From 53308ab1a7960306867a660b86bcfc2a5c872b73 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Thu, 6 May 2010 00:27:37 +0200 Subject: [PATCH] compat: backport eth_change_mtu and eth_validate_addr Signed-off-by: Hauke Mehrtens --- compat/compat-2.6.29.c | 26 ++++++++++++++++++++++++++ include/linux/compat-2.6.29.h | 2 ++ 2 files changed, 28 insertions(+) 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 -- 2.30.2