netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: jeff@garzik.org
Cc: netdev@vger.kernel.org, akpm@linux-foundation.org,
	Stephen Hemminger <shemminger@vyatta.com>
Subject: [PATCH 3/6] sis190: use netdev_alloc_skb
Date: Sun, 27 Apr 2008 19:03:25 +0200	[thread overview]
Message-ID: <20080427170325.GD26953@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <20080427170023.GA26953@electric-eye.fr.zoreil.com>

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>
---
 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 248c385..97aa18d 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)
 	desc->status = 0x0;
 }
 
-static struct sk_buff *sis190_alloc_rx_skb(struct pci_dev *pdev,
-					   struct RxDesc *desc, u32 rx_buf_sz)
+static struct sk_buff *sis190_alloc_rx_skb(struct sis190_private *tp,
+					   struct RxDesc *desc)
 {
+	u32 rx_buf_sz = tp->rx_buf_sz;
 	struct sk_buff *skb;
 
-	skb = dev_alloc_skb(rx_buf_sz);
+	skb = netdev_alloc_skb(tp->dev, rx_buf_sz);
 	if (likely(skb)) {
 		dma_addr_t mapping;
 
-		mapping = pci_map_single(pdev, skb->data, rx_buf_sz,
+		mapping = pci_map_single(tp->pci_dev, skb->data, tp->rx_buf_sz,
 					 PCI_DMA_FROMDEVICE);
 		sis190_map_to_asic(desc, mapping, rx_buf_sz);
 	} else
@@ -509,29 +510,29 @@ static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev,
 		if (tp->Rx_skbuff[i])
 			continue;
 
-		tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp->pci_dev,
-						       tp->RxDescRing + i,
-						       tp->rx_buf_sz);
+		tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp, tp->RxDescRing + i);
+
 		if (!tp->Rx_skbuff[i])
 			break;
 	}
 	return cur - start;
 }
 
-static inline int sis190_try_rx_copy(struct sk_buff **sk_buff, int pkt_size,
-				     struct RxDesc *desc, int rx_buf_sz)
+static int sis190_try_rx_copy(struct sis190_private *tp,
+			      struct sk_buff **sk_buff, int pkt_size,
+			      struct RxDesc *desc)
 {
 	int ret = -1;
 
 	if (pkt_size < rx_copybreak) {
 		struct sk_buff *skb;
 
-		skb = dev_alloc_skb(pkt_size + 2);
+		skb = netdev_alloc_skb(tp->dev, pkt_size + 2);
 		if (skb) {
 			skb_reserve(skb, 2);
 			skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size);
 			*sk_buff = skb;
-			sis190_give_to_asic(desc, rx_buf_sz);
+			sis190_give_to_asic(desc, tp->rx_buf_sz);
 			ret = 0;
 		}
 	}
@@ -603,8 +604,7 @@ static int sis190_rx_interrupt(struct net_device *dev,
 				le32_to_cpu(desc->addr), tp->rx_buf_sz,
 				PCI_DMA_FROMDEVICE);
 
-			if (sis190_try_rx_copy(&skb, pkt_size, desc,
-					       tp->rx_buf_sz)) {
+			if (sis190_try_rx_copy(tp, &skb, pkt_size, desc)) {
 				pci_action = pci_unmap_single;
 				tp->Rx_skbuff[entry] = NULL;
 				sis190_make_unusable_by_asic(desc);
-- 
1.5.3.3


  parent reply	other threads:[~2008-04-27 17:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-27 17:00 [RFT 0/6] sis190 branch info Francois Romieu
2008-04-27 17:01 ` [PATCH 1/6] sis190: use the allocated buffer as a status code in sis190_alloc_rx_skb Francois Romieu
2008-04-27 17:02 ` [PATCH 2/6] sis190: hard-code the alignment of tiny packets Francois Romieu
2008-04-27 17:03 ` Francois Romieu [this message]
2008-04-27 17:04 ` [PATCH 4/6] sis190: Rx path update Francois Romieu
2008-04-27 17:05 ` [PATCH 5/6] sis190: remove needless MII reset Francois Romieu
2008-04-27 17:06 ` [PATCH 6/6] sis190: account for Tx errors Francois Romieu
2008-05-01 23:16   ` Andrew Morton
2008-04-29  5:47 ` [RFT 0/6] sis190 branch info Jeff Garzik
2008-05-01 23:10 ` Andrew Morton

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=20080427170325.GD26953@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=akpm@linux-foundation.org \
    --cc=jeff@garzik.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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).