aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igb/igb_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 0facaa73f626..902db2096bfd 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6859,8 +6859,14 @@ static void igb_set_default_mac_filter(struct igb_adapter *adapter)
6859 igb_rar_set_index(adapter, 0); 6859 igb_rar_set_index(adapter, 0);
6860} 6860}
6861 6861
6862static int igb_add_mac_filter(struct igb_adapter *adapter, const u8 *addr, 6862/* Add a MAC filter for 'addr' directing matching traffic to 'queue',
6863 const u8 queue) 6863 * 'flags' is used to indicate what kind of match is made, match is by
6864 * default for the destination address, if matching by source address
6865 * is desired the flag IGB_MAC_STATE_SRC_ADDR can be used.
6866 */
6867static int igb_add_mac_filter_flags(struct igb_adapter *adapter,
6868 const u8 *addr, const u8 queue,
6869 const u8 flags)
6864{ 6870{
6865 struct e1000_hw *hw = &adapter->hw; 6871 struct e1000_hw *hw = &adapter->hw;
6866 int rar_entries = hw->mac.rar_entry_count - 6872 int rar_entries = hw->mac.rar_entry_count -
@@ -6880,7 +6886,7 @@ static int igb_add_mac_filter(struct igb_adapter *adapter, const u8 *addr,
6880 6886
6881 ether_addr_copy(adapter->mac_table[i].addr, addr); 6887 ether_addr_copy(adapter->mac_table[i].addr, addr);
6882 adapter->mac_table[i].queue = queue; 6888 adapter->mac_table[i].queue = queue;
6883 adapter->mac_table[i].state |= IGB_MAC_STATE_IN_USE; 6889 adapter->mac_table[i].state |= IGB_MAC_STATE_IN_USE | flags;
6884 6890
6885 igb_rar_set_index(adapter, i); 6891 igb_rar_set_index(adapter, i);
6886 return i; 6892 return i;
@@ -6889,9 +6895,22 @@ static int igb_add_mac_filter(struct igb_adapter *adapter, const u8 *addr,
6889 return -ENOSPC; 6895 return -ENOSPC;
6890} 6896}
6891 6897
6892static int igb_del_mac_filter(struct igb_adapter *adapter, const u8 *addr, 6898static int igb_add_mac_filter(struct igb_adapter *adapter, const u8 *addr,
6893 const u8 queue) 6899 const u8 queue)
6894{ 6900{
6901 return igb_add_mac_filter_flags(adapter, addr, queue, 0);
6902}
6903
6904/* Remove a MAC filter for 'addr' directing matching traffic to
6905 * 'queue', 'flags' is used to indicate what kind of match need to be
6906 * removed, match is by default for the destination address, if
6907 * matching by source address is to be removed the flag
6908 * IGB_MAC_STATE_SRC_ADDR can be used.
6909 */
6910static int igb_del_mac_filter_flags(struct igb_adapter *adapter,
6911 const u8 *addr, const u8 queue,
6912 const u8 flags)
6913{
6895 struct e1000_hw *hw = &adapter->hw; 6914 struct e1000_hw *hw = &adapter->hw;
6896 int rar_entries = hw->mac.rar_entry_count - 6915 int rar_entries = hw->mac.rar_entry_count -
6897 adapter->vfs_allocated_count; 6916 adapter->vfs_allocated_count;
@@ -6907,12 +6926,14 @@ static int igb_del_mac_filter(struct igb_adapter *adapter, const u8 *addr,
6907 for (i = 0; i < rar_entries; i++) { 6926 for (i = 0; i < rar_entries; i++) {
6908 if (!(adapter->mac_table[i].state & IGB_MAC_STATE_IN_USE)) 6927 if (!(adapter->mac_table[i].state & IGB_MAC_STATE_IN_USE))
6909 continue; 6928 continue;
6929 if ((adapter->mac_table[i].state & flags) != flags)
6930 continue;
6910 if (adapter->mac_table[i].queue != queue) 6931 if (adapter->mac_table[i].queue != queue)
6911 continue; 6932 continue;
6912 if (!ether_addr_equal(adapter->mac_table[i].addr, addr)) 6933 if (!ether_addr_equal(adapter->mac_table[i].addr, addr))
6913 continue; 6934 continue;
6914 6935
6915 adapter->mac_table[i].state &= ~IGB_MAC_STATE_IN_USE; 6936 adapter->mac_table[i].state = 0;
6916 memset(adapter->mac_table[i].addr, 0, ETH_ALEN); 6937 memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
6917 adapter->mac_table[i].queue = 0; 6938 adapter->mac_table[i].queue = 0;
6918 6939
@@ -6923,6 +6944,12 @@ static int igb_del_mac_filter(struct igb_adapter *adapter, const u8 *addr,
6923 return -ENOENT; 6944 return -ENOENT;
6924} 6945}
6925 6946
6947static int igb_del_mac_filter(struct igb_adapter *adapter, const u8 *addr,
6948 const u8 queue)
6949{
6950 return igb_del_mac_filter_flags(adapter, addr, queue, 0);
6951}
6952
6926static int igb_uc_sync(struct net_device *netdev, const unsigned char *addr) 6953static int igb_uc_sync(struct net_device *netdev, const unsigned char *addr)
6927{ 6954{
6928 struct igb_adapter *adapter = netdev_priv(netdev); 6955 struct igb_adapter *adapter = netdev_priv(netdev);
@@ -8766,6 +8793,9 @@ static void igb_rar_set_index(struct igb_adapter *adapter, u32 index)
8766 if (is_valid_ether_addr(addr)) 8793 if (is_valid_ether_addr(addr))
8767 rar_high |= E1000_RAH_AV; 8794 rar_high |= E1000_RAH_AV;
8768 8795
8796 if (adapter->mac_table[index].state & IGB_MAC_STATE_SRC_ADDR)
8797 rar_high |= E1000_RAH_ASEL_SRC_ADDR;
8798
8769 switch (hw->mac.type) { 8799 switch (hw->mac.type) {
8770 case e1000_82575: 8800 case e1000_82575:
8771 case e1000_i210: 8801 case e1000_i210: