diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2005-10-25 18:03:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-10-29 00:23:58 -0400 |
commit | 360ac8e2f1a38c3497739636c3b702352d1ad0ae (patch) | |
tree | f671d3ec4071a1be3bce97bcff2c8c759e597e88 /net/ethernet/eth.c | |
parent | e83b860539d0ac1b3cff868178fa79c457e0c21f (diff) |
[ETH]: ether address compare
Expose faster ether compare for use by protocols and other
driver. And change name to be more consistent with other ether
address manipulation routines in same file
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/ethernet/eth.c')
-rw-r--r-- | net/ethernet/eth.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 68a5ca866442..e24577367274 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -146,19 +146,6 @@ int eth_rebuild_header(struct sk_buff *skb) | |||
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
148 | 148 | ||
149 | static inline unsigned int compare_eth_addr(const unsigned char *__a, const unsigned char *__b) | ||
150 | { | ||
151 | const unsigned short *dest = (unsigned short *) __a; | ||
152 | const unsigned short *devaddr = (unsigned short *) __b; | ||
153 | unsigned int res; | ||
154 | |||
155 | BUILD_BUG_ON(ETH_ALEN != 6); | ||
156 | res = ((dest[0] ^ devaddr[0]) | | ||
157 | (dest[1] ^ devaddr[1]) | | ||
158 | (dest[2] ^ devaddr[2])) != 0; | ||
159 | |||
160 | return res; | ||
161 | } | ||
162 | 149 | ||
163 | /* | 150 | /* |
164 | * Determine the packet's protocol ID. The rule here is that we | 151 | * Determine the packet's protocol ID. The rule here is that we |
@@ -176,7 +163,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
176 | eth = eth_hdr(skb); | 163 | eth = eth_hdr(skb); |
177 | 164 | ||
178 | if (*eth->h_dest&1) { | 165 | if (*eth->h_dest&1) { |
179 | if (!compare_eth_addr(eth->h_dest, dev->broadcast)) | 166 | if (!compare_ether_addr(eth->h_dest, dev->broadcast)) |
180 | skb->pkt_type = PACKET_BROADCAST; | 167 | skb->pkt_type = PACKET_BROADCAST; |
181 | else | 168 | else |
182 | skb->pkt_type = PACKET_MULTICAST; | 169 | skb->pkt_type = PACKET_MULTICAST; |
@@ -191,7 +178,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
191 | */ | 178 | */ |
192 | 179 | ||
193 | else if(1 /*dev->flags&IFF_PROMISC*/) { | 180 | else if(1 /*dev->flags&IFF_PROMISC*/) { |
194 | if (unlikely(compare_eth_addr(eth->h_dest, dev->dev_addr))) | 181 | if (unlikely(compare_ether_addr(eth->h_dest, dev->dev_addr))) |
195 | skb->pkt_type = PACKET_OTHERHOST; | 182 | skb->pkt_type = PACKET_OTHERHOST; |
196 | } | 183 | } |
197 | 184 | ||