From patchwork Tue Apr 24 12:44:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 38815 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CC8F85A44; Tue, 24 Apr 2018 14:44:16 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id F15112BD2 for ; Tue, 24 Apr 2018 14:44:07 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2018 05:44:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,322,1520924400"; d="scan'208";a="49490775" Received: from dpdk51.sh.intel.com ([10.67.110.184]) by fmsmga001.fm.intel.com with ESMTP; 24 Apr 2018 05:44:00 -0700 From: Qi Zhang To: thomas@monjalon.net, ferruh.yigit@intel.com Cc: konstantin.ananyev@intel.com, dev@dpdk.org, beilei.xing@intel.com, jingjing.wu@intel.com, wenzhuo.lu@intel.com, Qi Zhang Date: Tue, 24 Apr 2018 20:44:08 +0800 Message-Id: <20180424124410.229538-4-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180424124410.229538-1-qi.z.zhang@intel.com> References: <20180212045314.171616-1-qi.z.zhang@intel.com> <20180424124410.229538-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v8 3/5] app/testpmd: enable per queue configure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Each queue has independent configure information in rte_port. Base on this, we are able to add new commands to configure different queues with different value. Signed-off-by: Qi Zhang Acked-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 8 ++-- app/test-pmd/config.c | 67 +++++++++++++++++++++----------- app/test-pmd/testpmd.c | 101 ++++++++++++++++++++++++++++++------------------- app/test-pmd/testpmd.h | 6 ++- 4 files changed, 114 insertions(+), 68 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f248adc38..7066109c2 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -2365,9 +2365,9 @@ cmd_setup_rxtx_queue_parsed( } ret = rte_eth_rx_queue_setup(res->portid, res->qid, - nb_rxd, + port->nb_rx_desc[res->qid], socket_id, - &port->rx_conf, + &port->rx_conf[res->qid], mp); if (ret) printf("Failed to setup RX queue\n"); @@ -2378,9 +2378,9 @@ cmd_setup_rxtx_queue_parsed( ret = rte_eth_tx_queue_setup(res->portid, res->qid, - nb_txd, + port->nb_tx_desc[res->qid], socket_id, - &port->tx_conf); + &port->tx_conf[res->qid]); if (ret) printf("Failed to setup TX queue\n"); } diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index d98c08254..216a7eb4e 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1755,6 +1755,7 @@ void rxtx_config_display(void) { portid_t pid; + queueid_t qid; printf(" %s packet forwarding%s packets/burst=%d\n", cur_fwd_eng->fwd_mode_name, @@ -1769,31 +1770,51 @@ rxtx_config_display(void) nb_fwd_lcores, nb_fwd_ports); RTE_ETH_FOREACH_DEV(pid) { - struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf; - struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf; + struct rte_eth_rxconf *rx_conf = &ports[pid].rx_conf[0]; + struct rte_eth_txconf *tx_conf = &ports[pid].tx_conf[0]; + uint16_t *nb_rx_desc = &ports[pid].nb_rx_desc[0]; + uint16_t *nb_tx_desc = &ports[pid].nb_tx_desc[0]; + /* per port config */ printf(" port %d:\n", (unsigned int)pid); - printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n", - nb_rxq, nb_rxd, rx_conf->rx_free_thresh); - printf(" RX threshold registers: pthresh=%d hthresh=%d " - " wthresh=%d\n", - rx_conf->rx_thresh.pthresh, - rx_conf->rx_thresh.hthresh, - rx_conf->rx_thresh.wthresh); - printf(" Rx offloads=0x%"PRIx64" RXQ offloads=0x%"PRIx64"\n", - ports[pid].dev_conf.rxmode.offloads, - rx_conf->offloads); - printf(" TX queues=%d - TX desc=%d - TX free threshold=%d\n", - nb_txq, nb_txd, tx_conf->tx_free_thresh); - printf(" TX threshold registers: pthresh=%d hthresh=%d " - " wthresh=%d\n", - tx_conf->tx_thresh.pthresh, - tx_conf->tx_thresh.hthresh, - tx_conf->tx_thresh.wthresh); - printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); - printf(" Tx offloads=0x%"PRIx64" TXQ offloads=0x%"PRIx64"\n", - ports[pid].dev_conf.txmode.offloads, - tx_conf->offloads); + printf(" Rx offloads=0x%"PRIx64"\n", + ports[pid].dev_conf.rxmode.offloads); + + printf(" Tx offloads=0x%"PRIx64"\n", + ports[pid].dev_conf.txmode.offloads); + + printf(" RX queue number: %d\n", nb_rxq); + + /* per rx queue config */ + for (qid = 0; qid < nb_rxq; qid++) { + printf(" RX queue: %d\n", qid); + printf(" RX desc=%d - RX free threshold=%d\n", + nb_rx_desc[qid], rx_conf[qid].rx_free_thresh); + printf(" RX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + rx_conf[qid].rx_thresh.pthresh, + rx_conf[qid].rx_thresh.hthresh, + rx_conf[qid].rx_thresh.wthresh); + printf(" RX Offloads=0x%"PRIx64"\n", + rx_conf[qid].offloads); + } + + printf(" Tx queue number: %d\n", nb_txq); + + /* per tx queue config */ + for (qid = 0; qid < nb_txq; qid++) { + printf(" TX queue: %d\n", qid); + printf(" TX desc=%d - TX free threshold=%d\n", + nb_tx_desc[qid], tx_conf[qid].tx_free_thresh); + printf(" TX threshold registers: pthresh=%d hthresh=%d " + " wthresh=%d\n", + tx_conf[qid].tx_thresh.pthresh, + tx_conf[qid].tx_thresh.hthresh, + tx_conf[qid].tx_thresh.wthresh); + printf(" TX RS bit threshold=%d\n", tx_conf->tx_rs_thresh); + printf(" TX offloads=0x%"PRIx64"\n", + tx_conf[qid].offloads); + } } } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index d6da41927..f9b637ba8 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1593,20 +1593,24 @@ start_port(portid_t pid) } if (port->need_reconfig_queues > 0) { port->need_reconfig_queues = 0; - port->tx_conf.txq_flags = ETH_TXQ_FLAGS_IGNORE; - /* Apply Tx offloads configuration */ - port->tx_conf.offloads = port->dev_conf.txmode.offloads; /* setup tx queues */ for (qi = 0; qi < nb_txq; qi++) { + port->tx_conf[qi].txq_flags = + ETH_TXQ_FLAGS_IGNORE; + /* Apply Tx offloads configuration */ + port->tx_conf[qi].offloads = + port->dev_conf.txmode.offloads; if ((numa_support) && (txring_numa[pi] != NUMA_NO_CONFIG)) diag = rte_eth_tx_queue_setup(pi, qi, - nb_txd,txring_numa[pi], - &(port->tx_conf)); + port->nb_tx_desc[qi], + txring_numa[pi], + &(port->tx_conf[qi])); else diag = rte_eth_tx_queue_setup(pi, qi, - nb_txd,port->socket_id, - &(port->tx_conf)); + port->nb_tx_desc[qi], + port->socket_id, + &(port->tx_conf[qi])); if (diag == 0) continue; @@ -1617,15 +1621,17 @@ start_port(portid_t pid) RTE_PORT_STOPPED) == 0) printf("Port %d can not be set back " "to stopped\n", pi); - printf("Fail to configure port %d tx queues\n", pi); + printf("Fail to configure port %d tx queues\n", + pi); /* try to reconfigure queues next time */ port->need_reconfig_queues = 1; return -1; } - /* Apply Rx offloads configuration */ - port->rx_conf.offloads = port->dev_conf.rxmode.offloads; - /* setup rx queues */ for (qi = 0; qi < nb_rxq; qi++) { + /* Apply Rx offloads configuration */ + port->rx_conf[qi].offloads = + port->dev_conf.rxmode.offloads; + /* setup rx queues */ if ((numa_support) && (rxring_numa[pi] != NUMA_NO_CONFIG)) { struct rte_mempool * mp = @@ -1639,8 +1645,10 @@ start_port(portid_t pid) } diag = rte_eth_rx_queue_setup(pi, qi, - nb_rxd,rxring_numa[pi], - &(port->rx_conf),mp); + port->nb_rx_desc[pi], + rxring_numa[pi], + &(port->rx_conf[qi]), + mp); } else { struct rte_mempool *mp = mbuf_pool_find(port->socket_id); @@ -1652,8 +1660,10 @@ start_port(portid_t pid) return -1; } diag = rte_eth_rx_queue_setup(pi, qi, - nb_rxd,port->socket_id, - &(port->rx_conf), mp); + port->nb_rx_desc[pi], + port->socket_id, + &(port->rx_conf[qi]), + mp); } if (diag == 0) continue; @@ -1664,7 +1674,8 @@ start_port(portid_t pid) RTE_PORT_STOPPED) == 0) printf("Port %d can not be set back " "to stopped\n", pi); - printf("Fail to configure port %d rx queues\n", pi); + printf("Fail to configure port %d rx queues\n", + pi); /* try to reconfigure queues next time */ port->need_reconfig_queues = 1; return -1; @@ -2225,39 +2236,51 @@ map_port_queue_stats_mapping_registers(portid_t pi, struct rte_port *port) static void rxtx_port_config(struct rte_port *port) { - port->rx_conf = port->dev_info.default_rxconf; - port->tx_conf = port->dev_info.default_txconf; + uint16_t qid; - /* Check if any RX/TX parameters have been passed */ - if (rx_pthresh != RTE_PMD_PARAM_UNSET) - port->rx_conf.rx_thresh.pthresh = rx_pthresh; + for (qid = 0; qid < nb_rxq; qid++) { + port->rx_conf[qid] = port->dev_info.default_rxconf; - if (rx_hthresh != RTE_PMD_PARAM_UNSET) - port->rx_conf.rx_thresh.hthresh = rx_hthresh; + /* Check if any Rx parameters have been passed */ + if (rx_pthresh != RTE_PMD_PARAM_UNSET) + port->rx_conf[qid].rx_thresh.pthresh = rx_pthresh; - if (rx_wthresh != RTE_PMD_PARAM_UNSET) - port->rx_conf.rx_thresh.wthresh = rx_wthresh; + if (rx_hthresh != RTE_PMD_PARAM_UNSET) + port->rx_conf[qid].rx_thresh.hthresh = rx_hthresh; - if (rx_free_thresh != RTE_PMD_PARAM_UNSET) - port->rx_conf.rx_free_thresh = rx_free_thresh; + if (rx_wthresh != RTE_PMD_PARAM_UNSET) + port->rx_conf[qid].rx_thresh.wthresh = rx_wthresh; - if (rx_drop_en != RTE_PMD_PARAM_UNSET) - port->rx_conf.rx_drop_en = rx_drop_en; + if (rx_free_thresh != RTE_PMD_PARAM_UNSET) + port->rx_conf[qid].rx_free_thresh = rx_free_thresh; - if (tx_pthresh != RTE_PMD_PARAM_UNSET) - port->tx_conf.tx_thresh.pthresh = tx_pthresh; + if (rx_drop_en != RTE_PMD_PARAM_UNSET) + port->rx_conf[qid].rx_drop_en = rx_drop_en; - if (tx_hthresh != RTE_PMD_PARAM_UNSET) - port->tx_conf.tx_thresh.hthresh = tx_hthresh; + port->nb_rx_desc[qid] = nb_rxd; + } + + for (qid = 0; qid < nb_txq; qid++) { + port->tx_conf[qid] = port->dev_info.default_txconf; + + /* Check if any Tx parameters have been passed */ + if (tx_pthresh != RTE_PMD_PARAM_UNSET) + port->tx_conf[qid].tx_thresh.pthresh = tx_pthresh; - if (tx_wthresh != RTE_PMD_PARAM_UNSET) - port->tx_conf.tx_thresh.wthresh = tx_wthresh; + if (tx_hthresh != RTE_PMD_PARAM_UNSET) + port->tx_conf[qid].tx_thresh.hthresh = tx_hthresh; - if (tx_rs_thresh != RTE_PMD_PARAM_UNSET) - port->tx_conf.tx_rs_thresh = tx_rs_thresh; + if (tx_wthresh != RTE_PMD_PARAM_UNSET) + port->tx_conf[qid].tx_thresh.wthresh = tx_wthresh; - if (tx_free_thresh != RTE_PMD_PARAM_UNSET) - port->tx_conf.tx_free_thresh = tx_free_thresh; + if (tx_rs_thresh != RTE_PMD_PARAM_UNSET) + port->tx_conf[qid].tx_rs_thresh = tx_rs_thresh; + + if (tx_free_thresh != RTE_PMD_PARAM_UNSET) + port->tx_conf[qid].tx_free_thresh = tx_free_thresh; + + port->nb_tx_desc[qid] = nb_txd; + } } void diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 070919822..6f6eada66 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -194,8 +194,10 @@ struct rte_port { uint8_t need_reconfig_queues; /**< need reconfiguring queues or not */ uint8_t rss_flag; /**< enable rss or not */ uint8_t dcb_flag; /**< enable dcb */ - struct rte_eth_rxconf rx_conf; /**< rx configuration */ - struct rte_eth_txconf tx_conf; /**< tx configuration */ + uint16_t nb_rx_desc[MAX_QUEUE_ID+1]; /**< per queue rx desc number */ + uint16_t nb_tx_desc[MAX_QUEUE_ID+1]; /**< per queue tx desc number */ + struct rte_eth_rxconf rx_conf[MAX_QUEUE_ID+1]; /**< per queue rx configuration */ + struct rte_eth_txconf tx_conf[MAX_QUEUE_ID+1]; /**< per queue tx configuration */ struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */