From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 36E81A0521;
	Thu, 23 Jul 2020 14:02:38 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E9BDC1C002;
	Thu, 23 Jul 2020 14:02:10 +0200 (CEST)
Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com
 [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id 1CFAC1BFBA
 for <dev@dpdk.org>; Thu, 23 Jul 2020 14:02:03 +0200 (CEST)
Received: from dhcp-10-123-153-55.dhcp.broadcom.net
 (bgccx-dev-host-lnx35.bec.broadcom.net [10.123.153.55])
 by relay.smtp.broadcom.com (Postfix) with ESMTP id 4E43729ADB8;
 Thu, 23 Jul 2020 05:02:02 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 4E43729ADB8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;
 s=dkimrelay; t=1595505722;
 bh=g0Mh9NSS9U9Gn4oUKTO+ZAUxG63Uk49lPpfPYqjNLEw=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=D7vTjw0en7TYpwm/TMAXRj/YDqwbwXokMyXmSILyTCYO929awshBWeT9WXFhcK9p9
 /lIBmdGeDo9j12uA+jeJEXL/Q+It7a6WDAcwBuHDn0AvvKQ5gSk8eSc+rLqsbUWsUS
 1rkCSBpmOu/V5fgVbdoVljQ9PSsR6Mt4zg7P5Euw=
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Date: Thu, 23 Jul 2020 17:26:22 +0530
Message-Id: <20200723115639.22357-4-somnath.kotur@broadcom.com>
X-Mailer: git-send-email 2.10.1.613.g2cc2e70
In-Reply-To: <20200723115639.22357-1-somnath.kotur@broadcom.com>
References: <20200723111329.21855-1-somnath.kotur@broadcom.com>
 <20200723115639.22357-1-somnath.kotur@broadcom.com>
Subject: [dpdk-dev] [PATCH v2 03/20] net/bnxt: parif for offload miss rules
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

For the offload miss rules, the parif miss path needs to be
considered. The higher parif are reserved for handling this.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Michael Baucom <michael.baucom@broadcom.com>
---
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c  |  4 ++--
 drivers/net/bnxt/tf_ulp/ulp_port_db.h    |  1 +
 drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 40 ++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
index 4d4f7c4..d86e4c9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
@@ -12,8 +12,6 @@
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
 
-#define BNXT_ULP_FREE_PARIF_BASE 11
-
 struct bnxt_ulp_def_param_handler {
 	int32_t (*vfr_func)(struct bnxt_ulp_context *ulp_ctx,
 			    struct ulp_tlv_param *param,
@@ -85,6 +83,8 @@ ulp_set_parif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,
 
 	if (parif_type == BNXT_ULP_PHY_PORT_PARIF) {
 		idx = BNXT_ULP_CF_IDX_PHY_PORT_PARIF;
+		/* Parif needs to be reset to a free partition */
+		parif += BNXT_ULP_FREE_PARIF_BASE;
 	} else if (parif_type == BNXT_ULP_DRV_FUNC_PARIF) {
 		idx = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF;
 		/* Parif needs to be reset to a free partition */
diff --git a/drivers/net/bnxt/tf_ulp/ulp_port_db.h b/drivers/net/bnxt/tf_ulp/ulp_port_db.h
index 393d01b..2b323d1 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_port_db.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_port_db.h
@@ -10,6 +10,7 @@
 
 #define BNXT_PORT_DB_MAX_INTF_LIST		256
 #define BNXT_PORT_DB_MAX_FUNC			2048
+#define BNXT_ULP_FREE_PARIF_BASE		11
 
 enum bnxt_ulp_svif_type {
 	BNXT_ULP_DRV_FUNC_SVIF = 0,
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index 3891bcd..39f801b 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -159,6 +159,43 @@ bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[],
 }
 
 /*
+ * Function to handle the post processing of the computed
+ * fields for the interface.
+ */
+static void
+bnxt_ulp_comp_fld_intf_update(struct ulp_rte_parser_params *params)
+{
+	uint32_t ifindex;
+	uint16_t port_id, parif;
+	enum bnxt_ulp_direction_type dir;
+
+	/* get the direction details */
+	dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION);
+
+	if (dir == BNXT_ULP_DIR_INGRESS) {
+		/* read the port id details */
+		port_id = ULP_COMP_FLD_IDX_RD(params,
+					      BNXT_ULP_CF_IDX_INCOMING_IF);
+		if (ulp_port_db_dev_port_to_ulp_index(params->ulp_ctx,
+						      port_id,
+						      &ifindex)) {
+			BNXT_TF_DBG(ERR, "ParseErr:Portid is not valid\n");
+			return;
+		}
+		/* Set port PARIF */
+		if (ulp_port_db_parif_get(params->ulp_ctx, ifindex,
+					  BNXT_ULP_PHY_PORT_PARIF, &parif)) {
+			BNXT_TF_DBG(ERR, "ParseErr:ifindex is not valid\n");
+			return;
+		}
+		/* Parif needs to be reset to a free partition */
+		parif += BNXT_ULP_FREE_PARIF_BASE;
+		ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_PHY_PORT_PARIF,
+				    parif);
+	}
+}
+
+/*
  * Function to handle the post processing of the parsing details
  */
 int32_t
@@ -213,6 +250,9 @@ bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params)
 	/* Merge the hdr_fp_bit into the proto header bit */
 	params->hdr_bitmap.bits |= params->hdr_fp_bit.bits;
 
+	/* Update the computed interface parameters */
+	bnxt_ulp_comp_fld_intf_update(params);
+
 	/* TBD: Handle the flow rejection scenarios */
 	return 0;
 }
-- 
2.7.4