From: Hangbin Liu <liuhangbin@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, "Michael S . Tsirkin" <mst@redhat.com>,
Jason Wang <jasowang@redhat.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxim Mikityanskiy <maximmi@mellanox.com>,
virtualization@lists.linux-foundation.org,
Balazs Nemeth <bnemeth@redhat.com>,
Mike Pattrick <mpattric@redhat.com>,
Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH net-next] net/af_packet: add VLAN support for AF_PACKET SOCK_RAW GSO
Date: Fri, 22 Apr 2022 10:08:44 +0800 [thread overview]
Message-ID: <YmIOLBihyeLy+PCS@Laptop-X1> (raw)
In-Reply-To: <CA+FuTSckEJVUH1Q2vBxGbfPgVteyDVmTfjJC6hBj=qRP+JcAxA@mail.gmail.com>
Hi Willem,
On Thu, Apr 21, 2022 at 10:15:16AM -0400, Willem de Bruijn wrote:
> Your approach does sound simpler than the above. Thanks for looking
> into that alternative, though.
Sorry I have to bring this topic back. I just remembered that
tpacket_snd() already called skb_probe_transport_header() before calling
virtio_net_hdr_* functions. e.g.
- tpacket_snd()
- tpacket_fill_skb()
- packet_parse_headers()
- skb_probe_transport_header()
- if (po->has_vnet_hdr)
- virtio_net_hdr_to_skb()
- virtio_net_hdr_set_proto()
While for packet_snd()
- packet_snd()
- if (has_vnet_hdr)
- virtio_net_hdr_to_skb()
- virtio_net_hdr_set_proto()
- packet_parse_headers()
- skb_probe_transport_header()
If we split skb_probe_transport_header() from packet_parse_headers() and
move it before calling virtio_net_hdr_* function in packet_snd(). Should
we do the same for tpacket_snd(), i.e. move skb_probe_transport_header()
after the virtio_net_hdr_* function?
I think it really doesn't matter whether calls skb_probe_transport_header()
before or after virtio_net_hdr_* functions if we could set the skb->protocol
and network header correctly. Because
- skb_probe_transport_header()
- skb_flow_dissect_flow_keys_basic()
- __skb_flow_dissect()
In __skb_flow_dissect()
```
* @data: raw buffer pointer to the packet, if NULL use skb->data
* @proto: protocol for which to get the flow, if @data is NULL use skb->protocol
* @nhoff: network header offset, if @data is NULL use skb_network_offset(skb)
* @hlen: packet header length, if @data is NULL use skb_headlen(skb)
```
So when data is NULL, we need to make sure the protocol, network header offset,
packet header length are correct.
Before this patch, the VLAN packet network header offset is incorrect when calls
skb_probe_transport_header(). After the fix, this issue should be gone
and we can call skb_probe_transport_header() safely.
So my conclusion is. There is no need to split packet_parse_headers(). Move
packet_parse_headers() before calling virtio_net_hdr_* function in packet_snd()
should be safe.
Please pardon me if I didn't make something clear.
Let's me know what do you think.
Thanks
Hangbin
next prev parent reply other threads:[~2022-04-22 2:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 8:27 [PATCH net-next] net/af_packet: add VLAN support for AF_PACKET SOCK_RAW GSO Hangbin Liu
2022-04-20 13:45 ` Willem de Bruijn
2022-04-21 2:31 ` Hangbin Liu
2022-04-21 14:15 ` Willem de Bruijn
2022-04-22 2:08 ` Hangbin Liu [this message]
2022-04-22 21:39 ` Willem de Bruijn
2022-04-24 2:29 ` Hangbin Liu
2022-04-24 13:46 ` Willem de Bruijn
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=YmIOLBihyeLy+PCS@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=bnemeth@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=maximmi@mellanox.com \
--cc=mpattric@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux-foundation.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