[PATCH v4 15/16] net/nbl: add nbl device xstats and stats
Stephen Hemminger
stephen at networkplumber.org
Wed Aug 13 16:27:39 CEST 2025
On Wed, 13 Aug 2025 15:48:29 +0400 (+04)
Ivan Malov <ivan.malov at arknetworks.am> wrote:
> > +static int nbl_dev_update_hw_xstats(struct nbl_dev_mgt *dev_mgt, struct rte_eth_xstat *xstats,
> > + u16 hw_xstats_cnt, u16 *xstats_cnt)
> > +{
> > + struct nbl_common_info *common = NBL_DEV_MGT_TO_COMMON(dev_mgt);
> > + struct nbl_dispatch_ops *disp_ops = NBL_DEV_MGT_TO_DISP_OPS(dev_mgt);
> > + u64 *hw_stats;
> > + int i;
> > + u16 count = *xstats_cnt;
> > +
> > + hw_stats = rte_zmalloc("nbl_xstats_cnt", hw_xstats_cnt * sizeof(u64), 0);
>
> Do you believe it's the best course of action, to allocate and free a bounce
> buffer on each invocation? This function is not strictly fast-path, but I'd say
> semi-fast. Some applications may want to invoke it pretty often.
Unless the buffer is shared with another process, better to use regular malloc
or alloca for this. Using rte_malloc() is slower, and requires use of huge pages
when not needed.
More information about the dev
mailing list