From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH 4/6] net/e1000: implement descriptor status API (em) Date: Thu, 2 Mar 2017 15:46:49 +0100 Message-ID: <20170302154649.6488c40c@platinum> References: <1479981261-19512-1-git-send-email-olivier.matz@6wind.com> <1488388752-1819-1-git-send-email-olivier.matz@6wind.com> <1488388752-1819-5-git-send-email-olivier.matz@6wind.com> <6A0DE07E22DDAD4C9103DF62FEBC09093B569F66@shsmsx102.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "dev@dpdk.org" , "thomas.monjalon@6wind.com" , "Ananyev, Konstantin" , "Zhang, Helin" , "Wu, Jingjing" , "adrien.mazarguil@6wind.com" , "nelio.laranjeiro@6wind.com" , "Yigit, Ferruh" , "Richardson, Bruce" To: "Lu, Wenzhuo" Return-path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id C31612B88 for ; Thu, 2 Mar 2017 15:46:54 +0100 (CET) Received: by mail-wm0-f53.google.com with SMTP id n11so26984487wma.0 for ; Thu, 02 Mar 2017 06:46:54 -0800 (PST) In-Reply-To: <6A0DE07E22DDAD4C9103DF62FEBC09093B569F66@shsmsx102.ccr.corp.intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Wenzhuo, On Thu, 2 Mar 2017 01:22:25 +0000, "Lu, Wenzhuo" wrote: > Hi Oliver, > > > -----Original Message----- > > From: Olivier Matz [mailto:olivier.matz@6wind.com] > > Sent: Thursday, March 2, 2017 1:19 AM > > To: dev@dpdk.org; thomas.monjalon@6wind.com; Ananyev, Konstantin; Lu, > > Wenzhuo; Zhang, Helin; Wu, Jingjing; adrien.mazarguil@6wind.com; > > nelio.laranjeiro@6wind.com > > Cc: Yigit, Ferruh; Richardson, Bruce > > Subject: [PATCH 4/6] net/e1000: implement descriptor status API (em) > > > > Signed-off-by: Olivier Matz > > +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. Here is an example from: http://www.dpdk.org/ml/archives/dev/2016-November/050679.html |----------------------------------------------------------------| | D R R R | | ............xxxxxxxxxxxxxxxxxxxxxxxxx | | <- 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