From patchwork Tue Jul 27 17:43:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 96336 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 314B5A0C55; Tue, 27 Jul 2021 19:43:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20684410FD; Tue, 27 Jul 2021 19:43:51 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 26D29410F0 for ; Tue, 27 Jul 2021 19:43:48 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10058"; a="199677779" X-IronPort-AV: E=Sophos;i="5.84,274,1620716400"; d="scan'208";a="199677779" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2021 10:43:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,274,1620716400"; d="scan'208";a="517040381" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga002.fm.intel.com with ESMTP; 27 Jul 2021 10:43:40 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 27 Jul 2021 18:43:36 +0100 Message-Id: <20210727174340.2125-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210727163609.97769-1-cristian.dumitrescu@intel.com> References: <20210727163609.97769-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH V2 1/5] pipeline: prepare for variable size headers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The emit instruction that is responsible for pushing headers into the output packet is now reading the header length from internal run-time structures as opposed to constant value from the instruction opcode. Signed-off-by: Cristian Dumitrescu --- lib/pipeline/rte_swx_pipeline.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c index 84505e2a45..2f5cfacd85 100644 --- a/lib/pipeline/rte_swx_pipeline.c +++ b/lib/pipeline/rte_swx_pipeline.c @@ -251,6 +251,7 @@ TAILQ_HEAD(header_tailq, header); struct header_runtime { uint8_t *ptr0; + uint32_t n_bytes; }; struct header_out_runtime { @@ -2522,11 +2523,14 @@ header_build(struct rte_swx_pipeline *p) TAILQ_FOREACH(h, &p->headers, node) { uint8_t *header_storage; + uint32_t n_bytes = h->st->n_bits / 8; header_storage = &t->header_storage[offset]; - offset += h->st->n_bits / 8; + offset += n_bytes; t->headers[h->id].ptr0 = header_storage; + t->headers[h->id].n_bytes = n_bytes; + t->structs[h->struct_id] = header_storage; } } @@ -3262,9 +3266,11 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit) for (i = 0; i < n_emit; i++) { uint32_t header_id = ip->io.hdr.header_id[i]; uint32_t struct_id = ip->io.hdr.struct_id[i]; - uint32_t n_bytes = ip->io.hdr.n_bytes[i]; struct header_runtime *hi = &t->headers[header_id]; + uint8_t *hi_ptr0 = hi->ptr0; + uint32_t n_bytes = hi->n_bytes; + uint8_t *hi_ptr = t->structs[struct_id]; if (!MASK64_BIT_GET(valid_headers, header_id)) @@ -3281,7 +3287,7 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit) if (!t->n_headers_out) { ho = &t->headers_out[0]; - ho->ptr0 = hi->ptr0; + ho->ptr0 = hi_ptr0; ho->ptr = hi_ptr; ho_ptr = hi_ptr; @@ -3302,7 +3308,7 @@ __instr_hdr_emit_exec(struct rte_swx_pipeline *p, uint32_t n_emit) ho->n_bytes = ho_nbytes; ho++; - ho->ptr0 = hi->ptr0; + ho->ptr0 = hi_ptr0; ho->ptr = hi_ptr; ho_ptr = hi_ptr;