From: Stephen Hemminger <stephen@networkplumber.org>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, yuanhan.liu@linux.intel.com,
maxime.coquelin@redhat.com, huawei.xie@intel.com
Subject: Re: [dpdk-dev] [PATCH 5/5] net/virtio: fix Tso when mbuf is shared
Date: Mon, 9 Jan 2017 09:59:40 -0800 [thread overview]
Message-ID: <20170109095940.1a6df6ac@xeon-e3> (raw)
In-Reply-To: <1479977798-13417-6-git-send-email-olivier.matz@6wind.com>
On Thu, 24 Nov 2016 09:56:38 +0100
Olivier Matz <olivier.matz@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?
prev parent reply other threads:[~2017-01-09 17:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 8:56 [dpdk-dev] [PATCH 0/5] virtio/mbuf: fix virtio tso with shared mbufs Olivier Matz
2016-11-24 8:56 ` [dpdk-dev] [PATCH 1/5] mbuf: remove const attribute in mbuf read function Olivier Matz
2016-11-24 8:56 ` [dpdk-dev] [PATCH 2/5] mbuf: new helper to check if a mbuf is shared Olivier Matz
2016-11-24 8:56 ` [dpdk-dev] [PATCH 3/5] mbuf: new helper to write data in a mbuf chain Olivier Matz
2016-11-24 8:56 ` [dpdk-dev] [PATCH 4/5] mbuf: new helper to copy data from a mbuf Olivier Matz
2016-11-24 8:56 ` [dpdk-dev] [PATCH 5/5] net/virtio: fix Tso when mbuf is shared Olivier Matz
2016-12-14 7:27 ` Yuanhan Liu
2017-01-09 17:46 ` Olivier Matz
2017-01-16 6:48 ` Yuanhan Liu
2017-01-17 11:18 ` Olivier Matz
2017-01-18 5:03 ` Yuanhan Liu
2017-01-24 10:51 ` Olivier MATZ
2017-01-28 12:32 ` Yuanhan Liu
2017-01-09 17:59 ` Stephen Hemminger [this message]
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=20170109095940.1a6df6ac@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.com \
--cc=maxime.coquelin@redhat.com \
--cc=olivier.matz@6wind.com \
--cc=yuanhan.liu@linux.intel.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).