linux/drivers
Bjørn Mork 3edce1cf81 USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND
Userspace applications need to know the maximum supported message
size.

The cdc-wdm driver translates between a character device stream
and a message based protocol.  Each message is transported as a
usb control message with no further encapsulation or syncronization.
Each read or write on the character device should translate to
exactly one usb control message to ensure that message boundaries
are kept intact.  That means that the userspace application must
know the maximum message size supported by the device and driver,
making this size a vital part of the cdc-wdm character device API.

CDC WDM and CDC MBIM functions export the maximum supported
message size through CDC functional descriptors.  The cdc-wdm and
cdc_mbim drivers will parse these descriptors and use the value
chosen by the device.  The only current way for a userspace
application to retrive the value is by duplicating the descriptor
parsing. This is an unnecessary complex task, and application
writers are likely to postpone it, using a fixed value and adding
a "todo" item.

QMI functions have no way to tell the host what message size they
support.  The qmi_wwan driver use a fixed value based on protocol
recommendations and observed device behaviour.  Userspace
applications must know and hard code the same value.  This scheme
will break if we ever encounter a QMI device needing a device
specific message size quirk.  We are currently unable to support
such a device because using a non default size would break the
implicit userspace API.

The message size is currently a hidden attribute of the cdc-wdm
userspace API.  Retrieving it is unnecessarily complex, increasing
the possibility of drivers and applications using different limits.
The resulting errors are hard to debug, and can only be replicated
on identical hardware.

Exporting the maximum message size from the driver simplifies the
task for the userspace application, and creates a unified
information source independent of device and function class. It also
serves to document that the message size is part of the cdc-wdm
userspace API.

This proposed API extension has been presented for the authors of
userspace applications and libraries using the current API: libmbim,
libqmi, uqmi, oFono and ModemManager.  The replies were:

Aleksander Morgado:
 "We do really need max message size for MBIM; and as you say, it may be
  good to have the max message size info also for QMI, so the new ioctl
  seems a good addition. So +1 from my side, for what it's worth."

Dan Williams:
 "Yeah, +1 here.  I'd prefer the sysfs file, but the fact that that
  doesn't work for fd passing pretty much kills it."

No negative replies are so far received.

Cc: Aleksander Morgado <aleksander@lanedo.com>
Cc: Dan Williams <dcbw@redhat.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 13:32:20 -07:00
..
accessibility
acpi
amba
ata Simple stuff. See one-line summaries. 2013-03-23 12:33:36 -07:00
atm
auxdisplay
base
bcma
block Merge git://git.infradead.org/users/willy/linux-nvme 2013-03-22 16:43:53 -07:00
bluetooth
bus
cdrom
char
clk
clocksource
connector
cpufreq
cpuidle
crypto
dca
devfreq
dio
dma
edac
eisa
extcon
firewire
firmware
gpio
gpu KMS: fix EDID detailed timing frame rate 2013-03-23 10:46:10 -07:00
hid USBHID: don't recover device if suspend fails in system sleep 2013-03-25 10:55:46 -07:00
hsi
hv
hwmon
hwspinlock
i2c Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2013-03-23 12:32:14 -07:00
ide
idle
iio
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-03-19 13:20:51 -07:00
input
iommu
ipack
irqchip
isdn
leds
lguest
macintosh
mailbox
md A few bugfixes for md 2013-03-23 15:49:49 -07:00
media
memory
memstick
message
mfd
misc
mmc
mtd
net usbnet: smsc75xx: don't recover device if suspend fails in system sleep 2013-03-25 10:55:47 -07:00
nfc
ntb
nubus
of
oprofile
parisc
parport
pci PCI: Use ROM images from firmware only if no other ROM source available 2013-03-19 14:51:14 -07:00
pcmcia
pinctrl
platform
pnp
power
pps
ps3
ptp
pwm
rapidio
regulator
remoteproc
rpmsg
rtc drivers/rtc/rtc-at91rm9200.c: use a variable for storing IMR 2013-03-22 16:41:20 -07:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-03-19 13:20:51 -07:00
sbus
scsi
sfi
sh
sn
spi
ssb
staging Merge branch 'usb-linus' into usb-next 2013-03-20 16:21:47 -07:00
target target/pscsi: Reject cross page boundary case in pscsi_map_sg 2013-03-19 17:31:14 -07:00
tc
thermal
tty Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc 2013-03-19 14:47:11 -07:00
uio
usb USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND 2013-03-25 13:32:20 -07:00
uwb
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2013-03-23 16:51:55 -07:00
video drivers/video/ep93xx-fb.c: include <linux/io.h> for devm_ioremap() 2013-03-22 16:41:20 -07:00
virt
virtio
vlynq
vme
w1
watchdog watchdog: sp5100_tco: Set the AcpiMmioSel bitmask value to 1 instead of 2 2013-03-22 23:21:55 +01:00
xen
zorro
Kconfig
Makefile