aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000/e1000_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000/e1000_ethtool.c')
-rw-r--r--drivers/net/e1000/e1000_ethtool.c89
1 files changed, 46 insertions, 43 deletions
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index c67e93117271..d5ff029aa7b2 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -346,7 +346,7 @@ static int e1000_set_tso(struct net_device *netdev, u32 data)
346 346
347 netdev->features &= ~NETIF_F_TSO6; 347 netdev->features &= ~NETIF_F_TSO6;
348 348
349 DPRINTK(PROBE, INFO, "TSO is %s\n", data ? "Enabled" : "Disabled"); 349 e_info("TSO is %s\n", data ? "Enabled" : "Disabled");
350 adapter->tso_force = true; 350 adapter->tso_force = true;
351 return 0; 351 return 0;
352} 352}
@@ -714,9 +714,9 @@ static bool reg_pattern_test(struct e1000_adapter *adapter, u64 *data, int reg,
714 writel(write & test[i], address); 714 writel(write & test[i], address);
715 read = readl(address); 715 read = readl(address);
716 if (read != (write & test[i] & mask)) { 716 if (read != (write & test[i] & mask)) {
717 DPRINTK(DRV, ERR, "pattern test reg %04X failed: " 717 e_info("pattern test reg %04X failed: "
718 "got 0x%08X expected 0x%08X\n", 718 "got 0x%08X expected 0x%08X\n",
719 reg, read, (write & test[i] & mask)); 719 reg, read, (write & test[i] & mask));
720 *data = reg; 720 *data = reg;
721 return true; 721 return true;
722 } 722 }
@@ -734,9 +734,9 @@ static bool reg_set_and_check(struct e1000_adapter *adapter, u64 *data, int reg,
734 writel(write & mask, address); 734 writel(write & mask, address);
735 read = readl(address); 735 read = readl(address);
736 if ((read & mask) != (write & mask)) { 736 if ((read & mask) != (write & mask)) {
737 DPRINTK(DRV, ERR, "set/check reg %04X test failed: " 737 e_err("set/check reg %04X test failed: "
738 "got 0x%08X expected 0x%08X\n", 738 "got 0x%08X expected 0x%08X\n",
739 reg, (read & mask), (write & mask)); 739 reg, (read & mask), (write & mask));
740 *data = reg; 740 *data = reg;
741 return true; 741 return true;
742 } 742 }
@@ -779,8 +779,8 @@ static int e1000_reg_test(struct e1000_adapter *adapter, u64 *data)
779 ew32(STATUS, toggle); 779 ew32(STATUS, toggle);
780 after = er32(STATUS) & toggle; 780 after = er32(STATUS) & toggle;
781 if (value != after) { 781 if (value != after) {
782 DPRINTK(DRV, ERR, "failed STATUS register test got: " 782 e_err("failed STATUS register test got: "
783 "0x%08X expected: 0x%08X\n", after, value); 783 "0x%08X expected: 0x%08X\n", after, value);
784 *data = 1; 784 *data = 1;
785 return 1; 785 return 1;
786 } 786 }
@@ -894,8 +894,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
894 *data = 1; 894 *data = 1;
895 return -1; 895 return -1;
896 } 896 }
897 DPRINTK(HW, INFO, "testing %s interrupt\n", 897 e_info("testing %s interrupt\n", (shared_int ? "shared" : "unshared"));
898 (shared_int ? "shared" : "unshared"));
899 898
900 /* Disable all the interrupts */ 899 /* Disable all the interrupts */
901 ew32(IMC, 0xFFFFFFFF); 900 ew32(IMC, 0xFFFFFFFF);
@@ -980,9 +979,10 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
980 if (txdr->desc && txdr->buffer_info) { 979 if (txdr->desc && txdr->buffer_info) {
981 for (i = 0; i < txdr->count; i++) { 980 for (i = 0; i < txdr->count; i++) {
982 if (txdr->buffer_info[i].dma) 981 if (txdr->buffer_info[i].dma)
983 pci_unmap_single(pdev, txdr->buffer_info[i].dma, 982 dma_unmap_single(&pdev->dev,
983 txdr->buffer_info[i].dma,
984 txdr->buffer_info[i].length, 984 txdr->buffer_info[i].length,
985 PCI_DMA_TODEVICE); 985 DMA_TO_DEVICE);
986 if (txdr->buffer_info[i].skb) 986 if (txdr->buffer_info[i].skb)
987 dev_kfree_skb(txdr->buffer_info[i].skb); 987 dev_kfree_skb(txdr->buffer_info[i].skb);
988 } 988 }
@@ -991,20 +991,23 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
991 if (rxdr->desc && rxdr->buffer_info) { 991 if (rxdr->desc && rxdr->buffer_info) {
992 for (i = 0; i < rxdr->count; i++) { 992 for (i = 0; i < rxdr->count; i++) {
993 if (rxdr->buffer_info[i].dma) 993 if (rxdr->buffer_info[i].dma)
994 pci_unmap_single(pdev, rxdr->buffer_info[i].dma, 994 dma_unmap_single(&pdev->dev,
995 rxdr->buffer_info[i].dma,
995 rxdr->buffer_info[i].length, 996 rxdr->buffer_info[i].length,
996 PCI_DMA_FROMDEVICE); 997 DMA_FROM_DEVICE);
997 if (rxdr->buffer_info[i].skb) 998 if (rxdr->buffer_info[i].skb)
998 dev_kfree_skb(rxdr->buffer_info[i].skb); 999 dev_kfree_skb(rxdr->buffer_info[i].skb);
999 } 1000 }
1000 } 1001 }
1001 1002
1002 if (txdr->desc) { 1003 if (txdr->desc) {
1003 pci_free_consistent(pdev, txdr->size, txdr->desc, txdr->dma); 1004 dma_free_coherent(&pdev->dev, txdr->size, txdr->desc,
1005 txdr->dma);
1004 txdr->desc = NULL; 1006 txdr->desc = NULL;
1005 } 1007 }
1006 if (rxdr->desc) { 1008 if (rxdr->desc) {
1007 pci_free_consistent(pdev, rxdr->size, rxdr->desc, rxdr->dma); 1009 dma_free_coherent(&pdev->dev, rxdr->size, rxdr->desc,
1010 rxdr->dma);
1008 rxdr->desc = NULL; 1011 rxdr->desc = NULL;
1009 } 1012 }
1010 1013
@@ -1012,8 +1015,6 @@ static void e1000_free_desc_rings(struct e1000_adapter *adapter)
1012 txdr->buffer_info = NULL; 1015 txdr->buffer_info = NULL;
1013 kfree(rxdr->buffer_info); 1016 kfree(rxdr->buffer_info);
1014 rxdr->buffer_info = NULL; 1017 rxdr->buffer_info = NULL;
1015
1016 return;
1017} 1018}
1018 1019
1019static int e1000_setup_desc_rings(struct e1000_adapter *adapter) 1020static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
@@ -1039,7 +1040,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1039 1040
1040 txdr->size = txdr->count * sizeof(struct e1000_tx_desc); 1041 txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
1041 txdr->size = ALIGN(txdr->size, 4096); 1042 txdr->size = ALIGN(txdr->size, 4096);
1042 txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); 1043 txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
1044 GFP_KERNEL);
1043 if (!txdr->desc) { 1045 if (!txdr->desc) {
1044 ret_val = 2; 1046 ret_val = 2;
1045 goto err_nomem; 1047 goto err_nomem;
@@ -1070,8 +1072,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1070 txdr->buffer_info[i].skb = skb; 1072 txdr->buffer_info[i].skb = skb;
1071 txdr->buffer_info[i].length = skb->len; 1073 txdr->buffer_info[i].length = skb->len;
1072 txdr->buffer_info[i].dma = 1074 txdr->buffer_info[i].dma =
1073 pci_map_single(pdev, skb->data, skb->len, 1075 dma_map_single(&pdev->dev, skb->data, skb->len,
1074 PCI_DMA_TODEVICE); 1076 DMA_TO_DEVICE);
1075 tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma); 1077 tx_desc->buffer_addr = cpu_to_le64(txdr->buffer_info[i].dma);
1076 tx_desc->lower.data = cpu_to_le32(skb->len); 1078 tx_desc->lower.data = cpu_to_le32(skb->len);
1077 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP | 1079 tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP |
@@ -1093,7 +1095,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1093 } 1095 }
1094 1096
1095 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc); 1097 rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
1096 rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma); 1098 rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
1099 GFP_KERNEL);
1097 if (!rxdr->desc) { 1100 if (!rxdr->desc) {
1098 ret_val = 5; 1101 ret_val = 5;
1099 goto err_nomem; 1102 goto err_nomem;
@@ -1126,8 +1129,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1126 rxdr->buffer_info[i].skb = skb; 1129 rxdr->buffer_info[i].skb = skb;
1127 rxdr->buffer_info[i].length = E1000_RXBUFFER_2048; 1130 rxdr->buffer_info[i].length = E1000_RXBUFFER_2048;
1128 rxdr->buffer_info[i].dma = 1131 rxdr->buffer_info[i].dma =
1129 pci_map_single(pdev, skb->data, E1000_RXBUFFER_2048, 1132 dma_map_single(&pdev->dev, skb->data,
1130 PCI_DMA_FROMDEVICE); 1133 E1000_RXBUFFER_2048, DMA_FROM_DEVICE);
1131 rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma); 1134 rx_desc->buffer_addr = cpu_to_le64(rxdr->buffer_info[i].dma);
1132 memset(skb->data, 0x00, skb->len); 1135 memset(skb->data, 0x00, skb->len);
1133 } 1136 }
@@ -1444,10 +1447,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1444 for (i = 0; i < 64; i++) { /* send the packets */ 1447 for (i = 0; i < 64; i++) { /* send the packets */
1445 e1000_create_lbtest_frame(txdr->buffer_info[i].skb, 1448 e1000_create_lbtest_frame(txdr->buffer_info[i].skb,
1446 1024); 1449 1024);
1447 pci_dma_sync_single_for_device(pdev, 1450 dma_sync_single_for_device(&pdev->dev,
1448 txdr->buffer_info[k].dma, 1451 txdr->buffer_info[k].dma,
1449 txdr->buffer_info[k].length, 1452 txdr->buffer_info[k].length,
1450 PCI_DMA_TODEVICE); 1453 DMA_TO_DEVICE);
1451 if (unlikely(++k == txdr->count)) k = 0; 1454 if (unlikely(++k == txdr->count)) k = 0;
1452 } 1455 }
1453 ew32(TDT, k); 1456 ew32(TDT, k);
@@ -1455,10 +1458,10 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
1455 time = jiffies; /* set the start time for the receive */ 1458 time = jiffies; /* set the start time for the receive */
1456 good_cnt = 0; 1459 good_cnt = 0;
1457 do { /* receive the sent packets */ 1460 do { /* receive the sent packets */
1458 pci_dma_sync_single_for_cpu(pdev, 1461 dma_sync_single_for_cpu(&pdev->dev,
1459 rxdr->buffer_info[l].dma, 1462 rxdr->buffer_info[l].dma,
1460 rxdr->buffer_info[l].length, 1463 rxdr->buffer_info[l].length,
1461 PCI_DMA_FROMDEVICE); 1464 DMA_FROM_DEVICE);
1462 1465
1463 ret_val = e1000_check_lbtest_frame( 1466 ret_val = e1000_check_lbtest_frame(
1464 rxdr->buffer_info[l].skb, 1467 rxdr->buffer_info[l].skb,
@@ -1558,7 +1561,7 @@ static void e1000_diag_test(struct net_device *netdev,
1558 u8 forced_speed_duplex = hw->forced_speed_duplex; 1561 u8 forced_speed_duplex = hw->forced_speed_duplex;
1559 u8 autoneg = hw->autoneg; 1562 u8 autoneg = hw->autoneg;
1560 1563
1561 DPRINTK(HW, INFO, "offline testing starting\n"); 1564 e_info("offline testing starting\n");
1562 1565
1563 /* Link test performed before hardware reset so autoneg doesn't 1566 /* Link test performed before hardware reset so autoneg doesn't
1564 * interfere with test result */ 1567 * interfere with test result */
@@ -1598,7 +1601,7 @@ static void e1000_diag_test(struct net_device *netdev,
1598 if (if_running) 1601 if (if_running)
1599 dev_open(netdev); 1602 dev_open(netdev);
1600 } else { 1603 } else {
1601 DPRINTK(HW, INFO, "online testing starting\n"); 1604 e_info("online testing starting\n");
1602 /* Online tests */ 1605 /* Online tests */
1603 if (e1000_link_test(adapter, &data[4])) 1606 if (e1000_link_test(adapter, &data[4]))
1604 eth_test->flags |= ETH_TEST_FL_FAILED; 1607 eth_test->flags |= ETH_TEST_FL_FAILED;
@@ -1691,7 +1694,7 @@ static void e1000_get_wol(struct net_device *netdev,
1691 wol->supported &= ~WAKE_UCAST; 1694 wol->supported &= ~WAKE_UCAST;
1692 1695
1693 if (adapter->wol & E1000_WUFC_EX) 1696 if (adapter->wol & E1000_WUFC_EX)
1694 DPRINTK(DRV, ERR, "Interface does not support " 1697 e_err("Interface does not support "
1695 "directed (unicast) frame wake-up packets\n"); 1698 "directed (unicast) frame wake-up packets\n");
1696 break; 1699 break;
1697 default: 1700 default:
@@ -1706,8 +1709,6 @@ static void e1000_get_wol(struct net_device *netdev,
1706 wol->wolopts |= WAKE_BCAST; 1709 wol->wolopts |= WAKE_BCAST;
1707 if (adapter->wol & E1000_WUFC_MAG) 1710 if (adapter->wol & E1000_WUFC_MAG)
1708 wol->wolopts |= WAKE_MAGIC; 1711 wol->wolopts |= WAKE_MAGIC;
1709
1710 return;
1711} 1712}
1712 1713
1713static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) 1714static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
@@ -1725,8 +1726,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1725 switch (hw->device_id) { 1726 switch (hw->device_id) {
1726 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3: 1727 case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
1727 if (wol->wolopts & WAKE_UCAST) { 1728 if (wol->wolopts & WAKE_UCAST) {
1728 DPRINTK(DRV, ERR, "Interface does not support " 1729 e_err("Interface does not support "
1729 "directed (unicast) frame wake-up packets\n"); 1730 "directed (unicast) frame wake-up packets\n");
1730 return -EOPNOTSUPP; 1731 return -EOPNOTSUPP;
1731 } 1732 }
1732 break; 1733 break;
@@ -1803,7 +1804,7 @@ static int e1000_get_coalesce(struct net_device *netdev,
1803 if (adapter->hw.mac_type < e1000_82545) 1804 if (adapter->hw.mac_type < e1000_82545)
1804 return -EOPNOTSUPP; 1805 return -EOPNOTSUPP;
1805 1806
1806 if (adapter->itr_setting <= 3) 1807 if (adapter->itr_setting <= 4)
1807 ec->rx_coalesce_usecs = adapter->itr_setting; 1808 ec->rx_coalesce_usecs = adapter->itr_setting;
1808 else 1809 else
1809 ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting; 1810 ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting;
@@ -1821,12 +1822,14 @@ static int e1000_set_coalesce(struct net_device *netdev,
1821 return -EOPNOTSUPP; 1822 return -EOPNOTSUPP;
1822 1823
1823 if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) || 1824 if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) ||
1824 ((ec->rx_coalesce_usecs > 3) && 1825 ((ec->rx_coalesce_usecs > 4) &&
1825 (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) || 1826 (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) ||
1826 (ec->rx_coalesce_usecs == 2)) 1827 (ec->rx_coalesce_usecs == 2))
1827 return -EINVAL; 1828 return -EINVAL;
1828 1829
1829 if (ec->rx_coalesce_usecs <= 3) { 1830 if (ec->rx_coalesce_usecs == 4) {
1831 adapter->itr = adapter->itr_setting = 4;
1832 } else if (ec->rx_coalesce_usecs <= 3) {
1830 adapter->itr = 20000; 1833 adapter->itr = 20000;
1831 adapter->itr_setting = ec->rx_coalesce_usecs; 1834 adapter->itr_setting = ec->rx_coalesce_usecs;
1832 } else { 1835 } else {