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 <[email protected]>

Reviewed-by: Maciej Fijalkowski <[email protected]>

> ---
>  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 via email to