From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com [209.85.192.176]) by dpdk.org (Postfix) with ESMTP id C26E61E2B for ; Mon, 9 Jan 2017 18:59:43 +0100 (CET) Received: by mail-pf0-f176.google.com with SMTP id 189so20012616pfu.3 for ; Mon, 09 Jan 2017 09:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8PEXvA9bgF0kVpxxql+E7aW/6iXcvi33MVTyTDUipRg=; b=hFLjjS2BjlwRKizXCT7Cs5fIXKCdDoucGy/qcJXHCCQmjns3zqjgqycrf07nfwsOft mAZKqDW6k9S4O6+6FWbmpweP2YSXbu01VZe7mUSdsLvTxVLr1mS5o8Ug+HFxfJWD4qdC X3FSnmk1h9VVHYWv2ab4TkeGzBWW0fSWwEe4x+vNnsz3UDvsJW33qHbV79ulkFeSGttw Ce/kN/oQYREGZ5pd2ZdB3dNOoJQjmAgTTvs+zE7e1smWhvc4RFQIpuaBvYoPZFHHfsDV X0cKnvS2r5EZUQsZ5X6kl5+f6PI2WzOccpz0scspr6gEF4EjIeCB3S1AmZQLbjM2hJAI xxGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8PEXvA9bgF0kVpxxql+E7aW/6iXcvi33MVTyTDUipRg=; b=VYhL9omstUI+Z8EyIUqPuiHpKomeiQjvFgi6i/t2KJDiL69uDMiZL70jd0LkGSnEMl YesIpYD51XT597OLuO27qqQr8Z3C5UkcW7K6jdTSzYmhFB2YGHTG4OsoOQCSuS6YmkJL qHrw0Vg5gM/pF7sXXg0R+11Srs/JqZosMuN42rPKfha2juckGxwoDX4KDWfHg++D4rq9 uriOvVR5Ty6tsCwT/rBoAp2PIl8fqO7iNYmwtqsxXNR0c3JyuLKf9Si0BrKTlypbybYv bnTgQsch5J5Q5CKkx2YqieD/VIWFzAFqcc5XCg+55LJvDNJNUQkd/6cFjg/E78ibcKw3 OrUw== X-Gm-Message-State: AIkVDXKpZjr+O1KPYc/Mn8UfKjmpLGyqPtSX8pGf+enG0SxLDjOaJA8wDMY8pxdVk4iieQ== X-Received: by 10.84.215.194 with SMTP id g2mr196835941plj.16.1483984783072; Mon, 09 Jan 2017 09:59:43 -0800 (PST) Received: from xeon-e3 (204-195-18-65.wavecable.com. [204.195.18.65]) by smtp.gmail.com with ESMTPSA id f5sm165896622pgg.5.2017.01.09.09.59.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2017 09:59:42 -0800 (PST) Date: Mon, 9 Jan 2017 09:59:40 -0800 From: Stephen Hemminger To: Olivier Matz Cc: dev@dpdk.org, yuanhan.liu@linux.intel.com, maxime.coquelin@redhat.com, huawei.xie@intel.com Message-ID: <20170109095940.1a6df6ac@xeon-e3> In-Reply-To: <1479977798-13417-6-git-send-email-olivier.matz@6wind.com> References: <1479977798-13417-1-git-send-email-olivier.matz@6wind.com> <1479977798-13417-6-git-send-email-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 5/5] net/virtio: fix Tso when mbuf is shared X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2017 17:59:44 -0000 On Thu, 24 Nov 2016 09:56:38 +0100 Olivier Matz 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?