netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings
@ 2021-03-11  1:35 Alexander Duyck
  2021-03-11  1:35 ` [RFC PATCH 01/10] ethtool: Add common function for filling out strings Alexander Duyck
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

This patch set is meant to be a cleanup and refactoring of common code bits
from several drivers. Specificlly a number of drivers engage in a pattern
where they will use some variant on an sprintf or memcpy to write a string
into the ethtool string array and then they will increment their pointer by
ETH_GSTRING_LEN.

Instead of having each driver implement this independently I am refactoring
the code so that we have one central function, ethtool_gsprintf that does
all this whch takes a double pointer to access the data, a formatted string
to print, and the variable arguments that are associated with the string.


---

Alexander Duyck (10):
      ethtool: Add common function for filling out strings
      intel: Update drivers to use ethtool_gsprintf
      nfp: Replace nfp_pr_et with ethtool_gsprintf
      hisilicon: Update drivers to use ethtool_gsprintf
      ena: Update driver to use ethtool_gsprintf
      netvsc: Update driver to use ethtool_gsprintf
      virtio_net: Update driver to use ethtool_gsprintf
      vmxnet3: Update driver to use ethtool_gsprintf
      bna: Update driver to use ethtool_gsprintf
      ionic: Update driver to use ethtool_gsprintf


 drivers/net/ethernet/amazon/ena/ena_ethtool.c |  25 +-
 .../net/ethernet/brocade/bna/bnad_ethtool.c   | 266 +++++++-----------
 .../ethernet/hisilicon/hns/hns_dsaf_gmac.c    |   7 +-
 .../net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |  37 +--
 .../net/ethernet/hisilicon/hns/hns_dsaf_rcb.c |  89 ++----
 .../ethernet/hisilicon/hns/hns_dsaf_xgmac.c   |   6 +-
 .../net/ethernet/hisilicon/hns/hns_ethtool.c  |  97 +++----
 .../net/ethernet/intel/i40e/i40e_ethtool.c    |  16 +-
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |  55 ++--
 drivers/net/ethernet/intel/igb/igb_ethtool.c  |  40 +--
 .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c  |  40 +--
 drivers/net/ethernet/netronome/nfp/abm/main.c |   4 +-
 .../ethernet/netronome/nfp/nfp_net_ethtool.c  |  79 +++---
 drivers/net/ethernet/netronome/nfp/nfp_port.h |   2 -
 .../net/ethernet/pensando/ionic/ionic_stats.c | 145 ++++------
 drivers/net/hyperv/netvsc_drv.c               |  33 +--
 drivers/net/virtio_net.c                      |  18 +-
 drivers/net/vmxnet3/vmxnet3_ethtool.c         |  53 ++--
 18 files changed, 381 insertions(+), 631 deletions(-)

--


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [RFC PATCH 01/10] ethtool: Add common function for filling out strings
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11  2:08   ` Jakub Kicinski
  2021-03-11  1:35 ` [RFC PATCH 02/10] intel: Update drivers to use ethtool_gsprintf Alexander Duyck
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Add a function to handle the common pattern of printing a string into the
ethtool strings interface and incrementing the string pointer by the
ETH_GSTRING_LEN. Most of the drivers end up doing this and several have
implemented their own versions of this function so it would make sense to
consolidate on one implementation.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 include/linux/ethtool.h |    9 +++++++++
 net/ethtool/ioctl.c     |   12 ++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index ec4cd3921c67..0493f13b2b20 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -571,4 +571,13 @@ struct ethtool_phy_ops {
  */
 void ethtool_set_ethtool_phy_ops(const struct ethtool_phy_ops *ops);
 
+/**
+ * ethtool_gsprintf - Write formatted string to ethtool string data
+ * @data: Pointer to start of string to update
+ * @fmt: Format of string to write
+ *
+ * Write formatted string to data. Update data to point at start of
+ * next string.
+ */
+extern __printf(2, 3) void ethtool_gsprintf(u8 **data, const char *fmt, ...);
 #endif /* _LINUX_ETHTOOL_H */
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 24783b71c584..44ac73780b6e 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1844,6 +1844,18 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr)
 	return ret;
 }
 
+__printf(2, 3) void ethtool_gsprintf(u8 **data, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vsnprintf(*data, ETH_GSTRING_LEN, fmt, args);
+	va_end(args);
+
+	*data += ETH_GSTRING_LEN;
+}
+EXPORT_SYMBOL(ethtool_gsprintf);
+
 static int ethtool_phys_id(struct net_device *dev, void __user *useraddr)
 {
 	struct ethtool_value id;



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 02/10] intel: Update drivers to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
  2021-03-11  1:35 ` [RFC PATCH 01/10] ethtool: Add common function for filling out strings Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11 20:32   ` Jesse Brandeburg
  2021-03-11  1:35 ` [RFC PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_gsprintf Alexander Duyck
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Update the Intel drivers to make use of ethtool_gsprintf. The general idea
is to reduce code size and overhead by replacing the repeated pattern of
string printf statements and ETH_STRING_LEN counter increments.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c   |   16 ++----
 drivers/net/ethernet/intel/ice/ice_ethtool.c     |   55 +++++++---------------
 drivers/net/ethernet/intel/igb/igb_ethtool.c     |   40 ++++++----------
 drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   40 ++++++----------
 4 files changed, 50 insertions(+), 101 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index c70dec65a572..932c6635cfd6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2368,21 +2368,15 @@ static void i40e_get_priv_flag_strings(struct net_device *netdev, u8 *data)
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
-	char *p = (char *)data;
+	u8 *p = data;
 	unsigned int i;
 
-	for (i = 0; i < I40E_PRIV_FLAGS_STR_LEN; i++) {
-		snprintf(p, ETH_GSTRING_LEN, "%s",
-			 i40e_gstrings_priv_flags[i].flag_string);
-		p += ETH_GSTRING_LEN;
-	}
+	for (i = 0; i < I40E_PRIV_FLAGS_STR_LEN; i++)
+		ethtool_gsprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
 	if (pf->hw.pf_id != 0)
 		return;
-	for (i = 0; i < I40E_GL_PRIV_FLAGS_STR_LEN; i++) {
-		snprintf(p, ETH_GSTRING_LEN, "%s",
-			 i40e_gl_gstrings_priv_flags[i].flag_string);
-		p += ETH_GSTRING_LEN;
-	}
+	for (i = 0; i < I40E_GL_PRIV_FLAGS_STR_LEN; i++)
+		ethtool_gsprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
 }
 
 static void i40e_get_strings(struct net_device *netdev, u32 stringset,
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 2dcfa685b763..cef5ebeae886 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -871,68 +871,47 @@ static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 {
 	struct ice_netdev_priv *np = netdev_priv(netdev);
 	struct ice_vsi *vsi = np->vsi;
-	char *p = (char *)data;
 	unsigned int i;
+	u8 *p = data;
 
 	switch (stringset) {
 	case ETH_SS_STATS:
-		for (i = 0; i < ICE_VSI_STATS_LEN; i++) {
-			snprintf(p, ETH_GSTRING_LEN, "%s",
-				 ice_gstrings_vsi_stats[i].stat_string);
-			p += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < ICE_VSI_STATS_LEN; i++)
+			ethtool_gsprintf(&p,
+					 ice_gstrings_vsi_stats[i].stat_string);
 
 		ice_for_each_alloc_txq(vsi, i) {
-			snprintf(p, ETH_GSTRING_LEN,
-				 "tx_queue_%u_packets", i);
-			p += ETH_GSTRING_LEN;
-			snprintf(p, ETH_GSTRING_LEN, "tx_queue_%u_bytes", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "tx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "tx_queue_%u_bytes", i);
 		}
 
 		ice_for_each_alloc_rxq(vsi, i) {
-			snprintf(p, ETH_GSTRING_LEN,
-				 "rx_queue_%u_packets", i);
-			p += ETH_GSTRING_LEN;
-			snprintf(p, ETH_GSTRING_LEN, "rx_queue_%u_bytes", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "rx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_bytes", i);
 		}
 
 		if (vsi->type != ICE_VSI_PF)
 			return;
 
-		for (i = 0; i < ICE_PF_STATS_LEN; i++) {
-			snprintf(p, ETH_GSTRING_LEN, "%s",
-				 ice_gstrings_pf_stats[i].stat_string);
-			p += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < ICE_PF_STATS_LEN; i++)
+			ethtool_gsprintf(&p,
+					 ice_gstrings_pf_stats[i].stat_string);
 
 		for (i = 0; i < ICE_MAX_USER_PRIORITY; i++) {
-			snprintf(p, ETH_GSTRING_LEN,
-				 "tx_priority_%u_xon.nic", i);
-			p += ETH_GSTRING_LEN;
-			snprintf(p, ETH_GSTRING_LEN,
-				 "tx_priority_%u_xoff.nic", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "tx_priority_%u_xon.nic", i);
+			ethtool_gsprintf(&p, "tx_priority_%u_xoff.nic", i);
 		}
 		for (i = 0; i < ICE_MAX_USER_PRIORITY; i++) {
-			snprintf(p, ETH_GSTRING_LEN,
-				 "rx_priority_%u_xon.nic", i);
-			p += ETH_GSTRING_LEN;
-			snprintf(p, ETH_GSTRING_LEN,
-				 "rx_priority_%u_xoff.nic", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "rx_priority_%u_xon.nic", i);
+			ethtool_gsprintf(&p, "rx_priority_%u_xoff.nic", i);
 		}
 		break;
 	case ETH_SS_TEST:
 		memcpy(data, ice_gstrings_test, ICE_TEST_LEN * ETH_GSTRING_LEN);
 		break;
 	case ETH_SS_PRIV_FLAGS:
-		for (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) {
-			snprintf(p, ETH_GSTRING_LEN, "%s",
-				 ice_gstrings_priv_flags[i].name);
-			p += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++)
+			ethtool_gsprintf(&p, ice_gstrings_priv_flags[i].name);
 		break;
 	default:
 		break;
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 28baf203459a..a82d2b901ac4 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2347,35 +2347,23 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 			IGB_TEST_LEN*ETH_GSTRING_LEN);
 		break;
 	case ETH_SS_STATS:
-		for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) {
-			memcpy(p, igb_gstrings_stats[i].stat_string,
-			       ETH_GSTRING_LEN);
-			p += ETH_GSTRING_LEN;
-		}
-		for (i = 0; i < IGB_NETDEV_STATS_LEN; i++) {
-			memcpy(p, igb_gstrings_net_stats[i].stat_string,
-			       ETH_GSTRING_LEN);
-			p += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++)
+			ethtool_gsprintf(&p,
+					 igb_gstrings_stats[i].stat_string);
+		for (i = 0; i < IGB_NETDEV_STATS_LEN; i++)
+			ethtool_gsprintf(&p,
+					 igb_gstrings_net_stats[i].stat_string);
 		for (i = 0; i < adapter->num_tx_queues; 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, "tx_queue_%u_restart", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "tx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "tx_queue_%u_bytes", i);
+			ethtool_gsprintf(&p, "tx_queue_%u_restart", i);
 		}
 		for (i = 0; i < adapter->num_rx_queues; i++) {
-			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_drops", i);
-			p += ETH_GSTRING_LEN;
-			sprintf(p, "rx_queue_%u_csum_err", i);
-			p += ETH_GSTRING_LEN;
-			sprintf(p, "rx_queue_%u_alloc_failed", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "rx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_bytes", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_drops", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_csum_err", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_alloc_failed", i);
 		}
 		/* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */
 		break;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index a280aa34ca1d..439765d72ac1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1368,45 +1368,33 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
 static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
 			      u8 *data)
 {
-	char *p = (char *)data;
 	unsigned int i;
+	u8 *p = data;
 
 	switch (stringset) {
 	case ETH_SS_TEST:
-		for (i = 0; i < IXGBE_TEST_LEN; i++) {
-			memcpy(data, ixgbe_gstrings_test[i], ETH_GSTRING_LEN);
-			data += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < IXGBE_TEST_LEN; i++)
+			ethtool_gsprintf(&p, ixgbe_gstrings_test[i]);
 		break;
 	case ETH_SS_STATS:
-		for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
-			memcpy(p, ixgbe_gstrings_stats[i].stat_string,
-			       ETH_GSTRING_LEN);
-			p += ETH_GSTRING_LEN;
-		}
+		for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++)
+			ethtool_gsprintf(&p,
+					 ixgbe_gstrings_stats[i].stat_string);
 		for (i = 0; i < netdev->num_tx_queues; i++) {
-			sprintf(p, "tx_queue_%u_packets", i);
-			p += ETH_GSTRING_LEN;
-			sprintf(p, "tx_queue_%u_bytes", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "tx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "tx_queue_%u_bytes", i);
 		}
 		for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) {
-			sprintf(p, "rx_queue_%u_packets", i);
-			p += ETH_GSTRING_LEN;
-			sprintf(p, "rx_queue_%u_bytes", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "rx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_bytes", i);
 		}
 		for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) {
-			sprintf(p, "tx_pb_%u_pxon", i);
-			p += ETH_GSTRING_LEN;
-			sprintf(p, "tx_pb_%u_pxoff", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "tx_pb_%u_pxon", i);
+			ethtool_gsprintf(&p, "tx_pb_%u_pxoff", i);
 		}
 		for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) {
-			sprintf(p, "rx_pb_%u_pxon", i);
-			p += ETH_GSTRING_LEN;
-			sprintf(p, "rx_pb_%u_pxoff", i);
-			p += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&p, "rx_pb_%u_pxon", i);
+			ethtool_gsprintf(&p, "rx_pb_%u_pxoff", i);
 		}
 		/* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */
 		break;



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
  2021-03-11  1:35 ` [RFC PATCH 01/10] ethtool: Add common function for filling out strings Alexander Duyck
  2021-03-11  1:35 ` [RFC PATCH 02/10] intel: Update drivers to use ethtool_gsprintf Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11 11:51   ` Simon Horman
  2021-03-11  1:35 ` [RFC PATCH 04/10] hisilicon: Update drivers to use ethtool_gsprintf Alexander Duyck
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

The nfp_pr_et function is nearly identical to ethtool_gsprintf except for
the fact that it passes the pointer by value and as a return whereas
ethtool_gsprintf passes it as a pointer.

Since they are so close just update nfp to make use of ethtool_gsprintf

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/netronome/nfp/abm/main.c      |    4 +
 .../net/ethernet/netronome/nfp/nfp_net_ethtool.c   |   79 +++++++++-----------
 drivers/net/ethernet/netronome/nfp/nfp_port.h      |    2 -
 3 files changed, 36 insertions(+), 49 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/abm/main.c b/drivers/net/ethernet/netronome/nfp/abm/main.c
index bdbf0726145e..3e8a9a7d7327 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/main.c
+++ b/drivers/net/ethernet/netronome/nfp/abm/main.c
@@ -419,8 +419,8 @@ nfp_abm_port_get_stats_strings(struct nfp_app *app, struct nfp_port *port,
 		return data;
 	alink = repr->app_priv;
 	for (i = 0; i < alink->vnic->dp.num_r_vecs; i++) {
-		data = nfp_pr_et(data, "q%u_no_wait", i);
-		data = nfp_pr_et(data, "q%u_delayed", i);
+		ethtool_gsprintf(&data, "q%u_no_wait", i);
+		ethtool_gsprintf(&data, "q%u_delayed", i);
 	}
 	return data;
 }
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
index 9c9ae33d84ce..33097c411d7d 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
@@ -429,17 +429,6 @@ static int nfp_net_set_ringparam(struct net_device *netdev,
 	return nfp_net_set_ring_size(nn, rxd_cnt, txd_cnt);
 }
 
-__printf(2, 3) u8 *nfp_pr_et(u8 *data, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vsnprintf(data, ETH_GSTRING_LEN, fmt, args);
-	va_end(args);
-
-	return data + ETH_GSTRING_LEN;
-}
-
 static unsigned int nfp_vnic_get_sw_stats_count(struct net_device *netdev)
 {
 	struct nfp_net *nn = netdev_priv(netdev);
@@ -454,29 +443,29 @@ static u8 *nfp_vnic_get_sw_stats_strings(struct net_device *netdev, u8 *data)
 	int i;
 
 	for (i = 0; i < nn->max_r_vecs; i++) {
-		data = nfp_pr_et(data, "rvec_%u_rx_pkts", i);
-		data = nfp_pr_et(data, "rvec_%u_tx_pkts", i);
-		data = nfp_pr_et(data, "rvec_%u_tx_busy", i);
+		ethtool_gsprintf(&data, "rvec_%u_rx_pkts", i);
+		ethtool_gsprintf(&data, "rvec_%u_tx_pkts", i);
+		ethtool_gsprintf(&data, "rvec_%u_tx_busy", i);
 	}
 
-	data = nfp_pr_et(data, "hw_rx_csum_ok");
-	data = nfp_pr_et(data, "hw_rx_csum_inner_ok");
-	data = nfp_pr_et(data, "hw_rx_csum_complete");
-	data = nfp_pr_et(data, "hw_rx_csum_err");
-	data = nfp_pr_et(data, "rx_replace_buf_alloc_fail");
-	data = nfp_pr_et(data, "rx_tls_decrypted_packets");
-	data = nfp_pr_et(data, "hw_tx_csum");
-	data = nfp_pr_et(data, "hw_tx_inner_csum");
-	data = nfp_pr_et(data, "tx_gather");
-	data = nfp_pr_et(data, "tx_lso");
-	data = nfp_pr_et(data, "tx_tls_encrypted_packets");
-	data = nfp_pr_et(data, "tx_tls_ooo");
-	data = nfp_pr_et(data, "tx_tls_drop_no_sync_data");
-
-	data = nfp_pr_et(data, "hw_tls_no_space");
-	data = nfp_pr_et(data, "rx_tls_resync_req_ok");
-	data = nfp_pr_et(data, "rx_tls_resync_req_ign");
-	data = nfp_pr_et(data, "rx_tls_resync_sent");
+	ethtool_gsprintf(&data, "hw_rx_csum_ok");
+	ethtool_gsprintf(&data, "hw_rx_csum_inner_ok");
+	ethtool_gsprintf(&data, "hw_rx_csum_complete");
+	ethtool_gsprintf(&data, "hw_rx_csum_err");
+	ethtool_gsprintf(&data, "rx_replace_buf_alloc_fail");
+	ethtool_gsprintf(&data, "rx_tls_decrypted_packets");
+	ethtool_gsprintf(&data, "hw_tx_csum");
+	ethtool_gsprintf(&data, "hw_tx_inner_csum");
+	ethtool_gsprintf(&data, "tx_gather");
+	ethtool_gsprintf(&data, "tx_lso");
+	ethtool_gsprintf(&data, "tx_tls_encrypted_packets");
+	ethtool_gsprintf(&data, "tx_tls_ooo");
+	ethtool_gsprintf(&data, "tx_tls_drop_no_sync_data");
+
+	ethtool_gsprintf(&data, "hw_tls_no_space");
+	ethtool_gsprintf(&data, "rx_tls_resync_req_ok");
+	ethtool_gsprintf(&data, "rx_tls_resync_req_ign");
+	ethtool_gsprintf(&data, "rx_tls_resync_sent");
 
 	return data;
 }
@@ -550,19 +539,19 @@ nfp_vnic_get_hw_stats_strings(u8 *data, unsigned int num_vecs, bool repr)
 	swap_off = repr * NN_ET_SWITCH_STATS_LEN;
 
 	for (i = 0; i < NN_ET_SWITCH_STATS_LEN; i++)
-		data = nfp_pr_et(data, nfp_net_et_stats[i + swap_off].name);
+		ethtool_gsprintf(&data, nfp_net_et_stats[i + swap_off].name);
 
 	for (i = NN_ET_SWITCH_STATS_LEN; i < NN_ET_SWITCH_STATS_LEN * 2; i++)
-		data = nfp_pr_et(data, nfp_net_et_stats[i - swap_off].name);
+		ethtool_gsprintf(&data, nfp_net_et_stats[i - swap_off].name);
 
 	for (i = NN_ET_SWITCH_STATS_LEN * 2; i < NN_ET_GLOBAL_STATS_LEN; i++)
-		data = nfp_pr_et(data, nfp_net_et_stats[i].name);
+		ethtool_gsprintf(&data, nfp_net_et_stats[i].name);
 
 	for (i = 0; i < num_vecs; i++) {
-		data = nfp_pr_et(data, "rxq_%u_pkts", i);
-		data = nfp_pr_et(data, "rxq_%u_bytes", i);
-		data = nfp_pr_et(data, "txq_%u_pkts", i);
-		data = nfp_pr_et(data, "txq_%u_bytes", i);
+		ethtool_gsprintf(&data, "rxq_%u_pkts", i);
+		ethtool_gsprintf(&data, "rxq_%u_bytes", i);
+		ethtool_gsprintf(&data, "txq_%u_pkts", i);
+		ethtool_gsprintf(&data, "txq_%u_bytes", i);
 	}
 
 	return data;
@@ -610,15 +599,15 @@ static u8 *nfp_vnic_get_tlv_stats_strings(struct nfp_net *nn, u8 *data)
 			memcpy(data, nfp_tlv_stat_names[id], ETH_GSTRING_LEN);
 			data += ETH_GSTRING_LEN;
 		} else {
-			data = nfp_pr_et(data, "dev_unknown_stat%u", id);
+			ethtool_gsprintf(&data, "dev_unknown_stat%u", id);
 		}
 	}
 
 	for (i = 0; i < nn->max_r_vecs; i++) {
-		data = nfp_pr_et(data, "rxq_%u_pkts", i);
-		data = nfp_pr_et(data, "rxq_%u_bytes", i);
-		data = nfp_pr_et(data, "txq_%u_pkts", i);
-		data = nfp_pr_et(data, "txq_%u_bytes", i);
+		ethtool_gsprintf(&data, "rxq_%u_pkts", i);
+		ethtool_gsprintf(&data, "rxq_%u_bytes", i);
+		ethtool_gsprintf(&data, "txq_%u_pkts", i);
+		ethtool_gsprintf(&data, "txq_%u_bytes", i);
 	}
 
 	return data;
@@ -666,7 +655,7 @@ static u8 *nfp_mac_get_stats_strings(struct net_device *netdev, u8 *data)
 		return data;
 
 	for (i = 0; i < ARRAY_SIZE(nfp_mac_et_stats); i++)
-		data = nfp_pr_et(data, "mac.%s", nfp_mac_et_stats[i].name);
+		ethtool_gsprintf(&data, "mac.%s", nfp_mac_et_stats[i].name);
 
 	return data;
 }
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index d7fd203bb180..ae4da189d955 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -92,8 +92,6 @@ struct nfp_port {
 
 extern const struct ethtool_ops nfp_port_ethtool_ops;
 
-__printf(2, 3) u8 *nfp_pr_et(u8 *data, const char *fmt, ...);
-
 int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
 		      void *type_data);
 



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 04/10] hisilicon: Update drivers to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (2 preceding siblings ...)
  2021-03-11  1:35 ` [RFC PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_gsprintf Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11  1:35 ` [RFC PATCH 05/10] ena: Update driver " Alexander Duyck
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Update the hisilicon drivers to make use of ethtool_gsprintf. The general
idea is to reduce code size and overhead by replacing the repeated pattern
of string printf statements and ETH_STRING_LEN counter increments.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c |    7 -
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c  |   37 +++-----
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c  |   89 ++++++------------
 .../net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c    |    6 -
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c   |   97 +++++++-------------
 5 files changed, 82 insertions(+), 154 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
index 7fb7a419607d..c43acb73f1e3 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
@@ -693,11 +693,8 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data)
 	if (stringset != ETH_SS_STATS)
 		return;
 
-	for (i = 0; i < ARRAY_SIZE(g_gmac_stats_string); i++) {
-		snprintf(buff, ETH_GSTRING_LEN, "%s",
-			 g_gmac_stats_string[i].desc);
-		buff = buff + ETH_GSTRING_LEN;
-	}
+	for (i = 0; i < ARRAY_SIZE(g_gmac_stats_string); i++)
+		ethtool_gsprintf(&buff, g_gmac_stats_string[i].desc);
 }
 
 static int hns_gmac_get_sset_count(int stringset)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
index d0f8b1fff333..35a149e31a43 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
@@ -465,30 +465,19 @@ void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data)
 	char *buff = (char *)data;
 	int index = ppe_cb->index;
 
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_sw_pkt", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_pkt_ok", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_drop_pkt_no_bd", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_alloc_buf_fail", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_alloc_buf_wait", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_pkt_drop_no_buf", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_rx_pkt_err_fifo_full", index);
-	buff = buff + ETH_GSTRING_LEN;
-
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_bd", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt_ok", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt_err_fifo_empty", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "ppe%d_tx_pkt_err_csum_fail", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_sw_pkt", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_pkt_ok", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_drop_pkt_no_bd", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_alloc_buf_fail", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_alloc_buf_wait", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_pkt_drop_no_buf", index);
+	ethtool_gsprintf(&buff, "ppe%d_rx_pkt_err_fifo_full", index);
+
+	ethtool_gsprintf(&buff, "ppe%d_tx_bd", index);
+	ethtool_gsprintf(&buff, "ppe%d_tx_pkt", index);
+	ethtool_gsprintf(&buff, "ppe%d_tx_pkt_ok", index);
+	ethtool_gsprintf(&buff, "ppe%d_tx_pkt_err_fifo_empty", index);
+	ethtool_gsprintf(&buff, "ppe%d_tx_pkt_err_csum_fail", index);
 }
 
 void hns_ppe_get_stats(struct hns_ppe_cb *ppe_cb, u64 *data)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
index b6c8910cf7ba..a7232b906be4 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c
@@ -934,64 +934,37 @@ void hns_rcb_get_strings(int stringset, u8 *data, int index)
 	if (stringset != ETH_SS_STATS)
 		return;
 
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_rcb_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_ppe_tx_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_ppe_drop_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_fbd_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_bytes", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_err_cnt", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_io_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_sw_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_seg_pkt", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_restart_queue", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "tx_ring%d_tx_busy", index);
-	buff = buff + ETH_GSTRING_LEN;
-
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_rcb_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_ppe_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_ppe_drop_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_fbd_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_pkt_num", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_bytes", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_err_cnt", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_io_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_sw_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_seg_pkt", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_reuse_pg", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_len_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_non_vld_desc_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_bd_num_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_l2_err", index);
-	buff = buff + ETH_GSTRING_LEN;
-	snprintf(buff, ETH_GSTRING_LEN, "rx_ring%d_l3l4csum_err", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_rcb_pkt_num", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_ppe_tx_pkt_num", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_ppe_drop_pkt_num", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_fbd_num", index);
+
+	ethtool_gsprintf(&buff, "tx_ring%d_pkt_num", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_bytes", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_err_cnt", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_io_err", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_sw_err", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_seg_pkt", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_restart_queue", index);
+	ethtool_gsprintf(&buff, "tx_ring%d_tx_busy", index);
+
+	ethtool_gsprintf(&buff, "rx_ring%d_rcb_pkt_num", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_ppe_pkt_num", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_ppe_drop_pkt_num", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_fbd_num", index);
+
+	ethtool_gsprintf(&buff, "rx_ring%d_pkt_num", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_bytes", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_err_cnt", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_io_err", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_sw_err", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_seg_pkt", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_reuse_pg", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_len_err", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_non_vld_desc_err", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_bd_num_err", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_l2_err", index);
+	ethtool_gsprintf(&buff, "rx_ring%d_l3l4csum_err", index);
 }
 
 void hns_rcb_get_common_regs(struct rcb_common_cb *rcb_com, void *data)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
index 7e3609ce112a..c2d475fd4963 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
@@ -764,10 +764,8 @@ static void hns_xgmac_get_strings(u32 stringset, u8 *data)
 	if (stringset != ETH_SS_STATS)
 		return;
 
-	for (i = 0; i < ARRAY_SIZE(g_xgmac_stats_string); i++) {
-		snprintf(buff, ETH_GSTRING_LEN, g_xgmac_stats_string[i].desc);
-		buff = buff + ETH_GSTRING_LEN;
-	}
+	for (i = 0; i < ARRAY_SIZE(g_xgmac_stats_string); i++)
+		ethtool_gsprintf(&buff, g_xgmac_stats_string[i].desc);
 }
 
 /**
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index a6e3f07caf99..e9a5264306e7 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -903,72 +903,43 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 	}
 
 	if (stringset == ETH_SS_TEST) {
-		if (priv->ae_handle->phy_if != PHY_INTERFACE_MODE_XGMII) {
-			memcpy(buff, hns_nic_test_strs[MAC_INTERNALLOOP_MAC],
-			       ETH_GSTRING_LEN);
-			buff += ETH_GSTRING_LEN;
-		}
-		memcpy(buff, hns_nic_test_strs[MAC_INTERNALLOOP_SERDES],
-		       ETH_GSTRING_LEN);
-		buff += ETH_GSTRING_LEN;
+		if (priv->ae_handle->phy_if != PHY_INTERFACE_MODE_XGMII)
+			ethtool_gsprintf(&buff,
+					 hns_nic_test_strs[MAC_INTERNALLOOP_MAC]);
+		ethtool_gsprintf(&buff,
+				 hns_nic_test_strs[MAC_INTERNALLOOP_SERDES]);
 		if ((netdev->phydev) && (!netdev->phydev->is_c45))
-			memcpy(buff, hns_nic_test_strs[MAC_INTERNALLOOP_PHY],
-			       ETH_GSTRING_LEN);
+			ethtool_gsprintf(&buff,
+					 hns_nic_test_strs[MAC_INTERNALLOOP_PHY]);
 
 	} else {
-		snprintf(buff, ETH_GSTRING_LEN, "rx_packets");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_packets");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_bytes");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_bytes");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_dropped");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_dropped");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "multicast");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "collisions");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_over_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_crc_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_frame_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_fifo_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_missed_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_aborted_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_carrier_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_fifo_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_heartbeat_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_length_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_window_errors");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "rx_compressed");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "tx_compressed");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "netdev_rx_dropped");
-		buff = buff + ETH_GSTRING_LEN;
-		snprintf(buff, ETH_GSTRING_LEN, "netdev_tx_dropped");
-		buff = buff + ETH_GSTRING_LEN;
-
-		snprintf(buff, ETH_GSTRING_LEN, "netdev_tx_timeout");
-		buff = buff + ETH_GSTRING_LEN;
+		ethtool_gsprintf(&buff, "rx_packets");
+		ethtool_gsprintf(&buff, "tx_packets");
+		ethtool_gsprintf(&buff, "rx_bytes");
+		ethtool_gsprintf(&buff, "tx_bytes");
+		ethtool_gsprintf(&buff, "rx_errors");
+		ethtool_gsprintf(&buff, "tx_errors");
+		ethtool_gsprintf(&buff, "rx_dropped");
+		ethtool_gsprintf(&buff, "tx_dropped");
+		ethtool_gsprintf(&buff, "multicast");
+		ethtool_gsprintf(&buff, "collisions");
+		ethtool_gsprintf(&buff, "rx_over_errors");
+		ethtool_gsprintf(&buff, "rx_crc_errors");
+		ethtool_gsprintf(&buff, "rx_frame_errors");
+		ethtool_gsprintf(&buff, "rx_fifo_errors");
+		ethtool_gsprintf(&buff, "rx_missed_errors");
+		ethtool_gsprintf(&buff, "tx_aborted_errors");
+		ethtool_gsprintf(&buff, "tx_carrier_errors");
+		ethtool_gsprintf(&buff, "tx_fifo_errors");
+		ethtool_gsprintf(&buff, "tx_heartbeat_errors");
+		ethtool_gsprintf(&buff, "rx_length_errors");
+		ethtool_gsprintf(&buff, "tx_window_errors");
+		ethtool_gsprintf(&buff, "rx_compressed");
+		ethtool_gsprintf(&buff, "tx_compressed");
+		ethtool_gsprintf(&buff, "netdev_rx_dropped");
+		ethtool_gsprintf(&buff, "netdev_tx_dropped");
+
+		ethtool_gsprintf(&buff, "netdev_tx_timeout");
 
 		h->dev->ops->get_strings(h, stringset, (u8 *)buff);
 	}



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 05/10] ena: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (3 preceding siblings ...)
  2021-03-11  1:35 ` [RFC PATCH 04/10] hisilicon: Update drivers to use ethtool_gsprintf Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11 13:42   ` Kiyanovski, Arthur
  2021-03-11  1:35 ` [RFC PATCH 06/10] netvsc: " Alexander Duyck
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Replace instances of snprintf or memcpy with a pointer update with
ethtool_gsprintf.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c |   25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index d6cc7aa612b7..42f6bad7ca26 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -251,10 +251,10 @@ static void ena_queue_strings(struct ena_adapter *adapter, u8 **data)
 		for (j = 0; j < ENA_STATS_ARRAY_TX; j++) {
 			ena_stats = &ena_stats_tx_strings[j];
 
-			snprintf(*data, ETH_GSTRING_LEN,
-				 "queue_%u_%s_%s", i,
-				 is_xdp ? "xdp_tx" : "tx", ena_stats->name);
-			(*data) += ETH_GSTRING_LEN;
+			ethtool_gsprintf(data,
+					 "queue_%u_%s_%s", i,
+					 is_xdp ? "xdp_tx" : "tx",
+					 ena_stats->name);
 		}
 
 		if (!is_xdp) {
@@ -264,9 +264,9 @@ static void ena_queue_strings(struct ena_adapter *adapter, u8 **data)
 			for (j = 0; j < ENA_STATS_ARRAY_RX; j++) {
 				ena_stats = &ena_stats_rx_strings[j];
 
-				snprintf(*data, ETH_GSTRING_LEN,
-					 "queue_%u_rx_%s", i, ena_stats->name);
-				(*data) += ETH_GSTRING_LEN;
+				ethtool_gsprintf(data,
+						 "queue_%u_rx_%s", i,
+						 ena_stats->name);
 			}
 		}
 	}
@@ -280,9 +280,8 @@ static void ena_com_dev_strings(u8 **data)
 	for (i = 0; i < ENA_STATS_ARRAY_ENA_COM; i++) {
 		ena_stats = &ena_stats_ena_com_strings[i];
 
-		snprintf(*data, ETH_GSTRING_LEN,
-			 "ena_admin_q_%s", ena_stats->name);
-		(*data) += ETH_GSTRING_LEN;
+		ethtool_gsprintf(data,
+				 "ena_admin_q_%s", ena_stats->name);
 	}
 }
 
@@ -295,15 +294,13 @@ static void ena_get_strings(struct ena_adapter *adapter,
 
 	for (i = 0; i < ENA_STATS_ARRAY_GLOBAL; i++) {
 		ena_stats = &ena_stats_global_strings[i];
-		memcpy(data, ena_stats->name, ETH_GSTRING_LEN);
-		data += ETH_GSTRING_LEN;
+		ethtool_gsprintf(&data, ena_stats->name);
 	}
 
 	if (eni_stats_needed) {
 		for (i = 0; i < ENA_STATS_ARRAY_ENI(adapter); i++) {
 			ena_stats = &ena_stats_eni_strings[i];
-			memcpy(data, ena_stats->name, ETH_GSTRING_LEN);
-			data += ETH_GSTRING_LEN;
+			ethtool_gsprintf(&data, ena_stats->name);
 		}
 	}
 



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 06/10] netvsc: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (4 preceding siblings ...)
  2021-03-11  1:35 ` [RFC PATCH 05/10] ena: Update driver " Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11  1:35 ` [RFC PATCH 07/10] virtio_net: " Alexander Duyck
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Replace instances of sprintf or memcpy with a pointer update with
ethtool_gsprintf.

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..4e8446a81c0b 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_gsprintf(&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_gsprintf(&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_gsprintf(&p, "tx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "tx_queue_%u_bytes", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_packets", i);
+			ethtool_gsprintf(&p, "rx_queue_%u_bytes", i);
+			ethtool_gsprintf(&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_gsprintf(&p, pcpu_stats[i].name, cpu);
 		}
 
 		break;



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 07/10] virtio_net: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (5 preceding siblings ...)
  2021-03-11  1:35 ` [RFC PATCH 06/10] netvsc: " Alexander Duyck
@ 2021-03-11  1:35 ` Alexander Duyck
  2021-03-11  1:36 ` [RFC PATCH 08/10] vmxnet3: " Alexander Duyck
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:35 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Update the code to replace instances of snprintf and a pointer update with
just calling ethtool_gsprintf.

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>
---
 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 82e520d2cb12..f1a05b43dde7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2104,25 +2104,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_gsprintf(&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_gsprintf(&p, "tx_queue_%u_%s", i,
+						 virtnet_sq_stats_desc[j].desc);
 		}
 		break;
 	}



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 08/10] vmxnet3: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (6 preceding siblings ...)
  2021-03-11  1:35 ` [RFC PATCH 07/10] virtio_net: " Alexander Duyck
@ 2021-03-11  1:36 ` Alexander Duyck
  2021-03-11  1:36 ` [RFC PATCH 09/10] bna: " Alexander Duyck
  2021-03-11  1:36 ` [RFC PATCH 10/10] ionic: " Alexander Duyck
  9 siblings, 0 replies; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:36 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

So this patch actually does 3 things.

First it removes a stray white space at the start of the variable
declaration in vmxnet3_get_strings.

Second it flips the logic for the string test so that we exit immediately
if we are not looking for the stats strings. Doing this we can avoid
unnecessary indentation and line wrapping.

Then finally it updates the code to use ethtool_gsprintf rather than a
memcpy and pointer increment to write the ethtool strings.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/vmxnet3/vmxnet3_ethtool.c |   53 ++++++++++++---------------------
 1 file changed, 19 insertions(+), 34 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 7ec8652f2c26..4ec674380a91 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -218,43 +218,28 @@ vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
 static void
 vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
 {
-	 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
-	if (stringset == ETH_SS_STATS) {
-		int i, j;
-		for (j = 0; j < adapter->num_tx_queues; j++) {
-			for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) {
-				memcpy(buf, vmxnet3_tq_dev_stats[i].desc,
-				       ETH_GSTRING_LEN);
-				buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats);
-			     i++) {
-				memcpy(buf, vmxnet3_tq_driver_stats[i].desc,
-				       ETH_GSTRING_LEN);
-				buf += ETH_GSTRING_LEN;
-			}
-		}
+	struct vmxnet3_adapter *adapter = netdev_priv(netdev);
+	int i, j;
 
-		for (j = 0; j < adapter->num_rx_queues; j++) {
-			for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) {
-				memcpy(buf, vmxnet3_rq_dev_stats[i].desc,
-				       ETH_GSTRING_LEN);
-				buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats);
-			     i++) {
-				memcpy(buf, vmxnet3_rq_driver_stats[i].desc,
-				       ETH_GSTRING_LEN);
-				buf += ETH_GSTRING_LEN;
-			}
-		}
+	if (stringset != ETH_SS_STATS)
+		return;
 
-		for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) {
-			memcpy(buf, vmxnet3_global_stats[i].desc,
-				ETH_GSTRING_LEN);
-			buf += ETH_GSTRING_LEN;
-		}
+	for (j = 0; j < adapter->num_tx_queues; j++) {
+		for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++)
+			ethtool_gsprintf(&buf, vmxnet3_tq_dev_stats[i].desc);
+		for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++)
+			ethtool_gsprintf(&buf, vmxnet3_tq_driver_stats[i].desc);
+	}
+
+	for (j = 0; j < adapter->num_rx_queues; j++) {
+		for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
+			ethtool_gsprintf(&buf, vmxnet3_rq_dev_stats[i].desc);
+		for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++)
+			ethtool_gsprintf(&buf, vmxnet3_rq_driver_stats[i].desc);
 	}
+
+	for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++)
+		ethtool_gsprintf(&buf, vmxnet3_global_stats[i].desc);
 }
 
 netdev_features_t vmxnet3_fix_features(struct net_device *netdev,



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 09/10] bna: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (7 preceding siblings ...)
  2021-03-11  1:36 ` [RFC PATCH 08/10] vmxnet3: " Alexander Duyck
@ 2021-03-11  1:36 ` Alexander Duyck
  2021-03-11  1:36 ` [RFC PATCH 10/10] ionic: " Alexander Duyck
  9 siblings, 0 replies; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:36 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Update the bnad_get_strings to make use of ethtool_gsprintf and avoid
unnecessary line wrapping. To do this we invert the logic for the string
set test and instead exit immediately if we are not working with the stats
strings. In addition the function is broken up into subfunctions for each
area so that we can simply call ethtool_gsprintf once for each string in a
given subsection.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/brocade/bna/bnad_ethtool.c |  266 +++++++++--------------
 1 file changed, 105 insertions(+), 161 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
index 588c4804d10a..9d72f896880d 100644
--- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
+++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
@@ -524,6 +524,68 @@ bnad_set_pauseparam(struct net_device *netdev,
 	return 0;
 }
 
+static void bnad_get_txf_strings(u8 **string, int f_num)
+{
+	ethtool_gsprintf(string, "txf%d_ucast_octets", f_num);
+	ethtool_gsprintf(string, "txf%d_ucast", f_num);
+	ethtool_gsprintf(string, "txf%d_ucast_vlan", f_num);
+	ethtool_gsprintf(string, "txf%d_mcast_octets", f_num);
+	ethtool_gsprintf(string, "txf%d_mcast", f_num);
+	ethtool_gsprintf(string, "txf%d_mcast_vlan", f_num);
+	ethtool_gsprintf(string, "txf%d_bcast_octets", f_num);
+	ethtool_gsprintf(string, "txf%d_bcast", f_num);
+	ethtool_gsprintf(string, "txf%d_bcast_vlan", f_num);
+	ethtool_gsprintf(string, "txf%d_errors", f_num);
+	ethtool_gsprintf(string, "txf%d_filter_vlan", f_num);
+	ethtool_gsprintf(string, "txf%d_filter_mac_sa", f_num);
+}
+
+static void bnad_get_rxf_strings(u8 **string, int f_num)
+{
+	ethtool_gsprintf(string, "rxf%d_ucast_octets", f_num);
+	ethtool_gsprintf(string, "rxf%d_ucast", f_num);
+	ethtool_gsprintf(string, "rxf%d_ucast_vlan", f_num);
+	ethtool_gsprintf(string, "rxf%d_mcast_octets", f_num);
+	ethtool_gsprintf(string, "rxf%d_mcast", f_num);
+	ethtool_gsprintf(string, "rxf%d_mcast_vlan", f_num);
+	ethtool_gsprintf(string, "rxf%d_bcast_octets", f_num);
+	ethtool_gsprintf(string, "rxf%d_bcast", f_num);
+	ethtool_gsprintf(string, "rxf%d_bcast_vlan", f_num);
+	ethtool_gsprintf(string, "rxf%d_frame_drops", f_num);
+}
+
+static void bnad_get_cq_strings(u8 **string, int q_num)
+{
+	ethtool_gsprintf(string, "cq%d_producer_index", q_num);
+	ethtool_gsprintf(string, "cq%d_consumer_index", q_num);
+	ethtool_gsprintf(string, "cq%d_hw_producer_index", q_num);
+	ethtool_gsprintf(string, "cq%d_intr", q_num);
+	ethtool_gsprintf(string, "cq%d_poll", q_num);
+	ethtool_gsprintf(string, "cq%d_schedule", q_num);
+	ethtool_gsprintf(string, "cq%d_keep_poll", q_num);
+	ethtool_gsprintf(string, "cq%d_complete", q_num);
+}
+
+static void bnad_get_rxq_strings(u8 **string, int q_num)
+{
+	ethtool_gsprintf(string, "rxq%d_packets", q_num);
+	ethtool_gsprintf(string, "rxq%d_bytes", q_num);
+	ethtool_gsprintf(string, "rxq%d_packets_with_error", q_num);
+	ethtool_gsprintf(string, "rxq%d_allocbuf_failed", q_num);
+	ethtool_gsprintf(string, "rxq%d_mapbuf_failed", q_num);
+	ethtool_gsprintf(string, "rxq%d_producer_index", q_num);
+	ethtool_gsprintf(string, "rxq%d_consumer_index", q_num);
+}
+
+static void bnad_get_txq_strings(u8 **string, int q_num)
+{
+	ethtool_gsprintf(string, "txq%d_packets", q_num);
+	ethtool_gsprintf(string, "txq%d_bytes", q_num);
+	ethtool_gsprintf(string, "txq%d_producer_index", q_num);
+	ethtool_gsprintf(string, "txq%d_consumer_index", q_num);
+	ethtool_gsprintf(string, "txq%d_hw_consumer_index", q_num);
+}
+
 static void
 bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string)
 {
@@ -531,175 +593,57 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string)
 	int i, j, q_num;
 	u32 bmap;
 
+	if (stringset != ETH_SS_STATS)
+		return;
+
 	mutex_lock(&bnad->conf_mutex);
 
-	switch (stringset) {
-	case ETH_SS_STATS:
-		for (i = 0; i < BNAD_ETHTOOL_STATS_NUM; i++) {
-			BUG_ON(!(strlen(bnad_net_stats_strings[i]) <
-				   ETH_GSTRING_LEN));
-			strncpy(string, bnad_net_stats_strings[i],
-				ETH_GSTRING_LEN);
-			string += ETH_GSTRING_LEN;
-		}
-		bmap = bna_tx_rid_mask(&bnad->bna);
-		for (i = 0; bmap; i++) {
-			if (bmap & 1) {
-				sprintf(string, "txf%d_ucast_octets", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_ucast", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_ucast_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_mcast_octets", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_mcast", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_mcast_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_bcast_octets", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_bcast", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_bcast_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_errors", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_filter_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txf%d_filter_mac_sa", i);
-				string += ETH_GSTRING_LEN;
-			}
-			bmap >>= 1;
-		}
+	for (i = 0; i < BNAD_ETHTOOL_STATS_NUM; i++) {
+		BUG_ON(!(strlen(bnad_net_stats_strings[i]) < ETH_GSTRING_LEN));
+		ethtool_gsprintf(&string, bnad_net_stats_strings[i]);
+	}
 
-		bmap = bna_rx_rid_mask(&bnad->bna);
-		for (i = 0; bmap; i++) {
-			if (bmap & 1) {
-				sprintf(string, "rxf%d_ucast_octets", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_ucast", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_ucast_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_mcast_octets", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_mcast", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_mcast_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_bcast_octets", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_bcast", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_bcast_vlan", i);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxf%d_frame_drops", i);
-				string += ETH_GSTRING_LEN;
-			}
-			bmap >>= 1;
-		}
+	bmap = bna_tx_rid_mask(&bnad->bna);
+	for (i = 0; bmap; i++) {
+		if (bmap & 1)
+			bnad_get_txf_strings(&string, i);
+		bmap >>= 1;
+	}
 
-		q_num = 0;
-		for (i = 0; i < bnad->num_rx; i++) {
-			if (!bnad->rx_info[i].rx)
-				continue;
-			for (j = 0; j < bnad->num_rxp_per_rx; j++) {
-				sprintf(string, "cq%d_producer_index", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_consumer_index", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_hw_producer_index",
-					q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_intr", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_poll", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_schedule", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_keep_poll", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "cq%d_complete", q_num);
-				string += ETH_GSTRING_LEN;
-				q_num++;
-			}
-		}
+	bmap = bna_rx_rid_mask(&bnad->bna);
+	for (i = 0; bmap; i++, bmap >>= 1) {
+		if (bmap & 1)
+			bnad_get_rxf_strings(&string, i);
+		bmap >>= 1;
+	}
 
-		q_num = 0;
-		for (i = 0; i < bnad->num_rx; i++) {
-			if (!bnad->rx_info[i].rx)
-				continue;
-			for (j = 0; j < bnad->num_rxp_per_rx; j++) {
-				sprintf(string, "rxq%d_packets", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxq%d_bytes", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxq%d_packets_with_error",
-								q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxq%d_allocbuf_failed", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxq%d_mapbuf_failed", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxq%d_producer_index", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "rxq%d_consumer_index", q_num);
-				string += ETH_GSTRING_LEN;
-				q_num++;
-				if (bnad->rx_info[i].rx_ctrl[j].ccb &&
-					bnad->rx_info[i].rx_ctrl[j].ccb->
-					rcb[1] &&
-					bnad->rx_info[i].rx_ctrl[j].ccb->
-					rcb[1]->rxq) {
-					sprintf(string, "rxq%d_packets", q_num);
-					string += ETH_GSTRING_LEN;
-					sprintf(string, "rxq%d_bytes", q_num);
-					string += ETH_GSTRING_LEN;
-					sprintf(string,
-					"rxq%d_packets_with_error", q_num);
-					string += ETH_GSTRING_LEN;
-					sprintf(string, "rxq%d_allocbuf_failed",
-								q_num);
-					string += ETH_GSTRING_LEN;
-					sprintf(string, "rxq%d_mapbuf_failed",
-						q_num);
-					string += ETH_GSTRING_LEN;
-					sprintf(string, "rxq%d_producer_index",
-								q_num);
-					string += ETH_GSTRING_LEN;
-					sprintf(string, "rxq%d_consumer_index",
-								q_num);
-					string += ETH_GSTRING_LEN;
-					q_num++;
-				}
-			}
-		}
+	q_num = 0;
+	for (i = 0; i < bnad->num_rx; i++) {
+		if (!bnad->rx_info[i].rx)
+			continue;
+		for (j = 0; j < bnad->num_rxp_per_rx; j++)
+			bnad_get_cq_strings(&string, q_num++);
+	}
 
-		q_num = 0;
-		for (i = 0; i < bnad->num_tx; i++) {
-			if (!bnad->tx_info[i].tx)
-				continue;
-			for (j = 0; j < bnad->num_txq_per_tx; j++) {
-				sprintf(string, "txq%d_packets", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txq%d_bytes", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txq%d_producer_index", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txq%d_consumer_index", q_num);
-				string += ETH_GSTRING_LEN;
-				sprintf(string, "txq%d_hw_consumer_index",
-									q_num);
-				string += ETH_GSTRING_LEN;
-				q_num++;
-			}
+	q_num = 0;
+	for (i = 0; i < bnad->num_rx; i++) {
+		if (!bnad->rx_info[i].rx)
+			continue;
+		for (j = 0; j < bnad->num_rxp_per_rx; j++) {
+			bnad_get_rxq_strings(&string, q_num++);
+			if (bnad->rx_info[i].rx_ctrl[j].ccb &&
+			    bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1] &&
+			    bnad->rx_info[i].rx_ctrl[j].ccb->rcb[1]->rxq)
+				bnad_get_rxq_strings(&string, q_num++);
 		}
+	}
 
-		break;
-
-	default:
-		break;
+	q_num = 0;
+	for (i = 0; i < bnad->num_tx; i++) {
+		if (!bnad->tx_info[i].tx)
+			continue;
+		for (j = 0; j < bnad->num_txq_per_tx; j++)
+			bnad_get_txq_strings(&string, q_num++);
 	}
 
 	mutex_unlock(&bnad->conf_mutex);



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [RFC PATCH 10/10] ionic: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
                   ` (8 preceding siblings ...)
  2021-03-11  1:36 ` [RFC PATCH 09/10] bna: " Alexander Duyck
@ 2021-03-11  1:36 ` Alexander Duyck
  2021-03-11 17:19   ` Shannon Nelson
  9 siblings, 1 reply; 17+ messages in thread
From: Alexander Duyck @ 2021-03-11  1:36 UTC (permalink / raw)
  To: kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

From: Alexander Duyck <alexanderduyck@fb.com>

Update the ionic driver to make use of ethtool_gsprintf. In addition add
separate functions for Tx/Rx stats strings in order to reduce the total
amount of indenting needed in the driver code.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_stats.c |  145 +++++++++------------
 1 file changed, 60 insertions(+), 85 deletions(-)

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_stats.c b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
index 6ae75b771a15..1dac960386df 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_stats.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
@@ -246,98 +246,73 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif)
 	return total;
 }
 
+static void ionic_sw_stats_get_tx_strings(struct ionic_lif *lif, u8 **buf,
+					  int q_num)
+{
+	int i;
+
+	for (i = 0; i < IONIC_NUM_TX_STATS; i++)
+		ethtool_gsprintf(buf, "tx_%d_%s", q_num,
+				 ionic_tx_stats_desc[i].name);
+
+	if (!test_bit(IONIC_LIF_F_UP, lif->state) ||
+	    !test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state))
+		return;
+
+	for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++)
+		ethtool_gsprintf(buf, "txq_%d_%s", q_num,
+				 ionic_txq_stats_desc[i].name);
+	for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++)
+		ethtool_gsprintf(buf, "txq_%d_cq_%s", q_num,
+				 ionic_dbg_cq_stats_desc[i].name);
+	for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++)
+		ethtool_gsprintf(buf, "txq_%d_intr_%s", q_num,
+				 ionic_dbg_intr_stats_desc[i].name);
+	for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++)
+		ethtool_gsprintf(buf, "txq_%d_sg_cntr_%d", q_num, i);
+}
+
+static void ionic_sw_stats_get_rx_strings(struct ionic_lif *lif, u8 **buf,
+					  int q_num)
+{
+	int i;
+
+	for (i = 0; i < IONIC_NUM_RX_STATS; i++)
+		ethtool_gsprintf(buf, "rx_%d_%s", q_num,
+				 ionic_rx_stats_desc[i].name);
+
+	if (!test_bit(IONIC_LIF_F_UP, lif->state) ||
+	    !test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state))
+		return;
+
+	for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++)
+		ethtool_gsprintf(buf, "rxq_%d_cq_%s", q_num,
+				 ionic_dbg_cq_stats_desc[i].name);
+	for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++)
+		ethtool_gsprintf(buf, "rxq_%d_intr_%s", q_num,
+				 ionic_dbg_intr_stats_desc[i].name);
+	for (i = 0; i < IONIC_NUM_DBG_NAPI_STATS; i++)
+		ethtool_gsprintf(buf, "rxq_%d_napi_%s", q_num,
+				 ionic_dbg_napi_stats_desc[i].name);
+	for (i = 0; i < IONIC_MAX_NUM_NAPI_CNTR; i++)
+		ethtool_gsprintf(buf, "rxq_%d_napi_work_done_%d", q_num, i);
+}
+
 static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf)
 {
 	int i, q_num;
 
-	for (i = 0; i < IONIC_NUM_LIF_STATS; i++) {
-		snprintf(*buf, ETH_GSTRING_LEN, ionic_lif_stats_desc[i].name);
-		*buf += ETH_GSTRING_LEN;
-	}
+	for (i = 0; i < IONIC_NUM_LIF_STATS; i++)
+		ethtool_gsprintf(buf, ionic_lif_stats_desc[i].name);
 
-	for (i = 0; i < IONIC_NUM_PORT_STATS; i++) {
-		snprintf(*buf, ETH_GSTRING_LEN,
-			 ionic_port_stats_desc[i].name);
-		*buf += ETH_GSTRING_LEN;
-	}
+	for (i = 0; i < IONIC_NUM_PORT_STATS; i++)
+		ethtool_gsprintf(buf, ionic_port_stats_desc[i].name);
 
-	for (q_num = 0; q_num < MAX_Q(lif); q_num++) {
-		for (i = 0; i < IONIC_NUM_TX_STATS; i++) {
-			snprintf(*buf, ETH_GSTRING_LEN, "tx_%d_%s",
-				 q_num, ionic_tx_stats_desc[i].name);
-			*buf += ETH_GSTRING_LEN;
-		}
+	for (q_num = 0; q_num < MAX_Q(lif); q_num++)
+		ionic_sw_stats_get_tx_strings(lif, buf, q_num);
 
-		if (test_bit(IONIC_LIF_F_UP, lif->state) &&
-		    test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
-			for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "txq_%d_%s",
-					 q_num,
-					 ionic_txq_stats_desc[i].name);
-				*buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "txq_%d_cq_%s",
-					 q_num,
-					 ionic_dbg_cq_stats_desc[i].name);
-				*buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "txq_%d_intr_%s",
-					 q_num,
-					 ionic_dbg_intr_stats_desc[i].name);
-				*buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "txq_%d_sg_cntr_%d",
-					 q_num, i);
-				*buf += ETH_GSTRING_LEN;
-			}
-		}
-	}
-	for (q_num = 0; q_num < MAX_Q(lif); q_num++) {
-		for (i = 0; i < IONIC_NUM_RX_STATS; i++) {
-			snprintf(*buf, ETH_GSTRING_LEN,
-				 "rx_%d_%s",
-				 q_num, ionic_rx_stats_desc[i].name);
-			*buf += ETH_GSTRING_LEN;
-		}
-
-		if (test_bit(IONIC_LIF_F_UP, lif->state) &&
-		    test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
-			for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "rxq_%d_cq_%s",
-					 q_num,
-					 ionic_dbg_cq_stats_desc[i].name);
-				*buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "rxq_%d_intr_%s",
-					 q_num,
-					 ionic_dbg_intr_stats_desc[i].name);
-				*buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < IONIC_NUM_DBG_NAPI_STATS; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "rxq_%d_napi_%s",
-					 q_num,
-					 ionic_dbg_napi_stats_desc[i].name);
-				*buf += ETH_GSTRING_LEN;
-			}
-			for (i = 0; i < IONIC_MAX_NUM_NAPI_CNTR; i++) {
-				snprintf(*buf, ETH_GSTRING_LEN,
-					 "rxq_%d_napi_work_done_%d",
-					 q_num, i);
-				*buf += ETH_GSTRING_LEN;
-			}
-		}
-	}
+	for (q_num = 0; q_num < MAX_Q(lif); q_num++)
+		ionic_sw_stats_get_rx_strings(lif, buf, q_num);
 }
 
 static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf)



^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 01/10] ethtool: Add common function for filling out strings
  2021-03-11  1:35 ` [RFC PATCH 01/10] ethtool: Add common function for filling out strings Alexander Duyck
@ 2021-03-11  2:08   ` Jakub Kicinski
  2021-03-11 20:37     ` Jesse Brandeburg
  0 siblings, 1 reply; 17+ messages in thread
From: Jakub Kicinski @ 2021-03-11  2:08 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

On Wed, 10 Mar 2021 17:35:17 -0800 Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@fb.com>
> 
> Add a function to handle the common pattern of printing a string into the
> ethtool strings interface and incrementing the string pointer by the
> ETH_GSTRING_LEN. Most of the drivers end up doing this and several have
> implemented their own versions of this function so it would make sense to
> consolidate on one implementation.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
> ---
>  include/linux/ethtool.h |    9 +++++++++
>  net/ethtool/ioctl.c     |   12 ++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index ec4cd3921c67..0493f13b2b20 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -571,4 +571,13 @@ struct ethtool_phy_ops {
>   */
>  void ethtool_set_ethtool_phy_ops(const struct ethtool_phy_ops *ops);
>  
> +/**
> + * ethtool_gsprintf - Write formatted string to ethtool string data
> + * @data: Pointer to start of string to update
> + * @fmt: Format of string to write
> + *
> + * Write formatted string to data. Update data to point at start of
> + * next string.
> + */
> +extern __printf(2, 3) void ethtool_gsprintf(u8 **data, const char *fmt, ...);

I'd drop the 'g' TBH, it seems to have made its way from the ethtool
command ('gstrings') to various places but without the 'string' after
it - it becomes less and less meaningful. Just ethtool_sprintf() would
be fine IMHO.

Other than that there is a minor rev xmas tree violation in patch 2 :)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_gsprintf
  2021-03-11  1:35 ` [RFC PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_gsprintf Alexander Duyck
@ 2021-03-11 11:51   ` Simon Horman
  0 siblings, 0 replies; 17+ messages in thread
From: Simon Horman @ 2021-03-11 11:51 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: kuba, netdev, oss-drivers, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

On Wed, Mar 10, 2021 at 05:35:32PM -0800, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@fb.com>
> 
> The nfp_pr_et function is nearly identical to ethtool_gsprintf except for
> the fact that it passes the pointer by value and as a return whereas
> ethtool_gsprintf passes it as a pointer.
> 
> Since they are so close just update nfp to make use of ethtool_gsprintf
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>

Reviewed-by: Simon Horman <simon.horman@netronome.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [RFC PATCH 05/10] ena: Update driver to use ethtool_gsprintf
  2021-03-11  1:35 ` [RFC PATCH 05/10] ena: Update driver " Alexander Duyck
@ 2021-03-11 13:42   ` Kiyanovski, Arthur
  0 siblings, 0 replies; 17+ messages in thread
From: Kiyanovski, Arthur @ 2021-03-11 13:42 UTC (permalink / raw)
  To: Alexander Duyck, kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	snelson, Belgazal, Netanel, Tzalik, Guy, Bshara, Saeed,
	GR-Linux-NIC-Dev, skalluru, rmody, kys, haiyangz, sthemmin,
	wei.liu, mst, jasowang, pv-drivers, doshir, alexanderduyck

> -----Original Message-----
> From: Alexander Duyck <alexander.duyck@gmail.com>
> Sent: Thursday, March 11, 2021 3:36 AM
> To: 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; Belgazal, Netanel
> <netanel@amazon.com>; Kiyanovski, Arthur <akiyano@amazon.com>;
> Tzalik, Guy <gtzalik@amazon.com>; Bshara, Saeed <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
> Subject: [EXTERNAL] [RFC PATCH 05/10] ena: Update driver to use
> ethtool_gsprintf
> 
> CAUTION: This email originated from outside of the organization. Do not click
> links or open attachments unless you can confirm the sender and know the
> content is safe.
> 
> 
> 
> From: Alexander Duyck <alexanderduyck@fb.com>
> 
> Replace instances of snprintf or memcpy with a pointer update with
> ethtool_gsprintf.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>

Acked-by: Arthur Kiyanovski <akiyano@amazon.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 10/10] ionic: Update driver to use ethtool_gsprintf
  2021-03-11  1:36 ` [RFC PATCH 10/10] ionic: " Alexander Duyck
@ 2021-03-11 17:19   ` Shannon Nelson
  0 siblings, 0 replies; 17+ messages in thread
From: Shannon Nelson @ 2021-03-11 17:19 UTC (permalink / raw)
  To: Alexander Duyck, kuba
  Cc: netdev, oss-drivers, simon.horman, yisen.zhuang, salil.mehta,
	intel-wired-lan, jesse.brandeburg, anthony.l.nguyen, drivers,
	netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev, skalluru,
	rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

On 3/10/21 5:36 PM, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@fb.com>
>
> Update the ionic driver to make use of ethtool_gsprintf. In addition add
> separate functions for Tx/Rx stats strings in order to reduce the total
> amount of indenting needed in the driver code.
>
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>

Thanks, Alex!

Acked-by: Shannon Nelson <snelson@pensando.io>


> ---
>   drivers/net/ethernet/pensando/ionic/ionic_stats.c |  145 +++++++++------------
>   1 file changed, 60 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_stats.c b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
> index 6ae75b771a15..1dac960386df 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_stats.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_stats.c
> @@ -246,98 +246,73 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif)
>   	return total;
>   }
>   
> +static void ionic_sw_stats_get_tx_strings(struct ionic_lif *lif, u8 **buf,
> +					  int q_num)
> +{
> +	int i;
> +
> +	for (i = 0; i < IONIC_NUM_TX_STATS; i++)
> +		ethtool_gsprintf(buf, "tx_%d_%s", q_num,
> +				 ionic_tx_stats_desc[i].name);
> +
> +	if (!test_bit(IONIC_LIF_F_UP, lif->state) ||
> +	    !test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state))
> +		return;
> +
> +	for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++)
> +		ethtool_gsprintf(buf, "txq_%d_%s", q_num,
> +				 ionic_txq_stats_desc[i].name);
> +	for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++)
> +		ethtool_gsprintf(buf, "txq_%d_cq_%s", q_num,
> +				 ionic_dbg_cq_stats_desc[i].name);
> +	for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++)
> +		ethtool_gsprintf(buf, "txq_%d_intr_%s", q_num,
> +				 ionic_dbg_intr_stats_desc[i].name);
> +	for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++)
> +		ethtool_gsprintf(buf, "txq_%d_sg_cntr_%d", q_num, i);
> +}
> +
> +static void ionic_sw_stats_get_rx_strings(struct ionic_lif *lif, u8 **buf,
> +					  int q_num)
> +{
> +	int i;
> +
> +	for (i = 0; i < IONIC_NUM_RX_STATS; i++)
> +		ethtool_gsprintf(buf, "rx_%d_%s", q_num,
> +				 ionic_rx_stats_desc[i].name);
> +
> +	if (!test_bit(IONIC_LIF_F_UP, lif->state) ||
> +	    !test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state))
> +		return;
> +
> +	for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++)
> +		ethtool_gsprintf(buf, "rxq_%d_cq_%s", q_num,
> +				 ionic_dbg_cq_stats_desc[i].name);
> +	for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++)
> +		ethtool_gsprintf(buf, "rxq_%d_intr_%s", q_num,
> +				 ionic_dbg_intr_stats_desc[i].name);
> +	for (i = 0; i < IONIC_NUM_DBG_NAPI_STATS; i++)
> +		ethtool_gsprintf(buf, "rxq_%d_napi_%s", q_num,
> +				 ionic_dbg_napi_stats_desc[i].name);
> +	for (i = 0; i < IONIC_MAX_NUM_NAPI_CNTR; i++)
> +		ethtool_gsprintf(buf, "rxq_%d_napi_work_done_%d", q_num, i);
> +}
> +
>   static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf)
>   {
>   	int i, q_num;
>   
> -	for (i = 0; i < IONIC_NUM_LIF_STATS; i++) {
> -		snprintf(*buf, ETH_GSTRING_LEN, ionic_lif_stats_desc[i].name);
> -		*buf += ETH_GSTRING_LEN;
> -	}
> +	for (i = 0; i < IONIC_NUM_LIF_STATS; i++)
> +		ethtool_gsprintf(buf, ionic_lif_stats_desc[i].name);
>   
> -	for (i = 0; i < IONIC_NUM_PORT_STATS; i++) {
> -		snprintf(*buf, ETH_GSTRING_LEN,
> -			 ionic_port_stats_desc[i].name);
> -		*buf += ETH_GSTRING_LEN;
> -	}
> +	for (i = 0; i < IONIC_NUM_PORT_STATS; i++)
> +		ethtool_gsprintf(buf, ionic_port_stats_desc[i].name);
>   
> -	for (q_num = 0; q_num < MAX_Q(lif); q_num++) {
> -		for (i = 0; i < IONIC_NUM_TX_STATS; i++) {
> -			snprintf(*buf, ETH_GSTRING_LEN, "tx_%d_%s",
> -				 q_num, ionic_tx_stats_desc[i].name);
> -			*buf += ETH_GSTRING_LEN;
> -		}
> +	for (q_num = 0; q_num < MAX_Q(lif); q_num++)
> +		ionic_sw_stats_get_tx_strings(lif, buf, q_num);
>   
> -		if (test_bit(IONIC_LIF_F_UP, lif->state) &&
> -		    test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
> -			for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "txq_%d_%s",
> -					 q_num,
> -					 ionic_txq_stats_desc[i].name);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -			for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "txq_%d_cq_%s",
> -					 q_num,
> -					 ionic_dbg_cq_stats_desc[i].name);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -			for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "txq_%d_intr_%s",
> -					 q_num,
> -					 ionic_dbg_intr_stats_desc[i].name);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -			for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "txq_%d_sg_cntr_%d",
> -					 q_num, i);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -		}
> -	}
> -	for (q_num = 0; q_num < MAX_Q(lif); q_num++) {
> -		for (i = 0; i < IONIC_NUM_RX_STATS; i++) {
> -			snprintf(*buf, ETH_GSTRING_LEN,
> -				 "rx_%d_%s",
> -				 q_num, ionic_rx_stats_desc[i].name);
> -			*buf += ETH_GSTRING_LEN;
> -		}
> -
> -		if (test_bit(IONIC_LIF_F_UP, lif->state) &&
> -		    test_bit(IONIC_LIF_F_SW_DEBUG_STATS, lif->state)) {
> -			for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "rxq_%d_cq_%s",
> -					 q_num,
> -					 ionic_dbg_cq_stats_desc[i].name);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -			for (i = 0; i < IONIC_NUM_DBG_INTR_STATS; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "rxq_%d_intr_%s",
> -					 q_num,
> -					 ionic_dbg_intr_stats_desc[i].name);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -			for (i = 0; i < IONIC_NUM_DBG_NAPI_STATS; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "rxq_%d_napi_%s",
> -					 q_num,
> -					 ionic_dbg_napi_stats_desc[i].name);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -			for (i = 0; i < IONIC_MAX_NUM_NAPI_CNTR; i++) {
> -				snprintf(*buf, ETH_GSTRING_LEN,
> -					 "rxq_%d_napi_work_done_%d",
> -					 q_num, i);
> -				*buf += ETH_GSTRING_LEN;
> -			}
> -		}
> -	}
> +	for (q_num = 0; q_num < MAX_Q(lif); q_num++)
> +		ionic_sw_stats_get_rx_strings(lif, buf, q_num);
>   }
>   
>   static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf)
>
>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 02/10] intel: Update drivers to use ethtool_gsprintf
  2021-03-11  1:35 ` [RFC PATCH 02/10] intel: Update drivers to use ethtool_gsprintf Alexander Duyck
@ 2021-03-11 20:32   ` Jesse Brandeburg
  0 siblings, 0 replies; 17+ messages in thread
From: Jesse Brandeburg @ 2021-03-11 20:32 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: kuba, netdev, oss-drivers, simon.horman, yisen.zhuang,
	salil.mehta, intel-wired-lan, Nguyen, Anthony L, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

Alexander Duyck wrote:

> From: Alexander Duyck <alexanderduyck@fb.com>
> 
> Update the Intel drivers to make use of ethtool_gsprintf. The general idea
> is to reduce code size and overhead by replacing the repeated pattern of
> string printf statements and ETH_STRING_LEN counter increments.
> 
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
> ---
>  drivers/net/ethernet/intel/i40e/i40e_ethtool.c   |   16 ++----
>  drivers/net/ethernet/intel/ice/ice_ethtool.c     |   55 +++++++---------------
>  drivers/net/ethernet/intel/igb/igb_ethtool.c     |   40 ++++++----------
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c |   40 ++++++----------
>  4 files changed, 50 insertions(+), 101 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index c70dec65a572..932c6635cfd6 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -2368,21 +2368,15 @@ static void i40e_get_priv_flag_strings(struct net_device *netdev, u8 *data)
>  	struct i40e_netdev_priv *np = netdev_priv(netdev);
>  	struct i40e_vsi *vsi = np->vsi;
>  	struct i40e_pf *pf = vsi->back;
> -	char *p = (char *)data;
> +	u8 *p = data;
>  	unsigned int i;

As Jakub said, RCT... :-)

no other comments on the rest of the patch, looks good and Thanks!

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [RFC PATCH 01/10] ethtool: Add common function for filling out strings
  2021-03-11  2:08   ` Jakub Kicinski
@ 2021-03-11 20:37     ` Jesse Brandeburg
  0 siblings, 0 replies; 17+ messages in thread
From: Jesse Brandeburg @ 2021-03-11 20:37 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Alexander Duyck, netdev, oss-drivers, simon.horman, yisen.zhuang,
	salil.mehta, intel-wired-lan, Nguyen, Anthony L, drivers,
	snelson, netanel, akiyano, gtzalik, saeedb, GR-Linux-NIC-Dev,
	skalluru, rmody, kys, haiyangz, sthemmin, wei.liu, mst, jasowang,
	pv-drivers, doshir, alexanderduyck

Jakub Kicinski wrote:

> On Wed, 10 Mar 2021 17:35:17 -0800 Alexander Duyck wrote:
> > From: Alexander Duyck <alexanderduyck@fb.com>
> > +/**
> > + * ethtool_gsprintf - Write formatted string to ethtool string data
> > + * @data: Pointer to start of string to update
> > + * @fmt: Format of string to write
> > + *
> > + * Write formatted string to data. Update data to point at start of
> > + * next string.
> > + */
> > +extern __printf(2, 3) void ethtool_gsprintf(u8 **data, const char *fmt, ...);
> 
> I'd drop the 'g' TBH, it seems to have made its way from the ethtool
> command ('gstrings') to various places but without the 'string' after
> it - it becomes less and less meaningful. Just ethtool_sprintf() would
> be fine IMHO.
> 
> Other than that there is a minor rev xmas tree violation in patch 2 :)


I agree with Jakub, and I really like this series, it's a good clean up.

I'll be glad to add a reviewed by tag to v2.


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-03-11 20:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11  1:35 [RFC PATCH 00/10] ethtool: Factor out common code related to writing ethtool strings Alexander Duyck
2021-03-11  1:35 ` [RFC PATCH 01/10] ethtool: Add common function for filling out strings Alexander Duyck
2021-03-11  2:08   ` Jakub Kicinski
2021-03-11 20:37     ` Jesse Brandeburg
2021-03-11  1:35 ` [RFC PATCH 02/10] intel: Update drivers to use ethtool_gsprintf Alexander Duyck
2021-03-11 20:32   ` Jesse Brandeburg
2021-03-11  1:35 ` [RFC PATCH 03/10] nfp: Replace nfp_pr_et with ethtool_gsprintf Alexander Duyck
2021-03-11 11:51   ` Simon Horman
2021-03-11  1:35 ` [RFC PATCH 04/10] hisilicon: Update drivers to use ethtool_gsprintf Alexander Duyck
2021-03-11  1:35 ` [RFC PATCH 05/10] ena: Update driver " Alexander Duyck
2021-03-11 13:42   ` Kiyanovski, Arthur
2021-03-11  1:35 ` [RFC PATCH 06/10] netvsc: " Alexander Duyck
2021-03-11  1:35 ` [RFC PATCH 07/10] virtio_net: " Alexander Duyck
2021-03-11  1:36 ` [RFC PATCH 08/10] vmxnet3: " Alexander Duyck
2021-03-11  1:36 ` [RFC PATCH 09/10] bna: " Alexander Duyck
2021-03-11  1:36 ` [RFC PATCH 10/10] ionic: " Alexander Duyck
2021-03-11 17:19   ` Shannon Nelson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).