diff options
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 600d3ff347fc..290e1c1f30c6 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | * s2io.c: A Linux PCI-X Ethernet driver for Neterion 10GbE Server NIC | 2 | * s2io.c: A Linux PCI-X Ethernet driver for Neterion 10GbE Server NIC |
3 | * Copyright(c) 2002-2005 Neterion Inc. | 3 | * Copyright(c) 2002-2007 Neterion Inc. |
4 | 4 | ||
5 | * This software may be used and distributed according to the terms of | 5 | * This software may be used and distributed according to the terms of |
6 | * the GNU General Public License (GPL), incorporated herein by reference. | 6 | * the GNU General Public License (GPL), incorporated herein by reference. |
@@ -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.17.1" | 87 | #define DRV_VERSION "2.0.22.1" |
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"; |
@@ -316,7 +316,7 @@ static void s2io_vlan_rx_register(struct net_device *dev, | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */ | 318 | /* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */ |
319 | int vlan_strip_flag; | 319 | static int vlan_strip_flag; |
320 | 320 | ||
321 | /* Unregister the vlan */ | 321 | /* Unregister the vlan */ |
322 | static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) | 322 | static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid) |
@@ -394,7 +394,6 @@ static const u64 fix_mac[] = { | |||
394 | END_SIGN | 394 | END_SIGN |
395 | }; | 395 | }; |
396 | 396 | ||
397 | MODULE_AUTHOR("Raghavendra Koushik <raghavendra.koushik@neterion.com>"); | ||
398 | MODULE_LICENSE("GPL"); | 397 | MODULE_LICENSE("GPL"); |
399 | MODULE_VERSION(DRV_VERSION); | 398 | MODULE_VERSION(DRV_VERSION); |
400 | 399 | ||
@@ -516,7 +515,7 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
516 | mac_control->fifos[i].list_info = kmalloc(list_holder_size, | 515 | mac_control->fifos[i].list_info = kmalloc(list_holder_size, |
517 | GFP_KERNEL); | 516 | GFP_KERNEL); |
518 | if (!mac_control->fifos[i].list_info) { | 517 | if (!mac_control->fifos[i].list_info) { |
519 | DBG_PRINT(ERR_DBG, | 518 | DBG_PRINT(INFO_DBG, |
520 | "Malloc failed for list_info\n"); | 519 | "Malloc failed for list_info\n"); |
521 | return -ENOMEM; | 520 | return -ENOMEM; |
522 | } | 521 | } |
@@ -542,9 +541,9 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
542 | tmp_v = pci_alloc_consistent(nic->pdev, | 541 | tmp_v = pci_alloc_consistent(nic->pdev, |
543 | PAGE_SIZE, &tmp_p); | 542 | PAGE_SIZE, &tmp_p); |
544 | if (!tmp_v) { | 543 | if (!tmp_v) { |
545 | DBG_PRINT(ERR_DBG, | 544 | DBG_PRINT(INFO_DBG, |
546 | "pci_alloc_consistent "); | 545 | "pci_alloc_consistent "); |
547 | DBG_PRINT(ERR_DBG, "failed for TxDL\n"); | 546 | DBG_PRINT(INFO_DBG, "failed for TxDL\n"); |
548 | return -ENOMEM; | 547 | return -ENOMEM; |
549 | } | 548 | } |
550 | /* If we got a zero DMA address(can happen on | 549 | /* If we got a zero DMA address(can happen on |
@@ -561,9 +560,9 @@ static int init_shared_mem(struct s2io_nic *nic) | |||
561 | tmp_v = pci_alloc_consistent(nic->pdev, | 560 | tmp_v = pci_alloc_consistent(nic->pdev, |
562 | PAGE_SIZE, &tmp_p); | 561 | PAGE_SIZE, &tmp_p); |
563 | if (!tmp_v) { | 562 | if (!tmp_v) { |
564 | DBG_PRINT(ERR_DBG, | 563 | DBG_PRINT(INFO_DBG, |
565 | "pci_alloc_consistent "); | 564 | "pci_alloc_consistent "); |
566 | DBG_PRINT(ERR_DBG, "failed for TxDL\n"); | 565 | DBG_PRINT(INFO_DBG, "failed for TxDL\n"); |
567 | return -ENOMEM; | 566 | return -ENOMEM; |
568 | } | 567 | } |
569 | } | 568 | } |
@@ -2187,7 +2186,7 @@ static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \ | |||
2187 | /* skb_shinfo(skb)->frag_list will have L4 data payload */ | 2186 | /* skb_shinfo(skb)->frag_list will have L4 data payload */ |
2188 | skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE); | 2187 | skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE); |
2189 | if (skb_shinfo(skb)->frag_list == NULL) { | 2188 | if (skb_shinfo(skb)->frag_list == NULL) { |
2190 | DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb failed\n ", dev->name); | 2189 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n ", dev->name); |
2191 | return -ENOMEM ; | 2190 | return -ENOMEM ; |
2192 | } | 2191 | } |
2193 | frag_list = skb_shinfo(skb)->frag_list; | 2192 | frag_list = skb_shinfo(skb)->frag_list; |
@@ -2242,6 +2241,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2242 | struct buffAdd *ba; | 2241 | struct buffAdd *ba; |
2243 | unsigned long flags; | 2242 | unsigned long flags; |
2244 | struct RxD_t *first_rxdp = NULL; | 2243 | struct RxD_t *first_rxdp = NULL; |
2244 | u64 Buffer0_ptr = 0, Buffer1_ptr = 0; | ||
2245 | 2245 | ||
2246 | mac_control = &nic->mac_control; | 2246 | mac_control = &nic->mac_control; |
2247 | config = &nic->config; | 2247 | config = &nic->config; |
@@ -2313,8 +2313,8 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2313 | /* allocate skb */ | 2313 | /* allocate skb */ |
2314 | skb = dev_alloc_skb(size); | 2314 | skb = dev_alloc_skb(size); |
2315 | if(!skb) { | 2315 | if(!skb) { |
2316 | DBG_PRINT(ERR_DBG, "%s: Out of ", dev->name); | 2316 | DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); |
2317 | DBG_PRINT(ERR_DBG, "memory to allocate SKBs\n"); | 2317 | DBG_PRINT(INFO_DBG, "memory to allocate SKBs\n"); |
2318 | if (first_rxdp) { | 2318 | if (first_rxdp) { |
2319 | wmb(); | 2319 | wmb(); |
2320 | first_rxdp->Control_1 |= RXD_OWN_XENA; | 2320 | first_rxdp->Control_1 |= RXD_OWN_XENA; |
@@ -2342,7 +2342,14 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no) | |||
2342 | * payload | 2342 | * payload |
2343 | */ | 2343 | */ |
2344 | 2344 | ||
2345 | /* save the buffer pointers to avoid frequent dma mapping */ | ||
2346 | Buffer0_ptr = ((struct RxD3*)rxdp)->Buffer0_ptr; | ||
2347 | Buffer1_ptr = ((struct RxD3*)rxdp)->Buffer1_ptr; | ||
2345 | memset(rxdp, 0, sizeof(struct RxD3)); | 2348 | memset(rxdp, 0, sizeof(struct RxD3)); |
2349 | /* restore the buffer pointers for dma sync*/ | ||
2350 | ((struct RxD3*)rxdp)->Buffer0_ptr = Buffer0_ptr; | ||
2351 | ((struct RxD3*)rxdp)->Buffer1_ptr = Buffer1_ptr; | ||
2352 | |||
2346 | ba = &mac_control->rings[ring_no].ba[block_no][off]; | 2353 | ba = &mac_control->rings[ring_no].ba[block_no][off]; |
2347 | skb_reserve(skb, BUF0_LEN); | 2354 | skb_reserve(skb, BUF0_LEN); |
2348 | tmp = (u64)(unsigned long) skb->data; | 2355 | tmp = (u64)(unsigned long) skb->data; |
@@ -2573,8 +2580,8 @@ static int s2io_poll(struct net_device *dev, int *budget) | |||
2573 | 2580 | ||
2574 | for (i = 0; i < config->rx_ring_num; i++) { | 2581 | for (i = 0; i < config->rx_ring_num; i++) { |
2575 | if (fill_rx_buffers(nic, i) == -ENOMEM) { | 2582 | if (fill_rx_buffers(nic, i) == -ENOMEM) { |
2576 | DBG_PRINT(ERR_DBG, "%s:Out of memory", dev->name); | 2583 | DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); |
2577 | DBG_PRINT(ERR_DBG, " in Rx Poll!!\n"); | 2584 | DBG_PRINT(INFO_DBG, " in Rx Poll!!\n"); |
2578 | break; | 2585 | break; |
2579 | } | 2586 | } |
2580 | } | 2587 | } |
@@ -2590,8 +2597,8 @@ no_rx: | |||
2590 | 2597 | ||
2591 | for (i = 0; i < config->rx_ring_num; i++) { | 2598 | for (i = 0; i < config->rx_ring_num; i++) { |
2592 | if (fill_rx_buffers(nic, i) == -ENOMEM) { | 2599 | if (fill_rx_buffers(nic, i) == -ENOMEM) { |
2593 | DBG_PRINT(ERR_DBG, "%s:Out of memory", dev->name); | 2600 | DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); |
2594 | DBG_PRINT(ERR_DBG, " in Rx Poll!!\n"); | 2601 | DBG_PRINT(INFO_DBG, " in Rx Poll!!\n"); |
2595 | break; | 2602 | break; |
2596 | } | 2603 | } |
2597 | } | 2604 | } |
@@ -2640,8 +2647,8 @@ static void s2io_netpoll(struct net_device *dev) | |||
2640 | 2647 | ||
2641 | for (i = 0; i < config->rx_ring_num; i++) { | 2648 | for (i = 0; i < config->rx_ring_num; i++) { |
2642 | if (fill_rx_buffers(nic, i) == -ENOMEM) { | 2649 | if (fill_rx_buffers(nic, i) == -ENOMEM) { |
2643 | DBG_PRINT(ERR_DBG, "%s:Out of memory", dev->name); | 2650 | DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); |
2644 | DBG_PRINT(ERR_DBG, " in Rx Netpoll!!\n"); | 2651 | DBG_PRINT(INFO_DBG, " in Rx Netpoll!!\n"); |
2645 | break; | 2652 | break; |
2646 | } | 2653 | } |
2647 | } | 2654 | } |
@@ -3307,6 +3314,7 @@ static void s2io_reset(struct s2io_nic * sp) | |||
3307 | u16 subid, pci_cmd; | 3314 | u16 subid, pci_cmd; |
3308 | int i; | 3315 | int i; |
3309 | u16 val16; | 3316 | u16 val16; |
3317 | unsigned long long reset_cnt = 0; | ||
3310 | DBG_PRINT(INIT_DBG,"%s - Resetting XFrame card %s\n", | 3318 | DBG_PRINT(INIT_DBG,"%s - Resetting XFrame card %s\n", |
3311 | __FUNCTION__, sp->dev->name); | 3319 | __FUNCTION__, sp->dev->name); |
3312 | 3320 | ||
@@ -3372,6 +3380,11 @@ new_way: | |||
3372 | 3380 | ||
3373 | /* Reset device statistics maintained by OS */ | 3381 | /* Reset device statistics maintained by OS */ |
3374 | memset(&sp->stats, 0, sizeof (struct net_device_stats)); | 3382 | memset(&sp->stats, 0, sizeof (struct net_device_stats)); |
3383 | /* save reset count */ | ||
3384 | reset_cnt = sp->mac_control.stats_info->sw_stat.soft_reset_cnt; | ||
3385 | memset(sp->mac_control.stats_info, 0, sizeof(struct stat_block)); | ||
3386 | /* restore reset count */ | ||
3387 | sp->mac_control.stats_info->sw_stat.soft_reset_cnt = reset_cnt; | ||
3375 | 3388 | ||
3376 | /* SXE-002: Configure link and activity LED to turn it off */ | 3389 | /* SXE-002: Configure link and activity LED to turn it off */ |
3377 | subid = sp->pdev->subsystem_device; | 3390 | subid = sp->pdev->subsystem_device; |
@@ -3659,7 +3672,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3659 | nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry), | 3672 | nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry), |
3660 | GFP_KERNEL); | 3673 | GFP_KERNEL); |
3661 | if (nic->entries == NULL) { | 3674 | if (nic->entries == NULL) { |
3662 | DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", __FUNCTION__); | 3675 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); |
3663 | return -ENOMEM; | 3676 | return -ENOMEM; |
3664 | } | 3677 | } |
3665 | memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); | 3678 | memset(nic->entries, 0, MAX_REQUESTED_MSI_X * sizeof(struct msix_entry)); |
@@ -3668,7 +3681,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic) | |||
3668 | kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry), | 3681 | kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry), |
3669 | GFP_KERNEL); | 3682 | GFP_KERNEL); |
3670 | if (nic->s2io_entries == NULL) { | 3683 | if (nic->s2io_entries == NULL) { |
3671 | DBG_PRINT(ERR_DBG, "%s: Memory allocation failed\n", __FUNCTION__); | 3684 | DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", __FUNCTION__); |
3672 | kfree(nic->entries); | 3685 | kfree(nic->entries); |
3673 | return -ENOMEM; | 3686 | return -ENOMEM; |
3674 | } | 3687 | } |
@@ -4019,7 +4032,7 @@ static int s2io_chk_rx_buffers(struct s2io_nic *sp, int rng_n) | |||
4019 | DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", __FUNCTION__); | 4032 | DBG_PRINT(INTR_DBG, "%s: Rx BD hit ", __FUNCTION__); |
4020 | DBG_PRINT(INTR_DBG, "PANIC levels\n"); | 4033 | DBG_PRINT(INTR_DBG, "PANIC levels\n"); |
4021 | if ((ret = fill_rx_buffers(sp, rng_n)) == -ENOMEM) { | 4034 | if ((ret = fill_rx_buffers(sp, rng_n)) == -ENOMEM) { |
4022 | DBG_PRINT(ERR_DBG, "Out of memory in %s", | 4035 | DBG_PRINT(INFO_DBG, "Out of memory in %s", |
4023 | __FUNCTION__); | 4036 | __FUNCTION__); |
4024 | clear_bit(0, (&sp->tasklet_status)); | 4037 | clear_bit(0, (&sp->tasklet_status)); |
4025 | return -1; | 4038 | return -1; |
@@ -4029,8 +4042,8 @@ static int s2io_chk_rx_buffers(struct s2io_nic *sp, int rng_n) | |||
4029 | tasklet_schedule(&sp->task); | 4042 | tasklet_schedule(&sp->task); |
4030 | 4043 | ||
4031 | } else if (fill_rx_buffers(sp, rng_n) == -ENOMEM) { | 4044 | } else if (fill_rx_buffers(sp, rng_n) == -ENOMEM) { |
4032 | DBG_PRINT(ERR_DBG, "%s:Out of memory", sp->dev->name); | 4045 | DBG_PRINT(INFO_DBG, "%s:Out of memory", sp->dev->name); |
4033 | DBG_PRINT(ERR_DBG, " in Rx Intr!!\n"); | 4046 | DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); |
4034 | } | 4047 | } |
4035 | return 0; | 4048 | return 0; |
4036 | } | 4049 | } |
@@ -4279,9 +4292,7 @@ static void s2io_updt_stats(struct s2io_nic *sp) | |||
4279 | if (cnt == 5) | 4292 | if (cnt == 5) |
4280 | break; /* Updt failed */ | 4293 | break; /* Updt failed */ |
4281 | } while(1); | 4294 | } while(1); |
4282 | } else { | 4295 | } |
4283 | memset(sp->mac_control.stats_info, 0, sizeof(struct stat_block)); | ||
4284 | } | ||
4285 | } | 4296 | } |
4286 | 4297 | ||
4287 | /** | 4298 | /** |
@@ -5949,12 +5960,12 @@ static void s2io_tasklet(unsigned long dev_addr) | |||
5949 | for (i = 0; i < config->rx_ring_num; i++) { | 5960 | for (i = 0; i < config->rx_ring_num; i++) { |
5950 | ret = fill_rx_buffers(sp, i); | 5961 | ret = fill_rx_buffers(sp, i); |
5951 | if (ret == -ENOMEM) { | 5962 | if (ret == -ENOMEM) { |
5952 | DBG_PRINT(ERR_DBG, "%s: Out of ", | 5963 | DBG_PRINT(INFO_DBG, "%s: Out of ", |
5953 | dev->name); | 5964 | dev->name); |
5954 | DBG_PRINT(ERR_DBG, "memory in tasklet\n"); | 5965 | DBG_PRINT(ERR_DBG, "memory in tasklet\n"); |
5955 | break; | 5966 | break; |
5956 | } else if (ret == -EFILL) { | 5967 | } else if (ret == -EFILL) { |
5957 | DBG_PRINT(ERR_DBG, | 5968 | DBG_PRINT(INFO_DBG, |
5958 | "%s: Rx Ring %d is full\n", | 5969 | "%s: Rx Ring %d is full\n", |
5959 | dev->name, i); | 5970 | dev->name, i); |
5960 | break; | 5971 | break; |
@@ -6065,8 +6076,8 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6065 | } else { | 6076 | } else { |
6066 | *skb = dev_alloc_skb(size); | 6077 | *skb = dev_alloc_skb(size); |
6067 | if (!(*skb)) { | 6078 | if (!(*skb)) { |
6068 | DBG_PRINT(ERR_DBG, "%s: Out of ", dev->name); | 6079 | DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name); |
6069 | DBG_PRINT(ERR_DBG, "memory to allocate SKBs\n"); | 6080 | DBG_PRINT(INFO_DBG, "memory to allocate SKBs\n"); |
6070 | return -ENOMEM ; | 6081 | return -ENOMEM ; |
6071 | } | 6082 | } |
6072 | /* storing the mapped addr in a temp variable | 6083 | /* storing the mapped addr in a temp variable |
@@ -6088,7 +6099,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6088 | } else { | 6099 | } else { |
6089 | *skb = dev_alloc_skb(size); | 6100 | *skb = dev_alloc_skb(size); |
6090 | if (!(*skb)) { | 6101 | if (!(*skb)) { |
6091 | DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb failed\n", | 6102 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n", |
6092 | dev->name); | 6103 | dev->name); |
6093 | return -ENOMEM; | 6104 | return -ENOMEM; |
6094 | } | 6105 | } |
@@ -6115,7 +6126,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp, | |||
6115 | } else { | 6126 | } else { |
6116 | *skb = dev_alloc_skb(size); | 6127 | *skb = dev_alloc_skb(size); |
6117 | if (!(*skb)) { | 6128 | if (!(*skb)) { |
6118 | DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb failed\n", | 6129 | DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n", |
6119 | dev->name); | 6130 | dev->name); |
6120 | return -ENOMEM; | 6131 | return -ENOMEM; |
6121 | } | 6132 | } |
@@ -6616,7 +6627,6 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
6616 | 6627 | ||
6617 | /* Updating statistics */ | 6628 | /* Updating statistics */ |
6618 | rxdp->Host_Control = 0; | 6629 | rxdp->Host_Control = 0; |
6619 | sp->rx_pkt_count++; | ||
6620 | sp->stats.rx_packets++; | 6630 | sp->stats.rx_packets++; |
6621 | if (sp->rxd_mode == RXD_MODE_1) { | 6631 | if (sp->rxd_mode == RXD_MODE_1) { |
6622 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); | 6632 | int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2); |
@@ -7252,7 +7262,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7252 | goto register_failed; | 7262 | goto register_failed; |
7253 | } | 7263 | } |
7254 | s2io_vpd_read(sp); | 7264 | s2io_vpd_read(sp); |
7255 | DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2005 Neterion Inc.\n"); | 7265 | DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2007 Neterion Inc.\n"); |
7256 | DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name, | 7266 | DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name, |
7257 | sp->product_name, get_xena_rev_id(sp->pdev)); | 7267 | sp->product_name, get_xena_rev_id(sp->pdev)); |
7258 | DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name, | 7268 | DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name, |