Skip to content

Commit 45f8982

Browse files
committed
Merge branch 'hns3-next'
Peng Li says: ==================== code improvements in HNS3 driver This patchset fixes 2 comments for community review. [patch 1/2] reverts "net: hns3: Add packet statistics of netdev" reported by Jakub Kicinski and David Miller. [patch 2/2] reports the function type the same line with hns3_nic_get_stats64, reported by Andrew Lunn. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 68d5c26 + 6c88d9d commit 45f8982

File tree

2 files changed

+3
-81
lines changed

2 files changed

+3
-81
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,8 +1126,8 @@ static int hns3_nic_set_features(struct net_device *netdev,
11261126
return 0;
11271127
}
11281128

1129-
static void
1130-
hns3_nic_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats)
1129+
static void hns3_nic_get_stats64(struct net_device *netdev,
1130+
struct rtnl_link_stats64 *stats)
11311131
{
11321132
struct hns3_nic_priv *priv = netdev_priv(netdev);
11331133
int queue_num = priv->ae_handle->kinfo.num_tqps;

drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -59,41 +59,6 @@ static const struct hns3_stats hns3_rxq_stats[] = {
5959

6060
#define HNS3_TQP_STATS_COUNT (HNS3_TXQ_STATS_COUNT + HNS3_RXQ_STATS_COUNT)
6161

62-
/* netdev stats */
63-
#define HNS3_NETDEV_STAT(_string, _member) { \
64-
.stats_string = _string, \
65-
.stats_offset = offsetof(struct rtnl_link_stats64, _member) \
66-
}
67-
68-
static const struct hns3_stats hns3_netdev_stats[] = {
69-
/* Rx per-queue statistics */
70-
HNS3_NETDEV_STAT("rx_packets", rx_packets),
71-
HNS3_NETDEV_STAT("tx_packets", tx_packets),
72-
HNS3_NETDEV_STAT("rx_bytes", rx_bytes),
73-
HNS3_NETDEV_STAT("tx_bytes", tx_bytes),
74-
HNS3_NETDEV_STAT("rx_errors", rx_errors),
75-
HNS3_NETDEV_STAT("tx_errors", tx_errors),
76-
HNS3_NETDEV_STAT("rx_dropped", rx_dropped),
77-
HNS3_NETDEV_STAT("tx_dropped", tx_dropped),
78-
HNS3_NETDEV_STAT("multicast", multicast),
79-
HNS3_NETDEV_STAT("collisions", collisions),
80-
HNS3_NETDEV_STAT("rx_length_errors", rx_length_errors),
81-
HNS3_NETDEV_STAT("rx_over_errors", rx_over_errors),
82-
HNS3_NETDEV_STAT("rx_crc_errors", rx_crc_errors),
83-
HNS3_NETDEV_STAT("rx_frame_errors", rx_frame_errors),
84-
HNS3_NETDEV_STAT("rx_fifo_errors", rx_fifo_errors),
85-
HNS3_NETDEV_STAT("rx_missed_errors", rx_missed_errors),
86-
HNS3_NETDEV_STAT("tx_aborted_errors", tx_aborted_errors),
87-
HNS3_NETDEV_STAT("tx_carrier_errors", tx_carrier_errors),
88-
HNS3_NETDEV_STAT("tx_fifo_errors", tx_fifo_errors),
89-
HNS3_NETDEV_STAT("tx_heartbeat_errors", tx_heartbeat_errors),
90-
HNS3_NETDEV_STAT("tx_window_errors", tx_window_errors),
91-
HNS3_NETDEV_STAT("rx_compressed", rx_compressed),
92-
HNS3_NETDEV_STAT("tx_compressed", tx_compressed),
93-
};
94-
95-
#define HNS3_NETDEV_STATS_COUNT ARRAY_SIZE(hns3_netdev_stats)
96-
9762
#define HNS3_SELF_TEST_TPYE_NUM 1
9863
#define HNS3_NIC_LB_TEST_PKT_NUM 1
9964
#define HNS3_NIC_LB_TEST_RING_ID 0
@@ -466,27 +431,6 @@ static u8 *hns3_get_strings_tqps(struct hnae3_handle *handle, u8 *data)
466431
return data;
467432
}
468433

469-
static u8 *hns3_netdev_stats_get_strings(u8 *data)
470-
{
471-
int i;
472-
473-
/* get strings for netdev */
474-
for (i = 0; i < HNS3_NETDEV_STATS_COUNT; i++) {
475-
snprintf(data, ETH_GSTRING_LEN,
476-
hns3_netdev_stats[i].stats_string);
477-
data += ETH_GSTRING_LEN;
478-
}
479-
480-
snprintf(data, ETH_GSTRING_LEN, "netdev_rx_dropped");
481-
data += ETH_GSTRING_LEN;
482-
snprintf(data, ETH_GSTRING_LEN, "netdev_tx_dropped");
483-
data += ETH_GSTRING_LEN;
484-
snprintf(data, ETH_GSTRING_LEN, "netdev_tx_timeout");
485-
data += ETH_GSTRING_LEN;
486-
487-
return data;
488-
}
489-
490434
static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
491435
{
492436
struct hnae3_handle *h = hns3_get_handle(netdev);
@@ -498,7 +442,6 @@ static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
498442

499443
switch (stringset) {
500444
case ETH_SS_STATS:
501-
buff = hns3_netdev_stats_get_strings(buff);
502445
buff = hns3_get_strings_tqps(h, buff);
503446
h->ae_algo->ops->get_strings(h, stringset, (u8 *)buff);
504447
break;
@@ -537,27 +480,6 @@ static u64 *hns3_get_stats_tqps(struct hnae3_handle *handle, u64 *data)
537480
return data;
538481
}
539482

540-
static u64 *hns3_get_netdev_stats(struct net_device *netdev, u64 *data)
541-
{
542-
struct hns3_nic_priv *priv = netdev_priv(netdev);
543-
const struct rtnl_link_stats64 *net_stats;
544-
struct rtnl_link_stats64 temp;
545-
u8 *stat;
546-
int i;
547-
548-
net_stats = dev_get_stats(netdev, &temp);
549-
for (i = 0; i < HNS3_NETDEV_STATS_COUNT; i++) {
550-
stat = (u8 *)net_stats + hns3_netdev_stats[i].stats_offset;
551-
*data++ = *(u64 *)stat;
552-
}
553-
554-
*data++ = netdev->rx_dropped.counter;
555-
*data++ = netdev->tx_dropped.counter;
556-
*data++ = priv->tx_timeout_count;
557-
558-
return data;
559-
}
560-
561483
/* hns3_get_stats - get detail statistics.
562484
* @netdev: net device
563485
* @stats: statistics info.
@@ -574,7 +496,7 @@ static void hns3_get_stats(struct net_device *netdev,
574496
return;
575497
}
576498

577-
p = hns3_get_netdev_stats(netdev, p);
499+
h->ae_algo->ops->update_stats(h, &netdev->stats);
578500

579501
/* get per-queue stats */
580502
p = hns3_get_stats_tqps(h, p);

0 commit comments

Comments
 (0)