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

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>

+105 -11
+13 -4
drivers/net/ethernet/intel/igb/e1000_82575.c
··· 2223 2223 s32 igb_set_eee_i350(struct e1000_hw *hw) 2224 2224 { 2225 2225 s32 ret_val = 0; 2226 - u32 ipcnfg, eeer, ctrl_ext; 2226 + u32 ipcnfg, eeer; 2227 2227 2228 - ctrl_ext = rd32(E1000_CTRL_EXT); 2229 - if ((hw->mac.type != e1000_i350) || 2230 - (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK)) 2228 + if ((hw->mac.type < e1000_i350) || 2229 + (hw->phy.media_type != e1000_media_type_copper)) 2231 2230 goto out; 2232 2231 ipcnfg = rd32(E1000_IPCNFG); 2233 2232 eeer = rd32(E1000_EEER); ··· 2239 2240 E1000_EEER_RX_LPI_EN | 2240 2241 E1000_EEER_LPI_FC); 2241 2242 2243 + /* keep the LPI clock running before EEE is enabled */ 2244 + if (hw->mac.type == e1000_i210 || hw->mac.type == e1000_i211) { 2245 + u32 eee_su; 2246 + eee_su = rd32(E1000_EEE_SU); 2247 + eee_su &= ~E1000_EEE_SU_LPI_CLK_STP; 2248 + wr32(E1000_EEE_SU, eee_su); 2249 + } 2250 + 2242 2251 } else { 2243 2252 ipcnfg &= ~(E1000_IPCNFG_EEE_1G_AN | 2244 2253 E1000_IPCNFG_EEE_100M_AN); ··· 2256 2249 } 2257 2250 wr32(E1000_IPCNFG, ipcnfg); 2258 2251 wr32(E1000_EEER, eeer); 2252 + rd32(E1000_IPCNFG); 2253 + rd32(E1000_EEER); 2259 2254 out: 2260 2255 2261 2256 return ret_val;
+2 -1
drivers/net/ethernet/intel/igb/e1000_defines.h
··· 857 857 #define E1000_IPCNFG_EEE_100M_AN 0x00000004 /* EEE Enable 100M AN */ 858 858 #define E1000_EEER_TX_LPI_EN 0x00010000 /* EEE Tx LPI Enable */ 859 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 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 864 /* SerDes Control */ 864 865 #define E1000_GEN_CTL_READY 0x80000000
+1
drivers/net/ethernet/intel/igb/e1000_regs.h
··· 349 349 /* Energy Efficient Ethernet "EEE" register */ 350 350 #define E1000_IPCNFG 0x0E38 /* Internal PHY Configuration */ 351 351 #define E1000_EEER 0x0E30 /* Energy Efficient Ethernet */ 352 + #define E1000_EEE_SU 0X0E34 /* EEE Setup */ 352 353 353 354 /* Thermal Sensor Register */ 354 355 #define E1000_THSTAT 0x08110 /* Thermal Sensor Status */
+5 -3
drivers/net/ethernet/intel/igb/igb_main.c
··· 4681 4681 bytes = 0; 4682 4682 packets = 0; 4683 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 4685 struct igb_ring *ring = adapter->rx_ring[i]; 4686 4686 4687 - ring->rx_stats.drops += rqdpc_tmp; 4688 - net_stats->rx_fifo_errors += rqdpc_tmp; 4687 + if (rqdpc) { 4688 + ring->rx_stats.drops += rqdpc; 4689 + net_stats->rx_fifo_errors += rqdpc; 4690 + } 4689 4691 4690 4692 do { 4691 4693 start = u64_stats_fetch_begin_bh(&ring->rx_syncp);
+1
drivers/net/ethernet/intel/ixgbevf/defines.h
··· 272 272 /* Error Codes */ 273 273 #define IXGBE_ERR_INVALID_MAC_ADDR -1 274 274 #define IXGBE_ERR_RESET_FAILED -2 275 + #define IXGBE_ERR_INVALID_ARGUMENT -3 275 276 276 277 #endif /* _IXGBEVF_DEFINES_H_ */
+23
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
··· 1334 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 1356 static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) 1338 1357 { 1339 1358 struct net_device *netdev = adapter->netdev; ··· 1417 1398 void ixgbevf_up(struct ixgbevf_adapter *adapter) 1418 1399 { 1419 1400 struct ixgbe_hw *hw = &adapter->hw; 1401 + 1402 + ixgbevf_negotiate_api(adapter); 1420 1403 1421 1404 ixgbevf_configure(adapter); 1422 1405 ··· 2408 2387 goto err_setup_reset; 2409 2388 } 2410 2389 } 2390 + 2391 + ixgbevf_negotiate_api(adapter); 2411 2392 2412 2393 /* allocate transmit descriptors */ 2413 2394 err = ixgbevf_setup_all_tx_resources(adapter);
+19 -2
drivers/net/ethernet/intel/ixgbevf/mbx.h
··· 76 76 /* bits 23:16 are used for exra info for certain messages */ 77 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 93 #define IXGBE_VF_RESET 0x01 /* VF requests reset */ 80 94 #define IXGBE_VF_SET_MAC_ADDR 0x02 /* VF requests PF to set MAC addr */ 81 95 #define IXGBE_VF_SET_MULTICAST 0x03 /* VF requests PF to set MC addr */ 82 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 */ 84 - #define IXGBE_VF_SET_MACVLAN 0x06 /* VF requests PF for unicast filter */ 97 + 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 103 /* length of permanent address message returned from PF */ 87 104 #define IXGBE_VF_PERMADDR_MSG_LEN 4
+38 -1
drivers/net/ethernet/intel/ixgbevf/vf.c
··· 79 79 /* Call adapter stop to disable tx/rx and clear interrupts */ 80 80 hw->mac.ops.stop_adapter(hw); 81 81 82 + /* reset the api version */ 83 + hw->api_version = ixgbe_mbox_api_10; 84 + 82 85 IXGBE_WRITE_REG(hw, IXGBE_VFCTRL, IXGBE_CTRL_RST); 83 86 IXGBE_WRITE_FLUSH(hw); 84 87 ··· 100 97 msgbuf[0] = IXGBE_VF_RESET; 101 98 mbx->ops.write_posted(hw, msgbuf, 1); 102 99 103 - msleep(10); 100 + mdelay(10); 104 101 105 102 /* set our "perm_addr" based on info provided by PF */ 106 103 /* also set up the mc_filter_type which is piggy backed ··· 434 431 msgbuf[0] = IXGBE_VF_SET_LPE; 435 432 msgbuf[1] = max_size; 436 433 ixgbevf_write_msg_read_ack(hw, msgbuf, 2); 434 + } 435 + 436 + /** 437 + * ixgbevf_negotiate_api_version - Negotiate supported API version 438 + * @hw: pointer to the HW structure 439 + * @api: integer containing requested API version 440 + **/ 441 + int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api) 442 + { 443 + int err; 444 + u32 msg[3]; 445 + 446 + /* Negotiate the mailbox API version */ 447 + msg[0] = IXGBE_VF_API_NEGOTIATE; 448 + msg[1] = api; 449 + msg[2] = 0; 450 + err = hw->mbx.ops.write_posted(hw, msg, 3); 451 + 452 + if (!err) 453 + err = hw->mbx.ops.read_posted(hw, msg, 3); 454 + 455 + if (!err) { 456 + msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; 457 + 458 + /* Store value and return 0 on success */ 459 + if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_ACK)) { 460 + hw->api_version = api; 461 + return 0; 462 + } 463 + 464 + err = IXGBE_ERR_INVALID_ARGUMENT; 465 + } 466 + 467 + return err; 437 468 } 438 469 439 470 static const struct ixgbe_mac_operations ixgbevf_mac_ops = {
+3
drivers/net/ethernet/intel/ixgbevf/vf.h
··· 137 137 138 138 u8 revision_id; 139 139 bool adapter_stopped; 140 + 141 + int api_version; 140 142 }; 141 143 142 144 struct ixgbevf_hw_stats { ··· 173 171 }; 174 172 175 173 void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size); 174 + int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api); 176 175 #endif /* __IXGBE_VF_H__ */ 177 176