Netdev List
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Magnus Karlsson <magnus.karlsson@intel.com>
Cc: <netdev@vger.kernel.org>, <magnus.karlsson@gmail.com>,
	<sdf@fomichev.me>, <davem@davemloft.net>, <edumazet@kernel.org>,
	<kuba@kernel.org>, <pabeni@redhat.com>, <horms@kernel.org>,
	<bjorn@kernel.org>, <kerneljasonxing@gmail.com>,
	<intel-wired-lan@lists.osuosl.org>, <anthony.l.nguyen@intel.com>,
	<przemyslaw.kitszel@intel.com>, <jacob.e.keller@intel.com>
Subject: Re: [PATCH net-next 2/5] ice: add Tx descriptor builders and header length check
Date: Fri, 20 Nov 2026 12:59:18 +0100	[thread overview]
Message-ID: <awA2FrMwDMaZ7Yzw@boxer> (raw)
In-Reply-To: <20261119165340.1071525-3-magnus.karlsson@intel.com>

On Thu, Nov 19, 2026 at 05:53:37PM +0100, Magnus Karlsson wrote:
> Add ice_build_tx_desc_offset() and ice_build_tso_ctx_qw1() to
> ice_txrx_lib.h for the length fields of the Tx data descriptor and the
> TSO context descriptor, and use them in ice_tso() and ice_tx_csum().
> Add ice_tx_hdr_lens_ok() for the header length limits of the data
> descriptor, and use it in ice_features_check().
> 
> This prepares for AF_XDP USO in zero-copy mode, which builds the same
> descriptors from a copied packet header instead of an skb. The new
> check also requires IPLEN to be a multiple of 4 bytes, as the field is
> encoded in dwords, and so does the inner IPLEN check for encapsulated
> packets. The IPv4 and IPv6 header lengths that reach them always are.
> No functional change intended.
> 
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

> ---
>  drivers/net/ethernet/intel/ice/ice_main.c     | 12 ++---
>  drivers/net/ethernet/intel/ice/ice_txrx.c     | 20 +++-----
>  drivers/net/ethernet/intel/ice/ice_txrx_lib.h | 48 +++++++++++++++++++
>  3 files changed, 60 insertions(+), 20 deletions(-)
> 
> + */
> +static inline bool ice_tx_hdr_lens_ok(u32 mac_len, u32 ip_len)
> +{
> +	return mac_len <= ICE_TXD_MACLEN_MAX && !(mac_len & 1) &&
> +	       ip_len <= ICE_TXD_IPLEN_MAX && !(ip_len & 3);

alternative would be to use mac_len % ICE_BYTES_PER_WORD, but modulo has
a bad reputation when it comes to performance.

  reply	other threads:[~2026-11-20 12:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 16:53 [PATCH net-next 0/5] xsk: ice: USO support for AF_XDP Magnus Karlsson
2026-11-19 16:53 ` [PATCH net-next 1/5] xsk: add USO support for skb path Magnus Karlsson
2026-11-19 18:47   ` Maciej Fijalkowski
2026-11-20  8:55     ` Magnus Karlsson
2026-11-20 11:43       ` Maciej Fijalkowski
2026-11-19 16:53 ` [PATCH net-next 2/5] ice: add Tx descriptor builders and header length check Magnus Karlsson
2026-11-20 11:59   ` Maciej Fijalkowski [this message]
2026-11-19 16:53 ` [PATCH net-next 3/5] xsk: ice: add USO zero-copy support Magnus Karlsson
2026-11-19 16:53 ` [PATCH net-next 4/5] xsk: add KUnit tests for AF_XDP USO header helpers Magnus Karlsson
2026-11-19 16:53 ` [PATCH net-next 5/5] selftests: net: add AF_XDP USO test Magnus Karlsson
2026-11-19 19:05   ` Maciej Fijalkowski
2026-11-20  8:35     ` Magnus Karlsson

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=awA2FrMwDMaZ7Yzw@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sdf@fomichev.me \
    /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