Netdev List
 help / color / mirror / Atom feed
From: Kevin Lo <kevlo@kevlo.org>
To: netdev@vger.kernel.org
Subject: [PATCH] via-rhine: changed to use netdev_alloc_skb() from dev_alloc_skb
Date: Wed, 27 Aug 2008 11:35:09 +0800	[thread overview]
Message-ID: <1219808109.7135.11.camel@nsl> (raw)

[-- Attachment #1: Type: text/plain, Size: 174 bytes --]

Use netdev_alloc_skb. This sets skb->dev and allows 
arch specific allocation. Also cleanup the alignment code.

Tested on x86_64.

Signed-off-by:	Kevin Lo <kevlo@kevlo.org>

[-- Attachment #2: patch-via-rhine --]
[-- Type: text/x-patch, Size: 1429 bytes --]

--- linux-2.6.27-rc4/drivers/net/via-rhine.c.orig	2008-08-27 09:38:44.000000000 +0800
+++ linux-2.6.27-rc4/drivers/net/via-rhine.c	2008-08-27 09:40:50.000000000 +0800
@@ -914,7 +914,7 @@ static void alloc_rbufs(struct net_devic
 
 	/* Fill in the Rx buffers.  Handle allocation failure gracefully. */
 	for (i = 0; i < RX_RING_SIZE; i++) {
-		struct sk_buff *skb = dev_alloc_skb(rp->rx_buf_sz);
+		struct sk_buff *skb = netdev_alloc_skb(dev, rp->rx_buf_sz);
 		rp->rx_skbuff[i] = skb;
 		if (skb == NULL)
 			break;
@@ -1473,8 +1473,8 @@ static int rhine_rx(struct net_device *d
 			/* Check if the packet is long enough to accept without
 			   copying to a minimally-sized skbuff. */
 			if (pkt_len < rx_copybreak &&
-				(skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
-				skb_reserve(skb, 2);	/* 16 byte align the IP header */
+				(skb = netdev_alloc_skb(dev, pkt_len + NET_IP_ALIGN)) != NULL) {
+				skb_reserve(skb, NET_IP_ALIGN);	/* 16 byte align the IP header */
 				pci_dma_sync_single_for_cpu(rp->pdev,
 							    rp->rx_skbuff_dma[entry],
 							    rp->rx_buf_sz,
@@ -1518,7 +1518,7 @@ static int rhine_rx(struct net_device *d
 		struct sk_buff *skb;
 		entry = rp->dirty_rx % RX_RING_SIZE;
 		if (rp->rx_skbuff[entry] == NULL) {
-			skb = dev_alloc_skb(rp->rx_buf_sz);
+			skb = netdev_alloc_skb(dev, rp->rx_buf_sz);
 			rp->rx_skbuff[entry] = skb;
 			if (skb == NULL)
 				break;	/* Better luck next round. */

                 reply	other threads:[~2008-08-27  3:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1219808109.7135.11.camel@nsl \
    --to=kevlo@kevlo.org \
    --cc=netdev@vger.kernel.org \
    /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