From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeff Garzik <jgarzik@pobox.com>,
"Maciej W. Rozycki" <macro@linux-mips.org>
Cc: netdev@vger.kernel.org
Subject: [PATCH 07/13] sb1250: use netdev_alloc_skb
Date: Wed, 16 Apr 2008 16:37:34 -0700 [thread overview]
Message-ID: <20080416233757.467685157@vyatta.com> (raw)
In-Reply-To: 20080416233727.732025083@vyatta.com
[-- Attachment #1: sb1250 --]
[-- Type: text/plain, Size: 1723 bytes --]
Use netdev_alloc_skb. This sets skb->dev and allows arch specific
allocation. Also simplify and cleanup the alignment code.
Not tested, depends on non-x86 hardware
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/sb1250-mac.c 2008-04-02 10:55:30.000000000 -0700
+++ b/drivers/net/sb1250-mac.c 2008-04-16 16:32:06.000000000 -0700
@@ -179,7 +179,6 @@ enum sbmac_state {
#define SBMAC_MAX_TXDESCR 256
#define SBMAC_MAX_RXDESCR 256
-#define ETHER_ALIGN 2
#define ETHER_ADDR_LEN 6
#define ENET_PACKET_SIZE 1518
/*#define ENET_PACKET_SIZE 9216 */
@@ -777,16 +776,13 @@ static void sbdma_channel_stop(struct sb
d->sbdma_remptr = NULL;
}
-static void sbdma_align_skb(struct sk_buff *skb,int power2,int offset)
+static inline void sbdma_align_skb(struct sk_buff *skb,
+ unsigned power2, unsigned offset)
{
- unsigned long addr;
- unsigned long newaddr;
+ unsigned long addr = skb->data;
+ unsigned long newaddr = PTR_ALIGN(addr, power2);
- addr = (unsigned long) skb->data;
-
- newaddr = (addr + power2 - 1) & ~(power2 - 1);
-
- skb_reserve(skb,newaddr-addr+offset);
+ skb_reserve(skb, newaddr - addr + offset);
}
@@ -848,14 +844,15 @@ static int sbdma_add_rcvbuffer(struct sb
*/
if (sb == NULL) {
- sb_new = dev_alloc_skb(ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2 + ETHER_ALIGN);
+ sb_new = netdev_alloc_skb(dev, ENET_PACKET_SIZE + SMP_CACHE_BYTES * 2
+ + NET_IP_ALIGN);
if (sb_new == NULL) {
pr_info("%s: sk_buff allocation failed\n",
d->sbdma_eth->sbm_dev->name);
return -ENOBUFS;
}
- sbdma_align_skb(sb_new, SMP_CACHE_BYTES, ETHER_ALIGN);
+ sbdma_align_skb(sb_new, SMP_CACHE_BYTES, NET_IP_ALIGN);
}
else {
sb_new = sb;
--
next prev parent reply other threads:[~2008-04-16 23:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-16 23:37 [PATCH 00/13] Network driver changes for 2.6.26 Stephen Hemminger
2008-04-16 23:37 ` [PATCH 04/13] via-velocity: use netdev_alloc_skb Stephen Hemminger
2008-04-16 23:37 ` [PATCH 05/13] via-velocity: use memmove Stephen Hemminger
2008-04-16 23:37 ` [PATCH 06/13] sis190: use netdev_alloc_skb Stephen Hemminger
2008-04-17 1:04 ` Wang Chen
2008-04-17 2:16 ` Wang Chen
2008-04-17 2:59 ` Stephen Hemminger
2008-04-17 6:50 ` Francois Romieu
2008-04-16 23:37 ` Stephen Hemminger [this message]
2008-05-05 12:34 ` [PATCH 07/13] sb1250: " Maciej W. Rozycki
2008-04-16 23:37 ` [PATCH 08/13] ns8320: " Stephen Hemminger
2008-05-31 2:20 ` Jeff Garzik
2008-04-16 23:37 ` [PATCH 09/13] myri: " Stephen Hemminger
2008-04-16 23:37 ` [PATCH 10/13] ixp2000: " Stephen Hemminger
2008-04-17 13:53 ` Lennert Buytenhek
2008-04-16 23:37 ` [PATCH 11/13] hamachi: " Stephen Hemminger
2008-04-16 23:37 ` [PATCH 12/13] dl2k: " Stephen Hemminger
2008-04-16 23:37 ` [PATCH 13/13] acenic: " Stephen Hemminger
2008-05-31 2:21 ` Jeff Garzik
[not found] ` <20080416233757.090004281@vyatta.com>
2008-04-17 2:33 ` [PATCH 02/13] atl1: " Jay Cliburn
[not found] ` <20080416233757.015978466@vyatta.com>
2008-05-22 18:13 ` [PATCH 01/13] tg3: remove unneeded semicolons Jeff Garzik
[not found] ` <20080416233757.166190217@vyatta.com>
2008-05-31 2:20 ` [PATCH 03/13] ts108: use netdev_alloc_skb Jeff Garzik
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=20080416233757.467685157@vyatta.com \
--to=shemminger@vyatta.com \
--cc=jgarzik@pobox.com \
--cc=macro@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.