From patchwork Mon Dec 28 09:24:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: taoyunxiang X-Patchwork-Id: 1420955 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=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D4QbL3bXyz9sVv for ; Tue, 29 Dec 2020 05:11:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B508B86D19; Mon, 28 Dec 2020 18:11:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uoVN4weDAotF; Mon, 28 Dec 2020 18:11:07 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 963C586D43; Mon, 28 Dec 2020 18:10:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6F97FC1DA4; Mon, 28 Dec 2020 18:10:40 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id A73C4C0891 for ; Mon, 28 Dec 2020 09:26:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9548286C8C for ; Mon, 28 Dec 2020 09:26:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JaqO6AqTRo2I for ; Mon, 28 Dec 2020 09:26:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by whitealder.osuosl.org (Postfix) with ESMTP id B344986C4C for ; Mon, 28 Dec 2020 09:25:59 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app02-12002 (RichMail) with SMTP id 2ee25fe9a491d54-bebdd; Mon, 28 Dec 2020 17:25:39 +0800 (CST) X-RM-TRANSID: 2ee25fe9a491d54-bebdd 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-7b86c; Mon, 28 Dec 2020 17:25:38 +0800 (CST) X-RM-TRANSID: 2ee25fe9a48a90b-7b86c From: Tao YunXiang To: ovs-dev@openvswitch.org Date: Mon, 28 Dec 2020 01:24:33 -0800 Message-Id: <20201228092520.11807-16-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> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 28 Dec 2020 18:10:33 +0000 Cc: Liuchang Subject: [ovs-dev] [PATCH 15/62] netdev-offload-dpdk: add vlan push action offloading mechanism 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: Liuchang Code Source From: Self Code Description: add vlan push action offloading machenism Jira: #[Optional] 市场项目编号(名称):[Optional] --- lib/netdev-offload-dpdk.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 8f8a85b..cc5cbe0 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -419,6 +419,15 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) while (items && items->type != RTE_FLOW_ITEM_TYPE_END) { dump_flow_pattern(s, items++); } + } else if (actions->type == RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN) { + const struct rte_flow_action_of_push_vlan *vlan_tci = actions->conf; + + if (vlan_tci) { + ds_put_format(s, "rte flow vlan-push action:\n"); + ds_put_format(s, "vlan-encap: tci=%"PRIu16"\n",ntohs(vlan_tci->ethertype)); + } else { + ds_put_format(s, "vlan-encap: null\n"); + } } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC || actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_DST) { const struct rte_flow_action_set_mac *set_mac = actions->conf; @@ -1202,9 +1211,14 @@ parse_clone_actions(struct netdev *netdev, if (add_output_action(netdev, actions, ca,info)) { return -1; } - /* work around: tmp bypass vlan push action*/ } else if (clone_type == OVS_ACTION_ATTR_PUSH_VLAN) { - continue; + const struct ovs_action_push_vlan *vlan = nl_attr_get(ca); + struct rte_flow_action_of_push_vlan *vlan_tci; + + vlan_tci = xzalloc(sizeof *vlan_tci); + vlan_tci->ethertype = vlan->vlan_tci & ~htons(VLAN_CFI); + add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, + vlan_tci); } else { VLOG_DBG_RL(&rl, "Unsupported nested action inside clone(), " @@ -1255,6 +1269,14 @@ parse_flow_actions(struct netdev *netdev, return -1; } + } else if (nl_attr_type(nla) == OVS_ACTION_ATTR_PUSH_VLAN) { + const struct ovs_action_push_vlan *vlan = nl_attr_get(nla); + struct rte_flow_action_of_push_vlan *vlan_tci; + + vlan_tci = xzalloc(sizeof *vlan_tci); + vlan_tci->ethertype = vlan->vlan_tci & ~htons(VLAN_CFI); + add_flow_action(actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, + vlan_tci); } else { VLOG_DBG_RL(&rl, "Unsupported action type %d", nl_attr_type(nla)); return -1;