From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 0C9865946 for ; Wed, 4 Nov 2015 12:18:52 +0100 (CET) Received: by wmeg8 with SMTP id g8so38571900wme.1 for ; Wed, 04 Nov 2015 03:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding :content-type; bh=UOM6sb7hnE1S9I6Pp62Pt4S9bU8dSvu5AvrahesNRT0=; b=KxdgFPpGvS7GUBpE1zobcXPzj8ykviJHzCiaR9p9l8Q/MyZ2Jvk3QfeqaHeYFOB80Q YFiJ8JEdcfyXiql1MsAIzyfwUHeibxyrCbmXRlJgMwG7QoWJILAZmew0BQKj+kXWKEu+ 4x6J4a0gQNU9EoK/47PPIomfXPxESHEexVNTJbedaKtww6h5hf6dESYKXRzfcwtnEUjz ftg7q4uL2i6y50XCiqatzw2EgzkMvbJgbcIlggN5Y4jzbmFJKscZsRwHWCnkJ2mdMDKm LxYmJMutfaXVCCqicXn+0WIKGBjfRRV5qfIBXLm03ADLp642AfvFOxGT3/BHmKGaCVol Ng/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=UOM6sb7hnE1S9I6Pp62Pt4S9bU8dSvu5AvrahesNRT0=; b=KacZJrgmEoA+Bg3Yu+ZknXtAmzuqbkBh6svs1OClNaRnfX8Gqg8KPAaxnAs2VYe6D3 6N8N4PrXpDxfNxwZod22Bii0bp2lDjIwqnMfVJj1jCNDVppwbIRwvSmW13/V0JaJz3TJ ZRs5LPB+vEqOca3fHICqJJ4K5Ju3ClNKRM3WVNFp6Bm1vd8TJLoCwHgN0TngaixyVIAA 2iiJFD2PRpZr2mGbHZq+mXnRP2MHIC6DlZkLYjH9L8kLsSlotVOyM3ysIfN70r0qYhb4 2J+W2sZVpAmeuOYOhvVDjGYP2X6kZpWAuwSWOBqKhWoYvXG2f0SY81sY5VIFm9zagueD lK0A== X-Gm-Message-State: ALoCoQnmq4A/pDd1qrtjDJRGUHY1LxCpq7LpHOtigNEuiD5AEXNMO5XprEXNGDsSOici83EP8PM6 X-Received: by 10.28.140.211 with SMTP id o202mr26604830wmd.73.1446635931866; Wed, 04 Nov 2015 03:18:51 -0800 (PST) Received: from xps13.localnet (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id g66sm28260372wmd.1.2015.11.04.03.18.50 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Nov 2015 03:18:51 -0800 (PST) From: Thomas Monjalon To: Jijiang Liu Date: Wed, 04 Nov 2015 12:17:40 +0100 Message-ID: <2611781.I9AKvK5K3K@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1446634456-413-7-git-send-email-jijiang.liu@intel.com> References: <1446634456-413-1-git-send-email-jijiang.liu@intel.com> <1446634456-413-7-git-send-email-jijiang.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org, "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2015 11:18:52 -0000 2015-11-04 18:54, Jijiang Liu: > + /* if vhost TX checksum offload is required */ > + if (m->ol_flags & PKT_TX_IP_CKSUM) { > + hdr->csum_start = m->l2_len; > + hdr->csum_offset = offsetof(struct ipv4_hdr, hdr_checksum); > + } else if (m->ol_flags & PKT_TX_L4_MASK) { > + hdr->csum_start = m->l2_len + m->l3_len; > + switch (m->ol_flags & PKT_TX_L4_MASK) { > + case PKT_TX_TCP_CKSUM: > + hdr->csum_offset = offsetof(struct tcp_hdr, cksum); > + break; > + case PKT_TX_UDP_CKSUM: > + hdr->csum_offset = offsetof(struct udp_hdr, > + dgram_cksum); > + break; > + case PKT_TX_SCTP_CKSUM: > + hdr->csum_offset = offsetof(struct sctp_hdr, cksum); > + break; > + default: > + break; > + } The header checksum to offload is deduced from csum_offset. Your vhost implementation do some parsing to deduce it: > + 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