From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Rosen Penev <rosenp@gmail.com>, Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: <netdev@vger.kernel.org>, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
"moderated list:INTEL ETHERNET DRIVERS"
<intel-wired-lan@lists.osuosl.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:XDP (eXpress Data Path):Keyword:(?:b|_)xdp(?:b|_)"
<bpf@vger.kernel.org>
Subject: Re: [PATCH net-next] net: intel: use ethtool string helpers
Date: Fri, 25 Oct 2024 06:06:06 +0200 [thread overview]
Message-ID: <1c9afb23-fcf8-4401-af06-4a0b2dcbb135@intel.com> (raw)
In-Reply-To: <20241024195647.176614-1-rosenp@gmail.com>
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@gmail.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;
> }
> }
next prev parent reply other threads:[~2024-10-25 4:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 19:56 Rosen Penev
2024-10-25 4:06 ` Przemek Kitszel [this message]
2024-10-25 20:19 ` Rosen Penev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c9afb23-fcf8-4401-af06-4a0b2dcbb135@intel.com \
--to=przemyslaw.kitszel@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®