> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Sunday, April 1, 2018 8:18 PM
> To: Zhang, Qi Z <qi.z.zh...@intel.com>; tho...@monjalon.net
> Cc: dev@dpdk.org; Xing, Beilei <beilei.x...@intel.com>; Wu, Jingjing
> <jingjing...@intel.com>; Lu, Wenzhuo <wenzhuo...@intel.com>
> Subject: RE: [PATCH v4 3/3] net/i40e: enable runtime queue setup
> 
> 
> 
> > +
> > +static int
> > +i40e_dev_rx_queue_setup_runtime(struct rte_eth_dev *dev,
> > +                           struct i40e_rx_queue *rxq)
> > +{
> > +   struct i40e_adapter *ad =
> > +           I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> > +   int use_def_burst_func =
> > +           check_rx_burst_bulk_alloc_preconditions(rxq);
> > +   uint16_t buf_size =
> > +           (uint16_t)(rte_pktmbuf_data_room_size(rxq->mp) -
> > +                      RTE_PKTMBUF_HEADROOM);
> > +   int use_scattered_rx =
> > +           ((rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) > buf_size) ?
> > +                   1 : 0;
> 
> As a nit:
> int use_scattered_rx = ((rxq->max_pkt_len + 2 * I40E_VLAN_TAG_SIZE) >
> buf_size); would do exactly the same.
> 
> > +
> > +   if (i40e_rx_queue_init(rxq) != 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 = true;
> > +           ad->rx_vec_allowed = true;
> > +           dev->data->scattered_rx = use_scattered_rx;
> > +           if (use_def_burst_func)
> > +                   ad->rx_bulk_alloc_allowed = 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 = 0; i < dev->data->nb_rx_queues; i++) {
> > +           if (i != 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.

Thanks for capture this, will fix.

> Konstantin

Reply via email to