aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnanda Raju <Ananda.Raju@neterion.com>2006-07-24 19:52:49 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-03 17:27:25 -0400
commitb41477f32a5aaf39a77741c0138b16f16a636c70 (patch)
treef7bebdbcb01fc18772c3f1569d98eba3f4a8109f
parent2b14c30b46e007a16c665cc86329bf4a1d9ff6ee (diff)
[PATCH] s2io driver bug fixes #1
This patch contains some of the bug fixes and enhancements done to s2io driver. Following are the brief description of changes 1. Introduced macro "S2IO_PARM_INT" for declaring integer load parameter 2. UDP_RR test failure, memset txdl after Tx completion 3. PXE boot may leave adapter in unknown state so do reset in probe. 4. Add Tx completion code in netpoll 5. In s2io_vpd_read() move array vpd_data[] to pointer, saves stack memory 6. Fix bug in ethtool online test Signed-off-by: Ananda Raju <ananda.raju@neterion.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/s2io.c158
-rw-r--r--drivers/net/s2io.h5
2 files changed, 85 insertions, 78 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index e1fe3a0a7b0b..4a4e38be80a8 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -370,38 +370,50 @@ static const u64 fix_mac[] = {
370 END_SIGN 370 END_SIGN
371}; 371};
372 372
373MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>");
374MODULE_LICENSE("GPL");
375MODULE_VERSION(DRV_VERSION);
376
377
373/* Module Loadable parameters. */ 378/* Module Loadable parameters. */
374static unsigned int tx_fifo_num = 1; 379S2IO_PARM_INT(tx_fifo_num, 1);
375static unsigned int tx_fifo_len[MAX_TX_FIFOS] = 380S2IO_PARM_INT(rx_ring_num, 1);
376 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN}; 381
377static unsigned int rx_ring_num = 1; 382
378static unsigned int rx_ring_sz[MAX_RX_RINGS] = 383S2IO_PARM_INT(rx_ring_mode, 1);
379 {[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT}; 384S2IO_PARM_INT(use_continuous_tx_intrs, 1);
380static unsigned int rts_frm_len[MAX_RX_RINGS] = 385S2IO_PARM_INT(rmac_pause_time, 0x100);
381 {[0 ...(MAX_RX_RINGS - 1)] = 0 }; 386S2IO_PARM_INT(mc_pause_threshold_q0q3, 187);
382static unsigned int rx_ring_mode = 1; 387S2IO_PARM_INT(mc_pause_threshold_q4q7, 187);
383static unsigned int use_continuous_tx_intrs = 1; 388S2IO_PARM_INT(shared_splits, 0);
384static unsigned int rmac_pause_time = 0x100; 389S2IO_PARM_INT(tmac_util_period, 5);
385static unsigned int mc_pause_threshold_q0q3 = 187; 390S2IO_PARM_INT(rmac_util_period, 5);
386static unsigned int mc_pause_threshold_q4q7 = 187; 391S2IO_PARM_INT(bimodal, 0);
387static unsigned int shared_splits; 392S2IO_PARM_INT(l3l4hdr_size, 128);
388static unsigned int tmac_util_period = 5;
389static unsigned int rmac_util_period = 5;
390static unsigned int bimodal = 0;
391static unsigned int l3l4hdr_size = 128;
392#ifndef CONFIG_S2IO_NAPI
393static unsigned int indicate_max_pkts;
394#endif
395/* Frequency of Rx desc syncs expressed as power of 2 */ 393/* Frequency of Rx desc syncs expressed as power of 2 */
396static unsigned int rxsync_frequency = 3; 394S2IO_PARM_INT(rxsync_frequency, 3);
397/* Interrupt type. Values can be 0(INTA), 1(MSI), 2(MSI_X) */ 395/* Interrupt type. Values can be 0(INTA), 1(MSI), 2(MSI_X) */
398static unsigned int intr_type = 0; 396S2IO_PARM_INT(intr_type, 0);
399/* Large receive offload feature */ 397/* Large receive offload feature */
400static unsigned int lro = 0; 398S2IO_PARM_INT(lro, 0);
401/* Max pkts to be aggregated by LRO at one time. If not specified, 399/* Max pkts to be aggregated by LRO at one time. If not specified,
402 * aggregation happens until we hit max IP pkt size(64K) 400 * aggregation happens until we hit max IP pkt size(64K)
403 */ 401 */
404static unsigned int lro_max_pkts = 0xFFFF; 402S2IO_PARM_INT(lro_max_pkts, 0xFFFF);
403#ifndef CONFIG_S2IO_NAPI
404S2IO_PARM_INT(indicate_max_pkts, 0);
405#endif
406
407static unsigned int tx_fifo_len[MAX_TX_FIFOS] =
408 {DEFAULT_FIFO_0_LEN, [1 ...(MAX_TX_FIFOS - 1)] = DEFAULT_FIFO_1_7_LEN};
409static unsigned int rx_ring_sz[MAX_RX_RINGS] =
410 {[0 ...(MAX_RX_RINGS - 1)] = SMALL_BLK_CNT};
411static unsigned int rts_frm_len[MAX_RX_RINGS] =
412 {[0 ...(MAX_RX_RINGS - 1)] = 0 };
413
414module_param_array(tx_fifo_len, uint, NULL, 0);
415module_param_array(rx_ring_sz, uint, NULL, 0);
416module_param_array(rts_frm_len, uint, NULL, 0);
405 417
406/* 418/*
407 * S2IO device table. 419 * S2IO device table.
@@ -464,10 +476,9 @@ static int init_shared_mem(struct s2io_nic *nic)
464 size += config->tx_cfg[i].fifo_len; 476 size += config->tx_cfg[i].fifo_len;
465 } 477 }
466 if (size > MAX_AVAILABLE_TXDS) { 478 if (size > MAX_AVAILABLE_TXDS) {
467 DBG_PRINT(ERR_DBG, "%s: Requested TxDs too high, ", 479 DBG_PRINT(ERR_DBG, "s2io: Requested TxDs too high, ");
468 __FUNCTION__);
469 DBG_PRINT(ERR_DBG, "Requested: %d, max supported: 8192\n", size); 480 DBG_PRINT(ERR_DBG, "Requested: %d, max supported: 8192\n", size);
470 return FAILURE; 481 return -EINVAL;
471 } 482 }
472 483
473 lst_size = (sizeof(TxD_t) * config->max_txds); 484 lst_size = (sizeof(TxD_t) * config->max_txds);
@@ -547,6 +558,7 @@ static int init_shared_mem(struct s2io_nic *nic)
547 nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL); 558 nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL);
548 if (!nic->ufo_in_band_v) 559 if (!nic->ufo_in_band_v)
549 return -ENOMEM; 560 return -ENOMEM;
561 memset(nic->ufo_in_band_v, 0, size);
550 562
551 /* Allocation and initialization of RXDs in Rings */ 563 /* Allocation and initialization of RXDs in Rings */
552 size = 0; 564 size = 0;
@@ -1213,7 +1225,7 @@ static int init_nic(struct s2io_nic *nic)
1213 break; 1225 break;
1214 } 1226 }
1215 1227
1216 /* Enable Tx FIFO partition 0. */ 1228 /* Enable all configured Tx FIFO partitions */
1217 val64 = readq(&bar0->tx_fifo_partition_0); 1229 val64 = readq(&bar0->tx_fifo_partition_0);
1218 val64 |= (TX_FIFO_PARTITION_EN); 1230 val64 |= (TX_FIFO_PARTITION_EN);
1219 writeq(val64, &bar0->tx_fifo_partition_0); 1231 writeq(val64, &bar0->tx_fifo_partition_0);
@@ -1650,7 +1662,7 @@ static void en_dis_able_nic_intrs(struct s2io_nic *nic, u16 mask, int flag)
1650 writeq(temp64, &bar0->general_int_mask); 1662 writeq(temp64, &bar0->general_int_mask);
1651 /* 1663 /*
1652 * If Hercules adapter enable GPIO otherwise 1664 * If Hercules adapter enable GPIO otherwise
1653 * disabled all PCIX, Flash, MDIO, IIC and GPIO 1665 * disable all PCIX, Flash, MDIO, IIC and GPIO
1654 * interrupts for now. 1666 * interrupts for now.
1655 * TODO 1667 * TODO
1656 */ 1668 */
@@ -2119,7 +2131,7 @@ static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, in
2119 frag->size, PCI_DMA_TODEVICE); 2131 frag->size, PCI_DMA_TODEVICE);
2120 } 2132 }
2121 } 2133 }
2122 txdlp->Host_Control = 0; 2134 memset(txdlp,0, (sizeof(TxD_t) * fifo_data->max_txds));
2123 return(skb); 2135 return(skb);
2124} 2136}
2125 2137
@@ -2614,23 +2626,23 @@ no_rx:
2614} 2626}
2615#endif 2627#endif
2616 2628
2629#ifdef CONFIG_NET_POLL_CONTROLLER
2617/** 2630/**
2618 * s2io_netpoll - Rx interrupt service handler for netpoll support 2631 * s2io_netpoll - netpoll event handler entry point
2619 * @dev : pointer to the device structure. 2632 * @dev : pointer to the device structure.
2620 * Description: 2633 * Description:
2621 * Polling 'interrupt' - used by things like netconsole to send skbs 2634 * This function will be called by upper layer to check for events on the
2622 * without having to re-enable interrupts. It's not called while 2635 * interface in situations where interrupts are disabled. It is used for
2623 * the interrupt routine is executing. 2636 * specific in-kernel networking tasks, such as remote consoles and kernel
2637 * debugging over the network (example netdump in RedHat).
2624 */ 2638 */
2625
2626#ifdef CONFIG_NET_POLL_CONTROLLER
2627static void s2io_netpoll(struct net_device *dev) 2639static void s2io_netpoll(struct net_device *dev)
2628{ 2640{
2629 nic_t *nic = dev->priv; 2641 nic_t *nic = dev->priv;
2630 mac_info_t *mac_control; 2642 mac_info_t *mac_control;
2631 struct config_param *config; 2643 struct config_param *config;
2632 XENA_dev_config_t __iomem *bar0 = nic->bar0; 2644 XENA_dev_config_t __iomem *bar0 = nic->bar0;
2633 u64 val64; 2645 u64 val64 = 0xFFFFFFFFFFFFFFFFULL;
2634 int i; 2646 int i;
2635 2647
2636 disable_irq(dev->irq); 2648 disable_irq(dev->irq);
@@ -2639,9 +2651,17 @@ static void s2io_netpoll(struct net_device *dev)
2639 mac_control = &nic->mac_control; 2651 mac_control = &nic->mac_control;
2640 config = &nic->config; 2652 config = &nic->config;
2641 2653
2642 val64 = readq(&bar0->rx_traffic_int);
2643 writeq(val64, &bar0->rx_traffic_int); 2654 writeq(val64, &bar0->rx_traffic_int);
2655 writeq(val64, &bar0->tx_traffic_int);
2656
2657 /* we need to free up the transmitted skbufs or else netpoll will
2658 * run out of skbs and will fail and eventually netpoll application such
2659 * as netdump will fail.
2660 */
2661 for (i = 0; i < config->tx_fifo_num; i++)
2662 tx_intr_handler(&mac_control->fifos[i]);
2644 2663
2664 /* check for received packet and indicate up to network */
2645 for (i = 0; i < config->rx_ring_num; i++) 2665 for (i = 0; i < config->rx_ring_num; i++)
2646 rx_intr_handler(&mac_control->rings[i]); 2666 rx_intr_handler(&mac_control->rings[i]);
2647 2667
@@ -3327,7 +3347,7 @@ static void s2io_reset(nic_t * sp)
3327 3347
3328 /* Clear certain PCI/PCI-X fields after reset */ 3348 /* Clear certain PCI/PCI-X fields after reset */
3329 if (sp->device_type == XFRAME_II_DEVICE) { 3349 if (sp->device_type == XFRAME_II_DEVICE) {
3330 /* Clear parity err detect bit */ 3350 /* Clear "detected parity error" bit */
3331 pci_write_config_word(sp->pdev, PCI_STATUS, 0x8000); 3351 pci_write_config_word(sp->pdev, PCI_STATUS, 0x8000);
3332 3352
3333 /* Clearing PCIX Ecc status register */ 3353 /* Clearing PCIX Ecc status register */
@@ -4942,7 +4962,8 @@ static int write_eeprom(nic_t * sp, int off, u64 data, int cnt)
4942} 4962}
4943static void s2io_vpd_read(nic_t *nic) 4963static void s2io_vpd_read(nic_t *nic)
4944{ 4964{
4945 u8 vpd_data[256],data; 4965 u8 *vpd_data;
4966 u8 data;
4946 int i=0, cnt, fail = 0; 4967 int i=0, cnt, fail = 0;
4947 int vpd_addr = 0x80; 4968 int vpd_addr = 0x80;
4948 4969
@@ -4955,6 +4976,10 @@ static void s2io_vpd_read(nic_t *nic)
4955 vpd_addr = 0x50; 4976 vpd_addr = 0x50;
4956 } 4977 }
4957 4978
4979 vpd_data = kmalloc(256, GFP_KERNEL);
4980 if (!vpd_data)
4981 return;
4982
4958 for (i = 0; i < 256; i +=4 ) { 4983 for (i = 0; i < 256; i +=4 ) {
4959 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i); 4984 pci_write_config_byte(nic->pdev, (vpd_addr + 2), i);
4960 pci_read_config_byte(nic->pdev, (vpd_addr + 2), &data); 4985 pci_read_config_byte(nic->pdev, (vpd_addr + 2), &data);
@@ -4977,6 +5002,7 @@ static void s2io_vpd_read(nic_t *nic)
4977 memset(nic->product_name, 0, vpd_data[1]); 5002 memset(nic->product_name, 0, vpd_data[1]);
4978 memcpy(nic->product_name, &vpd_data[3], vpd_data[1]); 5003 memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
4979 } 5004 }
5005 kfree(vpd_data);
4980} 5006}
4981 5007
4982/** 5008/**
@@ -5295,7 +5321,7 @@ static int s2io_link_test(nic_t * sp, uint64_t * data)
5295 else 5321 else
5296 *data = 0; 5322 *data = 0;
5297 5323
5298 return 0; 5324 return *data;
5299} 5325}
5300 5326
5301/** 5327/**
@@ -6337,7 +6363,7 @@ static int s2io_card_up(nic_t * sp)
6337 s2io_set_multicast(dev); 6363 s2io_set_multicast(dev);
6338 6364
6339 if (sp->lro) { 6365 if (sp->lro) {
6340 /* Initialize max aggregatable pkts based on MTU */ 6366 /* Initialize max aggregatable pkts per session based on MTU */
6341 sp->lro_max_aggr_per_sess = ((1<<16) - 1) / dev->mtu; 6367 sp->lro_max_aggr_per_sess = ((1<<16) - 1) / dev->mtu;
6342 /* Check if we can use(if specified) user provided value */ 6368 /* Check if we can use(if specified) user provided value */
6343 if (lro_max_pkts < sp->lro_max_aggr_per_sess) 6369 if (lro_max_pkts < sp->lro_max_aggr_per_sess)
@@ -6438,7 +6464,7 @@ static void s2io_tx_watchdog(struct net_device *dev)
6438 * @cksum : FCS checksum of the frame. 6464 * @cksum : FCS checksum of the frame.
6439 * @ring_no : the ring from which this RxD was extracted. 6465 * @ring_no : the ring from which this RxD was extracted.
6440 * Description: 6466 * Description:
6441 * This function is called by the Tx interrupt serivce routine to perform 6467 * This function is called by the Rx interrupt serivce routine to perform
6442 * some OS related operations on the SKB before passing it to the upper 6468 * some OS related operations on the SKB before passing it to the upper
6443 * layers. It mainly checks if the checksum is OK, if so adds it to the 6469 * layers. It mainly checks if the checksum is OK, if so adds it to the
6444 * SKBs cksum variable, increments the Rx packet count and passes the SKB 6470 * SKBs cksum variable, increments the Rx packet count and passes the SKB
@@ -6698,33 +6724,6 @@ static void s2io_init_pci(nic_t * sp)
6698 pci_read_config_word(sp->pdev, PCI_COMMAND, &pci_cmd); 6724 pci_read_config_word(sp->pdev, PCI_COMMAND, &pci_cmd);
6699} 6725}
6700 6726
6701MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>");
6702MODULE_LICENSE("GPL");
6703MODULE_VERSION(DRV_VERSION);
6704
6705module_param(tx_fifo_num, int, 0);
6706module_param(rx_ring_num, int, 0);
6707module_param(rx_ring_mode, int, 0);
6708module_param_array(tx_fifo_len, uint, NULL, 0);
6709module_param_array(rx_ring_sz, uint, NULL, 0);
6710module_param_array(rts_frm_len, uint, NULL, 0);
6711module_param(use_continuous_tx_intrs, int, 1);
6712module_param(rmac_pause_time, int, 0);
6713module_param(mc_pause_threshold_q0q3, int, 0);
6714module_param(mc_pause_threshold_q4q7, int, 0);
6715module_param(shared_splits, int, 0);
6716module_param(tmac_util_period, int, 0);
6717module_param(rmac_util_period, int, 0);
6718module_param(bimodal, bool, 0);
6719module_param(l3l4hdr_size, int , 0);
6720#ifndef CONFIG_S2IO_NAPI
6721module_param(indicate_max_pkts, int, 0);
6722#endif
6723module_param(rxsync_frequency, int, 0);
6724module_param(intr_type, int, 0);
6725module_param(lro, int, 0);
6726module_param(lro_max_pkts, int, 0);
6727
6728static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type) 6727static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
6729{ 6728{
6730 if ( tx_fifo_num > 8) { 6729 if ( tx_fifo_num > 8) {
@@ -6832,8 +6831,8 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6832 } 6831 }
6833 if (dev_intr_type != MSI_X) { 6832 if (dev_intr_type != MSI_X) {
6834 if (pci_request_regions(pdev, s2io_driver_name)) { 6833 if (pci_request_regions(pdev, s2io_driver_name)) {
6835 DBG_PRINT(ERR_DBG, "Request Regions failed\n"), 6834 DBG_PRINT(ERR_DBG, "Request Regions failed\n");
6836 pci_disable_device(pdev); 6835 pci_disable_device(pdev);
6837 return -ENODEV; 6836 return -ENODEV;
6838 } 6837 }
6839 } 6838 }
@@ -6957,7 +6956,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6957 /* initialize the shared memory used by the NIC and the host */ 6956 /* initialize the shared memory used by the NIC and the host */
6958 if (init_shared_mem(sp)) { 6957 if (init_shared_mem(sp)) {
6959 DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", 6958 DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n",
6960 __FUNCTION__); 6959 dev->name);
6961 ret = -ENOMEM; 6960 ret = -ENOMEM;
6962 goto mem_alloc_failed; 6961 goto mem_alloc_failed;
6963 } 6962 }
@@ -7094,6 +7093,9 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7094 dev->addr_len = ETH_ALEN; 7093 dev->addr_len = ETH_ALEN;
7095 memcpy(dev->dev_addr, sp->def_mac_addr, ETH_ALEN); 7094 memcpy(dev->dev_addr, sp->def_mac_addr, ETH_ALEN);
7096 7095
7096 /* reset Nic and bring it to known state */
7097 s2io_reset(sp);
7098
7097 /* 7099 /*
7098 * Initialize the tasklet status and link state flags 7100 * Initialize the tasklet status and link state flags
7099 * and the card state parameter 7101 * and the card state parameter
@@ -7131,11 +7133,11 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7131 goto register_failed; 7133 goto register_failed;
7132 } 7134 }
7133 s2io_vpd_read(sp); 7135 s2io_vpd_read(sp);
7134 DBG_PRINT(ERR_DBG, "%s: Neterion %s",dev->name, sp->product_name);
7135 DBG_PRINT(ERR_DBG, "(rev %d), Driver version %s\n",
7136 get_xena_rev_id(sp->pdev),
7137 s2io_driver_version);
7138 DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2005 Neterion Inc.\n"); 7136 DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2005 Neterion Inc.\n");
7137 DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name,
7138 sp->product_name, get_xena_rev_id(sp->pdev));
7139 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name,
7140 s2io_driver_version);
7139 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: " 7141 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: "
7140 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, 7142 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev->name,
7141 sp->def_mac_addr[0].mac_addr[0], 7143 sp->def_mac_addr[0].mac_addr[0],
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 217097bc22f1..1654f71a9af8 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -1011,4 +1011,9 @@ static void clear_lro_session(lro_t *lro);
1011static void queue_rx_frame(struct sk_buff *skb); 1011static void queue_rx_frame(struct sk_buff *skb);
1012static void update_L3L4_header(nic_t *sp, lro_t *lro); 1012static void update_L3L4_header(nic_t *sp, lro_t *lro);
1013static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb, u32 tcp_len); 1013static void lro_append_pkt(nic_t *sp, lro_t *lro, struct sk_buff *skb, u32 tcp_len);
1014
1015#define S2IO_PARM_INT(X, def_val) \
1016 static unsigned int X = def_val;\
1017 module_param(X , uint, 0);
1018
1014#endif /* _S2IO_H */ 1019#endif /* _S2IO_H */