diff options
author | David S. Miller <davem@davemloft.net> | 2012-09-20 22:33:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-20 22:33:42 -0400 |
commit | b216a4d86fb599fa2808ea7456e15ca9b47bc756 (patch) | |
tree | 5eac23884cd85d45851c223dbc1822a9bf378cd3 /drivers | |
parent | 127a479442790d175811547dd95241dce9812ec5 (diff) | |
parent | 012dc19a45b2b9cc2ebd14aaa401cf782c2abba4 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says:
====================
This series contains updates to igb and ixgbevf.
v2: updated patch description in 04 patch (ixgbevf: scheduling while
atomic in reset hw path)
...
Akeem G. Abodunrin (1):
igb: Support to enable EEE on all eee_supported devices
Alexander Duyck (2):
igb: Remove artificial restriction on RQDPC stat reading
ixgbevf: Add support for VF API negotiation
John Fastabend (1):
ixgbevf: scheduling while atomic in reset hw path
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_82575.c | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_defines.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/e1000_regs.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/defines.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 23 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/mbx.h | 21 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/vf.c | 39 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbevf/vf.h | 3 |
9 files changed, 105 insertions, 11 deletions
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index ba994fb4cec6..ca4641e2f748 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
@@ -2223,11 +2223,10 @@ out: | |||
2223 | s32 igb_set_eee_i350(struct e1000_hw *hw) | 2223 | s32 igb_set_eee_i350(struct e1000_hw *hw) |
2224 | { | 2224 | { |
2225 | s32 ret_val = 0; | 2225 | s32 ret_val = 0; |
2226 | u32 ipcnfg, eeer, ctrl_ext; | 2226 | u32 ipcnfg, eeer; |
2227 | 2227 | ||
2228 | ctrl_ext = rd32(E1000_CTRL_EXT); | 2228 | if ((hw->mac.type < e1000_i350) || |
2229 | if ((hw->mac.type != e1000_i350) || | 2229 | (hw->phy.media_type != e1000_media_type_copper)) |
2230 | (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK)) | ||
2231 | goto out; | 2230 | goto out; |
2232 | ipcnfg = rd32(E1000_IPCNFG); | 2231 | ipcnfg = rd32(E1000_IPCNFG); |
2233 | eeer = rd32(E1000_EEER); | 2232 | eeer = rd32(E1000_EEER); |
@@ -2240,6 +2239,14 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) | |||
2240 | E1000_EEER_RX_LPI_EN | | 2239 | E1000_EEER_RX_LPI_EN | |
2241 | E1000_EEER_LPI_FC); | 2240 | E1000_EEER_LPI_FC); |
2242 | 2241 | ||
2242 | /* keep the LPI clock running before EEE is enabled */ | ||
2243 | if (hw->mac.type == e1000_i210 || hw->mac.type == e1000_i211) { | ||
2244 | u32 eee_su; | ||
2245 | eee_su = rd32(E1000_EEE_SU); | ||
2246 | eee_su &= ~E1000_EEE_SU_LPI_CLK_STP; | ||
2247 | wr32(E1000_EEE_SU, eee_su); | ||
2248 | } | ||
2249 | |||
2243 | } else { | 2250 | } else { |
2244 | ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | | 2251 | ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | |
2245 | E1000_IPCNFG_EEE_100M_AN); | 2252 | E1000_IPCNFG_EEE_100M_AN); |
@@ -2249,6 +2256,8 @@ s32 igb_set_eee_i350(struct e1000_hw *hw) | |||
2249 | } | 2256 | } |
2250 | wr32(E1000_IPCNFG, ipcnfg); | 2257 | wr32(E1000_IPCNFG, ipcnfg); |
2251 | wr32(E1000_EEER, eeer); | 2258 | wr32(E1000_EEER, eeer); |
2259 | rd32(E1000_IPCNFG); | ||
2260 | rd32(E1000_EEER); | ||
2252 | out: | 2261 | out: |
2253 | 2262 | ||
2254 | return ret_val; | 2263 | return ret_val; |
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h index cae3070da922..de4b41ec3c40 100644 --- a/drivers/net/ethernet/intel/igb/e1000_defines.h +++ b/drivers/net/ethernet/intel/igb/e1000_defines.h | |||
@@ -857,8 +857,9 @@ | |||
857 | #define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */ | 857 | #define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */ |
858 | #define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */ | 858 | #define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */ |
859 | #define E1000_EEER_RX_LPI_EN 0x00020000 /* EEE Rx LPI Enable */ | 859 | #define E1000_EEER_RX_LPI_EN 0x00020000 /* EEE Rx LPI Enable */ |
860 | #define E1000_EEER_FRC_AN 0x10000000 /* Enable EEE in loopback */ | 860 | #define E1000_EEER_FRC_AN 0x10000000 /* Enable EEE in loopback */ |
861 | #define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */ | 861 | #define E1000_EEER_LPI_FC 0x00040000 /* EEE Enable on FC */ |
862 | #define E1000_EEE_SU_LPI_CLK_STP 0X00800000 /* EEE LPI Clock Stop */ | ||
862 | 863 | ||
863 | /* SerDes Control */ | 864 | /* SerDes Control */ |
864 | #define E1000_GEN_CTL_READY 0x80000000 | 865 | #define E1000_GEN_CTL_READY 0x80000000 |
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h index faec840a5a8a..e5db48594e8a 100644 --- a/drivers/net/ethernet/intel/igb/e1000_regs.h +++ b/drivers/net/ethernet/intel/igb/e1000_regs.h | |||
@@ -349,6 +349,7 @@ | |||
349 | /* Energy Efficient Ethernet "EEE" register */ | 349 | /* Energy Efficient Ethernet "EEE" register */ |
350 | #define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ | 350 | #define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ |
351 | #define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */ | 351 | #define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */ |
352 | #define E1000_EEE_SU 0X0E34 /* EEE Setup */ | ||
352 | 353 | ||
353 | /* Thermal Sensor Register */ | 354 | /* Thermal Sensor Register */ |
354 | #define E1000_THSTAT 0x08110 /* Thermal Sensor Status */ | 355 | #define E1000_THSTAT 0x08110 /* Thermal Sensor Status */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 19d7666dfccb..246646b61a1a 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -4681,11 +4681,13 @@ void igb_update_stats(struct igb_adapter *adapter, | |||
4681 | bytes = 0; | 4681 | bytes = 0; |
4682 | packets = 0; | 4682 | packets = 0; |
4683 | for (i = 0; i < adapter->num_rx_queues; i++) { | 4683 | for (i = 0; i < adapter->num_rx_queues; i++) { |
4684 | u32 rqdpc_tmp = rd32(E1000_RQDPC(i)) & 0x0FFF; | 4684 | u32 rqdpc = rd32(E1000_RQDPC(i)); |
4685 | struct igb_ring *ring = adapter->rx_ring[i]; | 4685 | struct igb_ring *ring = adapter->rx_ring[i]; |
4686 | 4686 | ||
4687 | ring->rx_stats.drops += rqdpc_tmp; | 4687 | if (rqdpc) { |
4688 | net_stats->rx_fifo_errors += rqdpc_tmp; | 4688 | ring->rx_stats.drops += rqdpc; |
4689 | net_stats->rx_fifo_errors += rqdpc; | ||
4690 | } | ||
4689 | 4691 | ||
4690 | do { | 4692 | do { |
4691 | start = u64_stats_fetch_begin_bh(&ring->rx_syncp); | 4693 | start = u64_stats_fetch_begin_bh(&ring->rx_syncp); |
diff --git a/drivers/net/ethernet/intel/ixgbevf/defines.h b/drivers/net/ethernet/intel/ixgbevf/defines.h index 418af827b230..da17ccf5c09d 100644 --- a/drivers/net/ethernet/intel/ixgbevf/defines.h +++ b/drivers/net/ethernet/intel/ixgbevf/defines.h | |||
@@ -272,5 +272,6 @@ struct ixgbe_adv_tx_context_desc { | |||
272 | /* Error Codes */ | 272 | /* Error Codes */ |
273 | #define IXGBE_ERR_INVALID_MAC_ADDR -1 | 273 | #define IXGBE_ERR_INVALID_MAC_ADDR -1 |
274 | #define IXGBE_ERR_RESET_FAILED -2 | 274 | #define IXGBE_ERR_RESET_FAILED -2 |
275 | #define IXGBE_ERR_INVALID_ARGUMENT -3 | ||
275 | 276 | ||
276 | #endif /* _IXGBEVF_DEFINES_H_ */ | 277 | #endif /* _IXGBEVF_DEFINES_H_ */ |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index a5d9cc5bb257..c5ffe1dd3fcd 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -1334,6 +1334,25 @@ static void ixgbevf_init_last_counter_stats(struct ixgbevf_adapter *adapter) | |||
1334 | adapter->stats.base_vfmprc = adapter->stats.last_vfmprc; | 1334 | adapter->stats.base_vfmprc = adapter->stats.last_vfmprc; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter) | ||
1338 | { | ||
1339 | struct ixgbe_hw *hw = &adapter->hw; | ||
1340 | int api[] = { ixgbe_mbox_api_10, | ||
1341 | ixgbe_mbox_api_unknown }; | ||
1342 | int err = 0, idx = 0; | ||
1343 | |||
1344 | spin_lock(&adapter->mbx_lock); | ||
1345 | |||
1346 | while (api[idx] != ixgbe_mbox_api_unknown) { | ||
1347 | err = ixgbevf_negotiate_api_version(hw, api[idx]); | ||
1348 | if (!err) | ||
1349 | break; | ||
1350 | idx++; | ||
1351 | } | ||
1352 | |||
1353 | spin_unlock(&adapter->mbx_lock); | ||
1354 | } | ||
1355 | |||
1337 | static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) | 1356 | static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) |
1338 | { | 1357 | { |
1339 | struct net_device *netdev = adapter->netdev; | 1358 | struct net_device *netdev = adapter->netdev; |
@@ -1399,6 +1418,8 @@ void ixgbevf_up(struct ixgbevf_adapter *adapter) | |||
1399 | { | 1418 | { |
1400 | struct ixgbe_hw *hw = &adapter->hw; | 1419 | struct ixgbe_hw *hw = &adapter->hw; |
1401 | 1420 | ||
1421 | ixgbevf_negotiate_api(adapter); | ||
1422 | |||
1402 | ixgbevf_configure(adapter); | 1423 | ixgbevf_configure(adapter); |
1403 | 1424 | ||
1404 | ixgbevf_up_complete(adapter); | 1425 | ixgbevf_up_complete(adapter); |
@@ -2388,6 +2409,8 @@ static int ixgbevf_open(struct net_device *netdev) | |||
2388 | } | 2409 | } |
2389 | } | 2410 | } |
2390 | 2411 | ||
2412 | ixgbevf_negotiate_api(adapter); | ||
2413 | |||
2391 | /* allocate transmit descriptors */ | 2414 | /* allocate transmit descriptors */ |
2392 | err = ixgbevf_setup_all_tx_resources(adapter); | 2415 | err = ixgbevf_setup_all_tx_resources(adapter); |
2393 | if (err) | 2416 | if (err) |
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h index cf9131c5c115..946ce86f337f 100644 --- a/drivers/net/ethernet/intel/ixgbevf/mbx.h +++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h | |||
@@ -76,12 +76,29 @@ | |||
76 | /* bits 23:16 are used for exra info for certain messages */ | 76 | /* bits 23:16 are used for exra info for certain messages */ |
77 | #define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT) | 77 | #define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT) |
78 | 78 | ||
79 | /* definitions to support mailbox API version negotiation */ | ||
80 | |||
81 | /* | ||
82 | * each element denotes a version of the API; existing numbers may not | ||
83 | * change; any additions must go at the end | ||
84 | */ | ||
85 | enum ixgbe_pfvf_api_rev { | ||
86 | ixgbe_mbox_api_10, /* API version 1.0, linux/freebsd VF driver */ | ||
87 | ixgbe_mbox_api_20, /* API version 2.0, solaris Phase1 VF driver */ | ||
88 | /* This value should always be last */ | ||
89 | ixgbe_mbox_api_unknown, /* indicates that API version is not known */ | ||
90 | }; | ||
91 | |||
92 | /* mailbox API, legacy requests */ | ||
79 | #define IXGBE_VF_RESET 0x01 /* VF requests reset */ | 93 | #define IXGBE_VF_RESET 0x01 /* VF requests reset */ |
80 | #define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */ | 94 | #define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */ |
81 | #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ | 95 | #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ |
82 | #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ | 96 | #define IXGBE_VF_SET_VLAN 0x04 /* VF requests PF to set VLAN */ |
83 | #define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ | 97 | |
84 | #define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */ | 98 | /* mailbox API, version 1.0 VF requests */ |
99 | #define IXGBE_VF_SET_LPE 0x05 /* VF requests PF to set VMOLR.LPE */ | ||
100 | #define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */ | ||
101 | #define IXGBE_VF_API_NEGOTIATE 0x08 /* negotiate API version */ | ||
85 | 102 | ||
86 | /* length of permanent address message returned from PF */ | 103 | /* length of permanent address message returned from PF */ |
87 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 | 104 | #define IXGBE_VF_PERMADDR_MSG_LEN 4 |
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c index 3d555a10f592..87b3f3bf1c1f 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.c +++ b/drivers/net/ethernet/intel/ixgbevf/vf.c | |||
@@ -79,6 +79,9 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) | |||
79 | /* Call adapter stop to disable tx/rx and clear interrupts */ | 79 | /* Call adapter stop to disable tx/rx and clear interrupts */ |
80 | hw->mac.ops.stop_adapter(hw); | 80 | hw->mac.ops.stop_adapter(hw); |
81 | 81 | ||
82 | /* reset the api version */ | ||
83 | hw->api_version = ixgbe_mbox_api_10; | ||
84 | |||
82 | IXGBE_WRITE_REG(hw, IXGBE_VFCTRL, IXGBE_CTRL_RST); | 85 | IXGBE_WRITE_REG(hw, IXGBE_VFCTRL, IXGBE_CTRL_RST); |
83 | IXGBE_WRITE_FLUSH(hw); | 86 | IXGBE_WRITE_FLUSH(hw); |
84 | 87 | ||
@@ -97,7 +100,7 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw) | |||
97 | msgbuf[0] = IXGBE_VF_RESET; | 100 | msgbuf[0] = IXGBE_VF_RESET; |
98 | mbx->ops.write_posted(hw, msgbuf, 1); | 101 | mbx->ops.write_posted(hw, msgbuf, 1); |
99 | 102 | ||
100 | msleep(10); | 103 | mdelay(10); |
101 | 104 | ||
102 | /* set our "perm_addr" based on info provided by PF */ | 105 | /* set our "perm_addr" based on info provided by PF */ |
103 | /* also set up the mc_filter_type which is piggy backed | 106 | /* also set up the mc_filter_type which is piggy backed |
@@ -433,6 +436,40 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size) | |||
433 | ixgbevf_write_msg_read_ack(hw, msgbuf, 2); | 436 | ixgbevf_write_msg_read_ack(hw, msgbuf, 2); |
434 | } | 437 | } |
435 | 438 | ||
439 | /** | ||
440 | * ixgbevf_negotiate_api_version - Negotiate supported API version | ||
441 | * @hw: pointer to the HW structure | ||
442 | * @api: integer containing requested API version | ||
443 | **/ | ||
444 | int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api) | ||
445 | { | ||
446 | int err; | ||
447 | u32 msg[3]; | ||
448 | |||
449 | /* Negotiate the mailbox API version */ | ||
450 | msg[0] = IXGBE_VF_API_NEGOTIATE; | ||
451 | msg[1] = api; | ||
452 | msg[2] = 0; | ||
453 | err = hw->mbx.ops.write_posted(hw, msg, 3); | ||
454 | |||
455 | if (!err) | ||
456 | err = hw->mbx.ops.read_posted(hw, msg, 3); | ||
457 | |||
458 | if (!err) { | ||
459 | msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; | ||
460 | |||
461 | /* Store value and return 0 on success */ | ||
462 | if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_ACK)) { | ||
463 | hw->api_version = api; | ||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | err = IXGBE_ERR_INVALID_ARGUMENT; | ||
468 | } | ||
469 | |||
470 | return err; | ||
471 | } | ||
472 | |||
436 | static const struct ixgbe_mac_operations ixgbevf_mac_ops = { | 473 | static const struct ixgbe_mac_operations ixgbevf_mac_ops = { |
437 | .init_hw = ixgbevf_init_hw_vf, | 474 | .init_hw = ixgbevf_init_hw_vf, |
438 | .reset_hw = ixgbevf_reset_hw_vf, | 475 | .reset_hw = ixgbevf_reset_hw_vf, |
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h index 07fd87688e35..47f11a584d8c 100644 --- a/drivers/net/ethernet/intel/ixgbevf/vf.h +++ b/drivers/net/ethernet/intel/ixgbevf/vf.h | |||
@@ -137,6 +137,8 @@ struct ixgbe_hw { | |||
137 | 137 | ||
138 | u8 revision_id; | 138 | u8 revision_id; |
139 | bool adapter_stopped; | 139 | bool adapter_stopped; |
140 | |||
141 | int api_version; | ||
140 | }; | 142 | }; |
141 | 143 | ||
142 | struct ixgbevf_hw_stats { | 144 | struct ixgbevf_hw_stats { |
@@ -171,5 +173,6 @@ struct ixgbevf_info { | |||
171 | }; | 173 | }; |
172 | 174 | ||
173 | void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); | 175 | void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); |
176 | int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); | ||
174 | #endif /* __IXGBE_VF_H__ */ | 177 | #endif /* __IXGBE_VF_H__ */ |
175 | 178 | ||