Skip to content

Commit 28bf267

Browse files
bcreeley13Jeff Kirsher
authored and
Jeff Kirsher
committed
ice: Implement aRFS
Enable accelerated Receive Flow Steering (aRFS). It is used to steer Rx flows to a specific queue. This functionality is triggered by the network stack through ndo_rx_flow_steer and requires Flow Director (ntuple on) to function. The fltr_info is used to add/remove/update flow rules in the HW, the fltr_state is used to determine what to do with the filter with respect to HW and/or SW, and the flow_id is used in co-ordination with the network stack. The work for aRFS is split into two paths: the ndo_rx_flow_steer operation and the ice_service_task. The former is where the kernel hands us an Rx SKB among other items to setup aRFS and the latter is where the driver adds/updates/removes filter rules from HW and updates filter state. In the Rx path the following things can happen: 1. New aRFS entries are added to the hash table and the state is set to ICE_ARFS_INACTIVE so the filter can be updated in HW by the ice_service_task path. 2. aRFS entries have their Rx Queue updated if we receive a pre-existing flow_id and the filter state is ICE_ARFS_ACTIVE. The state is set to ICE_ARFS_INACTIVE so the filter can be updated in HW by the ice_service_task path. 3. aRFS entries marked as ICE_ARFS_TODEL are deleted In the ice_service_task path the following things can happen: 1. New aRFS entries marked as ICE_ARFS_INACTIVE are added or updated in HW. and their state is updated to ICE_ARFS_ACTIVE. 2. aRFS entries are deleted from HW and their state is updated to ICE_ARFS_TODEL. Signed-off-by: Brett Creeley <brett.creeley@intel.com> Signed-off-by: Madhu Chittim <madhu.chittim@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 83af003 commit 28bf267

File tree

7 files changed

+805
-12
lines changed

7 files changed

+805
-12
lines changed

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ ice-y := ice_main.o \
2626
ice_ethtool.o
2727
ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o
2828
ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
29+
ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o
2930
ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/ctype.h>
3535
#include <linux/bpf.h>
3636
#include <linux/avf/virtchnl.h>
37+
#include <linux/cpu_rmap.h>
3738
#include <net/devlink.h>
3839
#include <net/ipv6.h>
3940
#include <net/xdp_sock.h>
@@ -52,6 +53,7 @@
5253
#include "ice_sriov.h"
5354
#include "ice_fdir.h"
5455
#include "ice_xsk.h"
56+
#include "ice_arfs.h"
5557

5658
extern const char ice_drv_ver[];
5759
#define ICE_BAR0 0
@@ -271,6 +273,14 @@ struct ice_vsi {
271273
u8 *rss_lut_user; /* User configured lookup table entries */
272274
u8 rss_lut_type; /* used to configure Get/Set RSS LUT AQ call */
273275

276+
/* aRFS members only allocated for the PF VSI */
277+
#define ICE_MAX_ARFS_LIST 1024
278+
#define ICE_ARFS_LST_MASK (ICE_MAX_ARFS_LIST - 1)
279+
struct hlist_head *arfs_fltr_list;
280+
struct ice_arfs_active_fltr_cntrs *arfs_fltr_cntrs;
281+
spinlock_t arfs_lock; /* protects aRFS hash table and filter state */
282+
atomic_t *arfs_last_fltr_id;
283+
274284
u16 max_frame;
275285
u16 rx_buf_len;
276286

@@ -558,6 +568,9 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset);
558568
void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
559569
const char *ice_stat_str(enum ice_status stat_err);
560570
const char *ice_aq_str(enum ice_aq_err aq_err);
571+
int
572+
ice_fdir_write_fltr(struct ice_pf *pf, struct ice_fdir_fltr *input, bool add,
573+
bool is_tun);
561574
void ice_vsi_manage_fdir(struct ice_vsi *vsi, bool ena);
562575
int ice_add_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);
563576
int ice_del_fdir_ethtool(struct ice_vsi *vsi, struct ethtool_rxnfc *cmd);
@@ -571,5 +584,6 @@ void ice_fdir_replay_fltrs(struct ice_pf *pf);
571584
int ice_fdir_create_dflt_rules(struct ice_pf *pf);
572585
int ice_open(struct net_device *netdev);
573586
int ice_stop(struct net_device *netdev);
587+
void ice_service_task_schedule(struct ice_pf *pf);
574588

575589
#endif /* _ICE_H_ */

0 commit comments

Comments
 (0)