aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar.c
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-10-12 02:00:37 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-13 02:54:04 -0400
commit8a102fe001cc016dabcc392247a2b008e37ffe6a (patch)
tree1f64a312e00a030620e4874e614995dc575fe6cf /drivers/net/gianfar.c
parent32c513bca062f6c04b902d09c716fea205671e23 (diff)
gianfar: Factor out RX BDs initialization from gfar_new_rxbdp()
We want to just reinitialize RX BDs after hibernation, no need to map the skb->data again. So let's factor gfar_init_rxbdp() out of gfar_new_rxbdp(). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r--drivers/net/gianfar.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 068f9a2cf42c..a84363261673 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -147,6 +147,23 @@ MODULE_AUTHOR("Freescale Semiconductor, Inc");
147MODULE_DESCRIPTION("Gianfar Ethernet Driver"); 147MODULE_DESCRIPTION("Gianfar Ethernet Driver");
148MODULE_LICENSE("GPL"); 148MODULE_LICENSE("GPL");
149 149
150static void gfar_init_rxbdp(struct net_device *dev, struct rxbd8 *bdp,
151 dma_addr_t buf)
152{
153 struct gfar_private *priv = netdev_priv(dev);
154 u32 lstatus;
155
156 bdp->bufPtr = buf;
157
158 lstatus = BD_LFLAG(RXBD_EMPTY | RXBD_INTERRUPT);
159 if (bdp == priv->rx_bd_base + priv->rx_ring_size - 1)
160 lstatus |= BD_LFLAG(RXBD_WRAP);
161
162 eieio();
163
164 bdp->lstatus = lstatus;
165}
166
150static int gfar_alloc_skb_resources(struct net_device *ndev) 167static int gfar_alloc_skb_resources(struct net_device *ndev)
151{ 168{
152 struct txbd8 *txbdp; 169 struct txbd8 *txbdp;
@@ -1676,19 +1693,11 @@ static void gfar_new_rxbdp(struct net_device *dev, struct rxbd8 *bdp,
1676 struct sk_buff *skb) 1693 struct sk_buff *skb)
1677{ 1694{
1678 struct gfar_private *priv = netdev_priv(dev); 1695 struct gfar_private *priv = netdev_priv(dev);
1679 u32 lstatus; 1696 dma_addr_t buf;
1680
1681 bdp->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data,
1682 priv->rx_buffer_size, DMA_FROM_DEVICE);
1683
1684 lstatus = BD_LFLAG(RXBD_EMPTY | RXBD_INTERRUPT);
1685 1697
1686 if (bdp == priv->rx_bd_base + priv->rx_ring_size - 1) 1698 buf = dma_map_single(&priv->ofdev->dev, skb->data,
1687 lstatus |= BD_LFLAG(RXBD_WRAP); 1699 priv->rx_buffer_size, DMA_FROM_DEVICE);
1688 1700 gfar_init_rxbdp(dev, bdp, buf);
1689 eieio();
1690
1691 bdp->lstatus = lstatus;
1692} 1701}
1693 1702
1694 1703