From: Mike Baucom Date: Thu, 2 Jul 2020 23:28:20 +0000 (-0700) Subject: net/bnxt: support internal encap records X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f0ca77fd60bf5c675b81be5c1eed14e80b8dfb55;p=dpdk.git net/bnxt: support internal encap records 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 Signed-off-by: Somnath Kotur Signed-off-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index a9ed5d92a8..4c1a1c44c8 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -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; diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 734db7c6ce..a9a625f9ff 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -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; } diff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.c b/drivers/net/bnxt/tf_ulp/ulp_utils.c index 3a4157f22a..3afaac647d 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_utils.c +++ b/drivers/net/bnxt/tf_ulp/ulp_utils.c @@ -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) {