Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2147534iof; Tue, 7 Jun 2022 21:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAlbDLY/C+gEpCT2eNG/9BfsqtE8fL2QtGRt2/HJr6we/fSkuox+WTOQ9IxIoa3vkLLYkY X-Received: by 2002:a65:6887:0:b0:3fc:a5ef:3701 with SMTP id e7-20020a656887000000b003fca5ef3701mr28275257pgt.10.1654662002791; Tue, 07 Jun 2022 21:20:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662002; cv=none; d=google.com; s=arc-20160816; b=HOCt8xE8IQFfMZI8vaADMpg2cP+799kFdSMqojODplvf7NKc2Zlrvj8LV3nsXKiSbU Z6eBok/HdniwIrMw7CxJ8YiXTz8gTjyPu/R1lP5jKOKb5tHi2PJT15nAeWszxklC176G xOy7669lhS6M8x8i3yb6GNsiyRmH3aM3wH0ezqRpckd+6pogDjYo3EiuUO2ELoiuv73G JUIeiw9Dzek0eaJHbW/iYjlgY+J6Z3Y/AF71syH64N/jhhPXbe4tY1Bb6cJN3ZimpnCQ gEIxW2xnVjRABrPGfASG/r9fLJp5HkXuUTs7YNqHdSDJvgAYO1v0ypCreSBPFnbQdURh fEbg== 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=wN/uPsfA4WWrXiqwnIuFA+uniktbDx/9vsCmUVHHhss=; b=ePrrdYS5oZSFKhzU/ZqNrr12OPD03rEi5SWR3y1+iSwUTNee8oCIqCmey4FsM978tr 6ydV+ZoS1PqtilUwBRqZ7M3cZGcj9wf0TIT87yLNlNKT5NYI/H75yEaqcWmw1lj5FAOA nTGywE0cp66dfbx+1kgpwritLXnmpZzo7lKUFtepIDzfQ8ffYTJqJn6F1ABOdcnBDopI x8iovqlLsJzDYGz/CGxhWFKZMK2+tlF/dWpRnocy08FmMzWdekjznP1QYaJ4TZ36lJq8 aN4TClCRc+2hxcmGFLwlmO5P8ZeOVfKmOmGwFFD5dl1ISfnpdjuGqMdJ9wBb3RYjzyoU aRAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GzEWSo8t; 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 b11-20020a63d30b000000b003fa8a914658si27777111pgg.405.2022.06.07.21.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:20:02 -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=GzEWSo8t; 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 5ED433B092D; Tue, 7 Jun 2022 20:51:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377061AbiFGUt4 (ORCPT + 99 others); Tue, 7 Jun 2022 16:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357514AbiFGTu2 (ORCPT ); Tue, 7 Jun 2022 15:50:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35AFA7E1E5; Tue, 7 Jun 2022 11:19:33 -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 CD0E360A21; Tue, 7 Jun 2022 18:19:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE772C385A5; Tue, 7 Jun 2022 18:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654625972; bh=1FGITE9cSQ7P/XRgO9DxDaKqCo/fkaKYnIe8TByOLMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GzEWSo8tqmzDXLAym5m9K5cxvPN1TW5IKSF7U+O3imdY92n094kCIsatTFbCLIfzA f9EauPLMWYojKALeMq+jGKv3VyvjldM+SPPckbO4911JTX7TXl8ohrac54t3StAA2i 3bbZjdMR8MS/V/WHxuimAgL8sPeRssdviFRKBCwY= 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.17 170/772] net: ipa: ignore endianness if there is no header Date: Tue, 7 Jun 2022 18:56:02 +0200 Message-Id: <20220607164954.049841462@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@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 dde55ccae9d7..b421bb1cc23d 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -571,19 +571,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 */ @@ -741,8 +745,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