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 CA0BDA0540; Mon, 13 Jul 2020 08:35:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EB59B1D529; Mon, 13 Jul 2020 08:33:52 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id 4E8FD1D167 for ; Mon, 13 Jul 2020 08:33:40 +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 D7E4F29C6A1; Sun, 12 Jul 2020 23:33:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com D7E4F29C6A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1594622020; bh=AsdGGDxX06LlUbxkreVTaJn3rDfzw7pqZopC4n15mm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CAl0NbmHA0L0QECLxbg7nYGxAt4Z28RjCTW6BCTkP0jqYsBDtz0ZMRF8lxIQzvuY+ HAlpzenh7dZddCYlcmAUAVzWCaZgwMlJli+ezMkkpBqbktzAGw78rHp7uuLJgxjh8B IXdqeglgnDXwFzv/Hct/6Do9tfarMkWI6euswP3s= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Mon, 13 Jul 2020 11:58:28 +0530 Message-Id: <20200713062828.19626-11-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200713062828.19626-1-somnath.kotur@broadcom.com> References: <20200713062828.19626-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