Re: [PATCHv3 net-next] net: dsa: use ethtool string helpers
From: Simon Horman
Date: Fri Oct 25 2024 - 05:22:56 EST
On Thu, Oct 24, 2024 at 12:52:38PM -0700, Rosen Penev wrote:
> These are the preferred way to copy ethtool strings.
>
> Avoids incrementing pointers all over the place.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> Reviewed-by: Kurt Kanzenbach <kurt@xxxxxxxxxxxxx>
> ---
> v3: remove curly braces from ksz_common.c
> v2: remove curly braces from rzn1_a5psw.c
...
> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
> index 9201f07839ad..2bb1832d21bc 100644
> --- a/drivers/net/dsa/bcm_sf2.c
> +++ b/drivers/net/dsa/bcm_sf2.c
> @@ -1180,11 +1180,8 @@ static const struct b53_io_ops bcm_sf2_io_ops = {
> static void bcm_sf2_sw_get_strings(struct dsa_switch *ds, int port,
> u32 stringset, uint8_t *data)
> {
> - int cnt = b53_get_sset_count(ds, port, stringset);
> -
> b53_get_strings(ds, port, stringset, data);
Do you need to update b53_get_strings() so that you pass &data
rather than data? Otherwise, doesn't the call to bcm_sf2_cfp_get_strings()
overwrite what has been written by bcm_sf2_cfp_get_strings() ?
> - bcm_sf2_cfp_get_strings(ds, port, stringset,
> - data + cnt * ETH_GSTRING_LEN);
> + bcm_sf2_cfp_get_strings(ds, port, stringset, data);
> }
>
...