From patchwork Wed Dec 26 07:34:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1018617 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 43PnC24Vg2z9s8J for ; Wed, 26 Dec 2018 20:06:22 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 64EBAE94; Wed, 26 Dec 2018 09:06:19 +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 BF824E90 for ; Wed, 26 Dec 2018 09:06:18 +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 C57A8189 for ; Wed, 26 Dec 2018 09:06:17 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with ESMTPS (AES256-SHA encrypted); 26 Dec 2018 09:41:10 +0200 Received: from l-dev-uefi14.mtl.labs.mlnx. (l-dev-uefi14.mtl.labs.mlnx [10.134.80.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBQ7Yh9O004640; Wed, 26 Dec 2018 09:34:43 +0200 From: Eli Britstein To: dev@openvswitch.org Date: Wed, 26 Dec 2018 09:34:35 +0200 Message-Id: <20181226073435.24625-1-elibr@mellanox.com> X-Mailer: git-send-email 2.14.5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Simon Horman , Eli Britstein Subject: [ovs-dev] [PATCH V2 1/1] netdev-tc-offloads: Do not set 0 port attribute to TC tunnel 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 For non UDP tunnels as GRE there is no UDP port, i.e initialized to 0. Do not set the port attribute in such case. Signed-off-by: Eli Britstein Reviewed-by: Paul Blakey --- lib/netdev-tc-offloads.c | 6 ++++-- lib/tc.c | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c index 606a4f4db..5e6f69951 100644 --- a/lib/netdev-tc-offloads.c +++ b/lib/netdev-tc-offloads.c @@ -651,8 +651,10 @@ parse_tc_flower_to_match(struct tc_flower *flower, nl_msg_put_u8(buf, OVS_TUNNEL_KEY_ATTR_TTL, action->encap.ttl); } - nl_msg_put_be16(buf, OVS_TUNNEL_KEY_ATTR_TP_DST, - action->encap.tp_dst); + if (action->encap.tp_dst) { + nl_msg_put_be16(buf, OVS_TUNNEL_KEY_ATTR_TP_DST, + action->encap.tp_dst); + } if (!action->encap.no_csum) { nl_msg_put_u8(buf, OVS_TUNNEL_KEY_ATTR_CSUM, !action->encap.no_csum); diff --git a/lib/tc.c b/lib/tc.c index 47127ca2c..5681ee096 100644 --- a/lib/tc.c +++ b/lib/tc.c @@ -1661,7 +1661,9 @@ nl_msg_put_act_tunnel_key_set(struct ofpbuf *request, ovs_be64 id, if (ttl) { nl_msg_put_u8(request, TCA_TUNNEL_KEY_ENC_TTL, ttl); } - nl_msg_put_be16(request, TCA_TUNNEL_KEY_ENC_DST_PORT, tp_dst); + if (tp_dst) { + nl_msg_put_be16(request, TCA_TUNNEL_KEY_ENC_DST_PORT, tp_dst); + } nl_msg_put_act_tunnel_geneve_option(request, tun_metadata); nl_msg_put_u8(request, TCA_TUNNEL_KEY_NO_CSUM, no_csum); } @@ -2035,7 +2037,9 @@ nl_msg_put_flower_tunnel(struct ofpbuf *request, struct tc_flower *flower) nl_msg_put_u8(request, TCA_FLOWER_KEY_ENC_IP_TTL, ttl); nl_msg_put_u8(request, TCA_FLOWER_KEY_ENC_IP_TTL_MASK, ttl_mask); } - nl_msg_put_be16(request, TCA_FLOWER_KEY_ENC_UDP_DST_PORT, tp_dst); + if (tp_dst) { + nl_msg_put_be16(request, TCA_FLOWER_KEY_ENC_UDP_DST_PORT, tp_dst); + } nl_msg_put_be32(request, TCA_FLOWER_KEY_ENC_KEY_ID, id); nl_msg_put_flower_tunnel_opts(request, TCA_FLOWER_KEY_ENC_OPTS, flower->key.tunnel.metadata);