* [PATCH 1/3] eth: use constant size address (revised)
[not found] ` <20060411.172401.67034166.davem@davemloft.net>
@ 2006-04-13 23:24 ` Stephen Hemminger
0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2006-04-13 23:24 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Change the ethernet support routines to use constant address size.
This generates smaller faster code.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- sky2-2.6.17.orig/net/ethernet/eth.c 2006-03-07 13:28:54.000000000 -0800
+++ sky2-2.6.17/net/ethernet/eth.c 2006-04-12 13:10:56.000000000 -0700
@@ -77,6 +77,8 @@
{
struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);
+ BUG_ON(dev->addr_len != ETH_ALEN);
+
/*
* Set the protocol type. For a packet of type ETH_P_802_3 we put the length
* in here instead. It is up to the 802.2 layer to carry protocol information.
@@ -93,11 +95,11 @@
if(!saddr)
saddr = dev->dev_addr;
- memcpy(eth->h_source,saddr,dev->addr_len);
+ memcpy(eth->h_source,saddr, ETH_ALEN);
if(daddr)
{
- memcpy(eth->h_dest,daddr,dev->addr_len);
+ memcpy(eth->h_dest,daddr, ETH_ALEN);
return ETH_HLEN;
}
@@ -107,7 +109,7 @@
if (dev->flags & (IFF_LOOPBACK|IFF_NOARP))
{
- memset(eth->h_dest, 0, dev->addr_len);
+ memset(eth->h_dest, 0, ETH_ALEN);
return ETH_HLEN;
}
@@ -140,7 +142,7 @@
"%s: unable to resolve type %X addresses.\n",
dev->name, (int)eth->h_proto);
- memcpy(eth->h_source, dev->dev_addr, dev->addr_len);
+ memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
break;
}
@@ -223,8 +225,8 @@
return -1;
eth->h_proto = type;
- memcpy(eth->h_source, dev->dev_addr, dev->addr_len);
- memcpy(eth->h_dest, neigh->ha, dev->addr_len);
+ memcpy(eth->h_source, dev->dev_addr, ETH_ALEN);
+ memcpy(eth->h_dest, neigh->ha, ETH_ALEN);
hh->hh_len = ETH_HLEN;
return 0;
}
@@ -236,7 +238,7 @@
void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr)
{
memcpy(((u8*)hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)),
- haddr, dev->addr_len);
+ haddr, ETH_ALEN);
}
EXPORT_SYMBOL(eth_type_trans);
@@ -246,7 +248,7 @@
struct sockaddr *addr=p;
if (netif_running(dev))
return -EBUSY;
- memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-04-13 23:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20060411181053.862087000@localhost.localdomain>
[not found] ` <20060411181136.913572000@localhost.localdomain>
[not found] ` <20060411.172401.67034166.davem@davemloft.net>
2006-04-13 23:24 ` [PATCH 1/3] eth: use constant size address (revised) Stephen Hemminger
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).