Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507325

Re: [PATCH] LSO feature added to Cadence GEM driver

From Eric Dumazet <eric.dumazet@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] LSO feature added to Cadence GEM driver
Date 2016-10-24 17:50 +0200
Message-ID <svPFD-17R-3@gated-at.bofh.it> (permalink)
References <svNXb-8hj-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2016-10-24 at 14:18 +0100, Rafal Ozieblo wrote:
> New Cadence GEM hardware support Large Segment Offload (LSO):
> TCP segmentation offload (TSO) as well as UDP fragmentation
> offload (UFO). Support for those features was added to the driver.
> 
> Signed-off-by: Rafal Ozieblo <rafalo@cadence.com>

...
>  
> +static int macb_lso_check_compatibility(struct sk_buff *skb, unsigned int hdrlen)
> +{
> +	unsigned int nr_frags, f;
> +
> +	if (skb_shinfo(skb)->gso_size == 0)
> +		/* not LSO */
> +		return -EPERM;
> +
> +	/* there is only one buffer */
> +	if (!skb_is_nonlinear(skb))
> +		return 0;
> +
> +	/* For LSO:
> +	 * When software supplies two or more payload buffers all payload buffers
> +	 * apart from the last must be a multiple of 8 bytes in size.
> +	 */
> +	if (!IS_ALIGNED(skb_headlen(skb) - hdrlen, MACB_TX_LEN_ALIGN))
> +		return -EPERM;
> +
> +	nr_frags = skb_shinfo(skb)->nr_frags;
> +	/* No need to check last fragment */
> +	nr_frags--;
> +	for (f = 0; f < nr_frags; f++) {
> +		const skb_frag_t *frag = &skb_shinfo(skb)->frags[f];
> +
> +		if (!IS_ALIGNED(skb_frag_size(frag), MACB_TX_LEN_ALIGN))
> +			return -EPERM;
> +	}
> +	return 0;
> +}
> +

Very strange hardware requirements ;(

You should implement an .ndo_features_check method
to perform the checks from core networking stack, and not from your
ndo_start_xmit()

This has the huge advantage of not falling back to skb_linearize(skb)
which is very likely to fail with ~64 KB skbs anyway.

(Your ndo_features_check() would request software GSO instead ...)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] LSO feature added to Cadence GEM driver Rafal Ozieblo <rafalo@cadence.com> - 2016-10-24 16:00 +0200
  Re: [PATCH] LSO feature added to Cadence GEM driver Eric Dumazet <eric.dumazet@gmail.com> - 2016-10-24 17:50 +0200
  [PATCH v2] LSO feature added to Cadence GEM driver Rafal Ozieblo <rafalo@cadence.com> - 2016-10-25 14:50 +0200

csiph-web