From patchwork Mon Dec 28 09:25:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: taoyunxiang X-Patchwork-Id: 1421000 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.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D4Qdw6DZcz9sVv for ; Tue, 29 Dec 2020 05:13:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 3FE78870D7; Mon, 28 Dec 2020 18:13:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aBr524j4KvCw; Mon, 28 Dec 2020 18:13:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 82DBC87020; Mon, 28 Dec 2020 18:11:57 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5AB8DC1E67; Mon, 28 Dec 2020 18:11:57 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 833C6C0893 for ; Mon, 28 Dec 2020 09:26:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 7015B819CF for ; Mon, 28 Dec 2020 09:26:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C2k0t9rpe4M1 for ; Mon, 28 Dec 2020 09:26:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com [221.176.66.80]) by hemlock.osuosl.org (Postfix) with ESMTP id 83AE283BBA for ; Mon, 28 Dec 2020 09:26:32 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app08-12008 (RichMail) with SMTP id 2ee85fe9a4adf8f-c082e; Mon, 28 Dec 2020 17:26:05 +0800 (CST) X-RM-TRANSID: 2ee85fe9a4adf8f-c082e X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from yun.localdomain (unknown[112.25.154.146]) by rmsmtp-syy-appsvr02-12002 (RichMail) with SMTP id 2ee25fe9a48a90b-7b92f; Mon, 28 Dec 2020 17:26:05 +0800 (CST) X-RM-TRANSID: 2ee25fe9a48a90b-7b92f From: Tao YunXiang To: ovs-dev@openvswitch.org Date: Mon, 28 Dec 2020 01:25:20 -0800 Message-Id: <20201228092520.11807-63-taoyunxiang@cmss.chinamobile.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201228092520.11807-1-taoyunxiang@cmss.chinamobile.com> References: <8> <20201228092520.11807-1-taoyunxiang@cmss.chinamobile.com> X-Mailman-Approved-At: Mon, 28 Dec 2020 18:10:34 +0000 Cc: LIU CHANG , Rong Yin Subject: [ovs-dev] [PATCH 62/62] Fix some vxlan&&vlan offload problems. 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Rong Yin fix vlan push issue with RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN fix vlan pop issue with ethertype error and ip_0_protocol error fix vxlan decap offload with vxlan flags fix ipv4 pattern ttl dump with 0x Signed-off-by: LIU CHANG --- lib/netdev-dpdk.c | 6 ++++-- lib/netdev-offload-dpdk.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 5c5edb9..3d95d1b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2014,9 +2014,11 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, err = EINVAL; } /* update is_uplink_port && is_vf_rep_port flag */ - if (strstr(dev->devargs,"representor=[10")) { + if (strstr(new_devargs,"representor=[10")) { dev->is_uplink_port = true; - } else if (strstr(dev->devargs,"representor")) { + } else if (strstr(new_devargs,"representor=[64")) { + dev->is_uplink_port = true; + } else if (strstr(new_devargs,"representor")) { dev->is_vf_rep_port = true; } diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 58e6bc9..d407431 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -275,7 +275,7 @@ dump_flow_pattern(struct ds *s, const struct rte_flow_item *item) ds_put_cstr(s, "rte flow ipv4 pattern:\n"); if (ipv4_spec) { ds_put_format(s, - " Spec: tos=0x%"PRIx8", ttl=%"PRIx8 + " Spec: tos=0x%"PRIx8", ttl=0x%"PRIx8 ", proto=0x%"PRIx8 ", src="IP_FMT", dst="IP_FMT"\n", ipv4_spec->hdr.type_of_service, @@ -288,7 +288,7 @@ dump_flow_pattern(struct ds *s, const struct rte_flow_item *item) } if (ipv4_mask) { ds_put_format(s, - " Mask: tos=0x%"PRIx8", ttl=%"PRIx8 + " Mask: tos=0x%"PRIx8", ttl=0x%"PRIx8 ", proto=0x%"PRIx8 ", src="IP_FMT", dst="IP_FMT"\n", ipv4_mask->hdr.type_of_service, @@ -857,6 +857,14 @@ parse_vxlan_match(struct flow_patterns *patterns, put_unaligned_be32((ovs_be32 *)vx_mask->vni, htonl(ntohll(match->wc.masks.tunnel.tun_id) << 8)); + /* + memcpy(&vx_spec->flags, 0x08, sizeof vx_spec->flags); + memcpy(&vx_mask->flags, 0x0, sizeof vx_mask->flags); + */ + + vx_spec->flags=0x08; + vx_mask->flags=0x0; + add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VXLAN, vx_spec, vx_mask); return 0; } @@ -942,6 +950,7 @@ parse_flow_match(struct flow_patterns *patterns, } info->group_id = match->flow.recirc_id; + /* Eth */ if (match->flow.packet_type == htonl(PT_ETH)) { struct rte_flow_item_eth *spec, *mask; @@ -951,7 +960,12 @@ parse_flow_match(struct flow_patterns *patterns, memcpy(&spec->dst, &match->flow.dl_dst, sizeof spec->dst); memcpy(&spec->src, &match->flow.dl_src, sizeof spec->src); - spec->type = match->flow.dl_type; + + if (match->wc.masks.vlans[0].tci && match->flow.vlans[0].tci) { + spec->type = htons(ETH_TYPE_VLAN_8021Q); + } else { + spec->type = match->flow.dl_type; + } memcpy(&mask->dst, &match->wc.masks.dl_dst, sizeof mask->dst); memcpy(&mask->src, &match->wc.masks.dl_src, sizeof mask->src); @@ -980,7 +994,15 @@ parse_flow_match(struct flow_patterns *patterns, spec->tci = match->flow.vlans[0].tci & ~htons(VLAN_CFI); mask->tci = match->wc.masks.vlans[0].tci & ~htons(VLAN_CFI); - /* Match any protocols. */ + if (match->flow.dl_type == htons(ETH_TYPE_IP)) { + spec->inner_type = htons(ETH_TYPE_IP); + } else if (match->flow.dl_type == htons(ETH_TYPE_IPV6)) { + spec->inner_type = htons(ETH_TYPE_IPV6); + } else { + spec->inner_type = 0; + } + + /* Match ipv4 or ipv6 protocols. */ mask->inner_type = 0; add_flow_pattern(patterns, RTE_FLOW_ITEM_TYPE_VLAN, spec, mask); @@ -1830,12 +1852,16 @@ parse_clone_actions(struct netdev *netdev, } vlan_tci = xzalloc(sizeof *vlan_tci); vlan_tci->ethertype = vlan->vlan_tpid; + + /* add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, vlan_tci); - vid = xzalloc(sizeof *vid); vid->vlan_vid = vlan->vlan_tci & ~htons(VLAN_CFI); - add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID, vid); + */ + + vlan_tci->vlan_vid = vlan->vlan_tci & ~htons(VLAN_CFI); + add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, vlan_tci); } else if (clone_type == OVS_ACTION_ATTR_POP_VLAN) { add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_POP_VLAN, NULL); @@ -2116,12 +2142,16 @@ parse_flow_actions(struct dpif *dpif, vlan_tci = xzalloc(sizeof *vlan_tci); vlan_tci->ethertype = vlan->vlan_tpid; + + /* add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, vlan_tci); - vid = xzalloc(sizeof *vid); vid->vlan_vid = vlan->vlan_tci & ~htons(VLAN_CFI); - add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID, vid); + */ + + vlan_tci->vlan_vid = vlan->vlan_tci & ~htons(VLAN_CFI); + add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, vlan_tci); } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_POP_VLAN) { add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_POP_VLAN, NULL);