netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	ecree.xilinx@gmail.com, michael.chan@broadcom.com,
	horms@kernel.org, pavan.chebbi@broadcom.com,
	przemyslaw.kitszel@intel.com, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 03/11] eth: bnxt: allow deleting RSS contexts when the device is down
Date: Thu, 11 Jul 2024 15:07:05 -0700	[thread overview]
Message-ID: <20240711220713.283778-4-kuba@kernel.org> (raw)
In-Reply-To: <20240711220713.283778-1-kuba@kernel.org>

Contexts get deleted from FW when the device is down, but they
are kept in SW and re-added back on open. bnxt_set_rxfh_context()
apparently does not want to deal with complexity of dealing with
both the device down and device up cases. This is perhaps acceptable
for creating new contexts, but not being able to delete contexts
makes core-driven cleanups messy. Specifically with the new RSS
API core will try to delete contexts automatically after bringing
the device down.

Support the delete-while-down case. Skip the FW logic and delete
just the driver state.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c         | 10 ++++++----
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 80fce0aaad66..e8965cf743fc 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -10210,10 +10210,12 @@ void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx,
 	struct bnxt_ntuple_filter *ntp_fltr;
 	int i;
 
-	bnxt_hwrm_vnic_free_one(bp, &rss_ctx->vnic);
-	for (i = 0; i < BNXT_MAX_CTX_PER_VNIC; i++) {
-		if (vnic->fw_rss_cos_lb_ctx[i] != INVALID_HW_RING_ID)
-			bnxt_hwrm_vnic_ctx_free_one(bp, vnic, i);
+	if (netif_running(bp->dev)) {
+		bnxt_hwrm_vnic_free_one(bp, &rss_ctx->vnic);
+		for (i = 0; i < BNXT_MAX_CTX_PER_VNIC; i++) {
+			if (vnic->fw_rss_cos_lb_ctx[i] != INVALID_HW_RING_ID)
+				bnxt_hwrm_vnic_ctx_free_one(bp, vnic, i);
+		}
 	}
 	if (!all)
 		return;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 4d53ec7adc61..846a19b5f58d 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1874,6 +1874,7 @@ static int bnxt_set_rxfh_context(struct bnxt *bp,
 	struct bnxt_rss_ctx *rss_ctx;
 	struct bnxt_vnic_info *vnic;
 	bool modify = false;
+	bool delete;
 	int bit_id;
 	int rc;
 
@@ -1882,7 +1883,8 @@ static int bnxt_set_rxfh_context(struct bnxt *bp,
 		return -EOPNOTSUPP;
 	}
 
-	if (!netif_running(bp->dev)) {
+	delete = *rss_context != ETH_RXFH_CONTEXT_ALLOC && rxfh->rss_delete;
+	if (!netif_running(bp->dev) && !delete) {
 		NL_SET_ERR_MSG_MOD(extack, "Unable to set RSS contexts when interface is down");
 		return -EAGAIN;
 	}
@@ -1894,7 +1896,7 @@ static int bnxt_set_rxfh_context(struct bnxt *bp,
 					       *rss_context);
 			return -EINVAL;
 		}
-		if (*rss_context && rxfh->rss_delete) {
+		if (delete) {
 			bnxt_del_one_rss_ctx(bp, rss_ctx, true);
 			return 0;
 		}
-- 
2.45.2


  parent reply	other threads:[~2024-07-11 22:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 22:07 [PATCH net-next 00/11] eth: bnxt: use the new RSS API Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 01/11] net: ethtool: let drivers remove lost RSS contexts Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 02/11] net: ethtool: let drivers declare max size of RSS indir table and key Jakub Kicinski
2024-07-11 22:07 ` Jakub Kicinski [this message]
2024-07-11 22:07 ` [PATCH net-next 04/11] eth: bnxt: move from .set_rxfh to .create_rxfh_context and friends Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 05/11] eth: bnxt: remove rss_ctx_bmap Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 06/11] eth: bnxt: depend on core cleaning up RSS contexts Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 07/11] eth: bnxt: use context priv for struct bnxt_rss_ctx Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 08/11] eth: bnxt: use the RSS context XArray instead of the local list Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 09/11] eth: bnxt: pad out the correct indirection table Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 10/11] eth: bnxt: bump the entry size in indir tables to u32 Jakub Kicinski
2024-07-11 22:07 ` [PATCH net-next 11/11] eth: bnxt: use the indir table from ethtool context Jakub Kicinski
2024-07-12  5:08 ` [PATCH net-next 00/11] eth: bnxt: use the new RSS API Pavan Chebbi
2024-07-13  5:30 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2024-07-02 23:47 Jakub Kicinski
2024-07-02 23:47 ` [PATCH net-next 03/11] eth: bnxt: allow deleting RSS contexts when the device is down Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240711220713.283778-4-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).