aboutsummaryrefslogtreecommitdiffstats
path: root/net/ethernet/eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ethernet/eth.c')
-rw-r--r--net/ethernet/eth.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index b9d85af2dd31..280352aba403 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -165,8 +165,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
165 skb_pull(skb, ETH_HLEN); 165 skb_pull(skb, ETH_HLEN);
166 eth = eth_hdr(skb); 166 eth = eth_hdr(skb);
167 167
168 if (is_multicast_ether_addr(eth->h_dest)) { 168 if (unlikely(is_multicast_ether_addr(eth->h_dest))) {
169 if (!compare_ether_addr(eth->h_dest, dev->broadcast)) 169 if (!compare_ether_addr_64bits(eth->h_dest, dev->broadcast))
170 skb->pkt_type = PACKET_BROADCAST; 170 skb->pkt_type = PACKET_BROADCAST;
171 else 171 else
172 skb->pkt_type = PACKET_MULTICAST; 172 skb->pkt_type = PACKET_MULTICAST;
@@ -181,7 +181,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
181 */ 181 */
182 182
183 else if (1 /*dev->flags&IFF_PROMISC */ ) { 183 else if (1 /*dev->flags&IFF_PROMISC */ ) {
184 if (unlikely(compare_ether_addr(eth->h_dest, dev->dev_addr))) 184 if (unlikely(compare_ether_addr_64bits(eth->h_dest, dev->dev_addr)))
185 skb->pkt_type = PACKET_OTHERHOST; 185 skb->pkt_type = PACKET_OTHERHOST;
186 } 186 }
187 187
@@ -282,7 +282,7 @@ EXPORT_SYMBOL(eth_header_cache_update);
282 * This doesn't change hardware matching, so needs to be overridden 282 * This doesn't change hardware matching, so needs to be overridden
283 * for most real devices. 283 * for most real devices.
284 */ 284 */
285static int eth_mac_addr(struct net_device *dev, void *p) 285int eth_mac_addr(struct net_device *dev, void *p)
286{ 286{
287 struct sockaddr *addr = p; 287 struct sockaddr *addr = p;
288 288
@@ -293,6 +293,7 @@ static int eth_mac_addr(struct net_device *dev, void *p)
293 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 293 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
294 return 0; 294 return 0;
295} 295}
296EXPORT_SYMBOL(eth_mac_addr);
296 297
297/** 298/**
298 * eth_change_mtu - set new MTU size 299 * eth_change_mtu - set new MTU size
@@ -302,21 +303,23 @@ static int eth_mac_addr(struct net_device *dev, void *p)
302 * Allow changing MTU size. Needs to be overridden for devices 303 * Allow changing MTU size. Needs to be overridden for devices
303 * supporting jumbo frames. 304 * supporting jumbo frames.
304 */ 305 */
305static int eth_change_mtu(struct net_device *dev, int new_mtu) 306int eth_change_mtu(struct net_device *dev, int new_mtu)
306{ 307{
307 if (new_mtu < 68 || new_mtu > ETH_DATA_LEN) 308 if (new_mtu < 68 || new_mtu > ETH_DATA_LEN)
308 return -EINVAL; 309 return -EINVAL;
309 dev->mtu = new_mtu; 310 dev->mtu = new_mtu;
310 return 0; 311 return 0;
311} 312}
313EXPORT_SYMBOL(eth_change_mtu);
312 314
313static int eth_validate_addr(struct net_device *dev) 315int eth_validate_addr(struct net_device *dev)
314{ 316{
315 if (!is_valid_ether_addr(dev->dev_addr)) 317 if (!is_valid_ether_addr(dev->dev_addr))
316 return -EADDRNOTAVAIL; 318 return -EADDRNOTAVAIL;
317 319
318 return 0; 320 return 0;
319} 321}
322EXPORT_SYMBOL(eth_validate_addr);
320 323
321const struct header_ops eth_header_ops ____cacheline_aligned = { 324const struct header_ops eth_header_ops ____cacheline_aligned = {
322 .create = eth_header, 325 .create = eth_header,
@@ -334,11 +337,11 @@ const struct header_ops eth_header_ops ____cacheline_aligned = {
334void ether_setup(struct net_device *dev) 337void ether_setup(struct net_device *dev)
335{ 338{
336 dev->header_ops = &eth_header_ops; 339 dev->header_ops = &eth_header_ops;
337 340#ifdef CONFIG_COMPAT_NET_DEV_OPS
338 dev->change_mtu = eth_change_mtu; 341 dev->change_mtu = eth_change_mtu;
339 dev->set_mac_address = eth_mac_addr; 342 dev->set_mac_address = eth_mac_addr;
340 dev->validate_addr = eth_validate_addr; 343 dev->validate_addr = eth_validate_addr;
341 344#endif
342 dev->type = ARPHRD_ETHER; 345 dev->type = ARPHRD_ETHER;
343 dev->hard_header_len = ETH_HLEN; 346 dev->hard_header_len = ETH_HLEN;
344 dev->mtu = ETH_DATA_LEN; 347 dev->mtu = ETH_DATA_LEN;