> -----Original Message-----
> From: Wang, Xiao W
> Sent: Tuesday, January 16, 2018 7:03 PM
> To: 'Olivier Matz' <olivier.m...@6wind.com>
> Cc: y...@fridaylinux.org; tho...@monjalon.net; Bie, Tiwei
> <tiwei....@intel.com>; dev@dpdk.org; step...@networkplumber.org;
> maxime.coque...@redhat.com
> Subject: RE: [dpdk-dev] [PATCH v10 3/5] net: add a helper for making RARP
> packet
> 
> Hi Olivier,
> 
> > -----Original Message-----
> > From: Olivier Matz [mailto:olivier.m...@6wind.com]
> > Sent: Tuesday, January 16, 2018 6:43 PM
> > To: Wang, Xiao W <xiao.w.w...@intel.com>
> > Cc: y...@fridaylinux.org; tho...@monjalon.net; Bie, Tiwei
> > <tiwei....@intel.com>; dev@dpdk.org; step...@networkplumber.org;
> > maxime.coque...@redhat.com
> > Subject: Re: [dpdk-dev] [PATCH v10 3/5] net: add a helper for making RARP
> > packet
> >
> > Hi Xiao,
> >
> > On Tue, Jan 16, 2018 at 09:43:43AM +0000, Wang, Xiao W wrote:
> > > Hi Olivier,
> > > > You can also use rte_pktmbuf_append() to check for the tailroom and
> > > > update data_len/pkt_len:
> > > >
> > > >         m = rte_pktmbuf_alloc();
> 
> I just realized that if we let this function to allocate mbuf, it may 
> restrict this
> api's applicability.
> E.g. the caller just has a mbuf, without a mempool.
> How do you think?
> 
> > > >         if (m == NULL)
> > > >                 return NULL;
> > > >         eth_hdr = rte_pktmbuf_append(m, RARP_PKT_SIZE);
> > >
> > > When data_len is not enough, we need to rte_pktmbuf_append(m,
> > RARP_PKT_SIZE - m->data_len);
> >
> > Sorry, I don't get your point here.
> 
> I mean we just need to extend the data_len by "RARP_PKT_SIZE - m-
> >data_len" when the room is not big enough.

OK, in your sample code, you rte_pktmbuf_alloc() a mbuf, it's reset already, so 
we just append RARP_PKT_SIZE. I got you~

For the mbuf allocation, we can let this function do allocation and content 
filling. If the app needs special need, e.g. chained mbuf,
then let the app fill it by itself.

> 
> BRs,
> Xiao

Reply via email to