From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v6 03/13] mbuf: add accessors to get data room size and private size Date: Tue, 28 Apr 2015 11:15:23 +0200 Message-ID: <1741418.9S7PXYUXiU@xps13> References: <1429610122-30943-1-git-send-email-olivier.matz@6wind.com> <1429696650-9043-1-git-send-email-olivier.matz@6wind.com> <1429696650-9043-4-git-send-email-olivier.matz@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: dev-VfR2kkLFssw@public.gmane.org To: Olivier Matz Return-path: In-Reply-To: <1429696650-9043-4-git-send-email-olivier.matz-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 2015-04-22 11:57, Olivier Matz: > This code retrieving the pool private area is duplicated in many > places, we can use of function for it. >=20 > Signed-off-by: Olivier Matz > Acked-by: Neil Horman [...] > --- a/lib/librte_pmd_pcap/rte_eth_pcap.c > +++ b/lib/librte_pmd_pcap/rte_eth_pcap.c > @@ -136,9 +136,7 @@ eth_pcap_rx(void *queue, > =09const u_char *packet; > =09struct rte_mbuf *mbuf; > =09struct pcap_rx_queue *pcap_q =3D queue; > -=09struct rte_pktmbuf_pool_private *mbp_priv; > =09uint16_t num_rx =3D 0; > -=09uint16_t buf_size; > =20 > =09if (unlikely(pcap_q->pcap =3D=3D NULL || nb_pkts =3D=3D 0)) > =09=09return 0; > @@ -157,8 +155,7 @@ eth_pcap_rx(void *queue, > =09=09=09break; > =20 > =09=09/* Now get the space available for data in the mbuf */ > -=09=09mbp_priv =3D rte_mempool_get_priv(pcap_q->mb_pool); > -=09=09buf_size =3D (uint16_t) (mbp_priv->mbuf_data_room_size - > +=09=09buf_size =3D (uint16_t)(rte_pktmbuf_data_room_size(pcap_q->mb_= pool) - > =09=09=09=09RTE_PKTMBUF_HEADROOM); > =20 > =09=09if (header.len <=3D buf_size) { It doesn't compile because buf_size is removed by error: lib/librte_pmd_pcap/rte_eth_pcap.c: In function =E2=80=98eth_pcap_rx=E2= =80=99: lib/librte_pmd_pcap/rte_eth_pcap.c:158:3: error: =E2=80=98buf_size=E2=80= =99 undeclared (first use in this function) I fix it while applying patches.