From patchwork Thu Oct 27 12:26:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp199871wru; Thu, 27 Oct 2022 05:27:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hzEXE52PJp5hGv1rjlWKdblfkPWJwYLChuAZe2+5PfyCSm1QXO1uxF3RBm6W2+OyW5ZGZ X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr34786591edq.387.1666873652923; Thu, 27 Oct 2022 05:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873652; cv=none; d=google.com; s=arc-20160816; b=yuLF/69vbMb4S29ptdFT6qA5Nq5dz0UlS0hjam3YV37dHs6+mNtAzVSWOwGRGF2LrT 5qLoKhhxRhM0WTjz0jmHalQRy5TBVNmSxkRGJFjcmNGsQy6yL0Udc8SdX8QHPUZX9NLu y/RQFs9vMKBxN5N1mcm7K1IhY5SVDS6HIvwDKtpllrbJPo+bAQ6JxOY7k1l9G4DBK2ZA 8smV+wBfmreAd71WnT9is4NOBZZnuDPIhzoziYL2h+jU/JDb7xIg5Pd/ZvnCLzk2Isac 5hMF+kCoG6SO9uZYtznhw2Bx/71ixySa9OujLLkLEl7qkzcheLyb0fEaXAu5oeHHuX9p tdAQ== 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=MjjSjVxz43dPoj+rB5pDgaOIlILrA2m91ybZAXvDhDE=; b=vhrP+OBvKKXLB0uozfFTqgd9k7xmZOhvzr91CL9W7WDK5p8py9WqKaXn1q7rXguiy+ tMimf4q2gqTInM+bHPvlit1RsZfCYayB0Bhs+t71xAlkndgWS0fOhJpiTBfoJWqek4e4 MenwmRepg8wTNjtXScLQGAjOGbDM0M+IHrySYKmdPZfzhsT8w8Wrnv31Pc58G9e0e1pn zEceimt6FiaFVKFIiQqnhayJVvafw7VQvNp+9E6amGv3iAbPC8oCwC2nHxnri5nZ3pEP NnpDTNPSkpiSz9TtG5rMbSaYLMWPfJtwly7g/R7exPgl3nCPUuDoGCW/LLFP6sxyBgie tYDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LFbhw/vD"; 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 cw17-20020a170906479100b0078d9f02b452si1351695ejc.861.2022.10.27.05.27.08; Thu, 27 Oct 2022 05:27:32 -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="LFbhw/vD"; 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 S235535AbiJ0M0p (ORCPT + 99 others); Thu, 27 Oct 2022 08:26:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235480AbiJ0M0j (ORCPT ); Thu, 27 Oct 2022 08:26:39 -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 D58DE132EBD for ; Thu, 27 Oct 2022 05:26:38 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id 11so1305212iou.0 for ; Thu, 27 Oct 2022 05:26:38 -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=MjjSjVxz43dPoj+rB5pDgaOIlILrA2m91ybZAXvDhDE=; b=LFbhw/vDugO3V+guejpZp9r55Py7iMGG6jyjnu9kESgzHZbFfP+VFBMim552nitqST Q8p7/ZL3JQTGEFe2PDO7eWH8E69a6ayRvfK2N4xY2CIm6EToqdRKuRV0kQPX1UC9A9XK L2+6sNH0CvZ0+rFiZRuJ4E69Vbbz/17nG8QEkMBlqUpTiACt75Wgnjl4SS6+XAL0S8Yj JI8xZl+RxmcjpHDJk8uIOrrZ0DLKxNAhs4yxWScvT20VSb3SkOoJWBvU9Q+77eo4u1dd tvQ8m+AaFCszslPrcET1X+Lkclnc+l2rhhll3YGJc2dTtjrnWBrqEi9Tg2+f3qXdFMT2 r6DA== 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=MjjSjVxz43dPoj+rB5pDgaOIlILrA2m91ybZAXvDhDE=; b=QJerwaM00wk/fUq18YZp6TLj1dYUhhUAL6RPWTAcniGF3jBw9NFWJLIvaH+3UQwHZb IZPd76mmEDIldeg8wrJV909pS7TBIPrZzYcPpJVjLKETHV9Frax1186GqGjYg6lw6q0/ Ic+p6WMPnc/McvuonmfsjQoxqDNHgpfo9m62V34dg5ITXjvTHEIcwUFwIJ8y8OvHd3SF ckRznMfwiYDLq0/W2pXMlchqfJk9THG9skIf/VC8crTFN4M1CeMxZQA8rdou5l5bJQtI asH5F943RgM66q0jYK2B08iEf7J++y9rjEfuMnPowOH0l2ctYqgsXNZR5A6YT4bhqsSc A7wQ== X-Gm-Message-State: ACrzQf0M9m3XBbs0w7HJ7f8FRG60t/R5dUxJ3kx3afIl2K+anbfdWA1K NSbhp7SWejNQrLPR0FmHL0LZUA== X-Received: by 2002:a5d:9ac1:0:b0:6a3:1938:e6b0 with SMTP id x1-20020a5d9ac1000000b006a31938e6b0mr28385734ion.186.1666873598126; Thu, 27 Oct 2022 05:26:38 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:37 -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 1/7] net: ipa: define IPA v5.0 Date: Thu, 27 Oct 2022 07:26:26 -0500 Message-Id: <20221027122632.488694-2-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?1747843707427320940?= X-GMAIL-MSGID: =?utf-8?q?1747843707427320940?= In preparation for adding support for IPA v5.0, define it as an understood version. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_version.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ipa/ipa_version.h b/drivers/net/ipa/ipa_version.h index 7870e0cc3d7c9..7889c310e943d 100644 --- a/drivers/net/ipa/ipa_version.h +++ b/drivers/net/ipa/ipa_version.h @@ -19,6 +19,7 @@ * @IPA_VERSION_4_7: IPA version 4.7/GSI version 2.7 * @IPA_VERSION_4_9: IPA version 4.9/GSI version 2.9 * @IPA_VERSION_4_11: IPA version 4.11/GSI version 2.11 (2.1.1) + * @IPA_VERSION_5_0: IPA version 5.0/GSI version 3.0 * @IPA_VERSION_COUNT: Number of defined IPA versions * * Defines the version of IPA (and GSI) hardware present on the platform. @@ -36,6 +37,7 @@ enum ipa_version { IPA_VERSION_4_7, IPA_VERSION_4_9, IPA_VERSION_4_11, + IPA_VERSION_5_0, IPA_VERSION_COUNT, /* Last; not a version */ }; @@ -48,6 +50,7 @@ static inline bool ipa_version_supported(enum ipa_version version) case IPA_VERSION_4_5: case IPA_VERSION_4_9: case IPA_VERSION_4_11: + case IPA_VERSION_5_0: return true; default: return false; From patchwork Thu Oct 27 12:26:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp199979wru; Thu, 27 Oct 2022 05:27:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XXnMPAMSVDkLHemHSA4HbbqiWsPtusFE/90lqoTikUD4e2XBgJkIFMAmpsFroJMMLt2ae X-Received: by 2002:a05:6402:518f:b0:461:c252:c3b3 with SMTP id q15-20020a056402518f00b00461c252c3b3mr20003281edd.29.1666873663926; Thu, 27 Oct 2022 05:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873663; cv=none; d=google.com; s=arc-20160816; b=bWWSYWNIdjpPF/zq53FL2npzuMFuQqGMoYXC1SF6rwWMWyQMbgxdF3pO2lMIBf3i43 t3qMqOac4g711FyRj/TJH6ytrAnRpNa61k0y01LQOo9NER7DSywhWHSu7ukGKJeh1hnM f4IB/784yxfqAysqcyIiOlUpu5DqGeS0vHllbaQvJgRJLkSX/os7LfSvpXbVzNWu3jM1 Y75VOVhtXIuCvbG97a3j9m+XTahly/oRT2EvwSYp6wlyUVgusPgRQBVzyth6M59Z0zrn 8iskZzYtcsKm+vQQohd2JrCzek0HNnjF51qhGWlvHS5xDhoQ8ODZBCcvPCfsVAx6AdnQ nQkQ== 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=mZhPH98EZI2dEoFXGWQtmjLxJRjCACN6xFS+27Ga9q8=; b=UMay9aD/kT6o5hhmmRXgZyl30ydfyOzgtKowlmVG35MkeOTPvtez6GAvq9bPzuHKLZ 2UCWs4nI6jcniZu0EheAgNSt/qhQs2+GvVQvNTqOs3ukFiJm4xcwdcJV2sdKKhBf6bQx OODfJf/SC0LoCr6LO/lxqYxubh9JAX5Q6p4vhJm8aw9DShfOiq2BSSuPHFg6ch2/Rjaq 8wq9Cm1tULDp5RdsLy9bUxX5yZp0BerFVUyMyigYpCxg1zCFl/n3Op9FAtycTRnvhXlE DPVOTQ0IDuykhOMw8aaTAyD/fmuMu0p7/5F6gAVfyRVeWIZnUrYtWSRY9RC9cZ7Yny+R v58A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CGOB+dy4; 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 f14-20020a056402004e00b0045d523bee48si1196165edu.178.2022.10.27.05.27.17; Thu, 27 Oct 2022 05:27:43 -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=CGOB+dy4; 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 S235613AbiJ0M0u (ORCPT + 99 others); Thu, 27 Oct 2022 08:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235562AbiJ0M0l (ORCPT ); Thu, 27 Oct 2022 08:26:41 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3802C132240 for ; Thu, 27 Oct 2022 05:26:40 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id y143so460949iof.9 for ; Thu, 27 Oct 2022 05:26:40 -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=mZhPH98EZI2dEoFXGWQtmjLxJRjCACN6xFS+27Ga9q8=; b=CGOB+dy4GUYVpZbN/DWiHffXQGLBKtcmB1o3l8pIV6Su1Tk7/cZYKQBTlO6wnaarmQ 7VxFaYWL5uwsE9aAL2ZwDSgT0VNkNynJspstC4HVS2vS4YWvbNdYKdx3gIuoHuMhusDL GSh6+4QsnoL1WXG8yGkpQ5nU05969EC4nc/mQP+BH5cxcDqHiNJYDLqYY8vgDs9uz5wN uNGMVLymJbJfomK+gHqG4Q0Rr+NB8gWE7k3ZXOg7Pdj6k42BfgnCpf8kbAA4gapcXSUd E1q6/w1VhnDAepMXHViahUPSJdEs/+tVmTv8jnyFpPIYcPMgHjzFKTKFkZeziQ0YwKat DX6g== 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=mZhPH98EZI2dEoFXGWQtmjLxJRjCACN6xFS+27Ga9q8=; b=lIHlvATdeaAkuxCYBnwcYbIImkMsc5ZBNbBlIPdkHdNas03OWWd5ZnaqoMba+5raTL ztt2RqcuxHWQEjGEGZGPpPxkz4zV5uAErpCXyip01JEKUHTJ/rTWcaJ/2Err4YUQgeVj 7Nq7GopfRV9vKyrv64BmbFc1/7m8710oRyp8ZluH3TznF+235caOmvk6MxzxpNMc/SgJ C6Ylc/KEGGCnWzwL8y5UqZi9cltOqdY0h6ZhZyX0G6PxYIhQWIiawfj6WQrDKwN9KnmA Sa0sVm0ANgZcIHLMKW7LtgRnwBDlj03AVcUzswcpBTMBu0K+dhMmgeojsv/NeLnQH3i7 3cXw== X-Gm-Message-State: ACrzQf3OZtpy7DUa15/8g4JtS55Yc7MD0PDE7/lFdMAQfsPzew3fkDSW CX7glRmySjuVkkr00VNPRFJB0Q== X-Received: by 2002:a6b:5f1d:0:b0:6c5:247c:6763 with SMTP id t29-20020a6b5f1d000000b006c5247c6763mr1803360iob.65.1666873599556; Thu, 27 Oct 2022 05:26:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:39 -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 2/7] net: ipa: change an IPA v5.0 memory requirement Date: Thu, 27 Oct 2022 07:26:27 -0500 Message-Id: <20221027122632.488694-3-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?1747843718751217159?= X-GMAIL-MSGID: =?utf-8?q?1747843718751217159?= Don't require IPA v5.0 to have a STATS_TETHERING memory region. Downstream defines its size to 0, so it apparently is unused. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_mem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index cb95402018394..9ec5af323f731 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -198,9 +198,12 @@ static bool ipa_mem_id_required(struct ipa *ipa, enum ipa_mem_id mem_id) case IPA_MEM_PDN_CONFIG: case IPA_MEM_STATS_QUOTA_MODEM: - case IPA_MEM_STATS_TETHERING: return ipa->version >= IPA_VERSION_4_0; + case IPA_MEM_STATS_TETHERING: + return ipa->version >= IPA_VERSION_4_0 && + ipa->version != IPA_VERSION_5_0; + default: return false; /* Anything else is optional */ } From patchwork Thu Oct 27 12:26:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp200366wru; Thu, 27 Oct 2022 05:28:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c1SzIyAdyVDjMNVboFF98K77fZ0Mw11QAtusqraKgg/GHDc8WwR0YXNLwP6MZVZzoH6mG X-Received: by 2002:a17:906:8a48:b0:7a5:a8f5:b870 with SMTP id gx8-20020a1709068a4800b007a5a8f5b870mr20265050ejc.458.1666873723607; Thu, 27 Oct 2022 05:28:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873723; cv=none; d=google.com; s=arc-20160816; b=kyN15IcEiKPFBYjITFESw8Zf7rxcjxH7Cas3A1fo1FEk8LeVtFNv3OvERvWhAwWmkq jNFigIrIgNw0bH53FFEHaxUPG3j8EtwdcPYDHTLUXvKbJIP8/P1ZcdwauoAb/r72IoiA VGLB+PWd80NA3xSRvMGK425PHjp1AdScrNaP6+B/WDEFI+Pt9lWNJLU1QV6oZdwrG5OV DU39wMocgtngNqEOOCeeklWluG0mrKuBGyhoscAhCyNJ5oD/GXWodR5T7W8cP82QzDtS mEd5ugQeDOuBIzLNdOUUr2eGXnaIvoKqzX4Avf5SKbVlFLd6tADPFdWuJnJXYAsTmMhN Qrmg== 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=lniLLq0wWXt/bwGWmVmVl0IrNVPhksr2CD/LLDMRS+A=; b=h3fioN0GKC9hZ606tr3ItmIQQiwfbz8DX35/g11/ftbGzJ2vWzlEUUy6FDrZ+yuyvV Ss/Fcyp25WWjcCMGT2PQ9nmIvQ7jQ3/dwIEDUQvVRbCnb4d3+ad2TvsUYPT24ABibRRJ W7Lam5U+nO48JoCmENZmTo8YE54gQkZtQR+SrKLwCz+QNI3XFfk3XwEaIgmI7FRtaMmR 7EICFb5I6YabfB7B/ze17CNz4uP2j2fwg74gBvDW+iyhgAZHm4EoLVWHK3uGcaXGdlm0 SfgAA+xaeZiQrCCJKhKJ/akePCuAm7mcC3kt+0JcxMT7uf6ZG9/w8IZ81l02W4fqcrlf byVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iT1BRxpi; 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 o21-20020a170906975500b007707b853e46si1325496ejy.882.2022.10.27.05.28.19; Thu, 27 Oct 2022 05:28:43 -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=iT1BRxpi; 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 S235620AbiJ0M0z (ORCPT + 99 others); Thu, 27 Oct 2022 08:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235587AbiJ0M0m (ORCPT ); Thu, 27 Oct 2022 08:26:42 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C11BC13C1CA for ; Thu, 27 Oct 2022 05:26:41 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id q18so836677ils.12 for ; Thu, 27 Oct 2022 05:26:41 -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=lniLLq0wWXt/bwGWmVmVl0IrNVPhksr2CD/LLDMRS+A=; b=iT1BRxpiJ1FEPFYwmqxHLZwKGyvfuqDSSjPdNyeSC8hI3C5hVMsF6/UOjXFUyYS9nq XVwlez9HeD1TD792m2ZwoXP22fBXJbo7scUTO+g5diRZNPog3/CpkeLQBkKYxBpndyW/ DL/zpb9ZpRHOgKgspyfFhQzeyrudcvHvLY0hArRYzIvsiMOb7xTdDzzBce4TsvknUHTo a6cT7gI+rsDazezSiL/tRGHZCyN1OCR11LCZnk81tUWhTl0gJRdAkdsW2z7QrNhgOFck /90Im8QD7CwhSDeNlYksE88k+wsCyXbka0PMvRJ+ciSeRWDnfuCQWZj/smEjLoVvjGRr LRNQ== 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=lniLLq0wWXt/bwGWmVmVl0IrNVPhksr2CD/LLDMRS+A=; b=snZgjCU9lhYMfU3TqB+sJetjF3Gc/GWSbwHGNjKEBt74cWRTGiFymZpsbfw73/PMMA ikKgmnOW69CEZ9HVvVv+nkcD3cDdBJWwvxWZvsr4I4dM30oNRlqUV8j4dp3mTFFOe3M5 je7Ochljolyknl/ehjV+Q60Wg5vord0lx+2Qx5GtXFWTETcqPe70nRCBbmqrJTNtHiH9 UkdOn7/wpMXaaQHVgeYv8nie8VtgehBEEjRp9tBO5gDtTxKp2+MKl+TxLaQF6N69xZt2 UEq/HsYQEShYJrRZgfasD5zdGaVhnvao3K9iHcRhKaaWRY3rIwkiENNpwc5inbplEKW/ vX8w== X-Gm-Message-State: ACrzQf1KtHeKvot5r8nwMthBsrY4FAN339HOrVpw81Z26zfmmyFCMdRw t8E5lAKDb8YYxbLrttWFK6Jbmg== X-Received: by 2002:a92:d0a:0:b0:300:3d26:b1fa with SMTP id 10-20020a920d0a000000b003003d26b1famr9158422iln.272.1666873601045; Thu, 27 Oct 2022 05:26:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:40 -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 3/7] net: ipa: no more global filtering starting with IPA v5.0 Date: Thu, 27 Oct 2022 07:26:28 -0500 Message-Id: <20221027122632.488694-4-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?1747843781454929524?= X-GMAIL-MSGID: =?utf-8?q?1747843781454929524?= IPA v5.0 eliminates the global filter table entry. As a result, there is no need to shift the filtered endpoint bitmap when it is written to IPA local memory. Update comments to explain this. Also delete a redundant block of comments above the function. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_table.c | 59 ++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index db1992eaafaa9..cf3a3de239dc3 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -32,8 +32,8 @@ * endian 64-bit "slot" that holds the address of a rule definition. (The * size of these slots is 64 bits regardless of the host DMA address size.) * - * Separate tables (both filter and route) used for IPv4 and IPv6. There - * are normally another set of "hashed" filter and route tables, which are + * Separate tables (both filter and route) are used for IPv4 and IPv6. There + * is normally another set of "hashed" filter and route tables, which are * used with a hash of message metadata. Hashed operation is not supported * by all IPA hardware (IPA v4.2 doesn't support hashed tables). * @@ -51,19 +51,32 @@ * Each filter rule is associated with an AP or modem TX endpoint, though * not all TX endpoints support filtering. The first 64-bit slot in a * filter table is a bitmap indicating which endpoints have entries in - * the table. The low-order bit (bit 0) in this bitmap represents a - * special global filter, which applies to all traffic. This is not - * used in the current code. Bit 1, if set, indicates that there is an - * entry (i.e. slot containing a system address referring to a rule) for - * endpoint 0 in the table. Bit 3, if set, indicates there is an entry - * for endpoint 2, and so on. Space is set aside in IPA local memory to - * hold as many filter table entries as might be required, but typically - * they are not all used. + * the table. Each set bit in this bitmap indicates the presence of the + * address of a filter rule in the memory following the bitmap. Until IPA + * v5.0, the low-order bit (bit 0) in this bitmap represents a special + * global filter, which applies to all traffic. Otherwise the position of + * each set bit represents an endpoint for which a filter rule is defined. + * + * The global rule is not used in current code, and support for it is + * removed starting at IPA v5.0. For IPA v5.0+, the endpoint bitmap + * position defines the endpoint ID--i.e. if bit 1 is set in the endpoint + * bitmap, endpoint 1 has a filter rule. Older versions of IPA represent + * the presence of a filter rule for endpoint X by bit (X + 1) being set. + * I.e., bit 1 set indicates the presence of a filter rule for endpoint 0, + * and bit 3 set means there is a filter rule present for endpoint 2. + * + * Each filter table entry has the address of a set of equations that + * implement a filter rule. So following the endpoint bitmap there + * will be such an address/entry for each endpoint with a set bit in + * the bitmap. * * The AP initializes all entries in a filter table to refer to a "zero" - * entry. Once initialized the modem and AP update the entries for - * endpoints they "own" directly. Currently the AP does not use the - * IPA filtering functionality. + * rule. Once initialized, the modem and AP update the entries for + * endpoints they "own" directly. Currently the AP does not use the IPA + * filtering functionality. + * + * This diagram shows an example of a filter table with an endpoint + * bitmap as defined prior to IPA v5.0. * * IPA Filter Table * ---------------------- @@ -658,12 +671,6 @@ bool ipa_table_mem_valid(struct ipa *ipa, bool filter) * when a route table is initialized or reset, its entries are made to refer * to the zero rule. The zero rule is shared for route and filter tables. * - * Note that the IPA hardware requires a filter or route rule address to be - * aligned on a 128 byte boundary. The coherent DMA buffer we allocate here - * has a minimum alignment, and we place the zero rule at the base of that - * allocated space. In ipa_table_init() we verify the minimum DMA allocation - * meets our requirement. - * * +-------------------+ * --> | zero rule | * / |-------------------| @@ -708,12 +715,16 @@ int ipa_table_init(struct ipa *ipa) /* First slot is the zero rule */ *virt++ = 0; - /* Next is the filter table bitmap. The "soft" bitmap value - * must be converted to the hardware representation by shifting - * it left one position. (Bit 0 repesents global filtering, - * which is possible but not used.) + /* Next is the filter table bitmap. The "soft" bitmap value might + * need to be converted to the hardware representation by shifting + * it left one position. Prior to IPA v5.0, bit 0 repesents global + * filtering, which is possible but not used. IPA v5.0+ eliminated + * that option, so there's no shifting required. */ - *virt++ = cpu_to_le64((u64)ipa->filter_map << 1); + if (ipa->version < IPA_VERSION_5_0) + *virt++ = cpu_to_le64((u64)ipa->filter_map << 1); + else + *virt++ = cpu_to_le64((u64)ipa->filter_map); /* All the rest contain the DMA address of the zero rule */ le_addr = cpu_to_le64(addr); From patchwork Thu Oct 27 12:26:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp200474wru; Thu, 27 Oct 2022 05:29:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NSkidsq7srMK4FfEb4VelJviQCcy0WGm2GZxpPJHJsVVIWsMfFRXn+mKIUCeSoF3pW1Xh X-Received: by 2002:a17:907:97d5:b0:7ac:5f72:6c1a with SMTP id js21-20020a17090797d500b007ac5f726c1amr12227693ejc.126.1666873741335; Thu, 27 Oct 2022 05:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873741; cv=none; d=google.com; s=arc-20160816; b=GWBOViOEhVWSneukf1Kfw4Vp1WrUY4e4/oTti9wjxBZxYAL0+IihK+GoboXYseX/YD 1Mnba8Pf2dOmy4hj+2oVFnIz1Hbjv1iokuxfqR7raluAOv9sv6ryjHBtqIDDiwq1vuK/ zdtDo3GxhwDzjRSlg3Fo8KAkfv7brfRGwMm5Hx+U3QM/F/NSizQoTWb6CupbsAu0i+eS qthFXzzr59uUBh2J0mRetwaMo6S93hreGDLadoLZgA17UHZ6dZobCm77QVhNJ+N/84aI jdOrAMYNZtHgGYP+e7tjJZSDR4Fv/1sWNxrHlRzij1NBTkOckpkzc2ZKd6aowTm5altC sQfg== 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=PANmuigY2dyK4ROc5rs4Gly3suQYhUI4Jvo2R9OvA2c=; b=GtI7gIYN0a0Vs+wb3WbyXemrJqsJNdAFpOrXXYqIFJQBKW1mmb1kHzrQyHKROgEwsn smgfrukKsf/QcsuK2DAtewzYgWVfoiNQb5jXatTdppe7zqErkQu9+pw+0AOGFbsbl008 6KEfIqJyNAjHCDxiU3B7YjKxatzh41zyIs7ONzJNA+cgJ+MYmhKc7pdCY0FaP+4L2zwp CABrjU0TrZl0NiADQ5iKKHlrtaDaOjnrAMfVXqj07AVwx2DXrZn7brJ+5Y2nV6Ze0UGq BEoNxOSOdPaLT4Nd152QeDOKy6PjwoP6NSw9cBcLNb6NP7oV7wYryT+cWCPE18ofxo5N NN0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CNIPTfja; 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 he41-20020a1709073da900b007815e9c5b80si1540898ejc.617.2022.10.27.05.28.35; Thu, 27 Oct 2022 05:29:01 -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=CNIPTfja; 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 S235606AbiJ0M1A (ORCPT + 99 others); Thu, 27 Oct 2022 08:27:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235557AbiJ0M0n (ORCPT ); Thu, 27 Oct 2022 08:26:43 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D43D9134AB3 for ; Thu, 27 Oct 2022 05:26:42 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id y143so461056iof.9 for ; Thu, 27 Oct 2022 05:26:42 -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=PANmuigY2dyK4ROc5rs4Gly3suQYhUI4Jvo2R9OvA2c=; b=CNIPTfja4d7m0UUvAc898mJLSi8nuvTEtwk390CUT8LLOZ1Yvw6rMwssAbUQFEmB83 AAw/OYfkSg+b5It3jiavbaVjKPJ0VxHdydf4Hhueu2M7P+4oLvjAhR4ulNs4E5JQZNmO uTAtYpTZPKgwt4wJDjtzIAWZSaBYSTmslPpv47BzwfOekUMR5BhdZUj6C4sTCqkv/c1v gN6Qc9qFT0qpNKM5yEgRvsZrTXd729hp6tYoReRAuibU+gujlXUbdWW9IKJpvzvoYb+L fQy1m6utqPHp+d/BceLWEMvQzR6AphefF06vF4AoXgzIpg4+mckq3xlpgN7de5E8680J FGlg== 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=PANmuigY2dyK4ROc5rs4Gly3suQYhUI4Jvo2R9OvA2c=; b=q8hwSKSVjNdPhDZY/6rm4U7HnySzYo1JAzBXJ3u/TKvOTyMVGJ62LyRkNVL+kU4n+P bVsHhT/Qpm2SS5jAwx1gqZ65BJmgYEadcF75yk2612TAw1OZhzFPaBdPrzhSMe2NMvmx b/oukfD9whSUtj3FBvnEEen6azI8YJGBmWF5jXqRRPCU3U8GGWWxipiGkhEz3AbYhd8M 6uVSJI72101qaAN4Y2AnqNt33IIBtG1TxAElKAO++BZJeFfmF3qrxMrvmN9CazT/J1Zs ByAHXc5Po9/sFyj/WKWA/bQ64IjqpmNZNgQDKgTK4ddjrYNvLjXpX+8lm9YUw7tOgRFc PpSA== X-Gm-Message-State: ACrzQf0QV2/ISNSPl4JCxC/4koRMKrWQhnoQrE629mdH2XQWZLrz5xYU PZxYM9KYp4nCC/iuriMsZDyePg== X-Received: by 2002:a02:c90a:0:b0:363:2b87:887c with SMTP id t10-20020a02c90a000000b003632b87887cmr31914891jao.72.1666873602491; Thu, 27 Oct 2022 05:26:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:41 -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 4/7] net: ipa: more completely check endpoint validity Date: Thu, 27 Oct 2022 07:26:29 -0500 Message-Id: <20221027122632.488694-5-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=ham 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?1747843800427144254?= X-GMAIL-MSGID: =?utf-8?q?1747843800427144254?= Ensure all defined TX endpoints are in the range [0, CONS_PIPES) and defined RX endpoints are within [PROD_LOWEST, PROD_LOWEST+PROD_PIPES). Modify the way local variables are used to make the checks easier to understand. Check for each endpoint being in valid range in the loop, and drop the logical-AND check of initialized against unavailable IDs. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 67 +++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 093e11ec7c2d1..6fc3cc6379fb0 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1843,14 +1843,13 @@ int ipa_endpoint_config(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; const struct ipa_reg *reg; u32 initialized; + u32 tx_count; + u32 rx_count; u32 rx_base; - u32 rx_mask; - u32 tx_mask; - int ret = 0; - u32 max; + u32 limit; u32 val; - /* Prior to IPAv3.5, the FLAVOR_0 register was not supported. + /* Prior to IPA v3.5, the FLAVOR_0 register was not supported. * Furthermore, the endpoints were not grouped such that TX * endpoint numbers started with 0 and RX endpoints had numbers * higher than all TX endpoints, so we can't do the simple @@ -1866,33 +1865,25 @@ int ipa_endpoint_config(struct ipa *ipa) } /* Find out about the endpoints supplied by the hardware, and ensure - * the highest one doesn't exceed the number we support. + * the highest one doesn't exceed the number supported by software. */ reg = ipa_reg(ipa, FLAVOR_0); val = ioread32(ipa->reg_virt + ipa_reg_offset(reg)); - /* Our RX is an IPA producer */ + /* Our RX is an IPA producer; our TX is an IPA consumer. */ + tx_count = ipa_reg_decode(reg, MAX_CONS_PIPES, val); + rx_count = ipa_reg_decode(reg, MAX_PROD_PIPES, val); rx_base = ipa_reg_decode(reg, PROD_LOWEST, val); - max = rx_base + ipa_reg_decode(reg, MAX_PROD_PIPES, val); - if (max > IPA_ENDPOINT_MAX) { - dev_err(dev, "too many endpoints (%u > %u)\n", - max, IPA_ENDPOINT_MAX); + + limit = rx_base + rx_count; + if (limit > IPA_ENDPOINT_MAX) { + dev_err(dev, "too many endpoints, %u > %u\n", + limit, IPA_ENDPOINT_MAX); return -EINVAL; } - rx_mask = GENMASK(max - 1, rx_base); - /* Our TX is an IPA consumer */ - max = ipa_reg_decode(reg, MAX_CONS_PIPES, val); - tx_mask = GENMASK(max - 1, 0); - - ipa->available = rx_mask | tx_mask; - - /* Check for initialized endpoints not supported by the hardware */ - if (ipa->initialized & ~ipa->available) { - dev_err(dev, "unavailable endpoint id(s) 0x%08x\n", - ipa->initialized & ~ipa->available); - ret = -EINVAL; /* Report other errors too */ - } + /* Mark all supported RX and TX endpoints as available */ + ipa->available = GENMASK(limit - 1, rx_base) | GENMASK(tx_count - 1, 0); initialized = ipa->initialized; while (initialized) { @@ -1901,16 +1892,32 @@ int ipa_endpoint_config(struct ipa *ipa) initialized ^= BIT(endpoint_id); - /* Make sure it's pointing in the right direction */ - endpoint = &ipa->endpoint[endpoint_id]; - if ((endpoint_id < rx_base) != endpoint->toward_ipa) { - dev_err(dev, "endpoint id %u wrong direction\n", + if (endpoint_id >= limit) { + dev_err(dev, "invalid endpoint id, %u > %u\n", + endpoint_id, limit - 1); + return -EINVAL; + } + + if (!(BIT(endpoint_id) & ipa->available)) { + dev_err(dev, "unavailable endpoint id %u\n", endpoint_id); - ret = -EINVAL; + return -EINVAL; } + + /* Make sure it's pointing in the right direction */ + endpoint = &ipa->endpoint[endpoint_id]; + if (endpoint->toward_ipa) { + if (endpoint_id < tx_count) + continue; + } else if (endpoint_id >= rx_base) { + continue; + } + + dev_err(dev, "endpoint id %u wrong direction\n", endpoint_id); + return -EINVAL; } - return ret; + return 0; } void ipa_endpoint_deconfig(struct ipa *ipa) From patchwork Thu Oct 27 12:26:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp200682wru; Thu, 27 Oct 2022 05:29:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Hn2e1o84tyByQcpy5VDHJZVyPC1iJW4SjSm6yPYulLl7ti7o3SQiCGocKAXOv0WZpuTT1 X-Received: by 2002:a17:906:fe45:b0:788:15a5:7495 with SMTP id wz5-20020a170906fe4500b0078815a57495mr42519326ejb.633.1666873774752; Thu, 27 Oct 2022 05:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873774; cv=none; d=google.com; s=arc-20160816; b=XeamrtmMeAyMJk0TwiJTsWefaXt2jIrMl/f8mpKQOIB7GFp7DgD+gNjA30KTOctCX/ SJl3PsotCvjSFEV/f75tIWEhqYJGZlowfdPhC7ayMxcMpzoTc6ySzeR+OGB11n+PHXuX ZNIKIPIAE63uiK4P3mM6HhBlmr+49cldDHDpRQXsbbcx7VEx8uPSrQIzPUlAGOEUXwDL nOteyKMvFc4fS22Z/nYSaoA4Y7u/YGGVVCmFfx7t8C3jUPO9Op6SbFGqFgthnq1nLnHC VOyNCJl8uy3oHK6F4rE71+sJPcFdrc+YZqwaHLs58Z5IEx8ky4Om3RWUYXAsUrg/rSdS EHiA== 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=Lh1EaQjT2Reomce8kVVBzGzrDBNIcwVObojZzaiEYwI=; b=DgpXROaY67iJofh0zuXBazMRYG8MVhzIPQ3yWS6N7G7nMz5fn1FSbuc2tACokiVDw6 Lj3gGDrL7fkOekq3N9MBNWJNgmo4KVKAFQdxjkIJPyKzuMYfofGwpS/X5q5pd1nmK/Qn 7eXN8+amdevPhbu2inhDyCUhiCNioEQfdQYZEjpQ6FsyJK1FA415Zs/i7QD9IqI6bqLW gwOZf4mD3BZHJLeM0KmWs15KUrNlGKv452yCICdNc34N4LHiWTwidsZ2SOS6P4R6YcMy 6VrSakBbaJXpMntXLMaWZSa5VUQJxlYhuwNnj57YNQbRvP9y0Qt+71aCtknXBQno8o9v KG6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aoj+E+2Q; 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 dr12-20020a170907720c00b0078d25914115si1267088ejc.570.2022.10.27.05.29.06; Thu, 27 Oct 2022 05:29:34 -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=Aoj+E+2Q; 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 S235647AbiJ0M1G (ORCPT + 99 others); Thu, 27 Oct 2022 08:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235599AbiJ0M0p (ORCPT ); Thu, 27 Oct 2022 08:26:45 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 770C0144E18 for ; Thu, 27 Oct 2022 05:26:44 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id y143so461115iof.9 for ; Thu, 27 Oct 2022 05:26:44 -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=Lh1EaQjT2Reomce8kVVBzGzrDBNIcwVObojZzaiEYwI=; b=Aoj+E+2QqQ3GfZknmX8bjYVVjTqTknVXBgtukTrN+IiQ4/sLUoSqr3DsM1gal3O6XR T6eGVNVcmHM0fV8NukcOgwGlPAyFjHwg3rKS7u+oR+8W5ouHPrWhVuzBeYc0iZrFrkH7 +JYmZ27IfImAqHzt9l/Z1YdogztdX0IwCtYmf70OfcXy4DrvnC4ExQwaSDdr4XOqOdCc 2uaUcxDg0OL7MSfaVGw7hOXCj/7KnPeVs0i16HOhpubwiJfSgGoF57+OZsmjKIuDZ+rU G+chfM0GPoN4ff1z1ufcy60NQNv2BGgNoKS3KQZMvyjwk7SUH3qKX3/qsrQLiM4NJYxS C+AQ== 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=Lh1EaQjT2Reomce8kVVBzGzrDBNIcwVObojZzaiEYwI=; b=i34CdbNvTEfUsEtlqtgQpAV6uRD+NDYEFzjsAiCYeKiNY5REoObgVlqIL+EItWZsDE y0G0s6C/2txUi2x/cyQ1ghSGAze18bkYb+fOatD466TAT1TzW4zIdhOd+/JbsjoukpmE 8w96ylYQ8W8afEpp8OrRXqVjFJEA85VbAQp3LCp4cGl8SAj5Rnx5lKmVnI4Rf2muMTq7 JhDugEhZqDyhKlqYBvuw4BAxiCuKjBm/uzuFruemrpsvLFI7lKhWfcgbybpgfU26TbC5 z61KfO+uViaevnf/9Dl3qI5j5Kfd0FoAX/tag0kTjuwLr7nDUTPezYdTTpTN2M5h/Wz6 NxVg== X-Gm-Message-State: ACrzQf0HPmo5HM1fyGbJgFgJ9e7q6Om7tcFbAcwtuwWCrLrh2kqnDq0g hd7SuQ4ca2oRpTIpJMAbbEs+OQ== X-Received: by 2002:a05:6638:14cf:b0:365:c889:4285 with SMTP id l15-20020a05663814cf00b00365c8894285mr29372852jak.312.1666873604012; Thu, 27 Oct 2022 05:26:44 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:43 -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 5/7] net: ipa: refactor endpoint loops Date: Thu, 27 Oct 2022 07:26:30 -0500 Message-Id: <20221027122632.488694-6-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=ham 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?1747843835173607889?= X-GMAIL-MSGID: =?utf-8?q?1747843835173607889?= Change two functions that iterate over all endpoints to use while loops, using "endpoint_id" as the index variables in both spots. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 6fc3cc6379fb0..740b2e4e0c50a 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -426,10 +426,10 @@ ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable) */ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable) { - u32 endpoint_id; + u32 endpoint_id = 0; - for (endpoint_id = 0; endpoint_id < IPA_ENDPOINT_MAX; endpoint_id++) { - struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id]; + while (endpoint_id < IPA_ENDPOINT_MAX) { + struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id++]; if (endpoint->ee_id != GSI_EE_MODEM) continue; @@ -1008,10 +1008,10 @@ static void ipa_endpoint_init_hol_block_disable(struct ipa_endpoint *endpoint) void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa) { - u32 i; + u32 endpoint_id = 0; - for (i = 0; i < IPA_ENDPOINT_MAX; i++) { - struct ipa_endpoint *endpoint = &ipa->endpoint[i]; + while (endpoint_id < IPA_ENDPOINT_MAX) { + struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id++]; if (endpoint->toward_ipa || endpoint->ee_id != GSI_EE_MODEM) continue; From patchwork Thu Oct 27 12:26:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp200750wru; Thu, 27 Oct 2022 05:29:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kduyz6Qi0g8kDpGSZyawcc7yUndFNOtRFenYA5y60XXcG/sm8cKF++TwhaktIGlqItFfh X-Received: by 2002:a17:907:a067:b0:7a7:dc5e:eb2d with SMTP id ia7-20020a170907a06700b007a7dc5eeb2dmr19430146ejc.121.1666873786223; Thu, 27 Oct 2022 05:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666873786; cv=none; d=google.com; s=arc-20160816; b=FUNcYZVF00Y+W6scaWZB5QanFJg1kFwj0BDdTQxdcCDQrCFdD0chz14VUK9/k6fypQ OVfyUI2JC4tklQaAJdACqDaH4a6I0QYrW5afN7mlxVW3Wc6mfK6mahnSZqmqZBmx7U0g yE0mv3oJav7SkjEI+o7L0fp7688Lkklj5UZdZQFW6Cno9iz9H5P5AuXFBLR9fWZmvCzC U0Q2GLudzUHkwjJYBe/RV43OVzdrRBEXhNQBDuFhcX0bQQj08CTRscVB8mDqxYV20e3M QmtkE85IuSudjwnhvg1+6js5bEOvdQGvB9oxUxJT/yGohu9FPEQuoDHcrk4ltgfYtiaB Ex8w== 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=epeLvt8lBCaZ5l7avoF50kT1TtYCZEpBvcBKlNT2iwg=; b=0qw+eb0XITtPQvK8k+4aUxCD0BbG8l2wuQS07ZYFnxnk8iadGBE8Lr36TtyCuxR0fB Cmh86BXNPWKPhNa2qsq9CLOZDnUE+rJWGRKyYdhaDDj+7OSLqBzu+5VpWW8ixnswi+W+ ffeovSZ3zMK6ohCoFbEbOXgnA4KedNlOwWdTJAZLxaGhKWbdZcuxmvyGQoWg7BFnWNMC tagWwLJ78pXOiXMOTvXOjDEt1eGb3EGpwswHD7BA1pOJG+q6E4w+EwOnlJ2Cs+iL0AxL CJl/SHgiN9PS9CdRlTGGC8S6izLuHM8N5dDYHLt/Q4XG/2qn15xzyJXb4ctTMzvHcm7e H7mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ASZTBTVg; 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 y18-20020a056402441200b004615c5728e8si1702822eda.494.2022.10.27.05.29.16; Thu, 27 Oct 2022 05:29:46 -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=ASZTBTVg; 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 S234802AbiJ0M1L (ORCPT + 99 others); Thu, 27 Oct 2022 08:27:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235604AbiJ0M0s (ORCPT ); Thu, 27 Oct 2022 08:26:48 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32DA4147053 for ; Thu, 27 Oct 2022 05:26:46 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id y143so461176iof.9 for ; Thu, 27 Oct 2022 05:26:46 -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=epeLvt8lBCaZ5l7avoF50kT1TtYCZEpBvcBKlNT2iwg=; b=ASZTBTVg0XueoY1mvGbHkTi9Ugs5LisP/oDcEfaQOmPS1HYaqq9S6/676ekGpiR3vC UGmIy2WKb2YUQPBdPfh4H/TZsoRvP8FO3XsAIPgrc3wzmtxeKeIXKrSfzN/I4HztApCU pGuLaS4tJlPkem/X7itLVokqzg+g9nvzSj5yFXYu6Sf1r1j45Eepd+hfbhyFxPAYt+YP WuhnKJ/6SvlDpfivLdVOzukQ294KArdt7oeMW7jQCG9Qmuz/SiUhdODIUm8it+oDHlmg DeW59JdtbrEHqowOpFKFDfgXZzRi29ncMWVW7Q9L6XJQvSGUhLxkjTZf1krqzaDKOvJw Yl9w== 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=epeLvt8lBCaZ5l7avoF50kT1TtYCZEpBvcBKlNT2iwg=; b=F0h1mwhnXuQYcpNAvFMsZxW9OLI6tsWPg7pCekaiSPOq25nOiORlOaY0ZEPe34xKEa c7hKDmHkv1pw8qzWZ2E/ev0k3J6qcchMaMF8u9haAFT//XKVpu3TlKA+ZGjs0FMOhxKE jbB7M7aF86FkC0SZpAfHE7/zJnGJgFQYWimGl21uVZkgvrpKkf7tjoFgVL/U0W8lHWSZ BHkHMfD6+8FaNNg18L/gKDvZ5DrzzxN9KclAT0mX+9vlHIL68hge5k2E+VTJ/5sPTl4b LbNiYK8pBAW8lt9x9ESNMOH3JU5vbi5A9jbrsiHALUVfKN3FCsE57fIhRl9jmwt9tuTQ y4Dw== X-Gm-Message-State: ACrzQf2hCJlYLB7zS7qa+ZAlcpEUPtNa5MjoCNpCd2rQP55YsX0jSrw/ EbBjtk18tDqpDxOzymup2rrylA== X-Received: by 2002:a02:2242:0:b0:375:29b5:b885 with SMTP id o63-20020a022242000000b0037529b5b885mr935862jao.162.1666873605571; Thu, 27 Oct 2022 05:26:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 05:26:44 -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 6/7] net: ipa: determine the maximum endpoint ID Date: Thu, 27 Oct 2022 07:26:31 -0500 Message-Id: <20221027122632.488694-7-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?1747843847117375958?= X-GMAIL-MSGID: =?utf-8?q?1747843847117375958?= Each endpoint ID has an entry in the IPA endpoint array. But the size of that array is defined at compile time. Instead, rename ipa_endpoint_data_valid() to be ipa_endpoint_max() and have it return the maximum endpoint ID defined in configuration data. That function will still validate configuration data. Zero is returned on error; it's a valid endpoint ID, but we need more than one, so it can't be the maximum. The next patch makes use of the returned maximum value. Finally, rename the "initialized" mask of endpoints defined by configuration data to be "defined". Signed-off-by: Alex Elder --- drivers/net/ipa/ipa.h | 6 +-- drivers/net/ipa/ipa_endpoint.c | 67 ++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 34 deletions(-) diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index 82225316a2e25..e975f63271c96 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -61,9 +61,9 @@ 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 + * @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 - * @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 @@ -117,9 +117,9 @@ struct ipa { size_t zero_size; /* Bit masks indicating endpoint state */ - u32 available; /* supported by hardware */ + u32 defined; /* Defined in configuration data */ + u32 available; /* Supported by hardware */ u32 filter_map; - u32 initialized; u32 set_up; u32 enabled; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 740b2e4e0c50a..9fd72ba149afa 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -243,42 +243,47 @@ static bool ipa_endpoint_data_valid_one(struct ipa *ipa, u32 count, return true; } -static bool ipa_endpoint_data_valid(struct ipa *ipa, u32 count, - const struct ipa_gsi_endpoint_data *data) +/* Validate endpoint configuration data. Return max defined endpoint ID */ +static u32 ipa_endpoint_max(struct ipa *ipa, u32 count, + const struct ipa_gsi_endpoint_data *data) { const struct ipa_gsi_endpoint_data *dp = data; struct device *dev = &ipa->pdev->dev; enum ipa_endpoint_name name; + u32 max; if (count > IPA_ENDPOINT_COUNT) { dev_err(dev, "too many endpoints specified (%u > %u)\n", count, IPA_ENDPOINT_COUNT); - return false; + return 0; } /* Make sure needed endpoints have defined data */ if (ipa_gsi_endpoint_data_empty(&data[IPA_ENDPOINT_AP_COMMAND_TX])) { dev_err(dev, "command TX endpoint not defined\n"); - return false; + return 0; } if (ipa_gsi_endpoint_data_empty(&data[IPA_ENDPOINT_AP_LAN_RX])) { dev_err(dev, "LAN RX endpoint not defined\n"); - return false; + return 0; } if (ipa_gsi_endpoint_data_empty(&data[IPA_ENDPOINT_AP_MODEM_TX])) { dev_err(dev, "AP->modem TX endpoint not defined\n"); - return false; + return 0; } if (ipa_gsi_endpoint_data_empty(&data[IPA_ENDPOINT_AP_MODEM_RX])) { dev_err(dev, "AP<-modem RX endpoint not defined\n"); - return false; + return 0; } - for (name = 0; name < count; name++, dp++) + max = 0; + for (name = 0; name < count; name++, dp++) { if (!ipa_endpoint_data_valid_one(ipa, count, data, dp)) - return false; + return 0; + max = max_t(u32, max, dp->endpoint_id); + } - return true; + return max; } /* Allocate a transaction to use on a non-command endpoint */ @@ -448,7 +453,7 @@ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable) /* Reset all modem endpoints to use the default exception endpoint */ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) { - u32 initialized = ipa->initialized; + u32 defined = ipa->defined; struct gsi_trans *trans; u32 count; @@ -463,13 +468,13 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa) return -EBUSY; } - while (initialized) { - u32 endpoint_id = __ffs(initialized); + while (defined) { + u32 endpoint_id = __ffs(defined); struct ipa_endpoint *endpoint; const struct ipa_reg *reg; u32 offset; - initialized ^= BIT(endpoint_id); + defined ^= BIT(endpoint_id); /* We only reset modem TX endpoints */ endpoint = &ipa->endpoint[endpoint_id]; @@ -1812,13 +1817,13 @@ static void ipa_endpoint_teardown_one(struct ipa_endpoint *endpoint) void ipa_endpoint_setup(struct ipa *ipa) { - u32 initialized = ipa->initialized; + u32 defined = ipa->defined; ipa->set_up = 0; - while (initialized) { - u32 endpoint_id = __ffs(initialized); + while (defined) { + u32 endpoint_id = __ffs(defined); - initialized ^= BIT(endpoint_id); + defined ^= BIT(endpoint_id); ipa_endpoint_setup_one(&ipa->endpoint[endpoint_id]); } @@ -1842,10 +1847,10 @@ int ipa_endpoint_config(struct ipa *ipa) { struct device *dev = &ipa->pdev->dev; const struct ipa_reg *reg; - u32 initialized; u32 tx_count; u32 rx_count; u32 rx_base; + u32 defined; u32 limit; u32 val; @@ -1885,12 +1890,12 @@ int ipa_endpoint_config(struct ipa *ipa) /* Mark all supported RX and TX endpoints as available */ ipa->available = GENMASK(limit - 1, rx_base) | GENMASK(tx_count - 1, 0); - initialized = ipa->initialized; - while (initialized) { - u32 endpoint_id = __ffs(initialized); + defined = ipa->defined; + while (defined) { + u32 endpoint_id = __ffs(defined); struct ipa_endpoint *endpoint; - initialized ^= BIT(endpoint_id); + defined ^= BIT(endpoint_id); if (endpoint_id >= limit) { dev_err(dev, "invalid endpoint id, %u > %u\n", @@ -1943,24 +1948,24 @@ static void ipa_endpoint_init_one(struct ipa *ipa, enum ipa_endpoint_name name, endpoint->toward_ipa = data->toward_ipa; endpoint->config = data->endpoint.config; - ipa->initialized |= BIT(endpoint->endpoint_id); + ipa->defined |= BIT(endpoint->endpoint_id); } static void ipa_endpoint_exit_one(struct ipa_endpoint *endpoint) { - endpoint->ipa->initialized &= ~BIT(endpoint->endpoint_id); + endpoint->ipa->defined &= ~BIT(endpoint->endpoint_id); memset(endpoint, 0, sizeof(*endpoint)); } void ipa_endpoint_exit(struct ipa *ipa) { - u32 initialized = ipa->initialized; + u32 defined = ipa->defined; - while (initialized) { - u32 endpoint_id = __fls(initialized); + while (defined) { + u32 endpoint_id = __fls(defined); - initialized ^= BIT(endpoint_id); + defined ^= BIT(endpoint_id); ipa_endpoint_exit_one(&ipa->endpoint[endpoint_id]); } @@ -1977,10 +1982,10 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count, BUILD_BUG_ON(!IPA_REPLENISH_BATCH); - if (!ipa_endpoint_data_valid(ipa, count, data)) + if (!ipa_endpoint_max(ipa, count, data)) return 0; /* Error */ - ipa->initialized = 0; + ipa->defined = 0; filter_map = 0; for (name = 0; name < count; name++, data++) { 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;