diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-04-27 08:54:32 -0400 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2008-04-27 08:54:32 -0400 |
commit | 35aeb7809345e0362772a75368a3e62ecd931481 (patch) | |
tree | a98af3ae3d3ad89461e2a435fbad382fa0ad859c /drivers/net/sis190.c | |
parent | e3eccad9f6e84656b45bfa07738934145b09e11e (diff) |
sis190: use netdev_alloc_skb
This sets skb->dev and allows arch specific allocation.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers/net/sis190.c')
-rw-r--r-- | drivers/net/sis190.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 248c3855f4d5..97aa18dd9a4b 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -480,16 +480,17 @@ static inline void sis190_make_unusable_by_asic(struct RxDesc *desc) | |||
480 | desc->status = 0x0; | 480 | desc->status = 0x0; |
481 | } | 481 | } |
482 | 482 | ||
483 | static struct sk_buff *sis190_alloc_rx_skb(struct pci_dev *pdev, | 483 | static struct sk_buff *sis190_alloc_rx_skb(struct sis190_private *tp, |
484 | struct RxDesc *desc, u32 rx_buf_sz) | 484 | struct RxDesc *desc) |
485 | { | 485 | { |
486 | u32 rx_buf_sz = tp->rx_buf_sz; | ||
486 | struct sk_buff *skb; | 487 | struct sk_buff *skb; |
487 | 488 | ||
488 | skb = dev_alloc_skb(rx_buf_sz); | 489 | skb = netdev_alloc_skb(tp->dev, rx_buf_sz); |
489 | if (likely(skb)) { | 490 | if (likely(skb)) { |
490 | dma_addr_t mapping; | 491 | dma_addr_t mapping; |
491 | 492 | ||
492 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, | 493 | mapping = pci_map_single(tp->pci_dev, skb->data, tp->rx_buf_sz, |
493 | PCI_DMA_FROMDEVICE); | 494 | PCI_DMA_FROMDEVICE); |
494 | sis190_map_to_asic(desc, mapping, rx_buf_sz); | 495 | sis190_map_to_asic(desc, mapping, rx_buf_sz); |
495 | } else | 496 | } else |
@@ -509,29 +510,29 @@ static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, | |||
509 | if (tp->Rx_skbuff[i]) | 510 | if (tp->Rx_skbuff[i]) |
510 | continue; | 511 | continue; |
511 | 512 | ||
512 | tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp->pci_dev, | 513 | tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp, tp->RxDescRing + i); |
513 | tp->RxDescRing + i, | 514 | |
514 | tp->rx_buf_sz); | ||
515 | if (!tp->Rx_skbuff[i]) | 515 | if (!tp->Rx_skbuff[i]) |
516 | break; | 516 | break; |
517 | } | 517 | } |
518 | return cur - start; | 518 | return cur - start; |
519 | } | 519 | } |
520 | 520 | ||
521 | static inline int sis190_try_rx_copy(struct sk_buff **sk_buff, int pkt_size, | 521 | static int sis190_try_rx_copy(struct sis190_private *tp, |
522 | struct RxDesc *desc, int rx_buf_sz) | 522 | struct sk_buff **sk_buff, int pkt_size, |
523 | struct RxDesc *desc) | ||
523 | { | 524 | { |
524 | int ret = -1; | 525 | int ret = -1; |
525 | 526 | ||
526 | if (pkt_size < rx_copybreak) { | 527 | if (pkt_size < rx_copybreak) { |
527 | struct sk_buff *skb; | 528 | struct sk_buff *skb; |
528 | 529 | ||
529 | skb = dev_alloc_skb(pkt_size + 2); | 530 | skb = netdev_alloc_skb(tp->dev, pkt_size + 2); |
530 | if (skb) { | 531 | if (skb) { |
531 | skb_reserve(skb, 2); | 532 | skb_reserve(skb, 2); |
532 | skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size); | 533 | skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size); |
533 | *sk_buff = skb; | 534 | *sk_buff = skb; |
534 | sis190_give_to_asic(desc, rx_buf_sz); | 535 | sis190_give_to_asic(desc, tp->rx_buf_sz); |
535 | ret = 0; | 536 | ret = 0; |
536 | } | 537 | } |
537 | } | 538 | } |
@@ -603,8 +604,7 @@ static int sis190_rx_interrupt(struct net_device *dev, | |||
603 | le32_to_cpu(desc->addr), tp->rx_buf_sz, | 604 | le32_to_cpu(desc->addr), tp->rx_buf_sz, |
604 | PCI_DMA_FROMDEVICE); | 605 | PCI_DMA_FROMDEVICE); |
605 | 606 | ||
606 | if (sis190_try_rx_copy(&skb, pkt_size, desc, | 607 | if (sis190_try_rx_copy(tp, &skb, pkt_size, desc)) { |
607 | tp->rx_buf_sz)) { | ||
608 | pci_action = pci_unmap_single; | 608 | pci_action = pci_unmap_single; |
609 | tp->Rx_skbuff[entry] = NULL; | 609 | tp->Rx_skbuff[entry] = NULL; |
610 | sis190_make_unusable_by_asic(desc); | 610 | sis190_make_unusable_by_asic(desc); |