From: Alexander Duyck <alexander.duyck@gmail.com> To: davem@davemloft.net, kuba@kernel.org Cc: 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, mst@redhat.com, jasowang@redhat.com, pv-drivers@vmware.com, doshir@vmware.com, alexanderduyck@fb.com, Kernel-team@fb.com Subject: [net-next PATCH v2 06/10] netvsc: Update driver to use ethtool_sprintf Date: Tue, 16 Mar 2021 17:31:20 -0700 [thread overview] Message-ID: <161594108034.5644.17958637318710114762.stgit@localhost.localdomain> (raw) In-Reply-To: <161594093708.5644.11391417312031401152.stgit@localhost.localdomain> From: Alexander Duyck <alexanderduyck@fb.com> Replace instances of sprintf or memcpy with a pointer update with ethtool_sprintf. Signed-off-by: Alexander Duyck <alexanderduyck@fb.com> --- drivers/net/hyperv/netvsc_drv.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 15f262b70489..97b5c9b60503 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1612,34 +1612,23 @@ static void netvsc_get_strings(struct net_device *dev, u32 stringset, u8 *data) switch (stringset) { case ETH_SS_STATS: - for (i = 0; i < ARRAY_SIZE(netvsc_stats); i++) { - memcpy(p, netvsc_stats[i].name, ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(netvsc_stats); i++) + ethtool_sprintf(&p, netvsc_stats[i].name); - for (i = 0; i < ARRAY_SIZE(vf_stats); i++) { - memcpy(p, vf_stats[i].name, ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(vf_stats); i++) + ethtool_sprintf(&p, vf_stats[i].name); for (i = 0; i < nvdev->num_chn; i++) { - sprintf(p, "tx_queue_%u_packets", i); - p += ETH_GSTRING_LEN; - sprintf(p, "tx_queue_%u_bytes", i); - p += ETH_GSTRING_LEN; - sprintf(p, "rx_queue_%u_packets", i); - p += ETH_GSTRING_LEN; - sprintf(p, "rx_queue_%u_bytes", i); - p += ETH_GSTRING_LEN; - sprintf(p, "rx_queue_%u_xdp_drop", i); - p += ETH_GSTRING_LEN; + ethtool_sprintf(&p, "tx_queue_%u_packets", i); + ethtool_sprintf(&p, "tx_queue_%u_bytes", i); + ethtool_sprintf(&p, "rx_queue_%u_packets", i); + ethtool_sprintf(&p, "rx_queue_%u_bytes", i); + ethtool_sprintf(&p, "rx_queue_%u_xdp_drop", i); } for_each_present_cpu(cpu) { - for (i = 0; i < ARRAY_SIZE(pcpu_stats); i++) { - sprintf(p, pcpu_stats[i].name, cpu); - p += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(pcpu_stats); i++) + ethtool_sprintf(&p, pcpu_stats[i].name, cpu); } break;
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Duyck <alexander.duyck@gmail.com> To: intel-wired-lan@osuosl.org Subject: [Intel-wired-lan] [net-next PATCH v2 06/10] netvsc: Update driver to use ethtool_sprintf Date: Tue, 16 Mar 2021 17:31:20 -0700 [thread overview] Message-ID: <161594108034.5644.17958637318710114762.stgit@localhost.localdomain> (raw) In-Reply-To: <161594093708.5644.11391417312031401152.stgit@localhost.localdomain> From: Alexander Duyck <alexanderduyck@fb.com> Replace instances of sprintf or memcpy with a pointer update with ethtool_sprintf. Signed-off-by: Alexander Duyck <alexanderduyck@fb.com> --- drivers/net/hyperv/netvsc_drv.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 15f262b70489..97b5c9b60503 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1612,34 +1612,23 @@ static void netvsc_get_strings(struct net_device *dev, u32 stringset, u8 *data) switch (stringset) { case ETH_SS_STATS: - for (i = 0; i < ARRAY_SIZE(netvsc_stats); i++) { - memcpy(p, netvsc_stats[i].name, ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(netvsc_stats); i++) + ethtool_sprintf(&p, netvsc_stats[i].name); - for (i = 0; i < ARRAY_SIZE(vf_stats); i++) { - memcpy(p, vf_stats[i].name, ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(vf_stats); i++) + ethtool_sprintf(&p, vf_stats[i].name); for (i = 0; i < nvdev->num_chn; i++) { - sprintf(p, "tx_queue_%u_packets", i); - p += ETH_GSTRING_LEN; - sprintf(p, "tx_queue_%u_bytes", i); - p += ETH_GSTRING_LEN; - sprintf(p, "rx_queue_%u_packets", i); - p += ETH_GSTRING_LEN; - sprintf(p, "rx_queue_%u_bytes", i); - p += ETH_GSTRING_LEN; - sprintf(p, "rx_queue_%u_xdp_drop", i); - p += ETH_GSTRING_LEN; + ethtool_sprintf(&p, "tx_queue_%u_packets", i); + ethtool_sprintf(&p, "tx_queue_%u_bytes", i); + ethtool_sprintf(&p, "rx_queue_%u_packets", i); + ethtool_sprintf(&p, "rx_queue_%u_bytes", i); + ethtool_sprintf(&p, "rx_queue_%u_xdp_drop", i); } for_each_present_cpu(cpu) { - for (i = 0; i < ARRAY_SIZE(pcpu_stats); i++) { - sprintf(p, pcpu_stats[i].name, cpu); - p += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(pcpu_stats); i++) + ethtool_sprintf(&p, pcpu_stats[i].name, cpu); } break;
next prev parent reply other threads:[~2021-03-17 0:32 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-17 0:30 [net-next PATCH v2 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck 2021-03-17 0:30 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:30 ` [net-next PATCH v2 01/10] ethtool: Add common function for filling out strings Alexander Duyck 2021-03-17 0:30 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:30 ` [net-next PATCH v2 02/10] intel: Update drivers to use ethtool_sprintf Alexander Duyck 2021-03-17 0:30 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 16:36 ` Jesse Brandeburg 2021-03-17 16:36 ` [Intel-wired-lan] " Jesse Brandeburg 2021-03-17 0:30 ` [net-next PATCH v2 03/10] nfp: Replace nfp_pr_et with ethtool_sprintf Alexander Duyck 2021-03-17 0:30 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:31 ` [net-next PATCH v2 04/10] hisilicon: Update drivers to use ethtool_sprintf Alexander Duyck 2021-03-17 0:31 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:31 ` [net-next PATCH v2 05/10] ena: Update driver " Alexander Duyck 2021-03-17 0:31 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:31 ` Alexander Duyck [this message] 2021-03-17 0:31 ` [Intel-wired-lan] [net-next PATCH v2 06/10] netvsc: " Alexander Duyck 2021-03-17 0:31 ` [net-next PATCH v2 07/10] virtio_net: " Alexander Duyck 2021-03-17 0:31 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:31 ` [net-next PATCH v2 08/10] vmxnet3: " Alexander Duyck 2021-03-17 0:31 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:31 ` [net-next PATCH v2 09/10] bna: " Alexander Duyck 2021-03-17 0:31 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 0:31 ` [net-next PATCH v2 10/10] ionic: " Alexander Duyck 2021-03-17 0:31 ` [Intel-wired-lan] " Alexander Duyck 2021-03-17 16:41 ` [net-next PATCH v2 00/10] ethtool: Factor out common code related to writing ethtool strings Jesse Brandeburg 2021-03-17 16:41 ` [Intel-wired-lan] " Jesse Brandeburg 2021-03-17 18:50 ` patchwork-bot+netdevbpf 2021-03-17 18:50 ` [Intel-wired-lan] " patchwork-bot+netdevbpf
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=161594108034.5644.17958637318710114762.stgit@localhost.localdomain \ --to=alexander.duyck@gmail.com \ --cc=GR-Linux-NIC-Dev@marvell.com \ --cc=Kernel-team@fb.com \ --cc=akiyano@amazon.com \ --cc=alexanderduyck@fb.com \ --cc=anthony.l.nguyen@intel.com \ --cc=davem@davemloft.net \ --cc=doshir@vmware.com \ --cc=drivers@pensando.io \ --cc=gtzalik@amazon.com \ --cc=haiyangz@microsoft.com \ --cc=intel-wired-lan@lists.osuosl.org \ --cc=jasowang@redhat.com \ --cc=jesse.brandeburg@intel.com \ --cc=kuba@kernel.org \ --cc=kys@microsoft.com \ --cc=mst@redhat.com \ --cc=netanel@amazon.com \ --cc=netdev@vger.kernel.org \ --cc=oss-drivers@netronome.com \ --cc=pv-drivers@vmware.com \ --cc=rmody@marvell.com \ --cc=saeedb@amazon.com \ --cc=salil.mehta@huawei.com \ --cc=simon.horman@netronome.com \ --cc=skalluru@marvell.com \ --cc=snelson@pensando.io \ --cc=sthemmin@microsoft.com \ --cc=wei.liu@kernel.org \ --cc=yisen.zhuang@huawei.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: linkBe 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.