Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <davem@davemloft.net>

+3 -81
+2 -2
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 1126 1126 return 0; 1127 1127 } 1128 1128 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) 1131 1131 { 1132 1132 struct hns3_nic_priv *priv = netdev_priv(netdev); 1133 1133 int queue_num = priv->ae_handle->kinfo.num_tqps;
+1 -79
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
··· 59 59 60 60 #define HNS3_TQP_STATS_COUNT (HNS3_TXQ_STATS_COUNT + HNS3_RXQ_STATS_COUNT) 61 61 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 - 97 62 #define HNS3_SELF_TEST_TPYE_NUM 1 98 63 #define HNS3_NIC_LB_TEST_PKT_NUM 1 99 64 #define HNS3_NIC_LB_TEST_RING_ID 0 ··· 431 466 return data; 432 467 } 433 468 434 - static u8 *hns3_netdev_stats_get_strings(u8 *data) 435 - { 436 - int i; 437 - 438 - /* get strings for netdev */ 439 - for (i = 0; i < HNS3_NETDEV_STATS_COUNT; i++) { 440 - snprintf(data, ETH_GSTRING_LEN, 441 - hns3_netdev_stats[i].stats_string); 442 - data += ETH_GSTRING_LEN; 443 - } 444 - 445 - snprintf(data, ETH_GSTRING_LEN, "netdev_rx_dropped"); 446 - data += ETH_GSTRING_LEN; 447 - snprintf(data, ETH_GSTRING_LEN, "netdev_tx_dropped"); 448 - data += ETH_GSTRING_LEN; 449 - snprintf(data, ETH_GSTRING_LEN, "netdev_tx_timeout"); 450 - data += ETH_GSTRING_LEN; 451 - 452 - return data; 453 - } 454 - 455 469 static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data) 456 470 { 457 471 struct hnae3_handle *h = hns3_get_handle(netdev); ··· 442 498 443 499 switch (stringset) { 444 500 case ETH_SS_STATS: 445 - buff = hns3_netdev_stats_get_strings(buff); 446 501 buff = hns3_get_strings_tqps(h, buff); 447 502 h->ae_algo->ops->get_strings(h, stringset, (u8 *)buff); 448 503 break; ··· 480 537 return data; 481 538 } 482 539 483 - static u64 *hns3_get_netdev_stats(struct net_device *netdev, u64 *data) 484 - { 485 - struct hns3_nic_priv *priv = netdev_priv(netdev); 486 - const struct rtnl_link_stats64 *net_stats; 487 - struct rtnl_link_stats64 temp; 488 - u8 *stat; 489 - int i; 490 - 491 - net_stats = dev_get_stats(netdev, &temp); 492 - for (i = 0; i < HNS3_NETDEV_STATS_COUNT; i++) { 493 - stat = (u8 *)net_stats + hns3_netdev_stats[i].stats_offset; 494 - *data++ = *(u64 *)stat; 495 - } 496 - 497 - *data++ = netdev->rx_dropped.counter; 498 - *data++ = netdev->tx_dropped.counter; 499 - *data++ = priv->tx_timeout_count; 500 - 501 - return data; 502 - } 503 - 504 540 /* hns3_get_stats - get detail statistics. 505 541 * @netdev: net device 506 542 * @stats: statistics info. ··· 496 574 return; 497 575 } 498 576 499 - p = hns3_get_netdev_stats(netdev, p); 577 + h->ae_algo->ops->update_stats(h, &netdev->stats); 500 578 501 579 /* get per-queue stats */ 502 580 p = hns3_get_stats_tqps(h, p);