[PATCH] ethdev: fix get_reg_info

fengchengwen fengchengwen at huawei.com
Fri Mar 7 10:40:17 CET 2025


On 2025/2/18 19:58, Thierry Herbelot wrote:
> 'width' and 'offset' are input parameters when dumping the register
> info of an Ethernet device. They should be copied in the new request
> before calling the device callback function.
> 
> Fixes: 083db2ed9e9 ('ethdev: add report of register names and filter')
> Cc: stable at dpdk.org
> 
> Signed-off-by: Thierry Herbelot <thierry.herbelot at 6wind.com>
> ---
>  lib/ethdev/rte_ethdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 6413c54e3b39..073a3bcf5c0b 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -6511,6 +6511,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
>  	}
>  
>  	reg_info.length = info->length;
> +	reg_info.width = info->width;
> +	reg_info.offset = info->offset;

I think there are ambiguities in the original API definition:
1) the width was used as an output parameter in current all PMD impl.
2) the offset was unused in current all PMD impl.

But maybe other non-opensource PMD will use these two field.
So I think it's OK to copy the two fields (maybe another field "version") before invoke _ext API.

>  	reg_info.data = info->data;
>  
>  	ret = rte_eth_dev_get_reg_info_ext(port_id, &reg_info);



More information about the dev mailing list