usb: gadget: ncm: Add support to update wMaxSegmentSize via configfs
authorKrishna Kurapati <quic_kriskura@quicinc.com>
Thu, 21 Dec 2023 15:32:16 +0000 (21:02 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Jan 2024 15:01:14 +0000 (16:01 +0100)
commit1900daeefd3ebde61199649143085a2dfdebf55c
tree0abf5338653af936f95ee7c5475a09ebce9d143b
parent68c26fe58182f5af56bfa577d1cc0c949740baab
usb: gadget: ncm: Add support to update wMaxSegmentSize via configfs

The max segment size is currently limited to the ethernet frame length of
the kernel which happens to be 1514 at this point in time. However the NCM
specification limits it to 64K for sixtenn bit NTB's. For peer to peer
connections, increasing the segment size gives better throughput.

Add support to configure this value before configfs symlink is created.
Also since the NTB Out/In buffer sizes are fixed at 16384 bytes, limit the
segment size to an upper cap of 8000 to allow at least a minimum of 2 MTU
sized datagrams to be aggregated.

Set the default MTU size for the ncm interface during function bind before
network interface is registered allowing MTU to be set in parity with
wMaxSegmentSize.

Update gadget documentation describing the new configfs property.

Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
Link: https://lore.kernel.org/r/20231221153216.18657-1-quic_kriskura@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/usb/gadget-testing.rst
drivers/usb/gadget/function/f_ncm.c
drivers/usb/gadget/function/u_ncm.h