mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-01 07:20:31 +07:00
igc: Refactor igc_del_mac_filter()
This patch does a code refactoring in igc_del_mac_filter() so it uses the new helper igc_find_mac_filter() and improves the comment about the special handling when deleting the default filter. Signed-off-by: Andre Guedes <andre.guedes@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
794e5bc817
commit
5f93071372
@ -2267,40 +2267,33 @@ int igc_add_mac_filter(struct igc_adapter *adapter, const u8 *addr,
|
|||||||
int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
|
int igc_del_mac_filter(struct igc_adapter *adapter, const u8 *addr,
|
||||||
const u8 flags)
|
const u8 flags)
|
||||||
{
|
{
|
||||||
struct igc_hw *hw = &adapter->hw;
|
struct igc_mac_addr *entry;
|
||||||
int rar_entries = hw->mac.rar_entry_count;
|
int index;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!is_valid_ether_addr(addr))
|
if (!is_valid_ether_addr(addr))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < rar_entries; i++) {
|
index = igc_find_mac_filter(adapter, addr, flags);
|
||||||
if (!(adapter->mac_table[i].state & IGC_MAC_STATE_IN_USE))
|
if (index < 0)
|
||||||
continue;
|
return -ENOENT;
|
||||||
if (flags && (adapter->mac_table[i].state & flags) != flags)
|
|
||||||
continue;
|
|
||||||
if (!ether_addr_equal(adapter->mac_table[i].addr, addr))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* When a filter for the default address is "deleted",
|
entry = &adapter->mac_table[index];
|
||||||
* we return it to its initial configuration
|
|
||||||
|
if (entry->state & IGC_MAC_STATE_DEFAULT) {
|
||||||
|
/* If this is the default filter, we don't actually delete it.
|
||||||
|
* We just reset to its default value i.e. disable queue
|
||||||
|
* assignment.
|
||||||
*/
|
*/
|
||||||
if (adapter->mac_table[i].state & IGC_MAC_STATE_DEFAULT) {
|
entry->queue = -1;
|
||||||
adapter->mac_table[i].state =
|
igc_set_mac_filter_hw(adapter, 0, addr, entry->queue);
|
||||||
IGC_MAC_STATE_DEFAULT | IGC_MAC_STATE_IN_USE;
|
} else {
|
||||||
adapter->mac_table[i].queue = -1;
|
entry->state = 0;
|
||||||
igc_set_mac_filter_hw(adapter, 0, addr, -1);
|
entry->queue = -1;
|
||||||
} else {
|
memset(entry->addr, 0, ETH_ALEN);
|
||||||
adapter->mac_table[i].state = 0;
|
igc_clear_mac_filter_hw(adapter, index);
|
||||||
adapter->mac_table[i].queue = -1;
|
|
||||||
memset(adapter->mac_table[i].addr, 0, ETH_ALEN);
|
|
||||||
igc_clear_mac_filter_hw(adapter, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOENT;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int igc_uc_sync(struct net_device *netdev, const unsigned char *addr)
|
static int igc_uc_sync(struct net_device *netdev, const unsigned char *addr)
|
||||||
|
Loading…
Reference in New Issue
Block a user