From: Andrew Melnichenko <andrew@daynix.com>
To: davem@davemloft.net, willemb@google.com, bnemeth@redhat.com,
gregkh@linuxfoundation.org
Cc: Yan Vugenfirer <yan@daynix.com>,
Yuri Benditovich <yuri.benditovich@daynix.com>,
netdev@vger.kernel.org
Subject: VirtioNet L3 protocol patch advice request.
Date: Fri, 29 Oct 2021 13:51:30 +0300 [thread overview]
Message-ID: <CABcq3pG9GRCYqFDBAJ48H1vpnnX=41u+MhQnayF1ztLH4WX0Fw@mail.gmail.com> (raw)
Hi all,
Recently I've discovered a patch that added an additional check for the
protocol in VirtioNet.
(https://www.spinics.net/lists/kernel/msg3866319.html)
Currently, that patch breaks UFOv6 support and possible USOv6 support in
upcoming patches.
The issue is the code next to the patch expects failure of
skb_flow_dissect_flow_keys_basic()
for IPv6 packets to retry it with protocol IPv6.
I'm not sure about the goals of the patch and propose the next solution:
static inline int virtio_net_hdr_set_proto(struct sk_buff *skb,
> const struct virtio_net_hdr *hdr)
> {
> __be16 protocol;
>
> protocol = dev_parse_header_protocol(skb);
> switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {
> case VIRTIO_NET_HDR_GSO_TCPV4:
> skb->protocol = cpu_to_be16(ETH_P_IP);
> break;
> case VIRTIO_NET_HDR_GSO_TCPV6:
> skb->protocol = cpu_to_be16(ETH_P_IPV6);
> break;
> case VIRTIO_NET_HDR_GSO_UDP:
> case VIRTIO_NET_HDR_GSO_UDP_L4:
> skb->protocol = protocol;
> default:
> return -EINVAL;
> }
>
> return protocol && protocol == skb->protocol ? 0 : -EINVAL;
> }
>
And in virtio_net_hdr_to_skb():
if (!skb->protocol) {
> if(virtio_net_hdr_set_proto(skb, hdr))
> return -EINVAL;
> }
>
> if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
> NULL, 0, 0, 0,
> 0)) {
> return -EINVAL;
> }
>
Would such changes suit the goals of the initial patch?
next reply other threads:[~2021-10-29 10:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 10:51 Andrew Melnichenko [this message]
2021-10-29 14:19 ` VirtioNet L3 protocol patch advice request Willem de Bruijn
2021-10-31 20:49 ` 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='CABcq3pG9GRCYqFDBAJ48H1vpnnX=41u+MhQnayF1ztLH4WX0Fw@mail.gmail.com' \
--to=andrew@daynix.com \
--cc=bnemeth@redhat.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
--cc=yan@daynix.com \
--cc=yuri.benditovich@daynix.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).