net/sfc: use NIC EVQ descs limits instead of defines
authorIgor Romanov <igor.romanov@oktetlabs.ru>
Thu, 7 Feb 2019 16:29:16 +0000 (16:29 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Feb 2019 10:35:41 +0000 (11:35 +0100)
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
drivers/net/sfc/sfc.h
drivers/net/sfc/sfc_dp_rx.h
drivers/net/sfc/sfc_ef10_essb_rx.c
drivers/net/sfc/sfc_ev.c
drivers/net/sfc/sfc_ev.h
drivers/net/sfc/sfc_rx.c

index 26c7c32..8986038 100644 (file)
@@ -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));
 
index 6c99e9e..a4b9a3f 100644 (file)
@@ -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;
 
index c3cc4ff..042c014 100644 (file)
@@ -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;
 };
 
 /**
index fee7a8b..ccb6aea 100644 (file)
@@ -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
index 0ca502e..939766d 100644 (file)
@@ -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;
index 872f79b..5d070b1 100644 (file)
@@ -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;
index c8dec8d..faa9758 100644 (file)
@@ -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,