From patchwork Tue Jul 7 11:54:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1324300 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.136; helo=silver.osuosl.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 silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B1LTH5R4Jz9sRN for ; Tue, 7 Jul 2020 21:54:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 66CFE2942E; Tue, 7 Jul 2020 11:54:41 +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 MEXenLSIe2Sj; Tue, 7 Jul 2020 11:54:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 3CF992916A; Tue, 7 Jul 2020 11:54:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CEE5EC08A5; Tue, 7 Jul 2020 11:54:20 +0000 (UTC) X-Original-To: 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 016F7C016F for ; Tue, 7 Jul 2020 11:54:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E49A628EFB for ; Tue, 7 Jul 2020 11:54: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 ahhgvD8sS1O9 for ; Tue, 7 Jul 2020 11:54:16 +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 silver.osuosl.org (Postfix) with ESMTP id A72DC28960 for ; Tue, 7 Jul 2020 11:54:15 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from elibr@mellanox.com) with SMTP; 7 Jul 2020 14:54:09 +0300 Received: from dev-r-vrt-215.mtr.labs.mlnx. (dev-r-vrt-215.mtr.labs.mlnx [10.212.215.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 067Bs8ku006179; Tue, 7 Jul 2020 14:54:09 +0300 From: Eli Britstein To: dev@openvswitch.org, Ilya Maximets Date: Tue, 7 Jul 2020 11:54:01 +0000 Message-Id: <20200707115405.6756-9-elibr@mellanox.com> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20200707115405.6756-1-elibr@mellanox.com> References: <20200707115405.6756-1-elibr@mellanox.com> Cc: Eli Britstein , Ameer Mahagneh Subject: [ovs-dev] [PATCH V5 08/12] netdev-offload-dpdk: Support offload of set IPv6 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add support for set IPv6 actions. Signed-off-by: Eli Britstein Reviewed-by: Roni Bar Yanai Acked-by: Sriharsha Basavapatna --- Documentation/howto/dpdk.rst | 1 + NEWS | 2 ++ lib/netdev-offload-dpdk.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst index ebde9aeb9..fb9bd2d10 100644 --- a/Documentation/howto/dpdk.rst +++ b/Documentation/howto/dpdk.rst @@ -396,6 +396,7 @@ Supported actions for hardware offload are: - Modification of IPv4 (mod_nw_src/mod_nw_dst/mod_nw_ttl). - Modification of TCP/UDP (mod_tp_src/mod_tp_dst). - VLAN Push/Pop (push_vlan/pop_vlan). +- Modification of IPv6 (set_field:->ipv6_src/ipv6_dst/mod_nw_ttl). Further Reading --------------- diff --git a/NEWS b/NEWS index 056e9a67e..c9ad3fd1d 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ Post-v2.13.0 * Deprecated DPDK ring ports (dpdkr) are no longer supported. * Add hardware offload support for VLAN Push/Pop actions (experimental). * Add hardware offload support for matching IPv6 protocol (experimental). + * Add hardware offload support for set of IPv6 TCP/UDP ports + actions (experimental). - Linux datapath: * Support for kernel versions up to 5.5.x. - AF_XDP: diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index df5634ab2..3b4832fb8 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -437,6 +437,20 @@ dump_flow_action(struct ds *s, const struct rte_flow_action *actions) ds_put_cstr(s, "/ "); } else if (actions->type == RTE_FLOW_ACTION_TYPE_OF_POP_VLAN) { ds_put_cstr(s, "of_pop_vlan / "); + } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC || + actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) { + const struct rte_flow_action_set_ipv6 *set_ipv6 = actions->conf; + + char *dirstr = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_DST + ? "dst" : "src"; + + ds_put_format(s, "set_ipv6_%s ", dirstr); + if (set_ipv6) { + ds_put_cstr(s, "ipv6_addr "); + ipv6_format_addr((struct in6_addr *) &set_ipv6->ipv6_addr, s); + ds_put_cstr(s, " "); + } + ds_put_cstr(s, "/ "); } else { ds_put_format(s, "unknown rte flow action (%d)\n", actions->type); } @@ -985,6 +999,12 @@ 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) == MEMBER_SIZEOF(struct ovs_key_ipv4, ipv4_ttl)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_src)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ipv6) == + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_dst)); +BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_ttl) == + MEMBER_SIZEOF(struct ovs_key_ipv6, ipv6_hlimit)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_tp) == MEMBER_SIZEOF(struct ovs_key_tcp, tcp_src)); BUILD_ASSERT_DECL(sizeof(struct rte_flow_action_set_tp) == @@ -1034,6 +1054,18 @@ parse_set_actions(struct flow_actions *actions, VLOG_DBG_RL(&rl, "Unsupported IPv4 set action"); return -1; } + } else if (nl_attr_type(sa) == OVS_KEY_ATTR_IPV6) { + const struct ovs_key_ipv6 *key = nl_attr_get(sa); + const struct ovs_key_ipv6 *mask = masked ? key + 1 : NULL; + + add_set_flow_action(ipv6_src, RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC); + add_set_flow_action(ipv6_dst, RTE_FLOW_ACTION_TYPE_SET_IPV6_DST); + add_set_flow_action(ipv6_hlimit, RTE_FLOW_ACTION_TYPE_SET_TTL); + + if (mask && !is_all_zeros(mask, sizeof *mask)) { + VLOG_DBG_RL(&rl, "Unsupported IPv6 set action"); + return -1; + } } else if (nl_attr_type(sa) == OVS_KEY_ATTR_TCP) { const struct ovs_key_tcp *key = nl_attr_get(sa); const struct ovs_key_tcp *mask = masked ? key + 1 : NULL;