[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DM4PR18MB42699169ADEDE7BCF87D6AF0DFE4A@DM4PR18MB4269.namprd18.prod.outlook.com>
Date: Fri, 3 Oct 2025 11:06:09 +0000
From: Shiva Shankar Kommula <kshankar@...vell.com>
To: Jason Wang <jasowang@...hat.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"mst@...hat.com"
<mst@...hat.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"xuanzhuo@...ux.alibaba.com" <xuanzhuo@...ux.alibaba.com>,
"virtualization@...ts.linux.dev" <virtualization@...ts.linux.dev>,
"parav@...dia.com" <parav@...dia.com>,
Jerin Jacob <jerinj@...vell.com>,
Nithin Kumar Dabilpuram <ndabilpuram@...vell.com>,
Satananda Burla
<sburla@...vell.com>,
Srujana Challa <schalla@...vell.com>
Subject: RE: [EXTERNAL] Re: [PATCH v1 net-next 1/3] net: implement virtio
helper to handle outer nw offset
> -----Original Message-----
> From: Jason Wang <jasowang@...hat.com>
> Sent: Wednesday, September 24, 2025 6:42 AM
> To: Shiva Shankar Kommula <kshankar@...vell.com>
> Cc: netdev@...r.kernel.org; mst@...hat.com; pabeni@...hat.com;
> xuanzhuo@...ux.alibaba.com; virtualization@...ts.linux.dev;
> parav@...dia.com; Jerin Jacob <jerinj@...vell.com>; Nithin Kumar
> Dabilpuram <ndabilpuram@...vell.com>; Satananda Burla
> <sburla@...vell.com>; Srujana Challa <schalla@...vell.com>
> Subject: [EXTERNAL] Re: [PATCH v1 net-next 1/3] net: implement virtio helper
> to handle outer nw offset
>
> On Wed, Sep 24, 2025 at 8: 51 AM Jason Wang <jasowang@ redhat. com>
> wrote: > > On Wed, Sep 24, 2025 at 4: 23 AM Kommula Shiva Shankar >
> <kshankar@ marvell. com> wrote: > > > > virtio specification introduced
> support ZjQcmQRYFpfptBannerStart Prioritize security for external emails:
> Confirm sender and content safety before clicking links or opening
> attachments <https://us-phishalarm-
> ewt.proofpoint.com/EWT/v1/CRVmXkqW!uK3X-
> 9E6SRp0XGTVtj3VIQ_zyUMjHsJk-qBfNXNYwQ-
> KaaNi0OVbkFRQlH6dtJYLMJxB4nt7OedRALLt3Wbol5OAgy2sLOiZzMfXrW0fM
> e51aGMKTCrL4Ni4Ink$>
> Report Suspicious
>
> ZjQcmQRYFpfptBannerEnd
> On Wed, Sep 24, 2025 at 8:51 AM Jason Wang <jasowang@...hat.com>
> wrote:
> >
> > On Wed, Sep 24, 2025 at 4:23 AM Kommula Shiva Shankar
> > <kshankar@...vell.com> wrote:
> > >
> > > virtio specification introduced support for outer network header
> > > offset broadcast.
> > >
> > > This patch implements the needed defines and virtio header parsing
> > > capabilities.
> > >
> > > Signed-off-by: Kommula Shiva Shankar <kshankar@...vell.com>
> > > ---
> > > include/linux/virtio_net.h | 40
> +++++++++++++++++++++++++++++++++
> > > include/uapi/linux/virtio_net.h | 8 +++++++
> > > 2 files changed, 48 insertions(+)
> > >
> > > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> > > index 20e0584db1dd..e6153e9106d3 100644
> > > --- a/include/linux/virtio_net.h
> > > +++ b/include/linux/virtio_net.h
> > > @@ -374,6 +374,46 @@ static inline int
> virtio_net_handle_csum_offload(struct sk_buff *skb,
> > > return 0;
> > > }
> > >
> > > +static inline int
> > > +virtio_net_out_net_header_to_skb(struct sk_buff *skb,
> > > + struct virtio_net_hdr_v1_hash_tunnel_out_net_hdr
> *vhdr,
> > > + bool out_net_hdr_negotiated,
> > > + bool little_endian) {
> > > + unsigned int out_net_hdr_off;
> > > +
> > > + if (!out_net_hdr_negotiated)
> > > + return 0;
> > > +
> > > + if (vhdr->outer_nh_offset) {
> > > + out_net_hdr_off = __virtio16_to_cpu(little_endian, vhdr-
> >outer_nh_offset);
> > > + skb_set_network_header(skb, out_net_hdr_off);
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +static inline int
> > > +virtio_net_out_net_header_from_skb(const struct sk_buff *skb,
> > > + struct virtio_net_hdr_v1_hash_tunnel_out_net_hdr
> *vhdr,
> > > + bool out_net_hdr_negotiated,
> > > + bool little_endian) {
> > > + unsigned int out_net_hdr_off;
> > > +
> > > + if (!out_net_hdr_negotiated) {
> > > + vhdr->outer_nh_offset = 0;
> > > + return 0;
> > > + }
> > > +
> > > + out_net_hdr_off = skb_network_offset(skb);
> > > + if (out_net_hdr_off && skb->protocol == htons(ETH_P_IP))
> > > + vhdr->outer_nh_offset = __cpu_to_virtio16(little_endian,
> > > +
> > > + out_net_hdr_off);
> >
> > I'd expect this to work for IPV6 as well.
This feature could be extended to both IPv4 and IPv6 as they both used in GSO.
I will send v2 with IPv6 support.
>
> Or why it only works for IP/IPV6.
AFAIK, virtio device acceleration features are optimized for the IP protocol
and transport layers like TCP/UDP.
Although other protocols like IPX uses similar checksum algo used in IP checksum, they are not
utilized in device offloading.
>
> >
> > Thanks
>
> Thanks
Powered by blists - more mailing lists