Message ID | 20240208030702.27296-1-jdamato@fastly.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-57407-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2654922dyb; Wed, 7 Feb 2024 19:07:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/qlwVXCaJG0LbYujuvYw72VDrHrVWohNvSa3HmJZSHckoNTGWtwHoS7goP3Os9rZlhaLa X-Received: by 2002:a05:620a:5237:b0:785:8c58:e0bf with SMTP id dc55-20020a05620a523700b007858c58e0bfmr6894824qkb.61.1707361661873; Wed, 07 Feb 2024 19:07:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707361661; cv=pass; d=google.com; s=arc-20160816; b=Yi0ZCVa56PVnROU/5VyIqZi0huXd5XeFLN+jWanwTGtKeoHtawINn5cmJql7b4lj7U ZUSIsf3y/elcirH8WSU3p3cKf+kiFKiHN10ZnaoTrmSOFtLFth3CBHjZwsrH8RL8mCsA HjxVbQ0J5EF/ZeyMQhAbX19/MTn9FVEMlqTCDo4mdsgMpV3qBnXkRMkmyBzZc+SzNblX PnHzNtVN9GmWYpozCyovnw7RV4/eyRJggxk7+J2ZS7WqrKItg/wNrmmUFUrUK9PI7CZ6 mbvEXyblMF4818LPA7l6iDlob1LvQKJljinXlbZSyWQRkOOAwPEVNmQvB88LEZU64XoP IPPw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=egs7rCfpH1ftbki48KCuJAklsR0MNJ7M7ZSfGS5ub5U=; fh=kbunjhAN0btGWVjD0iII/kHgfJ+05DOfHFDjdEFR6Uw=; b=vwNbAzWhWWhb9GIxvFaSJKZw04NyGFuWif3qWgqagKh/HJ9EUCMDyeYOf8RGM95ZgP UCy0aSQRPF+UQEr3GICRyQky5hH2D0FhFPpsWIl6T5wHTG5uSCdpZjKZ1eWTwPn0Ofg1 yDBgxnccLBz4w2W9MirW9dwueKjHYoqwwFQr2kQGxpj2gRD5D2v0yeGGouoF018K6S2X M+b5OK4kqNTVCNtO0anePsl0lv4NmTf6/jWPxwKDdBpDQxk7wA9K91zl/ge3Rt1NyVsM wUwawRZtrGLNlYORLQkokEQDF11D9phJR6Ekyvp0YLUUdJRpAeN4zxnmE9MQ/gBSr973 4cHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=v05K2LjN; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-57407-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57407-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com X-Forwarded-Encrypted: i=2; AJvYcCWBJOeQjIe1mr6PEUxvkHxtUNiPwJW9NOjeWI9wns4GXzl3+6VfDgKlzJmFkmA+XoSi7hDrkzTkJfvluCJaDTagYlXchQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id vv22-20020a05620a563600b007858af9a0a4si2474626qkn.199.2024.02.07.19.07.41 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 19:07:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57407-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=v05K2LjN; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-57407-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57407-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 97CF01C22BE7 for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 03:07:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67BBF1DFC5; Thu, 8 Feb 2024 03:07:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="v05K2LjN" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A97381D525 for <linux-kernel@vger.kernel.org>; Thu, 8 Feb 2024 03:07:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707361631; cv=none; b=YjnNHoHbGFF92mmSQbh0IslqbzPzCga3qe7GFP2nIYmUk2DtNwnb8UKmleqDJUrw7x/ELhthwX/fcRzUuwYVJWOjki537JrRDOx3xJhbLbqZmUUI60wQ4yvjz2fq8+pSiBfPpaTq/H+N5AsoTCLkxfL1hwgYNqr3Tcsvovv8Z5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707361631; c=relaxed/simple; bh=Uh3Rm8V4VHsu71sBjaBczwz61EnKx5fFtPzxEMRZyvI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=QkPO4Txu3OGHaJ+QzlnI5hwP+YVtJrzzkCtuLJbZ/WYnzNl2BUbjeYXiBUKUzjT1WFbA2CZ+qRKRd0VVwmfQzmnfEyudcki00ZmPQ41HVuc/xHvRn48itYuurSd17xV9fgOjX8luPPpi2QBW+j9Cbds95jY0di4tl3hYgy+tjYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=v05K2LjN; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d780a392fdso12525445ad.3 for <linux-kernel@vger.kernel.org>; Wed, 07 Feb 2024 19:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1707361628; x=1707966428; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=egs7rCfpH1ftbki48KCuJAklsR0MNJ7M7ZSfGS5ub5U=; b=v05K2LjNf419fOZY8Hlm9F1vAYGv552eZ8LjB3QAZwNxzCWxAiapna16aDvXUurOCH 9kZIIT3tOXmE5xVMG0c6jYnbwX2GPV4aJzHqdTex24L0BPRZAAnXQXx0FhiB5Xq0yLqy nc9I3mCCyUqty+rNfFQ6Z0TxbWmNHMBUXBQNY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707361628; x=1707966428; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=egs7rCfpH1ftbki48KCuJAklsR0MNJ7M7ZSfGS5ub5U=; b=sDqjCY336y1f7ScPCmh1ZLA0BpvO/qhl2YroOzCeGya89tMrxshm70AZyEM7v3ImDy NBkzqfF4U132Vyl6sB4eUM5GwRsBKnjjjbwusHjrfDGO4c+yRe3u8UJ4Na34YdD7U5yV 3609q/cmTyZLFh+HJXeXrkhSYVulmLqkw9KTz9DQ/Hs0nz9mWr6G9Uw6KZE7gSVGrDdk DOlKquxQSxUwy90cNymSni4Xde6n1xpW08zFDQOuER6B2yQ4rdmlTcXDKf0JopO56iut oytUC66ACbsrDq1zBK6IoqxL0UTize+GZM1p9MWFzwXNzeqgt/c8sMw0NfD008330l5l FQeQ== X-Gm-Message-State: AOJu0YyiB3oErb6lr9bF9DbhLXeANS1ik2/vCmfU4TTWWCeagRLxSugW LVpgbPyKqWmSSBuvKNArqfh8ppEbWWM55lYsmyCGVTjMfJFDbpzTY69qFGzPQ20zpuUZsPwhSMq zQpp8/vGPJFwD6B44N136yXVPKeGyyvskHFL89gBfIbgIYzAyGk2cnJYe42KMkUCu6O/VJnPIYJ GmId5nWzhq8TpG/dO+yL2WA2xJ0uhb4vqkj77NYIzVQAXM1w== X-Received: by 2002:a17:902:6b44:b0:1d9:bc11:66e with SMTP id g4-20020a1709026b4400b001d9bc11066emr6196112plt.37.1707361628549; Wed, 07 Feb 2024 19:07:08 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWLLVbDAWkfFtyhSVVzh+qvy66GqylkUIRMroRtqJlDWxFeOc32pUB9RrPlUQyPQHQRsIEh7PCjqZYG9FT/j36boFo3nuhugbBy5NNz579ZY6vYDjR8jpJXPRxdTPZ3D+az1RklSBm1Y09QIYvUO/VyKE7LJTRMyRnHzjVW2PTdSsSSztuyIbCEf+5LlBC1NwF7ivTlCmtXDKFgwQraNBX96xDu3UOmSjROOfGxWCEYNoPzo11QOfbOdGgPDBchllmsEGaiTsKw3VOaBZej2Y7/b377piUFa8OF28Qto619MBsAVagNNwpbNMFE28Tj9u6bGGYxi81MfDA4uwItTZBdly95ViAD6ziwyRr1z6fZCj/iNhOmioMGkOa1eACs86sG9wWx0Blp9f/KYMdU24cinrZmGyLEBAcdkMS1/uvJHKjDO6bT Received: from localhost.localdomain ([2620:11a:c018:0:ea8:be91:8d1:f59b]) by smtp.gmail.com with ESMTPSA id q5-20020a170902c9c500b001d8b8bf8e44sm2235232pld.92.2024.02.07.19.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 19:07:08 -0800 (PST) From: Joe Damato <jdamato@fastly.com> To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: tariqt@nvidia.com, rrameshbabu@nvidia.com, Joe Damato <jdamato@fastly.com>, Saeed Mahameed <saeedm@nvidia.com>, Leon Romanovsky <leon@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Richard Cochran <richardcochran@gmail.com>, Gal Pressman <gal@nvidia.com>, Vadim Fedorenko <vadim.fedorenko@linux.dev>, linux-rdma@vger.kernel.org (open list:MELLANOX MLX5 core VPI driver) Subject: [PATCH net-next v3] net/mlx5e: link NAPI instances to queues and IRQs Date: Thu, 8 Feb 2024 03:07:00 +0000 Message-Id: <20240208030702.27296-1-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790298461544623366 X-GMAIL-MSGID: 1790298461544623366 |
Series |
[net-next,v3] net/mlx5e: link NAPI instances to queues and IRQs
|
|
Commit Message
Joe Damato
Feb. 8, 2024, 3:07 a.m. UTC
Make mlx5 compatible with the newly added netlink queue GET APIs.
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
v2 -> v3:
- Fix commit message subject
- call netif_queue_set_napi in mlx5e_ptp_activate_channel and
mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for
the PTP channel.
- Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set
NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including
QoS/HTB and PTP.
- Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for
better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI
structs
v1 -> v2:
- Move netlink NULL code to mlx5e_deactivate_channel
- Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the
irq, after netif_napi_add which itself sets the IRQ to -1
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 +++
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++
2 files changed, 10 insertions(+)
Comments
On Thu, 8 Feb 2024 03:07:00 +0000 Joe Damato wrote: > Make mlx5 compatible with the newly added netlink queue GET APIs. > > Signed-off-by: Joe Damato <jdamato@fastly.com> nVidia folks, I'm also waiting to use this, so I'd like to apply this directly. Please review.
On 08/02/2024 5:07, Joe Damato wrote: > Make mlx5 compatible with the newly added netlink queue GET APIs. > > Signed-off-by: Joe Damato <jdamato@fastly.com> > --- > v2 -> v3: > - Fix commit message subject > - call netif_queue_set_napi in mlx5e_ptp_activate_channel and > mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for > the PTP channel. > - Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set > NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including > QoS/HTB and PTP. > - Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for > better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI > structs > > v1 -> v2: > - Move netlink NULL code to mlx5e_deactivate_channel > - Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the > irq, after netif_napi_add which itself sets the IRQ to -1 > > drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 +++ > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > index 078f56a3cbb2..fbbc287d924d 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > @@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) > int tc; > > napi_enable(&c->napi); > + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, > + &c->napi); > > if (test_bit(MLX5E_PTP_STATE_TX, c->state)) { > for (tc = 0; tc < c->num_tc; tc++) > @@ -951,6 +953,7 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c) > mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq); > } > > + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, NULL); > napi_disable(&c->napi); > } > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > index c8e8f512803e..2f1792854dd5 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > @@ -1806,6 +1806,7 @@ void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq) > set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > netdev_tx_reset_queue(sq->txq); > netif_tx_start_queue(sq->txq); > + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, &sq->channel->napi); Might be called with channel==NULL. For example for PTP. Prefer sq->netdev and sq->cq.napi. > } > > void mlx5e_tx_disable_queue(struct netdev_queue *txq) > @@ -1819,6 +1820,7 @@ void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) > { > struct mlx5_wq_cyc *wq = &sq->wq; > > + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, NULL); Same here. > clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ > > @@ -2560,6 +2562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, > c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix); > > netif_napi_add(netdev, &c->napi, mlx5e_napi_poll); > + netif_napi_set_irq(&c->napi, irq); > > err = mlx5e_open_queues(c, params, cparam); > if (unlikely(err)) > @@ -2602,12 +2605,16 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c) > mlx5e_activate_xsk(c); > else > mlx5e_activate_rq(&c->rq); > + > + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, &c->napi); > } > > static void mlx5e_deactivate_channel(struct mlx5e_channel *c) > { > int tc; > > + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, NULL); > + > if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) > mlx5e_deactivate_xsk(c); > else
On Thu, Feb 08, 2024 at 09:13:25PM +0200, Tariq Toukan wrote: > > > On 08/02/2024 5:07, Joe Damato wrote: > >Make mlx5 compatible with the newly added netlink queue GET APIs. > > > >Signed-off-by: Joe Damato <jdamato@fastly.com> > >--- > >v2 -> v3: > > - Fix commit message subject > > - call netif_queue_set_napi in mlx5e_ptp_activate_channel and > > mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for > > the PTP channel. > > - Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set > > NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including > > QoS/HTB and PTP. > > - Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for > > better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI > > structs > > > >v1 -> v2: > > - Move netlink NULL code to mlx5e_deactivate_channel > > - Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the > > irq, after netif_napi_add which itself sets the IRQ to -1 > > > > drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 +++ > > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++ > > 2 files changed, 10 insertions(+) > > > >diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >index 078f56a3cbb2..fbbc287d924d 100644 > >--- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >@@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) > > int tc; > > napi_enable(&c->napi); > >+ netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, > >+ &c->napi); > > if (test_bit(MLX5E_PTP_STATE_TX, c->state)) { > > for (tc = 0; tc < c->num_tc; tc++) > >@@ -951,6 +953,7 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c) > > mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq); > > } > >+ netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, NULL); > > napi_disable(&c->napi); > > } > >diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >index c8e8f512803e..2f1792854dd5 100644 > >--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >@@ -1806,6 +1806,7 @@ void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq) > > set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > > netdev_tx_reset_queue(sq->txq); > > netif_tx_start_queue(sq->txq); > >+ netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, &sq->channel->napi); > > Might be called with channel==NULL. > For example for PTP. > > Prefer sq->netdev and sq->cq.napi. OK, I'll make that change for the v4 which I'll send sometime tomorrow. Thanks. > > } > > void mlx5e_tx_disable_queue(struct netdev_queue *txq) > >@@ -1819,6 +1820,7 @@ void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) > > { > > struct mlx5_wq_cyc *wq = &sq->wq; > >+ netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, NULL); > > Same here. > > > clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > > synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ > >@@ -2560,6 +2562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, > > c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix); > > netif_napi_add(netdev, &c->napi, mlx5e_napi_poll); > >+ netif_napi_set_irq(&c->napi, irq); > > err = mlx5e_open_queues(c, params, cparam); > > if (unlikely(err)) > >@@ -2602,12 +2605,16 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c) > > mlx5e_activate_xsk(c); > > else > > mlx5e_activate_rq(&c->rq); > >+ > >+ netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, &c->napi); > > } > > static void mlx5e_deactivate_channel(struct mlx5e_channel *c) > > { > > int tc; > >+ netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, NULL); > >+ > > if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) > > mlx5e_deactivate_xsk(c); > > else
On Thu, 08 Feb, 2024 21:13:25 +0200 Tariq Toukan <ttoukan.linux@gmail.com> wrote: > On 08/02/2024 5:07, Joe Damato wrote: >> Make mlx5 compatible with the newly added netlink queue GET APIs. >> Signed-off-by: Joe Damato <jdamato@fastly.com> >> --- Just came back from testing this code. Let me make one cosmetic point here. I noticed this patch has a line that is past 90 characters. Would be nice to get it wrapped in the next version. We use 90 instead of 80 characters for the line wrap in the mlx5 driver because of firmware command interface related code would lead to very hard to read lines if wrapped at 80. https://patchwork.kernel.org/project/netdevbpf/patch/20240208030702.27296-1-jdamato@fastly.com/ >> v2 -> v3: >> - Fix commit message subject >> - call netif_queue_set_napi in mlx5e_ptp_activate_channel and >> mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for >> the PTP channel. >> - Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set >> NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including >> QoS/HTB and PTP. >> - Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for >> better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI >> structs >> v1 -> v2: >> - Move netlink NULL code to mlx5e_deactivate_channel >> - Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the >> irq, after netif_napi_add which itself sets the IRQ to -1 >> drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 +++ >> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++ >> 2 files changed, 10 insertions(+) >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> index 078f56a3cbb2..fbbc287d924d 100644 >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> @@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) >> int tc; >> napi_enable(&c->napi); >> + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, >> + &c->napi); This should only be set if MLX5E_PTP_STATE_RX is set. Otherwise, the rq is not initialized. The following callgraph should help illustrate this. mlx5e_ptp_open |_ mlx5e_ptp_open_queues |_ mlx5e_ptp_open_rq |_ mlx5e_open_rq >> if (test_bit(MLX5E_PTP_STATE_TX, c->state)) { >> for (tc = 0; tc < c->num_tc; tc++) >> @@ -951,6 +953,7 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c) >> mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq); >> } >> + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, NULL); I believe it would be best to tie this to whether MLX5E_PTP_STATE_RX is set or not. >> napi_disable(&c->napi); >> } >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c >> b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c >> index c8e8f512803e..2f1792854dd5 100644 >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c >> @@ -1806,6 +1806,7 @@ void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq) >> set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); >> netdev_tx_reset_queue(sq->txq); >> netif_tx_start_queue(sq->txq); >> + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, &sq->channel->napi); > > Might be called with channel==NULL. > For example for PTP. > > Prefer sq->netdev and sq->cq.napi. > >> } >> void mlx5e_tx_disable_queue(struct netdev_queue *txq) >> @@ -1819,6 +1820,7 @@ void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) >> { >> struct mlx5_wq_cyc *wq = &sq->wq; >> + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, >> NETDEV_QUEUE_TYPE_TX, NULL); > > Same here. > >> clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); >> synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ >> @@ -2560,6 +2562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, >> int ix, >> c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix); >> netif_napi_add(netdev, &c->napi, mlx5e_napi_poll); >> + netif_napi_set_irq(&c->napi, irq); >> err = mlx5e_open_queues(c, params, cparam); >> if (unlikely(err)) >> @@ -2602,12 +2605,16 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c) >> mlx5e_activate_xsk(c); >> else >> mlx5e_activate_rq(&c->rq); >> + >> + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, &c->napi); >> } >> static void mlx5e_deactivate_channel(struct mlx5e_channel *c) >> { >> int tc; >> + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, NULL); >> + >> if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) >> mlx5e_deactivate_xsk(c); >> else -- Thanks, Rahul Rameshbabu
On Thu, Feb 08, 2024 at 08:43:57PM -0800, Rahul Rameshbabu wrote: > On Thu, 08 Feb, 2024 21:13:25 +0200 Tariq Toukan <ttoukan.linux@gmail.com> wrote: > > On 08/02/2024 5:07, Joe Damato wrote: > >> Make mlx5 compatible with the newly added netlink queue GET APIs. > >> Signed-off-by: Joe Damato <jdamato@fastly.com> > >> --- > > Just came back from testing this code. Let me make one cosmetic point > here. I noticed this patch has a line that is past 90 characters. Would > be nice to get it wrapped in the next version. We use 90 instead of 80 > characters for the line wrap in the mlx5 driver because of firmware > command interface related code would lead to very hard to read lines if > wrapped at 80. > > https://patchwork.kernel.org/project/netdevbpf/patch/20240208030702.27296-1-jdamato@fastly.com/ OK, I had wrapped them in the next version I was going to send to 80, but I'll adjust that to 90. > >> v2 -> v3: > >> - Fix commit message subject > >> - call netif_queue_set_napi in mlx5e_ptp_activate_channel and > >> mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for > >> the PTP channel. > >> - Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set > >> NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including > >> QoS/HTB and PTP. > >> - Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for > >> better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI > >> structs > >> v1 -> v2: > >> - Move netlink NULL code to mlx5e_deactivate_channel > >> - Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the > >> irq, after netif_napi_add which itself sets the IRQ to -1 > >> drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 +++ > >> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++ > >> 2 files changed, 10 insertions(+) > >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >> b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >> index 078f56a3cbb2..fbbc287d924d 100644 > >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c > >> @@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) > >> int tc; > >> napi_enable(&c->napi); > >> + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, > >> + &c->napi); > > This should only be set if MLX5E_PTP_STATE_RX is set. Otherwise, the rq > is not initialized. The following callgraph should help illustrate this. > > mlx5e_ptp_open > |_ mlx5e_ptp_open_queues > |_ mlx5e_ptp_open_rq > |_ mlx5e_open_rq I had made the change that Tariq had suggested in the previous message of using sq->netdev and sq->cq.napi, but I can also tie that into MLX5E_PTP_STATE_RX. I'll add this change as well, test locally again and resend shortly. > >> if (test_bit(MLX5E_PTP_STATE_TX, c->state)) { > >> for (tc = 0; tc < c->num_tc; tc++) > >> @@ -951,6 +953,7 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c) > >> mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq); > >> } > >> + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, NULL); > > I believe it would be best to tie this to whether MLX5E_PTP_STATE_RX is > set or not. > > >> napi_disable(&c->napi); > >> } > >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >> b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >> index c8e8f512803e..2f1792854dd5 100644 > >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > >> @@ -1806,6 +1806,7 @@ void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq) > >> set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > >> netdev_tx_reset_queue(sq->txq); > >> netif_tx_start_queue(sq->txq); > >> + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, &sq->channel->napi); > > > > Might be called with channel==NULL. > > For example for PTP. > > > > Prefer sq->netdev and sq->cq.napi. > > > >> } > >> void mlx5e_tx_disable_queue(struct netdev_queue *txq) > >> @@ -1819,6 +1820,7 @@ void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) > >> { > >> struct mlx5_wq_cyc *wq = &sq->wq; > >> + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, > >> NETDEV_QUEUE_TYPE_TX, NULL); > > > > Same here. > > > >> clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); > >> synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ > >> @@ -2560,6 +2562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, > >> int ix, > >> c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix); > >> netif_napi_add(netdev, &c->napi, mlx5e_napi_poll); > >> + netif_napi_set_irq(&c->napi, irq); > >> err = mlx5e_open_queues(c, params, cparam); > >> if (unlikely(err)) > >> @@ -2602,12 +2605,16 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c) > >> mlx5e_activate_xsk(c); > >> else > >> mlx5e_activate_rq(&c->rq); > >> + > >> + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, &c->napi); > >> } > >> static void mlx5e_deactivate_channel(struct mlx5e_channel *c) > >> { > >> int tc; > >> + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, NULL); > >> + > >> if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) > >> mlx5e_deactivate_xsk(c); > >> else > > -- > Thanks, > > Rahul Rameshbabu
On Fri, 09 Feb, 2024 11:24:04 -0800 Joe Damato <jdamato@fastly.com> wrote: > On Thu, Feb 08, 2024 at 08:43:57PM -0800, Rahul Rameshbabu wrote: >> On Thu, 08 Feb, 2024 21:13:25 +0200 Tariq Toukan <ttoukan.linux@gmail.com> wrote: >> > On 08/02/2024 5:07, Joe Damato wrote: >> >> Make mlx5 compatible with the newly added netlink queue GET APIs. >> >> Signed-off-by: Joe Damato <jdamato@fastly.com> >> >> --- >> >> Just came back from testing this code. Let me make one cosmetic point >> here. I noticed this patch has a line that is past 90 characters. Would >> be nice to get it wrapped in the next version. We use 90 instead of 80 >> characters for the line wrap in the mlx5 driver because of firmware >> command interface related code would lead to very hard to read lines if >> wrapped at 80. >> >> https://patchwork.kernel.org/project/netdevbpf/patch/20240208030702.27296-1-jdamato@fastly.com/ > > OK, I had wrapped them in the next version I was going to send to 80, but > I'll adjust that to 90. > >> >> v2 -> v3: >> >> - Fix commit message subject >> >> - call netif_queue_set_napi in mlx5e_ptp_activate_channel and >> >> mlx5e_ptp_deactivate_channel to enable/disable NETDEV_QUEUE_TYPE_RX for >> >> the PTP channel. >> >> - Modify mlx5e_activate_txqsq and mlx5e_deactivate_txqsq to set >> >> NETDEV_QUEUE_TYPE_TX which should take care of all TX queues including >> >> QoS/HTB and PTP. >> >> - Rearrange mlx5e_activate_channel and mlx5e_deactivate_channel for >> >> better ordering when setting and unsetting NETDEV_QUEUE_TYPE_RX NAPI >> >> structs >> >> v1 -> v2: >> >> - Move netlink NULL code to mlx5e_deactivate_channel >> >> - Move netif_napi_set_irq to mlx5e_open_channel and avoid storing the >> >> irq, after netif_napi_add which itself sets the IRQ to -1 >> >> drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 +++ >> >> drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 +++++++ >> >> 2 files changed, 10 insertions(+) >> >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> >> b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> >> index 078f56a3cbb2..fbbc287d924d 100644 >> >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c >> >> @@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) >> >> int tc; >> >> napi_enable(&c->napi); >> >> + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, >> >> + &c->napi); >> >> This should only be set if MLX5E_PTP_STATE_RX is set. Otherwise, the rq >> is not initialized. The following callgraph should help illustrate this. >> >> mlx5e_ptp_open >> |_ mlx5e_ptp_open_queues >> |_ mlx5e_ptp_open_rq >> |_ mlx5e_open_rq > > I had made the change that Tariq had suggested in the previous message of > using sq->netdev and sq->cq.napi, but I can also tie that into > MLX5E_PTP_STATE_RX. Right, Tariq's comments are needed for the TX queue associations and are needed as well. We also need to make sure we do not create an RX queue association for an RX queue that may not exist for this special PTP channel. > > I'll add this change as well, test locally again and resend shortly. > -- Thanks, Rahul Rameshbabu
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c index 078f56a3cbb2..fbbc287d924d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c @@ -927,6 +927,8 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c) int tc; napi_enable(&c->napi); + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, + &c->napi); if (test_bit(MLX5E_PTP_STATE_TX, c->state)) { for (tc = 0; tc < c->num_tc; tc++) @@ -951,6 +953,7 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c) mlx5e_deactivate_txqsq(&c->ptpsq[tc].txqsq); } + netif_queue_set_napi(c->netdev, c->rq.ix, NETDEV_QUEUE_TYPE_RX, NULL); napi_disable(&c->napi); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index c8e8f512803e..2f1792854dd5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1806,6 +1806,7 @@ void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq) set_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); netdev_tx_reset_queue(sq->txq); netif_tx_start_queue(sq->txq); + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, &sq->channel->napi); } void mlx5e_tx_disable_queue(struct netdev_queue *txq) @@ -1819,6 +1820,7 @@ void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq) { struct mlx5_wq_cyc *wq = &sq->wq; + netif_queue_set_napi(sq->channel->netdev, sq->txq_ix, NETDEV_QUEUE_TYPE_TX, NULL); clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state); synchronize_net(); /* Sync with NAPI to prevent netif_tx_wake_queue. */ @@ -2560,6 +2562,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix, c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix); netif_napi_add(netdev, &c->napi, mlx5e_napi_poll); + netif_napi_set_irq(&c->napi, irq); err = mlx5e_open_queues(c, params, cparam); if (unlikely(err)) @@ -2602,12 +2605,16 @@ static void mlx5e_activate_channel(struct mlx5e_channel *c) mlx5e_activate_xsk(c); else mlx5e_activate_rq(&c->rq); + + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, &c->napi); } static void mlx5e_deactivate_channel(struct mlx5e_channel *c) { int tc; + netif_queue_set_napi(c->netdev, c->ix, NETDEV_QUEUE_TYPE_RX, NULL); + if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state)) mlx5e_deactivate_xsk(c); else