Hi, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com] > Sent: Tuesday, June 14, 2016 9:02 PM > To: Pattan, Reshma <reshma.pattan at intel.com> > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH v9 2/8] ethdev: add new api to add Rx callback > as head of the list > > 2016-06-14 10:38, Reshma Pattan: > > Added new public api rte_eth_add_first_rx_callback to add given > > callback as head of the list. > > > > Signed-off-by: Reshma Pattan <reshma.pattan at intel.com> > > --- > > +/* > > +* Add a callback that must be called first on packet RX on a given > > +port > > +* and queue. > > +* > > +* This API configures a first function to be called for each burst of > > +* packets received on a given NIC port queue. The return value is a > > +pointer > > +* that can be used to later remove the callback using > > +* rte_eth_remove_rx_callback(). > > +* > > +* Multiple functions are called in the order that they are added. > > +* > > +* @param port_id > > +* The port identifier of the Ethernet device. > > +* @param queue_id > > +* The queue on the Ethernet device on which the callback is to be added. > > +* @param fn > > +* The callback function > > +* @param user_param > > +* A generic pointer parameter which will be passed to each invocation of > the > > +* callback function on this port and queue. > > +* > > +* @return > > +* NULL on error. > > +* On success, a pointer value which can later be used to remove the > callback. > > +*/ > > +void *rte_eth_add_first_rx_callback(uint8_t port_id, uint16_t queue_id, > > + rte_rx_callback_fn fn, void *user_param); > > Sorry I fail to understand why this function is needed. > What cannot be done in rte_eth_add_rx_callback?
Packet capturing framework should display Rx packets of NIC even before they are being processed by other callbacks of the application (because other callback s of application may change the packet data as part of the processing). So packet capturing framework should register a callback at the head of the Rx callback list so that callback always gets called first before any other callbacks of the applications. Hence this API is introduced. Thanks, Reshma