From patchwork Thu Oct 27 12:26:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp201303wru; Thu, 27 Oct 2022 05:30:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tc4r205vimcixfkmvsS4k9veM8A+gxXASeerulqTJOl3yepQl6nde3A3x7Yf0c7fBO5YE X-Received: by 2002:a05:6402:2687:b0:45d:3a94:348f with SMTP id w7-20020a056402268700b0045d3a94348fmr45335618edd.48.1666873848216; Thu, 27 Oct 2022 05:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873848; cv=none; d=google.com; s=arc-20160816; b=vsoVlpqu+VS48eMrX5KzvwAPrgTXZ8GMSxdjerfwm5cFmlmX3+pUK2Gw59yMcQ7dGj 1cLDSFzYMlrAzyeOJaER8+WEGDo8ty1aZvCnfJU9/vaG7ExTEEgxTe5KrH+Yj2GJf9s/ 06gqjD6IMZqZDUEdd21+bqMd1Y/zVbrHyWUK400e5NAokomW89+lVgAIZz6nimZskaPI jB0IZ9ueFfwXh64ZHNgEcgPB77E6U1jpTXHuNvKPJeG8vSqKQ0DoMUW+DtaK+3xSE5i6 emegDjzhdVB+PaiHwiPOXLIaJ8iF+zhBlr6qGcK0WPqCsv3WoiZXEwNvs1oPpXz7tvDJ Uv5w== 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=s//CwYJkDKmQmM0SN+cOE1kh8GQDyqEkHeEiZBjgvdk=; b=TF+ZLcHjRx8PqqR1uzCxsSbkTJq6UMfwYNGy18gKWjPiKLB3ExH9mE9ZACz7u5NcDB YJq7LnBhcULDhe3TQhGtOi/ob6gghVHLPqqbvRgwXZT/SBUHe/7f9rJVLNAraYoxdxP7 pTv5umpFD4bYGICBCpLEjQ0w6jEetOjfA33G1k89jvtUYKCvMA6SEnys8dVCZKuO5R2+ ItiZ+0C8s9WB/NZO/PQM6X/WoL6rb6AbCqdpCPVdzaiUmEVNdpoz3W0QGF/Jw7/HR4cB HKGu6blMw/gaDtJhiO1ADDez28dRDYdXM38gJp5Qdd2Pn1gRzu1ddVCSUJCT/TD7IN6c 0GgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHDHrj6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 24-20020a508758000000b00461a32e0e38si1062467edv.306.2022.10.27.05.30.22; Thu, 27 Oct 2022 05:30:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eHDHrj6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235660AbiJ0M1Q (ORCPT + 99 others); Thu, 27 Oct 2022 08:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235616AbiJ0M0u (ORCPT ); Thu, 27 Oct 2022 08:26:50 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10960148FE4 for ; Thu, 27 Oct 2022 05:26:47 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id r73so988047iod.10 for ; Thu, 27 Oct 2022 05:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s//CwYJkDKmQmM0SN+cOE1kh8GQDyqEkHeEiZBjgvdk=; b=eHDHrj6rkYZwRXHJl18s80X76ciclOcO7haBrN4mR7H7ksv9knqE44zAEEDoWwvb3J Yiy0SYRuE/xQY7sMwFGvrfKegl6t9wX7NaT8ZuwRRHVJxae75Lazwdn61uKXOQRa/jgm CdoWjIHJw4EZMnIwtu9e47+VFZyrNXmK9LtECrFIWtDan6D7v5X4/2MoMygc4e9pcMh1 66FfStTzqJlx6u1Cs1a29z+X4N9sN0n4E6vzIj1+sVKnUYZUyPxNTQKKHa0jJcZfv/vb x0g/GqMNsShZGx640igZMY5hvVAEBblAuD9c98ZnlcrczUiqDwmodGXUdsMmXRrH1mfm +URA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s//CwYJkDKmQmM0SN+cOE1kh8GQDyqEkHeEiZBjgvdk=; b=PTDMpvsW8dLVsamA1uU85UhTiy5Y0r1zM3+HQTMQcEEdmAK9/PIAs7wGgMliIHHZy1 llEm4sNDxxmvPxTheIKCkSpzZ0hQNamTddpy2lBYWzGDLQn13N0hgT7SGqIOhGwh7928 A77QAfxAdnjBU3PnsALoWWVqEdLayWTymijz3mjxivtgQo+5Yk9FTPeWAodRr/6UjdxW jJH7TyqpKrWLN8yBeWFcEru90yGvrqPfAp7+xC+RSH4lQfjMbYKSzjrvM/SAZJ5BYunM qeHPeAn8IQRVmw9dtKeaHaMgDu69s/oRBWyXpn9Iaqd+W7ZrvpEwan/p3LbmS6uIjo1d Byfg== X-Gm-Message-State: ACrzQf2nMgSCkYXRFJ3l3OQ+qD0+BxySdftXnElUQGGuEWVAy1c7PFWb lwpARf/V7H/RMsStmFaAv/a2Rg== X-Received: by 2002:a05:6638:300e:b0:35a:ab7a:4509 with SMTP id r14-20020a056638300e00b0035aab7a4509mr32112847jak.82.1666873607157; Thu, 27 Oct 2022 05:26:47 -0700 (PDT) Received: from localhost.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id w24-20020a05663800d800b003566ff0eb13sm526528jao.34.2022.10.27.05.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:46 -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, andersson@kernel.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 7/7] net: ipa: record and use the number of defined endpoint IDs Date: Thu, 27 Oct 2022 07:26:32 -0500 Message-Id: <20221027122632.488694-8-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027122632.488694-1-elder@linaro.org> References: <20221027122632.488694-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747843911910456114?= X-GMAIL-MSGID: =?utf-8?q?1747843911910456114?= Define a new field in the IPA structure that records the maximum number of entries that will be used in the IPA endpoint array. Use that value rather than IPA_ENDPOINT_MAX to determine the end condition for two loops that iterate over all endpoints. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa.h | 2 ++ drivers/net/ipa/ipa_endpoint.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index e975f63271c96..a44595575d066 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -61,6 +61,7 @@ struct ipa_interrupt; * @zero_addr: DMA address of preallocated zero-filled memory * @zero_virt: Virtual address of preallocated zero-filled memory * @zero_size: Size (bytes) of preallocated zero-filled memory + * @endpoint_count: Number of endpoints represented by bit masks below * @defined: Bit mask indicating endpoints defined in config data * @available: Bit mask indicating endpoints hardware supports * @filter_map: Bit mask indicating endpoints that support filtering @@ -117,6 +118,7 @@ struct ipa { size_t zero_size; /* Bit masks indicating endpoint state */ + u32 endpoint_count; u32 defined; /* Defined in configuration data */ u32 available; /* Supported by hardware */ u32 filter_map; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 9fd72ba149afa..2a6184ea8f5ca 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -433,7 +433,7 @@ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable) { u32 endpoint_id = 0; - while (endpoint_id < IPA_ENDPOINT_MAX) { + while (endpoint_id < ipa->endpoint_count) { struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id++]; if (endpoint->ee_id != GSI_EE_MODEM) @@ -1015,7 +1015,7 @@ void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa) { u32 endpoint_id = 0; - while (endpoint_id < IPA_ENDPOINT_MAX) { + while (endpoint_id < ipa->endpoint_count) { struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id++]; if (endpoint->toward_ipa || endpoint->ee_id != GSI_EE_MODEM) @@ -1982,7 +1982,9 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count, BUILD_BUG_ON(!IPA_REPLENISH_BATCH); - if (!ipa_endpoint_max(ipa, count, data)) + /* Number of endpoints is one more than the maximum ID */ + ipa->endpoint_count = ipa_endpoint_max(ipa, count, data) + 1; + if (!ipa->endpoint_count) return 0; /* Error */ ipa->defined = 0;