| 1 |
.. SPDX-License-Identifier: GPL-2.0 |
| 2 |
|
| 3 |
============ |
| 4 |
Rmnet Driver |
| 5 |
============ |
| 6 |
|
| 7 |
1. Introduction |
| 8 |
=============== |
| 9 |
|
| 10 |
rmnet driver is used for supporting the Multiplexing and aggregation |
| 11 |
Protocol (MAP). This protocol is used by all recent chipsets using Qualcomm |
| 12 |
Technologies, Inc. modems. |
| 13 |
|
| 14 |
This driver can be used to register onto any physical network device in |
| 15 |
IP mode. Physical transports include USB, HSIC, PCIe and IP accelerator. |
| 16 |
|
| 17 |
Multiplexing allows for creation of logical netdevices (rmnet devices) to |
| 18 |
handle multiple private data networks (PDN) like a default internet, tethering, |
| 19 |
multimedia messaging service (MMS) or IP media subsystem (IMS). Hardware sends |
| 20 |
packets with MAP headers to rmnet. Based on the multiplexer id, rmnet |
| 21 |
routes to the appropriate PDN after removing the MAP header. |
| 22 |
|
| 23 |
Aggregation is required to achieve high data rates. This involves hardware |
| 24 |
sending aggregated bunch of MAP frames. rmnet driver will de-aggregate |
| 25 |
these MAP frames and send them to appropriate PDN's. |
| 26 |
|
| 27 |
2. Packet format |
| 28 |
================ |
| 29 |
|
| 30 |
a. MAP packet v1 (data / control) |
| 31 |
--------------------------------- |
| 32 |
|
| 33 |
MAP header fields are in big endian format. |
| 34 |
|
| 35 |
Packet format:: |
| 36 |
|
| 37 |
Bit 0 1 2-7 8-15 16-31 |
| 38 |
Function Command / Data Reserved Pad Multiplexer ID Payload length |
| 39 |
|
| 40 |
Bit 32-x |
| 41 |
Function Raw bytes |
| 42 |
|
| 43 |
Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command |
| 44 |
or data packet. Command packet is used for transport level flow control. Data |
| 45 |
packets are standard IP packets. |
| 46 |
|
| 47 |
Reserved bits must be zero when sent and ignored when received. |
| 48 |
|
| 49 |
Padding is the number of bytes to be appended to the payload to |
| 50 |
ensure 4 byte alignment. |
| 51 |
|
| 52 |
Multiplexer ID is to indicate the PDN on which data has to be sent. |
| 53 |
|
| 54 |
Payload length includes the padding length but does not include MAP header |
| 55 |
length. |
| 56 |
|
| 57 |
b. Map packet v4 (data / control) |
| 58 |
--------------------------------- |
| 59 |
|
| 60 |
MAP header fields are in big endian format. |
| 61 |
|
| 62 |
Packet format:: |
| 63 |
|
| 64 |
Bit 0 1 2-7 8-15 16-31 |
| 65 |
Function Command / Data Reserved Pad Multiplexer ID Payload length |
| 66 |
|
| 67 |
Bit 32-(x-33) (x-32)-x |
| 68 |
Function Raw bytes Checksum offload header |
| 69 |
|
| 70 |
Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command |
| 71 |
or data packet. Command packet is used for transport level flow control. Data |
| 72 |
packets are standard IP packets. |
| 73 |
|
| 74 |
Reserved bits must be zero when sent and ignored when received. |
| 75 |
|
| 76 |
Padding is the number of bytes to be appended to the payload to |
| 77 |
ensure 4 byte alignment. |
| 78 |
|
| 79 |
Multiplexer ID is to indicate the PDN on which data has to be sent. |
| 80 |
|
| 81 |
Payload length includes the padding length but does not include MAP header |
| 82 |
length. |
| 83 |
|
| 84 |
Checksum offload header, has the information about the checksum processing done |
| 85 |
by the hardware.Checksum offload header fields are in big endian format. |
| 86 |
|
| 87 |
Packet format:: |
| 88 |
|
| 89 |
Bit 0-14 15 16-31 |
| 90 |
Function Reserved Valid Checksum start offset |
| 91 |
|
| 92 |
Bit 31-47 48-64 |
| 93 |
Function Checksum length Checksum value |
| 94 |
|
| 95 |
Reserved bits must be zero when sent and ignored when received. |
| 96 |
|
| 97 |
Valid bit indicates whether the partial checksum is calculated and is valid. |
| 98 |
Set to 1, if its is valid. Set to 0 otherwise. |
| 99 |
|
| 100 |
Padding is the number of bytes to be appended to the payload to |
| 101 |
ensure 4 byte alignment. |
| 102 |
|
| 103 |
Checksum start offset, Indicates the offset in bytes from the beginning of the |
| 104 |
IP header, from which modem computed checksum. |
| 105 |
|
| 106 |
Checksum length is the Length in bytes starting from CKSUM_START_OFFSET, |
| 107 |
over which checksum is computed. |
| 108 |
|
| 109 |
Checksum value, indicates the checksum computed. |
| 110 |
|
| 111 |
c. MAP packet v5 (data / control) |
| 112 |
--------------------------------- |
| 113 |
|
| 114 |
MAP header fields are in big endian format. |
| 115 |
|
| 116 |
Packet format:: |
| 117 |
|
| 118 |
Bit 0 1 2-7 8-15 16-31 |
| 119 |
Function Command / Data Next header Pad Multiplexer ID Payload length |
| 120 |
|
| 121 |
Bit 32-x |
| 122 |
Function Raw bytes |
| 123 |
|
| 124 |
Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command |
| 125 |
or data packet. Command packet is used for transport level flow control. Data |
| 126 |
packets are standard IP packets. |
| 127 |
|
| 128 |
Next header is used to indicate the presence of another header, currently is |
| 129 |
limited to checksum header. |
| 130 |
|
| 131 |
Padding is the number of bytes to be appended to the payload to |
| 132 |
ensure 4 byte alignment. |
| 133 |
|
| 134 |
Multiplexer ID is to indicate the PDN on which data has to be sent. |
| 135 |
|
| 136 |
Payload length includes the padding length but does not include MAP header |
| 137 |
length. |
| 138 |
|
| 139 |
d. Checksum offload header v5 |
| 140 |
----------------------------- |
| 141 |
|
| 142 |
Checksum offload header fields are in big endian format. |
| 143 |
|
| 144 |
Packet format:: |
| 145 |
|
| 146 |
Bit 0 - 6 7 8-15 16-31 |
| 147 |
Function Header Type Next Header Checksum Valid Reserved |
| 148 |
|
| 149 |
Header Type is to indicate the type of header, this usually is set to CHECKSUM |
| 150 |
|
| 151 |
Header types |
| 152 |
|
| 153 |
= =============== |
| 154 |
0 Reserved |
| 155 |
1 Reserved |
| 156 |
2 checksum header |
| 157 |
= =============== |
| 158 |
|
| 159 |
Checksum Valid is to indicate whether the header checksum is valid. Value of 1 |
| 160 |
implies that checksum is calculated on this packet and is valid, value of 0 |
| 161 |
indicates that the calculated packet checksum is invalid. |
| 162 |
|
| 163 |
Reserved bits must be zero when sent and ignored when received. |
| 164 |
|
| 165 |
e. MAP packet v1/v5 (command specific) |
| 166 |
-------------------------------------- |
| 167 |
|
| 168 |
Packet format:: |
| 169 |
|
| 170 |
Bit 0 1 2-7 8 - 15 16 - 31 |
| 171 |
Function Command Reserved Pad Multiplexer ID Payload length |
| 172 |
Bit 32 - 39 40 - 45 46 - 47 48 - 63 |
| 173 |
Function Command name Reserved Command Type Reserved |
| 174 |
Bit 64 - 95 |
| 175 |
Function Transaction ID |
| 176 |
Bit 96 - 127 |
| 177 |
Function Command data |
| 178 |
|
| 179 |
Command 1 indicates disabling flow while 2 is enabling flow |
| 180 |
|
| 181 |
Command types |
| 182 |
|
| 183 |
= ========================================== |
| 184 |
0 for MAP command request |
| 185 |
1 is to acknowledge the receipt of a command |
| 186 |
2 is for unsupported commands |
| 187 |
3 is for error during processing of commands |
| 188 |
= ========================================== |
| 189 |
|
| 190 |
f. Aggregation |
| 191 |
-------------- |
| 192 |
|
| 193 |
Aggregation is multiple MAP packets (can be data or command) delivered to |
| 194 |
rmnet in a single linear skb. rmnet will process the individual |
| 195 |
packets and either ACK the MAP command or deliver the IP packet to the |
| 196 |
network stack as needed |
| 197 |
|
| 198 |
Packet format:: |
| 199 |
|
| 200 |
MAP header|IP Packet|Optional padding|MAP header|IP Packet|Optional padding.... |
| 201 |
|
| 202 |
MAP header|IP Packet|Optional padding|MAP header|Command Packet|Optional pad... |
| 203 |
|
| 204 |
3. Userspace configuration |
| 205 |
========================== |
| 206 |
|
| 207 |
rmnet userspace configuration is done through netlink using iproute2 |
| 208 |
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/ |
| 209 |
|
| 210 |
The driver uses rtnl_link_ops for communication. |