netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Ahmed Zaki <ahmed.zaki@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	anthony.l.nguyen@intel.com,
	Sridhar Samudrala <sridhar.samudrala@intel.com>,
	Marcin Szycik <marcin.szycik@linux.intel.com>
Subject: Re: [PATCH iwl-next v3 13/13] iavf: add support for offloading tc U32 cls filters
Date: Mon, 22 Jul 2024 16:05:30 +0100	[thread overview]
Message-ID: <20240722150530.GL715661@kernel.org> (raw)
In-Reply-To: <20240710204015.124233-14-ahmed.zaki@intel.com>

On Wed, Jul 10, 2024 at 02:40:15PM -0600, Ahmed Zaki wrote:
> 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 <sridhar.samudrala@intel.com>
> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com>

...

> diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h

...

>  /* Must be called with fdir_fltr_lock lock held */
>  static inline bool iavf_fdir_max_reached(struct iavf_adapter *adapter)
>  {
> -	return (adapter->fdir_active_fltr >= IAVF_MAX_FDIR_FILTERS);
> +	return (adapter->fdir_active_fltr + adapter->raw_fdir_active_fltr >=
> +			IAVF_MAX_FDIR_FILTERS);

nit: These parentheses seem unnecessary

> +}

...

> diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c

...

> +/**
> + * iavf_add_cls_u32 - Add U32 classifier offloads
> + * @adapter: pointer to iavf adapter structure
> + * @cls_u32: pointer to tc_cls_u32_offload struct with flow info

Please document the return value with a "Return:" or "Returns:" section.
Likewise for iavf_del_cls_u32 and iavf_setup_tc_cls_u32.

...

      reply	other threads:[~2024-07-22 15:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 20:40 [PATCH iwl-next v3 00/13] ice: iavf: add support for TC U32 filters on VFs Ahmed Zaki
2024-07-10 20:40 ` [PATCH iwl-next v3 01/13] ice: add parser create and destroy skeleton Ahmed Zaki
2024-07-22 15:05   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 02/13] ice: parse and init various DDP parser sections Ahmed Zaki
2024-07-11  5:28   ` [Intel-wired-lan] " Paul Menzel
2024-07-15 14:16     ` Ahmed Zaki
2024-07-22 14:52   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 03/13] ice: add debugging functions for the " Ahmed Zaki
2024-07-22 14:53   ` Simon Horman
2024-07-24 16:19     ` Ahmed Zaki
2024-07-10 20:40 ` [PATCH iwl-next v3 04/13] ice: add parser internal helper functions Ahmed Zaki
2024-07-22 15:06   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 05/13] ice: add parser execution main loop Ahmed Zaki
2024-07-22 15:01   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 06/13] ice: support turning on/off the parser's double vlan mode Ahmed Zaki
2024-07-22 15:02   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 07/13] ice: add UDP tunnels support to the parser Ahmed Zaki
2024-07-22 15:06   ` Simon Horman
2024-07-22 15:10   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 08/13] ice: add API for parser profile initialization Ahmed Zaki
2024-07-10 20:40 ` [PATCH iwl-next v3 09/13] virtchnl: support raw packet in protocol header Ahmed Zaki
2024-07-22 15:10   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 10/13] ice: add method to disable FDIR SWAP option Ahmed Zaki
2024-07-11  4:59   ` [Intel-wired-lan] " Paul Menzel
2024-07-15 14:23     ` Ahmed Zaki
2024-07-17  9:55       ` Paul Menzel
2024-07-18 16:54         ` Ahmed Zaki
2024-07-10 20:40 ` [PATCH iwl-next v3 11/13] ice: enable FDIR filters from raw binary patterns for VFs Ahmed Zaki
2024-07-11  5:42   ` [Intel-wired-lan] " Paul Menzel
2024-07-15 14:33     ` Ahmed Zaki
2024-07-22 15:03   ` Simon Horman
2024-07-10 20:40 ` [PATCH iwl-next v3 12/13] iavf: refactor add/del FDIR filters Ahmed Zaki
2024-07-22 15:04   ` Simon Horman
2024-07-24 16:14     ` Ahmed Zaki
2024-07-24 16:30       ` Simon Horman
2024-07-24 19:28         ` Ahmed Zaki
2024-07-10 20:40 ` [PATCH iwl-next v3 13/13] iavf: add support for offloading tc U32 cls filters Ahmed Zaki
2024-07-22 15:05   ` Simon Horman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240722150530.GL715661@kernel.org \
    --to=horms@kernel.org \
    --cc=ahmed.zaki@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=marcin.szycik@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sridhar.samudrala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).