aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-06-06 00:15:50 -0400
committerDavid S. Miller <davem@davemloft.net>2015-06-06 00:15:50 -0400
commitc6271b7633f066eb1cd46c17862bde6c97f6a5ba (patch)
tree6b7aa1f0eae8779290e441a729ce516d66334af9
parent6e540309326188f769e03bb4c6dd8ff6752930c2 (diff)
parentfa11cb3d16a9b9b296a2b811a49faf1356240348 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-06-04 This series contains updates to i40e and i40evf. Anjali provides three fixes, first to resolve a Tx queue hang if mixed size frags are passed to the driver while using TSO. There was a corner case where we needed to linearize but we were not. Next fixes a bug in the default configuration which prevented a software bridge loaded on the PF interface from working correctly because broadcast packets are incorrectly looped back. Lastly fixes an NPAR bug when SRIOV is enabled, where we need to be in VEB mode, not VEPA mode at probe. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h1
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c9
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c35
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c25
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c10
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_txrx.c25
6 files changed, 70 insertions, 35 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 33c35d3b7420..5d47307121ab 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -317,6 +317,7 @@ struct i40e_pf {
317#endif 317#endif
318#define I40E_FLAG_PORT_ID_VALID (u64)(1 << 28) 318#define I40E_FLAG_PORT_ID_VALID (u64)(1 << 28)
319#define I40E_FLAG_DCB_CAPABLE (u64)(1 << 29) 319#define I40E_FLAG_DCB_CAPABLE (u64)(1 << 29)
320#define I40E_FLAG_VEB_MODE_ENABLED BIT_ULL(40)
320 321
321 /* tracks features that get auto disabled by errors */ 322 /* tracks features that get auto disabled by errors */
322 u64 auto_disable_flags; 323 u64 auto_disable_flags;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 34170eabca7d..da0faf478af0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1021,6 +1021,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1021 goto command_write_done; 1021 goto command_write_done;
1022 } 1022 }
1023 1023
1024 /* By default we are in VEPA mode, if this is the first VF/VMDq
1025 * VSI to be added switch to VEB mode.
1026 */
1027 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
1028 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
1029 i40e_do_reset_safe(pf,
1030 BIT_ULL(__I40E_PF_RESET_REQUESTED));
1031 }
1032
1024 vsi = i40e_vsi_setup(pf, I40E_VSI_VMDQ2, vsi_seid, 0); 1033 vsi = i40e_vsi_setup(pf, I40E_VSI_VMDQ2, vsi_seid, 0);
1025 if (vsi) 1034 if (vsi)
1026 dev_info(&pf->pdev->dev, "added VSI %d to relay %d\n", 1035 dev_info(&pf->pdev->dev, "added VSI %d to relay %d\n",
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a54c14491e3b..5b5bea159bd5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6097,6 +6097,10 @@ static int i40e_reconstitute_veb(struct i40e_veb *veb)
6097 if (ret) 6097 if (ret)
6098 goto end_reconstitute; 6098 goto end_reconstitute;
6099 6099
6100 if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
6101 veb->bridge_mode = BRIDGE_MODE_VEB;
6102 else
6103 veb->bridge_mode = BRIDGE_MODE_VEPA;
6100 i40e_config_bridge_mode(veb); 6104 i40e_config_bridge_mode(veb);
6101 6105
6102 /* create the remaining VSIs attached to this VEB */ 6106 /* create the remaining VSIs attached to this VEB */
@@ -8031,7 +8035,12 @@ static int i40e_ndo_bridge_setlink(struct net_device *dev,
8031 } else if (mode != veb->bridge_mode) { 8035 } else if (mode != veb->bridge_mode) {
8032 /* Existing HW bridge but different mode needs reset */ 8036 /* Existing HW bridge but different mode needs reset */
8033 veb->bridge_mode = mode; 8037 veb->bridge_mode = mode;
8034 i40e_do_reset(pf, (1 << __I40E_PF_RESET_REQUESTED)); 8038 /* TODO: If no VFs or VMDq VSIs, disallow VEB mode */
8039 if (mode == BRIDGE_MODE_VEB)
8040 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
8041 else
8042 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED;
8043 i40e_do_reset(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED));
8035 break; 8044 break;
8036 } 8045 }
8037 } 8046 }
@@ -8343,11 +8352,12 @@ static int i40e_add_vsi(struct i40e_vsi *vsi)
8343 ctxt.uplink_seid = vsi->uplink_seid; 8352 ctxt.uplink_seid = vsi->uplink_seid;
8344 ctxt.connection_type = I40E_AQ_VSI_CONN_TYPE_NORMAL; 8353 ctxt.connection_type = I40E_AQ_VSI_CONN_TYPE_NORMAL;
8345 ctxt.flags = I40E_AQ_VSI_TYPE_PF; 8354 ctxt.flags = I40E_AQ_VSI_TYPE_PF;
8346 if (i40e_is_vsi_uplink_mode_veb(vsi)) { 8355 if ((pf->flags & I40E_FLAG_VEB_MODE_ENABLED) &&
8356 (i40e_is_vsi_uplink_mode_veb(vsi))) {
8347 ctxt.info.valid_sections |= 8357 ctxt.info.valid_sections |=
8348 cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID); 8358 cpu_to_le16(I40E_AQ_VSI_PROP_SWITCH_VALID);
8349 ctxt.info.switch_id = 8359 ctxt.info.switch_id =
8350 cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB); 8360 cpu_to_le16(I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB);
8351 } 8361 }
8352 i40e_vsi_setup_queue_map(vsi, &ctxt, enabled_tc, true); 8362 i40e_vsi_setup_queue_map(vsi, &ctxt, enabled_tc, true);
8353 break; 8363 break;
@@ -8746,6 +8756,14 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
8746 __func__); 8756 __func__);
8747 return NULL; 8757 return NULL;
8748 } 8758 }
8759 /* We come up by default in VEPA mode if SRIOV is not
8760 * already enabled, in which case we can't force VEPA
8761 * mode.
8762 */
8763 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
8764 veb->bridge_mode = BRIDGE_MODE_VEPA;
8765 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED;
8766 }
8749 i40e_config_bridge_mode(veb); 8767 i40e_config_bridge_mode(veb);
8750 } 8768 }
8751 for (i = 0; i < I40E_MAX_VEB && !veb; i++) { 8769 for (i = 0; i < I40E_MAX_VEB && !veb; i++) {
@@ -9856,6 +9874,15 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
9856 goto err_switch_setup; 9874 goto err_switch_setup;
9857 } 9875 }
9858 9876
9877#ifdef CONFIG_PCI_IOV
9878 /* prep for VF support */
9879 if ((pf->flags & I40E_FLAG_SRIOV_ENABLED) &&
9880 (pf->flags & I40E_FLAG_MSIX_ENABLED) &&
9881 !test_bit(__I40E_BAD_EEPROM, &pf->state)) {
9882 if (pci_num_vf(pdev))
9883 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
9884 }
9885#endif
9859 err = i40e_setup_pf_switch(pf, false); 9886 err = i40e_setup_pf_switch(pf, false);
9860 if (err) { 9887 if (err) {
9861 dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err); 9888 dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 4bd3a80aba82..9d95042d5a0f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2410,14 +2410,12 @@ static int i40e_maybe_stop_tx(struct i40e_ring *tx_ring, int size)
2410 * i40e_chk_linearize - Check if there are more than 8 fragments per packet 2410 * i40e_chk_linearize - Check if there are more than 8 fragments per packet
2411 * @skb: send buffer 2411 * @skb: send buffer
2412 * @tx_flags: collected send information 2412 * @tx_flags: collected send information
2413 * @hdr_len: size of the packet header
2414 * 2413 *
2415 * Note: Our HW can't scatter-gather more than 8 fragments to build 2414 * Note: Our HW can't scatter-gather more than 8 fragments to build
2416 * a packet on the wire and so we need to figure out the cases where we 2415 * a packet on the wire and so we need to figure out the cases where we
2417 * need to linearize the skb. 2416 * need to linearize the skb.
2418 **/ 2417 **/
2419static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags, 2418static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags)
2420 const u8 hdr_len)
2421{ 2419{
2422 struct skb_frag_struct *frag; 2420 struct skb_frag_struct *frag;
2423 bool linearize = false; 2421 bool linearize = false;
@@ -2429,7 +2427,7 @@ static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags,
2429 gso_segs = skb_shinfo(skb)->gso_segs; 2427 gso_segs = skb_shinfo(skb)->gso_segs;
2430 2428
2431 if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) { 2429 if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) {
2432 u16 j = 1; 2430 u16 j = 0;
2433 2431
2434 if (num_frags < (I40E_MAX_BUFFER_TXD)) 2432 if (num_frags < (I40E_MAX_BUFFER_TXD))
2435 goto linearize_chk_done; 2433 goto linearize_chk_done;
@@ -2440,21 +2438,18 @@ static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags,
2440 goto linearize_chk_done; 2438 goto linearize_chk_done;
2441 } 2439 }
2442 frag = &skb_shinfo(skb)->frags[0]; 2440 frag = &skb_shinfo(skb)->frags[0];
2443 size = hdr_len;
2444 /* we might still have more fragments per segment */ 2441 /* we might still have more fragments per segment */
2445 do { 2442 do {
2446 size += skb_frag_size(frag); 2443 size += skb_frag_size(frag);
2447 frag++; j++; 2444 frag++; j++;
2445 if ((size >= skb_shinfo(skb)->gso_size) &&
2446 (j < I40E_MAX_BUFFER_TXD)) {
2447 size = (size % skb_shinfo(skb)->gso_size);
2448 j = (size) ? 1 : 0;
2449 }
2448 if (j == I40E_MAX_BUFFER_TXD) { 2450 if (j == I40E_MAX_BUFFER_TXD) {
2449 if (size < skb_shinfo(skb)->gso_size) { 2451 linearize = true;
2450 linearize = true; 2452 break;
2451 break;
2452 }
2453 j = 1;
2454 size -= skb_shinfo(skb)->gso_size;
2455 if (size)
2456 j++;
2457 size += hdr_len;
2458 } 2453 }
2459 num_frags--; 2454 num_frags--;
2460 } while (num_frags); 2455 } while (num_frags);
@@ -2724,7 +2719,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
2724 if (tsyn) 2719 if (tsyn)
2725 tx_flags |= I40E_TX_FLAGS_TSYN; 2720 tx_flags |= I40E_TX_FLAGS_TSYN;
2726 2721
2727 if (i40e_chk_linearize(skb, tx_flags, hdr_len)) 2722 if (i40e_chk_linearize(skb, tx_flags))
2728 if (skb_linearize(skb)) 2723 if (skb_linearize(skb))
2729 goto out_drop; 2724 goto out_drop;
2730 2725
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 78d1c4ff565e..4e9376da0518 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1018,11 +1018,19 @@ int i40e_pci_sriov_configure(struct pci_dev *pdev, int num_vfs)
1018{ 1018{
1019 struct i40e_pf *pf = pci_get_drvdata(pdev); 1019 struct i40e_pf *pf = pci_get_drvdata(pdev);
1020 1020
1021 if (num_vfs) 1021 if (num_vfs) {
1022 if (!(pf->flags & I40E_FLAG_VEB_MODE_ENABLED)) {
1023 pf->flags |= I40E_FLAG_VEB_MODE_ENABLED;
1024 i40e_do_reset_safe(pf,
1025 BIT_ULL(__I40E_PF_RESET_REQUESTED));
1026 }
1022 return i40e_pci_sriov_enable(pdev, num_vfs); 1027 return i40e_pci_sriov_enable(pdev, num_vfs);
1028 }
1023 1029
1024 if (!pci_vfs_assigned(pf->pdev)) { 1030 if (!pci_vfs_assigned(pf->pdev)) {
1025 i40e_free_vfs(pf); 1031 i40e_free_vfs(pf);
1032 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED;
1033 i40e_do_reset_safe(pf, BIT_ULL(__I40E_PF_RESET_REQUESTED));
1026 } else { 1034 } else {
1027 dev_warn(&pdev->dev, "Unable to free VFs because some are assigned to VMs.\n"); 1035 dev_warn(&pdev->dev, "Unable to free VFs because some are assigned to VMs.\n");
1028 return -EINVAL; 1036 return -EINVAL;
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index b077e02a0cc7..458fbb421090 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -1619,14 +1619,12 @@ static void i40e_create_tx_ctx(struct i40e_ring *tx_ring,
1619 * i40e_chk_linearize - Check if there are more than 8 fragments per packet 1619 * i40e_chk_linearize - Check if there are more than 8 fragments per packet
1620 * @skb: send buffer 1620 * @skb: send buffer
1621 * @tx_flags: collected send information 1621 * @tx_flags: collected send information
1622 * @hdr_len: size of the packet header
1623 * 1622 *
1624 * Note: Our HW can't scatter-gather more than 8 fragments to build 1623 * Note: Our HW can't scatter-gather more than 8 fragments to build
1625 * a packet on the wire and so we need to figure out the cases where we 1624 * a packet on the wire and so we need to figure out the cases where we
1626 * need to linearize the skb. 1625 * need to linearize the skb.
1627 **/ 1626 **/
1628static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags, 1627static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags)
1629 const u8 hdr_len)
1630{ 1628{
1631 struct skb_frag_struct *frag; 1629 struct skb_frag_struct *frag;
1632 bool linearize = false; 1630 bool linearize = false;
@@ -1638,7 +1636,7 @@ static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags,
1638 gso_segs = skb_shinfo(skb)->gso_segs; 1636 gso_segs = skb_shinfo(skb)->gso_segs;
1639 1637
1640 if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) { 1638 if (tx_flags & (I40E_TX_FLAGS_TSO | I40E_TX_FLAGS_FSO)) {
1641 u16 j = 1; 1639 u16 j = 0;
1642 1640
1643 if (num_frags < (I40E_MAX_BUFFER_TXD)) 1641 if (num_frags < (I40E_MAX_BUFFER_TXD))
1644 goto linearize_chk_done; 1642 goto linearize_chk_done;
@@ -1649,21 +1647,18 @@ static bool i40e_chk_linearize(struct sk_buff *skb, u32 tx_flags,
1649 goto linearize_chk_done; 1647 goto linearize_chk_done;
1650 } 1648 }
1651 frag = &skb_shinfo(skb)->frags[0]; 1649 frag = &skb_shinfo(skb)->frags[0];
1652 size = hdr_len;
1653 /* we might still have more fragments per segment */ 1650 /* we might still have more fragments per segment */
1654 do { 1651 do {
1655 size += skb_frag_size(frag); 1652 size += skb_frag_size(frag);
1656 frag++; j++; 1653 frag++; j++;
1654 if ((size >= skb_shinfo(skb)->gso_size) &&
1655 (j < I40E_MAX_BUFFER_TXD)) {
1656 size = (size % skb_shinfo(skb)->gso_size);
1657 j = (size) ? 1 : 0;
1658 }
1657 if (j == I40E_MAX_BUFFER_TXD) { 1659 if (j == I40E_MAX_BUFFER_TXD) {
1658 if (size < skb_shinfo(skb)->gso_size) { 1660 linearize = true;
1659 linearize = true; 1661 break;
1660 break;
1661 }
1662 j = 1;
1663 size -= skb_shinfo(skb)->gso_size;
1664 if (size)
1665 j++;
1666 size += hdr_len;
1667 } 1662 }
1668 num_frags--; 1663 num_frags--;
1669 } while (num_frags); 1664 } while (num_frags);
@@ -1950,7 +1945,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
1950 else if (tso) 1945 else if (tso)
1951 tx_flags |= I40E_TX_FLAGS_TSO; 1946 tx_flags |= I40E_TX_FLAGS_TSO;
1952 1947
1953 if (i40e_chk_linearize(skb, tx_flags, hdr_len)) 1948 if (i40e_chk_linearize(skb, tx_flags))
1954 if (skb_linearize(skb)) 1949 if (skb_linearize(skb))
1955 goto out_drop; 1950 goto out_drop;
1956 1951