From: Ferruh Yigit Subject: Re: [PATCH 3/8] net/bnxt: add support for rx_descriptor_status Date: Tue, 29 Aug 2017 17:11:06 +0100 Message-ID: <9eb94fb3-6898-7ccf-95da-143f17bcb27b@intel.com> References: <20170824162956.62761-1-ajit.khaparde@broadcom.com> <20170824162956.62761-5-ajit.khaparde@broadcom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: Ajit Khaparde , dev@dpdk.org Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 11ED83798 for ; Tue, 29 Aug 2017 18:11:08 +0200 (CEST) In-Reply-To: <20170824162956.62761-5-ajit.khaparde@broadcom.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 8/24/2017 5:29 PM, Ajit Khaparde wrote: > add support for rx_descriptor_status dev_op > Signed-off-by: Ajit Khaparde <...> > +static int > +bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset) > +{ > + struct bnxt_rx_queue *rxq = (struct bnxt_rx_queue *)rx_queue; > + struct bnxt_cp_ring_info *cpr; > + struct rx_pkt_cmpl *rxcmp; > + uint32_t cons; > + > + if (!rxq) > + return -EINVAL; > + > + cpr = rxq->cp_ring; > + > + if (offset >= rxq->nb_rx_desc) > + return -EINVAL; > + > + cons = RING_CMP(cpr->cp_ring_struct, offset); > + rxcmp = (struct rx_pkt_cmpl *)&cpr->cp_desc_ring[cons]; > + > + if (CMP_VALID(rxcmp, offset, cpr->cp_ring_struct)) > + return RTE_ETH_RX_DESC_DONE; > + > + return RTE_ETH_RX_DESC_AVAIL; Do we need a check to be sure if descriptor is available. Is PMD using rx_free_thresh? If so descriptor can be in a state that packet parsed by software but descriptor not freed yet: RTE_ETH_RX_DESC_UNAVAIL > +} <...>