Subject: Re: 答复: [PATCH] qmi_wwan: support modify usbnet's rx_urb_size

From: Bjørn Mork <[email-masked]>
Date: Mon, 03 Aug 2020 16:05:52 +0200

"Carl Yin(殷张成)" <[email-masked]> writes:

> Hi Bjørn, 
> 	You can check cdc_ncm.c.
> 	cdc ncm driver set 'rx_urb_size' on driver probe time, and the value read from' cdc_ncm_bind_common() 's USB_CDC_GET_NTB_FORMAT '.
> 	and also allow the userspace to modify 'rx_urb_size' by ' /sys/class/net/wwan0/cdc_ncm/rx_max'.

And I must admit I wrote that code ;-)

NCM has the concept of 'dwNtbInMaxSize' and 'dwNtbOutMaxSize'
controlling the maximum USB buffer size in each direction. The values
are set by the device and provided to the host driver when probing. The
driver then knows it must be prepared to receive up to 'dwNtbInMaxSize'
buffers and set 'rx_urb_size' to this value.

This is fully automatic and will Just Work without user/userspace
intervention for any sane NCM or MBIM device.

'rx_max' was introduced to handle the insane devices, wanting buffers
larger than the host was prepared to give them. The limit used to be
hard coded in the driver.  But it was enough for some low end
hosts, so I made it configurable using that sysfs knob.

You are right that the rmnet aggregation situation is similar. But
similar to NCM, I would like a solution which is fully automatic for
most of the users.  Or preferably all, if possible.  A sysfs knob is a
last resort thing.  Let's try to do without it first.

Bjørn