From: Igor Romanov Date: Thu, 7 Feb 2019 16:29:16 +0000 (+0000) Subject: net/sfc: use NIC EVQ descs limits instead of defines X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d5371f3dfa595951899ffc2f41dcd6711675d5b5;p=dpdk.git net/sfc: use NIC EVQ descs limits instead of defines Descriptor limits are not common for all NIC families. Use the variables from NIC configuration instead of deprecated defines. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 26c7c322f3..898603884f 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 6c99e9e66a..a4b9a3f331 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 c3cc4ff5b3..042c014ee5 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 fee7a8b279..ccb6aea743 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 0ca502ea29..939766dc25 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 872f79b914..5d070b1a35 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 c8dec8d6e1..faa9758af5 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,