From patchwork Mon Aug 23 16:01:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salem Sol X-Patchwork-Id: 1519809 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 4GtcSb4tDSz9s1l for ; Tue, 24 Aug 2021 02:02:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 60DC44032F; Mon, 23 Aug 2021 16:02:04 +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 RM9xOON4rQxC; Mon, 23 Aug 2021 16:02:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id C7DC7402C9; Mon, 23 Aug 2021 16:01:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1EF72C0021; Mon, 23 Aug 2021 16:01:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id AFAACC000E for ; Mon, 23 Aug 2021 16:01:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9EECD403C9 for ; Mon, 23 Aug 2021 16:01:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XScgSFqiPtcp 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 smtp4.osuosl.org (Postfix) with ESMTP id 4724D403A1 for ; Mon, 23 Aug 2021 16:01:49 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from salems@nvidia.com) with SMTP; 23 Aug 2021 19:01:44 +0300 Received: from nvidia.com ([10.228.128.224]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 17NG1gmp028973; Mon, 23 Aug 2021 19:01:44 +0300 To: dev@openvswitch.org, Ilya Maximets , Ian Stokes Date: Mon, 23 Aug 2021 19:01:37 +0300 Message-Id: <20210823160140.12788-4-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 3/6] netdev-offload-dpdk: Introduce a dump_raw_encap 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 remote destinations. Co-authored-by: Salem Sol Signed-off-by: Noa Levy Signed-off-by: Salem Sol --- lib/netdev-offload-dpdk.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 9b32816d1..cd63d3ae1 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -454,6 +454,24 @@ dump_vxlan_encap(struct ds *s, const struct rte_flow_item *items) } } +static void +dump_raw_encap(struct ds *s, + struct ds *s_extra, + const struct rte_flow_action_raw_encap *raw_encap) +{ + int i; + + ds_put_cstr(s, "raw_encap index 0 / "); + if (raw_encap) { + ds_put_format(s_extra, "Raw-encap size=%ld set raw_encap 0 raw " + "pattern is ", raw_encap->size); + for (i = 0; i < raw_encap->size; i++) { + ds_put_format(s_extra, "%02x", raw_encap->data[i]); + } + ds_put_cstr(s_extra, " / end_set; "); + } +} + static void dump_port_id(struct ds *s, const void *conf) { @@ -593,15 +611,7 @@ dump_flow_action(struct ds *s, struct ds *s_extra, } else if (actions->type == RTE_FLOW_ACTION_TYPE_RAW_ENCAP) { const struct rte_flow_action_raw_encap *raw_encap = actions->conf; - ds_put_cstr(s, "raw_encap index 0 / "); - if (raw_encap) { - ds_put_format(s_extra, "Raw-encap size=%ld set raw_encap 0 raw " - "pattern is ", raw_encap->size); - for (int i = 0; i < raw_encap->size; i++) { - ds_put_format(s_extra, "%02x", raw_encap->data[i]); - } - ds_put_cstr(s_extra, " / end_set;"); - } + dump_raw_encap(s, s_extra, raw_encap); } else if (actions->type == RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP) { const struct rte_flow_action_vxlan_encap *vxlan_encap = actions->conf; const struct rte_flow_item *items = vxlan_encap->definition;