[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181006165603.GA6990@lunn.ch>
Date: Sat, 6 Oct 2018 18:56:03 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Igor Russkikh <Igor.Russkikh@...antia.com>
Cc: "David S . Miller" <davem@...emloft.net>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Dmitry Bezrukov <Dmitry.Bezrukov@...antia.com>
Subject: Re: [PATCH net-next 11/19] net: usb: aqc111: Add support for
changing MTU
> +static int aqc111_change_mtu(struct net_device *net, int new_mtu)
> +{
> + struct usbnet *dev = netdev_priv(net);
> + u16 reg16 = 0;
> + u8 buf[5];
> +
> + if (new_mtu <= 0 || new_mtu > 16334) {
> + netdev_info(net, "Invalid MTU %d requested, hw max 16334",
> + new_mtu);
> + return -EINVAL;
> + }
Please set net->min_mtu, and net->max_mtu, and the core should do this
checking for you. See dev_set_mtu_ext().
Andrew
Powered by blists - more mailing lists