Change the ethernet support routines to use constant address size.
This generates smaller faster code.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>


--- net-2.6.orig/net/ethernet/eth.c     2006-04-11 09:43:40.000000000 -0700
+++ net-2.6/net/ethernet/eth.c  2006-04-11 10:07:37.000000000 -0700
@@ -93,11 +93,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 +107,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 +140,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 +223,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 +236,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 +246,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;
 }
 

--

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to