diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2008-12-10 04:09:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-10 04:09:53 -0500 |
commit | 5e8427e5e25e3f844113cf67d07e7806bbe8c0e2 (patch) | |
tree | 80851d045a850dc981c071fc4bb9ea763dbd8cd4 /drivers | |
parent | b4557be23dc959f38eed21d359ec7164e42bcbd6 (diff) |
igb: Correctly determine pci-e function number in virtual environment
When running in a virtual environment the ports of an 82575/6 can appear to
be single function devices which is not correct. To resolve this we rely
on the function number stored in the status register.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/igb/e1000_mac.c | 18 | ||||
-rw-r--r-- | drivers/net/igb/e1000_regs.h | 4 | ||||
-rw-r--r-- | drivers/net/igb/igb_ethtool.c | 2 |
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/igb/e1000_mac.c b/drivers/net/igb/e1000_mac.c index e18747c70bec..137269daeb2e 100644 --- a/drivers/net/igb/e1000_mac.c +++ b/drivers/net/igb/e1000_mac.c | |||
@@ -83,8 +83,8 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw) | |||
83 | { | 83 | { |
84 | struct e1000_bus_info *bus = &hw->bus; | 84 | struct e1000_bus_info *bus = &hw->bus; |
85 | s32 ret_val; | 85 | s32 ret_val; |
86 | u32 status; | 86 | u32 reg; |
87 | u16 pcie_link_status, pci_header_type; | 87 | u16 pcie_link_status; |
88 | 88 | ||
89 | bus->type = e1000_bus_type_pci_express; | 89 | bus->type = e1000_bus_type_pci_express; |
90 | bus->speed = e1000_bus_speed_2500; | 90 | bus->speed = e1000_bus_speed_2500; |
@@ -99,14 +99,8 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw) | |||
99 | PCIE_LINK_WIDTH_MASK) >> | 99 | PCIE_LINK_WIDTH_MASK) >> |
100 | PCIE_LINK_WIDTH_SHIFT); | 100 | PCIE_LINK_WIDTH_SHIFT); |
101 | 101 | ||
102 | igb_read_pci_cfg(hw, PCI_HEADER_TYPE_REGISTER, &pci_header_type); | 102 | reg = rd32(E1000_STATUS); |
103 | if (pci_header_type & PCI_HEADER_TYPE_MULTIFUNC) { | 103 | bus->func = (reg & E1000_STATUS_FUNC_MASK) >> E1000_STATUS_FUNC_SHIFT; |
104 | status = rd32(E1000_STATUS); | ||
105 | bus->func = (status & E1000_STATUS_FUNC_MASK) | ||
106 | >> E1000_STATUS_FUNC_SHIFT; | ||
107 | } else { | ||
108 | bus->func = 0; | ||
109 | } | ||
110 | 104 | ||
111 | return 0; | 105 | return 0; |
112 | } | 106 | } |
@@ -229,8 +223,8 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) | |||
229 | if (!hw->mac.disable_av) | 223 | if (!hw->mac.disable_av) |
230 | rar_high |= E1000_RAH_AV; | 224 | rar_high |= E1000_RAH_AV; |
231 | 225 | ||
232 | array_wr32(E1000_RA, (index << 1), rar_low); | 226 | wr32(E1000_RAL(index), rar_low); |
233 | array_wr32(E1000_RA, ((index << 1) + 1), rar_high); | 227 | wr32(E1000_RAH(index), rar_high); |
234 | } | 228 | } |
235 | 229 | ||
236 | /** | 230 | /** |
diff --git a/drivers/net/igb/e1000_regs.h b/drivers/net/igb/e1000_regs.h index 95523af26056..bdf5d839c4bf 100644 --- a/drivers/net/igb/e1000_regs.h +++ b/drivers/net/igb/e1000_regs.h | |||
@@ -221,6 +221,10 @@ | |||
221 | #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ | 221 | #define E1000_MTA 0x05200 /* Multicast Table Array - RW Array */ |
222 | #define E1000_RA 0x05400 /* Receive Address - RW Array */ | 222 | #define E1000_RA 0x05400 /* Receive Address - RW Array */ |
223 | #define E1000_RA2 0x054E0 /* 2nd half of receive address array - RW Array */ | 223 | #define E1000_RA2 0x054E0 /* 2nd half of receive address array - RW Array */ |
224 | #define E1000_RAL(_i) (((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ | ||
225 | (0x054E0 + ((_i - 16) * 8))) | ||
226 | #define E1000_RAH(_i) (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ | ||
227 | (0x054E4 + ((_i - 16) * 8))) | ||
224 | #define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */ | 228 | #define E1000_VFTA 0x05600 /* VLAN Filter Table Array - RW Array */ |
225 | #define E1000_VMD_CTL 0x0581C /* VMDq Control - RW */ | 229 | #define E1000_VMD_CTL 0x0581C /* VMDq Control - RW */ |
226 | #define E1000_WUC 0x05800 /* Wakeup Control - RW */ | 230 | #define E1000_WUC 0x05800 /* Wakeup Control - RW */ |
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c index d5efbcc49067..3c831f1472ad 100644 --- a/drivers/net/igb/igb_ethtool.c +++ b/drivers/net/igb/igb_ethtool.c | |||
@@ -494,8 +494,6 @@ static void igb_get_regs(struct net_device *netdev, | |||
494 | 494 | ||
495 | /* These should probably be added to e1000_regs.h instead */ | 495 | /* These should probably be added to e1000_regs.h instead */ |
496 | #define E1000_PSRTYPE_REG(_i) (0x05480 + ((_i) * 4)) | 496 | #define E1000_PSRTYPE_REG(_i) (0x05480 + ((_i) * 4)) |
497 | #define E1000_RAL(_i) (0x05400 + ((_i) * 8)) | ||
498 | #define E1000_RAH(_i) (0x05404 + ((_i) * 8)) | ||
499 | #define E1000_IP4AT_REG(_i) (0x05840 + ((_i) * 8)) | 497 | #define E1000_IP4AT_REG(_i) (0x05840 + ((_i) * 8)) |
500 | #define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4)) | 498 | #define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4)) |
501 | #define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4)) | 499 | #define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4)) |