On Thu, 24 Nov 2016 09:56:38 +0100 Olivier Matz <olivier.m...@6wind.com> wrote:
> diff --git a/drivers/net/virtio/virtio_rxtx.c > b/drivers/net/virtio/virtio_rxtx.c > index 22d97a4..577c775 100644 > --- a/drivers/net/virtio/virtio_rxtx.c > +++ b/drivers/net/virtio/virtio_rxtx.c > @@ -211,43 +211,73 @@ virtqueue_enqueue_recv_refill(struct virtqueue *vq, > struct rte_mbuf *cookie) > > /* When doing TSO, the IP length is not included in the pseudo header > * checksum of the packet given to the PMD, but for virtio it is > - * expected. > + * expected. Fix the mbuf or a copy if the mbuf is shared. > */ > -static void > -virtio_tso_fix_cksum(struct rte_mbuf *m) > +static unsigned int > +virtio_tso_fix_cksum(struct rte_mbuf *m, char *hdr, size_t hdr_sz) > { > - /* common case: header is not fragmented */ > - if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + > - m->l4_len)) { > - struct ipv4_hdr *iph; > - struct ipv6_hdr *ip6h; > - struct tcp_hdr *th; > - uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; > - uint32_t tmp; > - > - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); > - th = RTE_PTR_ADD(iph, m->l3_len); > - if ((iph->version_ihl >> 4) == 4) { > - iph->hdr_checksum = 0; > - iph->hdr_checksum = rte_ipv4_cksum(iph); > - ip_len = iph->total_length; > - ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - > - m->l3_len); > - } else { > - ip6h = (struct ipv6_hdr *)iph; > - ip_paylen = ip6h->payload_len; > + struct ipv4_hdr *iph, iph_copy; > + struct ipv6_hdr *ip6h = NULL, ip6h_copy; > + struct tcp_hdr *th, th_copy; > + size_t hdrlen = m->l2_len + m->l3_len + m->l4_len; > + uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; > + uint32_t tmp; > + int shared = 0; Minor nit, uses bool instead of int for shared?