diff options
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 632666706247..121cb100f93a 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -84,7 +84,7 @@ | |||
84 | #include "s2io.h" | 84 | #include "s2io.h" |
85 | #include "s2io-regs.h" | 85 | #include "s2io-regs.h" |
86 | 86 | ||
87 | #define DRV_VERSION "2.0.26.6" | 87 | #define DRV_VERSION "2.0.26.10" |
88 | 88 | ||
89 | /* S2io Driver name & version. */ | 89 | /* S2io Driver name & version. */ |
90 | static char s2io_driver_name[] = "Neterion"; | 90 | static char s2io_driver_name[] = "Neterion"; |
@@ -1081,7 +1081,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1081 | /* to set the swapper controle on the card */ | 1081 | /* to set the swapper controle on the card */ |
1082 | if(s2io_set_swapper(nic)) { | 1082 | if(s2io_set_swapper(nic)) { |
1083 | DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); | 1083 | DBG_PRINT(ERR_DBG,"ERROR: Setting Swapper failed\n"); |
1084 | return -1; | 1084 | return -EIO; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | /* | 1087 | /* |
@@ -1100,6 +1100,20 @@ static int init_nic(struct s2io_nic *nic) | |||
1100 | msleep(500); | 1100 | msleep(500); |
1101 | val64 = readq(&bar0->sw_reset); | 1101 | val64 = readq(&bar0->sw_reset); |
1102 | 1102 | ||
1103 | /* Ensure that it's safe to access registers by checking | ||
1104 | * RIC_RUNNING bit is reset. Check is valid only for XframeII. | ||
1105 | */ | ||
1106 | if (nic->device_type == XFRAME_II_DEVICE) { | ||
1107 | for (i = 0; i < 50; i++) { | ||
1108 | val64 = readq(&bar0->adapter_status); | ||
1109 | if (!(val64 & ADAPTER_STATUS_RIC_RUNNING)) | ||
1110 | break; | ||
1111 | msleep(10); | ||
1112 | } | ||
1113 | if (i == 50) | ||
1114 | return -ENODEV; | ||
1115 | } | ||
1116 | |||
1103 | /* Enable Receiving broadcasts */ | 1117 | /* Enable Receiving broadcasts */ |
1104 | add = &bar0->mac_cfg; | 1118 | add = &bar0->mac_cfg; |
1105 | val64 = readq(&bar0->mac_cfg); | 1119 | val64 = readq(&bar0->mac_cfg); |
@@ -1503,7 +1517,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1503 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", | 1517 | DBG_PRINT(ERR_DBG, "%s: failed rts ds steering", |
1504 | dev->name); | 1518 | dev->name); |
1505 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); | 1519 | DBG_PRINT(ERR_DBG, "set on codepoint %d\n", i); |
1506 | return FAILURE; | 1520 | return -ENODEV; |
1507 | } | 1521 | } |
1508 | } | 1522 | } |
1509 | 1523 | ||
@@ -1570,7 +1584,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1570 | if (time > 10) { | 1584 | if (time > 10) { |
1571 | DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", | 1585 | DBG_PRINT(ERR_DBG, "%s: TTI init Failed\n", |
1572 | dev->name); | 1586 | dev->name); |
1573 | return -1; | 1587 | return -ENODEV; |
1574 | } | 1588 | } |
1575 | msleep(50); | 1589 | msleep(50); |
1576 | time++; | 1590 | time++; |
@@ -1623,7 +1637,7 @@ static int init_nic(struct s2io_nic *nic) | |||
1623 | if (time > 10) { | 1637 | if (time > 10) { |
1624 | DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", | 1638 | DBG_PRINT(ERR_DBG, "%s: RTI init Failed\n", |
1625 | dev->name); | 1639 | dev->name); |
1626 | return -1; | 1640 | return -ENODEV; |
1627 | } | 1641 | } |
1628 | time++; | 1642 | time++; |
1629 | msleep(50); | 1643 | msleep(50); |
@@ -3914,6 +3928,12 @@ static int s2io_close(struct net_device *dev) | |||
3914 | { | 3928 | { |
3915 | struct s2io_nic *sp = dev->priv; | 3929 | struct s2io_nic *sp = dev->priv; |
3916 | 3930 | ||
3931 | /* Return if the device is already closed * | ||
3932 | * Can happen when s2io_card_up failed in change_mtu * | ||
3933 | */ | ||
3934 | if (!is_s2io_card_up(sp)) | ||
3935 | return 0; | ||
3936 | |||
3917 | netif_stop_queue(dev); | 3937 | netif_stop_queue(dev); |
3918 | napi_disable(&sp->napi); | 3938 | napi_disable(&sp->napi); |
3919 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ | 3939 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ |
@@ -6355,6 +6375,7 @@ static int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
6355 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) | 6375 | static int s2io_change_mtu(struct net_device *dev, int new_mtu) |
6356 | { | 6376 | { |
6357 | struct s2io_nic *sp = dev->priv; | 6377 | struct s2io_nic *sp = dev->priv; |
6378 | int ret = 0; | ||
6358 | 6379 | ||
6359 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { | 6380 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { |
6360 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", | 6381 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", |
@@ -6366,9 +6387,11 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6366 | if (netif_running(dev)) { | 6387 | if (netif_running(dev)) { |
6367 | s2io_card_down(sp); | 6388 | s2io_card_down(sp); |
6368 | netif_stop_queue(dev); | 6389 | netif_stop_queue(dev); |
6369 | if (s2io_card_up(sp)) { | 6390 | ret = s2io_card_up(sp); |
6391 | if (ret) { | ||
6370 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", | 6392 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", |
6371 | __FUNCTION__); | 6393 | __FUNCTION__); |
6394 | return ret; | ||
6372 | } | 6395 | } |
6373 | if (netif_queue_stopped(dev)) | 6396 | if (netif_queue_stopped(dev)) |
6374 | netif_wake_queue(dev); | 6397 | netif_wake_queue(dev); |
@@ -6379,7 +6402,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
6379 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); | 6402 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); |
6380 | } | 6403 | } |
6381 | 6404 | ||
6382 | return 0; | 6405 | return ret; |
6383 | } | 6406 | } |
6384 | 6407 | ||
6385 | /** | 6408 | /** |
@@ -6777,6 +6800,9 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io) | |||
6777 | unsigned long flags; | 6800 | unsigned long flags; |
6778 | register u64 val64 = 0; | 6801 | register u64 val64 = 0; |
6779 | 6802 | ||
6803 | if (!is_s2io_card_up(sp)) | ||
6804 | return; | ||
6805 | |||
6780 | del_timer_sync(&sp->alarm_timer); | 6806 | del_timer_sync(&sp->alarm_timer); |
6781 | /* If s2io_set_link task is executing, wait till it completes. */ | 6807 | /* If s2io_set_link task is executing, wait till it completes. */ |
6782 | while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) { | 6808 | while (test_and_set_bit(__S2IO_STATE_LINK_TASK, &(sp->state))) { |
@@ -6850,11 +6876,13 @@ static int s2io_card_up(struct s2io_nic * sp) | |||
6850 | u16 interruptible; | 6876 | u16 interruptible; |
6851 | 6877 | ||
6852 | /* Initialize the H/W I/O registers */ | 6878 | /* Initialize the H/W I/O registers */ |
6853 | if (init_nic(sp) != 0) { | 6879 | ret = init_nic(sp); |
6880 | if (ret != 0) { | ||
6854 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", | 6881 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", |
6855 | dev->name); | 6882 | dev->name); |
6856 | s2io_reset(sp); | 6883 | if (ret != -EIO) |
6857 | return -ENODEV; | 6884 | s2io_reset(sp); |
6885 | return ret; | ||
6858 | } | 6886 | } |
6859 | 6887 | ||
6860 | /* | 6888 | /* |