From: Jakub Kicinski <kuba@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org, "Jian Shen" <shenjian15@huawei.com>,
"Salil Mehta" <salil.mehta@huawei.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jijie Shao" <shaojijie@huawei.com>,
"Wei Fang" <wei.fang@nxp.com>,
"Louis Peens" <louis.peens@corigine.com>,
"justinstitt@google.com" <justinstitt@google.com>,
"Jacob Keller" <jacob.e.keller@intel.com>,
"Wojciech Drewek" <wojciech.drewek@intel.com>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Hongbo Li" <lihongbo22@huawei.com>,
"Yonglong Liu" <liuyonglong@huawei.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Ahmed Zaki" <ahmed.zaki@intel.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Kalesh AP" <kalesh-anakkur.purayil@broadcom.com>,
"Simon Horman" <horms@kernel.org>,
"Jie Wang" <wangjie125@huawei.com>,
"Peiyang Wang" <wangpeiyang1@huawei.com>,
"Hao Lan" <lanhao@huawei.com>,
linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH net-next] net: hisilicon: use ethtool string helpers
Date: Sun, 3 Nov 2024 13:54:29 -0800 [thread overview]
Message-ID: <20241103135429.1556ea05@kernel.org> (raw)
In-Reply-To: <20241030220746.305924-1-rosenp@gmail.com>
On Wed, 30 Oct 2024 15:07:46 -0700 Rosen Penev wrote:
> -static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
> - u32 stat_count, u32 num_tqps, const char *prefix)
> +static void hns3_update_strings(u8 **data, const struct hns3_stats *stats,
> + u32 stat_count, u32 num_tqps,
> + const char *prefix)
> {
> #define MAX_PREFIX_SIZE (6 + 4)
This define can also go away
> - u32 size_left;
> u32 i, j;
> - u32 n1;
>
> - for (i = 0; i < num_tqps; i++) {
> - for (j = 0; j < stat_count; j++) {
> - data[ETH_GSTRING_LEN - 1] = '\0';
> -
> - /* first, prepend the prefix string */
> - n1 = scnprintf(data, MAX_PREFIX_SIZE, "%s%u_",
> - prefix, i);
> - size_left = (ETH_GSTRING_LEN - 1) - n1;
> -
> - /* now, concatenate the stats string to it */
> - strncat(data, stats[j].stats_string, size_left);
> - data += ETH_GSTRING_LEN;
> - }
> - }
> -
> - return data;
> + for (i = 0; i < num_tqps; i++)
> + for (j = 0; j < stat_count; j++)
> + ethtool_sprintf(data, "%s%u_%s", prefix, i,
> + stats[j].stats_string);
> }
--
pw-bot: cr
prev parent reply other threads:[~2024-11-03 21:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 22:07 [PATCH net-next] net: hisilicon: use ethtool string helpers Rosen Penev
2024-10-31 3:21 ` Jijie Shao
2024-11-01 1:36 ` Jijie Shao
2024-11-01 2:04 ` Rosen Penev
2024-11-01 2:15 ` Jijie Shao
2024-11-03 21:54 ` Jakub Kicinski [this message]
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=20241103135429.1556ea05@kernel.org \
--to=kuba@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=justinstitt@google.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lanhao@huawei.com \
--cc=lihongbo22@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=louis.peens@corigine.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@gmail.com \
--cc=salil.mehta@huawei.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=wangjie125@huawei.com \
--cc=wangpeiyang1@huawei.com \
--cc=wei.fang@nxp.com \
--cc=wojciech.drewek@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.