[dpdk-stable] [PATCH] ethdev: keep count of allocated and used representor ranges

Viacheslav Galaktionov Viacheslav.Galaktionov at oktetlabs.ru
Sat Jul 3 12:01:19 CEST 2021


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?


More information about the stable mailing list