From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B6CDA0540; Mon, 13 Jul 2020 11:49:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B24281D5E2; Mon, 13 Jul 2020 11:47:43 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 977241D5AF for ; Mon, 13 Jul 2020 11:47:37 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 32DFF1BBA53; Mon, 13 Jul 2020 02:47:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 32DFF1BBA53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1594633658; bh=jm8p+sLFEJcddlNx25Aa4hwhdKIVw3jTiwCg2EjLepM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ba3Wv7tYYvdkdJpY/Jlp6wCRcX1h9J3uuEfb9REAyRySpm8Q3LTru6EPOXJvZJVuL DdYfR8rgR/K82ZZPFa70IsHX8bKNRUciLw2ii8Y2tUafrOO/lxT7dCu5a5ct2I6njp 42FPoVHO9cCpyedHXhxHOkA8NUhoMVHMkBY/sqvA= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Mon, 13 Jul 2020 15:12:13 +0530 Message-Id: <20200713094213.21410-11-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200713094213.21410-1-somnath.kotur@broadcom.com> References: <20200713061600.19456-1-somnath.kotur@broadcom.com> <20200713094213.21410-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 10/10] net/bnxt: add support for decrement TTL action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kishore Padmanabha Added support for decrement TTL action. Signed-off-by: Kishore Padmanabha Reviewed-by: Michael Baucom Signed-off-by: Somnath Kotur --- drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 30 +++++++++++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_rte_parser.h | 5 +++++ drivers/net/bnxt/tf_ulp/ulp_template_db_tbl.c | 4 ++-- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 68e59c4..4c1221a 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 e155250..7b6b57e 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 5847e58..9a27cbf 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, -- 2.7.4