From: Mike Baucom <michael.baucom@broadcom.com>
Modifications to allow internal encap records to be supported:
- Modified the mapper index table processing to handle encap without an
action record
- Modified the session open code to reserve some 64 Byte internal encap
records on tx
- Modified the blob encap swap to support encap without action record
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 3 +++
drivers/net/bnxt/tf_ulp/ulp_mapper.c | 29 +++++++++++++---------------
drivers/net/bnxt/tf_ulp/ulp_utils.c | 2 +-
3 files changed, 17 insertions(+), 17 deletions(-)
@@ -113,6 +113,9 @@ ulp_ctx_session_open(struct bnxt *bp,
resources->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_FULL_ACT_RECORD] = 16;
resources->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_STATS_64] = 16;
+ /* ENCAP */
+ resources->tbl_cnt[TF_DIR_TX].cnt[TF_TBL_TYPE_ACT_ENCAP_64B] = 16;
+
/* TCAMs */
resources->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_L2_CTXT_TCAM] = 8;
resources->tcam_cnt[TF_DIR_TX].cnt[TF_TCAM_TBL_TYPE_PROF_TCAM] = 8;
@@ -1473,7 +1473,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
flds = ulp_mapper_act_result_fields_get(tbl, &num_flds,
&encap_flds);
- if (!flds || !num_flds) {
+ if (!flds || (!num_flds && !encap_flds)) {
BNXT_TF_DBG(ERR, "template undefined for the index table\n");
return -EINVAL;
}
@@ -1482,7 +1482,7 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
for (i = 0; i < (num_flds + encap_flds); i++) {
/* set the swap index if encap swap bit is enabled */
if (parms->device_params->encap_byte_swap && encap_flds &&
- ((i + 1) == num_flds))
+ (i == num_flds))
ulp_blob_encap_swap_idx_set(&data);
/* Process the result fields */
@@ -1495,18 +1495,15 @@ ulp_mapper_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
BNXT_TF_DBG(ERR, "data field failed\n");
return rc;
}
+ }
- /* if encap bit swap is enabled perform the bit swap */
- if (parms->device_params->encap_byte_swap && encap_flds) {
- if ((i + 1) == (num_flds + encap_flds))
- ulp_blob_perform_encap_swap(&data);
+ /* if encap bit swap is enabled perform the bit swap */
+ if (parms->device_params->encap_byte_swap && encap_flds) {
+ ulp_blob_perform_encap_swap(&data);
#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG
- if ((i + 1) == (num_flds + encap_flds)) {
- BNXT_TF_DBG(INFO, "Dump fter encap swap\n");
- ulp_mapper_blob_dump(&data);
- }
+ BNXT_TF_DBG(INFO, "Dump after encap swap\n");
+ ulp_mapper_blob_dump(&data);
#endif
- }
}
/* Perform the tf table allocation by filling the alloc params */
@@ -1817,6 +1814,11 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)
switch (tbl->resource_func) {
case BNXT_ULP_RESOURCE_FUNC_INDEX_TABLE:
rc = ulp_mapper_index_tbl_process(parms, tbl, false);
+ if (rc) {
+ BNXT_TF_DBG(ERR, "Resource type %d failed\n",
+ tbl->resource_func);
+ return rc;
+ }
break;
default:
BNXT_TF_DBG(ERR, "Unexpected action resource %d\n",
@@ -1824,11 +1826,6 @@ ulp_mapper_action_tbls_process(struct bnxt_ulp_mapper_parms *parms)
return -EINVAL;
}
}
- if (rc) {
- BNXT_TF_DBG(ERR, "Resource type %d failed\n",
- tbl->resource_func);
- return rc;
- }
return rc;
}
@@ -478,7 +478,7 @@ ulp_blob_perform_encap_swap(struct ulp_blob *blob)
BNXT_TF_DBG(ERR, "invalid argument\n");
return; /* failure */
}
- idx = ULP_BITS_2_BYTE_NR(blob->encap_swap_idx + 1);
+ idx = ULP_BITS_2_BYTE_NR(blob->encap_swap_idx);
end_idx = ULP_BITS_2_BYTE(blob->write_idx);
while (idx <= end_idx) {