[PATCH v1] net: cdc_ncm: update datagram size after changing mtu

From: Robert Dobrowolski
Date: Wed Apr 06 2016 - 07:44:16 EST


From: Rafal Redzimski <rafal.f.redzimski@xxxxxxxxx>

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.

Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Rafal Redzimski <rafal.f.redzimski@xxxxxxxxx>
Signed-off-by: Robert Dobrowolski <robert.dobrowolski@xxxxxxxxxxxxxxx>
---
drivers/net/usb/cdc_ncm.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 2fb31ed..4a47656 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -746,6 +746,8 @@ int cdc_ncm_change_mtu(struct net_device *net, int new_mtu)
if (new_mtu <= 0 || new_mtu > maxmtu)
return -EINVAL;
net->mtu = new_mtu;
+ cdc_ncm_set_dgram_size(dev, new_mtu);
+
return 0;
}
EXPORT_SYMBOL_GPL(cdc_ncm_change_mtu);
--
1.9.1