From: "Michael S. Tsirkin" <mst@redhat•com>
To: Alexander Duyck <alexander.duyck@gmail•com>
Cc: davem@davemloft•net, kuba@kernel•org, netdev@vger•kernel.org,
oss-drivers@netronome•com, simon.horman@netronome•com,
yisen.zhuang@huawei•com, salil.mehta@huawei•com,
intel-wired-lan@lists•osuosl.org, jesse.brandeburg@intel•com,
anthony.l.nguyen@intel•com, drivers@pensando•io,
snelson@pensando•io, netanel@amazon•com, akiyano@amazon•com,
gtzalik@amazon•com, saeedb@amazon•com,
GR-Linux-NIC-Dev@marvell•com, skalluru@marvell•com,
rmody@marvell•com, kys@microsoft•com, haiyangz@microsoft•com,
sthemmin@microsoft•com, wei.liu@kernel•org, jasowang@redhat•com,
pv-drivers@vmware•com, doshir@vmware•com, alexanderduyck@fb•com,
Kernel-team@fb•com
Subject: Re: [net-next PATCH 07/10] virtio_net: Update driver to use ethtool_sprintf
Date: Sun, 14 Mar 2021 04:56:04 -0400 [thread overview]
Message-ID: <20210314045559-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <161557132651.10304.9382850626606060019.stgit@localhost.localdomain>
On Fri, Mar 12, 2021 at 09:48:46AM -0800, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@fb•com>
>
> Update the code to replace instances of snprintf and a pointer update with
> just calling ethtool_sprintf.
>
> Also replace the char pointer with a u8 pointer to avoid having to recast
> the pointer type.
>
> Signed-off-by: Alexander Duyck <alexanderduyck@fb•com>
Acked-by: Michael S. Tsirkin <mst@redhat•com>
> ---
> drivers/net/virtio_net.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index e97288dd6e5a..77ba8e2fc11c 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2138,25 +2138,21 @@ static int virtnet_set_channels(struct net_device *dev,
> static void virtnet_get_strings(struct net_device *dev, u32 stringset, u8 *data)
> {
> struct virtnet_info *vi = netdev_priv(dev);
> - char *p = (char *)data;
> unsigned int i, j;
> + u8 *p = data;
>
> switch (stringset) {
> case ETH_SS_STATS:
> for (i = 0; i < vi->curr_queue_pairs; i++) {
> - for (j = 0; j < VIRTNET_RQ_STATS_LEN; j++) {
> - snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_%s",
> - i, virtnet_rq_stats_desc[j].desc);
> - p += ETH_GSTRING_LEN;
> - }
> + for (j = 0; j < VIRTNET_RQ_STATS_LEN; j++)
> + ethtool_sprintf(&p, "rx_queue_%u_%s", i,
> + virtnet_rq_stats_desc[j].desc);
> }
>
> for (i = 0; i < vi->curr_queue_pairs; i++) {
> - for (j = 0; j < VIRTNET_SQ_STATS_LEN; j++) {
> - snprintf(p, ETH_GSTRING_LEN, "tx_queue_%u_%s",
> - i, virtnet_sq_stats_desc[j].desc);
> - p += ETH_GSTRING_LEN;
> - }
> + for (j = 0; j < VIRTNET_SQ_STATS_LEN; j++)
> + ethtool_sprintf(&p, "tx_queue_%u_%s", i,
> + virtnet_sq_stats_desc[j].desc);
> }
> break;
> }
>
next prev parent reply other threads:[~2021-03-14 8:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 17:48 [net-next PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
2021-03-12 17:48 ` [net-next PATCH 01/10] ethtool: Add common function for filling out strings Alexander Duyck
2021-03-12 17:48 ` [net-next PATCH 02/10] intel: Update drivers to use ethtool_sprintf Alexander Duyck
2021-03-16 6:56 ` [Intel-wired-lan] " Wang, Haiyue
2021-03-12 17:48 ` [net-next PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_sprintf Alexander Duyck
2021-03-12 17:48 ` [net-next PATCH 04/10] hisilicon: Update drivers to use ethtool_sprintf Alexander Duyck
2021-03-12 17:48 ` [net-next PATCH 05/10] ena: Update driver " Alexander Duyck
2021-03-14 8:30 ` Kiyanovski, Arthur
2021-03-12 17:48 ` [net-next PATCH 06/10] netvsc: " Alexander Duyck
2021-03-12 17:48 ` [net-next PATCH 07/10] virtio_net: " Alexander Duyck
2021-03-14 8:56 ` Michael S. Tsirkin [this message]
2021-03-15 3:52 ` Jason Wang
2021-03-12 17:48 ` [net-next PATCH 08/10] vmxnet3: " Alexander Duyck
2021-03-12 17:48 ` [net-next PATCH 09/10] bna: " Alexander Duyck
2021-03-12 17:49 ` [net-next PATCH 10/10] ionic: " Alexander Duyck
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=20210314045559-mutt-send-email-mst@kernel.org \
--to=mst@redhat$(echo .)com \
--cc=GR-Linux-NIC-Dev@marvell$(echo .)com \
--cc=Kernel-team@fb$(echo .)com \
--cc=akiyano@amazon$(echo .)com \
--cc=alexander.duyck@gmail$(echo .)com \
--cc=alexanderduyck@fb$(echo .)com \
--cc=anthony.l.nguyen@intel$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=doshir@vmware$(echo .)com \
--cc=drivers@pensando$(echo .)io \
--cc=gtzalik@amazon$(echo .)com \
--cc=haiyangz@microsoft$(echo .)com \
--cc=intel-wired-lan@lists$(echo .)osuosl.org \
--cc=jasowang@redhat$(echo .)com \
--cc=jesse.brandeburg@intel$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=kys@microsoft$(echo .)com \
--cc=netanel@amazon$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=oss-drivers@netronome$(echo .)com \
--cc=pv-drivers@vmware$(echo .)com \
--cc=rmody@marvell$(echo .)com \
--cc=saeedb@amazon$(echo .)com \
--cc=salil.mehta@huawei$(echo .)com \
--cc=simon.horman@netronome$(echo .)com \
--cc=skalluru@marvell$(echo .)com \
--cc=snelson@pensando$(echo .)io \
--cc=sthemmin@microsoft$(echo .)com \
--cc=wei.liu@kernel$(echo .)org \
--cc=yisen.zhuang@huawei$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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