Skip to content

Commit 1b8f15b

Browse files
mswiatkoJeff Kirsher
authored andcommitted
ice: refactor filter functions
Move filter functions to separate file. Add functions that prepare suitable ice_fltr_info struct depending on the filter type and add this struct to earlier created list: - ice_fltr_add_mac_to_list - ice_fltr_add_vlan_to_list - ice_fltr_add_eth_to_list This functions are used in adding and removing filters. Create wrappers for functions mentioned above that alloc list, add suitable ice_fltr_info to it and call add or remove function. - ice_fltr_prepare_mac - ice_fltr_prepare_mac_and_broadcast - ice_fltr_prepare_vlan - ice_fltr_prepare_eth Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 857a4f0 commit 1b8f15b

File tree

8 files changed

+494
-264
lines changed

8 files changed

+494
-264
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ice-y := ice_main.o \
1717
ice_lib.o \
1818
ice_txrx_lib.o \
1919
ice_txrx.o \
20+
ice_fltr.o \
2021
ice_flex_pipe.o \
2122
ice_flow.o \
2223
ice_devlink.o \

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "ice.h"
77
#include "ice_flow.h"
8+
#include "ice_fltr.h"
89
#include "ice_lib.h"
910
#include "ice_dcb_lib.h"
1011

@@ -676,7 +677,6 @@ static u64 ice_loopback_test(struct net_device *netdev)
676677
struct ice_ring *tx_ring, *rx_ring;
677678
u8 broadcast[ETH_ALEN], ret = 0;
678679
int num_frames, valid_frames;
679-
LIST_HEAD(tmp_list);
680680
struct device *dev;
681681
u8 *tx_frame;
682682
int i;
@@ -712,16 +712,11 @@ static u64 ice_loopback_test(struct net_device *netdev)
712712

713713
/* Test VSI needs to receive broadcast packets */
714714
eth_broadcast_addr(broadcast);
715-
if (ice_add_mac_to_list(test_vsi, &tmp_list, broadcast)) {
715+
if (ice_fltr_add_mac(test_vsi, broadcast, ICE_FWD_TO_VSI)) {
716716
ret = 5;
717717
goto lbtest_mac_dis;
718718
}
719719

720-
if (ice_add_mac(&pf->hw, &tmp_list)) {
721-
ret = 6;
722-
goto free_mac_list;
723-
}
724-
725720
if (ice_lbtest_create_frame(pf, &tx_frame, ICE_LB_FRAME_SIZE)) {
726721
ret = 7;
727722
goto remove_mac_filters;
@@ -744,10 +739,8 @@ static u64 ice_loopback_test(struct net_device *netdev)
744739
lbtest_free_frame:
745740
devm_kfree(dev, tx_frame);
746741
remove_mac_filters:
747-
if (ice_remove_mac(&pf->hw, &tmp_list))
742+
if (ice_fltr_remove_mac(test_vsi, broadcast, ICE_FWD_TO_VSI))
748743
netdev_err(netdev, "Could not remove MAC filter for the test VSI\n");
749-
free_mac_list:
750-
ice_free_fltr_list(dev, &tmp_list);
751744
lbtest_mac_dis:
752745
/* Disable MAC loopback after the test is completed. */
753746
if (ice_aq_set_mac_loopback(&pf->hw, false, NULL))

0 commit comments

Comments
 (0)