aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-06-16 16:36:41 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-08 22:16:42 -0400
commit15d317587e17dcb96484e46b17b6e826a1f97661 (patch)
tree3c226fb38a125086e1f2d8597746e603bc66d7e6 /drivers/net/r8169.c
parenta73b629b3519ae97c5325eda346b1749961cfa8d (diff)
r8169: use netdev_alloc_skb
Use netdev_alloc_skb and remove the useless sk_buff * argument of rtl8169_alloc_rx_skb. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 5ec7752caa48..45864461aab6 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1997,31 +1997,28 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
1997 rtl8169_mark_to_asic(desc, rx_buf_sz); 1997 rtl8169_mark_to_asic(desc, rx_buf_sz);
1998} 1998}
1999 1999
2000static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff, 2000static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
2001 struct RxDesc *desc, int rx_buf_sz, 2001 struct net_device *dev,
2002 unsigned int align) 2002 struct RxDesc *desc, int rx_buf_sz,
2003 unsigned int align)
2003{ 2004{
2004 struct sk_buff *skb; 2005 struct sk_buff *skb;
2005 dma_addr_t mapping; 2006 dma_addr_t mapping;
2006 int ret = 0;
2007 2007
2008 skb = dev_alloc_skb(rx_buf_sz + align); 2008 skb = netdev_alloc_skb(dev, rx_buf_sz + align);
2009 if (!skb) 2009 if (!skb)
2010 goto err_out; 2010 goto err_out;
2011 2011
2012 skb_reserve(skb, (align - 1) & (unsigned long)skb->data); 2012 skb_reserve(skb, (align - 1) & (unsigned long)skb->data);
2013 *sk_buff = skb;
2014 2013
2015 mapping = pci_map_single(pdev, skb->data, rx_buf_sz, 2014 mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
2016 PCI_DMA_FROMDEVICE); 2015 PCI_DMA_FROMDEVICE);
2017 2016
2018 rtl8169_map_to_asic(desc, mapping, rx_buf_sz); 2017 rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
2019
2020out: 2018out:
2021 return ret; 2019 return skb;
2022 2020
2023err_out: 2021err_out:
2024 ret = -ENOMEM;
2025 rtl8169_make_unusable_by_asic(desc); 2022 rtl8169_make_unusable_by_asic(desc);
2026 goto out; 2023 goto out;
2027} 2024}
@@ -2044,15 +2041,19 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev,
2044 u32 cur; 2041 u32 cur;
2045 2042
2046 for (cur = start; end - cur > 0; cur++) { 2043 for (cur = start; end - cur > 0; cur++) {
2047 int ret, i = cur % NUM_RX_DESC; 2044 struct sk_buff *skb;
2045 unsigned int i = cur % NUM_RX_DESC;
2048 2046
2049 if (tp->Rx_skbuff[i]) 2047 if (tp->Rx_skbuff[i])
2050 continue; 2048 continue;
2051 2049
2052 ret = rtl8169_alloc_rx_skb(tp->pci_dev, tp->Rx_skbuff + i, 2050 skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev,
2053 tp->RxDescArray + i, tp->rx_buf_sz, tp->align); 2051 tp->RxDescArray + i,
2054 if (ret < 0) 2052 tp->rx_buf_sz, tp->align);
2053 if (!skb)
2055 break; 2054 break;
2055
2056 tp->Rx_skbuff[i] = skb;
2056 } 2057 }
2057 return cur - start; 2058 return cur - start;
2058} 2059}