net: ipa: program metadata mask differently
authorAlex Elder <elder@linaro.org>
Thu, 11 Jun 2020 19:48:30 +0000 (14:48 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Jun 2020 01:39:07 +0000 (18:39 -0700)
commit8730f45d1ca5ff60033f5ba022f32e5379d7bb89
treede5e46596c946063d6719ba0a48c17f79f012408
parentc25cba3689c7ab5ae6ee7228d1d49a5652429229
net: ipa: program metadata mask differently

The way the mask value is programmed for QMAP RX endpoints was based
on some wrong assumptions about the way metadata containing the QMAP
mux_id value is formatted.  The metadata value supplied by the
modem is *not* in QMAP format, and in fact contains the mux_id we
want in its (big endian) low-order byte.  That byte must be written
by the IPA into offset 1 of the QMAP header it inserts before the
received packet.

QMAP TX endpoints *do* use a QMAP header as the metadata sent with
each packet.  The modem assumes this, and based on that assumes the
mux_id is in the second byte.  To match those assumptions we must
program the modem TX (QMAP) endpoint HDR register to indicate the
metadata will be found at offset 0 in the message header.

The previous configuration managed to work, but it was not working
correctly.  This patch fixes a bug whose symptom was receipt of
messages containing the wrong QMAP mux_id.

In fixing this, get rid of ipa_rmnet_mux_id_metadata_mask(), which
was more or less defined so there was a separate place to explain
what was happening as we generated the mask value.  Instead, put a
longer description of how this works above ipa_endpoint_init_hdr(),
and define the metadata mask to use as a simple constant.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_endpoint.c