[dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new library for packet capturing support

Pattan, Reshma reshma.pattan at intel.com
Tue May 31 16:55:07 CEST 2016



> -----Original Message-----
> From: Ananyev, Konstantin
> Sent: Friday, May 27, 2016 4:26 PM
> To: Pattan, Reshma <reshma.pattan at intel.com>; dev at dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new library for
> packet capturing support
> 
> 
> 
> > -----Original Message-----
> > From: Pattan, Reshma
> > Sent: Friday, May 27, 2016 3:55 PM
> > To: Ananyev, Konstantin; dev at dpdk.org
> > Cc: Pattan, Reshma
> > Subject: RE: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new
> > library for packet capturing support
> >
> >
> >
> > > -----Original Message-----
> > > From: Ananyev, Konstantin
> > > Sent: Friday, May 27, 2016 2:39 PM
> > > To: Pattan, Reshma <reshma.pattan at intel.com>; dev at dpdk.org
> > > Cc: Pattan, Reshma <reshma.pattan at intel.com>
> > > Subject: RE: [dpdk-dev] [PATCH v4 5/9] lib/librte_pdump: add new
> > > library for packet capturing support
> > >
> > > Hi Reshma,
> >
> > > > +static int
> > > > +pdump_regitser_callbacks(uint32_t dir, uint16_t end_q,
> > > > +			uint8_t port, uint16_t queue,
> > > > +			struct rte_ring *ring, struct rte_mempool *mp,
> > > > +			uint16_t operation)
> > > > +{
> > > > +
> > > > +	uint16_t qid;
> > > > +	struct pdump_rxtx_cbs *cbs = NULL;
> > > > +
> > > > +	qid = (queue == RTE_PDUMP_ALL_QUEUES) ? 0 : queue;
> > > > +	for (; qid < end_q; qid++) {
> > > > +		if ((dir & RTE_PDUMP_FLAG_RX) != 0)
> > > > +			cbs = &rx_cbs[port][qid];
> > > > +		if ((dir & RTE_PDUMP_FLAG_TX) != 0)
> > > > +			cbs = &tx_cbs[port][qid];
> > >
> > > In case you have dir == (RTE_PDUMP_FLAG_RX | RTE_PDUMP_FLAG_TX)
> > > you'll overwrite your rx_cbs pointer with tx_cbs pointer.
> > > I suppose you need 2 local vars: cbs_rx and cbs_tx here.
> > > Again probably worth to have 2 helper functions:
> > > pdump_regitser_rx_callback() and pdump_regitser_tx_callback() and
> > > call them from that one.
> > > Or you'll never invoke that function with dir ==(RTE_PDUMP_FLAG_RX |
> > > RTE_PDUMP_FLAG_TX)?
> > > If so, it porbably worth to put it into comments, though if it would
> > > be me, I still think it would be good to split it in a way I mentioned above.
> > >
> >
> > Yes,  I never invoke the function with dir ==(RTE_PDUMP_FLAG_RX |
> RTE_PDUMP_FLAG_TX).
> 
> Ok, then at least probably comment it somehow.
> Though I still think 2 different variables (and might be functions) would be
> better.
> 
> >

Ok, I will add a comment.

Thanks,
Reshma


More information about the dev mailing list