From: Kishore Padmanabha Date: Mon, 6 Jul 2020 08:24:59 +0000 (+0530) Subject: net/bnxt: support src and dst port actions X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ce023cf98c27b7c3fc4b9b519d4b60a33c57d020;p=dpdk.git net/bnxt: support src and dst port actions Added support for set transport port source and destination rewrite action items. This allows changing the tcp or udp source/destination ports for a given flow. Signed-off-by: Kishore Padmanabha Signed-off-by: Somnath Kotur Signed-off-by: Venkat Duvvuru 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 ac432b20f3..2f6a15d443 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -1736,3 +1736,47 @@ ulp_rte_set_ipv4_dst_act_handler(const struct rte_flow_action *action_item, BNXT_TF_DBG(ERR, "Parse Error: set ipv4 dst arg is invalid\n"); return BNXT_TF_RC_ERROR; } + +/* Function to handle the parsing of RTE Flow action set tp src.*/ +int32_t +ulp_rte_set_tp_src_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params) +{ + const struct rte_flow_action_set_tp *set_tp; + struct ulp_rte_act_prop *act = ¶ms->act_prop; + + set_tp = action_item->conf; + if (set_tp) { + memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_SET_TP_SRC], + &set_tp->port, BNXT_ULP_ACT_PROP_SZ_SET_TP_SRC); + /* Update the hdr_bitmap with set tp src */ + ULP_BITMAP_SET(params->act_bitmap.bits, + BNXT_ULP_ACTION_BIT_SET_TP_SRC); + return BNXT_TF_RC_SUCCESS; + } + + 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 set tp dst.*/ +int32_t +ulp_rte_set_tp_dst_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params) +{ + const struct rte_flow_action_set_tp *set_tp; + struct ulp_rte_act_prop *act = ¶ms->act_prop; + + set_tp = action_item->conf; + if (set_tp) { + memcpy(&act->act_details[BNXT_ULP_ACT_PROP_IDX_SET_TP_DST], + &set_tp->port, BNXT_ULP_ACT_PROP_SZ_SET_TP_DST); + /* Update the hdr_bitmap with set tp dst */ + ULP_BITMAP_SET(params->act_bitmap.bits, + BNXT_ULP_ACTION_BIT_SET_TP_DST); + return BNXT_TF_RC_SUCCESS; + } + + BNXT_TF_DBG(ERR, "Parse Error: set tp src arg is invalid\n"); + return BNXT_TF_RC_ERROR; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h index 6cb83b98db..e15525009c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h @@ -206,4 +206,14 @@ int32_t ulp_rte_set_ipv4_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 set tp src.*/ +int32_t +ulp_rte_set_tp_src_act_handler(const struct rte_flow_action *action_item, + struct ulp_rte_parser_params *params); + +/* Function to handle the parsing of RTE Flow action set tp dst.*/ +int32_t +ulp_rte_set_tp_dst_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_enum.h b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h index 436f54c4a0..6b68b95763 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_enum.h @@ -560,8 +560,8 @@ enum bnxt_ulp_act_prop_sz { BNXT_ULP_ACT_PROP_SZ_SET_IPV4_DST = 4, BNXT_ULP_ACT_PROP_SZ_SET_IPV6_SRC = 16, BNXT_ULP_ACT_PROP_SZ_SET_IPV6_DST = 16, - BNXT_ULP_ACT_PROP_SZ_SET_TP_SRC = 4, - BNXT_ULP_ACT_PROP_SZ_SET_TP_DST = 4, + BNXT_ULP_ACT_PROP_SZ_SET_TP_SRC = 2, + BNXT_ULP_ACT_PROP_SZ_SET_TP_DST = 2, BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_0 = 4, BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_1 = 4, BNXT_ULP_ACT_PROP_SZ_OF_PUSH_MPLS_2 = 4, @@ -605,23 +605,23 @@ enum bnxt_ulp_act_prop_idx { BNXT_ULP_ACT_PROP_IDX_SET_IPV6_SRC = 85, BNXT_ULP_ACT_PROP_IDX_SET_IPV6_DST = 101, BNXT_ULP_ACT_PROP_IDX_SET_TP_SRC = 117, - BNXT_ULP_ACT_PROP_IDX_SET_TP_DST = 121, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_0 = 125, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_1 = 129, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_2 = 133, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_3 = 137, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_4 = 141, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_5 = 145, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_6 = 149, - BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_7 = 153, - BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_DMAC = 157, - BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_SMAC = 163, - BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG = 169, - BNXT_ULP_ACT_PROP_IDX_ENCAP_IP = 177, - BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 209, - BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 225, - BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 229, - BNXT_ULP_ACT_PROP_IDX_LAST = 261 + BNXT_ULP_ACT_PROP_IDX_SET_TP_DST = 119, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_0 = 121, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_1 = 125, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_2 = 129, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_3 = 133, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_4 = 137, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_5 = 141, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_6 = 145, + BNXT_ULP_ACT_PROP_IDX_OF_PUSH_MPLS_7 = 149, + BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_DMAC = 153, + BNXT_ULP_ACT_PROP_IDX_ENCAP_L2_SMAC = 159, + BNXT_ULP_ACT_PROP_IDX_ENCAP_VTAG = 165, + BNXT_ULP_ACT_PROP_IDX_ENCAP_IP = 173, + BNXT_ULP_ACT_PROP_IDX_ENCAP_IP_SRC = 205, + BNXT_ULP_ACT_PROP_IDX_ENCAP_UDP = 221, + BNXT_ULP_ACT_PROP_IDX_ENCAP_TUN = 225, + BNXT_ULP_ACT_PROP_IDX_LAST = 257 }; enum bnxt_ulp_class_hid { 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 6fa74f8b3a..5847e58fdb 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c @@ -247,12 +247,12 @@ struct bnxt_ulp_rte_act_info ulp_act_info[] = { .proto_act_func = NULL }, [RTE_FLOW_ACTION_TYPE_SET_TP_SRC] = { - .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, - .proto_act_func = NULL + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_set_tp_src_act_handler }, [RTE_FLOW_ACTION_TYPE_SET_TP_DST] = { - .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED, - .proto_act_func = NULL + .act_type = BNXT_ULP_ACT_TYPE_SUPPORTED, + .proto_act_func = ulp_rte_set_tp_dst_act_handler }, [RTE_FLOW_ACTION_TYPE_MAC_SWAP] = { .act_type = BNXT_ULP_ACT_TYPE_NOT_SUPPORTED,