From: Kishore Padmanabha Date: Wed, 15 Jul 2020 13:50:38 +0000 (+0530) Subject: net/bnxt: support decrement TTL action X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6af7e459bacc146e6c4a92d51714f340decfb38e;p=dpdk.git net/bnxt: support decrement TTL action Added support for decrement TTL action. Signed-off-by: Kishore Padmanabha Signed-off-by: Somnath Kotur Reviewed-by: Mike Baucom Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 68e59c4c8d..4c1221aed1 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -189,6 +189,26 @@ bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params) match_port_type == BNXT_ULP_INTF_TYPE_VF_REP) ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_VF_TO_VF, 1); + /* Update the decrement ttl computational fields */ + if (ULP_BITMAP_ISSET(params->act_bitmap.bits, + BNXT_ULP_ACTION_BIT_DEC_TTL)) { + /* + * Check that vxlan proto is included and vxlan decap + * action is not set then decrement tunnel ttl. + * Similarly add GRE and NVGRE in future. + */ + if ((ULP_BITMAP_ISSET(params->hdr_bitmap.bits, + BNXT_ULP_HDR_BIT_T_VXLAN) && + !ULP_BITMAP_ISSET(params->act_bitmap.bits, + BNXT_ULP_ACTION_BIT_VXLAN_DECAP))) { + ULP_COMP_FLD_IDX_WR(params, + BNXT_ULP_CF_IDX_ACT_T_DEC_TTL, 1); + } else { + ULP_COMP_FLD_IDX_WR(params, + BNXT_ULP_CF_IDX_ACT_DEC_TTL, 1); + } + } + /* TBD: Handle the flow rejection scenarios */ return 0; } @@ -1814,3 +1834,13 @@ ulp_rte_set_tp_dst_act_handler(const struct rte_flow_action *action_item, BNXT_TF_DBG(ERR, "Parse Error: set tp src arg is invalid\n"); return BNXT_TF_RC_ERROR; } + +/* Function to handle the parsing of RTE Flow action dec ttl.*/ +int32_t +ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *act __rte_unused, + struct ulp_rte_parser_params *params) +{ + /* Update the act_bitmap with dec ttl */ + ULP_BITMAP_SET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_DEC_TTL); + return BNXT_TF_RC_SUCCESS; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index e15525009c..7b6b57e0e3 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -216,4 +216,9 @@ int32_t ulp_rte_set_tp_dst_act_handler(const struct rte_flow_action *action_item, struct ulp_rte_parser_params *params); +/* Function to handle the parsing of RTE Flow action dec ttl.*/ +int32_t +ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params); + #endif /* _ULP_RTE_PARSER_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c index 5847e58fdb..9a27cbf041 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c @@ -259,8 +259,8 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = { .proto_act_func = NULL }, [RTE_FLOW_ACTION_TYPE_DEC_TTL] = { - .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, - .proto_act_func = NULL + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_dec_ttl_act_handler }, [RTE_FLOW_ACTION_TYPE_SET_TTL] = { .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,