> -----Original Message----- > From: Intel-wired-lan <[email protected]> On Behalf Of > Ahmed Zaki > Sent: Monday, May 27, 2024 8:58 PM > To: [email protected] > Cc: [email protected]; Zaki, Ahmed <[email protected]>; Marcin > Szycik <[email protected]>; Nguyen, Anthony L > <[email protected]>; Samudrala, Sridhar > <[email protected]>; Keller, Jacob E <[email protected]> > Subject: [Intel-wired-lan] [PATCH iwl-next v2 13/13] iavf: add support for > offloading tc U32 cls filters > > Add support for offloading cls U32 filters. Only "skbedit queue_mapping" > and "drop" actions are supported. Also, only "ip" and "802_3" tc protocols are > allowed. The PF must advertise the VIRTCHNL_VF_OFFLOAD_TC_U32 capability > flag. > > Since the filters will be enabled via the FD stage at the PF, a new type of > FDIR > filters is added and the existing list and state machine are used. > > The new filters can be used to configure flow directors based on raw > (binary) pattern in the rx packet. > > Examples: > > 0. # tc qdisc add dev enp175s0v0 ingress > > 1. Redirect UDP from src IP 192.168.2.1 to queue 12: > > # tc filter add dev <dev> protocol ip ingress u32 \ > match u32 0x45000000 0xff000000 at 0 \ > match u32 0x00110000 0x00ff0000 at 8 \ > match u32 0xC0A80201 0xffffffff at 12 \ > match u32 0x00000000 0x00000000 at 24 \ > action skbedit queue_mapping 12 skip_sw > > 2. Drop all ICMP: > > # tc filter add dev <dev> protocol ip ingress u32 \ > match u32 0x45000000 0xff000000 at 0 \ > match u32 0x00010000 0x00ff0000 at 8 \ > match u32 0x00000000 0x00000000 at 24 \ > action drop skip_sw > > 3. Redirect ICMP traffic from MAC 3c:fd:fe:a5:47:e0 to queue 7 > (note proto: 802_3): > > # tc filter add dev <dev> protocol 802_3 ingress u32 \ > match u32 0x00003CFD 0x0000ffff at 4 \ > match u32 0xFEA547E0 0xffffffff at 8 \ > match u32 0x08004500 0xffffff00 at 12 \ > match u32 0x00000001 0x000000ff at 20 \ > match u32 0x0000 0x0000 at 40 \ > action skbedit queue_mapping 7 skip_sw > > Notes on matches: > 1 - All intermediate fields that are needed to parse the correct PTYPE > must be provided (in e.g. 3: Ethernet Type 0x0800 in MAC, IP version > and IP length: 0x45 and protocol: 0x01 (ICMP)). > 2 - The last match must provide an offset that guarantees all required > headers are accounted for, even if the last header is not matched. > For example, in #2, the last match is 4 bytes at offset 24 starting > from IP header, so the total is 14 (MAC) + 24 + 4 = 42, which is the > sum of MAC+IP+ICMP headers. > > Reviewed-by: Sridhar Samudrala <[email protected]> > Reviewed-by: Marcin Szycik <[email protected]> > Signed-off-by: Ahmed Zaki <[email protected]> > --- > drivers/net/ethernet/intel/iavf/iavf.h | 27 +++- > .../net/ethernet/intel/iavf/iavf_ethtool.c | 9 +- > drivers/net/ethernet/intel/iavf/iavf_fdir.c | 29 ++-- > drivers/net/ethernet/intel/iavf/iavf_fdir.h | 10 +- > drivers/net/ethernet/intel/iavf/iavf_main.c | 148 +++++++++++++++++- > .../net/ethernet/intel/iavf/iavf_virtchnl.c | 25 ++- > drivers/net/ethernet/intel/ice/ice_virtchnl.c | 4 + > include/linux/avf/virtchnl.h | 1 + > 8 files changed, 226 insertions(+), 27 deletions(-) > > diff --git a/drivers/net/ethernet/intel/iavf/iavf.h > b/drivers/net/ethernet/intel/iavf/iavf.h > index 85bd6a85cf2d..fb6f1b644d3b 100644 > --- a/drivers/net/ethernet/intel/iavf/iavf.h > +++ b/drivers/net/ethernet/intel/iavf/iavf.h > @@ -33,6 +33,7 @@
Tested-by: Rafal Romanowski <[email protected]>
