From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next 11/19] net: usb: aqc111: Add support for changing MTU Date: Sat, 6 Oct 2018 18:56:03 +0200 Message-ID: <20181006165603.GA6990@lunn.ch> References: <4217a1b53f61c5da8f6ba69326c7b759174817e7.1538734658.git.igor.russkikh@aquantia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "David S . Miller" , "linux-usb@vger.kernel.org" , "netdev@vger.kernel.org" , Dmitry Bezrukov To: Igor Russkikh Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:55771 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726256AbeJGAAM (ORCPT ); Sat, 6 Oct 2018 20:00:12 -0400 Content-Disposition: inline In-Reply-To: <4217a1b53f61c5da8f6ba69326c7b759174817e7.1538734658.git.igor.russkikh@aquantia.com> Sender: netdev-owner@vger.kernel.org List-ID: > +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