lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c9afb23-fcf8-4401-af06-4a0b2dcbb135@intel.com>
Date: Fri, 25 Oct 2024 06:06:06 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Rosen Penev <rosenp@...il.com>, Tony Nguyen <anthony.l.nguyen@...el.com>
CC: <netdev@...r.kernel.org>, Andrew Lunn <andrew+netdev@...n.ch>, "David S.
 Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, "Jakub
 Kicinski" <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Alexei
 Starovoitov" <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
	"Jesper Dangaard Brouer" <hawk@...nel.org>, John Fastabend
	<john.fastabend@...il.com>, "moderated list:INTEL ETHERNET DRIVERS"
	<intel-wired-lan@...ts.osuosl.org>, open list <linux-kernel@...r.kernel.org>,
	"open list:XDP (eXpress Data Path):Keyword:(?:b|_)xdp(?:b|_)"
	<bpf@...r.kernel.org>
Subject: Re: [PATCH net-next] net: intel: use ethtool string helpers

On 10/24/24 21:56, Rosen Penev wrote:
> The latter is the preferred way to copy ethtool strings.
> 
> Avoids manually incrementing the pointer. Cleans up the code quite well.

Indeed, thanks a lot!

Could you please tag next version as [iwl-next], so it will be easier to
via Tony's tree first?

Codewise it's good, just one nitpick from me.

> 
> Signed-off-by: Rosen Penev <rosenp@...il.com>
> ---
>   .../net/ethernet/intel/e1000/e1000_ethtool.c  | 10 ++---
>   drivers/net/ethernet/intel/e1000e/ethtool.c   | 14 +++----
>   .../net/ethernet/intel/fm10k/fm10k_ethtool.c  | 12 +++---
>   .../net/ethernet/intel/i40e/i40e_ethtool.c    |  8 ++--
>   drivers/net/ethernet/intel/ice/ice_ethtool.c  | 37 +++++++++++--------
>   drivers/net/ethernet/intel/igb/igb_ethtool.c  | 35 ++++++++++--------
>   drivers/net/ethernet/intel/igbvf/ethtool.c    | 10 ++---
>   drivers/net/ethernet/intel/igc/igc_ethtool.c  | 36 +++++++++---------
>   .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  | 32 ++++++++--------
>   drivers/net/ethernet/intel/ixgbevf/ethtool.c  | 36 +++++++-----------
>   10 files changed, 119 insertions(+), 111 deletions(-)
> 

[..]

> --- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> +++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
> @@ -122,7 +122,7 @@ static const char fm10k_gstrings_test[][ETH_GSTRING_LEN] = {
>   	"Mailbox test (on/offline)"
>   };
>   
> -#define FM10K_TEST_LEN (sizeof(fm10k_gstrings_test) / ETH_GSTRING_LEN)
> +#define FM10K_TEST_LEN ARRAY_SIZE(fm10k_gstrings_test)

this line is not strictly related to the stated goal of the commit,
fine anyway for me

>   
>   enum fm10k_self_test_types {
>   	FM10K_TEST_MBX,
> @@ -180,17 +180,19 @@ static void fm10k_get_stat_strings(struct net_device *dev, u8 *data)
>   static void fm10k_get_strings(struct net_device *dev,
>   			      u32 stringset, u8 *data)
>   {
> +	int i;
> +
>   	switch (stringset) {
>   	case ETH_SS_TEST:
> -		memcpy(data, fm10k_gstrings_test,
> -		       FM10K_TEST_LEN * ETH_GSTRING_LEN);
> +		for (i = 0; i < FM10K_TEST_LEN; i++)

for new code we put the iterator declaration into the loop, do:
		for (int i = 0; ...

ditto other places/drivers

> +			ethtool_puts(&data, fm10k_gstrings_test[i]);
>   		break;
>   	case ETH_SS_STATS:
>   		fm10k_get_stat_strings(dev, data);
>   		break;
>   	case ETH_SS_PRIV_FLAGS:
> -		memcpy(data, fm10k_prv_flags,
> -		       FM10K_PRV_FLAG_LEN * ETH_GSTRING_LEN);
> +		for (i = 0; i < FM10K_PRV_FLAG_LEN; i++)
> +			ethtool_puts(&data, fm10k_prv_flags[i]);
>   		break;
>   	}
>   }


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ