aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 13:15:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-24 13:15:13 -0400
commita319a2773a13bab56a0d0b3744ba8703324313b5 (patch)
treef02c86acabd1031439fd422a167784007e84ebb1 /drivers/net/s2io.c
parente18fa700c9a31360bc8f193aa543b7ef7b39a06b (diff)
parent183798799216fad36c7219fe8d4d6dee6b8fa755 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (217 commits) net/ieee80211: fix more crypto-related build breakage [PATCH] Spidernet: add ethtool -S (show statistics) [NET] GT96100: Delete bitrotting ethernet driver [PATCH] mv643xx_eth: restrict to 32-bit PPC_MULTIPLATFORM [PATCH] Cirrus Logic ep93xx ethernet driver r8169: the MMIO region of the 8167 stands behin BAR#1 e1000, ixgb: Remove pointless wrappers [PATCH] Remove powerpc specific parts of 3c509 driver [PATCH] s2io: Switch to pci_get_device [PATCH] gt96100: move to pci_get_device API [PATCH] ehea: bugfix for register access functions [PATCH] e1000 disable device on PCI error drivers/net/phy/fixed: #if 0 some incomplete code drivers/net: const-ify ethtool_ops declarations [PATCH] ethtool: allow const ethtool_ops [PATCH] sky2: big endian [PATCH] sky2: fiber support [PATCH] sky2: tx pause bug fix drivers/net: Trim trailing whitespace [PATCH] ehea: IBM eHEA Ethernet Device Driver ... Manually resolved conflicts in drivers/net/ixgb/ixgb_main.c and drivers/net/sky2.c related to CHECKSUM_HW/CHECKSUM_PARTIAL changes by commit 84fa7933a33f806bbbaae6775e87459b1ec584c0 that just happened to be next to unrelated changes in this update.
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 5b3713f622d7..f5dbeb27b6f0 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -530,9 +530,9 @@ static int init_shared_mem(struct s2io_nic *nic)
530 */ 530 */
531 if (!tmp_p) { 531 if (!tmp_p) {
532 mac_control->zerodma_virt_addr = tmp_v; 532 mac_control->zerodma_virt_addr = tmp_v;
533 DBG_PRINT(INIT_DBG, 533 DBG_PRINT(INIT_DBG,
534 "%s: Zero DMA address for TxDL. ", dev->name); 534 "%s: Zero DMA address for TxDL. ", dev->name);
535 DBG_PRINT(INIT_DBG, 535 DBG_PRINT(INIT_DBG,
536 "Virtual address %p\n", tmp_v); 536 "Virtual address %p\n", tmp_v);
537 tmp_v = pci_alloc_consistent(nic->pdev, 537 tmp_v = pci_alloc_consistent(nic->pdev,
538 PAGE_SIZE, &tmp_p); 538 PAGE_SIZE, &tmp_p);
@@ -756,7 +756,7 @@ static void free_shared_mem(struct s2io_nic *nic)
756 for (j = 0; j < page_num; j++) { 756 for (j = 0; j < page_num; j++) {
757 int mem_blks = (j * lst_per_page); 757 int mem_blks = (j * lst_per_page);
758 if (!mac_control->fifos[i].list_info) 758 if (!mac_control->fifos[i].list_info)
759 return; 759 return;
760 if (!mac_control->fifos[i].list_info[mem_blks]. 760 if (!mac_control->fifos[i].list_info[mem_blks].
761 list_virt_addr) 761 list_virt_addr)
762 break; 762 break;
@@ -775,7 +775,7 @@ static void free_shared_mem(struct s2io_nic *nic)
775 pci_free_consistent(nic->pdev, PAGE_SIZE, 775 pci_free_consistent(nic->pdev, PAGE_SIZE,
776 mac_control->zerodma_virt_addr, 776 mac_control->zerodma_virt_addr,
777 (dma_addr_t)0); 777 (dma_addr_t)0);
778 DBG_PRINT(INIT_DBG, 778 DBG_PRINT(INIT_DBG,
779 "%s: Freeing TxDL with zero DMA addr. ", 779 "%s: Freeing TxDL with zero DMA addr. ",
780 dev->name); 780 dev->name);
781 DBG_PRINT(INIT_DBG, "Virtual address %p\n", 781 DBG_PRINT(INIT_DBG, "Virtual address %p\n",
@@ -855,9 +855,10 @@ static int s2io_verify_pci_mode(nic_t *nic)
855static int s2io_on_nec_bridge(struct pci_dev *s2io_pdev) 855static int s2io_on_nec_bridge(struct pci_dev *s2io_pdev)
856{ 856{
857 struct pci_dev *tdev = NULL; 857 struct pci_dev *tdev = NULL;
858 while ((tdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) { 858 while ((tdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, tdev)) != NULL) {
859 if ((tdev->vendor == NEC_VENID) && (tdev->device == NEC_DEVID)){ 859 if (tdev->vendor == NEC_VENID && tdev->device == NEC_DEVID) {
860 if (tdev->bus == s2io_pdev->bus->parent) 860 if (tdev->bus == s2io_pdev->bus->parent)
861 pci_dev_put(tdev);
861 return 1; 862 return 1;
862 } 863 }
863 } 864 }
@@ -1276,7 +1277,7 @@ static int init_nic(struct s2io_nic *nic)
1276 writeq(val64, &bar0->rx_w_round_robin_1); 1277 writeq(val64, &bar0->rx_w_round_robin_1);
1277 val64 = 0x0200010000010203ULL; 1278 val64 = 0x0200010000010203ULL;
1278 writeq(val64, &bar0->rx_w_round_robin_2); 1279 writeq(val64, &bar0->rx_w_round_robin_2);
1279 val64 = 0x0001020001000001ULL; 1280 val64 = 0x0001020001000001ULL;
1280 writeq(val64, &bar0->rx_w_round_robin_3); 1281 writeq(val64, &bar0->rx_w_round_robin_3);
1281 val64 = 0x0203000100000000ULL; 1282 val64 = 0x0203000100000000ULL;
1282 writeq(val64, &bar0->rx_w_round_robin_4); 1283 writeq(val64, &bar0->rx_w_round_robin_4);
@@ -2127,7 +2128,7 @@ static struct sk_buff *s2io_txdl_getskb(fifo_info_t *fifo_data, TxD_t *txdlp, in
2127 skb_frag_t *frag = &skb_shinfo(skb)->frags[j]; 2128 skb_frag_t *frag = &skb_shinfo(skb)->frags[j];
2128 if (!txds->Buffer_Pointer) 2129 if (!txds->Buffer_Pointer)
2129 break; 2130 break;
2130 pci_unmap_page(nic->pdev, (dma_addr_t) 2131 pci_unmap_page(nic->pdev, (dma_addr_t)
2131 txds->Buffer_Pointer, 2132 txds->Buffer_Pointer,
2132 frag->size, PCI_DMA_TODEVICE); 2133 frag->size, PCI_DMA_TODEVICE);
2133 } 2134 }
@@ -2397,7 +2398,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2397 /* Two buffer mode */ 2398 /* Two buffer mode */
2398 2399
2399 /* 2400 /*
2400 * Buffer2 will have L3/L4 header plus 2401 * Buffer2 will have L3/L4 header plus
2401 * L4 payload 2402 * L4 payload
2402 */ 2403 */
2403 ((RxD3_t*)rxdp)->Buffer2_ptr = pci_map_single 2404 ((RxD3_t*)rxdp)->Buffer2_ptr = pci_map_single
@@ -2407,7 +2408,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2407 /* Buffer-1 will be dummy buffer. Not used */ 2408 /* Buffer-1 will be dummy buffer. Not used */
2408 if (!(((RxD3_t*)rxdp)->Buffer1_ptr)) { 2409 if (!(((RxD3_t*)rxdp)->Buffer1_ptr)) {
2409 ((RxD3_t*)rxdp)->Buffer1_ptr = 2410 ((RxD3_t*)rxdp)->Buffer1_ptr =
2410 pci_map_single(nic->pdev, 2411 pci_map_single(nic->pdev,
2411 ba->ba_1, BUF1_LEN, 2412 ba->ba_1, BUF1_LEN,
2412 PCI_DMA_FROMDEVICE); 2413 PCI_DMA_FROMDEVICE);
2413 } 2414 }
@@ -2509,7 +2510,7 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
2509 ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN, 2510 ((RxD3_t*)rxdp)->Buffer0_ptr, BUF0_LEN,
2510 PCI_DMA_FROMDEVICE); 2511 PCI_DMA_FROMDEVICE);
2511 pci_unmap_single(sp->pdev, (dma_addr_t) 2512 pci_unmap_single(sp->pdev, (dma_addr_t)
2512 ((RxD3_t*)rxdp)->Buffer1_ptr, 2513 ((RxD3_t*)rxdp)->Buffer1_ptr,
2513 l3l4hdr_size + 4, 2514 l3l4hdr_size + 4,
2514 PCI_DMA_FROMDEVICE); 2515 PCI_DMA_FROMDEVICE);
2515 pci_unmap_single(sp->pdev, (dma_addr_t) 2516 pci_unmap_single(sp->pdev, (dma_addr_t)
@@ -2663,7 +2664,7 @@ static void s2io_netpoll(struct net_device *dev)
2663 writeq(val64, &bar0->rx_traffic_int); 2664 writeq(val64, &bar0->rx_traffic_int);
2664 writeq(val64, &bar0->tx_traffic_int); 2665 writeq(val64, &bar0->tx_traffic_int);
2665 2666
2666 /* we need to free up the transmitted skbufs or else netpoll will 2667 /* we need to free up the transmitted skbufs or else netpoll will
2667 * run out of skbs and will fail and eventually netpoll application such 2668 * run out of skbs and will fail and eventually netpoll application such
2668 * as netdump will fail. 2669 * as netdump will fail.
2669 */ 2670 */
@@ -3209,7 +3210,7 @@ static void alarm_intr_handler(struct s2io_nic *nic)
3209 if (val64 & SERR_SOURCE_ANY) { 3210 if (val64 & SERR_SOURCE_ANY) {
3210 nic->mac_control.stats_info->sw_stat.serious_err_cnt++; 3211 nic->mac_control.stats_info->sw_stat.serious_err_cnt++;
3211 DBG_PRINT(ERR_DBG, "%s: Device indicates ", dev->name); 3212 DBG_PRINT(ERR_DBG, "%s: Device indicates ", dev->name);
3212 DBG_PRINT(ERR_DBG, "serious error %llx!!\n", 3213 DBG_PRINT(ERR_DBG, "serious error %llx!!\n",
3213 (unsigned long long)val64); 3214 (unsigned long long)val64);
3214 netif_stop_queue(dev); 3215 netif_stop_queue(dev);
3215 schedule_work(&nic->rst_timer_task); 3216 schedule_work(&nic->rst_timer_task);
@@ -4816,7 +4817,7 @@ static int read_eeprom(nic_t * sp, int off, u64 * data)
4816 4817
4817 if (sp->device_type == XFRAME_II_DEVICE) { 4818 if (sp->device_type == XFRAME_II_DEVICE) {
4818 val64 = SPI_CONTROL_KEY(0x9) | SPI_CONTROL_SEL1 | 4819 val64 = SPI_CONTROL_KEY(0x9) | SPI_CONTROL_SEL1 |
4819 SPI_CONTROL_BYTECNT(0x3) | 4820 SPI_CONTROL_BYTECNT(0x3) |
4820 SPI_CONTROL_CMD(0x3) | SPI_CONTROL_ADDR(off); 4821 SPI_CONTROL_CMD(0x3) | SPI_CONTROL_ADDR(off);
4821 SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF); 4822 SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF);
4822 val64 |= SPI_CONTROL_REQ; 4823 val64 |= SPI_CONTROL_REQ;
@@ -4883,7 +4884,7 @@ static int write_eeprom(nic_t * sp, int off, u64 data, int cnt)
4883 writeq(SPI_DATA_WRITE(data,(cnt<<3)), &bar0->spi_data); 4884 writeq(SPI_DATA_WRITE(data,(cnt<<3)), &bar0->spi_data);
4884 4885
4885 val64 = SPI_CONTROL_KEY(0x9) | SPI_CONTROL_SEL1 | 4886 val64 = SPI_CONTROL_KEY(0x9) | SPI_CONTROL_SEL1 |
4886 SPI_CONTROL_BYTECNT(write_cnt) | 4887 SPI_CONTROL_BYTECNT(write_cnt) |
4887 SPI_CONTROL_CMD(0x2) | SPI_CONTROL_ADDR(off); 4888 SPI_CONTROL_CMD(0x2) | SPI_CONTROL_ADDR(off);
4888 SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF); 4889 SPECIAL_REG_WRITE(val64, &bar0->spi_control, LF);
4889 val64 |= SPI_CONTROL_REQ; 4890 val64 |= SPI_CONTROL_REQ;
@@ -5646,7 +5647,7 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
5646 if (stat_info->sw_stat.num_aggregations) { 5647 if (stat_info->sw_stat.num_aggregations) {
5647 u64 tmp = stat_info->sw_stat.sum_avg_pkts_aggregated; 5648 u64 tmp = stat_info->sw_stat.sum_avg_pkts_aggregated;
5648 int count = 0; 5649 int count = 0;
5649 /* 5650 /*
5650 * Since 64-bit divide does not work on all platforms, 5651 * Since 64-bit divide does not work on all platforms,
5651 * do repeated subtraction. 5652 * do repeated subtraction.
5652 */ 5653 */
@@ -5736,7 +5737,7 @@ static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data)
5736 return 0; 5737 return 0;
5737} 5738}
5738 5739
5739static struct ethtool_ops netdev_ethtool_ops = { 5740static const struct ethtool_ops netdev_ethtool_ops = {
5740 .get_settings = s2io_ethtool_gset, 5741 .get_settings = s2io_ethtool_gset,
5741 .set_settings = s2io_ethtool_sset, 5742 .set_settings = s2io_ethtool_sset,
5742 .get_drvinfo = s2io_ethtool_gdrvinfo, 5743 .get_drvinfo = s2io_ethtool_gdrvinfo,
@@ -6597,7 +6598,7 @@ static int rx_osm_handler(ring_info_t *ring_data, RxD_t * rxdp)
6597 } else { 6598 } else {
6598send_up: 6599send_up:
6599 queue_rx_frame(skb); 6600 queue_rx_frame(skb);
6600 } 6601 }
6601 dev->last_rx = jiffies; 6602 dev->last_rx = jiffies;
6602aggregate: 6603aggregate:
6603 atomic_dec(&sp->rx_bufs_left[ring_no]); 6604 atomic_dec(&sp->rx_bufs_left[ring_no]);
@@ -6717,7 +6718,7 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
6717 if ((*dev_intr_type == MSI_X) && 6718 if ((*dev_intr_type == MSI_X) &&
6718 ((pdev->device != PCI_DEVICE_ID_HERC_WIN) && 6719 ((pdev->device != PCI_DEVICE_ID_HERC_WIN) &&
6719 (pdev->device != PCI_DEVICE_ID_HERC_UNI))) { 6720 (pdev->device != PCI_DEVICE_ID_HERC_UNI))) {
6720 DBG_PRINT(ERR_DBG, "s2io: Xframe I does not support MSI_X. " 6721 DBG_PRINT(ERR_DBG, "s2io: Xframe I does not support MSI_X. "
6721 "Defaulting to INTA\n"); 6722 "Defaulting to INTA\n");
6722 *dev_intr_type = INTA; 6723 *dev_intr_type = INTA;
6723 } 6724 }
@@ -6845,7 +6846,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
6845 sp->device_type = XFRAME_I_DEVICE; 6846 sp->device_type = XFRAME_I_DEVICE;
6846 6847
6847 sp->lro = lro; 6848 sp->lro = lro;
6848 6849
6849 /* Initialize some PCI/PCI-X fields of the NIC. */ 6850 /* Initialize some PCI/PCI-X fields of the NIC. */
6850 s2io_init_pci(sp); 6851 s2io_init_pci(sp);
6851 6852
@@ -7233,7 +7234,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev)
7233 7234
7234int __init s2io_starter(void) 7235int __init s2io_starter(void)
7235{ 7236{
7236 return pci_module_init(&s2io_driver); 7237 return pci_register_driver(&s2io_driver);
7237} 7238}
7238 7239
7239/** 7240/**
@@ -7250,7 +7251,7 @@ static void s2io_closer(void)
7250module_init(s2io_starter); 7251module_init(s2io_starter);
7251module_exit(s2io_closer); 7252module_exit(s2io_closer);
7252 7253
7253static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip, 7254static int check_L2_lro_capable(u8 *buffer, struct iphdr **ip,
7254 struct tcphdr **tcp, RxD_t *rxdp) 7255 struct tcphdr **tcp, RxD_t *rxdp)
7255{ 7256{
7256 int ip_off; 7257 int ip_off;
@@ -7312,7 +7313,7 @@ static void initiate_new_session(lro_t *lro, u8 *l2h,
7312 lro->sg_num = 1; 7313 lro->sg_num = 1;
7313 lro->total_len = ntohs(ip->tot_len); 7314 lro->total_len = ntohs(ip->tot_len);
7314 lro->frags_len = 0; 7315 lro->frags_len = 0;
7315 /* 7316 /*
7316 * check if we saw TCP timestamp. Other consistency checks have 7317 * check if we saw TCP timestamp. Other consistency checks have
7317 * already been done. 7318 * already been done.
7318 */ 7319 */
@@ -7369,12 +7370,12 @@ static void aggregate_new_rx(lro_t *lro, struct iphdr *ip,
7369 /* Update ack seq no. and window ad(from this pkt) in LRO object */ 7370 /* Update ack seq no. and window ad(from this pkt) in LRO object */
7370 lro->tcp_ack = tcp->ack_seq; 7371 lro->tcp_ack = tcp->ack_seq;
7371 lro->window = tcp->window; 7372 lro->window = tcp->window;
7372 7373
7373 if (lro->saw_ts) { 7374 if (lro->saw_ts) {
7374 u32 *ptr; 7375 u32 *ptr;
7375 /* Update tsecr and tsval from this packet */ 7376 /* Update tsecr and tsval from this packet */
7376 ptr = (u32 *) (tcp + 1); 7377 ptr = (u32 *) (tcp + 1);
7377 lro->cur_tsval = *(ptr + 1); 7378 lro->cur_tsval = *(ptr + 1);
7378 lro->cur_tsecr = *(ptr + 2); 7379 lro->cur_tsecr = *(ptr + 2);
7379 } 7380 }
7380} 7381}
@@ -7409,7 +7410,7 @@ static int verify_l3_l4_lro_capable(lro_t *l_lro, struct iphdr *ip,
7409 return -1; 7410 return -1;
7410 } 7411 }
7411 7412
7412 /* 7413 /*
7413 * Allow only one TCP timestamp option. Don't aggregate if 7414 * Allow only one TCP timestamp option. Don't aggregate if
7414 * any other options are detected. 7415 * any other options are detected.
7415 */ 7416 */
@@ -7417,7 +7418,7 @@ static int verify_l3_l4_lro_capable(lro_t *l_lro, struct iphdr *ip,
7417 return -1; 7418 return -1;
7418 7419
7419 if (tcp->doff == 8) { 7420 if (tcp->doff == 8) {
7420 ptr = (u8 *)(tcp + 1); 7421 ptr = (u8 *)(tcp + 1);
7421 while (*ptr == TCPOPT_NOP) 7422 while (*ptr == TCPOPT_NOP)
7422 ptr++; 7423 ptr++;
7423 if (*ptr != TCPOPT_TIMESTAMP || *(ptr+1) != TCPOLEN_TIMESTAMP) 7424 if (*ptr != TCPOPT_TIMESTAMP || *(ptr+1) != TCPOLEN_TIMESTAMP)
@@ -7429,7 +7430,7 @@ static int verify_l3_l4_lro_capable(lro_t *l_lro, struct iphdr *ip,
7429 return -1; 7430 return -1;
7430 7431
7431 /* timestamp echo reply should be non-zero */ 7432 /* timestamp echo reply should be non-zero */
7432 if (*((u32 *)(ptr+6)) == 0) 7433 if (*((u32 *)(ptr+6)) == 0)
7433 return -1; 7434 return -1;
7434 } 7435 }
7435 7436