aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-10-01 20:17:03 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-10-23 00:14:32 -0400
commit107d3018abd9d15df24e8f2d52366fa7f983beda (patch)
tree457a62b6d4e68e8809cdc071e0a2bfd76c2aa7d1
parenta048b40e0f9502bc75d7f9904c5399a0a87fa479 (diff)
ixgbe: Add support for tracking the default user priority to SR-IOV
It is necessary to track the default user priority in the PF so that we can force it upon the VFs. The motivation behind this is to keep the VFs from getting access to user priorities meant for things like storage. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c20
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c53
3 files changed, 55 insertions, 20 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index ccb850500a9a..101e525e7fe3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -601,6 +601,8 @@ struct ixgbe_adapter {
601#ifdef CONFIG_DEBUG_FS 601#ifdef CONFIG_DEBUG_FS
602 struct dentry *ixgbe_dbg_adapter; 602 struct dentry *ixgbe_dbg_adapter;
603#endif /*CONFIG_DEBUG_FS*/ 603#endif /*CONFIG_DEBUG_FS*/
604
605 u8 default_up;
604}; 606};
605 607
606struct ixgbe_fdir_filter { 608struct ixgbe_fdir_filter {
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 3ef74f893c2e..35be7d38c584 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -5460,6 +5460,23 @@ static void ixgbe_watchdog_update_link(struct ixgbe_adapter *adapter)
5460 adapter->link_speed = link_speed; 5460 adapter->link_speed = link_speed;
5461} 5461}
5462 5462
5463static void ixgbe_update_default_up(struct ixgbe_adapter *adapter)
5464{
5465#ifdef CONFIG_IXGBE_DCB
5466 struct net_device *netdev = adapter->netdev;
5467 struct dcb_app app = {
5468 .selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE,
5469 .protocol = 0,
5470 };
5471 u8 up = 0;
5472
5473 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)
5474 up = dcb_ieee_getapp_mask(netdev, &app);
5475
5476 adapter->default_up = (up > 1) ? (ffs(up) - 1) : 0;
5477#endif
5478}
5479
5463/** 5480/**
5464 * ixgbe_watchdog_link_is_up - update netif_carrier status and 5481 * ixgbe_watchdog_link_is_up - update netif_carrier status and
5465 * print link up message 5482 * print link up message
@@ -5519,6 +5536,9 @@ static void ixgbe_watchdog_link_is_up(struct ixgbe_adapter *adapter)
5519 netif_carrier_on(netdev); 5536 netif_carrier_on(netdev);
5520 ixgbe_check_vf_rate_limit(adapter); 5537 ixgbe_check_vf_rate_limit(adapter);
5521 5538
5539 /* update the default user priority for VFs */
5540 ixgbe_update_default_up(adapter);
5541
5522 /* ping all the active vfs to let them know link has changed */ 5542 /* ping all the active vfs to let them know link has changed */
5523 ixgbe_ping_all_vfs(adapter); 5543 ixgbe_ping_all_vfs(adapter);
5524} 5544}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index f563625f1f49..b330a1c6c4c6 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -431,35 +431,47 @@ static void ixgbe_set_vmolr(struct ixgbe_hw *hw, u32 vf, bool aupe)
431 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr); 431 IXGBE_WRITE_REG(hw, IXGBE_VMOLR(vf), vmolr);
432} 432}
433 433
434static void ixgbe_set_vmvir(struct ixgbe_adapter *adapter, u32 vid, u32 vf) 434static void ixgbe_set_vmvir(struct ixgbe_adapter *adapter,
435 u16 vid, u16 qos, u32 vf)
435{ 436{
436 struct ixgbe_hw *hw = &adapter->hw; 437 struct ixgbe_hw *hw = &adapter->hw;
438 u32 vmvir = vid | (qos << VLAN_PRIO_SHIFT) | IXGBE_VMVIR_VLANA_DEFAULT;
437 439
438 if (vid) 440 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), vmvir);
439 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf),
440 (vid | IXGBE_VMVIR_VLANA_DEFAULT));
441 else
442 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), 0);
443} 441}
444 442
443static void ixgbe_clear_vmvir(struct ixgbe_adapter *adapter, u32 vf)
444{
445 struct ixgbe_hw *hw = &adapter->hw;
446
447 IXGBE_WRITE_REG(hw, IXGBE_VMVIR(vf), 0);
448}
445static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf) 449static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
446{ 450{
447 struct ixgbe_hw *hw = &adapter->hw; 451 struct ixgbe_hw *hw = &adapter->hw;
452 struct vf_data_storage *vfinfo = &adapter->vfinfo[vf];
448 int rar_entry = hw->mac.num_rar_entries - (vf + 1); 453 int rar_entry = hw->mac.num_rar_entries - (vf + 1);
454 u8 num_tcs = netdev_get_num_tc(adapter->netdev);
455
456 /* add PF assigned VLAN or VLAN 0 */
457 ixgbe_set_vf_vlan(adapter, true, vfinfo->pf_vlan, vf);
449 458
450 /* reset offloads to defaults */ 459 /* reset offloads to defaults */
451 if (adapter->vfinfo[vf].pf_vlan) { 460 ixgbe_set_vmolr(hw, vf, !vfinfo->pf_vlan);
452 ixgbe_set_vf_vlan(adapter, true, 461
453 adapter->vfinfo[vf].pf_vlan, vf); 462 /* set outgoing tags for VFs */
454 ixgbe_set_vmvir(adapter, 463 if (!vfinfo->pf_vlan && !vfinfo->pf_qos && !num_tcs) {
455 (adapter->vfinfo[vf].pf_vlan | 464 ixgbe_clear_vmvir(adapter, vf);
456 (adapter->vfinfo[vf].pf_qos <<
457 VLAN_PRIO_SHIFT)), vf);
458 ixgbe_set_vmolr(hw, vf, false);
459 } else { 465 } else {
460 ixgbe_set_vf_vlan(adapter, true, 0, vf); 466 if (vfinfo->pf_qos || !num_tcs)
461 ixgbe_set_vmvir(adapter, 0, vf); 467 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan,
462 ixgbe_set_vmolr(hw, vf, true); 468 vfinfo->pf_qos, vf);
469 else
470 ixgbe_set_vmvir(adapter, vfinfo->pf_vlan,
471 adapter->default_up, vf);
472
473 if (vfinfo->spoofchk_enabled)
474 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
463 } 475 }
464 476
465 /* reset multicast table array for vf */ 477 /* reset multicast table array for vf */
@@ -661,8 +673,9 @@ static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter,
661 int add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) >> IXGBE_VT_MSGINFO_SHIFT; 673 int add = (msgbuf[0] & IXGBE_VT_MSGINFO_MASK) >> IXGBE_VT_MSGINFO_SHIFT;
662 int vid = (msgbuf[1] & IXGBE_VLVF_VLANID_MASK); 674 int vid = (msgbuf[1] & IXGBE_VLVF_VLANID_MASK);
663 int err; 675 int err;
676 u8 tcs = netdev_get_num_tc(adapter->netdev);
664 677
665 if (adapter->vfinfo[vf].pf_vlan) { 678 if (adapter->vfinfo[vf].pf_vlan || tcs) {
666 e_warn(drv, 679 e_warn(drv,
667 "VF %d attempted to override administratively set VLAN configuration\n" 680 "VF %d attempted to override administratively set VLAN configuration\n"
668 "Reload the VF driver to resume operations\n", 681 "Reload the VF driver to resume operations\n",
@@ -896,7 +909,7 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
896 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf); 909 err = ixgbe_set_vf_vlan(adapter, true, vlan, vf);
897 if (err) 910 if (err)
898 goto out; 911 goto out;
899 ixgbe_set_vmvir(adapter, vlan | (qos << VLAN_PRIO_SHIFT), vf); 912 ixgbe_set_vmvir(adapter, vlan, qos, vf);
900 ixgbe_set_vmolr(hw, vf, false); 913 ixgbe_set_vmolr(hw, vf, false);
901 if (adapter->vfinfo[vf].spoofchk_enabled) 914 if (adapter->vfinfo[vf].spoofchk_enabled)
902 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf); 915 hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
@@ -916,7 +929,7 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
916 } else { 929 } else {
917 err = ixgbe_set_vf_vlan(adapter, false, 930 err = ixgbe_set_vf_vlan(adapter, false,
918 adapter->vfinfo[vf].pf_vlan, vf); 931 adapter->vfinfo[vf].pf_vlan, vf);
919 ixgbe_set_vmvir(adapter, vlan, vf); 932 ixgbe_clear_vmvir(adapter, vf);
920 ixgbe_set_vmolr(hw, vf, true); 933 ixgbe_set_vmolr(hw, vf, true);
921 hw->mac.ops.set_vlan_anti_spoofing(hw, false, vf); 934 hw->mac.ops.set_vlan_anti_spoofing(hw, false, vf);
922 if (adapter->vfinfo[vf].vlan_count) 935 if (adapter->vfinfo[vf].vlan_count)