From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 157684CBB for ; Mon, 2 Apr 2018 04:21:20 +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 orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2018 19:21:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,393,1517904000"; d="scan'208";a="43192092" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 01 Apr 2018 19:21:18 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 1 Apr 2018 19:21:18 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 1 Apr 2018 19:21:18 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.235]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.226]) with mapi id 14.03.0319.002; Mon, 2 Apr 2018 10:20:57 +0800 From: "Zhang, Qi Z" To: "Ananyev, Konstantin" , "thomas@monjalon.net" CC: "dev@dpdk.org" , "Xing, Beilei" , "Wu, Jingjing" , "Lu, Wenzhuo" Thread-Topic: [PATCH v4 3/3] net/i40e: enable runtime queue setup Thread-Index: AQHTxODGGwTQNnbM6Ey+sYXepVvOIqPrVy8AgAFxU2A= Date: Mon, 2 Apr 2018 02:20:56 +0000 Message-ID: <039ED4275CED7440929022BC67E70611531775C2@SHSMSX103.ccr.corp.intel.com> References: <20180212045314.171616-1-qi.z.zhang@intel.com> <20180326085916.264811-1-qi.z.zhang@intel.com> <20180326085916.264811-4-qi.z.zhang@intel.com> <2601191342CEEE43887BDE71AB977258A0AB71C7@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB977258A0AB71C7@irsmsx105.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action 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 v4 3/3] net/i40e: enable runtime queue setup 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: , X-List-Received-Date: Mon, 02 Apr 2018 02:21:22 -0000 > -----Original Message----- > From: Ananyev, Konstantin > Sent: Sunday, April 1, 2018 8:18 PM > To: Zhang, Qi Z ; thomas@monjalon.net > Cc: dev@dpdk.org; Xing, Beilei ; Wu, Jingjing > ; Lu, Wenzhuo > Subject: RE: [PATCH v4 3/3] net/i40e: enable runtime queue setup >=20 >=20 >=20 > > + > > +static int > > +i40e_dev_rx_queue_setup_runtime(struct rte_eth_dev *dev, > > + struct i40e_rx_queue *rxq) > > +{ > > + struct i40e_adapter *ad =3D > > + I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); > > + int use_def_burst_func =3D > > + check_rx_burst_bulk_alloc_preconditions(rxq); > > + uint16_t buf_size =3D > > + (uint16_t)(rte_pktmbuf_data_room_size(rxq->mp) - > > + RTE_PKTMBUF_HEADROOM); > > + int use_scattered_rx =3D > > + ((rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) > buf_size) ? > > + 1 : 0; >=20 > As a nit: > int use_scattered_rx =3D ((rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) > > buf_size); would do exactly the same. >=20 > > + > > + if (i40e_rx_queue_init(rxq) !=3D I40E_SUCCESS) { > > + PMD_DRV_LOG(ERR, > > + "Failed to do RX queue initialization"); > > + return -EINVAL; > > + } > > + > > + if (i40e_dev_first_rx_queue(dev, rxq->queue_id)) { > > + /** > > + * If it is the first queue to setup, > > + * set all flags to default and call > > + * i40e_set_rx_function. > > + */ > > + ad->rx_bulk_alloc_allowed =3D true; > > + ad->rx_vec_allowed =3D true; > > + dev->data->scattered_rx =3D use_scattered_rx; > > + if (use_def_burst_func) > > + ad->rx_bulk_alloc_allowed =3D false; > > + i40e_set_rx_function(dev); > > + return 0; > > + } > > + > > + /* check bulk alloc conflict */ > > + if (ad->rx_bulk_alloc_allowed && use_def_burst_func) { > > + PMD_DRV_LOG(ERR, "Can't use default burst."); > > + return -EINVAL; > > + } > > + /* check scatterred conflict */ > > + if (!dev->data->scattered_rx && use_scattered_rx) { > > + PMD_DRV_LOG(ERR, "Scattered rx is required."); > > + return -EINVAL; > > + } > > + /* check vector conflict */ > > + if (ad->rx_vec_allowed && i40e_rxq_vec_setup(rxq)) { > > + PMD_DRV_LOG(ERR, "Failed vector rx setup."); > > + return -EINVAL; > > + } > > + > > + return 0; > > +} >=20 > ... >=20 > > + > > +static int > > +i40e_dev_first_tx_queue(struct rte_eth_dev *dev, > > + uint16_t queue_idx) > > +{ > > + uint16_t i; > > + > > + for (i =3D 0; i < dev->data->nb_rx_queues; i++) { > > + if (i !=3D queue_idx && dev->data->rx_queues[i]) > > + return 0; > > + } > > + > > + return 1; > > +} >=20 > I suppose it should be tx_qeueues and nb_tx_queues here. > BTW you probably can merge i40e_dev_first_tx_queue() and > i40e_dev_first_rx_queue() into one function. Thanks for capture this, will fix. > Konstantin