On Tue, Nov 03, 2020 at 01:13:59AM +0100, Thomas Monjalon wrote: > The mbuf timestamp is moved to a dynamic field > in order to allow removal of the deprecated static field. > The related mbuf flag is also replaced. > > Signed-off-by: Thomas Monjalon <tho...@monjalon.net> > --- > drivers/net/nfb/nfb_rx.c | 15 ++++++++++++++- > drivers/net/nfb/nfb_rx.h | 18 ++++++++++++++---- > 2 files changed, 28 insertions(+), 5 deletions(-)
<...> > index cf3899b2fb..e548226e0f 100644 > --- a/drivers/net/nfb/nfb_rx.h > +++ b/drivers/net/nfb/nfb_rx.h > @@ -15,6 +15,16 @@ > > #define NFB_TIMESTAMP_FLAG (1 << 0) > > +extern uint64_t nfb_timestamp_rx_dynflag; > +extern int nfb_timestamp_dynfield_offset; > + > +static inline rte_mbuf_timestamp_t * > +nfb_timestamp_dynfield(struct rte_mbuf *mbuf) > +{ > + return RTE_MBUF_DYNFIELD(mbuf, > + nfb_timestamp_dynfield_offset, rte_mbuf_timestamp_t *); > +} > + > struct ndp_rx_queue { > struct nfb_device *nfb; /* nfb dev structure */ > struct ndp_queue *queue; /* rx queue */ > @@ -191,15 +201,15 @@ nfb_eth_ndp_rx(void *queue, > > if (timestamping_enabled) { > /* nanoseconds */ > - mbuf->timestamp = > + *nfb_timestamp_dynfield(mbuf) = > rte_le_to_cpu_32(*((uint32_t *) > (packets[i].header + 4))); > - mbuf->timestamp <<= 32; > + *nfb_timestamp_dynfield(mbuf) <<= 32; > /* seconds */ > - mbuf->timestamp |= > + *nfb_timestamp_dynfield(mbuf) |= > rte_le_to_cpu_32(*((uint32_t *) > (packets[i].header + 8))); > - mbuf->ol_flags |= PKT_RX_TIMESTAMP; > + mbuf->ol_flags |= nfb_timestamp_rx_dynflag; > } > > bufs[num_rx++] = mbuf; I think it would be better with a local variable.