From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: David Miller <davem@davemloft.net>
Cc: Scott Wood <scottwood@freescale.com>,
linuxppc-dev@ozlabs.org, netdev@vger.kernel.org,
Andy Fleming <afleming@freescale.com>
Subject: [PATCH 6/8] gianfar: Factor out RX BDs initialization from gfar_new_rxbdp()
Date: Mon, 12 Oct 2009 20:00:37 +0400 [thread overview]
Message-ID: <20091012160037.GF2463@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20091012160000.GA32406@oksana.dev.rtsoft.ru>
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>
---
drivers/net/gianfar.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 46b0b37..1b32274 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -147,6 +147,23 @@ MODULE_AUTHOR("Freescale Semiconductor, Inc");
MODULE_DESCRIPTION("Gianfar Ethernet Driver");
MODULE_LICENSE("GPL");
+static void gfar_init_rxbdp(struct net_device *dev, struct rxbd8 *bdp,
+ dma_addr_t buf)
+{
+ struct gfar_private *priv = netdev_priv(dev);
+ u32 lstatus;
+
+ bdp->bufPtr = buf;
+
+ lstatus = BD_LFLAG(RXBD_EMPTY | RXBD_INTERRUPT);
+ if (bdp == priv->rx_bd_base + priv->rx_ring_size - 1)
+ lstatus |= BD_LFLAG(RXBD_WRAP);
+
+ eieio();
+
+ bdp->lstatus = lstatus;
+}
+
static int gfar_alloc_skb_resources(struct net_device *ndev)
{
struct txbd8 *txbdp;
@@ -1676,19 +1693,11 @@ static void gfar_new_rxbdp(struct net_device *dev, struct rxbd8 *bdp,
struct sk_buff *skb)
{
struct gfar_private *priv = netdev_priv(dev);
- u32 lstatus;
-
- bdp->bufPtr = dma_map_single(&priv->ofdev->dev, skb->data,
- priv->rx_buffer_size, DMA_FROM_DEVICE);
-
- lstatus = BD_LFLAG(RXBD_EMPTY | RXBD_INTERRUPT);
+ dma_addr_t buf;
- if (bdp == priv->rx_bd_base + priv->rx_ring_size - 1)
- lstatus |= BD_LFLAG(RXBD_WRAP);
-
- eieio();
-
- bdp->lstatus = lstatus;
+ buf = dma_map_single(&priv->ofdev->dev, skb->data,
+ priv->rx_buffer_size, DMA_FROM_DEVICE);
+ gfar_init_rxbdp(dev, bdp, buf);
}
--
1.6.3.3
next prev parent reply other threads:[~2009-10-12 16:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-12 16:00 [PATCH 0/8] gianfar: Add support for hibernation Anton Vorontsov
2009-10-12 16:00 ` [PATCH 1/8] gianfar: Some cleanups for startup_gfar() Anton Vorontsov
2009-10-12 16:00 ` [PATCH 2/8] gianfar: Simplify skb resources freeing code Anton Vorontsov
2009-10-12 16:00 ` [PATCH 3/8] gianfar: Don't needlessly set the wrap bit for the last RX BD Anton Vorontsov
2009-10-12 16:00 ` [PATCH 4/8] gianfar: Split allocation and initialization steps out of startup_gfar() Anton Vorontsov
2009-10-12 16:00 ` [PATCH 5/8] gianfar: Move tbase/rbase initialization to gfar_init_mac() Anton Vorontsov
2009-10-12 16:00 ` Anton Vorontsov [this message]
2009-10-12 16:00 ` [PATCH 7/8] gianfar: Factor out gfar_init_bds() from gfar_alloc_skb_resources() Anton Vorontsov
2009-10-12 16:00 ` [PATCH 8/8] gianfar: Add support for hibernation Anton Vorontsov
2009-10-13 6:57 ` [PATCH 0/8] " David Miller
2009-10-13 17:22 ` Andy Fleming
2009-10-13 19:09 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091012160037.GF2463@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=afleming@freescale.com \
--cc=davem@davemloft.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).