From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 05726A0C47; Tue, 26 Oct 2021 07:08:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD65C411D8; Tue, 26 Oct 2021 07:07:01 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id DC271410DB for ; Tue, 26 Oct 2021 07:06:35 +0200 (CEST) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 71A627DC2; Mon, 25 Oct 2021 22:06:34 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 71A627DC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1635224795; bh=qL18R9gny23olt4gOESRxhfqug8PsHJ0mx44GhGPYGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nKgvYOfhEhzT1KAC+4ynKrUBl+w5mX/j+Im50V2iCS1mWJa0QS4f2bpQhZ4qUwGDn L5Cwib/ahUCwNgYeDygpcSJ0o1FmfF+XPHRI09VtRiC8pylHVlCAiV0DzXkZ+g6ti4 zDJh7Mxh+uNbgzjEPot1EooG9qUOh6P5hQzqHI1I= From: Venkat Duvvuru To: dev@dpdk.org Cc: Kishore Padmanabha Date: Tue, 26 Oct 2021 10:35:47 +0530 Message-Id: <20211026050547.14692-20-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211026050547.14692-1-venkatkumar.duvvuru@broadcom.com> References: <20211001055909.27276-1-venkatkumar.duvvuru@broadcom.com> <20211026050547.14692-1-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH v2 19/19] net/bnxt: check for mismatch of control and physical port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 During the parsing of the ingress port ignore for a flow, added check to match the control port and the physical port that is configured to be ignored. If they do not match then the configuration to setup the svif ignore shall fail. Signed-off-by: Kishore Padmanabha Reviewed-by: Michael Baucom Reviewed-by: Shahaji Bhosle --- drivers/net/bnxt/tf_ulp/ulp_port_db.c | 23 +++++++++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_port_db.h | 13 +++++++++++++ drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 12 ++++++++++++ 3 files changed, 48 insertions(+) diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.c b/drivers/net/bnxt/tf_ulp/ulp_port_db.c index 5e7c1d1c17..f8ffb567b5 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_port_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.c @@ -679,3 +679,26 @@ ulp_port_db_parent_vnic_get(struct bnxt_ulp_context *ulp_ctxt, } return -EINVAL; } + +/* + * Api to get the phy port for a given port id. + * + * ulp_ctxt [in] Ptr to ulp context + * port_id [in] device port id + * phy_port [out] phy_port of the dpdk port_id + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_phy_port_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t port_id, uint16_t *phy_port) +{ + struct ulp_func_if_info *info; + + info = ulp_port_db_func_if_info_get(ulp_ctxt, port_id); + if (info) { + *phy_port = info->phy_port_id; + return 0; + } + return -EINVAL; +} diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.h b/drivers/net/bnxt/tf_ulp/ulp_port_db.h index 740c186e12..b112f1a216 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_port_db.h +++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.h @@ -314,4 +314,17 @@ int32_t ulp_port_db_parent_vnic_get(struct bnxt_ulp_context *ulp_ctxt, uint32_t port_id, uint8_t **vnic); +/* + * Api to get the phy port for a given port id. + * + * ulp_ctxt [in] Ptr to ulp context + * port_id [in] device port id + * phy_port [out] phy_port of the dpdk port_id + * + * Returns 0 on success or negative number on failure. + */ +int32_t +ulp_port_db_phy_port_get(struct bnxt_ulp_context *ulp_ctxt, + uint32_t port_id, uint16_t *phy_port); + #endif /* _ULP_PORT_DB_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 2ec3279239..f4274dd634 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -686,6 +686,18 @@ ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item, ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_SVIF_FLAG, rte_be_to_cpu_16(svif)); if (!mask) { + uint32_t port_id = 0; + uint16_t phy_port = 0; + + /* Validate the control port */ + port_id = ULP_COMP_FLD_IDX_RD(params, + BNXT_ULP_CF_IDX_DEV_PORT_ID); + if (ulp_port_db_phy_port_get(params->ulp_ctx, + port_id, &phy_port) || + (uint16_t)port_spec->index != phy_port) { + BNXT_TF_DBG(ERR, "Mismatch of control and phy_port\n"); + return BNXT_TF_RC_PARSE_ERR; + } ULP_BITMAP_SET(params->hdr_bitmap.bits, BNXT_ULP_HDR_BIT_SVIF_IGNORE); memset(hdr_field->mask, 0xFF, sizeof(mask)); -- 2.17.1