diff options
| -rw-r--r-- | Documentation/networking/cdc_mbim.txt | 339 |
1 files changed, 339 insertions, 0 deletions
diff --git a/Documentation/networking/cdc_mbim.txt b/Documentation/networking/cdc_mbim.txt new file mode 100644 index 000000000000..a15ea602aa52 --- /dev/null +++ b/Documentation/networking/cdc_mbim.txt | |||
| @@ -0,0 +1,339 @@ | |||
| 1 | cdc_mbim - Driver for CDC MBIM Mobile Broadband modems | ||
| 2 | ======================================================== | ||
| 3 | |||
| 4 | The cdc_mbim driver supports USB devices conforming to the "Universal | ||
| 5 | Serial Bus Communications Class Subclass Specification for Mobile | ||
| 6 | Broadband Interface Model" [1], which is a further development of | ||
| 7 | "Universal Serial Bus Communications Class Subclass Specifications for | ||
| 8 | Network Control Model Devices" [2] optimized for Mobile Broadband | ||
| 9 | devices, aka "3G/LTE modems". | ||
| 10 | |||
| 11 | |||
| 12 | Command Line Parameters | ||
| 13 | ======================= | ||
| 14 | |||
| 15 | The cdc_mbim driver has no parameters of its own. But the probing | ||
| 16 | behaviour for NCM 1.0 backwards compatible MBIM functions (an | ||
| 17 | "NCM/MBIM function" as defined in section 3.2 of [1]) is affected | ||
| 18 | by a cdc_ncm driver parameter: | ||
| 19 | |||
| 20 | prefer_mbim | ||
| 21 | ----------- | ||
| 22 | Type: Boolean | ||
| 23 | Valid Range: N/Y (0-1) | ||
| 24 | Default Value: Y (MBIM is preferred) | ||
| 25 | |||
| 26 | This parameter sets the system policy for NCM/MBIM functions. Such | ||
| 27 | functions will be handled by either the cdc_ncm driver or the cdc_mbim | ||
| 28 | driver depending on the prefer_mbim setting. Setting prefer_mbim=N | ||
| 29 | makes the cdc_mbim driver ignore these functions and lets the cdc_ncm | ||
| 30 | driver handle them instead. | ||
| 31 | |||
| 32 | The parameter is writable, and can be changed at any time. A manual | ||
| 33 | unbind/bind is required to make the change effective for NCM/MBIM | ||
| 34 | functions bound to the "wrong" driver | ||
| 35 | |||
| 36 | |||
| 37 | Basic usage | ||
| 38 | =========== | ||
| 39 | |||
| 40 | MBIM functions are inactive when unmanaged. The cdc_mbim driver only | ||
| 41 | provides an userspace interface to the MBIM control channel, and will | ||
| 42 | not participate in the management of the function. This implies that a | ||
| 43 | userspace MBIM management application always is required to enable a | ||
| 44 | MBIM function. | ||
| 45 | |||
| 46 | Such userspace applications includes, but are not limited to: | ||
| 47 | - mbimcli (included with the libmbim [3] library), and | ||
| 48 | - ModemManager [4] | ||
| 49 | |||
| 50 | Establishing a MBIM IP session reequires at least these actions by the | ||
| 51 | management application: | ||
| 52 | - open the control channel | ||
| 53 | - configure network connection settings | ||
| 54 | - connect to network | ||
| 55 | - configure IP interface | ||
| 56 | |||
| 57 | Management application development | ||
| 58 | ---------------------------------- | ||
| 59 | The driver <-> userspace interfaces are described below. The MBIM | ||
| 60 | control channel protocol is described in [1]. | ||
| 61 | |||
| 62 | |||
| 63 | MBIM control channel userspace ABI | ||
| 64 | ================================== | ||
| 65 | |||
| 66 | /dev/cdc-wdmX character device | ||
| 67 | ------------------------------ | ||
| 68 | The driver creates a two-way pipe to the MBIM function control channel | ||
| 69 | using the cdc-wdm driver as a subdriver. The userspace end of the | ||
| 70 | control channel pipe is a /dev/cdc-wdmX character device. | ||
| 71 | |||
| 72 | The cdc_mbim driver does not process or police messages on the control | ||
| 73 | channel. The channel is fully delegated to the userspace management | ||
| 74 | application. It is therefore up to this application to ensure that it | ||
| 75 | complies with all the control channel requirements in [1]. | ||
| 76 | |||
| 77 | The cdc-wdmX device is created as a child of the MBIM control | ||
| 78 | interface USB device. The character device associated with a specific | ||
| 79 | MBIM function can be looked up using sysfs. For example: | ||
| 80 | |||
| 81 | bjorn@nemi:~$ ls /sys/bus/usb/drivers/cdc_mbim/2-4:2.12/usbmisc | ||
| 82 | cdc-wdm0 | ||
| 83 | |||
| 84 | bjorn@nemi:~$ grep . /sys/bus/usb/drivers/cdc_mbim/2-4:2.12/usbmisc/cdc-wdm0/dev | ||
| 85 | 180:0 | ||
| 86 | |||
| 87 | |||
| 88 | USB configuration descriptors | ||
| 89 | ----------------------------- | ||
| 90 | The wMaxControlMessage field of the CDC MBIM functional descriptor | ||
| 91 | limits the maximum control message size. The managament application is | ||
| 92 | responsible for negotiating a control message size complying with the | ||
| 93 | requirements in section 9.3.1 of [1], taking this descriptor field | ||
| 94 | into consideration. | ||
| 95 | |||
| 96 | The userspace application can access the CDC MBIM functional | ||
| 97 | descriptor of a MBIM function using either of the two USB | ||
| 98 | configuration descriptor kernel interfaces described in [6] or [7]. | ||
| 99 | |||
| 100 | See also the ioctl documentation below. | ||
| 101 | |||
| 102 | |||
| 103 | Fragmentation | ||
| 104 | ------------- | ||
| 105 | The userspace application is responsible for all control message | ||
| 106 | fragmentation and defragmentaion, as described in section 9.5 of [1]. | ||
| 107 | |||
| 108 | |||
| 109 | /dev/cdc-wdmX write() | ||
| 110 | --------------------- | ||
| 111 | The MBIM control messages from the management application *must not* | ||
| 112 | exceed the negotiated control message size. | ||
| 113 | |||
| 114 | |||
| 115 | /dev/cdc-wdmX read() | ||
| 116 | -------------------- | ||
| 117 | The management application *must* accept control messages of up the | ||
| 118 | negotiated control message size. | ||
| 119 | |||
| 120 | |||
| 121 | /dev/cdc-wdmX ioctl() | ||
| 122 | -------------------- | ||
| 123 | IOCTL_WDM_MAX_COMMAND: Get Maximum Command Size | ||
| 124 | This ioctl returns the wMaxControlMessage field of the CDC MBIM | ||
| 125 | functional descriptor for MBIM devices. This is intended as a | ||
| 126 | convenience, eliminating the need to parse the USB descriptors from | ||
| 127 | userspace. | ||
| 128 | |||
| 129 | #include <stdio.h> | ||
| 130 | #include <fcntl.h> | ||
| 131 | #include <sys/ioctl.h> | ||
| 132 | #include <linux/types.h> | ||
| 133 | #include <linux/usb/cdc-wdm.h> | ||
| 134 | int main() | ||
| 135 | { | ||
| 136 | __u16 max; | ||
| 137 | int fd = open("/dev/cdc-wdm0", O_RDWR); | ||
| 138 | if (!ioctl(fd, IOCTL_WDM_MAX_COMMAND, &max)) | ||
| 139 | printf("wMaxControlMessage is %d\n", max); | ||
| 140 | } | ||
| 141 | |||
| 142 | |||
| 143 | Custom device services | ||
| 144 | ---------------------- | ||
| 145 | The MBIM specification allows vendors to freely define additional | ||
| 146 | services. This is fully supported by the cdc_mbim driver. | ||
| 147 | |||
| 148 | Support for new MBIM services, including vendor specified services, is | ||
| 149 | implemented entirely in userspace, like the rest of the MBIM control | ||
| 150 | protocol | ||
| 151 | |||
| 152 | New services should be registered in the MBIM Registry [5]. | ||
| 153 | |||
| 154 | |||
| 155 | |||
| 156 | MBIM data channel userspace ABI | ||
| 157 | =============================== | ||
| 158 | |||
| 159 | wwanY network device | ||
| 160 | -------------------- | ||
| 161 | The cdc_mbim driver represents the MBIM data channel as a single | ||
| 162 | network device of the "wwan" type. This network device is initially | ||
| 163 | mapped to MBIM IP session 0. | ||
| 164 | |||
| 165 | |||
| 166 | Multiplexed IP sessions (IPS) | ||
| 167 | ----------------------------- | ||
| 168 | MBIM allows multiplexing up to 256 IP sessions over a single USB data | ||
| 169 | channel. The cdc_mbim driver models such IP sessions as 802.1q VLAN | ||
| 170 | subdevices of the master wwanY device, mapping MBIM IP session Z to | ||
| 171 | VLAN ID Z for all values of Z greater than 0. | ||
| 172 | |||
| 173 | The device maximum Z is given in the MBIM_DEVICE_CAPS_INFO structure | ||
| 174 | described in section 10.5.1 of [1]. | ||
| 175 | |||
| 176 | The userspace management application is responsible for adding new | ||
| 177 | VLAN links prior to establishing MBIM IP sessions where the SessionId | ||
| 178 | is greater than 0. These links can be added by using the normal VLAN | ||
| 179 | kernel interfaces, either ioctl or netlink. | ||
| 180 | |||
| 181 | For example, adding a link for a MBIM IP session with SessionId 3: | ||
| 182 | |||
| 183 | ip link add link wwan0 name wwan0.3 type vlan id 3 | ||
| 184 | |||
| 185 | The driver will automatically map the "wwan0.3" network device to MBIM | ||
| 186 | IP session 3. | ||
| 187 | |||
| 188 | |||
| 189 | Device Service Streams (DSS) | ||
| 190 | ---------------------------- | ||
| 191 | MBIM also allows up to 256 non-IP data streams to be multiplexed over | ||
| 192 | the same shared USB data channel. The cdc_mbim driver models these | ||
| 193 | sessions as another set of 802.1q VLAN subdevices of the master wwanY | ||
| 194 | device, mapping MBIM DSS session A to VLAN ID (256 + A) for all values | ||
| 195 | of A. | ||
