aboutsummaryrefslogtreecommitdiffstats
path: root/net/ethernet/eth.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-20 01:42:31 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-20 01:42:31 -0500
commitccad637b0c57de1825ffd34c311bf71487545ac2 (patch)
treefa5e54d6a4d8a414754efb7904685e5a83bff601 /net/ethernet/eth.c
parenteeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 (diff)
netdev: expose ethernet address primitives
When ethernet devices are converted, the function pointer setup by eth_setup() need to be done during intialization. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ethernet/eth.c')
-rw-r--r--net/ethernet/eth.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index b9d85af2dd31..a87a171d9914 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -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;