From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 4B13BA0C45;
	Mon, 13 Sep 2021 18:45:07 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id EA6CC410F7;
	Mon, 13 Sep 2021 18:44:52 +0200 (CEST)
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by mails.dpdk.org (Postfix) with ESMTP id 2E05B4014F
 for <dev@dpdk.org>; Mon, 13 Sep 2021 18:44:48 +0200 (CEST)
X-IronPort-AV: E=McAfee;i="6200,9189,10106"; a="201239098"
X-IronPort-AV: E=Sophos;i="5.85,290,1624345200"; d="scan'208";a="201239098"
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 13 Sep 2021 09:44:47 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.85,290,1624345200"; d="scan'208";a="507429080"
Received: from silpixa00400573.ir.intel.com (HELO
 silpixa00400573.ger.corp.intel.com) ([10.237.223.107])
 by fmsmga008.fm.intel.com with ESMTP; 13 Sep 2021 09:44:46 -0700
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Date: Mon, 13 Sep 2021 17:44:22 +0100
Message-Id: <20210913164443.16875-3-cristian.dumitrescu@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20210913164443.16875-1-cristian.dumitrescu@intel.com>
References: <20210910133713.93103-1-cristian.dumitrescu@intel.com>
 <20210913164443.16875-1-cristian.dumitrescu@intel.com>
Subject: [dpdk-dev] [PATCH V3 03/24] pipeline: create inline functions for
 RX instruction
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Create inline functions for the RX instruction.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c          | 38 ------------------
 lib/pipeline/rte_swx_pipeline_internal.h | 51 ++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 38 deletions(-)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index 7e01453c27..ad1ecfc640 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -1517,44 +1517,6 @@ instr_rx_translate(struct rte_swx_pipeline *p,
 	return 0;
 }
 
-static inline void
-instr_rx_exec(struct rte_swx_pipeline *p);
-
-static inline void
-instr_rx_exec(struct rte_swx_pipeline *p)
-{
-	struct thread *t = &p->threads[p->thread_id];
-	struct instruction *ip = t->ip;
-	struct port_in_runtime *port = &p->in[p->port_id];
-	struct rte_swx_pkt *pkt = &t->pkt;
-	int pkt_received;
-
-	/* Packet. */
-	pkt_received = port->pkt_rx(port->obj, pkt);
-	t->ptr = &pkt->pkt[pkt->offset];
-	rte_prefetch0(t->ptr);
-
-	TRACE("[Thread %2u] rx %s from port %u\n",
-	      p->thread_id,
-	      pkt_received ? "1 pkt" : "0 pkts",
-	      p->port_id);
-
-	/* Headers. */
-	t->valid_headers = 0;
-	t->n_headers_out = 0;
-
-	/* Meta-data. */
-	METADATA_WRITE(t, ip->io.io.offset, ip->io.io.n_bits, p->port_id);
-
-	/* Tables. */
-	t->table_state = p->table_state;
-
-	/* Thread. */
-	pipeline_port_inc(p);
-	thread_ip_inc_cond(t, pkt_received);
-	thread_yield(p);
-}
-
 /*
  * tx.
  */
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index 682f4c86a0..9814b5685a 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -1439,4 +1439,55 @@ thread_yield_cond(struct rte_swx_pipeline *p, int cond)
 	p->thread_id = (p->thread_id + cond) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);
 }
 
+/*
+ * rx.
+ */
+static inline int
+__instr_rx_exec(struct rte_swx_pipeline *p, struct thread *t, const struct instruction *ip)
+{
+	struct port_in_runtime *port = &p->in[p->port_id];
+	struct rte_swx_pkt *pkt = &t->pkt;
+	int pkt_received;
+
+	/* Packet. */
+	pkt_received = port->pkt_rx(port->obj, pkt);
+	t->ptr = &pkt->pkt[pkt->offset];
+	rte_prefetch0(t->ptr);
+
+	TRACE("[Thread %2u] rx %s from port %u\n",
+	      p->thread_id,
+	      pkt_received ? "1 pkt" : "0 pkts",
+	      p->port_id);
+
+	/* Headers. */
+	t->valid_headers = 0;
+	t->n_headers_out = 0;
+
+	/* Meta-data. */
+	METADATA_WRITE(t, ip->io.io.offset, ip->io.io.n_bits, p->port_id);
+
+	/* Tables. */
+	t->table_state = p->table_state;
+
+	/* Thread. */
+	pipeline_port_inc(p);
+
+	return pkt_received;
+}
+
+static inline void
+instr_rx_exec(struct rte_swx_pipeline *p)
+{
+	struct thread *t = &p->threads[p->thread_id];
+	struct instruction *ip = t->ip;
+	int pkt_received;
+
+	/* Packet. */
+	pkt_received = __instr_rx_exec(p, t, ip);
+
+	/* Thread. */
+	thread_ip_inc_cond(t, pkt_received);
+	thread_yield(p);
+}
+
 #endif
-- 
2.17.1