[dpdk-stable] [PATCH] ethdev: keep count of allocated and used representor ranges
Xueming(Steven) Li
xuemingl at nvidia.com
Mon Jul 5 04:50:32 CEST 2021
> -----Original Message-----
> From: Viacheslav Galaktionov <Viacheslav.Galaktionov at oktetlabs.ru>
> Sent: Saturday, July 3, 2021 6:01 PM
> To: Xueming(Steven) Li <xuemingl at nvidia.com>
> Cc: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>; Matan Azrad <matan at nvidia.com>; Shahaf Shuler
> <shahafs at nvidia.com>; Slava Ovsiienko <viacheslavo at nvidia.com>; NBU-Contact-Thomas Monjalon <thomas at monjalon.net>;
> Ferruh Yigit <ferruh.yigit at intel.com>; dev at dpdk.org; stable at dpdk.org
> Subject: Re: [PATCH] ethdev: keep count of allocated and used representor ranges
>
> Hello!
>
> On 2021-07-03 04:32, Xueming(Steven) Li wrote:
> >> + if (i == n_entries)
> >> + break;
> >> }
> >> out:
> >> + info->nb_ranges = i;
> >
> > Here info maybe NULL.
>
> Good catch, thanks for noticing!
>
> >> faf3bd901d..d2b27c351f 100644
> >> --- a/lib/ethdev/rte_ethdev.h
> >> +++ b/lib/ethdev/rte_ethdev.h
> >> @@ -4856,6 +4856,8 @@ struct rte_eth_representor_range { struct
> >> rte_eth_representor_info {
> >> uint16_t controller; /**< Controller ID of caller device. */
> >> uint16_t pf; /**< Physical function ID of caller device. */
> >> + uint32_t nb_ranges_alloc; /**< Size of the ranges array. */
> >> + uint32_t nb_ranges; /**< Number of initialized ranges. */
> >
> > How about rte_eth_representor_info_get(info) return max ranges size if
> > info is NULL, return real initialized ranges if info not NULL?
>
> I'm not sure how I feel about it. I think it'd be best if the function returned just one thing.
>
> Moreover, there are drivers that don't have a fixed structure for representor IDs, e.g. net/sfc, where every range will contain a single
> ID. If a new representor range is created between invocations of this function, there probably should be a way for the caller to know
> about this.
>
> Perhaps we should move the total number of representors to an out parameter and use the return value for the number of initialized
> ranges. What do you think about this?
No big difference, I'm ok with your original design.
More information about the stable
mailing list