[Devel] [PATCH RHEL7 COMMIT] ms/ixgbe: cleanup ixgbe_enumerate_functions

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 10 05:44:18 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.7
------>
commit deecf721899a2e263e55d0b48e1ddf3316c247b5
Author: Jacob Keller <jacob.e.keller at intel.com>
Date:   Tue Nov 10 17:44:17 2015 +0400

    ms/ixgbe: cleanup ixgbe_enumerate_functions
    
    This function previously had the same check as used by the
    ixgbe_pcie_from_parent. As the hardcode is due to the device having an internal
    switch, this function should simply use the call from ixgbe_pcie_from_parent.
    This reduces code complexity and makes it less likely a developer will forget
    to update the list in the future.
    
    Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
    Tested-by: Phil Schmitt <phillip.j.schmitt at intel.com>
    Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher at intel.com>
    
    https://jira.sw.ru/browse/PSBM-41133
    
    (cherry picked from commit f1f965793b2bb8a75067e94acbe886a61637cab8)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 14f05b8..9fe8787 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7525,19 +7525,16 @@ static const struct net_device_ops ixgbe_netdev_ops = {
  **/
 static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter)
 {
-	struct ixgbe_hw *hw = &adapter->hw;
 	struct list_head *entry;
 	int physfns = 0;
 
-	/* Some cards can not use the generic count PCIe functions method, and
-	 * so must be hardcoded to the correct value.
+	/* Some cards can not use the generic count PCIe functions method,
+	 * because they are behind a parent switch, so we hardcode these with
+	 * the correct number of functions.
 	 */
-	switch (hw->device_id) {
-	case IXGBE_DEV_ID_82599_SFP_SF_QP:
-	case IXGBE_DEV_ID_82599_QSFP_SF_QP:
+	if (ixgbe_pcie_from_parent(&adapter->hw)) {
 		physfns = 4;
-		break;
-	default:
+	} else {
 		list_for_each(entry, &adapter->pdev->bus_list) {
 			struct pci_dev *pdev =
 				list_entry(entry, struct pci_dev, bus_list);


More information about the Devel mailing list