From: Richard Gobert <richardbgobert@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
willemdebruijn.kernel@gmail.com, dsahern@kernel.org,
shuah@kernel.org, idosch@nvidia.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/4] net: gro: set inner_network_header in receive phase
Date: Sat, 9 Mar 2024 16:13:24 +0100 [thread overview]
Message-ID: <1d4726dd-cc62-4966-90c1-68ea3f0905c4@gmail.com> (raw)
In-Reply-To: <CANn89iKq755tvJ1BZFXG5aX2YNd9AycbKu57taxi8gaSWn5Syw@mail.gmail.com>
Eric Dumazet wrote:
> On Thu, Mar 7, 2024 at 2:28 PM Richard Gobert <richardbgobert@gmail.com> wrote:
>>
>> This patch sets network_header and inner_network_header to their respective
>> values during the receive phase of GRO. This allows us to use
>> inner_network_header later on in GRO. network_header is already set in
>> dev_gro_receive and under encapsulation inner_network_header is set.
>>
>
>> +static inline int skb_gro_network_offset(const struct sk_buff *skb)
>> +{
>> + const u32 mask = NAPI_GRO_CB(skb)->encap_mark - 1;
>> +
>> + return (skb_network_offset(skb) & mask) | (skb_inner_network_offset(skb) & ~mask);
>
> Presumably this is not needed.
>
>> +}
>> +
>> static inline void *skb_gro_network_header(const struct sk_buff *skb)
>> {
>> + const int offset = skb_gro_network_offset(skb);
>> +
>> if (skb_gro_may_pull(skb, skb_gro_offset(skb)))
>> - return skb_gro_header_fast(skb, skb_network_offset(skb));
>> + return skb_gro_header_fast(skb, offset);
>>
>> - return skb_network_header(skb);
>> + return skb->data + offset;
>> }
>
> I would instead add a new offset parameter to this function.
>
> Again, ideally GRO should work without touching any skb->{offset}.
>
> GRO stack should maintain the offsets it needs in its own storage
> (stack parameter, or other storage if needed)
>
> Upper stack can not trust any of these skb fields, otherwise we would
> have some troubles with napi_reuse_skb()
Inner and outer network headers are needed for commit #4, I will store them
in the CB.
Moreover I will work on another patch series, that changes GRO receive phase
to use stack params as you suggested. (prev offset, and I will also work on a
version with data_offset too).
next prev parent reply other threads:[~2024-03-09 15:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 13:21 [PATCH net-next v2 0/4] net: gro: encapsulation bug fix and flush checks improvements Richard Gobert
2024-03-07 13:25 ` [PATCH net-next v2 1/4] net: gro: add p_off param in *_gro_complete Richard Gobert
2024-03-07 13:26 ` [PATCH net-next v2 2/4] selftests/net: add local address bind in vxlan selftest Richard Gobert
2024-03-07 13:27 ` [PATCH net-next v2 3/4] net: gro: set inner_network_header in receive phase Richard Gobert
2024-03-07 17:59 ` Eric Dumazet
2024-03-09 15:13 ` Richard Gobert [this message]
2024-03-07 13:29 ` [PATCH net-next v2 4/4] net: gro: move L3 flush checks to tcp_gro_receive Richard Gobert
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=1d4726dd-cc62-4966-90c1-68ea3f0905c4@gmail.com \
--to=richardbgobert@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=willemdebruijn.kernel@gmail.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).