aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/gadget/u_ether.c4
-rw-r--r--include/linux/etherdevice.h4
-rw-r--r--net/ethernet/eth.c13
3 files changed, 14 insertions, 7 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 00fa5239879d..d9739d52f8f5 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -146,7 +146,7 @@ static inline int qlen(struct usb_gadget *gadget)
146 146
147/* NETWORK DRIVER HOOKUP (to the layer above this driver) */ 147/* NETWORK DRIVER HOOKUP (to the layer above this driver) */
148 148
149static int eth_change_mtu(struct net_device *net, int new_mtu) 149static int ueth_change_mtu(struct net_device *net, int new_mtu)
150{ 150{
151 struct eth_dev *dev = netdev_priv(net); 151 struct eth_dev *dev = netdev_priv(net);
152 unsigned long flags; 152 unsigned long flags;
@@ -764,7 +764,7 @@ int __init gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
764 if (ethaddr) 764 if (ethaddr)
765 memcpy(ethaddr, dev->host_mac, ETH_ALEN); 765 memcpy(ethaddr, dev->host_mac, ETH_ALEN);
766 766
767 net->change_mtu = eth_change_mtu; 767 net->change_mtu = ueth_change_mtu;
768 net->hard_start_xmit = eth_start_xmit; 768 net->hard_start_xmit = eth_start_xmit;
769 net->open = eth_open; 769 net->open = eth_open;
770 net->stop = eth_stop; 770 net->stop = eth_stop;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 25d62e6e3290..0e5e97060034 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -41,6 +41,10 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh, 41extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev, 42 const struct net_device *dev,
43 const unsigned char *haddr); 43 const unsigned char *haddr);
44extern int eth_mac_addr(struct net_device *dev, void *p);
45extern int eth_change_mtu(struct net_device *dev, int new_mtu);
46extern int eth_validate_addr(struct net_device *dev);
47
44 48
45 49
46extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 50extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
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;