pds_core: keep viftypes table across reset
authorShannon Nelson <shannon.nelson@amd.com>
Thu, 14 Sep 2023 22:31:58 +0000 (15:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Sep 2023 08:28:22 +0000 (09:28 +0100)
Keep the viftypes and the current enable/disable states
across a recovery action.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/pds_core/core.c

index 36f9b932b9e2aabdb895b0fa4ac1351b43e7004e..6e426202ab835781630bad0a123cc5512ee2a928 100644 (file)
@@ -445,12 +445,13 @@ int pdsc_setup(struct pdsc *pdsc, bool init)
                goto err_out_teardown;
 
        /* Set up the VIFs */
-       err = pdsc_viftypes_init(pdsc);
-       if (err)
-               goto err_out_teardown;
+       if (init) {
+               err = pdsc_viftypes_init(pdsc);
+               if (err)
+                       goto err_out_teardown;
 
-       if (init)
                pdsc_debugfs_add_viftype(pdsc);
+       }
 
        clear_bit(PDSC_S_FW_DEAD, &pdsc->state);
        return 0;
@@ -469,8 +470,10 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing)
        pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
        pdsc_qcq_free(pdsc, &pdsc->adminqcq);
 
-       kfree(pdsc->viftype_status);
-       pdsc->viftype_status = NULL;
+       if (removing) {
+               kfree(pdsc->viftype_status);
+               pdsc->viftype_status = NULL;
+       }
 
        if (pdsc->intr_info) {
                for (i = 0; i < pdsc->nintrs; i++)