netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 3/5] sky2: use ALIGN() macro
Date: Tue, 25 Apr 2006 10:58:52 -0700	[thread overview]
Message-ID: <20060425175951.868574000@localhost.localdomain> (raw)
In-Reply-To: 20060425175849.372221000@localhost.localdomain

[-- Attachment #1: sky2-align.patch --]
[-- Type: text/plain, Size: 995 bytes --]

The ALIGN() macro in kernel.h does the same math that the
sky2 driver was using for padding.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

--- sky2-2.6.17.orig/drivers/net/sky2.c	2006-04-25 10:47:03.000000000 -0700
+++ sky2-2.6.17/drivers/net/sky2.c	2006-04-25 10:47:28.000000000 -0700
@@ -925,8 +925,7 @@
 	skb = alloc_skb(size + RX_SKB_ALIGN, gfp_mask);
 	if (likely(skb)) {
 		unsigned long p	= (unsigned long) skb->data;
-		skb_reserve(skb,
-			((p + RX_SKB_ALIGN - 1) & ~(RX_SKB_ALIGN - 1)) - p);
+		skb_reserve(skb, ALIGN(p, RX_SKB_ALIGN) - p);
 	}
 
 	return skb;
@@ -1686,13 +1685,12 @@
 }
 
 
-#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
 /* Want receive buffer size to be multiple of 64 bits
  * and incl room for vlan and truncation
  */
 static inline unsigned sky2_buf_size(int mtu)
 {
-	return roundup(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
+	return ALIGN(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
 }
 
 static int sky2_change_mtu(struct net_device *dev, int new_mtu)

--


  parent reply	other threads:[~2006-04-25 21:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-25 17:58 [PATCH 0/5] sky2: version 1.2 Stephen Hemminger
2006-04-25 17:58 ` [PATCH 1/5] sky2: reschedule if irq still pending Stephen Hemminger
2006-04-26 10:20   ` Jeff Garzik
2006-04-25 17:58 ` [PATCH 2/5] sky2: add fake idle irq timer Stephen Hemminger
2006-04-25 21:23   ` Francois Romieu
2006-04-25 21:30     ` Stephen Hemminger
2006-04-25 22:39       ` Francois Romieu
2006-04-25 22:45         ` Stephen Hemminger
2006-04-25 17:58 ` Stephen Hemminger [this message]
2006-04-25 17:58 ` [PATCH 4/5] sky2: reset function can be devinit Stephen Hemminger
2006-04-25 17:58 ` [PATCH 5/5] sky2: version 1.2 Stephen Hemminger
2006-04-29 18:15 ` [PATCH 0/5] " Bertrand Jacquin

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=20060425175951.868574000@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=jgarzik@pobox.com \
    --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;
as well as URLs for NNTP newsgroup(s).