DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/cxgbe: always enable HASH filter support
@ 2020-06-12 22:10 Rahul Lakkireddy
  2020-06-17 18:13 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Rahul Lakkireddy @ 2020-06-12 22:10 UTC (permalink / raw)
  To: dev; +Cc: nirranjan, kaara.satwik

From: Karra Satwik <kaara.satwik@chelsio.com>

Disable all unused firmware resources during init time to give
more resources for HASH (exact-match) filter region and always
request firmware to enable HASH filter support when resources
are available.

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/base/t4_regs.h        | 12 ++++++++++
 drivers/net/cxgbe/base/t4fw_interface.h |  3 ++-
 drivers/net/cxgbe/cxgbe_filter.c        | 32 ++++++++++++++-----------
 drivers/net/cxgbe/cxgbe_main.c          | 14 +++++++----
 4 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/drivers/net/cxgbe/base/t4_regs.h b/drivers/net/cxgbe/base/t4_regs.h
index bd9c8ad7c..e551f1b1a 100644
--- a/drivers/net/cxgbe/base/t4_regs.h
+++ b/drivers/net/cxgbe/base/t4_regs.h
@@ -969,6 +969,18 @@
 #define V_HASHEN(x) ((x) << S_HASHEN)
 #define F_HASHEN    V_HASHEN(1U)
 
+#define A_LE_DB_RSP_CODE_0 0x19c74
+
+#define S_TCAM_ACTV_HIT    0
+#define M_TCAM_ACTV_HIT    0x1fU
+#define G_TCAM_ACTV_HIT(x) (((x) >> S_TCAM_ACTV_HIT) & M_TCAM_ACTV_HIT)
+
+#define A_LE_DB_RSP_CODE_1 0x19c78
+
+#define S_HASH_ACTV_HIT    25
+#define M_HASH_ACTV_HIT    0x1fU
+#define G_HASH_ACTV_HIT(x) (((x) >> S_HASH_ACTV_HIT) & M_HASH_ACTV_HIT)
+
 #define A_LE_DB_TID_HASHBASE 0x19df8
 
 #define LE_3_DB_HASH_MASK_GEN_IPV4_T6_A 0x19eac
diff --git a/drivers/net/cxgbe/base/t4fw_interface.h b/drivers/net/cxgbe/base/t4fw_interface.h
index 0032178d0..109273a39 100644
--- a/drivers/net/cxgbe/base/t4fw_interface.h
+++ b/drivers/net/cxgbe/base/t4fw_interface.h
@@ -627,7 +627,7 @@ struct fw_caps_config_cmd {
 	__be16 niccaps;
 	__be16 toecaps;
 	__be16 rdmacaps;
-	__be16 r4;
+	__be16 cryptocaps;
 	__be16 iscsicaps;
 	__be16 fcoecaps;
 	__be32 cfcsum;
@@ -700,6 +700,7 @@ enum fw_params_param_dev {
 	FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17,
 	FW_PARAMS_PARAM_DEV_FILTER2_WR	= 0x1D,
 	FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27,
+	FW_PARAMS_PARAM_DEV_HASHFILTER_WITH_OFLD = 0x28,
 	FW_PARAMS_PARAM_DEV_FILTER      = 0x2E,
 };
 
diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
index 6066da7db..384dde3f9 100644
--- a/drivers/net/cxgbe/cxgbe_filter.c
+++ b/drivers/net/cxgbe/cxgbe_filter.c
@@ -12,33 +12,37 @@
 #include "clip_tbl.h"
 #include "l2t.h"
 #include "smt.h"
+#include "cxgbe_pfvf.h"
 
 /**
  * Initialize Hash Filters
  */
 int cxgbe_init_hash_filter(struct adapter *adap)
 {
-	unsigned int n_user_filters;
-	unsigned int user_filter_perc;
+	unsigned int user_filter_perc, n_user_filters;
+	u32 param, val;
 	int ret;
-	u32 params[7], val[7];
 
-#define FW_PARAM_DEV(param) \
-	(V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | \
-	V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_##param))
+	if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) {
+		val = t4_read_reg(adap, A_LE_DB_RSP_CODE_0);
+		if (G_TCAM_ACTV_HIT(val) != 4) {
+			adap->params.hash_filter = 0;
+			return 0;
+		}
 
-#define FW_PARAM_PFVF(param) \
-	(V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) | \
-	V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_##param) |  \
-	V_FW_PARAMS_PARAM_Y(0) | \
-	V_FW_PARAMS_PARAM_Z(0))
+		val = t4_read_reg(adap, A_LE_DB_RSP_CODE_1);
+		if (G_HASH_ACTV_HIT(val) != 4) {
+			adap->params.hash_filter = 0;
+			return 0;
+		}
+	}
 
-	params[0] = FW_PARAM_DEV(NTID);
+	param = CXGBE_FW_PARAM_DEV(NTID);
 	ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1,
-			      params, val);
+			      &param, &val);
 	if (ret < 0)
 		return ret;
-	adap->tids.ntids = val[0];
+	adap->tids.ntids = val;
 	adap->tids.natids = min(adap->tids.ntids / 2, MAX_ATIDS);
 
 	user_filter_perc = 100;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index a541d95cc..2656369c5 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -1126,13 +1126,12 @@ static int adap_init0_tweaks(struct adapter *adapter)
  */
 static int adap_init0_config(struct adapter *adapter, int reset)
 {
+	u32 finiver, finicsum, cfcsum, param, val;
 	struct fw_caps_config_cmd caps_cmd;
 	unsigned long mtype = 0, maddr = 0;
-	u32 finiver, finicsum, cfcsum;
-	int ret;
-	int config_issued = 0;
-	int cfg_addr;
+	u8 config_issued = 0;
 	char config_name[20];
+	int cfg_addr, ret;
 
 	/*
 	 * Reset device if necessary.
@@ -1159,6 +1158,12 @@ static int adap_init0_config(struct adapter *adapter, int reset)
 	mtype = FW_MEMTYPE_CF_FLASH;
 	maddr = cfg_addr;
 
+	/* Enable HASH filter region when support is available. */
+	val = 1;
+	param = CXGBE_FW_PARAM_DEV(HASHFILTER_WITH_OFLD);
+	t4_set_params(adapter, adapter->mbox, adapter->pf, 0, 1,
+		      &param, &val);
+
 	/*
 	 * Issue a Capability Configuration command to the firmware to get it
 	 * to parse the Configuration File.  We don't use t4_fw_config_file()
@@ -1217,6 +1222,7 @@ static int adap_init0_config(struct adapter *adapter, int reset)
 	caps_cmd.iscsicaps = 0;
 	caps_cmd.rdmacaps = 0;
 	caps_cmd.fcoecaps = 0;
+	caps_cmd.cryptocaps = 0;
 
 	/*
 	 * And now tell the firmware to use the configuration we just loaded.
-- 
2.24.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/cxgbe: always enable HASH filter support
  2020-06-12 22:10 [dpdk-dev] [PATCH] net/cxgbe: always enable HASH filter support Rahul Lakkireddy
@ 2020-06-17 18:13 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2020-06-17 18:13 UTC (permalink / raw)
  To: Rahul Lakkireddy, dev; +Cc: nirranjan, kaara.satwik

On 6/12/2020 11:10 PM, Rahul Lakkireddy wrote:
> From: Karra Satwik <kaara.satwik@chelsio.com>
> 
> Disable all unused firmware resources during init time to give
> more resources for HASH (exact-match) filter region and always
> request firmware to enable HASH filter support when resources
> are available.
> 
> Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>

Applied to dpdk-next-net/master, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-17 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 22:10 [dpdk-dev] [PATCH] net/cxgbe: always enable HASH filter support Rahul Lakkireddy
2020-06-17 18:13 ` Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git