From: Eric Dumazet <eric.dumazet@gmail.com>
To: Rafal Ozieblo <rafalo@cadence.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] LSO feature added to Cadence GEM driver
Date: Mon, 24 Oct 2016 08:40:56 -0700 [thread overview]
Message-ID: <1477323656.7065.130.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1477315088-28396-1-git-send-email-rafalo@cadence.com>
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 ...)
next prev parent reply other threads:[~2016-10-24 15:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 13:18 [PATCH] LSO feature added to Cadence GEM driver Rafal Ozieblo
2016-10-24 15:40 ` Eric Dumazet [this message]
2016-10-25 12:05 ` [PATCH v2] " Rafal Ozieblo
2016-10-28 17:49 ` David Miller
2016-11-04 11:40 ` [PATCH net-next v3] cadence: Add LSO support Rafal Ozieblo
2016-11-08 1:38 ` David Miller
2016-11-08 13:41 ` [PATCH net-next v4] " Rafal Ozieblo
2016-11-08 19:09 ` Florian Fainelli
2016-11-09 13:41 ` [PATCH net-next v5]] " Rafal Ozieblo
2016-11-10 17:01 ` David Miller
2016-11-16 10:02 ` [PATCH net-next v6] " Rafal Ozieblo
2016-11-16 22:56 ` David Miller
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=1477323656.7065.130.camel@edumazet-glaptop3.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=rafalo@cadence.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).