From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 65738683E for ; Thu, 6 Dec 2018 06:39:58 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2018 21:39:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,321,1539673200"; d="scan'208";a="123412149" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 05 Dec 2018 21:39:57 -0800 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 21:39:57 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 21:39:56 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.182]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.46]) with mapi id 14.03.0415.000; Thu, 6 Dec 2018 13:39:54 +0800 From: "Lu, Wenzhuo" To: "Varghese, Vipin" , "dev@dpdk.org" CC: "Yang, Qiming" , "Li, Xiaoyun" , "Wu, Jingjing" Thread-Topic: [dpdk-dev] [PATCH v2 16/20] net/ice: support basic RX/TX Thread-Index: AQHUitZBeP1aHlsx2UeuczxCUCeZ26VtjH6AgAOpqoA= Date: Thu, 6 Dec 2018 05:39:54 +0000 Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093FE1171D@shsmsx102.ccr.corp.intel.com> References: <1542956179-80951-1-git-send-email-wenzhuo.lu@intel.com> <1543820821-108122-1-git-send-email-wenzhuo.lu@intel.com> <1543820821-108122-17-git-send-email-wenzhuo.lu@intel.com> <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D2C45D8@BGSMSX101.gar.corp.intel.com> In-Reply-To: <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D2C45D8@BGSMSX101.gar.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 16/20] net/ice: support basic RX/TX 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: Thu, 06 Dec 2018 05:39:59 -0000 Hi Vipin, > -----Original Message----- > From: Varghese, Vipin > Sent: Tuesday, December 4, 2018 1:42 PM > To: Lu, Wenzhuo ; dev@dpdk.org > Cc: Lu, Wenzhuo ; Yang, Qiming > ; Li, Xiaoyun ; Wu, Jingjing > > Subject: RE: [dpdk-dev] [PATCH v2 16/20] net/ice: support basic RX/TX >=20 > snipped > > +uint16_t > > +ice_recv_pkts(void *rx_queue, > > + struct rte_mbuf **rx_pkts, > > + uint16_t nb_pkts) > > +{ > > + struct ice_rx_queue *rxq =3D rx_queue; > > + volatile union ice_rx_desc *rx_ring =3D rxq->rx_ring; > > + volatile union ice_rx_desc *rxdp; > > + union ice_rx_desc rxd; > > + struct ice_rx_entry *sw_ring =3D rxq->sw_ring; > > + struct ice_rx_entry *rxe; > > + struct rte_mbuf *nmb; /* new allocated mbuf */ > > + struct rte_mbuf *rxm; /* pointer to store old mbuf in SW ring */ > > + uint16_t rx_id =3D rxq->rx_tail; > > + uint16_t nb_rx =3D 0; > > + uint16_t nb_hold =3D 0; > > + uint16_t rx_packet_len; > > + uint32_t rx_status; > > + uint64_t qword1; > > + uint64_t dma_addr; > > + uint64_t pkt_flags =3D 0; > > + uint32_t *ptype_tbl =3D rxq->vsi->adapter->ptype_tbl; > > + struct rte_eth_dev *dev; > > + > > + while (nb_rx < nb_pkts) { > > + rxdp =3D &rx_ring[rx_id]; > > + qword1 =3D rte_le_to_cpu_64(rxdp- > > >wb.qword1.status_error_len); > > + rx_status =3D (qword1 & ICE_RXD_QW1_STATUS_M) >> > > + ICE_RXD_QW1_STATUS_S; > > + > > + /* Check the DD bit first */ > > + if (!(rx_status & (1 << ICE_RX_DESC_STATUS_DD_S))) > > + break; > > + > > + /* allocate mbuf */ > > + nmb =3D rte_mbuf_raw_alloc(rxq->mp); > > + if (unlikely(!nmb)) { > > + dev =3D ICE_VSI_TO_ETH_DEV(rxq->vsi); > > + dev->data->rx_mbuf_alloc_failed++; > > + break; > > + } >=20 > Should we check if the received packet length is greater than mbug pkt_le= n > then we need bulk alloc with n_segs? We cannot do it here. It's fast path. It hurts performance badly. So we do = the check before and choose the right RX function. Normally by default the n_segs is supported. >=20 > > + rxd =3D *rxdp; /* copy descriptor in ring to temp variable*/ > > + > > + nb_hold++; > > + rxe =3D &sw_ring[rx_id]; /* get corresponding mbuf in SW ring > */ > > + rx_id++; > > + if (unlikely(rx_id =3D=3D rxq->nb_rx_desc)) > > + rx_id =3D 0; > > + rxm =3D rxe->mbuf; > > + rxe->mbuf =3D nmb; > > + dma_addr =3D > > + > rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb)); > > + > > + /** > > + * fill the read format of descriptor with physic address in > > + * new allocated mbuf: nmb > > + */ > > + rxdp->read.hdr_addr =3D 0; > > + rxdp->read.pkt_addr =3D dma_addr; > > + > > + /* calculate rx_packet_len of the received pkt */ > > + rx_packet_len =3D ((qword1 & ICE_RXD_QW1_LEN_PBUF_M) >> > > + ICE_RXD_QW1_LEN_PBUF_S) - rxq->crc_len; > > + > > + /* fill old mbuf with received descriptor: rxd */ > > + rxm->data_off =3D RTE_PKTMBUF_HEADROOM; > > + rte_prefetch0(RTE_PTR_ADD(rxm->buf_addr, > > RTE_PKTMBUF_HEADROOM)); > > + rxm->nb_segs =3D 1; >=20 > Same comment for above for multi segment alloc for larger packets or > smaller pkt_len in mempool? >=20 > Snipped