Validate ethdev parameter 'max_rx_mempools' to know whether
device supports multi-mempool feature or not.

Bugzilla ID: 1128

Signed-off-by: Hanumanth Pothula <hpoth...@marvell.com>
v4:
 - updated if condition.
v3:
 - Simplified conditional check.
 - Corrected spell, whether.
v2:
 - Rebased on tip of next-net/main.
---
 app/test-pmd/testpmd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4e25f77c6a..9fc14e6d6b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2655,17 +2655,23 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
        union rte_eth_rxseg rx_useg[MAX_SEGS_BUFFER_SPLIT] = {};
        struct rte_mempool *rx_mempool[MAX_MEMPOOL] = {};
        struct rte_mempool *mpx;
+       struct rte_eth_dev_info dev_info;
        unsigned int i, mp_n;
        uint32_t prev_hdrs = 0;
        int ret;
 
+       ret = rte_eth_dev_info_get(port_id, &dev_info);
+       if (ret != 0)
+               return ret;
+
        /* Verify Rx queue configuration is single pool and segment or
         * multiple pool/segment.
+        * @see rte_eth_dev_info::max_rx_mempools
         * @see rte_eth_rxconf::rx_mempools
         * @see rte_eth_rxconf::rx_seg
         */
-       if (!(mbuf_data_size_n > 1) && !(rx_pkt_nb_segs > 1 ||
-           ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) != 0))) {
+       if ((dev_info.max_rx_mempools == 0) && (rx_pkt_nb_segs < 1 ||
+           ((rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) == 0))) {
                /* Single pool/segment configuration */
                rx_conf->rx_seg = NULL;
                rx_conf->rx_nseg = 0;
-- 
2.25.1

Reply via email to