lkml.org 
[lkml]   [2022]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 195/879] net: ipa: ignore endianness if there is no header
    Date
    From: Alex Elder <elder@linaro.org>

    [ Upstream commit 332ef7c814bdd60f08d0d9013d0e1104798b2d23 ]

    If we program an RX endpoint to have no header (header length is 0),
    header-related endpoint configuration values are meaningless and are
    ignored.

    The only case we support that defines a header is QMAP endpoints.
    In ipa_endpoint_init_hdr_ext() we set the endianness mask value
    unconditionally, but it should not be done if there is no header
    (meaning it is not configured for QMAP).

    Set the endianness conditionally, and rearrange the logic in that
    function slightly to avoid testing the qmap flag twice.

    Delete an incorrect comment in ipa_endpoint_init_aggr().

    Signed-off-by: Alex Elder <elder@linaro.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/net/ipa/ipa_endpoint.c | 32 +++++++++++++++++---------------
    1 file changed, 17 insertions(+), 15 deletions(-)

    diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
    index 53764f3c0c7e..55322800ba58 100644
    --- a/drivers/net/ipa/ipa_endpoint.c
    +++ b/drivers/net/ipa/ipa_endpoint.c
    @@ -587,19 +587,23 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint)
    struct ipa *ipa = endpoint->ipa;
    u32 val = 0;

    - val |= HDR_ENDIANNESS_FMASK; /* big endian */
    -
    - /* 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 */
    + if (endpoint->data->qmap) {
    + /* We have a header, so we must specify its endianness */
    + val |= HDR_ENDIANNESS_FMASK; /* big endian */
    +
    + /* 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->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 */
    @@ -759,8 +763,6 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint)

    close_eof = rx_data->aggr_close_eof;
    val |= aggr_sw_eof_active_encoded(version, close_eof);
    -
    - /* AGGR_HARD_BYTE_LIMIT_ENABLE is 0 */
    } else {
    val |= u32_encode_bits(IPA_ENABLE_DEAGGR,
    AGGR_EN_FMASK);
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-06-08 00:22    [W:2.602 / U:0.980 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site