Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3156493rwi; Fri, 21 Oct 2022 12:19:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66G+8GoyZGtixHvmW3Mr0LZ7jPjh8hpdX/V+8Fdgg039xZC8Q3n8wTnYUzhxwPKzt0zLj6 X-Received: by 2002:aa7:c58a:0:b0:459:1511:6cff with SMTP id g10-20020aa7c58a000000b0045915116cffmr19085147edq.27.1666379946135; Fri, 21 Oct 2022 12:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666379946; cv=none; d=google.com; s=arc-20160816; b=TQeHORrzUd1JOpziLyKtKOZbBjPmfZdINfu/TX8s4Zz4MWv7FC/kSLuFjKpbPFxzTD 4OsdkrPXgIwoYwOhBfgeagER7vz9SMXlabAlqZB7qXzqNSXJrcYJG69Zln6Pfv2NfGHm Qq3NILWHExvq/gpHUrFLEoVhlz/2fHGItrQks/rRdMcQwY39XuN8AZzvUxJaKOo7gMV0 5Ks7TPlcpNh3PsnGDqrzsRUmOcphIsAJqYlB1jdwX0TWV1nZ8PCTaojHCH30X6yHgRMg EiByeD202cLAQdX4DEJFAjTBEiQBmmWAf/KzRrfCTG1WKIAlAIaDe9X0QRgAMw0hVT5F wsrw== 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=qAM1egPVWVrike9dFWQzNQN7PoIv5TOv3JuxtoXyqE4=; b=ONpRjwGPESVP/r6LCQ+pqmgEngMPqlTgLjYvBf+FqJBowzg7GUy1YLh7rXSA7tVbTw rUFK/1FZ3GT0mAi37fjJH3ey+7PqVSdrPpxvEphcCyjXQQU9Wn5aFuhR+THZElLDjick jasvgKxKXAz9FMojM+R9kIeE/+pSydWVsfcsNTPWuAYKqbzePgsETzIkKoeF51lT4Xgq SvWB5IeUYKsPGMQwYBvQXpp9URoAZ57daQFmelbuhPiMJDgrCSw1JEjfbH4yQv8F/yav BKSNjsxEvTXYwW3lbnMbbeuf9CJM7tWkHobpKlLozqFehi/UCSCZe0q5g5qtdwUMZz8m 5vRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tKJZ9iQB; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020aa7c1c7000000b00457d6a92180si3284637edp.538.2022.10.21.12.18.19; Fri, 21 Oct 2022 12:19:06 -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=tKJZ9iQB; 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 S230422AbiJUTOP (ORCPT + 99 others); Fri, 21 Oct 2022 15:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbiJUTN6 (ORCPT ); Fri, 21 Oct 2022 15:13:58 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 692F7295B01 for ; Fri, 21 Oct 2022 12:13:55 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id q18so2143239ils.12 for ; Fri, 21 Oct 2022 12:13:55 -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=qAM1egPVWVrike9dFWQzNQN7PoIv5TOv3JuxtoXyqE4=; b=tKJZ9iQBwxdnhWesKo8avmic9dyQA85QgCdk0ZvCuN+PgentQO+5dk6cYu0zc/5pzM xQCE5VWlKy0kEG6jC2eWdvDx0vlxzzllmRDPNXGktN6DKf4jpnS5tANWx9dPivslbV0B Wp8KULKmHLFfwmOzb58r1ag5hyHuFVgKD97HjhMlq01Bz96t8tbha/P8fjAx9maH+JXr MotJLvZhB0ileRiweiugeyqH5TNppfOLyByU52u+Y3O6JBHkRMhvkdEM3XAOHOSLM6Sg 0SXxteXEYePjK/EwK4/QbPK16mvHs5sTzYI6tiVkQE/6fWkfWFW8teJB0eWOaRxEQUCD rgXw== 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=qAM1egPVWVrike9dFWQzNQN7PoIv5TOv3JuxtoXyqE4=; b=7JzAVP1HvoDOYFqQnA4pyDi0wF5tgOCeJKQysM+BrL7ECDl0dOgx3jBIqUv3ZKNBpQ AHbJoiVlXhsOsZ5jMlwlUQIFpm14p/5JSLHPLmZQG++p3Sj3uLFvafWQuFloBcAPOuHJ 9k+V6KEhDvXqm0dFedfyo1VJCBFKVwxzwrsmg2UKjLww8cRlslC2f7ueVsbZT78Fr2j7 8XGUVEMXyuAbkmirm1yBuO5QRCBn/mK1qHozQ6QNdq26UwhvgEFZL1qaV0UaqceWw8kv nzH5e593idHnh6VHW06rMR6nO/U/RsAUxhNXw82NCnqaY24+OFqQMsUg9eZtxppqZIeH WxRw== X-Gm-Message-State: ACrzQf3zDrvbRxBvVR798EjMimsu3quTvHgiUybLpr+rSaIM39CNSCb3 WAbbqhNG3W81wlH/LWvzrVl5eg== X-Received: by 2002:a05:6e02:170d:b0:2fc:3e76:b262 with SMTP id u13-20020a056e02170d00b002fc3e76b262mr14803311ill.152.1666379634210; Fri, 21 Oct 2022 12:13:54 -0700 (PDT) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id e3-20020a022103000000b00363c68aa348sm4439362jaa.72.2022.10.21.12.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 12:13:53 -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: kill ipa_table_valid() Date: Fri, 21 Oct 2022 14:13:39 -0500 Message-Id: <20221021191340.4187935-7-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021191340.4187935-1-elder@linaro.org> References: <20221021191340.4187935-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,URIBL_BLOCKED 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 What ipa_table_valid() (and ipa_table_valid_one(), which it calls) does is ensure that the memory regions that hold routing and filter tables have reasonable size. Specifically, it checks that the size of a region is sufficient (or rather, exactly the right size) to hold the maximum number of entries supported by the driver. (There is an additional check that's erroneous, but in practice it is never reached.) Recently ipa_table_mem_valid() was added, which is called by ipa_table_init(). That function verifies that all table memory regions are of sufficient size, and requires hashed tables to have zero size if hashing is not supported. It only ensures the filter table is large enough to hold the number of endpoints that support filtering, but that is adequate. Therefore everything that ipa_table_valid() does is redundant, so get rid of it. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_mem.c | 4 --- drivers/net/ipa/ipa_table.c | 50 ------------------------------------- drivers/net/ipa/ipa_table.h | 8 ------ 3 files changed, 62 deletions(-) diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c index 2238dac2af07e..4022ae01a1319 100644 --- a/drivers/net/ipa/ipa_mem.c +++ b/drivers/net/ipa/ipa_mem.c @@ -366,10 +366,6 @@ int ipa_mem_config(struct ipa *ipa) while (--canary_count); } - /* Make sure filter and route table memory regions are valid */ - if (!ipa_table_valid(ipa)) - goto err_dma_free; - /* Verify the microcontroller ring alignment (if defined) */ mem = ipa_mem_find(ipa, IPA_MEM_UC_EVENT_RING); if (mem && mem->offset % 1024) { diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 9822b18d9ed39..7a60f2867de92 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -155,56 +155,6 @@ ipa_table_mem(struct ipa *ipa, bool filter, bool hashed, bool ipv6) return ipa_mem_find(ipa, mem_id); } -static bool -ipa_table_valid_one(struct ipa *ipa, enum ipa_mem_id mem_id, bool route) -{ - const struct ipa_mem *mem = ipa_mem_find(ipa, mem_id); - struct device *dev = &ipa->pdev->dev; - u32 size; - - if (route) - size = IPA_ROUTE_COUNT_MAX * sizeof(__le64); - else - size = (1 + IPA_FILTER_COUNT_MAX) * sizeof(__le64); - /* mem->size >= size is sufficient, but we'll demand more */ - if (mem->size == size) - return true; - - /* Hashed table regions can be zero size if hashing is not supported */ - if (ipa_table_hash_support(ipa) && !mem->size) - return true; - - dev_err(dev, "%s table region %u size 0x%02x, expected 0x%02x\n", - route ? "route" : "filter", mem_id, mem->size, size); - - return false; -} - -/* Verify the filter and route table memory regions are the expected size */ -bool ipa_table_valid(struct ipa *ipa) -{ - bool valid; - - valid = ipa_table_valid_one(ipa, IPA_MEM_V4_FILTER, false); - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V6_FILTER, false); - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V4_ROUTE, true); - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V6_ROUTE, true); - - if (!ipa_table_hash_support(ipa)) - return valid; - - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V4_FILTER_HASHED, - false); - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V6_FILTER_HASHED, - false); - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V4_ROUTE_HASHED, - true); - valid = valid && ipa_table_valid_one(ipa, IPA_MEM_V6_ROUTE_HASHED, - true); - - return valid; -} - bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_map) { struct device *dev = &ipa->pdev->dev; diff --git a/drivers/net/ipa/ipa_table.h b/drivers/net/ipa/ipa_table.h index 395189f75d784..73ca8369c6352 100644 --- a/drivers/net/ipa/ipa_table.h +++ b/drivers/net/ipa/ipa_table.h @@ -19,14 +19,6 @@ struct ipa; /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */ #define IPA_ROUTE_COUNT_MAX 15 -/** - * ipa_table_valid() - Validate route and filter table memory regions - * @ipa: IPA pointer - * - * Return: true if all regions are valid, false otherwise - */ -bool ipa_table_valid(struct ipa *ipa); - /** * ipa_filter_map_valid() - Validate a filter table endpoint bitmap * @ipa: IPA pointer -- 2.34.1