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

bnx2x: Prevent inner-reload while VFs exist

On some feature changes, driver employes an inner-reload flow where it
resets the function and re-configures it with the new required set of
parameters.

Such a flow proves fatal to any VF since those were not intended to be used
while HW is being reset underneath, causing them [at best] to lose all
connectivity.

This changes driver behavior to fail all configuration changes [e.g., mtu
change] requested of the driver in case VFs are active.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yuval Mintz and committed by
David S. Miller
909d9faa a2c3935a

+51 -9
+34 -9
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 4809 4809 { 4810 4810 struct bnx2x *bp = netdev_priv(dev); 4811 4811 4812 + if (pci_num_vf(bp->pdev)) { 4813 + netdev_features_t changed = dev->features ^ features; 4814 + 4815 + /* Revert the requested changes in features if they 4816 + * would require internal reload of PF in bnx2x_set_features(). 4817 + */ 4818 + if (!(features & NETIF_F_RXCSUM) && !bp->disable_tpa) { 4819 + features &= ~NETIF_F_RXCSUM; 4820 + features |= dev->features & NETIF_F_RXCSUM; 4821 + } 4822 + 4823 + if (changed & NETIF_F_LOOPBACK) { 4824 + features &= ~NETIF_F_LOOPBACK; 4825 + features |= dev->features & NETIF_F_LOOPBACK; 4826 + } 4827 + } 4828 + 4812 4829 /* TPA requires Rx CSUM offloading */ 4813 4830 if (!(features & NETIF_F_RXCSUM)) { 4814 4831 features &= ~NETIF_F_LRO; ··· 4856 4839 else 4857 4840 flags &= ~GRO_ENABLE_FLAG; 4858 4841 4859 - if (features & NETIF_F_LOOPBACK) { 4860 - if (bp->link_params.loopback_mode != LOOPBACK_BMAC) { 4861 - bp->link_params.loopback_mode = LOOPBACK_BMAC; 4862 - bnx2x_reload = true; 4863 - } 4864 - } else { 4865 - if (bp->link_params.loopback_mode != LOOPBACK_NONE) { 4866 - bp->link_params.loopback_mode = LOOPBACK_NONE; 4867 - bnx2x_reload = true; 4842 + /* VFs or non SRIOV PFs should be able to change loopback feature */ 4843 + if (!pci_num_vf(bp->pdev)) { 4844 + if (features & NETIF_F_LOOPBACK) { 4845 + if (bp->link_params.loopback_mode != LOOPBACK_BMAC) { 4846 + bp->link_params.loopback_mode = LOOPBACK_BMAC; 4847 + bnx2x_reload = true; 4848 + } 4849 + } else { 4850 + if (bp->link_params.loopback_mode != LOOPBACK_NONE) { 4851 + bp->link_params.loopback_mode = LOOPBACK_NONE; 4852 + bnx2x_reload = true; 4853 + } 4868 4854 } 4869 4855 } 4870 4856 ··· 4950 4930 return -ENODEV; 4951 4931 } 4952 4932 bp = netdev_priv(dev); 4933 + 4934 + if (pci_num_vf(bp->pdev)) { 4935 + DP(BNX2X_MSG_IOV, "VFs are enabled, can not change MTU\n"); 4936 + return -EPERM; 4937 + } 4953 4938 4954 4939 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 4955 4940 BNX2X_ERR("Handling parity error recovery. Try again later\n");
+17
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
··· 1843 1843 "set ring params command parameters: rx_pending = %d, tx_pending = %d\n", 1844 1844 ering->rx_pending, ering->tx_pending); 1845 1845 1846 + if (pci_num_vf(bp->pdev)) { 1847 + DP(BNX2X_MSG_IOV, 1848 + "VFs are enabled, can not change ring parameters\n"); 1849 + return -EPERM; 1850 + } 1851 + 1846 1852 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 1847 1853 DP(BNX2X_MSG_ETHTOOL, 1848 1854 "Handling parity error recovery. Try again later\n"); ··· 2905 2899 u8 is_serdes, link_up; 2906 2900 int rc, cnt = 0; 2907 2901 2902 + if (pci_num_vf(bp->pdev)) { 2903 + DP(BNX2X_MSG_IOV, 2904 + "VFs are enabled, can not perform self test\n"); 2905 + return; 2906 + } 2907 + 2908 2908 if (bp->recovery_state != BNX2X_RECOVERY_DONE) { 2909 2909 netdev_err(bp->dev, 2910 2910 "Handling parity error recovery. Try again later\n"); ··· 3479 3467 "set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n", 3480 3468 channels->rx_count, channels->tx_count, channels->other_count, 3481 3469 channels->combined_count); 3470 + 3471 + if (pci_num_vf(bp->pdev)) { 3472 + DP(BNX2X_MSG_IOV, "VFs are enabled, can not set channels\n"); 3473 + return -EPERM; 3474 + } 3482 3475 3483 3476 /* We don't support separate rx / tx channels. 3484 3477 * We don't allow setting 'other' channels.