From patchwork Mon May 17 13:45:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Varghese X-Patchwork-Id: 1479514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=SH7F+Oqt; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FkL591b1lz9s5R for ; Mon, 17 May 2021 23:46:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A554E83CA6; Mon, 17 May 2021 13:46:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SezW6b5hE1pm; Mon, 17 May 2021 13:46:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTP id 0ECBC838ED; Mon, 17 May 2021 13:46:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CD3C6C000E; Mon, 17 May 2021 13:46:12 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 39906C0001 for ; Mon, 17 May 2021 13:46:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2E75240351 for ; Mon, 17 May 2021 13:46:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yXMaa4O_ih_A for ; Mon, 17 May 2021 13:46:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by smtp4.osuosl.org (Postfix) with ESMTPS id 94CDD4033F for ; Mon, 17 May 2021 13:46:07 +0000 (UTC) Received: by mail-pj1-x1029.google.com with SMTP id gb21-20020a17090b0615b029015d1a863a91so5600666pjb.2 for ; Mon, 17 May 2021 06:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WvCd3qwdk2SGSibxDPcp8Dt1YJj9v6t5BPbAkyODAoY=; b=SH7F+Oqt0y2BmNl+yLPd5n1/ha8OzJchTlDCuqaij95vssCsdSxm39yiSrF/NIgjbR n65PO8rIkBqHSdZ5AL1BmjM53pCoLrqLuHk24R7D3AgyLA5w3RJmhUg26OvFiNgLuTGu Xh5Xu4WQyN+Sn2hNF95yjE4a3a2xi7NQcVtzZk3GxX8qSn6ki60QBaSVHUkdqQNpuvMd S58PVi8bi6f2ak/tTNRx4L3sfYldh4NhUXp717t5/6QIb9YVokm1fSMxXzxW3SiLTUZy P26R7r/R5hzEgyUckhsJ2Nw0BUB7qRTc5maX5jJKvF+18vtl1k9jF1MMvpLv3N5bkNQQ SvEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WvCd3qwdk2SGSibxDPcp8Dt1YJj9v6t5BPbAkyODAoY=; b=g+GvGZvycJTOf3u2Nr3pufstam4fn/CIJEdLRczcq0OwUGHbPzPAKB5xLX74F77tHg ye+LIldHyUVNtbxvaYzDV82q42ye7f7MmDB4420wbDKa9ZidYbkOp4J8vaMSD257lIL5 62dLcR5Ffh51bBaED+J4kzXKBKCnxDShrZKRGpilVwS4qqFBUW15cZS/AGmM6s/7EMtU 6XPqad0WAYiqmGn+rWuWB7rSjUAs7t6UdzxvrQkzESVNAlBrvMvDOiZJtPrqy3sUndAZ +6PGzu9a0FMhLYxN9N1JUveMzJTKcB2FPiF0Ev2xxgav2SwCrvdkS6V4RaXaBrP6th5k /Y8w== X-Gm-Message-State: AOAM532TkkEdwYye8dEDq1/dbMY2/6JhW+GOrfpe1+ts23kcoZGDeTyk gcX3yZPWJJ6M3hcSU0tTlzM= X-Google-Smtp-Source: ABdhPJxQxyGpzqpCzPVDd4DAxVpQDTec8t7tGlYdocJlSo+hgeQ8wCMKZ72jLHB/YMgIRhOgFmHCCg== X-Received: by 2002:a17:902:6bc7:b029:ee:f84f:1093 with SMTP id m7-20020a1709026bc7b02900eef84f1093mr65939plt.37.1621259166924; Mon, 17 May 2021 06:46:06 -0700 (PDT) Received: from martin-ubuntu ([111.92.74.221]) by smtp.gmail.com with ESMTPSA id n20sm11013505pjq.45.2021.05.17.06.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 06:46:06 -0700 (PDT) From: Martin Varghese To: dev@openvswitch.org, echaudro@redhat.com, jan.scheurich@ericsson.com, i.maximets@ovn.org Date: Mon, 17 May 2021 19:15:48 +0530 Message-Id: <20210517134548.2083-1-martinvarghesenokia@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Cc: Martin Varghese Subject: [ovs-dev] [PATCH v2] Fix redundant datapath set ethernet action with NSH Decap X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Martin Varghese When a decap action is applied on NSH header encapsulatiing a ethernet packet a redundant set mac address action is programmed to the datapath. Fixes: f839892a206a ("OF support and translation of generic encap and decap") Signed-off-by: Martin Varghese Acked-by: Jan Scheurich Acked-by: Eelco Chaudron --- Changes in v2: - Fixed code styling - Added Ack from jan.scheurich@ericsson.com - Added Ack from echaudro@redhat.com lib/odp-util.c | 3 ++- ofproto/ofproto-dpif-xlate.c | 2 ++ tests/nsh.at | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/odp-util.c b/lib/odp-util.c index e1199d1da..e2ac241d7 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -7830,7 +7830,8 @@ commit_set_ether_action(const struct flow *flow, struct flow *base_flow, struct offsetof_sizeof ovs_key_ethernet_offsetof_sizeof_arr[] = OVS_KEY_ETHERNET_OFFSETOF_SIZEOF_ARR; - if (flow->packet_type != htonl(PT_ETH)) { + if (flow->packet_type != htonl(PT_ETH) || + base_flow->packet_type != htonl(PT_ETH)) { return; } diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 7108c8a30..a6f4ea334 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -6549,6 +6549,8 @@ xlate_generic_decap_action(struct xlate_ctx *ctx, * Delay generating pop_eth to the next commit. */ flow->packet_type = htonl(PACKET_TYPE(OFPHTN_ETHERTYPE, ntohs(flow->dl_type))); + flow->dl_src = eth_addr_zero; + flow->dl_dst = eth_addr_zero; ctx->wc->masks.dl_type = OVS_BE16_MAX; } return false; diff --git a/tests/nsh.at b/tests/nsh.at index d5c772ff0..e84134e42 100644 --- a/tests/nsh.at +++ b/tests/nsh.at @@ -105,7 +105,7 @@ bridge("br0") Final flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=11:22:33:44:55:66,dl_type=0x894f,nsh_flags=0,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_si=255,nsh_c1=0x11223344,nsh_c2=0x0,nsh_c3=0x0,nsh_c4=0x0,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0 Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=66:77:88:99:aa:bb,nw_frag=no -Datapath actions: push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x1) +Datapath actions: push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),recirc(0x1) ]) AT_CHECK([ @@ -139,7 +139,7 @@ ovs-appctl time/warp 1000 AT_CHECK([ ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort ], [0], [flow-dump from the main thread: -recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x3) +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),recirc(0x3) recirc_id(0x3),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:2 ]) @@ -232,7 +232,7 @@ bridge("br0") Final flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=11:22:33:44:55:66,dl_type=0x894f,nsh_flags=0,nsh_ttl=63,nsh_mdtype=2,nsh_np=3,nsh_spi=0x1234,nsh_si=255,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0 Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=66:77:88:99:aa:bb,nw_frag=no -Datapath actions: push_nsh(flags=0,ttl=63,mdtype=2,np=3,spi=0x1234,si=255,md2=0x10000a041234567820001408fedcba9876543210),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x1) +Datapath actions: push_nsh(flags=0,ttl=63,mdtype=2,np=3,spi=0x1234,si=255,md2=0x10000a041234567820001408fedcba9876543210),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),recirc(0x1) ]) AT_CHECK([ @@ -266,7 +266,7 @@ ovs-appctl time/warp 1000 AT_CHECK([ ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort ], [0], [flow-dump from the main thread: -recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=2,np=3,spi=0x1234,si=255,md2=0x10000a041234567820001408fedcba9876543210),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x3) +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=2,np=3,spi=0x1234,si=255,md2=0x10000a041234567820001408fedcba9876543210),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),recirc(0x3) recirc_id(0x3),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:2 ])