diff options
author | Rafal Redzimski <rafal.f.redzimski@intel.com> | 2016-05-19 11:56:09 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-21 01:30:43 +0200 |
commit | 05a56487174d33fff5986f13c0c8e4b32f046da9 (patch) | |
tree | 2ce798fe0d3732ad18f9832d512d2155cdfc2cba /drivers/net/usb | |
parent | tuntap: correctly wake up process during uninit (diff) | |
download | linux-05a56487174d33fff5986f13c0c8e4b32f046da9.tar.xz linux-05a56487174d33fff5986f13c0c8e4b32f046da9.zip |
net: cdc_ncm: update datagram size after changing mtu
Current implementation updates the mtu size and notify cdc_ncm
device using USB_CDC_SET_MAX_DATAGRAM_SIZE request about datagram
size change instead of changing rx_urb_size.
Whenever mtu is being changed, datagram size should also be
updated. Also updating maxmtu formula so it takes max_datagram_size with
use of cdc_ncm_max_dgram_size() and not ctx.
Signed-off-by: Robert Dobrowolski <robert.dobrowolski@linux.intel.com>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/cdc_ncm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 2fb31edab125..53759c315b97 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -740,12 +740,14 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx) int cdc_ncm_change_mtu(struct net_device *net, int new_mtu) { struct usbnet *dev = netdev_priv(net); - struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; - int maxmtu = ctx->max_datagram_size - cdc_ncm_eth_hlen(dev); + int maxmtu = cdc_ncm_max_dgram_size(dev) - cdc_ncm_eth_hlen(dev); if (new_mtu <= 0 || new_mtu > maxmtu) return -EINVAL; + net->mtu = new_mtu; + cdc_ncm_set_dgram_size(dev, new_mtu + cdc_ncm_eth_hlen(dev)); + return 0; } EXPORT_SYMBOL_GPL(cdc_ncm_change_mtu); |