Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp444518rdb; Mon, 18 Sep 2023 23:11:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfH+oP2WZmLpMrQXf/YSOYZ8ap4K2KZDwym9Gz827tUifS5CwDZMlHs8VdSqwGrw29jka5 X-Received: by 2002:a17:90a:bb03:b0:267:eefe:d0b5 with SMTP id u3-20020a17090abb0300b00267eefed0b5mr9932017pjr.46.1695103897511; Mon, 18 Sep 2023 23:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695103897; cv=none; d=google.com; s=arc-20160816; b=NFFnpdME54q0kpFI0zEbSwcYgIwJJ8aV27D5Oq7JYb4Px2NGgJ+9b37dMF9ayDphZ/ 1OqBnDC5KoyPKrEYO7pqz/sjFUQQhJXQYpBhZcviRMmsZbnsBdxQKrj0sTDUCPwogUFq JCmLIqBBIjZ8jr/6EvDSRu1zee+mhvXOKQHy7HAOBwaPL0mv8jpaJRqc4Q2ndk8VEiwm PV+cLpcN+V6gPb9naEqlK6w0I47tTDw1kB0SmK5F2wiFCIQMVAJxzA4MkcyVSNJhz7in 0MMdxaRkH9XxgZRkRKQ7UYfyR7P7+gftGzh4x6zvHUb1tTlEXen7pvo+Cp6K9gtmfHbn RyUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=civKVjUZdeRQiNd2Nurlx+U4cUAHpte7hLrL1+ny2CY=; fh=TtX9qxEdI0u3e0LGhsCtlCN+kXyJXp3ICREwEmULsIQ=; b=LHTplnNHOHLU6cim48/hadVLdL/2cILLjo6Qyb0jIz4+zdxT89SAU3kXHBFyOIhj/N ChrYsq1BEOQcunNsiiI/r5G5o/sbOaBb5r7eHDMZ2/mX6TmLSO4YUlF3huFX/C6+wfNv pAJ3vcB6Dcb9mUwe6l1ceq5WqlH2myuZj5fw0Ii2f+eChipCDLcjQBAU2u88NLRcHvkb iUUe+SQYtJs9sSMd9wMOt1qLqURPKuedMY4XvL5OTHgJJz0GfqMtn2LYD8hebPXeSpj0 l8xLbkas+MD5d/HaR6t1hYkU5J8YP1Ki93tRWbZPxkuMebcQOENBJ7ZPnjD1VlsqjXHF u98g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@email-od.com header.s=dkim header.b=ESM+AJzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b005703b492a23si786145pgb.308.2023.09.18.23.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 23:11:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@email-od.com header.s=dkim header.b=ESM+AJzU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 32A7481F06AA; Mon, 18 Sep 2023 15:45:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbjIRWp3 (ORCPT + 99 others); Mon, 18 Sep 2023 18:45:29 -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 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 18 Sep 2023 15:45:51 -0700 (PDT) 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/drive= rs/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 *net= dev, return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal); } =20 +/** + * mlx5e_get_per_queue_coalesce - gets coalesce settings for particular = queue + * @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 *net= dev, 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, NU= LL); +} + 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