[dpdk-dev] [PATCH 14/36] net/bnxt: add support for action bitmap opcode in result field processing

Somnath Kotur somnath.kotur at broadcom.com
Wed Jun 10 13:44:05 CEST 2020


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

This enables using the action bitmap to update the action result
fields in the flow creation instead of using computed header fields.
An example would be the usage of the vlan pop action bitmap that is
used to updated action result field as part of this commit.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha at broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom at broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur at broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c      | 20 ++++++++++++++++++++
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 14 +++++++++++---
 drivers/net/bnxt/tf_ulp/ulp_template_db.h | 11 ++++++-----
 3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 40c515d..a0b77c0 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -611,6 +611,8 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 	uint8_t	 *val = NULL;
 	uint64_t regval;
 	uint32_t val_size = 0, field_size = 0;
+	uint64_t act_bit;
+	uint8_t act_val;
 
 	switch (fld->result_opcode) {
 	case BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT:
@@ -644,6 +646,24 @@ ulp_mapper_result_field_process(struct bnxt_ulp_mapper_parms *parms,
 			return -EINVAL;
 		}
 		break;
+	case BNXT_ULP_RESULT_OPC_SET_TO_ACT_BIT:
+		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);
+		act_val = ULP_BITMAP_ISSET(parms->act_bitmap->bits, act_bit);
+		if (fld->field_bit_size > ULP_BYTE_2_BITS(sizeof(act_val))) {
+			BNXT_TF_DBG(ERR, "%s field size is incorrect\n", name);
+			return -EINVAL;
+		}
+		if (!ulp_blob_push(blob, &act_val, fld->field_bit_size)) {
+			BNXT_TF_DBG(ERR, "%s push field failed\n", name);
+			return -EINVAL;
+		}
+		val = &act_val;
+		break;
 	case BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ:
 		if (!ulp_operand_read(fld->result_operand,
 				      (uint8_t *)&idx, sizeof(uint16_t))) {
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
index 013bc13..cb5e325 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
@@ -1774,9 +1774,17 @@ struct bnxt_ulp_mapper_result_field_info ulp_act_result_field_list[] = {
 	},
 	{
 	.field_bit_size = 1,
-	.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT,
-	.result_operand = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+	.result_opcode = BNXT_ULP_RESULT_OPC_SET_TO_ACT_BIT,
+	.result_operand = {
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 56) & 0xff,
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 48) & 0xff,
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 40) & 0xff,
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 32) & 0xff,
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 24) & 0xff,
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 16) & 0xff,
+		((uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN >> 8) & 0xff,
+		(uint64_t)BNXT_ULP_ACTION_BIT_POP_VLAN & 0xff,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
 	},
 	{
 	.field_bit_size = 2,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.h b/drivers/net/bnxt/tf_ulp/ulp_template_db.h
index 8554a03..6935072 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.h
@@ -211,11 +211,12 @@ enum bnxt_ulp_regfile_index {
 enum bnxt_ulp_result_opc {
 	BNXT_ULP_RESULT_OPC_SET_TO_CONSTANT = 0,
 	BNXT_ULP_RESULT_OPC_SET_TO_ACT_PROP = 1,
-	BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ = 2,
-	BNXT_ULP_RESULT_OPC_SET_TO_REGFILE = 3,
-	BNXT_ULP_RESULT_OPC_SET_TO_GLB_REGFILE = 4,
-	BNXT_ULP_RESULT_OPC_SET_TO_COMP_FIELD = 5,
-	BNXT_ULP_RESULT_OPC_LAST = 6
+	BNXT_ULP_RESULT_OPC_SET_TO_ACT_BIT = 2,
+	BNXT_ULP_RESULT_OPC_SET_TO_ENCAP_ACT_PROP_SZ = 3,
+	BNXT_ULP_RESULT_OPC_SET_TO_REGFILE = 4,
+	BNXT_ULP_RESULT_OPC_SET_TO_GLB_REGFILE = 5,
+	BNXT_ULP_RESULT_OPC_SET_TO_COMP_FIELD = 6,
+	BNXT_ULP_RESULT_OPC_LAST = 7
 };
 
 enum bnxt_ulp_search_before_alloc {
-- 
2.7.4



More information about the dev mailing list