Commit 6be3593c authored by Ganesh Venkatesan's avatar Ganesh Venkatesan Committed by Jeff Garzik

[PATCH] e1000: Fix ethtool diagnostics -- specifically for blade server

implementations
Signed-off-by: default avatarGanesh Venkatesan <ganesh.venkatesan@intel.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 0a502361
...@@ -776,7 +776,7 @@ static int ...@@ -776,7 +776,7 @@ static int
e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
uint32_t icr, mask, i=0, shared_int = TRUE; uint32_t mask, i=0, shared_int = TRUE;
uint32_t irq = adapter->pdev->irq; uint32_t irq = adapter->pdev->irq;
*data = 0; *data = 0;
...@@ -784,7 +784,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) ...@@ -784,7 +784,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
/* Hook up test interrupt handler just for this test */ /* Hook up test interrupt handler just for this test */
if(!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) { if(!request_irq(irq, &e1000_test_intr, 0, netdev->name, netdev)) {
shared_int = FALSE; shared_int = FALSE;
} else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ, netdev->name, netdev)){ } else if(request_irq(irq, &e1000_test_intr, SA_SHIRQ,
netdev->name, netdev)){
*data = 1; *data = 1;
return -1; return -1;
} }
...@@ -793,21 +794,6 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) ...@@ -793,21 +794,6 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF); E1000_WRITE_REG(&adapter->hw, IMC, 0xFFFFFFFF);
msec_delay(10); msec_delay(10);
/* Interrupts are disabled, so read interrupt cause
* register (icr) twice to verify that there are no interrupts
* pending. icr is clear on read.
*/
icr = E1000_READ_REG(&adapter->hw, ICR);
icr = E1000_READ_REG(&adapter->hw, ICR);
if(icr != 0) {
/* if icr is non-zero, there is no point
* running other interrupt tests.
*/
*data = 2;
i = 10;
}
/* Test each interrupt */ /* Test each interrupt */
for(; i < 10; i++) { for(; i < 10; i++) {
...@@ -856,8 +842,10 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) ...@@ -856,8 +842,10 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
* test failed. * test failed.
*/ */
adapter->test_icr = 0; adapter->test_icr = 0;
E1000_WRITE_REG(&adapter->hw, IMC, ~mask); E1000_WRITE_REG(&adapter->hw, IMC,
E1000_WRITE_REG(&adapter->hw, ICS, ~mask); (~mask & 0x00007FFF));
E1000_WRITE_REG(&adapter->hw, ICS,
(~mask & 0x00007FFF));
msec_delay(10); msec_delay(10);
if(adapter->test_icr) { if(adapter->test_icr) {
...@@ -1336,10 +1324,17 @@ e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1336,10 +1324,17 @@ e1000_run_loopback_test(struct e1000_adapter *adapter)
msec_delay(200); msec_delay(200);
pci_dma_sync_single_for_cpu(pdev, rxdr->buffer_info[0].dma, i = 0;
rxdr->buffer_info[0].length, PCI_DMA_FROMDEVICE); do {
pci_dma_sync_single_for_cpu(pdev, rxdr->buffer_info[i].dma,
rxdr->buffer_info[i].length,
PCI_DMA_FROMDEVICE);
if (!e1000_check_lbtest_frame(rxdr->buffer_info[i++].skb, 1024))
return 0;
} while (i < 64);
return e1000_check_lbtest_frame(rxdr->buffer_info[0].skb, 1024); return 13;
} }
static int static int
...@@ -1358,10 +1353,27 @@ static int ...@@ -1358,10 +1353,27 @@ static int
e1000_link_test(struct e1000_adapter *adapter, uint64_t *data) e1000_link_test(struct e1000_adapter *adapter, uint64_t *data)
{ {
*data = 0; *data = 0;
e1000_check_for_link(&adapter->hw);
if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) { if (adapter->hw.media_type == e1000_media_type_internal_serdes) {
*data = 1; int i = 0;
adapter->hw.serdes_link_down = TRUE;
/* on some blade server designs link establishment */
/* could take as long as 2-3 minutes. */
do {
e1000_check_for_link(&adapter->hw);
if (adapter->hw.serdes_link_down == FALSE)
return *data;
msec_delay(20);
} while (i++ < 3750);
*data = 1;
} else {
e1000_check_for_link(&adapter->hw);
if(!(E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU)) {
*data = 1;
}
} }
return *data; return *data;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment