diff options
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r-- | drivers/net/e1000/e1000_ethtool.c | 167 |
1 files changed, 119 insertions, 48 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index c88f1a3c1b1d..d252297e4db0 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -80,6 +80,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
80 | { "tx_deferred_ok", E1000_STAT(stats.dc) }, | 80 | { "tx_deferred_ok", E1000_STAT(stats.dc) }, |
81 | { "tx_single_coll_ok", E1000_STAT(stats.scc) }, | 81 | { "tx_single_coll_ok", E1000_STAT(stats.scc) }, |
82 | { "tx_multi_coll_ok", E1000_STAT(stats.mcc) }, | 82 | { "tx_multi_coll_ok", E1000_STAT(stats.mcc) }, |
83 | { "tx_timeout_count", E1000_STAT(tx_timeout_count) }, | ||
83 | { "rx_long_length_errors", E1000_STAT(stats.roc) }, | 84 | { "rx_long_length_errors", E1000_STAT(stats.roc) }, |
84 | { "rx_short_length_errors", E1000_STAT(stats.ruc) }, | 85 | { "rx_short_length_errors", E1000_STAT(stats.ruc) }, |
85 | { "rx_align_errors", E1000_STAT(stats.algnerrc) }, | 86 | { "rx_align_errors", E1000_STAT(stats.algnerrc) }, |
@@ -93,9 +94,20 @@ static const struct e1000_stats e1000_gstrings_stats[] = { | |||
93 | { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, | 94 | { "rx_csum_offload_good", E1000_STAT(hw_csum_good) }, |
94 | { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, | 95 | { "rx_csum_offload_errors", E1000_STAT(hw_csum_err) }, |
95 | { "rx_header_split", E1000_STAT(rx_hdr_split) }, | 96 | { "rx_header_split", E1000_STAT(rx_hdr_split) }, |
97 | { "alloc_rx_buff_failed", E1000_STAT(alloc_rx_buff_failed) }, | ||
96 | }; | 98 | }; |
97 | #define E1000_STATS_LEN \ | 99 | |
100 | #ifdef CONFIG_E1000_MQ | ||
101 | #define E1000_QUEUE_STATS_LEN \ | ||
102 | (((struct e1000_adapter *)netdev->priv)->num_tx_queues + \ | ||
103 | ((struct e1000_adapter *)netdev->priv)->num_rx_queues) \ | ||
104 | * (sizeof(struct e1000_queue_stats) / sizeof(uint64_t)) | ||
105 | #else | ||
106 | #define E1000_QUEUE_STATS_LEN 0 | ||
107 | #endif | ||
108 | #define E1000_GLOBAL_STATS_LEN \ | ||
98 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) | 109 | sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats) |
110 | #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN + E1000_QUEUE_STATS_LEN) | ||
99 | static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { | 111 | static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { |
100 | "Register test (offline)", "Eeprom test (offline)", | 112 | "Register test (offline)", "Eeprom test (offline)", |
101 | "Interrupt test (offline)", "Loopback test (offline)", | 113 | "Interrupt test (offline)", "Loopback test (offline)", |
@@ -183,7 +195,15 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
183 | struct e1000_adapter *adapter = netdev_priv(netdev); | 195 | struct e1000_adapter *adapter = netdev_priv(netdev); |
184 | struct e1000_hw *hw = &adapter->hw; | 196 | struct e1000_hw *hw = &adapter->hw; |
185 | 197 | ||
186 | if(ecmd->autoneg == AUTONEG_ENABLE) { | 198 | /* When SoL/IDER sessions are active, autoneg/speed/duplex |
199 | * cannot be changed */ | ||
200 | if (e1000_check_phy_reset_block(hw)) { | ||
201 | DPRINTK(DRV, ERR, "Cannot change link characteristics " | ||
202 | "when SoL/IDER is active.\n"); | ||
203 | return -EINVAL; | ||
204 | } | ||
205 | |||
206 | if (ecmd->autoneg == AUTONEG_ENABLE) { | ||
187 | hw->autoneg = 1; | 207 | hw->autoneg = 1; |
188 | if(hw->media_type == e1000_media_type_fiber) | 208 | if(hw->media_type == e1000_media_type_fiber) |
189 | hw->autoneg_advertised = ADVERTISED_1000baseT_Full | | 209 | hw->autoneg_advertised = ADVERTISED_1000baseT_Full | |
@@ -567,21 +587,21 @@ e1000_get_drvinfo(struct net_device *netdev, | |||
567 | 587 | ||
568 | strncpy(drvinfo->driver, e1000_driver_name, 32); | 588 | strncpy(drvinfo->driver, e1000_driver_name, 32); |
569 | strncpy(drvinfo->version, e1000_driver_version, 32); | 589 | strncpy(drvinfo->version, e1000_driver_version, 32); |
570 | 590 | ||
571 | /* EEPROM image version # is reported as firware version # for | 591 | /* EEPROM image version # is reported as firmware version # for |
572 | * 8257{1|2|3} controllers */ | 592 | * 8257{1|2|3} controllers */ |
573 | e1000_read_eeprom(&adapter->hw, 5, 1, &eeprom_data); | 593 | e1000_read_eeprom(&adapter->hw, 5, 1, &eeprom_data); |
574 | switch (adapter->hw.mac_type) { | 594 | switch (adapter->hw.mac_type) { |
575 | case e1000_82571: | 595 | case e1000_82571: |
576 | case e1000_82572: | 596 | case e1000_82572: |
577 | case e1000_82573: | 597 | case e1000_82573: |
578 | sprintf(firmware_version, "%d.%d-%d", | 598 | sprintf(firmware_version, "%d.%d-%d", |
579 | (eeprom_data & 0xF000) >> 12, | 599 | (eeprom_data & 0xF000) >> 12, |
580 | (eeprom_data & 0x0FF0) >> 4, | 600 | (eeprom_data & 0x0FF0) >> 4, |
581 | eeprom_data & 0x000F); | 601 | eeprom_data & 0x000F); |
582 | break; | 602 | break; |
583 | default: | 603 | default: |
584 | sprintf(firmware_version, "n/a"); | 604 | sprintf(firmware_version, "N/A"); |
585 | } | 605 | } |
586 | 606 | ||
587 | strncpy(drvinfo->fw_version, firmware_version, 32); | 607 | strncpy(drvinfo->fw_version, firmware_version, 32); |
@@ -623,8 +643,8 @@ e1000_set_ringparam(struct net_device *netdev, | |||
623 | struct e1000_rx_ring *rxdr, *rx_old, *rx_new; | 643 | struct e1000_rx_ring *rxdr, *rx_old, *rx_new; |
624 | int i, err, tx_ring_size, rx_ring_size; | 644 | int i, err, tx_ring_size, rx_ring_size; |
625 | 645 | ||
626 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_queues; | 646 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues; |
627 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_queues; | 647 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues; |
628 | 648 | ||
629 | if (netif_running(adapter->netdev)) | 649 | if (netif_running(adapter->netdev)) |
630 | e1000_down(adapter); | 650 | e1000_down(adapter); |
@@ -663,10 +683,10 @@ e1000_set_ringparam(struct net_device *netdev, | |||
663 | E1000_MAX_TXD : E1000_MAX_82544_TXD)); | 683 | E1000_MAX_TXD : E1000_MAX_82544_TXD)); |
664 | E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); | 684 | E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE); |
665 | 685 | ||
666 | for (i = 0; i < adapter->num_queues; i++) { | 686 | for (i = 0; i < adapter->num_tx_queues; i++) |
667 | txdr[i].count = txdr->count; | 687 | txdr[i].count = txdr->count; |
688 | for (i = 0; i < adapter->num_rx_queues; i++) | ||
668 | rxdr[i].count = rxdr->count; | 689 | rxdr[i].count = rxdr->count; |
669 | } | ||
670 | 690 | ||
671 | if(netif_running(adapter->netdev)) { | 691 | if(netif_running(adapter->netdev)) { |
672 | /* Try to get new resources before deleting old */ | 692 | /* Try to get new resources before deleting old */ |
@@ -979,18 +999,17 @@ e1000_free_desc_rings(struct e1000_adapter *adapter) | |||
979 | } | 999 | } |
980 | } | 1000 | } |
981 | 1001 | ||
982 | if(txdr->desc) { | 1002 | if (txdr->desc) { |
983 | pci_free_consistent(pdev, txdr->size, txdr->desc, txdr->dma); | 1003 | pci_free_consistent(pdev, txdr->size, txdr->desc, txdr->dma); |
984 | txdr->desc = NULL; | 1004 | txdr->desc = NULL; |
985 | } | 1005 | } |
986 | if(rxdr->desc) { | 1006 | if (rxdr->desc) { |
987 | pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma); | 1007 | pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma); |
988 | rxdr->desc = NULL; | 1008 | rxdr->desc = NULL; |
989 | } | 1009 | } |
990 | 1010 | ||
991 | kfree(txdr->buffer_info); | 1011 | kfree(txdr->buffer_info); |
992 | txdr->buffer_info = NULL; | 1012 | txdr->buffer_info = NULL; |
993 | |||
994 | kfree(rxdr->buffer_info); | 1013 | kfree(rxdr->buffer_info); |
995 | rxdr->buffer_info = NULL; | 1014 | rxdr->buffer_info = NULL; |
996 | 1015 | ||
@@ -1327,11 +1346,11 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1327 | static int | 1346 | static int |
1328 | e1000_setup_loopback_test(struct e1000_adapter *adapter) | 1347 | e1000_setup_loopback_test(struct e1000_adapter *adapter) |
1329 | { | 1348 | { |
1330 | uint32_t rctl; | ||
1331 | struct e1000_hw *hw = &adapter->hw; | 1349 | struct e1000_hw *hw = &adapter->hw; |
1350 | uint32_t rctl; | ||
1332 | 1351 | ||
1333 | if (hw->media_type == e1000_media_type_fiber || | 1352 | if (hw->media_type == e1000_media_type_fiber || |
1334 | hw->media_type == e1000_media_type_internal_serdes) { | 1353 | hw->media_type == e1000_media_type_internal_serdes) { |
1335 | switch (hw->mac_type) { | 1354 | switch (hw->mac_type) { |
1336 | case e1000_82545: | 1355 | case e1000_82545: |
1337 | case e1000_82546: | 1356 | case e1000_82546: |
@@ -1362,25 +1381,25 @@ e1000_setup_loopback_test(struct e1000_adapter *adapter) | |||
1362 | static void | 1381 | static void |
1363 | e1000_loopback_cleanup(struct e1000_adapter *adapter) | 1382 | e1000_loopback_cleanup(struct e1000_adapter *adapter) |
1364 | { | 1383 | { |
1384 | struct e1000_hw *hw = &adapter->hw; | ||
1365 | uint32_t rctl; | 1385 | uint32_t rctl; |
1366 | uint16_t phy_reg; | 1386 | uint16_t phy_reg; |
1367 | struct e1000_hw *hw = &adapter->hw; | ||
1368 | 1387 | ||
1369 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 1388 | rctl = E1000_READ_REG(hw, RCTL); |
1370 | rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); | 1389 | rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC); |
1371 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 1390 | E1000_WRITE_REG(hw, RCTL, rctl); |
1372 | 1391 | ||
1373 | switch (hw->mac_type) { | 1392 | switch (hw->mac_type) { |
1374 | case e1000_82571: | 1393 | case e1000_82571: |
1375 | case e1000_82572: | 1394 | case e1000_82572: |
1376 | if (hw->media_type == e1000_media_type_fiber || | 1395 | if (hw->media_type == e1000_media_type_fiber || |
1377 | hw->media_type == e1000_media_type_internal_serdes){ | 1396 | hw->media_type == e1000_media_type_internal_serdes) { |
1378 | #define E1000_SERDES_LB_OFF 0x400 | 1397 | #define E1000_SERDES_LB_OFF 0x400 |
1379 | E1000_WRITE_REG(hw, SCTL, E1000_SERDES_LB_OFF); | 1398 | E1000_WRITE_REG(hw, SCTL, E1000_SERDES_LB_OFF); |
1380 | msec_delay(10); | 1399 | msec_delay(10); |
1381 | break; | 1400 | break; |
1382 | } | 1401 | } |
1383 | /* fall thru for Cu adapters */ | 1402 | /* Fall Through */ |
1384 | case e1000_82545: | 1403 | case e1000_82545: |
1385 | case e1000_82546: | 1404 | case e1000_82546: |
1386 | case e1000_82545_rev_3: | 1405 | case e1000_82545_rev_3: |
@@ -1401,7 +1420,7 @@ static void | |||
1401 | e1000_create_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | 1420 | e1000_create_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) |
1402 | { | 1421 | { |
1403 | memset(skb->data, 0xFF, frame_size); | 1422 | memset(skb->data, 0xFF, frame_size); |
1404 | frame_size = (frame_size % 2) ? (frame_size - 1) : frame_size; | 1423 | frame_size &= ~1; |
1405 | memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1); | 1424 | memset(&skb->data[frame_size / 2], 0xAA, frame_size / 2 - 1); |
1406 | memset(&skb->data[frame_size / 2 + 10], 0xBE, 1); | 1425 | memset(&skb->data[frame_size / 2 + 10], 0xBE, 1); |
1407 | memset(&skb->data[frame_size / 2 + 12], 0xAF, 1); | 1426 | memset(&skb->data[frame_size / 2 + 12], 0xAF, 1); |
@@ -1410,7 +1429,7 @@ e1000_create_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | |||
1410 | static int | 1429 | static int |
1411 | e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) | 1430 | e1000_check_lbtest_frame(struct sk_buff *skb, unsigned int frame_size) |
1412 | { | 1431 | { |
1413 | frame_size = (frame_size % 2) ? (frame_size - 1) : frame_size; | 1432 | frame_size &= ~1; |
1414 | if(*(skb->data + 3) == 0xFF) { | 1433 | if(*(skb->data + 3) == 0xFF) { |
1415 | if((*(skb->data + frame_size / 2 + 10) == 0xBE) && | 1434 | if((*(skb->data + frame_size / 2 + 10) == 0xBE) && |
1416 | (*(skb->data + frame_size / 2 + 12) == 0xAF)) { | 1435 | (*(skb->data + frame_size / 2 + 12) == 0xAF)) { |
@@ -1488,14 +1507,25 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) | |||
1488 | static int | 1507 | static int |
1489 | e1000_loopback_test(struct e1000_adapter *adapter, uint64_t *data) | 1508 | e1000_loopback_test(struct e1000_adapter *adapter, uint64_t *data) |
1490 | { | 1509 | { |
1491 | if((*data = e1000_setup_desc_rings(adapter))) goto err_loopback; | 1510 | /* PHY loopback cannot be performed if SoL/IDER |
1492 | if((*data = e1000_setup_loopback_test(adapter))) | 1511 | * sessions are active */ |
1493 | goto err_loopback_setup; | 1512 | if (e1000_check_phy_reset_block(&adapter->hw)) { |
1513 | DPRINTK(DRV, ERR, "Cannot do PHY loopback test " | ||
1514 | "when SoL/IDER is active.\n"); | ||
1515 | *data = 0; | ||
1516 | goto out; | ||
1517 | } | ||
1518 | |||
1519 | if ((*data = e1000_setup_desc_rings(adapter))) | ||
1520 | goto out; | ||
1521 | if ((*data = e1000_setup_loopback_test(adapter))) | ||
1522 | goto err_loopback; | ||
1494 | *data = e1000_run_loopback_test(adapter); | 1523 | *data = e1000_run_loopback_test(adapter); |
1495 | e1000_loopback_cleanup(adapter); | 1524 | e1000_loopback_cleanup(adapter); |
1496 | err_loopback_setup: | 1525 | |
1497 | e1000_free_desc_rings(adapter); | ||
1498 | err_loopback: | 1526 | err_loopback: |
1527 | e1000_free_desc_rings(adapter); | ||
1528 | out: | ||
1499 | return *data; | 1529 | return *data; |
1500 | } | 1530 | } |
1501 | 1531 | ||
@@ -1617,6 +1647,7 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1617 | 1647 | ||
1618 | case E1000_DEV_ID_82546EB_FIBER: | 1648 | case E1000_DEV_ID_82546EB_FIBER: |
1619 | case E1000_DEV_ID_82546GB_FIBER: | 1649 | case E1000_DEV_ID_82546GB_FIBER: |
1650 | case E1000_DEV_ID_82571EB_FIBER: | ||
1620 | /* Wake events only supported on port A for dual fiber */ | 1651 | /* Wake events only supported on port A for dual fiber */ |
1621 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { | 1652 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) { |
1622 | wol->supported = 0; | 1653 | wol->supported = 0; |
@@ -1660,6 +1691,7 @@ e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) | |||
1660 | 1691 | ||
1661 | case E1000_DEV_ID_82546EB_FIBER: | 1692 | case E1000_DEV_ID_82546EB_FIBER: |
1662 | case E1000_DEV_ID_82546GB_FIBER: | 1693 | case E1000_DEV_ID_82546GB_FIBER: |
1694 | case E1000_DEV_ID_82571EB_FIBER: | ||
1663 | /* Wake events only supported on port A for dual fiber */ | 1695 | /* Wake events only supported on port A for dual fiber */ |
1664 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) | 1696 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) |
1665 | return wol->wolopts ? -EOPNOTSUPP : 0; | 1697 | return wol->wolopts ? -EOPNOTSUPP : 0; |
@@ -1721,21 +1753,21 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1721 | mod_timer(&adapter->blink_timer, jiffies); | 1753 | mod_timer(&adapter->blink_timer, jiffies); |
1722 | msleep_interruptible(data * 1000); | 1754 | msleep_interruptible(data * 1000); |
1723 | del_timer_sync(&adapter->blink_timer); | 1755 | del_timer_sync(&adapter->blink_timer); |
1724 | } | 1756 | } else if (adapter->hw.mac_type < e1000_82573) { |
1725 | else if(adapter->hw.mac_type < e1000_82573) { | 1757 | E1000_WRITE_REG(&adapter->hw, LEDCTL, |
1726 | E1000_WRITE_REG(&adapter->hw, LEDCTL, (E1000_LEDCTL_LED2_BLINK_RATE | | 1758 | (E1000_LEDCTL_LED2_BLINK_RATE | |
1727 | E1000_LEDCTL_LED0_BLINK | E1000_LEDCTL_LED2_BLINK | | 1759 | E1000_LEDCTL_LED0_BLINK | E1000_LEDCTL_LED2_BLINK | |
1728 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | | 1760 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | |
1729 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED0_MODE_SHIFT) | | 1761 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED0_MODE_SHIFT) | |
1730 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED1_MODE_SHIFT))); | 1762 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED1_MODE_SHIFT))); |
1731 | msleep_interruptible(data * 1000); | 1763 | msleep_interruptible(data * 1000); |
1732 | } | 1764 | } else { |
1733 | else { | 1765 | E1000_WRITE_REG(&adapter->hw, LEDCTL, |
1734 | E1000_WRITE_REG(&adapter->hw, LEDCTL, (E1000_LEDCTL_LED2_BLINK_RATE | | 1766 | (E1000_LEDCTL_LED2_BLINK_RATE | |
1735 | E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK | | 1767 | E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK | |
1736 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | | 1768 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | |
1737 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED1_MODE_SHIFT) | | 1769 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED1_MODE_SHIFT) | |
1738 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT))); | 1770 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT))); |
1739 | msleep_interruptible(data * 1000); | 1771 | msleep_interruptible(data * 1000); |
1740 | } | 1772 | } |
1741 | 1773 | ||
@@ -1768,19 +1800,43 @@ e1000_get_ethtool_stats(struct net_device *netdev, | |||
1768 | struct ethtool_stats *stats, uint64_t *data) | 1800 | struct ethtool_stats *stats, uint64_t *data) |
1769 | { | 1801 | { |
1770 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1802 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1803 | #ifdef CONFIG_E1000_MQ | ||
1804 | uint64_t *queue_stat; | ||
1805 | int stat_count = sizeof(struct e1000_queue_stats) / sizeof(uint64_t); | ||
1806 | int j, k; | ||
1807 | #endif | ||
1771 | int i; | 1808 | int i; |
1772 | 1809 | ||
1773 | e1000_update_stats(adapter); | 1810 | e1000_update_stats(adapter); |
1774 | for(i = 0; i < E1000_STATS_LEN; i++) { | 1811 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
1775 | char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset; | 1812 | char *p = (char *)adapter+e1000_gstrings_stats[i].stat_offset; |
1776 | data[i] = (e1000_gstrings_stats[i].sizeof_stat == | 1813 | data[i] = (e1000_gstrings_stats[i].sizeof_stat == |
1777 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; | 1814 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; |
1778 | } | 1815 | } |
1816 | #ifdef CONFIG_E1000_MQ | ||
1817 | for (j = 0; j < adapter->num_tx_queues; j++) { | ||
1818 | queue_stat = (uint64_t *)&adapter->tx_ring[j].tx_stats; | ||
1819 | for (k = 0; k < stat_count; k++) | ||
1820 | data[i + k] = queue_stat[k]; | ||
1821 | i += k; | ||
1822 | } | ||
1823 | for (j = 0; j < adapter->num_rx_queues; j++) { | ||
1824 | queue_stat = (uint64_t *)&adapter->rx_ring[j].rx_stats; | ||
1825 | for (k = 0; k < stat_count; k++) | ||
1826 | data[i + k] = queue_stat[k]; | ||
1827 | i += k; | ||
1828 | } | ||
1829 | #endif | ||
1830 | /* BUG_ON(i != E1000_STATS_LEN); */ | ||
1779 | } | 1831 | } |
1780 | 1832 | ||
1781 | static void | 1833 | static void |
1782 | e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | 1834 | e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) |
1783 | { | 1835 | { |
1836 | #ifdef CONFIG_E1000_MQ | ||
1837 | struct e1000_adapter *adapter = netdev_priv(netdev); | ||
1838 | #endif | ||
1839 | uint8_t *p = data; | ||
1784 | int i; | 1840 | int i; |
1785 | 1841 | ||
1786 | switch(stringset) { | 1842 | switch(stringset) { |
@@ -1789,11 +1845,26 @@ e1000_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | |||
1789 | E1000_TEST_LEN*ETH_GSTRING_LEN); | 1845 | E1000_TEST_LEN*ETH_GSTRING_LEN); |
1790 | break; | 1846 | break; |
1791 | case ETH_SS_STATS: | 1847 | case ETH_SS_STATS: |
1792 | for (i=0; i < E1000_STATS_LEN; i++) { | 1848 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { |
1793 | memcpy(data + i * ETH_GSTRING_LEN, | 1849 | memcpy(p, e1000_gstrings_stats[i].stat_string, |
1794 | e1000_gstrings_stats[i].stat_string, | 1850 | ETH_GSTRING_LEN); |
1795 | ETH_GSTRING_LEN); | 1851 | p += ETH_GSTRING_LEN; |
1852 | } | ||
1853 | #ifdef CONFIG_E1000_MQ | ||
1854 | for (i = 0; i < adapter->num_tx_queues; i++) { | ||
1855 | sprintf(p, "tx_queue_%u_packets", i); | ||
1856 | p += ETH_GSTRING_LEN; | ||
1857 | sprintf(p, "tx_queue_%u_bytes", i); | ||
1858 | p += ETH_GSTRING_LEN; | ||
1796 | } | 1859 | } |
1860 | for (i = 0; i < adapter->num_rx_queues; i++) { | ||
1861 | sprintf(p, "rx_queue_%u_packets", i); | ||
1862 | p += ETH_GSTRING_LEN; | ||
1863 | sprintf(p, "rx_queue_%u_bytes", i); | ||
1864 | p += ETH_GSTRING_LEN; | ||
1865 | } | ||
1866 | #endif | ||
1867 | /* BUG_ON(p - data != E1000_STATS_LEN * ETH_GSTRING_LEN); */ | ||
1797 | break; | 1868 | break; |
1798 | } | 1869 | } |
1799 | } | 1870 | } |