From: Hauke Mehrtens Date: Wed, 5 May 2010 22:27:37 +0000 (+0200) Subject: compat: backport eth_change_mtu and eth_validate_addr X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=53308ab1a7960306867a660b86bcfc2a5c872b73;p=openwrt%2Fstaging%2Fblogic.git compat: backport eth_change_mtu and eth_validate_addr Signed-off-by: Hauke Mehrtens --- diff --git a/compat/compat-2.6.29.c b/compat/compat-2.6.29.c index 5ee1e44cd347..8c725ee73151 100644 --- a/compat/compat-2.6.29.c +++ b/compat/compat-2.6.29.c @@ -98,6 +98,32 @@ int eth_mac_addr(struct net_device *dev, void *p) return 0; } EXPORT_SYMBOL(eth_mac_addr); + +/** + * eth_change_mtu - set new MTU size + * @dev: network device + * @new_mtu: new Maximum Transfer Unit + * + * Allow changing MTU size. Needs to be overridden for devices + * supporting jumbo frames. + */ +int eth_change_mtu(struct net_device *dev, int new_mtu) +{ + if (new_mtu < 68 || new_mtu > ETH_DATA_LEN) + return -EINVAL; + dev->mtu = new_mtu; + return 0; +} +EXPORT_SYMBOL(eth_change_mtu); + +int eth_validate_addr(struct net_device *dev) +{ + if (!is_valid_ether_addr(dev->dev_addr)) + return -EADDRNOTAVAIL; + + return 0; +} +EXPORT_SYMBOL(eth_validate_addr); /* Source: net/ethernet/eth.c */ diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h index 165b78c33c27..f063e240cef5 100644 --- a/include/linux/compat-2.6.29.h +++ b/include/linux/compat-2.6.29.h @@ -246,6 +246,8 @@ extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); ) extern int eth_mac_addr(struct net_device *dev, void *p); +extern int eth_change_mtu(struct net_device *dev, int new_mtu); +extern int eth_validate_addr(struct net_device *dev); #else