From patchwork Mon May 30 14:15:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Malov X-Patchwork-Id: 1636934 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=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LBd013SHgz9s07 for ; Tue, 31 May 2022 00:22:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 21790611BE; Mon, 30 May 2022 14:22:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KBRKeZUl6h97; Mon, 30 May 2022 14:22:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 30F1B611A0; Mon, 30 May 2022 14:22:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0B83EC0083; Mon, 30 May 2022 14:22:03 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7E0F7C0032 for ; Mon, 30 May 2022 14:22:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 66D0583F28 for ; Mon, 30 May 2022 14:22:00 +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 9REYELnhKPDc for ; Mon, 30 May 2022 14:21:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2787083EE1 for ; Mon, 30 May 2022 14:21:58 +0000 (UTC) Received: from bree.oktetlabs.ru (bree.oktetlabs.ru [192.168.34.5]) (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 shelob.oktetlabs.ru (Postfix) with ESMTPS id 46BE488; Mon, 30 May 2022 17:15:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 46BE488 Authentication-Results: shelob.oktetlabs.ru/46BE488; dkim=none; dkim-atps=neutral From: Ivan Malov To: dev@openvswitch.org Date: Mon, 30 May 2022 17:15:49 +0300 Message-Id: <20220530141550.368926-3-ivan.malov@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220530141550.368926-1-ivan.malov@oktetlabs.ru> References: <20220530141550.368926-1-ivan.malov@oktetlabs.ru> MIME-Version: 1.0 Cc: Eli Britstein , Stephen Hemminger , Ilya Maximets , Ori Kam , Maxime Coquelin , David Marchand Subject: [ovs-dev] [PATCH 2/3] netdev-offload-dpdk: replace action PORT_ID with REPRESENTED_PORT 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" Action PORT_ID has been deprecated. Use REPRESENTED_PORT instead. Signed-off-by: Ivan Malov Acked-by: Andrew Rybchenko --- lib/netdev-offload-dpdk.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 12d299603..9cd5a0159 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -733,6 +733,14 @@ dump_flow_action(struct ds *s, struct ds *s_extra, ds_put_cstr(s, "rss / "); } else if (actions->type == RTE_FLOW_ACTION_TYPE_COUNT) { ds_put_cstr(s, "count / "); +#ifdef ALLOW_EXPERIMENTAL_API + } else if (actions->type == RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT) { + const struct rte_flow_action_ethdev *ethdev = actions->conf; + + ds_put_cstr(s, "represented_port "); + if (ethdev) { + ds_put_format(s, "ethdev_port_id %d ", ethdev->port_id); +#else /* ! ALLOW_EXPERIMENTAL_API */ } else if (actions->type == RTE_FLOW_ACTION_TYPE_PORT_ID) { const struct rte_flow_action_port_id *port_id = actions->conf; @@ -740,6 +748,7 @@ dump_flow_action(struct ds *s, struct ds *s_extra, if (port_id) { ds_put_format(s, "original %d id %d ", port_id->original, port_id->id); +#endif /* ALLOW_EXPERIMENTAL_API */ } ds_put_cstr(s, "/ "); } else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) { @@ -1767,6 +1776,24 @@ add_count_action(struct flow_actions *actions) add_flow_action(actions, RTE_FLOW_ACTION_TYPE_COUNT, count); } +#ifdef ALLOW_EXPERIMENTAL_API +static int +add_represented_port_action(struct flow_actions *actions, + struct netdev *outdev) +{ + struct rte_flow_action_ethdev *ethdev; + int outdev_id; + + outdev_id = netdev_dpdk_get_port_id(outdev); + if (outdev_id < 0) { + return -1; + } + ethdev = xzalloc(sizeof *ethdev); + ethdev->port_id = outdev_id; + add_flow_action(actions, RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT, ethdev); + return 0; +} +#else /* ! ALLOW_EXPERIMENTAL_API */ static int add_port_id_action(struct flow_actions *actions, struct netdev *outdev) @@ -1783,6 +1810,7 @@ add_port_id_action(struct flow_actions *actions, add_flow_action(actions, RTE_FLOW_ACTION_TYPE_PORT_ID, port_id); return 0; } +#endif /* ALLOW_EXPERIMENTAL_API */ static int add_output_action(struct netdev *netdev, @@ -1800,7 +1828,11 @@ add_output_action(struct netdev *netdev, return -1; } if (!netdev_flow_api_equals(netdev, outdev) || +#ifdef ALLOW_EXPERIMENTAL_API + add_represented_port_action(actions, outdev)) { +#else /* ! ALLOW_EXPERIMENTAL_API */ add_port_id_action(actions, outdev)) { +#endif /* ALLOW_EXPERIMENTAL_API */ VLOG_DBG_RL(&rl, "%s: Output to port \'%s\' cannot be offloaded.", netdev_get_name(netdev), netdev_get_name(outdev)); ret = -1;