aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index a1fc04365e07..e86a88aa9d06 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -818,8 +818,9 @@ static void skge_rx_clean(struct skge_port *skge)
818/* Allocate buffers for receive ring 818/* Allocate buffers for receive ring
819 * For receive: to_clean is next received frame. 819 * For receive: to_clean is next received frame.
820 */ 820 */
821static int skge_rx_fill(struct skge_port *skge) 821static int skge_rx_fill(struct net_device *dev)
822{ 822{
823 struct skge_port *skge = netdev_priv(dev);
823 struct skge_ring *ring = &skge->rx_ring; 824 struct skge_ring *ring = &skge->rx_ring;
824 struct skge_element *e; 825 struct skge_element *e;
825 826
@@ -827,8 +828,8 @@ static int skge_rx_fill(struct skge_port *skge)
827 do { 828 do {
828 struct sk_buff *skb; 829 struct sk_buff *skb;
829 830
830 skb = __dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN, 831 skb = __netdev_alloc_skb(dev, skge->rx_buf_size + NET_IP_ALIGN,
831 GFP_KERNEL); 832 GFP_KERNEL);
832 if (!skb) 833 if (!skb)
833 return -ENOMEM; 834 return -ENOMEM;
834 835
@@ -2179,7 +2180,7 @@ static int skge_up(struct net_device *dev)
2179 if (err) 2180 if (err)
2180 goto free_pci_mem; 2181 goto free_pci_mem;
2181 2182
2182 err = skge_rx_fill(skge); 2183 err = skge_rx_fill(dev);
2183 if (err) 2184 if (err)
2184 goto free_rx_ring; 2185 goto free_rx_ring;
2185 2186
@@ -2585,16 +2586,17 @@ static inline int bad_phy_status(const struct skge_hw *hw, u32 status)
2585/* Get receive buffer from descriptor. 2586/* Get receive buffer from descriptor.
2586 * Handles copy of small buffers and reallocation failures 2587 * Handles copy of small buffers and reallocation failures
2587 */ 2588 */
2588static inline struct sk_buff *skge_rx_get(struct skge_port *skge, 2589static struct sk_buff *skge_rx_get(struct net_device *dev,
2589 struct skge_element *e, 2590 struct skge_element *e,
2590 u32 control, u32 status, u16 csum) 2591 u32 control, u32 status, u16 csum)
2591{ 2592{
2593 struct skge_port *skge = netdev_priv(dev);
2592 struct sk_buff *skb; 2594 struct sk_buff *skb;
2593 u16 len = control & BMU_BBC; 2595 u16 len = control & BMU_BBC;
2594 2596
2595 if (unlikely(netif_msg_rx_status(skge))) 2597 if (unlikely(netif_msg_rx_status(skge)))
2596 printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", 2598 printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n",
2597 skge->netdev->name, e - skge->rx_ring.start, 2599 dev->name, e - skge->rx_ring.start,
2598 status, len); 2600 status, len);
2599 2601
2600 if (len > skge->rx_buf_size) 2602 if (len > skge->rx_buf_size)
@@ -2610,7 +2612,7 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
2610 goto error; 2612 goto error;
2611 2613
2612 if (len < RX_COPY_THRESHOLD) { 2614 if (len < RX_COPY_THRESHOLD) {
2613 skb = dev_alloc_skb(len + 2); 2615 skb = netdev_alloc_skb(dev, len + 2);
2614 if (!skb) 2616 if (!skb)
2615 goto resubmit; 2617 goto resubmit;
2616 2618
@@ -2625,7 +2627,7 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
2625 skge_rx_reuse(e, skge->rx_buf_size); 2627 skge_rx_reuse(e, skge->rx_buf_size);
2626 } else { 2628 } else {
2627 struct sk_buff *nskb; 2629 struct sk_buff *nskb;
2628 nskb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN); 2630 nskb = netdev_alloc_skb(dev, skge->rx_buf_size + NET_IP_ALIGN);
2629 if (!nskb) 2631 if (!nskb)
2630 goto resubmit; 2632 goto resubmit;
2631 2633
@@ -2640,20 +2642,19 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
2640 } 2642 }
2641 2643
2642 skb_put(skb, len); 2644 skb_put(skb, len);
2643 skb->dev = skge->netdev;
2644 if (skge->rx_csum) { 2645 if (skge->rx_csum) {
2645 skb->csum = csum; 2646 skb->csum = csum;
2646 skb->ip_summed = CHECKSUM_HW; 2647 skb->ip_summed = CHECKSUM_HW;
2647 } 2648 }
2648 2649
2649 skb->protocol = eth_type_trans(skb, skge->netdev); 2650 skb->protocol = eth_type_trans(skb, dev);
2650 2651
2651 return skb; 2652 return skb;
2652error: 2653error:
2653 2654
2654 if (netif_msg_rx_err(skge)) 2655 if (netif_msg_rx_err(skge))
2655 printk(KERN_DEBUG PFX "%s: rx err, slot %td control 0x%x status 0x%x\n", 2656 printk(KERN_DEBUG PFX "%s: rx err, slot %td control 0x%x status 0x%x\n",
2656 skge->netdev->name, e - skge->rx_ring.start, 2657 dev->name, e - skge->rx_ring.start,
2657 control, status); 2658 control, status);
2658 2659
2659 if (skge->hw->chip_id == CHIP_ID_GENESIS) { 2660 if (skge->hw->chip_id == CHIP_ID_GENESIS) {
@@ -2723,7 +2724,7 @@ static int skge_poll(struct net_device *dev, int *budget)
2723 if (control & BMU_OWN) 2724 if (control & BMU_OWN)
2724 break; 2725 break;
2725 2726
2726 skb = skge_rx_get(skge, e, control, rd->status, rd->csum2); 2727 skb = skge_rx_get(dev, e, control, rd->status, rd->csum2);
2727 if (likely(skb)) { 2728 if (likely(skb)) {
2728 dev->last_rx = jiffies; 2729 dev->last_rx = jiffies;
2729 netif_receive_skb(skb); 2730 netif_receive_skb(skb);