aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-10-23 09:58:09 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-23 09:58:09 -0400
commitbf7958607d0b792e0c43482c0c78786023a69832 (patch)
treeceb1fdc52660a7787f11c76e63c1d627c559a9c3
parente74f51056a167036f9168fb8d04b9e16ea12af43 (diff)
parent8443c1a4b192089e62642d847ebac3e4d15134c3 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-10-23 This series contains updates to i40e, i40evf, if_link, ixgbe and ixgbevf. Anjali adds a workaround to drop any flow control frames from being transmitted from any VSI, so that a malicious VF cannot send flow control or PFC packets out on the wire. Also fixed a bug in debugfs by grabbing the filter list lock before adding or deleting a filter. Akeem fixes an issue where we were unconditionally returning VEB bridge mode before allowing LB in the add VSI routine, resolve by checking if the bridge is actually in VEB mode first. Mitch fixed an issue where the incorrect structure was being used for VLAN filter list, which meant the VLAN filter list did not get processed correctly and VLAN filters would not be re-enabled after any kind of reset. Helin fixed a problem of possibly getting inconsistent flow control status after a PF reset. The issue was requested_mode was being set with a default value during probe, but the hardware state could be a different value from this mode. Carolyn fixed a problem where the driver output of the OEM version string varied from the other tools. Jean Sacren fixes up kernel documentation by fixing function header comments to match actual variables used in the functions. Also cleaned up variable initialization, when the variable would be over-written immediately. Hiroshi Shimanoto provides three patches to add "trusted" VF by adding netlink directives and an NDO entry. Then implement these new controls in ixgbe and ixgbevf. This series has gone through several iterations to address all the suggested community changes and concerns. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e.h17
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_common.c44
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c4
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c56
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c9
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_prototype.h2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c3
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c1
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_common.c22
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40e_prototype.h2
-rw-r--r--drivers/net/ethernet/intel/i40evf/i40evf_main.c17
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h8
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c1
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c96
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h1
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf.h6
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c8
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/mbx.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/vf.c41
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/vf.h1
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/netdevice.h3
-rw-r--r--include/uapi/linux/if_link.h6
-rw-r--r--net/core/rtnetlink.c24
25 files changed, 318 insertions, 59 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 7c2b2e891f62..4dd3e26129b4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -109,8 +109,10 @@
109#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT) 109#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT)
110#define I40E_NVM_VERSION_HI_SHIFT 12 110#define I40E_NVM_VERSION_HI_SHIFT 12
111#define I40E_NVM_VERSION_HI_MASK (0xf << I40E_NVM_VERSION_HI_SHIFT) 111#define I40E_NVM_VERSION_HI_MASK (0xf << I40E_NVM_VERSION_HI_SHIFT)
112#define I40E_OEM_VER_BUILD_MASK 0xff00 112#define I40E_OEM_VER_BUILD_MASK 0xffff
113#define I40E_OEM_VER_PATCH_MASK 0xff 113#define I40E_OEM_VER_PATCH_MASK 0xff
114#define I40E_OEM_VER_BUILD_SHIFT 8
115#define I40E_OEM_VER_SHIFT 24
114 116
115/* The values in here are decimal coded as hex as is the case in the NVM map*/ 117/* The values in here are decimal coded as hex as is the case in the NVM map*/
116#define I40E_CURRENT_NVM_VERSION_HI 0x2 118#define I40E_CURRENT_NVM_VERSION_HI 0x2
@@ -594,6 +596,15 @@ struct i40e_device {
594static inline char *i40e_nvm_version_str(struct i40e_hw *hw) 596static inline char *i40e_nvm_version_str(struct i40e_hw *hw)
595{ 597{
596 static char buf[32]; 598 static char buf[32];
599 u32 full_ver;
600 u8 ver, patch;
601 u16 build;
602
603 full_ver = hw->nvm.oem_ver;
604 ver = (u8)(full_ver >> I40E_OEM_VER_SHIFT);
605 build = (u16)((full_ver >> I40E_OEM_VER_BUILD_SHIFT)
606 & I40E_OEM_VER_BUILD_MASK);
607 patch = (u8)(full_ver & I40E_OEM_VER_PATCH_MASK);
597 608
598 snprintf(buf, sizeof(buf), 609 snprintf(buf, sizeof(buf),
599 "%x.%02x 0x%x %d.%d.%d", 610 "%x.%02x 0x%x %d.%d.%d",
@@ -601,9 +612,7 @@ static inline char *i40e_nvm_version_str(struct i40e_hw *hw)
601 I40E_NVM_VERSION_HI_SHIFT, 612 I40E_NVM_VERSION_HI_SHIFT,
602 (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >> 613 (hw->nvm.version & I40E_NVM_VERSION_LO_MASK) >>
603 I40E_NVM_VERSION_LO_SHIFT, 614 I40E_NVM_VERSION_LO_SHIFT,
604 hw->nvm.eetrack, (hw->nvm.oem_ver >> 24), 615 hw->nvm.eetrack, ver, build, patch);
605 (hw->nvm.oem_ver & I40E_OEM_VER_BUILD_MASK) >> 8,
606 hw->nvm.oem_ver & I40E_OEM_VER_PATCH_MASK);
607 616
608 return buf; 617 return buf;
609} 618}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
index c51f2fb94716..2d74c6e4d7b6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_common.c
@@ -331,25 +331,11 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
331 len = buf_len; 331 len = buf_len;
332 /* write the full 16-byte chunks */ 332 /* write the full 16-byte chunks */
333 for (i = 0; i < (len - 16); i += 16) 333 for (i = 0; i < (len - 16); i += 16)
334 i40e_debug(hw, mask, 334 i40e_debug(hw, mask, "\t0x%04X %16ph\n", i, buf + i);
335 "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
336 i, buf[i], buf[i + 1], buf[i + 2],
337 buf[i + 3], buf[i + 4], buf[i + 5],
338 buf[i + 6], buf[i + 7], buf[i + 8],
339 buf[i + 9], buf[i + 10], buf[i + 11],
340 buf[i + 12], buf[i + 13], buf[i + 14],
341 buf[i + 15]);
342 /* write whatever's left over without overrunning the buffer */ 335 /* write whatever's left over without overrunning the buffer */
343 if (i < len) { 336 if (i < len)
344 char d_buf[80]; 337 i40e_debug(hw, mask, "\t0x%04X %*ph\n",
345 int j = 0; 338 i, len - i, buf + i);
346
347 memset(d_buf, 0, sizeof(d_buf));
348 j += sprintf(d_buf, "\t0x%04X ", i);
349 while (i < len)
350 j += sprintf(&d_buf[j], " %02X", buf[i++]);
351 i40e_debug(hw, mask, "%s\n", d_buf);
352 }
353 } 339 }
354} 340}
355 341
@@ -3829,6 +3815,28 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
3829} 3815}
3830 3816
3831/** 3817/**
3818 * i40e_add_filter_to_drop_tx_flow_control_frames- filter to drop flow control
3819 * @hw: pointer to the hw struct
3820 * @seid: VSI seid to add ethertype filter from
3821 **/
3822#define I40E_FLOW_CONTROL_ETHTYPE 0x8808
3823void i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
3824 u16 seid)
3825{
3826 u16 flag = I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC |
3827 I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP |
3828 I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX;
3829 u16 ethtype = I40E_FLOW_CONTROL_ETHTYPE;
3830 i40e_status status;
3831
3832 status = i40e_aq_add_rem_control_packet_filter(hw, NULL, ethtype, flag,
3833 seid, 0, true, NULL,
3834 NULL);
3835 if (status)
3836 hw_dbg(hw, "Ethtype Filter Add failed: Error pruning Tx flow control frames\n");
3837}
3838
3839/**
3832 * i40e_aq_alternate_read 3840 * i40e_aq_alternate_read
3833 * @hw: pointer to the hardware structure 3841 * @hw: pointer to the hardware structure
3834 * @reg_addr0: address of first dword to be read 3842 * @reg_addr0: address of first dword to be read
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index d15bd62eb874..d4b7af9a2fc8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -1137,7 +1137,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1137 goto command_write_done; 1137 goto command_write_done;
1138 } 1138 }
1139 1139
1140 spin_lock_bh(&vsi->mac_filter_list_lock);
1140 f = i40e_add_filter(vsi, ma, vlan, false, false); 1141 f = i40e_add_filter(vsi, ma, vlan, false, false);
1142 spin_unlock_bh(&vsi->mac_filter_list_lock);
1141 ret = i40e_sync_vsi_filters(vsi, true); 1143 ret = i40e_sync_vsi_filters(vsi, true);
1142 if (f && !ret) 1144 if (f && !ret)
1143 dev_info(&pf->pdev->dev, 1145 dev_info(&pf->pdev->dev,
@@ -1174,7 +1176,9 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
1174 goto command_write_done; 1176 goto command_write_done;
1175 } 1177 }
1176 1178
1179 spin_lock_bh(&vsi->mac_filter_list_lock);
1177 i40e_del_filter(vsi, ma, vlan, false, false); 1180 i40e_del_filter(vsi, ma, vlan, false, false);
1181 spin_unlock_bh(&vsi->mac_filter_list_lock);
1178 ret = i40e_sync_vsi_filters(vsi, true); 1182 ret = i40e_sync_vsi_filters(vsi, true);
1179 if (!ret) 1183 if (!ret)
1180 dev_info(&pf->pdev->dev, 1184 dev_info(&pf->pdev->dev,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index cc8c0aeab9bb..3e595adfb0bf 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -39,7 +39,7 @@ static const char i40e_driver_string[] =
39 39
40#define DRV_VERSION_MAJOR 1 40#define DRV_VERSION_MAJOR 1
41#define DRV_VERSION_MINOR 3 41#define DRV_VERSION_MINOR 3
42#define DRV_VERSION_BUILD 38 42#define DRV_VERSION_BUILD 46
43#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ 43#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
44 __stringify(DRV_VERSION_MINOR) "." \ 44 __stringify(DRV_VERSION_MINOR) "." \
45 __stringify(DRV_VERSION_BUILD) DRV_KERN 45 __stringify(DRV_VERSION_BUILD) DRV_KERN
@@ -6837,6 +6837,15 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
6837 if (pf->flags & I40E_FLAG_MSIX_ENABLED) 6837 if (pf->flags & I40E_FLAG_MSIX_ENABLED)
6838 ret = i40e_setup_misc_vector(pf); 6838 ret = i40e_setup_misc_vector(pf);
6839 6839
6840 /* Add a filter to drop all Flow control frames from any VSI from being
6841 * transmitted. By doing so we stop a malicious VF from sending out
6842 * PAUSE or PFC frames and potentially controlling traffic for other
6843 * PF/VF VSIs.
6844 * The FW can still send Flow control frames if enabled.
6845 */
6846 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw,
6847 pf->main_vsi_seid);
6848
6840 /* restart the VSIs that were rebuilt and running before the reset */ 6849 /* restart the VSIs that were rebuilt and running before the reset */
6841 i40e_pf_unquiesce_all_vsi(pf); 6850 i40e_pf_unquiesce_all_vsi(pf);
6842 6851
@@ -8732,12 +8741,22 @@ int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi)
8732 return 1; 8741 return 1;
8733 8742
8734 veb = pf->veb[vsi->veb_idx]; 8743 veb = pf->veb[vsi->veb_idx];
8744 if (!veb) {
8745 dev_info(&pf->pdev->dev,
8746 "There is no veb associated with the bridge\n");
8747 return -ENOENT;
8748 }
8749
8735 /* Uplink is a bridge in VEPA mode */ 8750 /* Uplink is a bridge in VEPA mode */
8736 if (veb && (veb->bridge_mode & BRIDGE_MODE_VEPA)) 8751 if (veb->bridge_mode & BRIDGE_MODE_VEPA) {
8737 return 0; 8752 return 0;
8753 } else {
8754 /* Uplink is a bridge in VEB mode */
8755 return 1;
8756 }
8738 8757
8739 /* Uplink is a bridge in VEB mode */ 8758 /* VEPA is now default bridge, so return 0 */
8740 return 1; 8759 return 0;
8741} 8760}
8742 8761
8743/** 8762/**
@@ -10164,6 +10183,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
10164 int err; 10183 int err;
10165 u32 len; 10184 u32 len;
10166 u32 i; 10185 u32 i;
10186 u8 set_fc_aq_fail;
10167 10187
10168 err = pci_enable_device_mem(pdev); 10188 err = pci_enable_device_mem(pdev);
10169 if (err) 10189 if (err)
@@ -10428,6 +10448,25 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
10428 dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err); 10448 dev_info(&pdev->dev, "setup_pf_switch failed: %d\n", err);
10429 goto err_vsis; 10449 goto err_vsis;
10430 } 10450 }
10451
10452 /* Make sure flow control is set according to current settings */
10453 err = i40e_set_fc(hw, &set_fc_aq_fail, true);
10454 if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_GET)
10455 dev_dbg(&pf->pdev->dev,
10456 "Set fc with err %s aq_err %s on get_phy_cap\n",
10457 i40e_stat_str(hw, err),
10458 i40e_aq_str(hw, hw->aq.asq_last_status));
10459 if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_SET)
10460 dev_dbg(&pf->pdev->dev,
10461 "Set fc with err %s aq_err %s on set_phy_config\n",
10462 i40e_stat_str(hw, err),
10463 i40e_aq_str(hw, hw->aq.asq_last_status));
10464 if (set_fc_aq_fail & I40E_SET_FC_AQ_FAIL_UPDATE)
10465 dev_dbg(&pf->pdev->dev,
10466 "Set fc with err %s aq_err %s on get_link_info\n",
10467 i40e_stat_str(hw, err),
10468 i40e_aq_str(hw, hw->aq.asq_last_status));
10469
10431 /* if FDIR VSI was set up, start it now */ 10470 /* if FDIR VSI was set up, start it now */
10432 for (i = 0; i < pf->num_alloc_vsi; i++) { 10471 for (i = 0; i < pf->num_alloc_vsi; i++) {
10433 if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) { 10472 if (pf->vsi[i] && pf->vsi[i]->type == I40E_VSI_FDIR) {
@@ -10585,6 +10624,15 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
10585 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); 10624 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
10586 pf->hw.phy.phy_types = le32_to_cpu(abilities.phy_type); 10625 pf->hw.phy.phy_types = le32_to_cpu(abilities.phy_type);
10587 10626
10627 /* Add a filter to drop all Flow control frames from any VSI from being
10628 * transmitted. By doing so we stop a malicious VF from sending out
10629 * PAUSE or PFC frames and potentially controlling traffic for other
10630 * PF/VF VSIs.
10631 * The FW can still send Flow control frames if enabled.
10632 */
10633 i40e_add_filter_to_drop_tx_flow_control_frames(&pf->hw,
10634 pf->main_vsi_seid);
10635
10588 /* print a string summarizing features */ 10636 /* print a string summarizing features */
10589 i40e_print_features(pf); 10637 i40e_print_features(pf);
10590 10638
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 58e384a372a0..6100cdd9ad13 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -484,7 +484,7 @@ static i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
484static i40e_status i40e_calc_nvm_checksum(struct i40e_hw *hw, 484static i40e_status i40e_calc_nvm_checksum(struct i40e_hw *hw,
485 u16 *checksum) 485 u16 *checksum)
486{ 486{
487 i40e_status ret_code = 0; 487 i40e_status ret_code;
488 struct i40e_virt_mem vmem; 488 struct i40e_virt_mem vmem;
489 u16 pcie_alt_module = 0; 489 u16 pcie_alt_module = 0;
490 u16 checksum_local = 0; 490 u16 checksum_local = 0;
@@ -564,15 +564,16 @@ i40e_calc_nvm_checksum_exit:
564 **/ 564 **/
565i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw) 565i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
566{ 566{
567 i40e_status ret_code = 0; 567 i40e_status ret_code;
568 u16 checksum; 568 u16 checksum;
569 __le16 le_sum; 569 __le16 le_sum;
570 570
571 ret_code = i40e_calc_nvm_checksum(hw, &checksum); 571 ret_code = i40e_calc_nvm_checksum(hw, &checksum);
572 le_sum = cpu_to_le16(checksum); 572 if (!ret_code) {
573 if (!ret_code) 573 le_sum = cpu_to_le16(checksum);
574 ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD, 574 ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
575 1, &le_sum, true); 575 1, &le_sum, true);
576 }
576 577
577 return ret_code; 578 return ret_code;
578} 579}
diff --git a/drivers/net/ethernet/intel/i40e/i40e_prototype.h b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
index 10bf2ba8bc15..bb9d583e5416 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_prototype.h
@@ -322,4 +322,6 @@ i40e_status i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
322 void *buff, u16 *ret_buff_size, 322 void *buff, u16 *ret_buff_size,
323 u8 *ret_next_table, u32 *ret_next_index, 323 u8 *ret_next_table, u32 *ret_next_index,
324 struct i40e_asq_cmd_details *cmd_details); 324 struct i40e_asq_cmd_details *cmd_details);
325void i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
326 u16 vsi_seid);
325#endif /* _I40E_PROTOTYPE_H_ */ 327#endif /* _I40E_PROTOTYPE_H_ */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 006f0fb4720c..635b3ac17877 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2187,6 +2187,7 @@ out:
2187 * @tx_ring: ptr to the ring to send 2187 * @tx_ring: ptr to the ring to send
2188 * @skb: ptr to the skb we're sending 2188 * @skb: ptr to the skb we're sending
2189 * @hdr_len: ptr to the size of the packet header 2189 * @hdr_len: ptr to the size of the packet header
2190 * @cd_type_cmd_tso_mss: ptr to u64 object
2190 * @cd_tunneling: ptr to context descriptor bits 2191 * @cd_tunneling: ptr to context descriptor bits
2191 * 2192 *
2192 * Returns 0 if no TSO can happen, 1 if tso is going, or error 2193 * Returns 0 if no TSO can happen, 1 if tso is going, or error
@@ -2246,6 +2247,7 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
2246 * @tx_ring: ptr to the ring to send 2247 * @tx_ring: ptr to the ring to send
2247 * @skb: ptr to the skb we're sending 2248 * @skb: ptr to the skb we're sending
2248 * @tx_flags: the collected send information 2249 * @tx_flags: the collected send information
2250 * @cd_type_cmd_tso_mss: ptr to u64 object
2249 * 2251 *
2250 * Returns 0 if no Tx timestamp can happen and 1 if the timestamp will happen 2252 * Returns 0 if no Tx timestamp can happen and 1 if the timestamp will happen
2251 **/ 2253 **/
@@ -2288,6 +2290,7 @@ static int i40e_tsyn(struct i40e_ring *tx_ring, struct sk_buff *skb,
2288 * @tx_flags: pointer to Tx flags currently set 2290 * @tx_flags: pointer to Tx flags currently set
2289 * @td_cmd: Tx descriptor command bits to set 2291 * @td_cmd: Tx descriptor command bits to set
2290 * @td_offset: Tx descriptor header offsets to set 2292 * @td_offset: Tx descriptor header offsets to set
2293 * @tx_ring: Tx descriptor ring
2291 * @cd_tunneling: ptr to context desc bits 2294 * @cd_tunneling: ptr to context desc bits
2292 **/ 2295 **/
2293static void i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags, 2296static void i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index b2d95ee7ec69..44462b40f2d7 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -944,6 +944,7 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
944 if (pci_num_vf(pf->pdev) != num_alloc_vfs) { 944 if (pci_num_vf(pf->pdev) != num_alloc_vfs) {
945 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs); 945 ret = pci_enable_sriov(pf->pdev, num_alloc_vfs);
946 if (ret) { 946 if (ret) {
947 pf->flags &= ~I40E_FLAG_VEB_MODE_ENABLED;
947 pf->num_alloc_vfs = 0; 948 pf->num_alloc_vfs = 0;
948 goto err_iov; 949 goto err_iov;
949 } 950 }
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_common.c b/drivers/net/ethernet/intel/i40evf/i40e_common.c
index a4c5a49ddbcf..72b1942a94aa 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_common.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_common.c
@@ -331,25 +331,11 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
331 len = buf_len; 331 len = buf_len;
332 /* write the full 16-byte chunks */ 332 /* write the full 16-byte chunks */
333 for (i = 0; i < (len - 16); i += 16) 333 for (i = 0; i < (len - 16); i += 16)
334 i40e_debug(hw, mask, 334 i40e_debug(hw, mask, "\t0x%04X %16ph\n", i, buf + i);
335 "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
336 i, buf[i], buf[i + 1], buf[i + 2],
337 buf[i + 3], buf[i + 4], buf[i + 5],
338 buf[i + 6], buf[i + 7], buf[i + 8],
339 buf[i + 9], buf[i + 10], buf[i + 11],
340 buf[i + 12], buf[i + 13], buf[i + 14],
341 buf[i + 15]);
342 /* write whatever's left over without overrunning the buffer */ 335 /* write whatever's left over without overrunning the buffer */
343 if (i < len) { 336 if (i < len)
344 char d_buf[80]; 337 i40e_debug(hw, mask, "\t0x%04X %*ph\n",
345 int j = 0; 338 i, len - i, buf + i);
346
347 memset(d_buf, 0, sizeof(d_buf));
348 j += sprintf(d_buf, "\t0x%04X ", i);
349 while (i < len)
350 j += sprintf(&d_buf[j], " %02X", buf[i++]);
351 i40e_debug(hw, mask, "%s\n", d_buf);
352 }
353 } 339 }
354} 340}
355 341
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_prototype.h b/drivers/net/ethernet/intel/i40evf/i40e_prototype.h
index 8ed0edfbc125..cbd9a1b078ab 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_prototype.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_prototype.h
@@ -101,4 +101,6 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
101 u16 vsi_seid, u16 queue, bool is_add, 101 u16 vsi_seid, u16 queue, bool is_add,
102 struct i40e_control_filter_stats *stats, 102 struct i40e_control_filter_stats *stats,
103 struct i40e_asq_cmd_details *cmd_details); 103 struct i40e_asq_cmd_details *cmd_details);
104void i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
105 u16 vsi_seid);
104#endif /* _I40E_PROTOTYPE_H_ */ 106#endif /* _I40E_PROTOTYPE_H_ */
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 10b2a4a33c68..d962164dfb0f 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -34,7 +34,7 @@ char i40evf_driver_name[] = "i40evf";
34static const char i40evf_driver_string[] = 34static const char i40evf_driver_string[] =
35 "Intel(R) XL710/X710 Virtual Function Network Driver"; 35 "Intel(R) XL710/X710 Virtual Function Network Driver";
36 36
37#define DRV_VERSION "1.3.25" 37#define DRV_VERSION "1.3.33"
38const char i40evf_driver_version[] = DRV_VERSION; 38const char i40evf_driver_version[] = DRV_VERSION;
39static const char i40evf_copyright[] = 39static const char i40evf_copyright[] =
40 "Copyright (c) 2013 - 2015 Intel Corporation."; 40 "Copyright (c) 2013 - 2015 Intel Corporation.";
@@ -282,6 +282,7 @@ static void i40evf_fire_sw_int(struct i40evf_adapter *adapter, u32 mask)
282/** 282/**
283 * i40evf_irq_enable - Enable default interrupt generation settings 283 * i40evf_irq_enable - Enable default interrupt generation settings
284 * @adapter: board private structure 284 * @adapter: board private structure
285 * @flush: boolean value whether to run rd32()
285 **/ 286 **/
286void i40evf_irq_enable(struct i40evf_adapter *adapter, bool flush) 287void i40evf_irq_enable(struct i40evf_adapter *adapter, bool flush)
287{ 288{
@@ -305,15 +306,14 @@ static irqreturn_t i40evf_msix_aq(int irq, void *data)
305 struct i40evf_adapter *adapter = netdev_priv(netdev); 306 struct i40evf_adapter *adapter = netdev_priv(netdev);
306 struct i40e_hw *hw = &adapter->hw; 307 struct i40e_hw *hw = &adapter->hw;
307 u32 val; 308 u32 val;
308 u32 ena_mask;
309 309
310 /* handle non-queue interrupts */ 310 /* handle non-queue interrupts */
311 val = rd32(hw, I40E_VFINT_ICR01); 311 rd32(hw, I40E_VFINT_ICR01);
312 ena_mask = rd32(hw, I40E_VFINT_ICR0_ENA1); 312 rd32(hw, I40E_VFINT_ICR0_ENA1);
313 313
314 314
315 val = rd32(hw, I40E_VFINT_DYN_CTL01); 315 val = rd32(hw, I40E_VFINT_DYN_CTL01) |
316 val = val | I40E_VFINT_DYN_CTL01_CLEARPBA_MASK; 316 I40E_VFINT_DYN_CTL01_CLEARPBA_MASK;
317 wr32(hw, I40E_VFINT_DYN_CTL01, val); 317 wr32(hw, I40E_VFINT_DYN_CTL01, val);
318 318
319 /* schedule work on the private workqueue */ 319 /* schedule work on the private workqueue */
@@ -1609,6 +1609,7 @@ static void i40evf_reset_task(struct work_struct *work)
1609 reset_task); 1609 reset_task);
1610 struct net_device *netdev = adapter->netdev; 1610 struct net_device *netdev = adapter->netdev;
1611 struct i40e_hw *hw = &adapter->hw; 1611 struct i40e_hw *hw = &adapter->hw;
1612 struct i40evf_vlan_filter *vlf;
1612 struct i40evf_mac_filter *f; 1613 struct i40evf_mac_filter *f;
1613 u32 reg_val; 1614 u32 reg_val;
1614 int i = 0, err; 1615 int i = 0, err;
@@ -1732,8 +1733,8 @@ continue_reset:
1732 f->add = true; 1733 f->add = true;
1733 } 1734 }
1734 /* re-add all VLAN filters */ 1735 /* re-add all VLAN filters */
1735 list_for_each_entry(f, &adapter->vlan_filter_list, list) { 1736 list_for_each_entry(vlf, &adapter->vlan_filter_list, list) {
1736 f->add = true; 1737 vlf->add = true;
1737 } 1738 }
1738 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER; 1739 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER;
1739 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER; 1740 adapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index dda0f678339a..1d2174526a4c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -152,9 +152,17 @@ struct vf_data_storage {
152 u16 vlan_count; 152 u16 vlan_count;
153 u8 spoofchk_enabled; 153 u8 spoofchk_enabled;
154 bool rss_query_enabled; 154 bool rss_query_enabled;
155 u8 trusted;
156 int xcast_mode;
155 unsigned int vf_api; 157 unsigned int vf_api;
156}; 158};
157 159
160enum ixgbevf_xcast_modes {
161 IXGBEVF_XCAST_MODE_NONE = 0,
162 IXGBEVF_XCAST_MODE_MULTI,
163 IXGBEVF_XCAST_MODE_ALLMULTI,
164};
165
158struct vf_macvlans { 166struct vf_macvlans {
159 struct list_head l; 167 struct list_head l;
160 int vf; 168 int vf;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 9f8a7fd7a195..47395ff5d908 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8407,6 +8407,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
8407 .ndo_set_vf_rate = ixgbe_ndo_set_vf_bw, 8407 .ndo_set_vf_rate = ixgbe_ndo_set_vf_bw,
8408 .ndo_set_vf_spoofchk = ixgbe_ndo_set_vf_spoofchk, 8408 .ndo_set_vf_spoofchk = ixgbe_ndo_set_vf_spoofchk,
8409 .ndo_set_vf_rss_query_en = ixgbe_ndo_set_vf_rss_query_en, 8409 .ndo_set_vf_rss_query_en = ixgbe_ndo_set_vf_rss_query_en,
8410 .ndo_set_vf_trust = ixgbe_ndo_set_vf_trust,
8410 .ndo_get_vf_config = ixgbe_ndo_get_vf_config, 8411 .ndo_get_vf_config = ixgbe_ndo_get_vf_config,
8411 .ndo_get_stats64 = ixgbe_get_stats64, 8412 .ndo_get_stats64 = ixgbe_get_stats64,
8412#ifdef CONFIG_IXGBE_DCB 8413#ifdef CONFIG_IXGBE_DCB
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
index b1e4703ff2a5..8daa95f74548 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_mbx.h
@@ -102,6 +102,8 @@ enum ixgbe_pfvf_api_rev {
102#define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */ 102#define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */
103#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS key */ 103#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS key */
104 104
105#define IXGBE_VF_UPDATE_XCAST_MODE 0x0c
106
105/* length of permanent address message returned from PF */ 107/* length of permanent address message returned from PF */
106#define IXGBE_VF_PERMADDR_MSG_LEN 4 108#define IXGBE_VF_PERMADDR_MSG_LEN 4
107/* word in permanent address message with the current multicast type */ 109/* word in permanent address message with the current multicast type */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 1d17b5872dd1..fcd8b27a0ccb 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -116,6 +116,12 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
116 * we want to disable the querying by default. 116 * we want to disable the querying by default.
117 */ 117 */
118 adapter->vfinfo[i].rss_query_enabled = 0; 118 adapter->vfinfo[i].rss_query_enabled = 0;
119
120 /* Untrust all VFs */
121 adapter->vfinfo[i].trusted = false;
122
123 /* set the default xcast mode */
124 adapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE;
119 } 125 }
120 126
121 return 0; 127 return 0;
@@ -1001,6 +1007,59 @@ static int ixgbe_get_vf_rss_key(struct ixgbe_adapter *adapter,
1001 return 0; 1007 return 0;
1002} 1008}
1003 1009
1010static int ixgbe_update_vf_xcast_mode(struct ixgbe_adapter *adapter,
1011 u32 *msgbuf, u32 vf)
1012{
1013 struct ixgbe_hw *hw = &adapter->hw;
1014 int xcast_mode = msgbuf[1];
1015 u32 vmolr, disable, enable;
1016
1017 /* verify the PF is supporting the correct APIs */
1018 switch (adapter->vfinfo[vf].vf_api) {
1019 case ixgbe_mbox_api_12:
1020 break;
1021 default:
1022 return -EOPNOTSUPP;
1023 }
1024
1025 if (xcast_mode > IXGBEVF_XCAST_MODE_MULTI &&
1026 !adapter->vfinfo[vf].trusted) {
1027 xcast_mode = IXGBEVF_XCAST_MODE_MULTI;
1028 }
1029
1030 if (adapter->vfinfo[vf].xcast_mode == xcast_mode)
1031 goto out;
1032
1033 switch (xcast_mode) {
1034 case IXGBEVF_XCAST_MODE_NONE:
1035 disable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
1036 enable = 0;
1037 break;
1038 case IXGBEVF_XCAST_MODE_MULTI:
1039 disable = IXGBE_VMOLR_MPE;
1040 enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE;
1041 break;
1042 case IXGBEVF_XCAST_MODE_ALLMULTI:
1043 disable = 0;
1044 enable = IXGBE_VMOLR_BAM | IXGBE_VMOLR_ROMPE | IXGBE_VMOLR_MPE;
1045 break;
1046 default:
1047 return -EOPNOTSUPP;
1048 }
1049
1050 vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf));
1051 vmolr &= ~disable;
1052 vmolr |= enable;
1053 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
1054
1055 adapter->vfinfo[vf].xcast_mode = xcast_mode;
1056
1057out:
1058 msgbuf[1] = xcast_mode;
1059
1060 return 0;
1061}
1062
1004static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) 1063static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
1005{ 1064{
1006 u32 mbx_size = IXGBE_VFMAILBOX_SIZE; 1065 u32 mbx_size = IXGBE_VFMAILBOX_SIZE;
@@ -1063,6 +1122,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf)
1063 case IXGBE_VF_GET_RSS_KEY: 1122 case IXGBE_VF_GET_RSS_KEY:
1064 retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf); 1123 retval = ixgbe_get_vf_rss_key(adapter, msgbuf, vf);
1065 break; 1124 break;
1125 case IXGBE_VF_UPDATE_XCAST_MODE:
1126 retval = ixgbe_update_vf_xcast_mode(adapter, msgbuf, vf);
1127 break;
1066 default: 1128 default:
1067 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); 1129 e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]);
1068 retval = IXGBE_ERR_MBX; 1130 retval = IXGBE_ERR_MBX;
@@ -1124,6 +1186,17 @@ void ixgbe_disable_tx_rx(struct ixgbe_adapter *adapter)
1124 IXGBE_WRITE_REG(hw, IXGBE_VFRE(1), 0); 1186 IXGBE_WRITE_REG(hw, IXGBE_VFRE(1), 0);
1125} 1187}
1126 1188
1189static inline void ixgbe_ping_vf(struct ixgbe_adapter *adapter, int vf)
1190{
1191 struct ixgbe_hw *hw = &adapter->hw;
1192 u32 ping;
1193
1194 ping = IXGBE_PF_CONTROL_MSG;
1195 if (adapter->vfinfo[vf].clear_to_send)
1196 ping |= IXGBE_VT_MSGTYPE_CTS;
1197 ixgbe_write_mbx(hw, &ping, 1, vf);
1198}
1199
1127void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter) 1200void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter)
1128{ 1201{
1129 struct ixgbe_hw *hw = &adapter->hw; 1202 struct ixgbe_hw *hw = &adapter->hw;
@@ -1416,6 +1489,28 @@ int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
1416 return 0; 1489 return 0;
1417} 1490}
1418 1491
1492int ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting)
1493{
1494 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1495
1496 if (vf >= adapter->num_vfs)
1497 return -EINVAL;
1498
1499 /* nothing to do */
1500 if (adapter->vfinfo[vf].trusted == setting)
1501 return 0;
1502
1503 adapter->vfinfo[vf].trusted = setting;
1504
1505 /* reset VF to reconfigure features */
1506 adapter->vfinfo[vf].clear_to_send = false;
1507 ixgbe_ping_vf(adapter, vf);
1508
1509 e_info(drv, "VF %u is %strusted\n", vf, setting ? "" : "not ");
1510
1511 return 0;
1512}
1513
1419int ixgbe_ndo_get_vf_config(struct net_device *netdev, 1514int ixgbe_ndo_get_vf_config(struct net_device *netdev,
1420 int vf, struct ifla_vf_info *ivi) 1515 int vf, struct ifla_vf_info *ivi)
1421{ 1516{
@@ -1430,5 +1525,6 @@ int ixgbe_ndo_get_vf_config(struct net_device *netdev,
1430 ivi->qos = adapter->vfinfo[vf].pf_qos; 1525 ivi->qos = adapter->vfinfo[vf].pf_qos;
1431 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled; 1526 ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled;
1432 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled; 1527 ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled;
1528 ivi->trusted = adapter->vfinfo[vf].trusted;
1433 return 0; 1529 return 0;
1434} 1530}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
index 2c197e6d1fe7..dad925706f4c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
@@ -49,6 +49,7 @@ int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
49int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting); 49int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
50int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf, 50int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
51 bool setting); 51 bool setting);
52int ixgbe_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting);
52int ixgbe_ndo_get_vf_config(struct net_device *netdev, 53int ixgbe_ndo_get_vf_config(struct net_device *netdev,
53 int vf, struct ifla_vf_info *ivi); 54 int vf, struct ifla_vf_info *ivi);
54void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter); 55void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index 04c7ec8446e0..ec3147279621 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -471,6 +471,12 @@ enum ixgbevf_boards {
471 board_X550EM_x_vf, 471 board_X550EM_x_vf,
472}; 472};
473 473
474enum ixgbevf_xcast_modes {
475 IXGBEVF_XCAST_MODE_NONE = 0,
476 IXGBEVF_XCAST_MODE_MULTI,
477 IXGBEVF_XCAST_MODE_ALLMULTI,
478};
479
474extern const struct ixgbevf_info ixgbevf_82599_vf_info; 480extern const struct ixgbevf_info ixgbevf_82599_vf_info;
475extern const struct ixgbevf_info ixgbevf_X540_vf_info; 481extern const struct ixgbevf_info ixgbevf_X540_vf_info;
476extern const struct ixgbevf_info ixgbevf_X550_vf_info; 482extern const struct ixgbevf_info ixgbevf_X550_vf_info;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 7570b5c7ccd8..592ff237d692 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1894,9 +1894,17 @@ static void ixgbevf_set_rx_mode(struct net_device *netdev)
1894{ 1894{
1895 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 1895 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
1896 struct ixgbe_hw *hw = &adapter->hw; 1896 struct ixgbe_hw *hw = &adapter->hw;
1897 unsigned int flags = netdev->flags;
1898 int xcast_mode;
1899
1900 xcast_mode = (flags & IFF_ALLMULTI) ? IXGBEVF_XCAST_MODE_ALLMULTI :
1901 (flags & (IFF_BROADCAST | IFF_MULTICAST)) ?
1902 IXGBEVF_XCAST_MODE_MULTI : IXGBEVF_XCAST_MODE_NONE;
1897 1903
1898 spin_lock_bh(&adapter->mbx_lock); 1904 spin_lock_bh(&adapter->mbx_lock);
1899 1905
1906 hw->mac.ops.update_xcast_mode(hw, netdev, xcast_mode);
1907
1900 /* reprogram multicast list */ 1908 /* reprogram multicast list */
1901 hw->mac.ops.update_mc_addr_list(hw, netdev); 1909 hw->mac.ops.update_mc_addr_list(hw, netdev);
1902 1910
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.h b/drivers/net/ethernet/intel/ixgbevf/mbx.h
index 82f44e06e5fc..340cdd469455 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.h
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.h
@@ -112,6 +112,8 @@ enum ixgbe_pfvf_api_rev {
112#define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */ 112#define IXGBE_VF_GET_RETA 0x0a /* VF request for RETA */
113#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS hash key */ 113#define IXGBE_VF_GET_RSS_KEY 0x0b /* get RSS hash key */
114 114
115#define IXGBE_VF_UPDATE_XCAST_MODE 0x0c
116
115/* length of permanent address message returned from PF */ 117/* length of permanent address message returned from PF */
116#define IXGBE_VF_PERMADDR_MSG_LEN 4 118#define IXGBE_VF_PERMADDR_MSG_LEN 4
117/* word in permanent address message with the current multicast type */ 119/* word in permanent address message with the current multicast type */
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index d1339b050627..427f3605cbfc 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -469,6 +469,46 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
469} 469}
470 470
471/** 471/**
472 * ixgbevf_update_xcast_mode - Update Multicast mode
473 * @hw: pointer to the HW structure
474 * @netdev: pointer to net device structure
475 * @xcast_mode: new multicast mode
476 *
477 * Updates the Multicast Mode of VF.
478 **/
479static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,
480 struct net_device *netdev, int xcast_mode)
481{
482 struct ixgbe_mbx_info *mbx = &hw->mbx;
483 u32 msgbuf[2];
484 s32 err;
485
486 switch (hw->api_version) {
487 case ixgbe_mbox_api_12:
488 break;
489 default:
490 return -EOPNOTSUPP;
491 }
492
493 msgbuf[0] = IXGBE_VF_UPDATE_XCAST_MODE;
494 msgbuf[1] = xcast_mode;
495
496 err = mbx->ops.write_posted(hw, msgbuf, 2);
497 if (err)
498 return err;
499
500 err = mbx->ops.read_posted(hw, msgbuf, 2);
501 if (err)
502 return err;
503
504 msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
505 if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
506 return -EPERM;
507
508 return 0;
509}
510
511/**
472 * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address 512 * ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address
473 * @hw: pointer to the HW structure 513 * @hw: pointer to the HW structure
474 * @vlan: 12 bit VLAN ID 514 * @vlan: 12 bit VLAN ID
@@ -727,6 +767,7 @@ static const struct ixgbe_mac_operations ixgbevf_mac_ops = {
727 .check_link = ixgbevf_check_mac_link_vf, 767 .check_link = ixgbevf_check_mac_link_vf,
728 .set_rar = ixgbevf_set_rar_vf, 768 .set_rar = ixgbevf_set_rar_vf,
729 .update_mc_addr_list = ixgbevf_update_mc_addr_list_vf, 769 .update_mc_addr_list = ixgbevf_update_mc_addr_list_vf,
770 .update_xcast_mode = ixgbevf_update_xcast_mode,
730 .set_uc_addr = ixgbevf_set_uc_addr_vf, 771 .set_uc_addr = ixgbevf_set_uc_addr_vf,
731 .set_vfta = ixgbevf_set_vfta_vf, 772 .set_vfta = ixgbevf_set_vfta_vf,
732}; 773};
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index d40f036b6df0..ef9f7736b4dc 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -63,6 +63,7 @@ struct ixgbe_mac_operations {
63 s32 (*set_uc_addr)(struct ixgbe_hw *, u32, u8 *); 63 s32 (*set_uc_addr)(struct ixgbe_hw *, u32, u8 *);
64 s32 (*init_rx_addrs)(struct ixgbe_hw *); 64 s32 (*init_rx_addrs)(struct ixgbe_hw *);
65 s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *); 65 s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *);
66 s32 (*update_xcast_mode)(struct ixgbe_hw *, struct net_device *, int);
66 s32 (*enable_mc)(struct ixgbe_hw *); 67 s32 (*enable_mc)(struct ixgbe_hw *);
67 s32 (*disable_mc)(struct ixgbe_hw *); 68 s32 (*disable_mc)(struct ixgbe_hw *);
68 s32 (*clear_vfta)(struct ixgbe_hw *); 69 s32 (*clear_vfta)(struct ixgbe_hw *);
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index ae5d0d22955d..f923d15b432c 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -24,5 +24,6 @@ struct ifla_vf_info {
24 __u32 min_tx_rate; 24 __u32 min_tx_rate;
25 __u32 max_tx_rate; 25 __u32 max_tx_rate;
26 __u32 rss_query_en; 26 __u32 rss_query_en;
27 __u32 trusted;
27}; 28};
28#endif /* _LINUX_IF_LINK_H */ 29#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 69fdd427c8cb..773383859bd9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -881,6 +881,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
881 * int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate, 881 * int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
882 * int max_tx_rate); 882 * int max_tx_rate);
883 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 883 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
884 * int (*ndo_set_vf_trust)(struct net_device *dev, int vf, bool setting);
884 * int (*ndo_get_vf_config)(struct net_device *dev, 885 * int (*ndo_get_vf_config)(struct net_device *dev,
885 * int vf, struct ifla_vf_info *ivf); 886 * int vf, struct ifla_vf_info *ivf);
886 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state); 887 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
@@ -1109,6 +1110,8 @@ struct net_device_ops {
1109 int max_tx_rate); 1110 int max_tx_rate);
1110 int (*ndo_set_vf_spoofchk)(struct net_device *dev, 1111 int (*ndo_set_vf_spoofchk)(struct net_device *dev,
1111 int vf, bool setting); 1112 int vf, bool setting);
1113 int (*ndo_set_vf_trust)(struct net_device *dev,
1114 int vf, bool setting);
1112 int (*ndo_get_vf_config)(struct net_device *dev, 1115 int (*ndo_get_vf_config)(struct net_device *dev,
1113 int vf, 1116 int vf,
1114 struct ifla_vf_info *ivf); 1117 struct ifla_vf_info *ivf);
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index e3b6217f34f1..a7aea8418abb 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -550,6 +550,7 @@ enum {
550 * on/off switch 550 * on/off switch
551 */ 551 */
552 IFLA_VF_STATS, /* network device statistics */ 552 IFLA_VF_STATS, /* network device statistics */
553 IFLA_VF_TRUST, /* Trust VF */
553 __IFLA_VF_MAX, 554 __IFLA_VF_MAX,
554}; 555};
555 556
@@ -611,6 +612,11 @@ enum {
611 612
612#define IFLA_VF_STATS_MAX (__IFLA_VF_STATS_MAX - 1) 613#define IFLA_VF_STATS_MAX (__IFLA_VF_STATS_MAX - 1)
613 614
615struct ifla_vf_trust {
616 __u32 vf;
617 __u32 setting;
618};
619
614/* VF ports management section 620/* VF ports management section
615 * 621 *
616 * Nested layout of set/get msg is: 622 * Nested layout of set/get msg is:
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7c78b5aca944..504bd17b7456 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -838,7 +838,8 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
838 /* IFLA_VF_STATS_BROADCAST */ 838 /* IFLA_VF_STATS_BROADCAST */
839 nla_total_size(sizeof(__u64)) + 839 nla_total_size(sizeof(__u64)) +
840 /* IFLA_VF_STATS_MULTICAST */ 840 /* IFLA_VF_STATS_MULTICAST */
841 nla_total_size(sizeof(__u64))); 841 nla_total_size(sizeof(__u64)) +
842 nla_total_size(sizeof(struct ifla_vf_trust)));
842 return size; 843 return size;
843 } else 844 } else
844 return 0; 845 return 0;
@@ -1161,6 +1162,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1161 struct ifla_vf_link_state vf_linkstate; 1162 struct ifla_vf_link_state vf_linkstate;
1162 struct ifla_vf_rss_query_en vf_rss_query_en; 1163 struct ifla_vf_rss_query_en vf_rss_query_en;
1163 struct ifla_vf_stats vf_stats; 1164 struct ifla_vf_stats vf_stats;
1165 struct ifla_vf_trust vf_trust;
1164 1166
1165 /* 1167 /*
1166 * Not all SR-IOV capable drivers support the 1168 * Not all SR-IOV capable drivers support the
@@ -1170,6 +1172,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1170 */ 1172 */
1171 ivi.spoofchk = -1; 1173 ivi.spoofchk = -1;
1172 ivi.rss_query_en = -1; 1174 ivi.rss_query_en = -1;
1175 ivi.trusted = -1;
1173 memset(ivi.mac, 0, sizeof(ivi.mac)); 1176 memset(ivi.mac, 0, sizeof(ivi.mac));
1174 /* The default value for VF link state is "auto" 1177 /* The default value for VF link state is "auto"
1175 * IFLA_VF_LINK_STATE_AUTO which equals zero 1178 * IFLA_VF_LINK_STATE_AUTO which equals zero
@@ -1183,7 +1186,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1183 vf_tx_rate.vf = 1186 vf_tx_rate.vf =
1184 vf_spoofchk.vf = 1187 vf_spoofchk.vf =
1185 vf_linkstate.vf = 1188 vf_linkstate.vf =
1186 vf_rss_query_en.vf = ivi.vf; 1189 vf_rss_query_en.vf =
1190 vf_trust.vf = ivi.vf;
1187 1191
1188 memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac)); 1192 memcpy(vf_mac.mac, ivi.mac, sizeof(ivi.mac));
1189 vf_vlan.vlan = ivi.vlan; 1193 vf_vlan.vlan = ivi.vlan;
@@ -1194,6 +1198,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1194 vf_spoofchk.setting = ivi.spoofchk; 1198 vf_spoofchk.setting = ivi.spoofchk;
1195 vf_linkstate.link_state = ivi.linkstate; 1199 vf_linkstate.link_state = ivi.linkstate;
1196 vf_rss_query_en.setting = ivi.rss_query_en; 1200 vf_rss_query_en.setting = ivi.rss_query_en;
1201 vf_trust.setting = ivi.trusted;
1197 vf = nla_nest_start(skb, IFLA_VF_INFO); 1202 vf = nla_nest_start(skb, IFLA_VF_INFO);
1198 if (!vf) { 1203 if (!vf) {
1199 nla_nest_cancel(skb, vfinfo); 1204 nla_nest_cancel(skb, vfinfo);
@@ -1211,7 +1216,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1211 &vf_linkstate) || 1216 &vf_linkstate) ||
1212 nla_put(skb, IFLA_VF_RSS_QUERY_EN, 1217 nla_put(skb, IFLA_VF_RSS_QUERY_EN,
1213 sizeof(vf_rss_query_en), 1218 sizeof(vf_rss_query_en),
1214 &vf_rss_query_en)) 1219 &vf_rss_query_en) ||
1220 nla_put(skb, IFLA_VF_TRUST,
1221 sizeof(vf_trust), &vf_trust))
1215 goto nla_put_failure; 1222 goto nla_put_failure;
1216 memset(&vf_stats, 0, sizeof(vf_stats)); 1223 memset(&vf_stats, 0, sizeof(vf_stats));
1217 if (dev->netdev_ops->ndo_get_vf_stats) 1224 if (dev->netdev_ops->ndo_get_vf_stats)
@@ -1348,6 +1355,7 @@ static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
1348 [IFLA_VF_LINK_STATE] = { .len = sizeof(struct ifla_vf_link_state) }, 1355 [IFLA_VF_LINK_STATE] = { .len = sizeof(struct ifla_vf_link_state) },
1349 [IFLA_VF_RSS_QUERY_EN] = { .len = sizeof(struct ifla_vf_rss_query_en) }, 1356 [IFLA_VF_RSS_QUERY_EN] = { .len = sizeof(struct ifla_vf_rss_query_en) },
1350 [IFLA_VF_STATS] = { .type = NLA_NESTED }, 1357 [IFLA_VF_STATS] = { .type = NLA_NESTED },
1358 [IFLA_VF_TRUST] = { .len = sizeof(struct ifla_vf_trust) },
1351}; 1359};
1352 1360
1353static const struct nla_policy ifla_vf_stats_policy[IFLA_VF_STATS_MAX + 1] = { 1361static const struct nla_policy ifla_vf_stats_policy[IFLA_VF_STATS_MAX + 1] = {
@@ -1587,6 +1595,16 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
1587 return err; 1595 return err;
1588 } 1596 }
1589 1597
1598 if (tb[IFLA_VF_TRUST]) {
1599 struct ifla_vf_trust *ivt = nla_data(tb[IFLA_VF_TRUST]);
1600
1601 err = -EOPNOTSUPP;
1602 if (ops->ndo_set_vf_trust)
1603 err = ops->ndo_set_vf_trust(dev, ivt->vf, ivt->setting);
1604 if (err < 0)
1605 return err;
1606 }
1607
1590 return err; 1608 return err;
1591} 1609}
1592 1610