bnxt_en: Refactor bnxt_set_features()
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Tue, 20 Feb 2024 23:03:13 +0000 (15:03 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 22 Feb 2024 14:31:23 +0000 (15:31 +0100)
Refactor bnxt_set_features() function to have a common
function to re-init.  We'll need this to reinitialize when
ntuple configuration changes.

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 95af3cd7dba0037f6951f8f1fa89aae467ed8f4d..2fe5262f6c41c0d33d82d3d5afb417cae429d02a 100644 (file)
@@ -12431,6 +12431,16 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
        return features;
 }
 
+static int bnxt_reinit_features(struct bnxt *bp, bool irq_re_init,
+                               bool link_re_init, u32 flags, bool update_tpa)
+{
+       bnxt_close_nic(bp, irq_re_init, link_re_init);
+       bp->flags = flags;
+       if (update_tpa)
+               bnxt_set_ring_params(bp);
+       return bnxt_open_nic(bp, irq_re_init, link_re_init);
+}
+
 static int bnxt_set_features(struct net_device *dev, netdev_features_t features)
 {
        struct bnxt *bp = netdev_priv(dev);
@@ -12479,14 +12489,9 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features)
                        return rc;
                }
 
-               if (re_init) {
-                       bnxt_close_nic(bp, false, false);
-                       bp->flags = flags;
-                       if (update_tpa)
-                               bnxt_set_ring_params(bp);
+               if (re_init)
+                       return bnxt_reinit_features(bp, false, false, flags, update_tpa);
 
-                       return bnxt_open_nic(bp, false, false);
-               }
                if (update_tpa) {
                        bp->flags = flags;
                        rc = bnxt_set_tpa(bp,