From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CDD73A0A0A for ; Wed, 24 Mar 2021 12:36:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1E78140D60; Wed, 24 Mar 2021 12:36:09 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id EA3984014F; Wed, 24 Mar 2021 12:36:06 +0100 (CET) IronPort-SDR: f3ufSV1YvnNbawcoRCeZl5GfX4QfJkTsY3eQ4C58qkH08XhdoG48XoatltgwA8zzCbCXnMzkp6 HYGd9Rz2HCFg== X-IronPort-AV: E=McAfee;i="6000,8403,9932"; a="177800583" X-IronPort-AV: E=Sophos;i="5.81,274,1610438400"; d="scan'208";a="177800583" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 04:36:05 -0700 IronPort-SDR: 6wSbZdMOBedUA2hYja4l6gDG8X5QIvuwccajA7xHWU34MQrr+YCS30WzsAG9Vgr6DLEq0nskH/ zkYlLF7nllIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,274,1610438400"; d="scan'208";a="391266792" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by orsmga002.jf.intel.com with ESMTP; 24 Mar 2021 04:36:04 -0700 From: Cristian Dumitrescu To: dev@dpdk.org, thomas@monjalon.net Cc: stable@dpdk.org Date: Wed, 24 Mar 2021 11:36:03 +0000 Message-Id: <20210324113603.56624-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210319143625.78445-1-cristian.dumitrescu@intel.com> References: <20210319143625.78445-1-cristian.dumitrescu@intel.com> Subject: [dpdk-stable] [PATCH v2] pipeline: fix instruction translation for table and mailbox fields X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The SWX pipeline instructions work with operands of different types: header fields (h.header.field), packet meta-data (m.field), extern object mailbox field (e.obj.field), extern function (f.field), action data read from table entries (t.field), or immediate values; hence the HMEFTI acronym. For some pipeline instructions (add/sub, srl/shr, jmplt/jmpgt), only the H, M and I cases were handled, while the E, F and T cases were disregarded. This is what we fix here. Fixes: baf7999303d0 ("pipeline: introduce SWX add instruction") Fixes: c88c62943818 ("pipeline: introduce SWX subtract instruction") Fixes: b09ba6d0a3c2 ("pipeline: introduce SWX SHL instruction") Fixes: e0f51638b715 ("pipeline: introduce SWX SHR instruction") Fixes: b3947e25bed4 ("pipeline: introduce SWX jump and return instructions") Cc: stable@dpdk.org Signed-off-by: Cristian Dumitrescu --- lib/librte_pipeline/rte_swx_pipeline.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c index 5257a5360..4455d9135 100644 --- a/lib/librte_pipeline/rte_swx_pipeline.c +++ b/lib/librte_pipeline/rte_swx_pipeline.c @@ -3697,9 +3697,9 @@ instr_alu_add_translate(struct rte_swx_pipeline *p, fsrc = struct_field_parse(p, action, src, &src_struct_id); if (fsrc) { instr->type = INSTR_ALU_ADD; - if (dst[0] == 'h' && src[0] == 'm') + if (dst[0] == 'h' && src[0] != 'h') instr->type = INSTR_ALU_ADD_HM; - if (dst[0] == 'm' && src[0] == 'h') + if (dst[0] != 'h' && src[0] == 'h') instr->type = INSTR_ALU_ADD_MH; if (dst[0] == 'h' && src[0] == 'h') instr->type = INSTR_ALU_ADD_HH; @@ -3750,9 +3750,9 @@ instr_alu_sub_translate(struct rte_swx_pipeline *p, fsrc = struct_field_parse(p, action, src, &src_struct_id); if (fsrc) { instr->type = INSTR_ALU_SUB; - if (dst[0] == 'h' && src[0] == 'm') + if (dst[0] == 'h' && src[0] != 'h') instr->type = INSTR_ALU_SUB_HM; - if (dst[0] == 'm' && src[0] == 'h') + if (dst[0] != 'h' && src[0] == 'h') instr->type = INSTR_ALU_SUB_MH; if (dst[0] == 'h' && src[0] == 'h') instr->type = INSTR_ALU_SUB_HH; @@ -3880,9 +3880,9 @@ instr_alu_shl_translate(struct rte_swx_pipeline *p, fsrc = struct_field_parse(p, action, src, &src_struct_id); if (fsrc) { instr->type = INSTR_ALU_SHL; - if (dst[0] == 'h' && src[0] == 'm') + if (dst[0] == 'h' && src[0] != 'h') instr->type = INSTR_ALU_SHL_HM; - if (dst[0] == 'm' && src[0] == 'h') + if (dst[0] != 'h' && src[0] == 'h') instr->type = INSTR_ALU_SHL_MH; if (dst[0] == 'h' && src[0] == 'h') instr->type = INSTR_ALU_SHL_HH; @@ -3933,9 +3933,9 @@ instr_alu_shr_translate(struct rte_swx_pipeline *p, fsrc = struct_field_parse(p, action, src, &src_struct_id); if (fsrc) { instr->type = INSTR_ALU_SHR; - if (dst[0] == 'h' && src[0] == 'm') + if (dst[0] == 'h' && src[0] != 'h') instr->type = INSTR_ALU_SHR_HM; - if (dst[0] == 'm' && src[0] == 'h') + if (dst[0] != 'h' && src[0] == 'h') instr->type = INSTR_ALU_SHR_MH; if (dst[0] == 'h' && src[0] == 'h') instr->type = INSTR_ALU_SHR_HH; @@ -6853,9 +6853,9 @@ instr_jmp_lt_translate(struct rte_swx_pipeline *p, fb = struct_field_parse(p, action, b, &b_struct_id); if (fb) { instr->type = INSTR_JMP_LT; - if (a[0] == 'h' && b[0] == 'm') + if (a[0] == 'h' && b[0] != 'h') instr->type = INSTR_JMP_LT_HM; - if (a[0] == 'm' && b[0] == 'h') + if (a[0] != 'h' && b[0] == 'h') instr->type = INSTR_JMP_LT_MH; if (a[0] == 'h' && b[0] == 'h') instr->type = INSTR_JMP_LT_HH; @@ -6910,9 +6910,9 @@ instr_jmp_gt_translate(struct rte_swx_pipeline *p, fb = struct_field_parse(p, action, b, &b_struct_id); if (fb) { instr->type = INSTR_JMP_GT; - if (a[0] == 'h' && b[0] == 'm') + if (a[0] == 'h' && b[0] != 'h') instr->type = INSTR_JMP_GT_HM; - if (a[0] == 'm' && b[0] == 'h') + if (a[0] != 'h' && b[0] == 'h') instr->type = INSTR_JMP_GT_MH; if (a[0] == 'h' && b[0] == 'h') instr->type = INSTR_JMP_GT_HH; -- 2.17.1