DPDK patches and discussions
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 15/20] net/bnxt: add support for conditional opcodes for mapper result table
Date: Mon,  6 Jul 2020 13:54:57 +0530	[thread overview]
Message-ID: <20200706082502.26935-16-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20200706082502.26935-1-somnath.kotur@broadcom.com>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Added support for conditional mapper result opcodes. The conditional
opcodes allows to set the action details in hardware based on the
actions configured for the flow. This allows aggregation of multiple
templates.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c           | 69 ++++++++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h |  4 +-
 drivers/net/bnxt/tf_ulp/ulp_template_struct.h  |  2 +
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index dd99ea3..44fd0ac 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -841,7 +841,73 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 
 		break;
+	case BNXT_ULP_MAPPER_OPC_IF_ACT_BIT_THEN_ACT_PROP_ELSE_CONST:
+		if (!ulp_operand_read(fld->result_operand,
+				      (uint8_t *)&act_bit, sizeof(uint64_t))) {
+			BNXT_TF_DBG(ERR, "%s operand read failed\n", name);
+			return -EINVAL;
+		}
+		act_bit = tfp_be_to_cpu_64(act_bit);
+		if (ULP_BITMAP_ISSET(parms->act_bitmap->bits, act_bit)) {
+			/* Action bit is set so consider operand_true */
+			if (!ulp_operand_read(fld->result_operand_true,
+					      (uint8_t *)&idx,
+					      sizeof(uint16_t))) {
+				BNXT_TF_DBG(ERR, "%s operand read failed\n",
+					    name);
+				return -EINVAL;
+			}
+			idx = tfp_be_to_cpu_16(idx);
+			if (idx >= BNXT_ULP_ACT_PROP_IDX_LAST) {
+				BNXT_TF_DBG(ERR, "%s act_prop[%d] oob\n",
+					    name, idx);
+				return -EINVAL;
+			}
+			val = &parms->act_prop->act_details[idx];
+			field_size = ulp_mapper_act_prop_size_get(idx);
+			if (fld->field_bit_size < ULP_BYTE_2_BITS(field_size)) {
+				field_size  = field_size -
+				    ((fld->field_bit_size + 7) / 8);
+				val += field_size;
+			}
+			if (!ulp_blob_push(blob, val, fld->field_bit_size)) {
+				BNXT_TF_DBG(ERR, "%s push field failed\n",
+					    name);
+				return -EINVAL;
+			}
+		} else {
+			/* action bit is not set, use the operand false */
+			val = fld->result_operand_false;
+			if (!ulp_blob_push(blob, val, fld->field_bit_size)) {
+				BNXT_TF_DBG(ERR, "%s failed to add field\n",
+					    name);
+				return -EINVAL;
+			}
+		}
+		break;
+	case BNXT_ULP_MAPPER_OPC_IF_ACT_BIT_THEN_CONST_ELSE_CONST:
+		if (!ulp_operand_read(fld->result_operand,
+				      (uint8_t *)&act_bit, sizeof(uint64_t))) {
+			BNXT_TF_DBG(ERR, "%s operand read failed\n", name);
+			return -EINVAL;
+		}
+		act_bit = tfp_be_to_cpu_64(act_bit);
+		if (ULP_BITMAP_ISSET(parms->act_bitmap->bits, act_bit)) {
+			/* Action bit is set so consider operand_true */
+			val = fld->result_operand_true;
+		} else {
+			/* action bit is not set, use the operand false */
+			val = fld->result_operand_false;
+		}
+		if (!ulp_blob_push(blob, val, fld->field_bit_size)) {
+			BNXT_TF_DBG(ERR, "%s failed to add field\n",
+				    name);
+			return -EINVAL;
+		}
+		break;
 	default:
+		BNXT_TF_DBG(ERR, "invalid result mapper opcode 0x%x\n",
+			    fld->result_opcode);
 		return -EINVAL;
 	}
 	return 0;
@@ -973,6 +1039,9 @@ ulp_mapper_keymask_field_process(struct bnxt_ulp_mapper_parms *parms,
 		}
 		break;
 	default:
+		BNXT_TF_DBG(ERR, "invalid keymask mapper opcode 0x%x\n",
+			    opcode);
+		return -EINVAL;
 		break;
 	}
 
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
index 14c77b3..2d73ea3 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
@@ -212,7 +212,9 @@ enum bnxt_ulp_mapper_opc {
 	BNXT_ULP_MAPPER_OPC_SET_TO_ACT_BIT = 6,
 	BNXT_ULP_MAPPER_OPC_SET_TO_ACT_PROP = 7,
 	BNXT_ULP_MAPPER_OPC_SET_TO_ENCAP_ACT_PROP_SZ = 8,
-	BNXT_ULP_MAPPER_OPC_LAST = 9
+	BNXT_ULP_MAPPER_OPC_IF_ACT_BIT_THEN_ACT_PROP_ELSE_CONST = 9,
+	BNXT_ULP_MAPPER_OPC_IF_ACT_BIT_THEN_CONST_ELSE_CONST = 10,
+	BNXT_ULP_MAPPER_OPC_LAST = 11
 };
 
 enum bnxt_ulp_mark_db_opcode {
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
index ea4f253..2f2f9a2 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_struct.h
@@ -213,6 +213,8 @@ struct bnxt_ulp_mapper_result_field_info {
 	enum bnxt_ulp_mapper_opc	result_opcode;
 	uint16_t			field_bit_size;
 	uint8_t				result_operand[16];
+	uint8_t				result_operand_true[16];
+	uint8_t				result_operand_false[16];
 };
 
 struct bnxt_ulp_mapper_ident_info {
-- 
2.7.4


  parent reply	other threads:[~2020-07-06  8:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  8:24 [dpdk-dev] [PATCH 00/20] bnxt patches Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 01/20] net/bnxt: vxlan encap and decap with src property enabled Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 02/20] net/bnxt: add support vlan header bitmap Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 03/20] net/bnxt: add support for negative conditional opcodes Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 04/20] net/bnxt: add validations to dpdk port id and phy port parsing Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 05/20] net/bnxt: add support for index opcode constant Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 06/20] net/bnxt: updated hsi_struct_def_dpdk.h Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 07/20] nxt/bnxt: added HWRM support for global cfg Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 08/20] net/bnxt: cleanup and refactoring Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 09/20] net/bnxt: add support for vlan push and vlan pop actions Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 10/20] net/bnxt: remove vnic and vport act bits from template matching Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 11/20] net/bnxt: fix vxlan outer ip protocol id encapsulation Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 12/20] net/bnxt: add number of vlan tags in the computed field list Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 13/20] net/bnxt: enable support for PF and VF port action items Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 14/20] net/bnxt: port configuration changes to support full offload Somnath Kotur
2020-07-06  8:24 ` Somnath Kotur [this message]
2020-07-06  8:24 ` [dpdk-dev] [PATCH 16/20] net/bnxt: add support for nat rte action items Somnath Kotur
2020-07-06  8:24 ` [dpdk-dev] [PATCH 17/20] net/bnxt: add support for tp src/dst " Somnath Kotur
2020-07-06  8:25 ` [dpdk-dev] [PATCH 18/20] net/bnxt: use VF vnic when port action is for a VF rep port Somnath Kotur
2020-07-06  8:25 ` [dpdk-dev] [PATCH 19/20] net/bnxt: enable flow ctrl ops for the VF-rep device Somnath Kotur
2020-07-06  8:25 ` [dpdk-dev] [PATCH 20/20] net/bnxt: use byte/pkt count shift/masks from the device template Somnath Kotur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200706082502.26935-16-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).