From patchwork Mon Nov 23 11:17:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zang MingJie X-Patchwork-Id: 547505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 65B031402B1 for ; Mon, 23 Nov 2015 22:17:29 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=QQ+E3iEM; dkim-atps=neutral Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id C9DAC1030D; Mon, 23 Nov 2015 03:17:27 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 86E62102FE for ; Mon, 23 Nov 2015 03:17:26 -0800 (PST) Received: from bar4.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 6E2EA161ADB for ; Mon, 23 Nov 2015 04:17:25 -0700 (MST) X-ASG-Debug-ID: 1448277444-03dc217b9e174e50001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar4.cudamail.com with ESMTP id 3Geht3qlVB76G600 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 23 Nov 2015 04:17:24 -0700 (MST) X-Barracuda-Envelope-From: zealot0630@gmail.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mail-io0-f170.google.com) (209.85.223.170) by mx3-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 23 Nov 2015 11:17:24 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at _netblocks.google.com designates 209.85.223.170 as permitted sender) X-Barracuda-RBL-Trusted-Forwarder: 209.85.223.170 Received: by ioir85 with SMTP id r85so183356664ioi.1 for ; Mon, 23 Nov 2015 03:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=xBxRwOC3AfF2uJXKBjW14auBHUuSzy5Iw8oSsAKdIpw=; b=QQ+E3iEMW4qHd3khXNoAz3ZC+PVHoy7Mj4lrxYJvfvo9VukZ4mxr9ztYwAnGeBuO6g JyR0HmRP81wkhrn79ygfIn2IWJr1wA5AAgZU/KYnZ2L+FSFwXjuyqvPWDrf5UeDaw+V9 mXzyawIbsYWthUdBIxkkrsh7Ap2KGkz0Bkjmtn7HMNZ1cQauww0dRRsiu1shwY5uIlE1 TD579vqsL2WDKgH/70Pc4YAxJbFpIUeDUvzZwOrB5bYxp4An2x5TdcpYPaOWUaLp+3MZ AcEwv9fnR0ulkKW/rcwm2Z2DMrTIvONT1SDmjjPd2nEDl66f0uBUFWyb/43UJhX51Tq0 lelw== X-Received: by 10.107.162.68 with SMTP id l65mr23675004ioe.179.1448277443663; Mon, 23 Nov 2015 03:17:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.8.50 with HTTP; Mon, 23 Nov 2015 03:17:04 -0800 (PST) X-CudaMail-Envelope-Sender: zealot0630@gmail.com From: Zang MingJie Date: Mon, 23 Nov 2015 19:17:04 +0800 Message-ID: X-CudaMail-MID: CM-V1-1122004215 X-CudaMail-DTE: 112315 X-CudaMail-Originating-IP: 209.85.223.170 To: dev@openvswitch.org X-ASG-Orig-Subj: [##CM-V1-1122004215##]ovs 2.4 vxlan udp csum isn't working X-GBUdb-Analysis: 0, 209.85.223.170, Ugly c=0.387593 p=-0.302326 Source Normal X-MessageSniffer-Rules: 0-0-0-5698-c X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1448277444 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, DKIM_SIGNED, MAILTO_TO_SPAM_ADDR, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.24647 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 DKIM_SIGNED Domain Keys Identified Mail: message has a signature 0.00 MAILTO_TO_SPAM_ADDR URI: Includes a link to a likely spammer email 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] ovs 2.4 vxlan udp csum isn't working X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" Hi I have set up an environment using ovs 2.4 with ovs shipped datapath and kernel 3.14. When perfing vxlan performance with csum enabled, I found checksum of most udp packets are zero, but some are correct value not zero. This is my vsctl on sender end: Port "vxlan-0ab49c21" Interface "vxlan-0ab49c21" type: vxlan options: {csum="true", df_default="true", in_key=flow, local_ip="10.180.156.34", out_key=flow, remote_ip="10.180.156.33"} and its dp-flow when doing perf: $ sudo ovs-dpctl dump-flows recirc_id(0),in_port(3),eth(src=fa:16:3e:d8:06:a8,dst=fa:16:3e:7b:22:c1),eth_type(0x0800),ipv4(tos=0/0x3,frag=no), packets:11587, bytes:192152422, used:0.001s, flags:P., actions:set(tunnel(tun_id=0x190,src=10.180.156.34,dst=10.180.156.33,ttl=64,flags(df,csum,key))),1 recirc_id(0),tunnel(tun_id=0x190,src=10.180.156.33,dst=10.180.156.34,ttl=64,flags(-df+csum+key)),in_port(1),skb_mark(0),eth(src=fa:16:3e:7b:22:c1,dst=fa:16:3e:d8:06:a8),eth_type(0x0800),ipv4(frag=no), packets:32832, bytes:2332180, used:0.001s, flags:., actions:3 After some investment, finally I found the bug. All udp gso packet doesn't have checksum. Here is the patch to fix it: commit df4620805747bb7065eebe5b432b16b01973202c Author: Zang MingJie Date: Mon Nov 23 19:15:02 2015 +0800 Fix vxlan udp csum of gso packet Signed-off-by: Zang MingJie diff --git a/datapath/linux/compat/udp_tunnel.c b/datapath/linux/compat/udp_tunnel.c index a3223fd..19a1ea5 100644 --- a/datapath/linux/compat/udp_tunnel.c +++ b/datapath/linux/compat/udp_tunnel.c @@ -133,7 +133,7 @@ void ovs_udp_csum_gso(struct sk_buff *skb) /* csum segment if tunnel sets skb with csum. The cleanest way * to do this just to set it up from scratch. */ skb->ip_summed = CHECKSUM_NONE; - udp_set_csum(true, skb, iph->saddr, iph->daddr, + udp_set_csum(false, skb, iph->saddr, iph->daddr, skb->len - udp_offset); } EXPORT_SYMBOL_GPL(ovs_udp_csum_gso);