sky2.c (3f42941b5d1d13542b1a755a9e4f633aa72e4d3e) | sky2.c (e072b3fad5f3915102c94628b4971f52ff99dd05) |
---|---|
1/* 2 * New driver for Marvell Yukon 2 chipset. 3 * Based on earlier sk98lin, and skge driver. 4 * 5 * This driver intentionally does not support all the features 6 * of the original driver such as link fail-over and link management because 7 * those should be done at higher levels. 8 * --- 2481 unchanged lines hidden (view full) --- 2490 skb = netdev_alloc_skb_ip_align(sky2->netdev, length); 2491 if (likely(skb)) { 2492 pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr, 2493 length, PCI_DMA_FROMDEVICE); 2494 skb_copy_from_linear_data(re->skb, skb->data, length); 2495 skb->ip_summed = re->skb->ip_summed; 2496 skb->csum = re->skb->csum; 2497 skb->rxhash = re->skb->rxhash; | 1/* 2 * New driver for Marvell Yukon 2 chipset. 3 * Based on earlier sk98lin, and skge driver. 4 * 5 * This driver intentionally does not support all the features 6 * of the original driver such as link fail-over and link management because 7 * those should be done at higher levels. 8 * --- 2481 unchanged lines hidden (view full) --- 2490 skb = netdev_alloc_skb_ip_align(sky2->netdev, length); 2491 if (likely(skb)) { 2492 pci_dma_sync_single_for_cpu(sky2->hw->pdev, re->data_addr, 2493 length, PCI_DMA_FROMDEVICE); 2494 skb_copy_from_linear_data(re->skb, skb->data, length); 2495 skb->ip_summed = re->skb->ip_summed; 2496 skb->csum = re->skb->csum; 2497 skb->rxhash = re->skb->rxhash; |
2498 skb->vlan_tci = re->skb->vlan_tci; |
|
2498 2499 pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, 2500 length, PCI_DMA_FROMDEVICE); | 2499 2500 pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, 2501 length, PCI_DMA_FROMDEVICE); |
2502 re->skb->vlan_tci = 0; |
|
2501 re->skb->rxhash = 0; 2502 re->skb->ip_summed = CHECKSUM_NONE; 2503 skb_put(skb, length); 2504 } 2505 return skb; 2506} 2507 2508/* Adjust length of skb with fragments to match received data */ --- 69 unchanged lines hidden (view full) --- 2578static struct sk_buff *sky2_receive(struct net_device *dev, 2579 u16 length, u32 status) 2580{ 2581 struct sky2_port *sky2 = netdev_priv(dev); 2582 struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next; 2583 struct sk_buff *skb = NULL; 2584 u16 count = (status & GMR_FS_LEN) >> 16; 2585 | 2503 re->skb->rxhash = 0; 2504 re->skb->ip_summed = CHECKSUM_NONE; 2505 skb_put(skb, length); 2506 } 2507 return skb; 2508} 2509 2510/* Adjust length of skb with fragments to match received data */ --- 69 unchanged lines hidden (view full) --- 2580static struct sk_buff *sky2_receive(struct net_device *dev, 2581 u16 length, u32 status) 2582{ 2583 struct sky2_port *sky2 = netdev_priv(dev); 2584 struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next; 2585 struct sk_buff *skb = NULL; 2586 u16 count = (status & GMR_FS_LEN) >> 16; 2587 |
2586 if (status & GMR_FS_VLAN) 2587 count -= VLAN_HLEN; /* Account for vlan tag */ 2588 | |
2589 netif_printk(sky2, rx_status, KERN_DEBUG, dev, 2590 "rx slot %u status 0x%x len %d\n", 2591 sky2->rx_next, status, length); 2592 2593 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; 2594 prefetch(sky2->rx_ring + sky2->rx_next); 2595 | 2588 netif_printk(sky2, rx_status, KERN_DEBUG, dev, 2589 "rx slot %u status 0x%x len %d\n", 2590 sky2->rx_next, status, length); 2591 2592 sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; 2593 prefetch(sky2->rx_ring + sky2->rx_next); 2594 |
2595 if (vlan_tx_tag_present(re->skb)) 2596 count -= VLAN_HLEN; /* Account for vlan tag */ 2597 |
|
2596 /* This chip has hardware problems that generates bogus status. 2597 * So do only marginal checking and expect higher level protocols 2598 * to handle crap frames. 2599 */ 2600 if (sky2->hw->chip_id == CHIP_ID_YUKON_FE_P && 2601 sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0 && 2602 length != count) 2603 goto okay; --- 41 unchanged lines hidden (view full) --- 2645 2646 /* Wake unless it's detached, and called e.g. from sky2_close() */ 2647 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 2648 netif_wake_queue(dev); 2649 } 2650} 2651 2652static inline void sky2_skb_rx(const struct sky2_port *sky2, | 2598 /* This chip has hardware problems that generates bogus status. 2599 * So do only marginal checking and expect higher level protocols 2600 * to handle crap frames. 2601 */ 2602 if (sky2->hw->chip_id == CHIP_ID_YUKON_FE_P && 2603 sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0 && 2604 length != count) 2605 goto okay; --- 41 unchanged lines hidden (view full) --- 2647 2648 /* Wake unless it's detached, and called e.g. from sky2_close() */ 2649 if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) 2650 netif_wake_queue(dev); 2651 } 2652} 2653 2654static inline void sky2_skb_rx(const struct sky2_port *sky2, |
2653 u32 status, struct sk_buff *skb) | 2655 struct sk_buff *skb) |
2654{ | 2656{ |
2655 if (status & GMR_FS_VLAN) 2656 __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag)); 2657 | |
2658 if (skb->ip_summed == CHECKSUM_NONE) 2659 netif_receive_skb(skb); 2660 else 2661 napi_gro_receive(&sky2->hw->napi, skb); 2662} 2663 2664static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port, 2665 unsigned packets, unsigned bytes) --- 37 unchanged lines hidden (view full) --- 2703 * really broken, will get disabled again 2704 */ 2705 sky2->netdev->features &= ~NETIF_F_RXCSUM; 2706 sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), 2707 BMU_DIS_RX_CHKSUM); 2708 } 2709} 2710 | 2657 if (skb->ip_summed == CHECKSUM_NONE) 2658 netif_receive_skb(skb); 2659 else 2660 napi_gro_receive(&sky2->hw->napi, skb); 2661} 2662 2663static inline void sky2_rx_done(struct sky2_hw *hw, unsigned port, 2664 unsigned packets, unsigned bytes) --- 37 unchanged lines hidden (view full) --- 2702 * really broken, will get disabled again 2703 */ 2704 sky2->netdev->features &= ~NETIF_F_RXCSUM; 2705 sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), 2706 BMU_DIS_RX_CHKSUM); 2707 } 2708} 2709 |
2710static void sky2_rx_tag(struct sky2_port *sky2, u16 length) 2711{ 2712 struct sk_buff *skb; 2713 2714 skb = sky2->rx_ring[sky2->rx_next].skb; 2715 __vlan_hwaccel_put_tag(skb, be16_to_cpu(length)); 2716} 2717 |
|
2711static void sky2_rx_hash(struct sky2_port *sky2, u32 status) 2712{ 2713 struct sk_buff *skb; 2714 2715 skb = sky2->rx_ring[sky2->rx_next].skb; 2716 skb->rxhash = le32_to_cpu(status); 2717} 2718 --- 42 unchanged lines hidden (view full) --- 2761 (le->css & (CSS_ISIPV4 | CSS_ISIPV6)) && 2762 (le->css & CSS_TCPUDPCSOK)) 2763 skb->ip_summed = CHECKSUM_UNNECESSARY; 2764 else 2765 skb->ip_summed = CHECKSUM_NONE; 2766 } 2767 2768 skb->protocol = eth_type_trans(skb, dev); | 2718static void sky2_rx_hash(struct sky2_port *sky2, u32 status) 2719{ 2720 struct sk_buff *skb; 2721 2722 skb = sky2->rx_ring[sky2->rx_next].skb; 2723 skb->rxhash = le32_to_cpu(status); 2724} 2725 --- 42 unchanged lines hidden (view full) --- 2768 (le->css & (CSS_ISIPV4 | CSS_ISIPV6)) && 2769 (le->css & CSS_TCPUDPCSOK)) 2770 skb->ip_summed = CHECKSUM_UNNECESSARY; 2771 else 2772 skb->ip_summed = CHECKSUM_NONE; 2773 } 2774 2775 skb->protocol = eth_type_trans(skb, dev); |
2776 sky2_skb_rx(sky2, skb); |
|
2769 | 2777 |
2770 sky2_skb_rx(sky2, status, skb); 2771 | |
2772 /* Stop after net poll weight */ 2773 if (++work_done >= to_do) 2774 goto exit_loop; 2775 break; 2776 2777 case OP_RXVLAN: | 2778 /* Stop after net poll weight */ 2779 if (++work_done >= to_do) 2780 goto exit_loop; 2781 break; 2782 2783 case OP_RXVLAN: |
2778 sky2->rx_tag = length; | 2784 sky2_rx_tag(sky2, length); |
2779 break; 2780 2781 case OP_RXCHKSVLAN: | 2785 break; 2786 2787 case OP_RXCHKSVLAN: |
2782 sky2->rx_tag = length; | 2788 sky2_rx_tag(sky2, length); |
2783 /* fall through */ 2784 case OP_RXCHKS: 2785 if (likely(dev->features & NETIF_F_RXCSUM)) 2786 sky2_rx_checksum(sky2, status); 2787 break; 2788 2789 case OP_RSS_HASH: 2790 sky2_rx_hash(sky2, status); --- 2420 unchanged lines hidden --- | 2789 /* fall through */ 2790 case OP_RXCHKS: 2791 if (likely(dev->features & NETIF_F_RXCSUM)) 2792 sky2_rx_checksum(sky2, status); 2793 break; 2794 2795 case OP_RSS_HASH: 2796 sky2_rx_hash(sky2, status); --- 2420 unchanged lines hidden --- |