bnxt_en: stop packet flow during bnxt_queue_stop/start
authorDavid Wei <dw@davidwei.uk>
Thu, 8 Aug 2024 05:15:17 +0000 (22:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 11 Aug 2024 12:48:02 +0000 (13:48 +0100)
The current implementation when resetting a queue while packets are
flowing puts the queue into an inconsistent state.

There needs to be some synchronisation with the FW. Add calls to
bnxt_hwrm_vnic_update() to set the MRU for both the default and ntuple
vnic during queue start/stop. When the MRU is set to 0, flow is stopped.
Each Rx queue belongs to either the default or the ntuple vnic.

With calling bnxt_hwrm_vnic_update() the calls to napi_enable() and
napi_disable() must be removed for reset to work on a queue that has
active traffic flowing e.g. iperf3.

Co-developed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: David Wei <dw@davidwei.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 10ca0ed..e1eadab 100644 (file)
@@ -15177,7 +15177,8 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_rx_ring_info *rxr, *clone;
        struct bnxt_cp_ring_info *cpr;
-       int rc;
+       struct bnxt_vnic_info *vnic;
+       int i, rc;
 
        rxr = &bp->rx_ring[idx];
        clone = qmem;
@@ -15202,11 +15203,16 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
        if (bp->flags & BNXT_FLAG_AGG_RINGS)
                bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod);
 
-       napi_enable(&rxr->bnapi->napi);
-
        cpr = &rxr->bnapi->cp_ring;
        cpr->sw_stats->rx.rx_resets++;
 
+       for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) {
+               vnic = &bp->vnic_info[i];
+               vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN;
+               bnxt_hwrm_vnic_update(bp, vnic,
+                                     VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
+       }
+
        return 0;
 
 err_free_hwrm_rx_ring:
@@ -15218,9 +15224,17 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
 {
        struct bnxt *bp = netdev_priv(dev);
        struct bnxt_rx_ring_info *rxr;
+       struct bnxt_vnic_info *vnic;
+       int i;
+
+       for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) {
+               vnic = &bp->vnic_info[i];
+               vnic->mru = 0;
+               bnxt_hwrm_vnic_update(bp, vnic,
+                                     VNIC_UPDATE_REQ_ENABLES_MRU_VALID);
+       }
 
        rxr = &bp->rx_ring[idx];
-       napi_disable(&rxr->bnapi->napi);
        bnxt_hwrm_rx_ring_free(bp, rxr, false);
        bnxt_hwrm_rx_agg_ring_free(bp, rxr, false);
        rxr->rx_next_cons = 0;