The following structure  is defined in virtio standard,

struct virtio_net_hdr {
#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1
u8 flags;
#define VIRTIO_NET_HDR_GSO_NONE 0
#define VIRTIO_NET_HDR_GSO_TCPV4 1
#define VIRTIO_NET_HDR_GSO_UDP 3
#define VIRTIO_NET_HDR_GSO_TCPV6 4
#define VIRTIO_NET_HDR_GSO_ECN 0x80
u8 gso_type;
le16 hdr_len;
le16 gso_size;
le16 csum_start;
le16 csum_offset;
le16 num_buffers;
};

For checksum. The 'flags', ' csum_start' and csum_offset filed need to be 
filled.

For TSO, the 'gso_type', 'hdr_len' and 'csum_offset' fileds need to be filled.


> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Liu, Jijiang
> Sent: Wednesday, November 4, 2015 9:08 PM
> To: Thomas Monjalon
> Cc: dev at dpdk.org; Michael S. Tsirkin
> Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX
> offload
> 
> 
> 
> > -----Original Message-----
> > From: Liu, Jijiang
> > Sent: Wednesday, November 4, 2015 8:52 PM
> > To: 'Thomas Monjalon'
> > Cc: dev at dpdk.org; Michael S. Tsirkin
> > Subject: RE: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX
> > offload
> >
> > Hi Thomas,
> >
> >
> > > -----Original Message-----
> > > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> > > Sent: Wednesday, November 4, 2015 7:18 PM
> > > To: Liu, Jijiang
> > > Cc: dev at dpdk.org; Michael S. Tsirkin
> > > Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost
> >
> >
> > The following code is not in the patch 6, please review the latest patch 
> > set.
> 
> Got it. You copy the codes from vhost side here for the comparison. The v3 is
> latest.
> 
> >
> > > > +       parse_ethernet(m, &l4_proto, &l4_hdr);
> > > > +       if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) {
> > > > +               if ((hdr->csum_start == m->l2_len) &&
> > > > +                       (hdr->csum_offset == offsetof(struct ipv4_hdr,
> > > > +                                               hdr_checksum)))
> > > > +                       m->ol_flags |= PKT_TX_IP_CKSUM;
> > > > +               else if (hdr->csum_start == (m->l2_len + m->l3_len)) {
> > > > +                       switch (hdr->csum_offset) {
> > > > +                       case (offsetof(struct tcp_hdr, cksum)):
> > > > +                               if (l4_proto == IPPROTO_TCP)
> > > > +                                       m->ol_flags |= PKT_TX_TCP_CKSUM;
> > > > +                               break;
> > > > +                       case (offsetof(struct udp_hdr, dgram_cksum)):
> > > > +                               if (l4_proto == IPPROTO_UDP)
> > > > +                                       m->ol_flags |= PKT_TX_UDP_CKSUM;
> > > > +                               break;
> > > > +                       case (offsetof(struct sctp_hdr, cksum)):
> > > > +                               if (l4_proto == IPPROTO_SCTP)
> > > > +                                       m->ol_flags |= 
> > > > PKT_TX_SCTP_CKSUM;
> > > > +                               break;
> > > > +                       default:
> > > > +                               break;
> > > > +                       }
> > > > +               }
> > >
> > > The kernel doesn't work this way.
> > > Please could you check that your virtio implementation works with a
> > vanilla
> > > Linux with or without vhost?
> > > Thanks
> >
> > This is vhost lib implementation, not virtio-net side.
> > We have already validated with a vanilla Linux with or without
> > virtio-net, and it passed.
> > Could you please review latest patch v3?
> >
> > Xu Qian can send the test report out.

Reply via email to