aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c79
1 files changed, 46 insertions, 33 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index ecc25aab896a..39c17cecb8b9 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -88,14 +88,14 @@
88#include "s2io.h" 88#include "s2io.h"
89#include "s2io-regs.h" 89#include "s2io-regs.h"
90 90
91#define DRV_VERSION "2.0.26.27" 91#define DRV_VERSION "2.0.26.28"
92 92
93/* S2io Driver name & version. */ 93/* S2io Driver name & version. */
94static char s2io_driver_name[] = "Neterion"; 94static const char s2io_driver_name[] = "Neterion";
95static char s2io_driver_version[] = DRV_VERSION; 95static const char s2io_driver_version[] = DRV_VERSION;
96 96
97static int rxd_size[2] = {32, 48}; 97static const int rxd_size[2] = {32, 48};
98static int rxd_count[2] = {127, 85}; 98static const int rxd_count[2] = {127, 85};
99 99
100static inline int RXD_IS_UP2DT(struct RxD_t *rxdp) 100static inline int RXD_IS_UP2DT(struct RxD_t *rxdp)
101{ 101{
@@ -3598,10 +3598,12 @@ static int s2io_set_swapper(struct s2io_nic *sp)
3598 val64 = readq(&bar0->pif_rd_swapper_fb); 3598 val64 = readq(&bar0->pif_rd_swapper_fb);
3599 if (val64 != 0x0123456789ABCDEFULL) { 3599 if (val64 != 0x0123456789ABCDEFULL) {
3600 int i = 0; 3600 int i = 0;
3601 u64 value[] = { 0xC30000C3C30000C3ULL, /* FE=1, SE=1 */ 3601 static const u64 value[] = {
3602 0x8100008181000081ULL, /* FE=1, SE=0 */ 3602 0xC30000C3C30000C3ULL, /* FE=1, SE=1 */
3603 0x4200004242000042ULL, /* FE=0, SE=1 */ 3603 0x8100008181000081ULL, /* FE=1, SE=0 */
3604 0}; /* FE=0, SE=0 */ 3604 0x4200004242000042ULL, /* FE=0, SE=1 */
3605 0 /* FE=0, SE=0 */
3606 };
3605 3607
3606 while (i < 4) { 3608 while (i < 4) {
3607 writeq(value[i], &bar0->swapper_ctrl); 3609 writeq(value[i], &bar0->swapper_ctrl);
@@ -3627,10 +3629,12 @@ static int s2io_set_swapper(struct s2io_nic *sp)
3627 3629
3628 if (val64 != valt) { 3630 if (val64 != valt) {
3629 int i = 0; 3631 int i = 0;
3630 u64 value[] = { 0x00C3C30000C3C300ULL, /* FE=1, SE=1 */ 3632 static const u64 value[] = {
3631 0x0081810000818100ULL, /* FE=1, SE=0 */ 3633 0x00C3C30000C3C300ULL, /* FE=1, SE=1 */
3632 0x0042420000424200ULL, /* FE=0, SE=1 */ 3634 0x0081810000818100ULL, /* FE=1, SE=0 */
3633 0}; /* FE=0, SE=0 */ 3635 0x0042420000424200ULL, /* FE=0, SE=1 */
3636 0 /* FE=0, SE=0 */
3637 };
3634 3638
3635 while (i < 4) { 3639 while (i < 4) {
3636 writeq((value[i] | valr), &bar0->swapper_ctrl); 3640 writeq((value[i] | valr), &bar0->swapper_ctrl);
@@ -5568,30 +5572,27 @@ static void s2io_ethtool_gringparam(struct net_device *dev,
5568 struct s2io_nic *sp = netdev_priv(dev); 5572 struct s2io_nic *sp = netdev_priv(dev);
5569 int i, tx_desc_count = 0, rx_desc_count = 0; 5573 int i, tx_desc_count = 0, rx_desc_count = 0;
5570 5574
5571 if (sp->rxd_mode == RXD_MODE_1) 5575 if (sp->rxd_mode == RXD_MODE_1) {
5572 ering->rx_max_pending = MAX_RX_DESC_1; 5576 ering->rx_max_pending = MAX_RX_DESC_1;
5573 else if (sp->rxd_mode == RXD_MODE_3B) 5577 ering->rx_jumbo_max_pending = MAX_RX_DESC_1;
5578 } else {
5574 ering->rx_max_pending = MAX_RX_DESC_2; 5579 ering->rx_max_pending = MAX_RX_DESC_2;
5580 ering->rx_jumbo_max_pending = MAX_RX_DESC_2;
5581 }
5575 5582
5583 ering->rx_mini_max_pending = 0;
5576 ering->tx_max_pending = MAX_TX_DESC; 5584 ering->tx_max_pending = MAX_TX_DESC;
5577 for (i = 0 ; i < sp->config.tx_fifo_num ; i++)
5578 tx_desc_count += sp->config.tx_cfg[i].fifo_len;
5579 5585
5580 DBG_PRINT(INFO_DBG, "max txds: %d\n", sp->config.max_txds); 5586 for (i = 0; i < sp->config.rx_ring_num; i++)
5581 ering->tx_pending = tx_desc_count;
5582 rx_desc_count = 0;
5583 for (i = 0 ; i < sp->config.rx_ring_num ; i++)
5584 rx_desc_count += sp->config.rx_cfg[i].num_rxd; 5587 rx_desc_count += sp->config.rx_cfg[i].num_rxd;
5585
5586 ering->rx_pending = rx_desc_count; 5588 ering->rx_pending = rx_desc_count;
5587
5588 ering->rx_mini_max_pending = 0;
5589 ering->rx_mini_pending = 0;
5590 if (sp->rxd_mode == RXD_MODE_1)
5591 ering->rx_jumbo_max_pending = MAX_RX_DESC_1;
5592 else if (sp->rxd_mode == RXD_MODE_3B)
5593 ering->rx_jumbo_max_pending = MAX_RX_DESC_2;
5594 ering->rx_jumbo_pending = rx_desc_count; 5589 ering->rx_jumbo_pending = rx_desc_count;
5590 ering->rx_mini_pending = 0;
5591
5592 for (i = 0; i < sp->config.tx_fifo_num; i++)
5593 tx_desc_count += sp->config.tx_cfg[i].fifo_len;
5594 ering->tx_pending = tx_desc_count;
5595 DBG_PRINT(INFO_DBG, "max txds: %d\n", sp->config.max_txds);
5595} 5596}
5596 5597
5597/** 5598/**
@@ -7692,6 +7693,8 @@ static void s2io_init_pci(struct s2io_nic *sp)
7692static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type, 7693static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
7693 u8 *dev_multiq) 7694 u8 *dev_multiq)
7694{ 7695{
7696 int i;
7697
7695 if ((tx_fifo_num > MAX_TX_FIFOS) || (tx_fifo_num < 1)) { 7698 if ((tx_fifo_num > MAX_TX_FIFOS) || (tx_fifo_num < 1)) {
7696 DBG_PRINT(ERR_DBG, "Requested number of tx fifos " 7699 DBG_PRINT(ERR_DBG, "Requested number of tx fifos "
7697 "(%d) not supported\n", tx_fifo_num); 7700 "(%d) not supported\n", tx_fifo_num);
@@ -7750,6 +7753,15 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type,
7750 DBG_PRINT(ERR_DBG, "Defaulting to 1-buffer mode\n"); 7753 DBG_PRINT(ERR_DBG, "Defaulting to 1-buffer mode\n");
7751 rx_ring_mode = 1; 7754 rx_ring_mode = 1;
7752 } 7755 }
7756
7757 for (i = 0; i < MAX_RX_RINGS; i++)
7758 if (rx_ring_sz[i] > MAX_RX_BLOCKS_PER_RING) {
7759 DBG_PRINT(ERR_DBG, "Requested rx ring size not "
7760 "supported\nDefaulting to %d\n",
7761 MAX_RX_BLOCKS_PER_RING);
7762 rx_ring_sz[i] = MAX_RX_BLOCKS_PER_RING;
7763 }
7764
7753 return SUCCESS; 7765 return SUCCESS;
7754} 7766}
7755 7767
@@ -8321,8 +8333,7 @@ mem_alloc_failed:
8321 8333
8322static void __devexit s2io_rem_nic(struct pci_dev *pdev) 8334static void __devexit s2io_rem_nic(struct pci_dev *pdev)
8323{ 8335{
8324 struct net_device *dev = 8336 struct net_device *dev = pci_get_drvdata(pdev);
8325 (struct net_device *)pci_get_drvdata(pdev);
8326 struct s2io_nic *sp; 8337 struct s2io_nic *sp;
8327 8338
8328 if (dev == NULL) { 8339 if (dev == NULL) {
@@ -8330,9 +8341,11 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev)
8330 return; 8341 return;
8331 } 8342 }
8332 8343
8333 flush_scheduled_work();
8334
8335 sp = netdev_priv(dev); 8344 sp = netdev_priv(dev);
8345
8346 cancel_work_sync(&sp->rst_timer_task);
8347 cancel_work_sync(&sp->set_link_task);
8348
8336 unregister_netdev(dev); 8349 unregister_netdev(dev);
8337 8350
8338 free_shared_mem(sp); 8351 free_shared_mem(sp);