From patchwork Thu Feb 11 21:19:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 381048 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp2418293jah; Thu, 11 Feb 2021 13:21:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz15Rx309RsVI3yhMyiyB44v38Z9M5faRkQIiMGNvvS9kxt8HyNehPlV/c4nniQ0ZI+X0dD X-Received: by 2002:aa7:c901:: with SMTP id b1mr47821edt.329.1613078501578; Thu, 11 Feb 2021 13:21:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613078501; cv=none; d=google.com; s=arc-20160816; b=DIRl2w9htK+fF7OHS1Mag+fIzobiwP9K5pH5PMx04uCeRNgSIDkpKNo5NTjbc+F8Cx UDiw5EGXyO+pN3VEnsZpbyq9XbqLH8XhCRXEU7QBDI86blAoi58HjT6CWfu3rIVK3TRZ DzSgdQ/nv5yC3XOKyMu2eYBHsajJaAmOoxaGjA9iyrLy71LNIQC49AdOmL77vO84u6kD u7ctDLFanpjsBUaL5kVT8UJLwi2w5+WqABAOcKtAk3rkJxJs84RWmGXfmt5cTWKKt4Ik W7H+cqB5P6bTbdqEOUT8revDc0M/Qg9N8ztIMuEFYJsIgm/+qprLjU12/Ts9BO2w7Yv5 uRPw== 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=IStF8omOtMMIRYTaQJuhUXxte77Gy13HZh8YPRMX9jw=; b=pK58epwwQqQz8P28QU7NfkbQ2xyx6T7VwJBH6Nq52lZ8S8YgTebRCXtUsv/wXnP8pP 18FVhyEsJYC2EkbsyyPjsw7U1qsumR0CJ6Z/pUHwQL0kaPY2s3/3li1gN9R9rDkak5kV J9MZBx5QnkIk9vrp5rnyNDlTRnke8HReINDE6JKb06L07rIITZt2AWjgX2wf13mr3S4l ViQJ6K9AW515Cp0mnSEQYqQWDfy/Ch1m0L+H3TyS/fEoVvY4HMQZSjMBImQB7mn9sB2D wMG5AKNBlm18RX9aGrYvtJx1uDgfU0PBUSK6dN7MvWf1b148k/e/pQML3qfz6ODwxva8 8/NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AaO/WNil"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si4647314edo.136.2021.02.11.13.21.41; Thu, 11 Feb 2021 13:21:41 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AaO/WNil"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S230003AbhBKVVb (ORCPT + 9 others); Thu, 11 Feb 2021 16:21:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbhBKVUx (ORCPT ); Thu, 11 Feb 2021 16:20:53 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ED69C061797 for ; Thu, 11 Feb 2021 13:19:36 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id u20so7219858iot.9 for ; Thu, 11 Feb 2021 13:19:36 -0800 (PST) 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=IStF8omOtMMIRYTaQJuhUXxte77Gy13HZh8YPRMX9jw=; b=AaO/WNil1d0IglNbl3EOtwIFStOFY2YUW3SMEvQSQD+OMVyLRPFy9V6y/P7YUPvT13 8OXWvn1FOIzvj/wP8kSMZ3SAHZSVj55fu3estS5ZfZvsNyedgwxNBGz88bS/LXMIINi9 eGVdqchNQv4kiKlVshihBM+9CupkYNlEUVzDLHDq+FEF13WAy3EUZ4DGxaUp7PVJnZ0i 23Fir9SEKbcG799IuMV7vGy+ggQUAHnSTD7/ro/hMnczN/yT1i0O6ILUc7xObuI4qcXC oKOlqKfCQK0ujdSwPtMvT0S2uXhBqwEBEw1DM4BLBfRhPGQBko8klDPodRF5kFxys2z6 zmbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IStF8omOtMMIRYTaQJuhUXxte77Gy13HZh8YPRMX9jw=; b=Mq5UdSKgdtX7Ko0RJV3Ri+KuCnlDK91+YMpwN0lJXIU3mxXH8y07nd6ppoMcZI1OOH HHcG/183Dr8CL3ljfLeS2JZ7cr7/rSum7quSEUAdg+h1C/CM/UKa35yOdqbSaVuaryBh JK+lqEt//d4v2wDG2eB6/TpdDDnN8SgljS1u3f4GJhRmWsNTXZCSTfTO+JkxOWz79YPx VCDbSOV/ZsPpkf3n8dw3uQW9qRbPmrmuZUBrEF8+lxvf8yGtQ/bH5LN8oe4/MYpvhs8z CgjudUc+3z1/mBVjxBKzQ/z6Gmypeek4f5iKcI7GhH7tXg1KaYhSOS0MgycThcZ3Hjwy s9jg== X-Gm-Message-State: AOAM532QbREDOrYPfOPDDUp6nFBzTSYMlQfNHR8TP+tJqtFFVG5rFzpx Uj/1AXBjSbOFrXnqOvH5/jEU/g== X-Received: by 2002:a5d:8d92:: with SMTP id b18mr7243216ioj.167.1613078375566; Thu, 11 Feb 2021 13:19:35 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id j10sm3155718ilc.50.2021.02.11.13.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 13:19:34 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: elder@kernel.org, evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 4/5] net: ipa: introduce ipa_table_hash_support() Date: Thu, 11 Feb 2021 15:19:26 -0600 Message-Id: <20210211211927.28061-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210211211927.28061-1-elder@linaro.org> References: <20210211211927.28061-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Introduce a new function to abstract the knowledge of whether hashed routing and filter tables are supported for a given IPA instance. IPA v4.2 is the only one that doesn't support hashed tables (now and for the foreseeable future), but the name of the helper function is better for explaining what's going on. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_cmd.c | 2 +- drivers/net/ipa/ipa_table.c | 16 +++++++++------- drivers/net/ipa/ipa_table.h | 8 +++++++- 3 files changed, 17 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_cmd.c b/drivers/net/ipa/ipa_cmd.c index fd8bf6468d313..35e35852c25c5 100644 --- a/drivers/net/ipa/ipa_cmd.c +++ b/drivers/net/ipa/ipa_cmd.c @@ -268,7 +268,7 @@ static bool ipa_cmd_register_write_valid(struct ipa *ipa) /* If hashed tables are supported, ensure the hash flush register * offset will fit in a register write IPA immediate command. */ - if (ipa->version != IPA_VERSION_4_2) { + if (ipa_table_hash_support(ipa)) { offset = ipa_reg_filt_rout_hash_flush_offset(ipa->version); name = "filter/route hash flush"; if (!ipa_cmd_register_write_offset_valid(ipa, name, offset)) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 32e2d3e052d55..baaab3dd0e63c 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2018-2020 Linaro Ltd. + * Copyright (C) 2018-2021 Linaro Ltd. */ #include @@ -239,6 +239,11 @@ static void ipa_table_validate_build(void) #endif /* !IPA_VALIDATE */ +bool ipa_table_hash_support(struct ipa *ipa) +{ + return ipa->version != IPA_VERSION_4_2; +} + /* Zero entry count means no table, so just return a 0 address */ static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count) { @@ -412,8 +417,7 @@ int ipa_table_hash_flush(struct ipa *ipa) struct gsi_trans *trans; u32 val; - /* IPA version 4.2 does not support hashed tables */ - if (ipa->version == IPA_VERSION_4_2) + if (!ipa_table_hash_support(ipa)) return 0; trans = ipa_cmd_trans_alloc(ipa, 1); @@ -531,8 +535,7 @@ static void ipa_filter_config(struct ipa *ipa, bool modem) enum gsi_ee_id ee_id = modem ? GSI_EE_MODEM : GSI_EE_AP; u32 ep_mask = ipa->filter_map; - /* IPA version 4.2 has no hashed route tables */ - if (ipa->version == IPA_VERSION_4_2) + if (!ipa_table_hash_support(ipa)) return; while (ep_mask) { @@ -582,8 +585,7 @@ static void ipa_route_config(struct ipa *ipa, bool modem) { u32 route_id; - /* IPA version 4.2 has no hashed route tables */ - if (ipa->version == IPA_VERSION_4_2) + if (!ipa_table_hash_support(ipa)) return; for (route_id = 0; route_id < IPA_ROUTE_COUNT_MAX; route_id++) diff --git a/drivers/net/ipa/ipa_table.h b/drivers/net/ipa/ipa_table.h index 78038d14fcea9..1a68d20f19d6a 100644 --- a/drivers/net/ipa/ipa_table.h +++ b/drivers/net/ipa/ipa_table.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2020 Linaro Ltd. + * Copyright (C) 2019-2021 Linaro Ltd. */ #ifndef _IPA_TABLE_H_ #define _IPA_TABLE_H_ @@ -51,6 +51,12 @@ static inline bool ipa_filter_map_valid(struct ipa *ipa, u32 filter_mask) #endif /* !IPA_VALIDATE */ +/** + * ipa_table_hash_support() - Return true if hashed tables are supported + * @ipa: IPA pointer + */ +bool ipa_table_hash_support(struct ipa *ipa); + /** * ipa_table_reset() - Reset filter and route tables entries to "none" * @ipa: IPA pointer