/* returns 0 on success, -EINVAL if MTU is out of valid range. (valid range is 576 .. 65527). If VM is on the remote side, maximum MTU is 32760, however this is not checked here.  */
static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
/* returns 0 on success, -EINVAL if MTU is out of valid range. (valid range is 576 .. 65527). If VM is on the remote side, maximum MTU is 32760, however this is not checked here.  */
static int ctcm_change_mtu(struct net_device *dev, int new_mtu)
{
	struct ctcm_priv *priv;
	int max_bufsize;
	if (new_mtu < 576 || new_mtu > 65527)
		return -EINVAL;
	priv = dev->ml_priv;
	max_bufsize = priv->channel[READ]->max_bufsize;
	if (IS_MPC(priv)) {
		if (new_mtu > max_bufsize - TH_HEADER_LENGTH)
			return -EINVAL;
		dev->hard_header_len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH;
	} else {
		if (new_mtu > max_bufsize - LL_HEADER_LENGTH - 2)
			return -EINVAL;
		dev->hard_header_len = LL_HEADER_LENGTH + 2;
	}
	dev->mtu = new_mtu;
	return 0;
}