/* Change the maximum transfer size of the network device.  */
int dev_set_mtu(struct net_device *dev, int new_mtu)
/* Change the maximum transfer size of the network device.  */
int dev_set_mtu(struct net_device *dev, int new_mtu)
{
	const struct net_device_ops *ops = dev->netdev_ops;
	int err;
	if (new_mtu == dev->mtu)
		return 0;
	if (new_mtu < 0)
		return -EINVAL;
	if (!netif_device_present(dev))
		return -ENODEV;
	err = 0;
	if (ops->ndo_change_mtu)
		err = ops->ndo_change_mtu(dev, new_mtu);
	else
		dev->mtu = new_mtu;
	if (!err && dev->flags & IFF_UP)
		call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
	return err;
}