From: "Chen, Jing D" <jing.d.chen@intel.com>
To: "Xie, Huawei" <huawei.xie@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/2] examples/vhost: use factorized default Rx/Tx configuration
Date: Thu, 13 Nov 2014 06:02:26 +0000 [thread overview]
Message-ID: <4341B239C0EFF9468EE453F9E9F4604D0161CAD6@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1415831647-11139-3-git-send-email-huawei.xie@intel.com>
Hi,
> -----Original Message-----
> From: Xie, Huawei
> Sent: Thursday, November 13, 2014 6:34 AM
> To: dev@dpdk.org
> Cc: Chen, Jing D; Xie, Huawei
> Subject: [PATCH 2/2] examples/vhost: use factorized default Rx/Tx
> configuration
>
> Refer to Pablo's commit:
> "use factorized default Rx/Tx configuration
>
> For apps that were using default rte_eth_rxconf and rte_eth_txconf
> structures, these have been removed and now they are obtained by
> calling rte_eth_dev_info_get, just before setting up RX/TX queues."
>
> move zero copy's deferred start set up ahead.
>
> Signed-off-by: Huawei Xie <huawei.xie@intel.com>
> ---
> examples/vhost/main.c | 78 +++++++++++++++----------------------------------
> --
> 1 file changed, 22 insertions(+), 56 deletions(-)
>
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index 2b1bf02..fa36913 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -79,25 +79,6 @@
> + RTE_PKTMBUF_HEADROOM)
> #define MBUF_CACHE_SIZE_ZCP 0
>
> -/*
> - * RX and TX Prefetch, Host, and Write-back threshold values should be
> - * carefully set for optimal performance. Consult the network
> - * controller's datasheet and supporting DPDK documentation for guidance
> - * on how these parameters should be set.
> - */
> -#define RX_PTHRESH 8 /* Default values of RX prefetch threshold reg. */
> -#define RX_HTHRESH 8 /* Default values of RX host threshold reg. */
> -#define RX_WTHRESH 4 /* Default values of RX write-back threshold reg. */
> -
> -/*
> - * These default values are optimized for use with the Intel(R) 82599 10 GbE
> - * Controller and the DPDK ixgbe PMD. Consider using other values for other
> - * network controllers and/or network drivers.
> - */
> -#define TX_PTHRESH 36 /* Default values of TX prefetch threshold reg. */
> -#define TX_HTHRESH 0 /* Default values of TX host threshold reg. */
> -#define TX_WTHRESH 0 /* Default values of TX write-back threshold reg. */
> -
> #define MAX_PKT_BURST 32 /* Max burst size for RX/TX */
> #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */
>
> @@ -217,32 +198,6 @@ static uint32_t burst_rx_retry_num =
> BURST_RX_RETRIES;
> /* Character device basename. Can be set by user. */
> static char dev_basename[MAX_BASENAME_SZ] = "vhost-net";
>
> -
> -/* Default configuration for rx and tx thresholds etc. */
> -static struct rte_eth_rxconf rx_conf_default = {
> - .rx_thresh = {
> - .pthresh = RX_PTHRESH,
> - .hthresh = RX_HTHRESH,
> - .wthresh = RX_WTHRESH,
> - },
> - .rx_drop_en = 1,
> -};
> -
> -/*
> - * These default values are optimized for use with the Intel(R) 82599 10 GbE
> - * Controller and the DPDK ixgbe/igb PMD. Consider using other values for
> other
> - * network controllers and/or network drivers.
> - */
> -static struct rte_eth_txconf tx_conf_default = {
> - .tx_thresh = {
> - .pthresh = TX_PTHRESH,
> - .hthresh = TX_HTHRESH,
> - .wthresh = TX_WTHRESH,
> - },
> - .tx_free_thresh = 0, /* Use PMD default values */
> - .tx_rs_thresh = 0, /* Use PMD default values */
> -};
> -
> /* empty vmdq configuration structure. Filled in programatically */
> static struct rte_eth_conf vmdq_conf_default = {
> .rxmode = {
> @@ -410,7 +365,9 @@ port_init(uint8_t port)
> {
> struct rte_eth_dev_info dev_info;
> struct rte_eth_conf port_conf;
> - uint16_t rx_rings, tx_rings;
> + struct rte_eth_rxconf *rxconf;
> + struct rte_eth_txconf *txconf;
> + int16_t rx_rings, tx_rings;
> uint16_t rx_ring_size, tx_ring_size;
> int retval;
> uint16_t q;
> @@ -418,6 +375,21 @@ port_init(uint8_t port)
> /* The max pool number from dev_info will be used to validate the
> pool number specified in cmd line */
> rte_eth_dev_info_get (port, &dev_info);
>
> + rxconf = &dev_info.default_rxconf;
> + txconf = &dev_info.default_txconf;
> + rxconf->rx_drop_en = 1;
> +
> + /*
> + * Zero copy defers queue RX/TX start to the time when guest
> + * finishes its startup and packet buffers from that guest are
> + * available.
> + */
> + if (zero_copy) {
> + rxconf->rx_deferred_start = 1;
> + rxconf->rx_drop_en = 0;
> + txconf->tx_deferred_start = 1;
> + }
> +
May I know why 'rx_drop_en' is cleared after 'zero_copy' set?
> /*configure the number of supported virtio devices based on VMDQ
> limits */
> num_devices = dev_info.max_vmdq_pools;
>
> @@ -460,14 +432,16 @@ port_init(uint8_t port)
> /* Setup the queues. */
> for (q = 0; q < rx_rings; q ++) {
> retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
> - rte_eth_dev_socket_id(port),
> &rx_conf_default,
> + rte_eth_dev_socket_id(port),
> + rxconf,
> vpool_array[q].pool);
> if (retval < 0)
> return retval;
> }
> for (q = 0; q < tx_rings; q ++) {
> retval = rte_eth_tx_queue_setup(port, q, tx_ring_size,
> - rte_eth_dev_socket_id(port),
> &tx_conf_default);
> + rte_eth_dev_socket_id(port),
> + txconf);
> if (retval < 0)
> return retval;
> }
> @@ -2920,14 +2894,6 @@ MAIN(int argc, char *argv[])
> char pool_name[RTE_MEMPOOL_NAMESIZE];
> char ring_name[RTE_MEMPOOL_NAMESIZE];
>
> - /*
> - * Zero copy defers queue RX/TX start to the time when
> guest
> - * finishes its startup and packet buffers from that guest are
> - * available.
> - */
> - rx_conf_default.rx_deferred_start = (uint8_t)zero_copy;
> - rx_conf_default.rx_drop_en = 0;
> - tx_conf_default.tx_deferred_start = (uint8_t)zero_copy;
> nb_mbuf = num_rx_descriptor
> + num_switching_cores * MBUF_CACHE_SIZE_ZCP
> + num_switching_cores * MAX_PKT_BURST;
> --
> 1.8.1.4
next prev parent reply other threads:[~2014-11-13 5:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 22:34 [dpdk-dev] [PATCH 0/2] examples/vhost: support new VMDQ api and new nic i40e in vhost example Huawei Xie
2014-11-12 22:34 ` [dpdk-dev] [PATCH 1/2] examples/vhost: support new VMDQ API and new nic i40e Huawei Xie
2014-11-13 0:49 ` Ouyang, Changchun
2014-11-13 1:20 ` Xie, Huawei
2014-11-13 5:58 ` Chen, Jing D
2014-11-14 6:30 ` Xie, Huawei
2014-11-14 7:24 ` Chen, Jing D
2014-11-12 22:34 ` [dpdk-dev] [PATCH 2/2] examples/vhost: use factorized default Rx/Tx configuration Huawei Xie
2014-11-13 6:02 ` Chen, Jing D [this message]
2014-11-14 2:17 ` Xie, Huawei
2014-11-12 22:52 ` [dpdk-dev] [PATCH 0/2] examples/vhost: support new VMDQ api and new nic i40e in vhost example Xie, Huawei
2014-12-06 10:16 ` Thomas Monjalon
2014-12-05 10:51 ` Fu, JingguoX
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4341B239C0EFF9468EE453F9E9F4604D0161CAD6@shsmsx102.ccr.corp.intel.com \
--to=jing.d.chen@intel.com \
--cc=dev@dpdk.org \
--cc=huawei.xie@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).