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] [day] [month] [year] [list]
Message-ID: <CAKxU2N9XKEsr+c-Kwi+T08DqN8jt8Gdf0tH8Fy2M0Nb4fCjddA@mail.gmail.com>
Date: Fri, 25 Oct 2024 13:19:55 -0700
From: Rosen Penev <rosenp@...il.com>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: Tony Nguyen <anthony.l.nguyen@...el.com>, 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 Thu, Oct 24, 2024 at 9:06 PM Przemek Kitszel
<przemyslaw.kitszel@...el.com> wrote:
>
> 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?
message awaits moderator approval.
>
> 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
I use grep ETH_GSTRING_LEN to find opportunities for these changes,
hence why I changed.
>
> >
> >   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
I changed the places where I had + int i;

I kept every other place as is.
>
> > +                     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