From patchwork Mon Aug 23 16:01:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salem Sol X-Patchwork-Id: 1519811 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=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (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 ozlabs.org (Postfix) with ESMTPS id 4GtcSg2cGcz9s1l for ; Tue, 24 Aug 2021 02:02:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D3127402D1; Mon, 23 Aug 2021 16:02:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L3sG0Ds2zg6c; Mon, 23 Aug 2021 16:02:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id F1FEE402E5; Mon, 23 Aug 2021 16:01:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C76C5C0028; Mon, 23 Aug 2021 16:01:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 26EB6C000E for ; Mon, 23 Aug 2021 16:01:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 08B3160597 for ; Mon, 23 Aug 2021 16:01:56 +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 Zq9OYykFf9q0 for ; Mon, 23 Aug 2021 16:01:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp3.osuosl.org (Postfix) with ESMTP id 5410C60600 for ; Mon, 23 Aug 2021 16:01:48 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from salems@nvidia.com) with SMTP; 23 Aug 2021 19:01:43 +0300 Received: from nvidia.com ([10.228.128.224]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 17NG1gmo028973; Mon, 23 Aug 2021 19:01:43 +0300 To: dev@openvswitch.org, Ilya Maximets , Ian Stokes Date: Mon, 23 Aug 2021 19:01:36 +0300 Message-Id: <20210823160140.12788-3-salems@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210823160140.12788-1-salems@nvidia.com> References: <20210823160140.12788-1-salems@nvidia.com> MIME-Version: 1.0 Cc: Eli Britstein , Noa Levy Subject: [ovs-dev] [PATCH v2 2/6] netdev-offload-dpdk: Introduce a dump_port_id helper function 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: , X-Patchwork-Original-From: Salem Sol via dev From: Salem Sol Reply-To: Salem Sol Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Noa Levy Introduce a helper function as a pre-step towards supporting offload multiple desinations. Signed-off-by: Noa Levy --- lib/netdev-offload-dpdk.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index ed59d6fcd..9b32816d1 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -454,6 +454,20 @@ dump_vxlan_encap(struct ds *s, const struct rte_flow_item *items) } } +static void +dump_port_id(struct ds *s, const void *conf) +{ + const struct rte_flow_action_port_id *port_id = conf; + + ds_put_cstr(s, "port_id "); + if (port_id) { + ds_put_format(s, "original %d id %d ", port_id->original, + port_id->id); + } + ds_put_cstr(s, "/ "); +} + + static void dump_flow_action(struct ds *s, struct ds *s_extra, struct flow_actions *flow_actions, int act_index) @@ -481,14 +495,7 @@ dump_flow_action(struct ds *s, struct ds *s_extra, } else if (actions->type == RTE_FLOW_ACTION_TYPE_COUNT) { ds_put_cstr(s, "count / "); } else if (actions->type == RTE_FLOW_ACTION_TYPE_PORT_ID) { - const struct rte_flow_action_port_id *port_id = actions->conf; - - ds_put_cstr(s, "port_id "); - if (port_id) { - ds_put_format(s, "original %d id %d ", - port_id->original, port_id->id); - } - ds_put_cstr(s, "/ "); + dump_port_id(s, actions->conf); } else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) { ds_put_cstr(s, "drop / "); } else if (actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ||