Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bnxt_en: Optimize bnxt_sriov_disable()

bnxt_sriov_disable() is invoked from 2 places:

1. When the user deletes the VFs.
2. During the unload of the PF driver instance.

Inside bnxt_sriov_disable(), driver invokes
bnxt_restore_pf_fw_resources() which in turn causes a close/open_nic().
There is no harm doing this in the unload path, although it is inefficient
and unnecessary.

Optimize the function to make it more efficient.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250917040839.1924698-4-michael.chan@broadcom.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Kalesh AP and committed by
Paolo Abeni
21b6b8e8 e23c40d4

+12 -4
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 16156 16156 struct bnxt *bp = netdev_priv(dev); 16157 16157 16158 16158 if (BNXT_PF(bp)) 16159 - bnxt_sriov_disable(bp); 16159 + __bnxt_sriov_disable(bp); 16160 16160 16161 16161 bnxt_rdma_aux_device_del(bp); 16162 16162
+10 -2
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
··· 919 919 return rc; 920 920 } 921 921 922 - void bnxt_sriov_disable(struct bnxt *bp) 922 + void __bnxt_sriov_disable(struct bnxt *bp) 923 923 { 924 924 u16 num_vfs = pci_num_vf(bp->pdev); 925 925 ··· 943 943 devl_unlock(bp->dl); 944 944 945 945 bnxt_free_vf_resources(bp); 946 + } 947 + 948 + static void bnxt_sriov_disable(struct bnxt *bp) 949 + { 950 + if (!pci_num_vf(bp->pdev)) 951 + return; 952 + 953 + __bnxt_sriov_disable(bp); 946 954 947 955 /* Reclaim all resources for the PF. */ 948 956 rtnl_lock(); ··· 1329 1321 return 0; 1330 1322 } 1331 1323 1332 - void bnxt_sriov_disable(struct bnxt *bp) 1324 + void __bnxt_sriov_disable(struct bnxt *bp) 1333 1325 { 1334 1326 } 1335 1327
+1 -1
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
··· 38 38 int bnxt_set_vf_trust(struct net_device *dev, int vf_id, bool trust); 39 39 int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs); 40 40 int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset); 41 - void bnxt_sriov_disable(struct bnxt *); 41 + void __bnxt_sriov_disable(struct bnxt *bp); 42 42 void bnxt_hwrm_exec_fwd_req(struct bnxt *); 43 43 void bnxt_update_vf_mac(struct bnxt *); 44 44 int bnxt_approve_mac(struct bnxt *, const u8 *, bool);