From patchwork Mon Dec 28 09:25:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: taoyunxiang X-Patchwork-Id: 1421011 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 4D4Qg55HqWz9sVv for ; Tue, 29 Dec 2020 05:14:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 41BDA86D29; Mon, 28 Dec 2020 18:14:24 +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 eM9R733UeW0R; Mon, 28 Dec 2020 18:14:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 507A586DE0; Mon, 28 Dec 2020 18:11:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0FA88C1E7F; Mon, 28 Dec 2020 18:11:31 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id A7908C0891 for ; Mon, 28 Dec 2020 09:26:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A139B2046B for ; Mon, 28 Dec 2020 09:26:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pTv25AMkmKOs for ; Mon, 28 Dec 2020 09:26:17 +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 silver.osuosl.org (Postfix) with ESMTP id 22F0220464 for ; Mon, 28 Dec 2020 09:26:16 +0000 (UTC) Received: from spf.mail.chinamobile.com (unknown[172.16.121.3]) by rmmx-syy-dmz-app07-12007 (RichMail) with SMTP id 2ee75fe9a4abb56-c33ae; Mon, 28 Dec 2020 17:26:03 +0800 (CST) X-RM-TRANSID: 2ee75fe9a4abb56-c33ae 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-7b918; Mon, 28 Dec 2020 17:26:03 +0800 (CST) X-RM-TRANSID: 2ee25fe9a48a90b-7b918 From: Tao YunXiang To: ovs-dev@openvswitch.org Date: Mon, 28 Dec 2020 01:25:16 -0800 Message-Id: <20201228092520.11807-59-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:34 +0000 Cc: Taoyunxiang Subject: [ovs-dev] [PATCH 58/62] netdev-offload-dpdk: Add offload mod_tos actions 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: Taoyunxiang Code Source From: Self Code Description: netdev-offload-dpdk: Add offload mod_tos actions Jira: #[Optional] 市场项目编号(名称):[Optional] --- lib/netdev-offload-dpdk.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index bef2349..3ee4f33 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -647,6 +647,15 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) } else { ds_put_cstr(s, " Set-ttl = null\n"); } + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IP_TOS) { + const struct rte_flow_action_set_iptos *set_tos = actions->conf; + + ds_put_cstr(s, "rte flow set-tos action:\n"); + if (set_tos) { + ds_put_format(s, " Set-tos: 0x%02x\n", set_tos->ip_tos); + } else { + ds_put_cstr(s, " Set-tos = null\n"); + } } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC || actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_DST) { const struct rte_flow_action_set_tp *set_tp = actions->conf; @@ -1354,7 +1363,8 @@ add_set_flow_action__(struct flow_actions *actions, if (is_all_zeros(mask, size)) { return 0; } - if (!is_all_ones(mask, size)) { + if (!is_all_ones(mask, size) && + (attr != RTE_FLOW_ACTION_TYPE_SET_IP_TOS )) { VLOG_DBG_RL(&rl, "Partial mask is not supported"); return -1; } @@ -1377,6 +1387,8 @@ BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_mac) == MEMBER_SIZEOF(struct ovs_key_ethernet, eth_dst)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) == MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_src)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_iptos) == + MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_tos)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv4) == MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_dst)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == @@ -1425,6 +1437,7 @@ parse_set_actions(struct flow_actions *actions, add_set_flow_action(ipv4_src, RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC); add_set_flow_action(ipv4_dst, RTE_FLOW_ACTION_TYPE_SET_IPV4_DST); add_set_flow_action(ipv4_ttl, RTE_FLOW_ACTION_TYPE_SET_TTL); + add_set_flow_action(ipv4_tos, RTE_FLOW_ACTION_TYPE_SET_IP_TOS); if (mask && !is_all_zeros(mask, sizeof *mask)) { VLOG_DBG_RL(&rl, "Unsupported IPv4 set action");