Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2282735iof; Wed, 8 Jun 2022 01:21:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRTft1Ve8ulkkZ7t5OtzEBLE2mbzG4E1tC3Q8UDFT/Z2pCQKlBHMAZK3KCc+N5T0rkbU5N X-Received: by 2002:a17:90a:ce18:b0:1e7:71de:7721 with SMTP id f24-20020a17090ace1800b001e771de7721mr30535808pju.244.1654676505766; Wed, 08 Jun 2022 01:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654676505; cv=none; d=google.com; s=arc-20160816; b=zpxqcr+MFszVVXxuiEcgG/j/9J3qHy2/jUTKY5e2ijTSgOzEUtnNUVwVyACPc/W2TS 3tbouFZ2UBo9GbvJISl4Ngu6n2d16kg4RCAyga3O+rbHW+92TcEy9ohTozcjFpyFvw4R 78HEBXC31Whkm4Fe5XPTL/xJBdwvXAjXsHxt9llryDMgHf63Rn/e9/97oUV3K46fHzoc 7zgm9F9NWTRgdC0lfmLMoOTL9SEB9zoZMuD84F+JPQVNiqQYsJhoZTzbZTQr0yfTi5e+ W7hFGMTET5fMubRbu6s/TniuT6JNPJ0BNMdiBK3/nvyYgIfVT4zHRBmyC/duq0Z28rIw skng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qKzXGiBno9Zlb3fNyYpRE4VbJlakmOcqh+ygXkdt6mM=; b=dAouFsXV/wqVUjVwdcBYnGbZ9/xYErJijB4b/RU6Od9tmsaRL/yViJHxRjArf4D3uR kB1nU5eTWh+XgaiiMNEKT0muxhkLTlYU11ralm5xR9iY9IBR7k0xU095m3muDAWtiZp0 Dv8fpHg1S1D3NuTIrJ7cx7wQOE0hznlSnIsrmS2F5E4XFp/ivTBfURKWTYAqe04Ncn7n J8Hc78lfmRXZYYQr29heTmIc2sa8JcEoybyiNOZRis69GE6FSdfAuI8KQJsH5RL5Qz3V TF0blU+etfwD1tl+WRHNOmOdPofYxj7qezRqykPa0IstsdUneP699BZbVMAXuXyqqUxF ecSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RibPQx7V; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bd13-20020a656e0d000000b003fbe01f7487si5913679pgb.645.2022.06.08.01.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:21:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RibPQx7V; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 80B491F534A; Wed, 8 Jun 2022 00:51:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351372AbiFGScK (ORCPT + 99 others); Tue, 7 Jun 2022 14:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351729AbiFGSCS (ORCPT ); Tue, 7 Jun 2022 14:02:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA7CA109180; Tue, 7 Jun 2022 10:45:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CEA5616B1; Tue, 7 Jun 2022 17:45:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43662C385A5; Tue, 7 Jun 2022 17:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623912; bh=o9zNJFyYPWthPvxfa3aU9+R/Vxq7Wbw/vekxHbjVKK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RibPQx7Vm4EWSlkos5WiHf9iR6GLQecZNsyAsodwc5UVmM8XpMTkBjcbPj+MpJvCl zsWG135t4mh7j/WxGmOEUoZc72pGhxHYMNtXjL75fENEZlumO7olkHRyRfnxMpADfK xQg4OM1cWQCpmE+mnP9sFA8T2w+yvBbjJ4ZReuKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 138/667] net: ipa: ignore endianness if there is no header Date: Tue, 7 Jun 2022 18:56:43 +0200 Message-Id: <20220607164938.960215937@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164934.766888869@linuxfoundation.org> References: <20220607164934.766888869@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Elder [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 477eb4051bed..703e1630f9c2 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -570,19 +570,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 */ @@ -740,8 +744,6 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint) close_eof = endpoint->data->rx.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