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 C33455B34 for ; Sun, 1 Apr 2018 14:18:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2018 05:18:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,391,1517904000"; d="scan'208";a="216562877" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga006.fm.intel.com with ESMTP; 01 Apr 2018 05:18:23 -0700 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX104.ger.corp.intel.com (163.33.3.159) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 1 Apr 2018 13:18:22 +0100 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.216]) by irsmsx155.ger.corp.intel.com ([169.254.14.50]) with mapi id 14.03.0319.002; Sun, 1 Apr 2018 13:18:22 +0100 From: "Ananyev, Konstantin" To: "Zhang, Qi Z" , "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: AQHTxODH3ciHLe1qJ0uI6ofuPE/AoqPr2s6Q Date: Sun, 1 Apr 2018 12:18:22 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258A0AB71C7@irsmsx105.ger.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> In-Reply-To: <20180326085916.264811-4-qi.z.zhang@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGY4MGExNDYtZTQyNi00ODRhLTk5ZWMtMDNmNzA2NjU4ZDg1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImVlSHl0cHJORFFcL2xQZHZIMFM4VGhXYVZidDlNaGxhY1NXSlRmbjFveTlZPSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] 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: Sun, 01 Apr 2018 12:18:26 -0000 > + > +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; As a nit: int use_scattered_rx =3D ((rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) > buf= _size); would do exactly the same. > + > + 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; > +} ... > + > +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; > +} 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. Konstantin