0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 ============
0004 Rmnet Driver
0005 ============
0006
0007 1. Introduction
0008 ===============
0009
0010 rmnet driver is used for supporting the Multiplexing and aggregation
0011 Protocol (MAP). This protocol is used by all recent chipsets using Qualcomm
0012 Technologies, Inc. modems.
0013
0014 This driver can be used to register onto any physical network device in
0015 IP mode. Physical transports include USB, HSIC, PCIe and IP accelerator.
0016
0017 Multiplexing allows for creation of logical netdevices (rmnet devices) to
0018 handle multiple private data networks (PDN) like a default internet, tethering,
0019 multimedia messaging service (MMS) or IP media subsystem (IMS). Hardware sends
0020 packets with MAP headers to rmnet. Based on the multiplexer id, rmnet
0021 routes to the appropriate PDN after removing the MAP header.
0022
0023 Aggregation is required to achieve high data rates. This involves hardware
0024 sending aggregated bunch of MAP frames. rmnet driver will de-aggregate
0025 these MAP frames and send them to appropriate PDN's.
0026
0027 2. Packet format
0028 ================
0029
0030 a. MAP packet v1 (data / control)
0031
0032 MAP header fields are in big endian format.
0033
0034 Packet format::
0035
0036 Bit 0 1 2-7 8-15 16-31
0037 Function Command / Data Reserved Pad Multiplexer ID Payload length
0038
0039 Bit 32-x
0040 Function Raw bytes
0041
0042 Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command
0043 or data packet. Command packet is used for transport level flow control. Data
0044 packets are standard IP packets.
0045
0046 Reserved bits must be zero when sent and ignored when received.
0047
0048 Padding is the number of bytes to be appended to the payload to
0049 ensure 4 byte alignment.
0050
0051 Multiplexer ID is to indicate the PDN on which data has to be sent.
0052
0053 Payload length includes the padding length but does not include MAP header
0054 length.
0055
0056 b. Map packet v4 (data / control)
0057
0058 MAP header fields are in big endian format.
0059
0060 Packet format::
0061
0062 Bit 0 1 2-7 8-15 16-31
0063 Function Command / Data Reserved Pad Multiplexer ID Payload length
0064
0065 Bit 32-(x-33) (x-32)-x
0066 Function Raw bytes Checksum offload header
0067
0068 Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command
0069 or data packet. Command packet is used for transport level flow control. Data
0070 packets are standard IP packets.
0071
0072 Reserved bits must be zero when sent and ignored when received.
0073
0074 Padding is the number of bytes to be appended to the payload to
0075 ensure 4 byte alignment.
0076
0077 Multiplexer ID is to indicate the PDN on which data has to be sent.
0078
0079 Payload length includes the padding length but does not include MAP header
0080 length.
0081
0082 Checksum offload header, has the information about the checksum processing done
0083 by the hardware.Checksum offload header fields are in big endian format.
0084
0085 Packet format::
0086
0087 Bit 0-14 15 16-31
0088 Function Reserved Valid Checksum start offset
0089
0090 Bit 31-47 48-64
0091 Function Checksum length Checksum value
0092
0093 Reserved bits must be zero when sent and ignored when received.
0094
0095 Valid bit indicates whether the partial checksum is calculated and is valid.
0096 Set to 1, if its is valid. Set to 0 otherwise.
0097
0098 Padding is the number of bytes to be appended to the payload to
0099 ensure 4 byte alignment.
0100
0101 Checksum start offset, Indicates the offset in bytes from the beginning of the
0102 IP header, from which modem computed checksum.
0103
0104 Checksum length is the Length in bytes starting from CKSUM_START_OFFSET,
0105 over which checksum is computed.
0106
0107 Checksum value, indicates the checksum computed.
0108
0109 c. MAP packet v5 (data / control)
0110
0111 MAP header fields are in big endian format.
0112
0113 Packet format::
0114
0115 Bit 0 1 2-7 8-15 16-31
0116 Function Command / Data Next header Pad Multiplexer ID Payload length
0117
0118 Bit 32-x
0119 Function Raw bytes
0120
0121 Command (1)/ Data (0) bit value is to indicate if the packet is a MAP command
0122 or data packet. Command packet is used for transport level flow control. Data
0123 packets are standard IP packets.
0124
0125 Next header is used to indicate the presence of another header, currently is
0126 limited to checksum header.
0127
0128 Padding is the number of bytes to be appended to the payload to
0129 ensure 4 byte alignment.
0130
0131 Multiplexer ID is to indicate the PDN on which data has to be sent.
0132
0133 Payload length includes the padding length but does not include MAP header
0134 length.
0135
0136 d. Checksum offload header v5
0137
0138 Checksum offload header fields are in big endian format.
0139
0140 Bit 0 - 6 7 8-15 16-31
0141 Function Header Type Next Header Checksum Valid Reserved
0142
0143 Header Type is to indicate the type of header, this usually is set to CHECKSUM
0144
0145 Header types
0146 = ==========================================
0147 0 Reserved
0148 1 Reserved
0149 2 checksum header
0150
0151 Checksum Valid is to indicate whether the header checksum is valid. Value of 1
0152 implies that checksum is calculated on this packet and is valid, value of 0
0153 indicates that the calculated packet checksum is invalid.
0154
0155 Reserved bits must be zero when sent and ignored when received.
0156
0157 e. MAP packet v1/v5 (command specific)::
0158
0159 Bit 0 1 2-7 8 - 15 16 - 31
0160 Function Command Reserved Pad Multiplexer ID Payload length
0161 Bit 32 - 39 40 - 45 46 - 47 48 - 63
0162 Function Command name Reserved Command Type Reserved
0163 Bit 64 - 95
0164 Function Transaction ID
0165 Bit 96 - 127
0166 Function Command data
0167
0168 Command 1 indicates disabling flow while 2 is enabling flow
0169
0170 Command types
0171
0172 = ==========================================
0173 0 for MAP command request
0174 1 is to acknowledge the receipt of a command
0175 2 is for unsupported commands
0176 3 is for error during processing of commands
0177 = ==========================================
0178
0179 f. Aggregation
0180
0181 Aggregation is multiple MAP packets (can be data or command) delivered to
0182 rmnet in a single linear skb. rmnet will process the individual
0183 packets and either ACK the MAP command or deliver the IP packet to the
0184 network stack as needed
0185
0186 MAP header|IP Packet|Optional padding|MAP header|IP Packet|Optional padding....
0187
0188 MAP header|IP Packet|Optional padding|MAP header|Command Packet|Optional pad...
0189
0190 3. Userspace configuration
0191 ==========================
0192
0193 rmnet userspace configuration is done through netlink library librmnetctl
0194 and command line utility rmnetcli. Utility is hosted in codeaurora forum git.
0195 The driver uses rtnl_link_ops for communication.
0196
0197 https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource/dataservices/tree/rmnetctl