[dpdk-dev] [PATCH v2 10/14] net/octeontx2: switch timestamp to dynamic mbuf field

Thomas Monjalon thomas at monjalon.net
Mon Nov 2 10:38:33 CET 2020


01/11/2020 19:28, Jerin Jacob:
> On Sun, Nov 1, 2020 at 11:40 PM Thomas Monjalon <thomas at monjalon.net> 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 <thomas at monjalon.net>
> > ---
[...]
> > +uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag;
> > +int rte_pmd_octeontx2_timestamp_dynfield_offset = -1;
> 
> Instead of the global variable, please move the offset to struct
> otx2_timesync_info(which is used in fastpath) and accessible in slow
> path.

This structure is initialized in otx2_nix_dev_start().
otx2_rx_timestamp_setup() is called earlier in otx2_nix_configure().
One of the two has to change. Which one?

> > +static int
> > +otx2_rx_timestamp_setup(uint16_t flags)
> > +{
> > +       int timestamp_rx_dynflag_offset;
> > +
> > +       if ((flags & NIX_RX_OFFLOAD_TSTAMP_F) == 0)
> > +               return 0;
> > +
> > +       rte_pmd_octeontx2_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup(
> > +                       RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL);
> > +       if (rte_pmd_octeontx2_timestamp_dynfield_offset < 0) {
> > +               otx2_err("Failed to lookup timestamp field");
> > +               return -rte_errno;
> > +       }
> > +       timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup(
> > +                       RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL);
> > +       if (timestamp_rx_dynflag_offset < 0) {
> > +               otx2_err("Failed to lookup Rx timestamp flag");
> > +               return -rte_errno;
> > +       }
> > +       rte_pmd_octeontx2_timestamp_rx_dynflag =
> > +                       RTE_BIT64(timestamp_rx_dynflag_offset);
> > +
> > +       return 0;
> > +}
> > @@ -1874,6 +1904,9 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev)
> >         dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev);
> >         dev->rss_info.rss_grps = NIX_RSS_GRPS;
> >
> > +       if (otx2_rx_timestamp_setup(dev->rx_offload_flags) != 0)
> > +               goto fail_offloads;
> > +
> >         nb_rxq = RTE_MAX(data->nb_rx_queues, 1);
> >         nb_txq = RTE_MAX(data->nb_tx_queues, 1);





More information about the dev mailing list