From patchwork Mon Nov 21 14:33:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanumanth Pothula X-Patchwork-Id: 120000 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1E7E4A0560; Mon, 21 Nov 2022 15:33:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07A4342D14; Mon, 21 Nov 2022 15:33:58 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 438DC400EF for ; Mon, 21 Nov 2022 15:33:56 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ALBUWro014545; Mon, 21 Nov 2022 06:33:55 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=WH+0BNAy6/bO77lpaoiPfgZeamrGaGl158n1PBrui3g=; b=M5pHM5IDqx8oiUKwTNbJSh8v0ZhiF/EPDsppyOdEZRNQPogGLhoHO1mPBbD8eJ1tdOq/ GU4cK6K0ihcUDX769Y2UqcEzEkBj+4cjkNw93nSJ8WdUVuVN613QYTctF9CKGpolQFmB +SThRmRXyu67BPkHo8q2wt8n5O75GISDadqfMc/8oyh6l/K+BC/75OhsUBo5PyP6cjvZ KMJNiyBrANpnTObyi7Wto/RuJZQoXKBhsosoiZYigBaxZC5BzBdGEN4QGmq8DgABom3T jLAKlhad1EtYenlWBLF99zQ0wmGzCOYNinQbOoG5uFztYCW/yBmdWTy55Au/H9wSCgVp KQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kxyhrx0jk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 21 Nov 2022 06:33:55 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 21 Nov 2022 06:33:53 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 21 Nov 2022 06:33:53 -0800 Received: from localhost.localdomain (unknown [10.28.36.155]) by maili.marvell.com (Postfix) with ESMTP id 516343F707A; Mon, 21 Nov 2022 06:33:50 -0800 (PST) From: Hanumanth Pothula To: Aman Singh , Yuying Zhang CC: , , , , , , Subject: [PATCH v6 1/1] app/testpmd: add valid check to verify multi mempool feature Date: Mon, 21 Nov 2022 20:03:47 +0530 Message-ID: <20221121143347.3923255-1-hpothula@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221121124546.3920722-1-hpothula@marvell.com> References: <20221121124546.3920722-1-hpothula@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: RnkQ4LhKJ0EEdaNNUxcfU3cUm6GXz9D1 X-Proofpoint-ORIG-GUID: RnkQ4LhKJ0EEdaNNUxcfU3cUm6GXz9D1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_13,2022-11-18_01,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Validate ethdev parameter 'max_rx_mempools' to know whether device supports multi-mempool feature or not. Also, add new testpmd command line argument, multi-mempool, to control multi-mempool feature. By default its disabled. Bugzilla ID: 1128 Fixes: 4f04edcda769 ("app/testpmd: support multiple mbuf pools per Rx queue") Signed-off-by: Hanumanth Pothula --- v6: - Updated run_app.rst file with multi-mempool argument. - defined and populated multi_mempool at related arguments. - invoking rte_eth_dev_info_get() withing multi-mempool condition v5: - Added testpmd argument to enable multi-mempool feature. - Simplified logic to distinguish between multi-mempool, multi-segment and single pool/segment. v4: - updated if condition. v3: - Simplified conditional check. - Corrected spell, whether. v2: - Rebased on tip of next-net/main. --- app/test-pmd/parameters.c | 4 ++ app/test-pmd/testpmd.c | 66 +++++++++++++++++---------- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/run_app.rst | 4 ++ 4 files changed, 50 insertions(+), 25 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index aed4cdcb84..d0f7b2f11d 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -155,6 +155,7 @@ usage(char* progname) printf(" --rxhdrs=eth[,ipv4]*: set RX segment protocol to split.\n"); printf(" --txpkts=X[,Y]*: set TX segment sizes" " or total packet length.\n"); + printf(" --multi-mempool: enable multi-mempool support\n"); printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n"); printf(" --tx-ip=src,dst: IP addresses in Tx-only mode\n"); printf(" --tx-udp=src[,dst]: UDP ports in Tx-only mode\n"); @@ -669,6 +670,7 @@ launch_args_parse(int argc, char** argv) { "rxpkts", 1, 0, 0 }, { "rxhdrs", 1, 0, 0 }, { "txpkts", 1, 0, 0 }, + { "multi-mempool", 0, 0, 0 }, { "txonly-multi-flow", 0, 0, 0 }, { "rxq-share", 2, 0, 0 }, { "eth-link-speed", 1, 0, 0 }, @@ -1295,6 +1297,8 @@ launch_args_parse(int argc, char** argv) else rte_exit(EXIT_FAILURE, "bad txpkts\n"); } + if (!strcmp(lgopts[opt_idx].name, "multi-mempool")) + multi_mempool = 1; if (!strcmp(lgopts[opt_idx].name, "txonly-multi-flow")) txonly_multi_flow = 1; if (!strcmp(lgopts[opt_idx].name, "rxq-share")) { diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 4e25f77c6a..0bf2e4bd0d 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -245,6 +245,7 @@ uint32_t max_rx_pkt_len; */ uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT]; uint8_t rx_pkt_nb_segs; /**< Number of segments to split */ +uint8_t multi_mempool; /**< Enables multi-mempool feature */ uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT]; uint8_t rx_pkt_nb_offs; /**< Number of specified offsets */ uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT]; @@ -258,6 +259,8 @@ uint16_t tx_pkt_seg_lengths[RTE_MAX_SEGS_PER_PKT] = { }; uint8_t tx_pkt_nb_segs = 1; /**< Number of segments in TXONLY packets */ + + enum tx_pkt_split tx_pkt_split = TX_PKT_SPLIT_OFF; /**< Split policy for packets to TX. */ @@ -2659,24 +2662,9 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, uint32_t prev_hdrs = 0; int ret; - /* Verify Rx queue configuration is single pool and segment or - * multiple pool/segment. - * @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))) { - /* Single pool/segment configuration */ - rx_conf->rx_seg = NULL; - rx_conf->rx_nseg = 0; - ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, - nb_rx_desc, socket_id, - rx_conf, mp); - goto exit; - } - if (rx_pkt_nb_segs > 1 || - rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT) { + if ((rx_pkt_nb_segs > 1) && + (rx_conf->offloads & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT)) { /* multi-segment configuration */ for (i = 0; i < rx_pkt_nb_segs; i++) { struct rte_eth_rxseg_split *rx_seg = &rx_useg[i].split; @@ -2701,22 +2689,50 @@ rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, } rx_conf->rx_nseg = rx_pkt_nb_segs; rx_conf->rx_seg = rx_useg; - } else { + rx_conf->rx_mempools = NULL; + rx_conf->rx_nmempool = 0; + ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc, + socket_id, rx_conf, NULL); + rx_conf->rx_seg = NULL; + rx_conf->rx_nseg = 0; + } else if (multi_mempool == 1) { /* multi-pool configuration */ + struct rte_eth_dev_info dev_info; + + if (mbuf_data_size_n <= 1) { + RTE_LOG(ERR, EAL, "invalid number of mempools %u", + mbuf_data_size_n); + return -EINVAL; + } + ret = rte_eth_dev_info_get(port_id, &dev_info); + if (ret != 0) + return ret; + if (dev_info.max_rx_mempools == 0) { + RTE_LOG(ERR, EAL, "device doesn't support requested multi-mempool configuration"); + return -ENOTSUP; + } for (i = 0; i < mbuf_data_size_n; i++) { mpx = mbuf_pool_find(socket_id, i); rx_mempool[i] = mpx ? mpx : mp; } rx_conf->rx_mempools = rx_mempool; rx_conf->rx_nmempool = mbuf_data_size_n; - } - ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc, + rx_conf->rx_seg = NULL; + rx_conf->rx_nseg = 0; + ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc, socket_id, rx_conf, NULL); - rx_conf->rx_seg = NULL; - rx_conf->rx_nseg = 0; - rx_conf->rx_mempools = NULL; - rx_conf->rx_nmempool = 0; -exit: + rx_conf->rx_mempools = NULL; + rx_conf->rx_nmempool = 0; + } else { + /* Single pool/segment configuration */ + rx_conf->rx_seg = NULL; + rx_conf->rx_nseg = 0; + rx_conf->rx_mempools = NULL; + rx_conf->rx_nmempool = 0; + ret = rte_eth_rx_queue_setup(port_id, rx_queue_id, nb_rx_desc, + socket_id, rx_conf, mp); + } + ports[port_id].rxq[rx_queue_id].state = rx_conf->rx_deferred_start ? RTE_ETH_QUEUE_STATE_STOPPED : RTE_ETH_QUEUE_STATE_STARTED; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index aaf69c349a..e4f9b142c9 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -589,6 +589,7 @@ extern uint32_t max_rx_pkt_len; extern uint32_t rx_pkt_hdr_protos[MAX_SEGS_BUFFER_SPLIT]; extern uint16_t rx_pkt_seg_lengths[MAX_SEGS_BUFFER_SPLIT]; extern uint8_t rx_pkt_nb_segs; /**< Number of segments to split */ +extern uint8_t multi_mempool; /**< Enables multi-mempool feature. */ extern uint16_t rx_pkt_seg_offsets[MAX_SEGS_BUFFER_SPLIT]; extern uint8_t rx_pkt_nb_offs; /**< Number of specified offsets */ diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 610e442924..329570e721 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -365,6 +365,10 @@ The command line options are: Set TX segment sizes or total packet length. Valid for ``tx-only`` and ``flowgen`` forwarding modes. +* ``--multi-mempool`` + + Enable multi-mempool, multiple mbuf pools per Rx queue, support. + * ``--txonly-multi-flow`` Generate multiple flows in txonly mode.