[PATCH] skge: use netdev_alloc_skb

Change to use new netdev_alloc_skb interface for 2.6.18.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Stephen Hemminger 2006-09-01 15:53:47 -07:00 committed by Jeff Garzik
parent 2f4a66ad49
commit c54f9765da

View File

@ -818,8 +818,9 @@ static void skge_rx_clean(struct skge_port *skge)
/* Allocate buffers for receive ring /* Allocate buffers for receive ring
* For receive: to_clean is next received frame. * For receive: to_clean is next received frame.
*/ */
static int skge_rx_fill(struct skge_port *skge) static int skge_rx_fill(struct net_device *dev)
{ {
struct skge_port *skge = netdev_priv(dev);
struct skge_ring *ring = &skge->rx_ring; struct skge_ring *ring = &skge->rx_ring;
struct skge_element *e; struct skge_element *e;
@ -827,8 +828,8 @@ static int skge_rx_fill(struct skge_port *skge)
do { do {
struct sk_buff *skb; struct sk_buff *skb;
skb = __dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN, skb = __netdev_alloc_skb(dev, skge->rx_buf_size + NET_IP_ALIGN,
GFP_KERNEL); GFP_KERNEL);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
@ -2179,7 +2180,7 @@ static int skge_up(struct net_device *dev)
if (err) if (err)
goto free_pci_mem; goto free_pci_mem;
err = skge_rx_fill(skge); err = skge_rx_fill(dev);
if (err) if (err)
goto free_rx_ring; goto free_rx_ring;
@ -2585,16 +2586,17 @@ static inline int bad_phy_status(const struct skge_hw *hw, u32 status)
/* Get receive buffer from descriptor. /* Get receive buffer from descriptor.
* Handles copy of small buffers and reallocation failures * Handles copy of small buffers and reallocation failures
*/ */
static inline struct sk_buff *skge_rx_get(struct skge_port *skge, static struct sk_buff *skge_rx_get(struct net_device *dev,
struct skge_element *e, struct skge_element *e,
u32 control, u32 status, u16 csum) u32 control, u32 status, u16 csum)
{ {
struct skge_port *skge = netdev_priv(dev);
struct sk_buff *skb; struct sk_buff *skb;
u16 len = control & BMU_BBC; u16 len = control & BMU_BBC;
if (unlikely(netif_msg_rx_status(skge))) if (unlikely(netif_msg_rx_status(skge)))
printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n", printk(KERN_DEBUG PFX "%s: rx slot %td status 0x%x len %d\n",
skge->netdev->name, e - skge->rx_ring.start, dev->name, e - skge->rx_ring.start,
status, len); status, len);
if (len > skge->rx_buf_size) if (len > skge->rx_buf_size)
@ -2610,7 +2612,7 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
goto error; goto error;
if (len < RX_COPY_THRESHOLD) { if (len < RX_COPY_THRESHOLD) {
skb = dev_alloc_skb(len + 2); skb = netdev_alloc_skb(dev, len + 2);
if (!skb) if (!skb)
goto resubmit; goto resubmit;
@ -2625,7 +2627,7 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
skge_rx_reuse(e, skge->rx_buf_size); skge_rx_reuse(e, skge->rx_buf_size);
} else { } else {
struct sk_buff *nskb; struct sk_buff *nskb;
nskb = dev_alloc_skb(skge->rx_buf_size + NET_IP_ALIGN); nskb = netdev_alloc_skb(dev, skge->rx_buf_size + NET_IP_ALIGN);
if (!nskb) if (!nskb)
goto resubmit; goto resubmit;
@ -2640,20 +2642,19 @@ static inline struct sk_buff *skge_rx_get(struct skge_port *skge,
} }
skb_put(skb, len); skb_put(skb, len);
skb->dev = skge->netdev;
if (skge->rx_csum) { if (skge->rx_csum) {
skb->csum = csum; skb->csum = csum;
skb->ip_summed = CHECKSUM_HW; skb->ip_summed = CHECKSUM_HW;
} }
skb->protocol = eth_type_trans(skb, skge->netdev); skb->protocol = eth_type_trans(skb, dev);
return skb; return skb;
error: error:
if (netif_msg_rx_err(skge)) if (netif_msg_rx_err(skge))
printk(KERN_DEBUG PFX "%s: rx err, slot %td control 0x%x status 0x%x\n", printk(KERN_DEBUG PFX "%s: rx err, slot %td control 0x%x status 0x%x\n",
skge->netdev->name, e - skge->rx_ring.start, dev->name, e - skge->rx_ring.start,
control, status); control, status);
if (skge->hw->chip_id == CHIP_ID_GENESIS) { if (skge->hw->chip_id == CHIP_ID_GENESIS) {
@ -2723,7 +2724,7 @@ static int skge_poll(struct net_device *dev, int *budget)
if (control & BMU_OWN) if (control & BMU_OWN)
break; break;
skb = skge_rx_get(skge, e, control, rd->status, rd->csum2); skb = skge_rx_get(dev, e, control, rd->status, rd->csum2);
if (likely(skb)) { if (likely(skb)) {
dev->last_rx = jiffies; dev->last_rx = jiffies;
netif_receive_skb(skb); netif_receive_skb(skb);