From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 34C9A7E75 for ; Fri, 14 Nov 2014 03:08:42 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 13 Nov 2014 18:16:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,382,1413270000"; d="scan'208";a="636741085" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by orsmga002.jf.intel.com with ESMTP; 13 Nov 2014 18:18:41 -0800 Received: from pgsmsx102.gar.corp.intel.com (10.221.44.80) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 14 Nov 2014 10:17:34 +0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX102.gar.corp.intel.com (10.221.44.80) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 14 Nov 2014 10:17:33 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.86]) with mapi id 14.03.0195.001; Fri, 14 Nov 2014 10:17:32 +0800 From: "Xie, Huawei" To: "Chen, Jing D" , "dev@dpdk.org" Thread-Topic: [PATCH 2/2] examples/vhost: use factorized default Rx/Tx configuration Thread-Index: AQHP/sjrHodjWEP7h0mKZKMME/pha5xeENUggAFSv6A= Date: Fri, 14 Nov 2014 02:17:32 +0000 Message-ID: References: <1415831647-11139-1-git-send-email-huawei.xie@intel.com> <1415831647-11139-3-git-send-email-huawei.xie@intel.com> <4341B239C0EFF9468EE453F9E9F4604D0161CAD6@shsmsx102.ccr.corp.intel.com> In-Reply-To: <4341B239C0EFF9468EE453F9E9F4604D0161CAD6@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/2] examples/vhost: use factorized default Rx/Tx configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2014 02:08:43 -0000 > -----Original Message----- > From: Chen, Jing D > Sent: Wednesday, November 12, 2014 11:02 PM > To: Xie, Huawei; dev@dpdk.org > Subject: RE: [PATCH 2/2] examples/vhost: use factorized default Rx/Tx > configuration >=20 > Hi, >=20 > > -----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 > > --- > > 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 guidan= ce > > - * 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 =3D > > BURST_RX_RETRIES; > > /* Character device basename. Can be set by user. */ > > static char dev_basename[MAX_BASENAME_SZ] =3D "vhost-net"; > > > > - > > -/* Default configuration for rx and tx thresholds etc. */ > > -static struct rte_eth_rxconf rx_conf_default =3D { > > - .rx_thresh =3D { > > - .pthresh =3D RX_PTHRESH, > > - .hthresh =3D RX_HTHRESH, > > - .wthresh =3D RX_WTHRESH, > > - }, > > - .rx_drop_en =3D 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 =3D { > > - .tx_thresh =3D { > > - .pthresh =3D TX_PTHRESH, > > - .hthresh =3D TX_HTHRESH, > > - .wthresh =3D TX_WTHRESH, > > - }, > > - .tx_free_thresh =3D 0, /* Use PMD default values */ > > - .tx_rs_thresh =3D 0, /* Use PMD default values */ > > -}; > > - > > /* empty vmdq configuration structure. Filled in programatically */ > > static struct rte_eth_conf vmdq_conf_default =3D { > > .rxmode =3D { > > @@ -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 =3D &dev_info.default_rxconf; > > + txconf =3D &dev_info.default_txconf; > > + rxconf->rx_drop_en =3D 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 =3D 1; > > + rxconf->rx_drop_en =3D 0; > > + txconf->tx_deferred_start =3D 1; > > + } > > + >=20 > May I know why 'rx_drop_en' is cleared after 'zero_copy' set? :), first of all, this is not related to this patch. This patch inheritate = old rx_drop_en behavior, and apply pablo's change. Secondly, this is due to rx ring in zero copy case has very limited descrip= tor number. Clearing this setting will cache the packets when there are not enough descriptors >=20 > > /*configure the number of supported virtio devices based on VMDQ > > limits */ > > num_devices =3D dev_info.max_vmdq_pools; > > > > @@ -460,14 +432,16 @@ port_init(uint8_t port) > > /* Setup the queues. */ > > for (q =3D 0; q < rx_rings; q ++) { > > retval =3D 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 =3D 0; q < tx_rings; q ++) { > > retval =3D 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 =3D (uint8_t)zero_copy; > > - rx_conf_default.rx_drop_en =3D 0; > > - tx_conf_default.tx_deferred_start =3D (uint8_t)zero_copy; > > nb_mbuf =3D num_rx_descriptor > > + num_switching_cores * MBUF_CACHE_SIZE_ZCP > > + num_switching_cores * MAX_PKT_BURST; > > -- > > 1.8.1.4