]> git.baikalelectronics.ru Git - kernel.git/commit
net: cdc_ncm: avoid changing RX/TX buffers on MTU changes
authorBjørn Mork <bjorn@mork.no>
Wed, 23 Dec 2015 12:42:43 +0000 (13:42 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Dec 2015 03:52:08 +0000 (22:52 -0500)
commit5f96b810ede446908b738a150b5684d538ee3ff1
treeb0c5d35d7cd42c16f8364f4028a9313cc1eb6666
parent4bbd60dda6ac6ef495d9e99e2521384a3af5264e
net: cdc_ncm: avoid changing RX/TX buffers on MTU changes

NCM buffer sizes are negotiated with the device independently of
the network device MTU.  The RX buffers are allocated by the
usbnet framework based on the rx_urb_size value set by cdc_ncm. A
single RX buffer can hold a number of MTU sized packets.

The default usbnet change_mtu ndo only modifies rx_urb_size if it
is equal to hard_mtu.  And the cdc_ncm driver will set rx_urb_size
and hard_mtu independently of each other, based on dwNtbInMaxSize
and dwNtbOutMaxSize respectively. It was therefore assumed that
usbnet_change_mtu() would never touch rx_urb_size.  This failed to
consider the case where dwNtbInMaxSize and dwNtbOutMaxSize happens
to be equal.

Fix by implementing an NCM specific change_mtu ndo, modifying the
netdev MTU without touching the buffer size settings.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_mbim.c
drivers/net/usb/cdc_ncm.c
include/linux/usb/cdc_ncm.h