]> www.infradead.org Git - nvme.git/commitdiff
eth: bnxt: allow deleting RSS contexts when the device is down
authorJakub Kicinski <kuba@kernel.org>
Thu, 11 Jul 2024 22:07:05 +0000 (15:07 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 13 Jul 2024 05:16:22 +0000 (22:16 -0700)
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.

Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://patch.msgid.link/20240711220713.283778-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c

index 80fce0aaad665e8e96f5e126d8dad28d6fa9449f..e8965cf743fc3942a64ba993cf830e97af4288e9 100644 (file)
@@ -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;
index 4d53ec7adc6154f79b4ad64b7133db1715c859a5..846a19b5f58d1f70e8bd3a769d17bf82ec553e67 100644 (file)
@@ -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;
                }