From patchwork Wed Sep 13 14:04:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 813462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xsk2G475Nz9sNr for ; Thu, 14 Sep 2017 00:05:10 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 729C8B15; Wed, 13 Sep 2017 14:05:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 07260B12 for ; Wed, 13 Sep 2017 14:05:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id D8F9F195 for ; Wed, 13 Sep 2017 14:05:04 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from roid@mellanox.com) with ESMTPS (AES256-SHA encrypted); 13 Sep 2017 17:05:01 +0300 Received: from dev-r-vrt-189.mtr.labs.mlnx (dev-r-vrt-189.mtr.labs.mlnx [10.212.189.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v8DE50KI028494; Wed, 13 Sep 2017 17:05:00 +0300 From: Roi Dayan To: dev@openvswitch.org Date: Wed, 13 Sep 2017 17:04:58 +0300 Message-Id: <1505311498-13843-1-git-send-email-roid@mellanox.com> X-Mailer: git-send-email 2.7.5 X-Spam-Status: No, score=0.0 required=5.0 tests=RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Simon Horman Subject: [ovs-dev] [PATCH V2] netdev-tc-offloads: Fix vxlan tunnel offloading X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Paul Blakey This commit fixes offloading when tunnel id is 0 by checking for valid tunnel dst ipv4 or ipv6, like done in the normal flow. Also need to reset the tunnel mask outside the condition because in the special case, when adding a port with key=flow, the match for tunnel_set gets a tunnel key id 0 with a mask. If we don't reset the mask we'll fail later when we check for unknown attributes that the mask was not reset. Fixes: 8f283af89298 ("netdev-tc-offloads: Implement netdev flow put using tc interface") Signed-off-by: Paul Blakey Reviewed-by: Roi Dayan --- Hi, This is V2 for the prev patch with title "netdev-tc-offloads: Fix offloading when tunnel id is 0" V1->V2: - Use flow_tnl_dst_is_set() instead of checking mask - Move memset of maks tunnel to outside the condition - Update commit message Thanks, Roi lib/netdev-tc-offloads.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index 3c145c2..524c7dc 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -683,7 +683,7 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, memset(&flower, 0, sizeof flower); - if (tnl->tun_id) { + if (flow_tnl_dst_is_set(&key->tunnel)) { VLOG_DBG_RL(&rl, "tunnel: id %#" PRIx64 " src " IP_FMT " dst " IP_FMT " tp_src %d tp_dst %d", @@ -698,9 +698,8 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match, flower.tunnel.tp_src = tnl->tp_src; flower.tunnel.tp_dst = tnl->tp_dst; flower.tunnel.tunnel = true; - - memset(&mask->tunnel, 0, sizeof mask->tunnel); } + memset(&mask->tunnel, 0, sizeof mask->tunnel); flower.key.eth_type = key->dl_type; flower.mask.eth_type = mask->dl_type;