linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: davem@davemloft.net
Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Antoine Tenart <antoine.tenart@bootlin.com>,
	thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com,
	miquel.raynal@bootlin.com, nadavh@marvell.com,
	stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com
Subject: [PATCH net-next 2/3] net: mvpp2: Rename mvpp2_ethtool_counters to mvpp2_ethtool_mib_counters
Date: Mon, 10 Jun 2019 10:55:28 +0200	[thread overview]
Message-ID: <20190610085529.16803-3-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20190610085529.16803-1-maxime.chevallier@bootlin.com>

Since we'll be adding support for other kind of internal counters, make
clear that the currently supported counters are the MIB counters.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   | 21 ++++++++++---------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index ee653125194e..01380ccb2139 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1267,7 +1267,7 @@ static u64 mvpp2_read_count(struct mvpp2_port *port,
  * Hence, statistics gathered from userspace with ifconfig (software) and
  * ethtool (hardware) cannot be compared.
  */
-static const struct mvpp2_ethtool_counter mvpp2_ethtool_regs[] = {
+static const struct mvpp2_ethtool_counter mvpp2_ethtool_mib_regs[] = {
 	{ MVPP2_MIB_GOOD_OCTETS_RCVD, "good_octets_received", true },
 	{ MVPP2_MIB_BAD_OCTETS_RCVD, "bad_octets_received" },
 	{ MVPP2_MIB_CRC_ERRORS_SENT, "crc_errors_sent" },
@@ -1303,9 +1303,10 @@ static void mvpp2_ethtool_get_strings(struct net_device *netdev, u32 sset,
 	if (sset == ETH_SS_STATS) {
 		int i;
 
-		for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++)
+		for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_mib_regs); i++)
 			strscpy(data + i * ETH_GSTRING_LEN,
-			        mvpp2_ethtool_regs[i].string, ETH_GSTRING_LEN);
+				mvpp2_ethtool_mib_regs[i].string,
+				ETH_GSTRING_LEN);
 	}
 }
 
@@ -1320,8 +1321,8 @@ static void mvpp2_gather_hw_statistics(struct work_struct *work)
 	mutex_lock(&port->gather_stats_lock);
 
 	pstats = port->ethtool_stats;
-	for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++)
-		*pstats++ += mvpp2_read_count(port, &mvpp2_ethtool_regs[i]);
+	for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_mib_regs); i++)
+		*pstats++ += mvpp2_read_count(port, &mvpp2_ethtool_mib_regs[i]);
 
 	/* No need to read again the counters right after this function if it
 	 * was called asynchronously by the user (ie. use of ethtool).
@@ -1345,14 +1346,14 @@ static void mvpp2_ethtool_get_stats(struct net_device *dev,
 
 	mutex_lock(&port->gather_stats_lock);
 	memcpy(data, port->ethtool_stats,
-	       sizeof(u64) * ARRAY_SIZE(mvpp2_ethtool_regs));
+	       sizeof(u64) * ARRAY_SIZE(mvpp2_ethtool_mib_regs));
 	mutex_unlock(&port->gather_stats_lock);
 }
 
 static int mvpp2_ethtool_get_sset_count(struct net_device *dev, int sset)
 {
 	if (sset == ETH_SS_STATS)
-		return ARRAY_SIZE(mvpp2_ethtool_regs);
+		return ARRAY_SIZE(mvpp2_ethtool_mib_regs);
 
 	return -EOPNOTSUPP;
 }
@@ -4368,8 +4369,8 @@ static int mvpp2_port_init(struct mvpp2_port *port)
 		goto err_free_percpu;
 
 	/* Read the GOP statistics to reset the hardware counters */
-	for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_regs); i++)
-		mvpp2_read_count(port, &mvpp2_ethtool_regs[i]);
+	for (i = 0; i < ARRAY_SIZE(mvpp2_ethtool_mib_regs); i++)
+		mvpp2_read_count(port, &mvpp2_ethtool_mib_regs[i]);
 
 	return 0;
 
@@ -5052,7 +5053,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 	}
 
 	port->ethtool_stats = devm_kcalloc(&pdev->dev,
-					   ARRAY_SIZE(mvpp2_ethtool_regs),
+					   ARRAY_SIZE(mvpp2_ethtool_mib_regs),
 					   sizeof(u64), GFP_KERNEL);
 	if (!port->ethtool_stats) {
 		err = -ENOMEM;
-- 
2.20.1


  parent reply	other threads:[~2019-06-10  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10  8:55 [PATCH net-next 0/3] net: mvpp2: Add extra ethtool stats Maxime Chevallier
2019-06-10  8:55 ` [PATCH net-next 1/3] net: mvpp2: Only clear the stat counters at port init Maxime Chevallier
2019-06-10  8:55 ` Maxime Chevallier [this message]
2019-06-10  8:55 ` [PATCH net-next 3/3] net: mvpp2: Add support for more ethtool counters Maxime Chevallier
2019-06-10 16:13 ` [PATCH net-next 0/3] net: mvpp2: Add extra ethtool stats David Miller

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=20190610085529.16803-3-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=antoine.tenart@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanc@marvell.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=ymarkman@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).