Commit d88d40b0 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

i40e: allow i40e_update_filter_state to skip broadcast filters

Fix a bug where we modified the mac_filter_hash while outside a lock,
when handling addition of broadcast filters.

Normally, we add filters to firmware by batching the additions into
lists and issuing 1 update for every few filters. Broadcast filters are
handled differently, by instead setting the broadcast promiscuous mode
flags. In order to make sure the 1<->1 mapping of filters in our
addition array lined up with filters in the hlist tmp_add_list, we had
to remove the filter and move it back to the main hash. However, we
didn't do this under lock, which could cause consistency problems for
the list.

Fix this by updating i40e_update_filter_state logic so that it knows to
avoid broadcast filters. This ensures that we don't have to remove the
filter separately, and can put it back using the normal flow.

Change-ID: Id288fade80b3e3a9a54b68cc249188cb95147518
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent e6e3fc2b
...@@ -1842,6 +1842,31 @@ static void i40e_undo_filter_entries(struct i40e_vsi *vsi, ...@@ -1842,6 +1842,31 @@ static void i40e_undo_filter_entries(struct i40e_vsi *vsi,
} }
} }
/**
* i40e_next_entry - Get the next non-broadcast filter from a list
* @f: pointer to filter in list
*
* Returns the next non-broadcast filter in the list. Required so that we
* ignore broadcast filters within the list, since these are not handled via
* the normal firmware update path.
*/
static struct i40e_mac_filter *i40e_next_filter(struct i40e_mac_filter *f)
{
while (f) {
f = hlist_entry(f->hlist.next,
typeof(struct i40e_mac_filter),
hlist);
/* keep going if we found a broadcast filter */
if (f && is_broadcast_ether_addr(f->macaddr))
continue;
break;
}
return f;
}
/** /**
* i40e_update_filter_state - Update filter state based on return data * i40e_update_filter_state - Update filter state based on return data
* from firmware * from firmware
...@@ -1874,9 +1899,9 @@ i40e_update_filter_state(int count, ...@@ -1874,9 +1899,9 @@ i40e_update_filter_state(int count,
retval++; retval++;
} }
add_head = hlist_entry(add_head->hlist.next, add_head = i40e_next_filter(add_head);
typeof(struct i40e_mac_filter), if (!add_head)
hlist); break;
} }
return retval; return retval;
...@@ -2095,7 +2120,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -2095,7 +2120,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
cmd_flags = 0; cmd_flags = 0;
/* handle broadcast filters by updating the broadcast /* handle broadcast filters by updating the broadcast
* promiscuous flag instead of deleting a MAC filter. * promiscuous flag and release filter list.
*/ */
if (is_broadcast_ether_addr(f->macaddr)) { if (is_broadcast_ether_addr(f->macaddr)) {
i40e_aqc_broadcast_filter(vsi, vsi_name, f); i40e_aqc_broadcast_filter(vsi, vsi_name, f);
...@@ -2164,11 +2189,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -2164,11 +2189,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
* promiscuous flag instead of adding a MAC filter. * promiscuous flag instead of adding a MAC filter.
*/ */
if (is_broadcast_ether_addr(f->macaddr)) { if (is_broadcast_ether_addr(f->macaddr)) {
u64 key = i40e_addr_to_hkey(f->macaddr);
i40e_aqc_broadcast_filter(vsi, vsi_name, f); i40e_aqc_broadcast_filter(vsi, vsi_name, f);
hlist_del(&f->hlist);
hash_add(vsi->mac_filter_hash, &f->hlist, key);
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment