Hi Olivier, > -----Original Message----- > From: Olivier Matz [mailto:olivier.m...@6wind.com] > Sent: Thursday, March 2, 2017 10:47 PM > To: Lu, Wenzhuo > Cc: dev@dpdk.org; thomas.monja...@6wind.com; Ananyev, Konstantin; Zhang, > Helin; Wu, Jingjing; adrien.mazarg...@6wind.com; nelio.laranje...@6wind.com; > Yigit, Ferruh; Richardson, Bruce > Subject: Re: [PATCH 4/6] net/e1000: implement descriptor status API (em) > > Hi Wenzhuo, > > On Thu, 2 Mar 2017 01:22:25 +0000, "Lu, Wenzhuo" <wenzhuo...@intel.com> > wrote: > > Hi Oliver, > > > > > -----Original Message----- > > > From: Olivier Matz [mailto:olivier.m...@6wind.com] > > > Sent: Thursday, March 2, 2017 1:19 AM > > > To: dev@dpdk.org; thomas.monja...@6wind.com; Ananyev, Konstantin; > > > Lu, Wenzhuo; Zhang, Helin; Wu, Jingjing; adrien.mazarg...@6wind.com; > > > nelio.laranje...@6wind.com > > > Cc: Yigit, Ferruh; Richardson, Bruce > > > Subject: [PATCH 4/6] net/e1000: implement descriptor status API (em) > > > > > > Signed-off-by: Olivier Matz <olivier.m...@6wind.com> > > > +int > > > +eth_em_tx_descriptor_status(struct rte_eth_dev *dev, uint16_t > tx_queue_id, > > > + uint16_t offset) > > > +{ > > > + volatile uint8_t *status; > > > + struct em_tx_queue *txq; > > > + uint32_t desc; > > > + > > > + txq = dev->data->tx_queues[tx_queue_id]; > > > + if (unlikely(offset >= txq->nb_tx_desc)) > > > + return -EINVAL; > > > + > > > + desc = txq->tx_tail + offset; > > > + /* go to next desc that has the RS bit */ > > > + desc = ((desc + txq->tx_rs_thresh - 1) / txq->tx_rs_thresh) * > > > + txq->tx_rs_thresh; > > The descriptor may be changed here. So the return value may not be for the > offset one. Why? > > Yes, desc index can change. From what I understand, the "descriptor done" (DD) > bit is only set on descriptors which are flagged with the "report status" > (RS) bit. Yes, you're right. Sorry for the noise :)
> > Here is an example from: > http://www.dpdk.org/ml/archives/dev/2016-November/050679.html > > |----------------------------------------------------------------| > | D R R R | > | ............xxxxxxxxxxxxxxxxxxxxxxxxx | > | <descs sent><- descs not sent yet -> | > | ............xxxxxxxxxxxxxxxxxxxxxxxxx | > |----------------------------------------------------------------| > ^last_desc_cleaned=8 ^next_rs=47 > ^next_dd=15 ^tail=45 > ^hw_head=20 > > <---- nb_used ---------> > > The hardware is currently processing the descriptor 20 'R' means the > descriptor > has the RS bit 'D' means the descriptor has the DD + RS bits 'x' are packets > in txq > (not sent) '.' are packet already sent but not freed by sw > > > Regards, > Olivier