aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-05-05 01:32:52 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-07-19 21:19:37 -0400
commit7fa7c9dcadcff800a897232204e2128e92dd44cd (patch)
treed621413ba6b799755402f429cd5bb45bf3b98315
parent7c8ae65a6248518b2775a03129424a7e08fd058a (diff)
ixgbe: Correctly set SAN MAC RAR pool to default pool of PF
This change corrects an issue in which an FCoE enabled adapter was always setting the FCoE SAN MAC MPSAR register to 0x1. This results in the first VF being assigned the SAN MAC address in the case of SR-IOV and as such is incorrect. To resolve this I am adding a new function that will update the SAN MAC pool address after reset. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c4
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_common.c25
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_common.h1
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c13
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_type.h2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c4
6 files changed, 46 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index e7dddfd97cb9..50fc137501da 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -1025,6 +1025,9 @@ mac_reset_top:
1025 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, 1025 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1,
1026 hw->mac.san_addr, 0, IXGBE_RAH_AV); 1026 hw->mac.san_addr, 0, IXGBE_RAH_AV);
1027 1027
1028 /* Save the SAN MAC RAR index */
1029 hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
1030
1028 /* Reserve the last RAR for the SAN MAC address */ 1031 /* Reserve the last RAR for the SAN MAC address */
1029 hw->mac.num_rar_entries--; 1032 hw->mac.num_rar_entries--;
1030 } 1033 }
@@ -2106,6 +2109,7 @@ static struct ixgbe_mac_operations mac_ops_82599 = {
2106 .set_rar = &ixgbe_set_rar_generic, 2109 .set_rar = &ixgbe_set_rar_generic,
2107 .clear_rar = &ixgbe_clear_rar_generic, 2110 .clear_rar = &ixgbe_clear_rar_generic,
2108 .set_vmdq = &ixgbe_set_vmdq_generic, 2111 .set_vmdq = &ixgbe_set_vmdq_generic,
2112 .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic,
2109 .clear_vmdq = &ixgbe_clear_vmdq_generic, 2113 .clear_vmdq = &ixgbe_clear_vmdq_generic,
2110 .init_rx_addrs = &ixgbe_init_rx_addrs_generic, 2114 .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
2111 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, 2115 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index bb7fde45c057..bbe9d45c8436 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -2848,6 +2848,31 @@ s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
2848} 2848}
2849 2849
2850/** 2850/**
2851 * This function should only be involved in the IOV mode.
2852 * In IOV mode, Default pool is next pool after the number of
2853 * VFs advertized and not 0.
2854 * MPSAR table needs to be updated for SAN_MAC RAR [hw->mac.san_mac_rar_index]
2855 *
2856 * ixgbe_set_vmdq_san_mac - Associate default VMDq pool index with a rx address
2857 * @hw: pointer to hardware struct
2858 * @vmdq: VMDq pool index
2859 **/
2860s32 ixgbe_set_vmdq_san_mac_generic(struct ixgbe_hw *hw, u32 vmdq)
2861{
2862 u32 rar = hw->mac.san_mac_rar_index;
2863
2864 if (vmdq < 32) {
2865 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 1 << vmdq);
2866 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0);
2867 } else {
2868 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0);
2869 IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 1 << (vmdq - 32));
2870 }
2871
2872 return 0;
2873}
2874
2875/**
2851 * ixgbe_init_uta_tables_generic - Initialize the Unicast Table Array 2876 * ixgbe_init_uta_tables_generic - Initialize the Unicast Table Array
2852 * @hw: pointer to hardware structure 2877 * @hw: pointer to hardware structure
2853 **/ 2878 **/
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
index 6222fdb3d3f1..d813d1188c36 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
@@ -85,6 +85,7 @@ s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
85void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask); 85void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u16 mask);
86s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr); 86s32 ixgbe_get_san_mac_addr_generic(struct ixgbe_hw *hw, u8 *san_mac_addr);
87s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq); 87s32 ixgbe_set_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
88s32 ixgbe_set_vmdq_san_mac_generic(struct ixgbe_hw *hw, u32 vmdq);
88s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq); 89s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq);
89s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw); 90s32 ixgbe_init_uta_tables_generic(struct ixgbe_hw *hw);
90s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan, 91s32 ixgbe_set_vfta_generic(struct ixgbe_hw *hw, u32 vlan,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index e006c05580ec..aa0155848d39 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -4119,6 +4119,10 @@ void ixgbe_reset(struct ixgbe_adapter *adapter)
4119 4119
4120 /* reprogram the RAR[0] in case user changed it. */ 4120 /* reprogram the RAR[0] in case user changed it. */
4121 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, VMDQ_P(0), IXGBE_RAH_AV); 4121 hw->mac.ops.set_rar(hw, 0, hw->mac.addr, VMDQ_P(0), IXGBE_RAH_AV);
4122
4123 /* update SAN MAC vmdq pool selection */
4124 if (hw->mac.san_mac_rar_index)
4125 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
4122} 4126}
4123 4127
4124/** 4128/**
@@ -6509,12 +6513,15 @@ static int ixgbe_add_sanmac_netdev(struct net_device *dev)
6509{ 6513{
6510 int err = 0; 6514 int err = 0;
6511 struct ixgbe_adapter *adapter = netdev_priv(dev); 6515 struct ixgbe_adapter *adapter = netdev_priv(dev);
6512 struct ixgbe_mac_info *mac = &adapter->hw.mac; 6516 struct ixgbe_hw *hw = &adapter->hw;
6513 6517
6514 if (is_valid_ether_addr(mac->san_addr)) { 6518 if (is_valid_ether_addr(hw->mac.san_addr)) {
6515 rtnl_lock(); 6519 rtnl_lock();
6516 err = dev_addr_add(dev, mac->san_addr, NETDEV_HW_ADDR_T_SAN); 6520 err = dev_addr_add(dev, hw->mac.san_addr, NETDEV_HW_ADDR_T_SAN);
6517 rtnl_unlock(); 6521 rtnl_unlock();
6522
6523 /* update SAN MAC vmdq pool selection */
6524 hw->mac.ops.set_vmdq_san_mac(hw, VMDQ_P(0));
6518 } 6525 }
6519 return err; 6526 return err;
6520} 6527}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
index 482a33b0eb46..d26e07a8140f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
@@ -2847,6 +2847,7 @@ struct ixgbe_mac_operations {
2847 s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32); 2847 s32 (*set_rar)(struct ixgbe_hw *, u32, u8 *, u32, u32);
2848 s32 (*clear_rar)(struct ixgbe_hw *, u32); 2848 s32 (*clear_rar)(struct ixgbe_hw *, u32);
2849 s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32); 2849 s32 (*set_vmdq)(struct ixgbe_hw *, u32, u32);
2850 s32 (*set_vmdq_san_mac)(struct ixgbe_hw *, u32);
2850 s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32); 2851 s32 (*clear_vmdq)(struct ixgbe_hw *, u32, u32);
2851 s32 (*init_rx_addrs)(struct ixgbe_hw *); 2852 s32 (*init_rx_addrs)(struct ixgbe_hw *);
2852 s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *); 2853 s32 (*update_mc_addr_list)(struct ixgbe_hw *, struct net_device *);
@@ -2922,6 +2923,7 @@ struct ixgbe_mac_info {
2922 bool orig_link_settings_stored; 2923 bool orig_link_settings_stored;
2923 bool autotry_restart; 2924 bool autotry_restart;
2924 u8 flags; 2925 u8 flags;
2926 u8 san_mac_rar_index;
2925 struct ixgbe_thermal_sensor_data thermal_sensor_data; 2927 struct ixgbe_thermal_sensor_data thermal_sensor_data;
2926}; 2928};
2927 2929
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
index f90ec078ece2..de4da5219b71 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c
@@ -156,6 +156,9 @@ mac_reset_top:
156 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1, 156 hw->mac.ops.set_rar(hw, hw->mac.num_rar_entries - 1,
157 hw->mac.san_addr, 0, IXGBE_RAH_AV); 157 hw->mac.san_addr, 0, IXGBE_RAH_AV);
158 158
159 /* Save the SAN MAC RAR index */
160 hw->mac.san_mac_rar_index = hw->mac.num_rar_entries - 1;
161
159 /* Reserve the last RAR for the SAN MAC address */ 162 /* Reserve the last RAR for the SAN MAC address */
160 hw->mac.num_rar_entries--; 163 hw->mac.num_rar_entries--;
161 } 164 }
@@ -832,6 +835,7 @@ static struct ixgbe_mac_operations mac_ops_X540 = {
832 .set_rar = &ixgbe_set_rar_generic, 835 .set_rar = &ixgbe_set_rar_generic,
833 .clear_rar = &ixgbe_clear_rar_generic, 836 .clear_rar = &ixgbe_clear_rar_generic,
834 .set_vmdq = &ixgbe_set_vmdq_generic, 837 .set_vmdq = &ixgbe_set_vmdq_generic,
838 .set_vmdq_san_mac = &ixgbe_set_vmdq_san_mac_generic,
835 .clear_vmdq = &ixgbe_clear_vmdq_generic, 839 .clear_vmdq = &ixgbe_clear_vmdq_generic,
836 .init_rx_addrs = &ixgbe_init_rx_addrs_generic, 840 .init_rx_addrs = &ixgbe_init_rx_addrs_generic,
837 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic, 841 .update_mc_addr_list = &ixgbe_update_mc_addr_list_generic,