From nobody Thu Dec 18 12:44:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0851CD13DE for ; Mon, 18 Sep 2023 22:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229628AbjIRWpO (ORCPT ); Mon, 18 Sep 2023 18:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjIRWpN (ORCPT ); Mon, 18 Sep 2023 18:45:13 -0400 X-Greylist: delayed 906 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Sep 2023 15:45:06 PDT Received: from s1-ba86.socketlabs.email-od.com (s1-ba86.socketlabs.email-od.com [142.0.186.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF7AC91 for ; Mon, 18 Sep 2023 15:45:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1695077107; x=1697669107; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date:subject:cc:to:from:x-thread-info:subject:to:from:cc:reply-to; bh=3ZMrNeKN62FSveMjc7T4KvcZT7aU10NEVwhrwfIClwc=; b=SOJ21ln7J3AF6p35MI1B8mGA1OqV76FCS6m3brSYZ3qkfik91+rXoa+K3yQ28l3diGLUqi+oON1dOCThGFREXToKIIPV/5Dc8v3HBuucBbFahZ9mJcrH0wolEHT6HqIUTFQ/fauYGGGK6qwbcqpCAPhB8Er/d51fAxdoLCUDNaY= X-Thread-Info: NDUwNC4xMi4xNWZkOTAwMDc1Y2E1MzQubGludXgta2VybmVsPXZnZXIua2VybmVsLm9yZw== Received: from r2.h.in.socketlabs.com (r2.h.in.socketlabs.com [142.0.180.12]) by mxrs4.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Mon, 18 Sep 2023 18:29:59 -0400 Received: from nalramli.com (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by r2.h.in.socketlabs.com with ESMTP; Mon, 18 Sep 2023 18:29:59 -0400 Received: from localhost.localdomain (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by nalramli.com (Postfix) with ESMTPS id 9248C2CE016A; Mon, 18 Sep 2023 18:29:58 -0400 (EDT) From: "Nabil S. Alramli" To: netdev@vger.kernel.org, saeedm@nvidia.com, saeed@kernel.org, kuba@kernel.org, davem@davemloft.net, tariqt@nvidia.com, linux-kernel@vger.kernel.org, leon@kernel.org Cc: jdamato@fastly.com, sbhogavilli@fastly.com, nalramli@fastly.com, "Nabil S. Alramli" Subject: [net-next RFC v2 1/4] mlx5: Add mlx5e_param to individual mlx5e_channel and preserve them through mlx5e_open_channels() Date: Mon, 18 Sep 2023 18:29:52 -0400 Message-Id: <20230918222955.2066-2-dev@nalramli.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230918222955.2066-1-dev@nalramli.com> References: <20230918222955.2066-1-dev@nalramli.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The mlx-5 driver currently has one global `struct mlx5e_param` for storing settings including coalescing ones which means that individual channels cannot have their own independent settings. This patch adds a `struct mlx5e_param` to each `struct mlx5e_channel`. The global settings have been preserved as well to continue to support global commands. Signed-off-by: Nabil S. Alramli --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 3 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 34 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/eth= ernet/mellanox/mlx5/core/en.h index 86f2690c5e01..3657839b88f8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -783,6 +783,7 @@ struct mlx5e_channel { DECLARE_BITMAP(state, MLX5E_CHANNEL_NUM_STATES); int ix; int cpu; + struct mlx5e_params params; /* channel specific params */ /* Sync between icosq recovery and XSK enable/disable. */ struct mutex icosq_recovery_lock; }; @@ -793,7 +794,7 @@ struct mlx5e_channels { struct mlx5e_channel **c; struct mlx5e_ptp *ptp; unsigned int num; - struct mlx5e_params params; + struct mlx5e_params params; /* global params */ }; =20 struct mlx5e_channel_stats { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/en_main.c index a2ae791538ed..a1578219187b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -2471,6 +2471,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv= , int ix, c->tstamp =3D &priv->tstamp; c->ix =3D ix; c->cpu =3D cpu; + c->params =3D *params; c->pdev =3D mlx5_core_dma_dev(priv->mdev); c->netdev =3D priv->netdev; c->mkey_be =3D cpu_to_be32(priv->mdev->mlx5e_res.hw_objs.mkey); @@ -2558,27 +2559,42 @@ int mlx5e_open_channels(struct mlx5e_priv *priv, struct mlx5e_channels *chs) { struct mlx5e_channel_param *cparam; + bool use_global_params =3D true; int err =3D -ENOMEM; int i; =20 chs->num =3D chs->params.num_channels; =20 + /* This check is necessary here in case chs =3D=3D priv->channels because= the allocation of + * chs->c will invalidate it + */ + if (priv->channels.c) + use_global_params =3D false; + chs->c =3D kcalloc(chs->num, sizeof(struct mlx5e_channel *), GFP_KERNEL); - cparam =3D kvzalloc(sizeof(struct mlx5e_channel_param), GFP_KERNEL); + cparam =3D kvmalloc(sizeof(*cparam), GFP_KERNEL); if (!chs->c || !cparam) goto err_free; =20 - err =3D mlx5e_build_channel_param(priv->mdev, &chs->params, priv->q_count= er, cparam); - if (err) - goto err_free; - for (i =3D 0; i < chs->num; i++) { struct xsk_buff_pool *xsk_pool =3D NULL; + struct mlx5e_params *params =3D NULL; + + /* If priv->channels.c is not NULL, then retain the original params */ + if (use_global_params) + params =3D &chs->params; + else + params =3D &priv->channels.c[i]->params; + + memset(cparam, 0, sizeof(*cparam)); + err =3D mlx5e_build_channel_param(priv->mdev, params, priv->q_counter, c= param); + if (err) + goto err_free; =20 - if (chs->params.xdp_prog) - xsk_pool =3D mlx5e_xsk_get_pool(&chs->params, chs->params.xsk, i); + if (params->xdp_prog) + xsk_pool =3D mlx5e_xsk_get_pool(params, params->xsk, i); =20 - err =3D mlx5e_open_channel(priv, i, &chs->params, cparam, xsk_pool, &chs= ->c[i]); + err =3D mlx5e_open_channel(priv, i, params, cparam, xsk_pool, &chs->c[i]= ); if (err) goto err_close_channels; } @@ -3115,6 +3131,7 @@ int mlx5e_open_locked(struct net_device *netdev) =20 set_bit(MLX5E_STATE_OPENED, &priv->state); =20 + priv->channels.c =3D NULL; err =3D mlx5e_open_channels(priv, &priv->channels); if (err) goto err_clear_state_opened_flag; @@ -5611,6 +5628,7 @@ int mlx5e_priv_init(struct mlx5e_priv *priv, priv->netdev =3D netdev; priv->max_nch =3D nch; priv->max_opened_tc =3D 1; + priv->channels.c =3D NULL; =20 if (!alloc_cpumask_var(&priv->scratchpad.cpumask, GFP_KERNEL)) return -ENOMEM; --=20 2.35.1 From nobody Thu Dec 18 12:44:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C93A8CD13DF for ; Mon, 18 Sep 2023 22:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbjIRWpV (ORCPT ); Mon, 18 Sep 2023 18:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbjIRWpT (ORCPT ); Mon, 18 Sep 2023 18:45:19 -0400 X-Greylist: delayed 911 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Sep 2023 15:45:12 PDT Received: from s1-ba86.socketlabs.email-od.com (s1-ba86.socketlabs.email-od.com [142.0.186.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3972A3 for ; Mon, 18 Sep 2023 15:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1695077113; x=1697669113; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date:subject:cc:to:from:x-thread-info:subject:to:from:cc:reply-to; bh=AoNgiqW2GYdLCwa5yhKQBqJzGNFkZjdvxpssRuQqoC4=; b=JoSZ7AxAQiBftRXDObGwGboXC5IJ3VR9ya2rb9x/YBtS37iZV0xYDanN6irqBxTY8D2MQ480cuT5Tr2hvMAqkSCGnrbcYpcA4JMV/x1wPV55XCwNYz5+pAy/CgFuaEgQTK3OGITepAnJeqnSMVNeb5agObWBs4wMmc8b2erYhDM= X-Thread-Info: NDUwNC4xMi4xNWZkOTAwMDc1Y2E1NGYubGludXgta2VybmVsPXZnZXIua2VybmVsLm9yZw== Received: from r2.h.in.socketlabs.com (r2.h.in.socketlabs.com [142.0.180.12]) by mxrs4.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Mon, 18 Sep 2023 18:30:00 -0400 Received: from nalramli.com (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by r2.h.in.socketlabs.com with ESMTP; Mon, 18 Sep 2023 18:29:59 -0400 Received: from localhost.localdomain (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by nalramli.com (Postfix) with ESMTPS id AF9EF2CE016B; Mon, 18 Sep 2023 18:29:58 -0400 (EDT) From: "Nabil S. Alramli" To: netdev@vger.kernel.org, saeedm@nvidia.com, saeed@kernel.org, kuba@kernel.org, davem@davemloft.net, tariqt@nvidia.com, linux-kernel@vger.kernel.org, leon@kernel.org Cc: jdamato@fastly.com, sbhogavilli@fastly.com, nalramli@fastly.com, "Nabil S. Alramli" Subject: [net-next RFC v2 2/4] mlx5: Add queue number parameter to mlx5e_safe_switch_params() Date: Mon, 18 Sep 2023 18:29:53 -0400 Message-Id: <20230918222955.2066-3-dev@nalramli.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230918222955.2066-1-dev@nalramli.com> References: <20230918222955.2066-1-dev@nalramli.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently mlx5e_safe_switch_params() does not take a queue number and assumes a global operation. This allows the function to handle individual channels. Note that Global operations reset the individual channel settings. Signed-off-by: Nabil S. Alramli --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 3 +- .../ethernet/mellanox/mlx5/core/en_dcbnl.c | 2 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 18 ++++---- .../net/ethernet/mellanox/mlx5/core/en_main.c | 42 +++++++++++++------ .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 2 +- 5 files changed, 42 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/eth= ernet/mellanox/mlx5/core/en.h index 3657839b88f8..ba8eb2b30251 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -1063,7 +1063,8 @@ int mlx5e_safe_reopen_channels(struct mlx5e_priv *pri= v); int mlx5e_safe_switch_params(struct mlx5e_priv *priv, struct mlx5e_params *new_params, mlx5e_fp_preactivate preactivate, - void *context, bool reset); + void *context, bool reset, + int queue); int mlx5e_update_tx_netdev_queues(struct mlx5e_priv *priv); int mlx5e_num_channels_changed_ctx(struct mlx5e_priv *priv, void *context); void mlx5e_activate_priv_channels(struct mlx5e_priv *priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/n= et/ethernet/mellanox/mlx5/core/en_dcbnl.c index 8705cffc747f..8c0704beb25c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c @@ -1159,7 +1159,7 @@ static int mlx5e_set_trust_state(struct mlx5e_priv *p= riv, u8 trust_state) =20 err =3D mlx5e_safe_switch_params(priv, &new_params, mlx5e_update_trust_state_hw, - &trust_state, reset); + &trust_state, reset, -1); =20 mutex_unlock(&priv->state_lock); =20 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers= /net/ethernet/mellanox/mlx5/core/en_ethtool.c index dff02434ff45..13e5838ff1ee 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -389,7 +389,7 @@ int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv, if (err) goto unlock; =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true, -1); =20 unlock: mutex_unlock(&priv->state_lock); @@ -489,7 +489,7 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv, =20 /* Switch to new channels, set new parameters and close old ones */ err =3D mlx5e_safe_switch_params(priv, &new_params, - mlx5e_num_channels_changed_ctx, NULL, true); + mlx5e_num_channels_changed_ctx, NULL, true, -1); =20 if (arfs_enabled) { int err2 =3D mlx5e_arfs_enable(priv->fs); @@ -684,7 +684,7 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, reset =3D false; } =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset, -1= ); =20 mutex_unlock(&priv->state_lock); return err; @@ -1893,7 +1893,7 @@ static int set_pflag_cqe_based_moder(struct net_devic= e *netdev, bool enable, else mlx5e_set_tx_cq_mode_params(&new_params, cq_period_mode); =20 - return mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true); + return mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true, -1); } =20 static int set_pflag_tx_cqe_based_moder(struct net_device *netdev, bool en= able) @@ -1935,10 +1935,10 @@ int mlx5e_modify_rx_cqe_compression_locked(struct m= lx5e_priv *priv, bool new_val new_params.ptp_rx =3D new_val; =20 if (new_params.ptp_rx =3D=3D priv->channels.params.ptp_rx) - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true, -1= ); else err =3D mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_= fs_ctx, - &new_params.ptp_rx, true); + &new_params.ptp_rx, true, -1); if (err) return err; =20 @@ -1996,7 +1996,7 @@ static int set_pflag_rx_striding_rq(struct net_device= *netdev, bool enable) MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_STRIDING_RQ, enable); mlx5e_set_rq_type(mdev, &new_params); =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true, -1); if (err) return err; =20 @@ -2041,7 +2041,7 @@ static int set_pflag_tx_mpwqe_common(struct net_devic= e *netdev, u32 flag, bool e =20 MLX5E_SET_PFLAG(&new_params, flag, enable); =20 - return mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true); + return mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true, -1); } =20 static int set_pflag_xdp_tx_mpwqe(struct net_device *netdev, bool enable) @@ -2094,7 +2094,7 @@ static int set_pflag_tx_port_ts(struct net_device *ne= tdev, bool enable) */ =20 err =3D mlx5e_safe_switch_params(priv, &new_params, - mlx5e_num_channels_changed_ctx, NULL, true); + mlx5e_num_channels_changed_ctx, NULL, true, -1); if (!err) priv->tx_ptp_opened =3D true; =20 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/en_main.c index a1578219187b..d7325fc4f2c0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3055,19 +3055,35 @@ static int mlx5e_switch_priv_channels(struct mlx5e_= priv *priv, int mlx5e_safe_switch_params(struct mlx5e_priv *priv, struct mlx5e_params *params, mlx5e_fp_preactivate preactivate, - void *context, bool reset) + void *context, bool reset, + int queue) { struct mlx5e_channels *new_chs; int err; + int i; + + if (queue =3D=3D -1) { + for (i =3D 0; i < priv->channels.num; i++) + priv->channels.c[i]->params =3D *params; + } else { + priv->channels.c[queue]->params =3D *params; + } =20 reset &=3D test_bit(MLX5E_STATE_OPENED, &priv->state); - if (!reset) - return mlx5e_switch_priv_params(priv, params, preactivate, context); + if (!reset) { + if (queue =3D=3D -1) + return mlx5e_switch_priv_params(priv, params, preactivate, context); + else + return 0; + } =20 new_chs =3D kzalloc(sizeof(*new_chs), GFP_KERNEL); if (!new_chs) return -ENOMEM; - new_chs->params =3D *params; + if (queue =3D=3D -1) + new_chs->params =3D *params; + else + new_chs->params =3D priv->channels.params; =20 mlx5e_selq_prepare_params(&priv->selq, &new_chs->params); =20 @@ -3093,7 +3109,7 @@ int mlx5e_safe_switch_params(struct mlx5e_priv *priv, =20 int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv) { - return mlx5e_safe_switch_params(priv, &priv->channels.params, NULL, NULL,= true); + return mlx5e_safe_switch_params(priv, &priv->channels.params, NULL, NULL,= true, -1); } =20 void mlx5e_timestamp_init(struct mlx5e_priv *priv) @@ -3486,7 +3502,7 @@ static int mlx5e_setup_tc_mqprio_dcb(struct mlx5e_pri= v *priv, mlx5e_params_mqprio_dcb_set(&new_params, tc ? tc : 1); =20 err =3D mlx5e_safe_switch_params(priv, &new_params, - mlx5e_num_channels_changed_ctx, NULL, true); + mlx5e_num_channels_changed_ctx, NULL, true, -1); =20 if (!err && priv->mqprio_rl) { mlx5e_mqprio_rl_cleanup(priv->mqprio_rl); @@ -3607,7 +3623,7 @@ static int mlx5e_setup_tc_mqprio_channel(struct mlx5e= _priv *priv, nch_changed =3D mlx5e_get_dcb_num_tc(&priv->channels.params) > 1; preactivate =3D nch_changed ? mlx5e_num_channels_changed_ctx : mlx5e_update_netdev_queues_ctx; - err =3D mlx5e_safe_switch_params(priv, &new_params, preactivate, NULL, tr= ue); + err =3D mlx5e_safe_switch_params(priv, &new_params, preactivate, NULL, tr= ue, -1); if (err) { if (rl) { mlx5e_mqprio_rl_cleanup(rl); @@ -3849,7 +3865,7 @@ static int set_feature_lro(struct net_device *netdev,= bool enable) } =20 err =3D mlx5e_safe_switch_params(priv, &new_params, - mlx5e_modify_tirs_packet_merge_ctx, NULL, reset); + mlx5e_modify_tirs_packet_merge_ctx, NULL, reset, -1); out: mutex_unlock(&priv->state_lock); return err; @@ -3877,7 +3893,7 @@ static int set_feature_hw_gro(struct net_device *netd= ev, bool enable) goto out; } =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset, -1= ); out: mutex_unlock(&priv->state_lock); return err; @@ -3975,7 +3991,7 @@ static int set_feature_rx_fcs(struct net_device *netd= ev, bool enable) new_params =3D chs->params; new_params.scatter_fcs_en =3D enable; err =3D mlx5e_safe_switch_params(priv, &new_params, mlx5e_set_rx_port_ts_= wrap, - &new_params.scatter_fcs_en, true); + &new_params.scatter_fcs_en, true, -1); mutex_unlock(&priv->state_lock); return err; } @@ -4349,7 +4365,7 @@ int mlx5e_change_mtu(struct net_device *netdev, int n= ew_mtu, reset =3D false; } =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, preactivate, NULL, re= set); + err =3D mlx5e_safe_switch_params(priv, &new_params, preactivate, NULL, re= set, -1); =20 out: netdev->mtu =3D params->sw_mtu; @@ -4400,7 +4416,7 @@ static int mlx5e_hwstamp_config_ptp_rx(struct mlx5e_p= riv *priv, bool ptp_rx) new_params =3D priv->channels.params; new_params.ptp_rx =3D ptp_rx; return mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs= _ctx, - &new_params.ptp_rx, true); + &new_params.ptp_rx, true, -1); } =20 int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) @@ -4831,7 +4847,7 @@ static int mlx5e_xdp_set(struct net_device *netdev, s= truct bpf_prog *prog) =20 old_prog =3D priv->channels.params.xdp_prog; =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset, -1= ); if (err) goto unlock; =20 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/driver= s/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index baa7ef812313..877719c4454a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -522,7 +522,7 @@ static int mlx5i_change_mtu(struct net_device *netdev, = int new_mtu) new_params =3D priv->channels.params; new_params.sw_mtu =3D new_mtu; =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, true, -1); if (err) goto out; =20 --=20 2.35.1 From nobody Thu Dec 18 12:44:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88127CD13DE for ; Mon, 18 Sep 2023 22:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbjIRWpe (ORCPT ); Mon, 18 Sep 2023 18:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjIRWp2 (ORCPT ); Mon, 18 Sep 2023 18:45:28 -0400 X-Greylist: delayed 918 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Sep 2023 15:45:20 PDT Received: from s1-ba86.socketlabs.email-od.com (s1-ba86.socketlabs.email-od.com [142.0.186.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E5B4121 for ; Mon, 18 Sep 2023 15:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1695077120; x=1697669120; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date:subject:cc:to:from:x-thread-info:subject:to:from:cc:reply-to; bh=0YsRXYBbuXnhWf+zWYyFmbZFXhPUlkNKfNdLVRBgGwg=; b=F6LonNziXG2aVeKKuNxx3Az74cvMdxIDRbikU/jQCrFIny9g2Tl0UYSk9Rft36KeHu/kuAO6+Rg3oCytzjvU9m84WxkRNCBRs6D9r0nrCLch0PwrGfp7Q6vqA3LG8ZN7UmtUpgeT5HBBbU5yYu5k7Brb7Ny3HJuB4aO7fzkV4+A= X-Thread-Info: NDUwNC4xMi4xNWZkOTAwMDc1Y2E1NzgubGludXgta2VybmVsPXZnZXIua2VybmVsLm9yZw== Received: from r1.h.in.socketlabs.com (r1.h.in.socketlabs.com [142.0.180.11]) by mxrs4.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Mon, 18 Sep 2023 18:30:00 -0400 Received: from nalramli.com (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by r1.h.in.socketlabs.com with ESMTP; Mon, 18 Sep 2023 18:29:59 -0400 Received: from localhost.localdomain (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by nalramli.com (Postfix) with ESMTPS id C51312CE016C; Mon, 18 Sep 2023 18:29:58 -0400 (EDT) From: "Nabil S. Alramli" To: netdev@vger.kernel.org, saeedm@nvidia.com, saeed@kernel.org, kuba@kernel.org, davem@davemloft.net, tariqt@nvidia.com, linux-kernel@vger.kernel.org, leon@kernel.org Cc: jdamato@fastly.com, sbhogavilli@fastly.com, nalramli@fastly.com, "Nabil S. Alramli" Subject: [net-next RFC v2 3/4] mlx5: Implement mlx5e_ethtool_{get,set}_per_queue_coalesce() to support per-queue operations Date: Mon, 18 Sep 2023 18:29:54 -0400 Message-Id: <20230918222955.2066-4-dev@nalramli.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230918222955.2066-1-dev@nalramli.com> References: <20230918222955.2066-1-dev@nalramli.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Implment two new methods, mlx5e_ethtool_get_per_queue_coalesce() and mlx5e_ethtool_set_per_queue_coalesce() and update global coalescing request handlers to call into them for an extra level of indirection to allow support for per-queue operations. Signed-off-by: Nabil S. Alramli --- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 152 +++++++++++++----- 1 file changed, 112 insertions(+), 40 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers= /net/ethernet/mellanox/mlx5/core/en_ethtool.c index 13e5838ff1ee..daa0aa833a42 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -513,33 +513,55 @@ static int mlx5e_set_channels(struct net_device *dev, return mlx5e_ethtool_set_channels(priv, ch); } =20 -int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv, +static int mlx5e_ethtool_get_per_queue_coalesce(struct mlx5e_priv *priv, + int queue, struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal) { struct dim_cq_moder *rx_moder, *tx_moder; + struct mlx5e_params *params; =20 if (!MLX5_CAP_GEN(priv->mdev, cq_moderation)) return -EOPNOTSUPP; =20 - rx_moder =3D &priv->channels.params.rx_cq_moderation; + if (queue !=3D -1 && queue >=3D priv->channels.num) { + netdev_err(priv->netdev, "%s: Invalid queue ID [%d]", + __func__, queue); + return -EINVAL; + } + + if (queue =3D=3D -1) + params =3D &priv->channels.params; + else + params =3D &priv->channels.c[queue]->params; + + rx_moder =3D ¶ms->rx_cq_moderation; coal->rx_coalesce_usecs =3D rx_moder->usec; coal->rx_max_coalesced_frames =3D rx_moder->pkts; - coal->use_adaptive_rx_coalesce =3D priv->channels.params.rx_dim_enabled; + coal->use_adaptive_rx_coalesce =3D params->rx_dim_enabled; =20 - tx_moder =3D &priv->channels.params.tx_cq_moderation; + tx_moder =3D ¶ms->tx_cq_moderation; coal->tx_coalesce_usecs =3D tx_moder->usec; coal->tx_max_coalesced_frames =3D tx_moder->pkts; - coal->use_adaptive_tx_coalesce =3D priv->channels.params.tx_dim_enabled; + coal->use_adaptive_tx_coalesce =3D params->tx_dim_enabled; =20 - kernel_coal->use_cqe_mode_rx =3D - MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_BASED_MODER); - kernel_coal->use_cqe_mode_tx =3D - MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_TX_CQE_BASED_MODER); + if (kernel_coal) { + kernel_coal->use_cqe_mode_rx =3D + MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_BASED_MODER); + kernel_coal->use_cqe_mode_tx =3D + MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_TX_CQE_BASED_MODER); + } =20 return 0; } =20 +int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv, + struct ethtool_coalesce *coal, + struct kernel_ethtool_coalesce *kernel_coal) +{ + return mlx5e_ethtool_get_per_queue_coalesce(priv, -1, coal, kernel_coal); +} + static int mlx5e_get_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, @@ -554,32 +576,55 @@ static int mlx5e_get_coalesce(struct net_device *netd= ev, #define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT =20 static void -mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, struct ethtoo= l_coalesce *coal) +mlx5e_set_priv_channels_tx_coalesce(struct mlx5e_priv *priv, + int queue, + struct ethtool_coalesce *coal) { struct mlx5_core_dev *mdev =3D priv->mdev; int tc; int i; =20 - for (i =3D 0; i < priv->channels.num; ++i) { - struct mlx5e_channel *c =3D priv->channels.c[i]; + if (queue =3D=3D -1) { + for (i =3D 0; i < priv->channels.num; ++i) { + struct mlx5e_channel *c =3D priv->channels.c[i]; + + for (tc =3D 0; tc < c->num_tc; tc++) { + mlx5_core_modify_cq_moderation(mdev, + &c->sq[tc].cq.mcq, + coal->tx_coalesce_usecs, + coal->tx_max_coalesced_frames); + } + } + } else { + struct mlx5e_channel *c =3D priv->channels.c[queue]; =20 for (tc =3D 0; tc < c->num_tc; tc++) { mlx5_core_modify_cq_moderation(mdev, - &c->sq[tc].cq.mcq, - coal->tx_coalesce_usecs, - coal->tx_max_coalesced_frames); + &c->sq[tc].cq.mcq, + coal->tx_coalesce_usecs, + coal->tx_max_coalesced_frames); } } } =20 static void -mlx5e_set_priv_channels_rx_coalesce(struct mlx5e_priv *priv, struct ethtoo= l_coalesce *coal) +mlx5e_set_priv_channels_rx_coalesce(struct mlx5e_priv *priv, + int queue, + struct ethtool_coalesce *coal) { struct mlx5_core_dev *mdev =3D priv->mdev; int i; =20 - for (i =3D 0; i < priv->channels.num; ++i) { - struct mlx5e_channel *c =3D priv->channels.c[i]; + if (queue =3D=3D -1) { + for (i =3D 0; i < priv->channels.num; ++i) { + struct mlx5e_channel *c =3D priv->channels.c[i]; + + mlx5_core_modify_cq_moderation(mdev, &c->rq.cq.mcq, + coal->rx_coalesce_usecs, + coal->rx_max_coalesced_frames); + } + } else { + struct mlx5e_channel *c =3D priv->channels.c[queue]; =20 mlx5_core_modify_cq_moderation(mdev, &c->rq.cq.mcq, coal->rx_coalesce_usecs, @@ -596,15 +641,17 @@ static int cqe_mode_to_period_mode(bool val) return val ? MLX5_CQ_PERIOD_MODE_START_FROM_CQE : MLX5_CQ_PERIOD_MODE_STA= RT_FROM_EQE; } =20 -int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, +static int mlx5e_ethtool_set_per_queue_coalesce(struct mlx5e_priv *priv, + int queue, struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, struct netlink_ext_ack *extack) { struct dim_cq_moder *rx_moder, *tx_moder; struct mlx5_core_dev *mdev =3D priv->mdev; - struct mlx5e_params new_params; - bool reset_rx, reset_tx; + bool reset_rx =3D false, reset_tx =3D false; + struct mlx5e_params new_params =3D {0}; + struct mlx5e_params *old_params; bool reset =3D true; u8 cq_period_mode; int err =3D 0; @@ -626,14 +673,29 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *pri= v, return -ERANGE; } =20 - if ((kernel_coal->use_cqe_mode_rx || kernel_coal->use_cqe_mode_tx) && - !MLX5_CAP_GEN(priv->mdev, cq_period_start_from_cqe)) { - NL_SET_ERR_MSG_MOD(extack, "cqe_mode_rx/tx is not supported on this devi= ce"); - return -EOPNOTSUPP; + if (kernel_coal) { + if ((kernel_coal->use_cqe_mode_rx || kernel_coal->use_cqe_mode_tx) && + !MLX5_CAP_GEN(priv->mdev, cq_period_start_from_cqe)) { + NL_SET_ERR_MSG_MOD(extack, + "cqe_mode_rx/tx is not supported on this device"); + return -EOPNOTSUPP; + } + } + + if (queue !=3D -1 && queue >=3D priv->channels.num) { + netdev_err(priv->netdev, "%s: Invalid queue ID [%d]", + __func__, queue); + return -EINVAL; } =20 mutex_lock(&priv->state_lock); - new_params =3D priv->channels.params; + + if (queue =3D=3D -1) + old_params =3D &priv->channels.params; + else + old_params =3D &priv->channels.c[queue]->params; + + new_params =3D *old_params; =20 rx_moder =3D &new_params.rx_cq_moderation; rx_moder->usec =3D coal->rx_coalesce_usecs; @@ -645,19 +707,21 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *pri= v, tx_moder->pkts =3D coal->tx_max_coalesced_frames; new_params.tx_dim_enabled =3D !!coal->use_adaptive_tx_coalesce; =20 - reset_rx =3D !!coal->use_adaptive_rx_coalesce !=3D priv->channels.params.= rx_dim_enabled; - reset_tx =3D !!coal->use_adaptive_tx_coalesce !=3D priv->channels.params.= tx_dim_enabled; + reset_rx =3D !!coal->use_adaptive_rx_coalesce !=3D old_params->rx_dim_ena= bled; + reset_tx =3D !!coal->use_adaptive_tx_coalesce !=3D old_params->tx_dim_ena= bled; =20 - cq_period_mode =3D cqe_mode_to_period_mode(kernel_coal->use_cqe_mode_rx); - if (cq_period_mode !=3D rx_moder->cq_period_mode) { - mlx5e_set_rx_cq_mode_params(&new_params, cq_period_mode); - reset_rx =3D true; - } + if (kernel_coal) { + cq_period_mode =3D cqe_mode_to_period_mode(kernel_coal->use_cqe_mode_rx); + if (cq_period_mode !=3D rx_moder->cq_period_mode) { + mlx5e_set_rx_cq_mode_params(&new_params, cq_period_mode); + reset_rx =3D true; + } =20 - cq_period_mode =3D cqe_mode_to_period_mode(kernel_coal->use_cqe_mode_tx); - if (cq_period_mode !=3D tx_moder->cq_period_mode) { - mlx5e_set_tx_cq_mode_params(&new_params, cq_period_mode); - reset_tx =3D true; + cq_period_mode =3D cqe_mode_to_period_mode(kernel_coal->use_cqe_mode_tx); + if (cq_period_mode !=3D tx_moder->cq_period_mode) { + mlx5e_set_tx_cq_mode_params(&new_params, cq_period_mode); + reset_tx =3D true; + } } =20 if (reset_rx) { @@ -678,18 +742,26 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *pri= v, */ if (!reset_rx && !reset_tx && test_bit(MLX5E_STATE_OPENED, &priv->state))= { if (!coal->use_adaptive_rx_coalesce) - mlx5e_set_priv_channels_rx_coalesce(priv, coal); + mlx5e_set_priv_channels_rx_coalesce(priv, queue, coal); if (!coal->use_adaptive_tx_coalesce) - mlx5e_set_priv_channels_tx_coalesce(priv, coal); + mlx5e_set_priv_channels_tx_coalesce(priv, queue, coal); reset =3D false; } =20 - err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset, -1= ); + err =3D mlx5e_safe_switch_params(priv, &new_params, NULL, NULL, reset, qu= eue); =20 mutex_unlock(&priv->state_lock); return err; } =20 +int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, + struct ethtool_coalesce *coal, + struct kernel_ethtool_coalesce *kernel_coal, + struct netlink_ext_ack *extack) +{ + return mlx5e_ethtool_set_per_queue_coalesce(priv, -1, coal, kernel_coal, = extack); +} + static int mlx5e_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coal, struct kernel_ethtool_coalesce *kernel_coal, --=20 2.35.1 From nobody Thu Dec 18 12:44:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DAE4CD13DE for ; Mon, 18 Sep 2023 22:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjIRWpa (ORCPT ); Mon, 18 Sep 2023 18:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbjIRWpZ (ORCPT ); Mon, 18 Sep 2023 18:45:25 -0400 X-Greylist: delayed 916 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Sep 2023 15:45:18 PDT Received: from s1-ba86.socketlabs.email-od.com (s1-ba86.socketlabs.email-od.com [142.0.186.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C98FF for ; Mon, 18 Sep 2023 15:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1695077119; x=1697669119; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date:subject:cc:to:from:x-thread-info:subject:to:from:cc:reply-to; bh=civKVjUZdeRQiNd2Nurlx+U4cUAHpte7hLrL1+ny2CY=; b=ESM+AJzUjX3KV6WcNtaMHDRQJrl0e15n6DJ3Ti5ecyxNt2Kv6sxfYBBVSBDc/SMPuUFyssdKsTvpWjrapNLVCQQjoGFFKPC+595OZAF6W5RMnlGeLKlsUFA7/3NYaRAec/VaqDn9A7gePOD0OsUq9YMvkIOQLeUkzp2wt8Q/+H8= X-Thread-Info: NDUwNC4xMi4xNWZkOTAwMDc1Y2E1NjQubGludXgta2VybmVsPXZnZXIua2VybmVsLm9yZw== Received: from r3.h.in.socketlabs.com (r3.h.in.socketlabs.com [142.0.180.13]) by mxrs4.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Mon, 18 Sep 2023 18:30:00 -0400 Received: from nalramli.com (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by r3.h.in.socketlabs.com with ESMTP; Mon, 18 Sep 2023 18:29:59 -0400 Received: from localhost.localdomain (d14-69-55-117.try.wideopenwest.com [69.14.117.55]) by nalramli.com (Postfix) with ESMTPS id D2D4E2CE016D; Mon, 18 Sep 2023 18:29:58 -0400 (EDT) From: "Nabil S. Alramli" To: netdev@vger.kernel.org, saeedm@nvidia.com, saeed@kernel.org, kuba@kernel.org, davem@davemloft.net, tariqt@nvidia.com, linux-kernel@vger.kernel.org, leon@kernel.org Cc: jdamato@fastly.com, sbhogavilli@fastly.com, nalramli@fastly.com, "Nabil S. Alramli" Subject: [net-next RFC v2 4/4] mlx5: Add {get,set}_per_queue_coalesce() Date: Mon, 18 Sep 2023 18:29:55 -0400 Message-Id: <20230918222955.2066-5-dev@nalramli.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230918222955.2066-1-dev@nalramli.com> References: <20230918222955.2066-1-dev@nalramli.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The mlx-5 driver currently only implements querying or modifying coalesce configurations globally. It does not allow per-queue operations. This change is to implement per-queue coalesce operations in the driver. Signed-off-by: Nabil S. Alramli --- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 46 +++++++++++++++++-- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers= /net/ethernet/mellanox/mlx5/core/en_ethtool.c index daa0aa833a42..492c03c3d5f4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -515,8 +515,8 @@ static int mlx5e_set_channels(struct net_device *dev, =20 static int mlx5e_ethtool_get_per_queue_coalesce(struct mlx5e_priv *priv, int queue, - struct ethtool_coalesce *coal, - struct kernel_ethtool_coalesce *kernel_coal) + struct ethtool_coalesce *coal, + struct kernel_ethtool_coalesce *kernel_coal) { struct dim_cq_moder *rx_moder, *tx_moder; struct mlx5e_params *params; @@ -572,6 +572,23 @@ static int mlx5e_get_coalesce(struct net_device *netde= v, return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal); } =20 +/** + * mlx5e_get_per_queue_coalesce - gets coalesce settings for particular qu= eue + * @netdev: netdev structure + * @coal: ethtool's coalesce settings + * @queue: the particular queue to read + * + * Reads a specific queue's coalesce settings + **/ +static int mlx5e_get_per_queue_coalesce(struct net_device *netdev, + u32 queue, + struct ethtool_coalesce *coal) +{ + struct mlx5e_priv *priv =3D netdev_priv(netdev); + + return mlx5e_ethtool_get_per_queue_coalesce(priv, queue, coal, NULL); +} + #define MLX5E_MAX_COAL_TIME MLX5_MAX_CQ_PERIOD #define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT =20 @@ -643,9 +660,9 @@ static int cqe_mode_to_period_mode(bool val) =20 static int mlx5e_ethtool_set_per_queue_coalesce(struct mlx5e_priv *priv, int queue, - struct ethtool_coalesce *coal, - struct kernel_ethtool_coalesce *kernel_coal, - struct netlink_ext_ack *extack) + struct ethtool_coalesce *coal, + struct kernel_ethtool_coalesce *kernel_coal, + struct netlink_ext_ack *extack) { struct dim_cq_moder *rx_moder, *tx_moder; struct mlx5_core_dev *mdev =3D priv->mdev; @@ -772,6 +789,23 @@ static int mlx5e_set_coalesce(struct net_device *netde= v, return mlx5e_ethtool_set_coalesce(priv, coal, kernel_coal, extack); } =20 +/** + * mlx5e_set_per_queue_coalesce - set specific queue's coalesce settings + * @netdev: the netdev to change + * @coal: ethtool's coalesce settings + * @queue: the queue to change + * + * Sets the specified queue's coalesce settings. + **/ +static int mlx5e_set_per_queue_coalesce(struct net_device *netdev, + u32 queue, + struct ethtool_coalesce *coal) +{ + struct mlx5e_priv *priv =3D netdev_priv(netdev); + + return mlx5e_ethtool_set_per_queue_coalesce(priv, queue, coal, NULL, NULL= ); +} + static void ptys2ethtool_supported_link(struct mlx5_core_dev *mdev, unsigned long *supported_modes, u32 eth_proto_cap) @@ -2506,6 +2540,8 @@ const struct ethtool_ops mlx5e_ethtool_ops =3D { .flash_device =3D mlx5e_flash_device, .get_priv_flags =3D mlx5e_get_priv_flags, .set_priv_flags =3D mlx5e_set_priv_flags, + .get_per_queue_coalesce =3D mlx5e_get_per_queue_coalesce, + .set_per_queue_coalesce =3D mlx5e_set_per_queue_coalesce, .self_test =3D mlx5e_self_test, .get_fec_stats =3D mlx5e_get_fec_stats, .get_fecparam =3D mlx5e_get_fecparam, --=20 2.35.1