* [PATCH] ethdev: fix get_reg_info
@ 2025-02-18 11:58 Thierry Herbelot
2025-02-19 18:45 ` Stephen Hemminger
2025-03-07 9:40 ` fengchengwen
0 siblings, 2 replies; 5+ messages in thread
From: Thierry Herbelot @ 2025-02-18 11:58 UTC (permalink / raw)
To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, stable
'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@dpdk.org
Signed-off-by: Thierry Herbelot <thierry.herbelot@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;
reg_info.data = info->data;
ret = rte_eth_dev_get_reg_info_ext(port_id, ®_info);
--
2.39.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethdev: fix get_reg_info
2025-02-18 11:58 [PATCH] ethdev: fix get_reg_info Thierry Herbelot
@ 2025-02-19 18:45 ` Stephen Hemminger
2025-03-06 16:36 ` Thomas Monjalon
2025-03-07 9:33 ` fengchengwen
2025-03-07 9:40 ` fengchengwen
1 sibling, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2025-02-19 18:45 UTC (permalink / raw)
To: Thierry Herbelot; +Cc: dev, Thomas Monjalon, stable
On Tue, 18 Feb 2025 12:58:28 +0100
Thierry Herbelot <thierry.herbelot@6wind.com> 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@dpdk.org
>
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Why does the ethdev code create an on stack temporary variable.
Looks like it only wants to make sure that names element is NULL.
Really should be one function and when extended fields were added
should have used API versioning.
Probably too late now, although rte_eth_dev_get_reg_info_ext()
is an experimental API.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethdev: fix get_reg_info
2025-02-19 18:45 ` Stephen Hemminger
@ 2025-03-06 16:36 ` Thomas Monjalon
2025-03-07 9:33 ` fengchengwen
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2025-03-06 16:36 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Thierry Herbelot, dev, stable
19/02/2025 19:45, Stephen Hemminger:
> On Tue, 18 Feb 2025 12:58:28 +0100
> Thierry Herbelot <thierry.herbelot@6wind.com> 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@dpdk.org
> >
> > Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
>
> Why does the ethdev code create an on stack temporary variable.
> Looks like it only wants to make sure that names element is NULL.
>
> Really should be one function and when extended fields were added
> should have used API versioning.
> Probably too late now, although rte_eth_dev_get_reg_info_ext()
> is an experimental API.
If it is experimental, the function can be dropped in favour of a better versioned function.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethdev: fix get_reg_info
2025-02-19 18:45 ` Stephen Hemminger
2025-03-06 16:36 ` Thomas Monjalon
@ 2025-03-07 9:33 ` fengchengwen
1 sibling, 0 replies; 5+ messages in thread
From: fengchengwen @ 2025-03-07 9:33 UTC (permalink / raw)
To: Stephen Hemminger, Thierry Herbelot; +Cc: dev, Thomas Monjalon, stable
On 2025/2/20 2:45, Stephen Hemminger wrote:
> On Tue, 18 Feb 2025 12:58:28 +0100
> Thierry Herbelot <thierry.herbelot@6wind.com> 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@dpdk.org
>>
>> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
>
> Why does the ethdev code create an on stack temporary variable.
> Looks like it only wants to make sure that names element is NULL.
It mainly for ABI compatibility.
The original solution is to add an ext API (rte_eth_dev_get_reg_info_ext) and deprecate the original API (rte_eth_dev_get_reg_info).
>
> Really should be one function and when extended fields were added
> should have used API versioning.
> Probably too late now, although rte_eth_dev_get_reg_info_ext()
> is an experimental API.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ethdev: fix get_reg_info
2025-02-18 11:58 [PATCH] ethdev: fix get_reg_info Thierry Herbelot
2025-02-19 18:45 ` Stephen Hemminger
@ 2025-03-07 9:40 ` fengchengwen
1 sibling, 0 replies; 5+ messages in thread
From: fengchengwen @ 2025-03-07 9:40 UTC (permalink / raw)
To: Thierry Herbelot, dev; +Cc: Thomas Monjalon, stable
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@dpdk.org
>
> Signed-off-by: Thierry Herbelot <thierry.herbelot@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, ®_info);
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-07 9:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-18 11:58 [PATCH] ethdev: fix get_reg_info Thierry Herbelot
2025-02-19 18:45 ` Stephen Hemminger
2025-03-06 16:36 ` Thomas Monjalon
2025-03-07 9:33 ` fengchengwen
2025-03-07 9:40 ` fengchengwen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).