linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xue Chaojing <xuechaojing@huawei.com>
To: <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<luoshaokai@huawei.com>, <cloud.wangxiaoyun@huawei.com>,
	<xuechaojing@huawei.com>, <chiqijun@huawei.com>,
	<wulike1@huawei.com>
Subject: [PATCH net-next] hinic: remove standard netdev stats
Date: Mon, 1 Jul 2019 23:40:00 +0000	[thread overview]
Message-ID: <20190701234000.31738-1-xuechaojing@huawei.com> (raw)

This patch removes standard netdev stats in ethtool -S.

Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Xue Chaojing <xuechaojing@huawei.com>
---
 .../net/ethernet/huawei/hinic/hinic_ethtool.c | 47 +------------------
 1 file changed, 1 insertion(+), 46 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
index 8d98f37c88a8..73a20f01ad4c 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
@@ -440,35 +440,6 @@ static u32 hinic_get_rxfh_indir_size(struct net_device *netdev)
 
 #define ARRAY_LEN(arr) ((int)((int)sizeof(arr) / (int)sizeof(arr[0])))
 
-#define HINIC_NETDEV_STAT(_stat_item) { \
-	.name = #_stat_item, \
-	.size = FIELD_SIZEOF(struct rtnl_link_stats64, _stat_item), \
-	.offset = offsetof(struct rtnl_link_stats64, _stat_item) \
-}
-
-static struct hinic_stats hinic_netdev_stats[] = {
-	HINIC_NETDEV_STAT(rx_packets),
-	HINIC_NETDEV_STAT(tx_packets),
-	HINIC_NETDEV_STAT(rx_bytes),
-	HINIC_NETDEV_STAT(tx_bytes),
-	HINIC_NETDEV_STAT(rx_errors),
-	HINIC_NETDEV_STAT(tx_errors),
-	HINIC_NETDEV_STAT(rx_dropped),
-	HINIC_NETDEV_STAT(tx_dropped),
-	HINIC_NETDEV_STAT(multicast),
-	HINIC_NETDEV_STAT(collisions),
-	HINIC_NETDEV_STAT(rx_length_errors),
-	HINIC_NETDEV_STAT(rx_over_errors),
-	HINIC_NETDEV_STAT(rx_crc_errors),
-	HINIC_NETDEV_STAT(rx_frame_errors),
-	HINIC_NETDEV_STAT(rx_fifo_errors),
-	HINIC_NETDEV_STAT(rx_missed_errors),
-	HINIC_NETDEV_STAT(tx_aborted_errors),
-	HINIC_NETDEV_STAT(tx_carrier_errors),
-	HINIC_NETDEV_STAT(tx_fifo_errors),
-	HINIC_NETDEV_STAT(tx_heartbeat_errors),
-};
-
 #define HINIC_FUNC_STAT(_stat_item) {	\
 	.name = #_stat_item, \
 	.size = FIELD_SIZEOF(struct hinic_vport_stats, _stat_item), \
@@ -658,20 +629,11 @@ static void hinic_get_ethtool_stats(struct net_device *netdev,
 {
 	struct hinic_dev *nic_dev = netdev_priv(netdev);
 	struct hinic_vport_stats vport_stats = {0};
-	const struct rtnl_link_stats64 *net_stats;
 	struct hinic_phy_port_stats *port_stats;
-	struct rtnl_link_stats64 temp;
 	u16 i = 0, j = 0;
 	char *p;
 	int err;
 
-	net_stats = dev_get_stats(netdev, &temp);
-	for (j = 0; j < ARRAY_LEN(hinic_netdev_stats); j++, i++) {
-		p = (char *)net_stats + hinic_netdev_stats[j].offset;
-		data[i] = (hinic_netdev_stats[j].size ==
-				sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
-	}
-
 	err = hinic_get_vport_stats(nic_dev, &vport_stats);
 	if (err)
 		netif_err(nic_dev, drv, netdev,
@@ -716,8 +678,7 @@ static int hinic_get_sset_count(struct net_device *netdev, int sset)
 	switch (sset) {
 	case ETH_SS_STATS:
 		q_num = nic_dev->num_qps;
-		count = ARRAY_LEN(hinic_netdev_stats) +
-			ARRAY_LEN(hinic_function_stats) +
+		count = ARRAY_LEN(hinic_function_stats) +
 			(ARRAY_LEN(hinic_tx_queue_stats) +
 			ARRAY_LEN(hinic_rx_queue_stats)) * q_num;
 
@@ -738,12 +699,6 @@ static void hinic_get_strings(struct net_device *netdev,
 
 	switch (stringset) {
 	case ETH_SS_STATS:
-		for (i = 0; i < ARRAY_LEN(hinic_netdev_stats); i++) {
-			memcpy(p, hinic_netdev_stats[i].name,
-			       ETH_GSTRING_LEN);
-			p += ETH_GSTRING_LEN;
-		}
-
 		for (i = 0; i < ARRAY_LEN(hinic_function_stats); i++) {
 			memcpy(p, hinic_function_stats[i].name,
 			       ETH_GSTRING_LEN);
-- 
2.17.1


             reply	other threads:[~2019-07-02  7:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 23:40 Xue Chaojing [this message]
2019-07-02 18:12 ` [PATCH net-next] hinic: remove standard netdev 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=20190701234000.31738-1-xuechaojing@huawei.com \
    --to=xuechaojing@huawei.com \
    --cc=chiqijun@huawei.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luoshaokai@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=wulike1@huawei.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: 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).