Commit e284fc28 authored by Avinash Dayanand's avatar Avinash Dayanand Committed by Jeff Kirsher

i40e: Add and delete cloud filter

This patch provides support to add or delete cloud filter for queue
channels created for ADq on VF.
We are using the HW's cloud filter feature and programming it to act
as a TC filter applied to a group of queues.

There are two possible modes for a VF when applying a cloud filter
1. Basic Mode:	Intended to apply filters that don't need a VF to be
		Trusted. This would include the following
		  Dest MAC + L4 port
		  Dest MAC + VLAN + L4 port
2. Advanced Mode: This mode is only for filters with combination that
		  requires VF to be Trusted.
		  Dest IP + L4 port

When cloud filters are applied on a trusted VF and for some reason
the same VF is later made as untrusted then all cloud filters
will be deleted. All cloud filters has to be re-applied in
such a case.
Cloud filters are also deleted when queue channel is deleted.

Testing-Hints:
=============
1. Adding Basic Mode filter should be possible on a VF in
   Non-Trusted mode.
2. In Advanced mode all filters should be able to be created.

Steps:
======
1. Enable ADq and create TCs using TC mqprio command
2. Apply cloud filter.
3. Turn-off the spoof check.
4. Pass traffic.

Example:
========
1. tc qdisc add dev enp4s2 root mqprio num_tc 4 map 0 0 0 0 1 2 2 3\
	queues 2@0 2@2 1@4 1@5 hw 1 mode channel
2. tc qdisc add dev enp4s2 ingress
3. ethtool -K enp4s2 hw-tc-offload on
4. ip link set ens261f0 vf 0 spoofchk off
5. tc filter add dev enp4s2 protocol ip parent ffff: prio 1 flower\
	dst_ip 192.168.3.5/32 ip_proto udp dst_port 25 skip_sw hw_tc 2
Signed-off-by: default avatarAvinash Dayanand <avinash.dayanand@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 0075fa0f
...@@ -1109,4 +1109,10 @@ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi) ...@@ -1109,4 +1109,10 @@ static inline bool i40e_enabled_xdp_vsi(struct i40e_vsi *vsi)
int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch); int i40e_create_queue_channel(struct i40e_vsi *vsi, struct i40e_channel *ch);
int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate); int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate);
int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
struct i40e_cloud_filter *filter,
bool add);
int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
struct i40e_cloud_filter *filter,
bool add);
#endif /* _I40E_H_ */ #endif /* _I40E_H_ */
...@@ -69,12 +69,6 @@ static int i40e_reset(struct i40e_pf *pf); ...@@ -69,12 +69,6 @@ static int i40e_reset(struct i40e_pf *pf);
static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired); static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired);
static void i40e_fdir_sb_setup(struct i40e_pf *pf); static void i40e_fdir_sb_setup(struct i40e_pf *pf);
static int i40e_veb_get_bw_info(struct i40e_veb *veb); static int i40e_veb_get_bw_info(struct i40e_veb *veb);
static int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
struct i40e_cloud_filter *filter,
bool add);
static int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
struct i40e_cloud_filter *filter,
bool add);
static int i40e_get_capabilities(struct i40e_pf *pf, static int i40e_get_capabilities(struct i40e_pf *pf,
enum i40e_admin_queue_opc list_type); enum i40e_admin_queue_opc list_type);
...@@ -6841,8 +6835,8 @@ i40e_set_cld_element(struct i40e_cloud_filter *filter, ...@@ -6841,8 +6835,8 @@ i40e_set_cld_element(struct i40e_cloud_filter *filter,
* Add or delete a cloud filter for a specific flow spec. * Add or delete a cloud filter for a specific flow spec.
* Returns 0 if the filter were successfully added. * Returns 0 if the filter were successfully added.
**/ **/
static int i40e_add_del_cloud_filter(struct i40e_vsi *vsi, int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
struct i40e_cloud_filter *filter, bool add) struct i40e_cloud_filter *filter, bool add)
{ {
struct i40e_aqc_cloud_filters_element_data cld_filter; struct i40e_aqc_cloud_filters_element_data cld_filter;
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
...@@ -6908,9 +6902,9 @@ static int i40e_add_del_cloud_filter(struct i40e_vsi *vsi, ...@@ -6908,9 +6902,9 @@ static int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,
* Add or delete a cloud filter for a specific flow spec using big buffer. * Add or delete a cloud filter for a specific flow spec using big buffer.
* Returns 0 if the filter were successfully added. * Returns 0 if the filter were successfully added.
**/ **/
static int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi, int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,
struct i40e_cloud_filter *filter, struct i40e_cloud_filter *filter,
bool add) bool add)
{ {
struct i40e_aqc_cloud_filters_element_bb cld_filter; struct i40e_aqc_cloud_filters_element_bb cld_filter;
struct i40e_pf *pf = vsi->back; struct i40e_pf *pf = vsi->back;
......
...@@ -128,6 +128,8 @@ struct i40e_vf { ...@@ -128,6 +128,8 @@ struct i40e_vf {
bool adq_enabled; /* flag to enable adq */ bool adq_enabled; /* flag to enable adq */
u8 num_tc; u8 num_tc;
struct i40evf_channel ch[I40E_MAX_VF_VSI]; struct i40evf_channel ch[I40E_MAX_VF_VSI];
struct hlist_head cloud_filter_list;
u16 num_cloud_filters;
/* RDMA Client */ /* RDMA Client */
struct virtchnl_iwarp_qvlist_info *qvlist_info; struct virtchnl_iwarp_qvlist_info *qvlist_info;
......
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