header_size += sizeof(struct rmnet_map_ul_csum_header);
val |= u32_encode_bits(header_size, HDR_LEN_FMASK);
- /* Define how to fill mux_id in a received QMAP header */
+ /* Define how to fill fields in a received QMAP header */
if (!endpoint->toward_ipa) {
u32 off; /* Field offset within header */
u32 val = 0;
val |= HDR_ENDIANNESS_FMASK; /* big endian */
- val |= HDR_TOTAL_LEN_OR_PAD_VALID_FMASK;
- /* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */
+
+ /* A QMAP header contains a 6 bit pad field at offset 0. The RMNet
+ * driver assumes this field is meaningful in packets it receives,
+ * and assumes the header's payload length includes that padding.
+ * The RMNet driver does *not* pad packets it sends, however, so
+ * the pad field (although 0) should be ignored.
+ */
+ if (endpoint->data->qmap && !endpoint->toward_ipa) {
+ val |= HDR_TOTAL_LEN_OR_PAD_VALID_FMASK;
+ /* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */
+ val |= HDR_PAYLOAD_LEN_INC_PADDING_FMASK;
+ /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */
+ }
+
/* HDR_PAYLOAD_LEN_INC_PADDING is 0 */
- /* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */
if (!endpoint->toward_ipa)
val |= u32_encode_bits(pad_align, HDR_PAD_TO_ALIGNMENT_FMASK);