Commit f1199998 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: clean whole mac filter list

Clean the whole mac filter list when resetting after an intermediate
add or delete push to the firmware.  The code had evolved from using
a list from the stack to a heap allocation, but the memset() didn't
follow the change correctly.  This now cleans the whole list rather
that just part of the first element.

Change-ID: I4cd03d5a103b7407dd8556a3a231e800f2d6f2d5
Reported-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent b9eacec3
...@@ -1916,11 +1916,13 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -1916,11 +1916,13 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
/* Now process 'del_list' outside the lock */ /* Now process 'del_list' outside the lock */
if (!list_empty(&tmp_del_list)) { if (!list_empty(&tmp_del_list)) {
int del_list_size;
filter_list_len = pf->hw.aq.asq_buf_size / filter_list_len = pf->hw.aq.asq_buf_size /
sizeof(struct i40e_aqc_remove_macvlan_element_data); sizeof(struct i40e_aqc_remove_macvlan_element_data);
del_list = kcalloc(filter_list_len, del_list_size = filter_list_len *
sizeof(struct i40e_aqc_remove_macvlan_element_data), sizeof(struct i40e_aqc_remove_macvlan_element_data);
GFP_KERNEL); del_list = kzalloc(del_list_size, GFP_KERNEL);
if (!del_list) { if (!del_list) {
i40e_cleanup_add_list(&tmp_add_list); i40e_cleanup_add_list(&tmp_add_list);
...@@ -1955,7 +1957,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -1955,7 +1957,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
NULL); NULL);
aq_err = pf->hw.aq.asq_last_status; aq_err = pf->hw.aq.asq_last_status;
num_del = 0; num_del = 0;
memset(del_list, 0, sizeof(*del_list)); memset(del_list, 0, del_list_size);
if (aq_ret && aq_err != I40E_AQ_RC_ENOENT) { if (aq_ret && aq_err != I40E_AQ_RC_ENOENT) {
retval = -EIO; retval = -EIO;
...@@ -1991,13 +1993,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -1991,13 +1993,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
} }
if (!list_empty(&tmp_add_list)) { if (!list_empty(&tmp_add_list)) {
int add_list_size;
/* do all the adds now */ /* do all the adds now */
filter_list_len = pf->hw.aq.asq_buf_size / filter_list_len = pf->hw.aq.asq_buf_size /
sizeof(struct i40e_aqc_add_macvlan_element_data), sizeof(struct i40e_aqc_add_macvlan_element_data),
add_list = kcalloc(filter_list_len, add_list_size = filter_list_len *
sizeof(struct i40e_aqc_add_macvlan_element_data), sizeof(struct i40e_aqc_add_macvlan_element_data);
GFP_KERNEL); add_list = kzalloc(add_list_size, GFP_KERNEL);
if (!add_list) { if (!add_list) {
/* Purge element from temporary lists */ /* Purge element from temporary lists */
i40e_cleanup_add_list(&tmp_add_list); i40e_cleanup_add_list(&tmp_add_list);
...@@ -2036,7 +2039,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -2036,7 +2039,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
if (aq_ret) if (aq_ret)
break; break;
memset(add_list, 0, sizeof(*add_list)); memset(add_list, 0, add_list_size);
} }
/* Entries from tmp_add_list were cloned from MAC /* Entries from tmp_add_list were cloned from MAC
* filter list, hence clean those cloned entries * filter list, hence clean those cloned entries
......
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