Patchwork [dpdk-dev,11/38] net/sfc: use NIC EVQ descs limits instead of defines

login
register
mail settings
Submitter Andrew Rybchenko
Date Feb. 7, 2019, 4:29 p.m.
Message ID <1549556983-10896-12-git-send-email-arybchenko@solarflare.com>
Download mbox | patch
Permalink /patch/720827/
State New
Headers show

Comments

Andrew Rybchenko - Feb. 7, 2019, 4:29 p.m.
From: Igor Romanov <igor.romanov@oktetlabs.ru>

Descriptor limits are not common for all NIC families. Use the variables
from NIC configuration instead of deprecated defines.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc.c              | 6 ++++++
 drivers/net/sfc/sfc.h              | 3 +++
 drivers/net/sfc/sfc_dp_rx.h        | 2 ++
 drivers/net/sfc/sfc_ef10_essb_rx.c | 4 ++--
 drivers/net/sfc/sfc_ev.c           | 2 +-
 drivers/net/sfc/sfc_ev.h           | 3 ---
 drivers/net/sfc/sfc_rx.c           | 2 ++
 7 files changed, 16 insertions(+), 6 deletions(-)

Patch

diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 26c7c322f..898603884 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -756,6 +756,12 @@  sfc_attach(struct sfc_adapter *sa)
 	if (rc != 0)
 		goto fail_estimate_rsrc_limits;
 
+	sa->evq_max_entries = encp->enc_evq_max_nevs;
+	SFC_ASSERT(rte_is_power_of_2(sa->evq_max_entries));
+
+	sa->evq_min_entries = encp->enc_evq_min_nevs;
+	SFC_ASSERT(rte_is_power_of_2(sa->evq_min_entries));
+
 	sa->rxq_max_entries = encp->enc_rxq_max_ndescs;
 	SFC_ASSERT(rte_is_power_of_2(sa->rxq_max_entries));
 
diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h
index 6c99e9e66..a4b9a3f33 100644
--- a/drivers/net/sfc/sfc.h
+++ b/drivers/net/sfc/sfc.h
@@ -250,6 +250,9 @@  struct sfc_adapter {
 	unsigned int			txq_max_entries;
 	unsigned int			txq_min_entries;
 
+	unsigned int			evq_max_entries;
+	unsigned int			evq_min_entries;
+
 	uint32_t			evq_flags;
 	unsigned int			evq_count;
 
diff --git a/drivers/net/sfc/sfc_dp_rx.h b/drivers/net/sfc/sfc_dp_rx.h
index c3cc4ff5b..042c014ee 100644
--- a/drivers/net/sfc/sfc_dp_rx.h
+++ b/drivers/net/sfc/sfc_dp_rx.h
@@ -32,6 +32,8 @@  struct sfc_dp_rxq {
 struct sfc_dp_rx_hw_limits {
 	unsigned int rxq_max_entries;
 	unsigned int rxq_min_entries;
+	unsigned int evq_max_entries;
+	unsigned int evq_min_entries;
 };
 
 /**
diff --git a/drivers/net/sfc/sfc_ef10_essb_rx.c b/drivers/net/sfc/sfc_ef10_essb_rx.c
index fee7a8b27..ccb6aea74 100644
--- a/drivers/net/sfc/sfc_ef10_essb_rx.c
+++ b/drivers/net/sfc/sfc_ef10_essb_rx.c
@@ -528,8 +528,8 @@  sfc_ef10_essb_rx_qsize_up_rings(uint16_t nb_rx_desc,
 		1 /* Rx error */ + 1 /* flush */ + 1 /* head-tail space */;
 
 	*evq_entries = rte_align32pow2(max_events);
-	*evq_entries = RTE_MAX(*evq_entries, (unsigned int)EFX_EVQ_MINNEVS);
-	*evq_entries = RTE_MIN(*evq_entries, (unsigned int)EFX_EVQ_MAXNEVS);
+	*evq_entries = RTE_MAX(*evq_entries, limits->evq_min_entries);
+	*evq_entries = RTE_MIN(*evq_entries, limits->evq_max_entries);
 
 	/*
 	 * May be even maximum event queue size is insufficient to handle
diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index 0ca502ea2..939766dc2 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -897,7 +897,7 @@  sfc_ev_attach(struct sfc_adapter *sa)
 	sa->mgmt_evq_index = 0;
 	rte_spinlock_init(&sa->mgmt_evq_lock);
 
-	rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_MGMT, 0, SFC_MGMT_EVQ_ENTRIES,
+	rc = sfc_ev_qinit(sa, SFC_EVQ_TYPE_MGMT, 0, sa->evq_min_entries,
 			  sa->socket_id, &sa->mgmt_evq);
 	if (rc != 0)
 		goto fail_mgmt_evq_init;
diff --git a/drivers/net/sfc/sfc_ev.h b/drivers/net/sfc/sfc_ev.h
index 872f79b91..5d070b1a3 100644
--- a/drivers/net/sfc/sfc_ev.h
+++ b/drivers/net/sfc/sfc_ev.h
@@ -20,9 +20,6 @@ 
 extern "C" {
 #endif
 
-/* Number of entries in the management event queue */
-#define SFC_MGMT_EVQ_ENTRIES	(EFX_EVQ_MINNEVS)
-
 struct sfc_adapter;
 struct sfc_dp_rxq;
 struct sfc_dp_txq;
diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c
index c8dec8d6e..faa9758af 100644
--- a/drivers/net/sfc/sfc_rx.c
+++ b/drivers/net/sfc/sfc_rx.c
@@ -977,6 +977,8 @@  sfc_rx_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 	memset(&hw_limits, 0, sizeof(hw_limits));
 	hw_limits.rxq_max_entries = sa->rxq_max_entries;
 	hw_limits.rxq_min_entries = sa->rxq_min_entries;
+	hw_limits.evq_max_entries = sa->evq_max_entries;
+	hw_limits.evq_min_entries = sa->evq_min_entries;
 
 	rc = sa->priv.dp_rx->qsize_up_rings(nb_rx_desc, &hw_limits, mb_pool,
 					    &rxq_entries, &evq_entries,