[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1188212049.6756.18.camel@johannes.berg>
Date: Mon, 27 Aug 2007 12:54:09 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Joe Perches <joe@...ches.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net-2.6.24] introduce MAC_FMT/MAC_ARG
On Sat, 2007-08-25 at 17:09 -0700, Joe Perches wrote:
>
> @@ -747,22 +741,15 @@ static int ariadne_rx(struct net_device *dev)
> skb_copy_to_linear_data(skb, (char *)priv->rx_buff[entry],
> pkt_len);
> skb->protocol=eth_type_trans(skb,dev);
> #if 0
> (int)skb->len);
> +{
> + printk(KERN_DEBUG "RX pkt type 0x%04x"
> + " from " MAC_FMT " to " MAC_FMT
> + " data 0x%08x len %d\n",
> + ((u_short *)skb->data)[6],
> + MAC_ARG(((u_char *)skb->data)+6),
> + MAC_ARG((u_char *)skb->data),
> + (int)skb->data, (int)skb->len);
> +}
> #endif
You could drop the braces since there are no variables there any more.
Thanks for this patch though, I'd have done it otherwise.
I was rereading your original conversion and noticed that it is now
trivial to make the kernel smaller like you originally wanted by doing
something like this
-- define this function somewhere --
print_mac(u8 *mac, char *buf)
{
sprintf(buf, "%02x:...", mac[0], mac[1], ...);
}
EXPORT_SYMBOL(print_mac)
-- change macros to --
#define MAC_FMT "%s"
#define MAC_ARG(a) ({char __buf[18]; print_mac(a, buf); __buf})
I'm not sure we'd want that, but at the time you said it made the kernel
significantly smaller and I doubt there's a performance problem with it
(who prints mac addresses regularly?)
johannes
Download attachment "signature.asc" of type "application/pgp-signature" (191 bytes)
Powered by blists - more mailing lists