Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1677147ioo; Mon, 23 May 2022 00:01:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEEVbF9rfdZxalWzw8pJLaoE/ROuig/NsKSr9xdVpv9nCb9d9tPjyqCLdToJPQu3D7LcFb X-Received: by 2002:a17:903:186:b0:161:f394:3e75 with SMTP id z6-20020a170903018600b00161f3943e75mr14889736plg.113.1653289282041; Mon, 23 May 2022 00:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653289282; cv=none; d=google.com; s=arc-20160816; b=DDSOUHmMqff/lQYL2czyPURrgFUCjwlEVxqep6+0TJ68l2dFVPtsr1ZHgHOI6ajNEx OuDmAGi0O/Bylqh1E7fSGuUJKYpg873OwiqUczZv26eqxs0Rs3uTmeNsSCkZ4pBfUMCY 5/EHooZsDEV6gro3DuYIbsDvUn4g0KctFuMedP1xcytxT/Cc/ocQ/1bHcDfK8+Y2/wiw X5oC2DwGKv2okR4rt36JMPB8lndws9cdmLhIInvuy5p2vZfBX5x7WRnwppCExhXBPe65 oZdug+g3vC4NnjgH1nV5IcW5y7wu9uGEhLYNBCIsgzPBlBhYPo90gEF2zwSJn4bUuCi4 bTNQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w1h7lzBoTRhyrnPIVZrDCLdy25xtg4IsChqOgLd2WKk=; b=BS2KGUfvvVWk9itCeuXUr+z9Tkmtfjnenl9ZZ4mxWhOvXYgrPWRarDk23TilyarEnL el1jlzP3XqZGHMGbODEjRDHJIxL2vr9z6Cv7Lbg+uNYe3HKHRGwHTPlKX1E+VlsJl171 4Pz3jtC131vh8rEuqZwNyaKnwq8QD1rnEhEXjr0tHBcxFnduc4zTFMNlNdezqReZ+Ld/ qSQNTxFZ+DH/JZB0+xYbg8lNLg2e2Jb68bnI4i6zXYxJMxJAn4rzzA3xkGphLBYXA1kK yC0yoN+Igtykgd7tYpQAScPIzu8iHfBrSEDmSJgV56UC/saZ2V/EBbEBs7pmRlEWmOnG c0aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PTPwtLov; 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=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h67-20020a62de46000000b0050dcf85b9e1si11772412pfg.141.2022.05.23.00.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:01:22 -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=@linaro.org header.s=google header.b=PTPwtLov; 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=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85C276472C; Sun, 22 May 2022 23:25:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348353AbiEVAc7 (ORCPT + 99 others); Sat, 21 May 2022 20:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347932AbiEVAcd (ORCPT ); Sat, 21 May 2022 20:32:33 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E96140930 for ; Sat, 21 May 2022 17:32:32 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id e3so12117968ios.6 for ; Sat, 21 May 2022 17:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w1h7lzBoTRhyrnPIVZrDCLdy25xtg4IsChqOgLd2WKk=; b=PTPwtLovhOsE11ooX/9DB0FEdX+sJIpSa7FNxpe2MzRMAc29BQRY/87J/gghpZlaHR Gu4/vFxwFtAZrsqoRHSxenYN2XSRM8laXMahnoLARsVn0clT3nRmTn2eF2bEb3quQ34e MezpcjuRVABCCgWSSgqfyw9rIZ+GpUqG6uLOKW39fGLpUNXLWCm2xEuqqQkMGh033lWF HReLueNOm/jQhwOGW/qAqCUtc0Q/BTa9lnG12eItT/q+C2UkVU0Tyz8jqsgfM00ncXF2 ic8PiPUA4L2u0fqcrEv+jgQv6r2Gr8NXjfp3JRV0gmSbc6lYo8U131FvDkTXCWCPXO+t 8D8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w1h7lzBoTRhyrnPIVZrDCLdy25xtg4IsChqOgLd2WKk=; b=LXm3qDJA1wO22EVxYP+Gythw6DYK8qIr0XexSran2kv/dhsO73pSndEfMGiKpEy0y4 B6RWEwynMHxs7cRSyAdA1+wkwlYYcfYFRl+ee8oN8l/4QpBNJ97RhV0HI7b6/1PQTb8p skrsNuoWzn2lNVarNscuJ5mmu8Ux+IGZgX68TUgJ6JwrKHsc3wqz0JpF9ZgHfSBwrLBE /bN8l+eukpT3ud37VpnzU6wZ83vsRyvGN+546LQ7yI22PgpO5TeSLIWQ+ltp9Ptz7pED 7Myk5aB5It6rdXGmQTXpHFeaqwUWEsWHdQdIXuGR8+KE4rvq7p5AtOckjhkBzODVSN/O IcaQ== X-Gm-Message-State: AOAM533y2J+0w1unz8Lp/qMRkiQG5fiuBC0GVokymBNo3E6acJhwNytY 9TJZyrSSSdLMY+AdfpV/vORCdw== X-Received: by 2002:a6b:3e41:0:b0:65a:4456:90b8 with SMTP id l62-20020a6b3e41000000b0065a445690b8mr7491000ioa.57.1653179551901; Sat, 21 May 2022 17:32:31 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id g8-20020a02c548000000b0032b5e78bfcbsm1757115jaj.135.2022.05.21.17.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 17:32:31 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: mka@chromium.org, evgreen@chromium.org, bjorn.andersson@linaro.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 5/9] net: ipa: count the number of modem TX endpoints Date: Sat, 21 May 2022 19:32:19 -0500 Message-Id: <20220522003223.1123705-6-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220522003223.1123705-1-elder@linaro.org> References: <20220522003223.1123705-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,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=no 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 In ipa_endpoint_modem_exception_reset_all(), a high estimate was made of the number of endpoints that need their status register updated. We only used what was needed, so the high estimate didn't matter much. However the next few patches are going to limit the number of commands in a single transaction, and the overestimate would exceed that. So count the number of modem TX endpoints at initialization time, and use it in ipa_endpoint_modem_exception_reset_all(). Signed-off-by: Alex Elder --- v2: This is a new patch added to the series. drivers/net/ipa/ipa.h | 2 ++ drivers/net/ipa/ipa_endpoint.c | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index 9fc880eb7e3a6..4fc3c72359f5e 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -62,6 +62,7 @@ struct ipa_interrupt; * @initialized: Bit mask indicating endpoints initialized * @set_up: Bit mask indicating endpoints set up * @enabled: Bit mask indicating endpoints enabled + * @modem_tx_count: Number of defined modem TX endoints * @endpoint: Array of endpoint information * @channel_map: Mapping of GSI channel to IPA endpoint * @name_map: Mapping of IPA endpoint name to IPA endpoint @@ -114,6 +115,7 @@ struct ipa { u32 set_up; u32 enabled; + u32 modem_tx_count; struct ipa_endpoint endpoint[IPA_ENDPOINT_MAX]; struct ipa_endpoint *channel_map[GSI_CHANNEL_COUNT_MAX]; struct ipa_endpoint *name_map[IPA_ENDPOINT_COUNT]; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 5ed5b8fd3ea36..385aa63ab4bbc 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -442,12 +442,10 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) struct gsi_trans *trans; u32 count; - /* We need one command per modem TX endpoint. We can get an upper - * bound on that by assuming all initialized endpoints are modem->IPA. - * That won't happen, and we could be more precise, but this is fine - * for now. End the transaction with commands to clear the pipeline. + /* We need one command per modem TX endpoint, plus the commands + * that clear the pipeline. */ - count = hweight32(initialized) + ipa_cmd_pipeline_clear_count(); + count = ipa->modem_tx_count + ipa_cmd_pipeline_clear_count(); trans = ipa_cmd_trans_alloc(ipa, count); if (!trans) { dev_err(&ipa->pdev->dev, @@ -1924,6 +1922,8 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count, if (data->endpoint.filter_support) filter_map |= BIT(data->endpoint_id); + if (data->ee_id == GSI_EE_MODEM && data->toward_ipa) + ipa->modem_tx_count++; } if (!ipa_filter_map_valid(ipa, filter_map)) -- 2.32.0