diff mbox series

[05/20] net/bnxt: add support for index opcode constant

Message ID 20200706082502.26935-6-somnath.kotur@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series bnxt patches | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Somnath Kotur July 6, 2020, 8:24 a.m. UTC
From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Add support for index opcode constant so that
parif configuration could be constant value.

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_def_rules.c        | 11 ++++++++---
 drivers/net/bnxt/tf_ulp/ulp_mapper.c           |  7 +++++--
 drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h |  4 +++-
 3 files changed, 16 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
index 46b558f..b01ad0b 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
@@ -12,6 +12,8 @@ 
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
 
+#define BNXT_ULP_FREE_PARIF_BASE 11
+
 struct bnxt_ulp_def_param_handler {
 	int32_t (*vfr_func)(struct bnxt_ulp_context *ulp_ctx,
 			    struct ulp_tlv_param *param,
@@ -81,12 +83,15 @@  ulp_set_parif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,
 	if (rc)
 		return rc;
 
-	if (parif_type == BNXT_ULP_PHY_PORT_PARIF)
+	if (parif_type == BNXT_ULP_PHY_PORT_PARIF) {
 		idx = BNXT_ULP_CF_IDX_PHY_PORT_PARIF;
-	else if (parif_type == BNXT_ULP_DRV_FUNC_PARIF)
+	} else if (parif_type == BNXT_ULP_DRV_FUNC_PARIF) {
 		idx = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF;
-	else
+		/* Parif needs to be reset to a free partition */
+		parif += BNXT_ULP_FREE_PARIF_BASE;
+	} else {
 		idx = BNXT_ULP_CF_IDX_VF_FUNC_PARIF;
+	}
 
 	ULP_COMP_FLD_IDX_WR(mapper_params, idx, parif);
 
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index eb77328..b0d31a8 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -1922,11 +1922,14 @@  ulp_mapper_if_tbl_process(struct bnxt_ulp_mapper_parms *parms,
 	}
 
 	/* Get the index details from computed field */
-	if (tbl->index_opcode != BNXT_ULP_INDEX_OPCODE_COMP_FIELD) {
+	if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_COMP_FIELD) {
+		idx = ULP_COMP_FLD_IDX_RD(parms, tbl->index_operand);
+	} else if (tbl->index_opcode == BNXT_ULP_INDEX_OPCODE_CONSTANT) {
+		idx = tbl->index_operand;
+	} else {
 		BNXT_TF_DBG(ERR, "Invalid tbl index opcode\n");
 		return -EINVAL;
 	}
-	idx = ULP_COMP_FLD_IDX_RD(parms, tbl->index_operand);
 
 	/* Perform the tf table set by filling the set params */
 	iftbl_params.dir = tbl->direction;
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 6d6a734..892d8ea 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h
@@ -188,7 +188,8 @@  enum bnxt_ulp_index_opcode {
 	BNXT_ULP_INDEX_OPCODE_ALLOCATE = 1,
 	BNXT_ULP_INDEX_OPCODE_GLOBAL = 2,
 	BNXT_ULP_INDEX_OPCODE_COMP_FIELD = 3,
-	BNXT_ULP_INDEX_OPCODE_LAST = 4
+	BNXT_ULP_INDEX_OPCODE_CONSTANT = 4,
+	BNXT_ULP_INDEX_OPCODE_LAST = 5
 };
 
 enum bnxt_ulp_mapper_opc {
@@ -511,6 +512,7 @@  enum bnxt_ulp_sym {
 	BNXT_ULP_SYM_IP_PROTO_IP_IN_IP = 4,
 	BNXT_ULP_SYM_IP_PROTO_TCP = 6,
 	BNXT_ULP_SYM_IP_PROTO_UDP = 17,
+	BNXT_ULP_SYM_VF_FUNC_PARIF = 15,
 	BNXT_ULP_SYM_NO = 0,
 	BNXT_ULP_SYM_YES = 1
 };