Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1129710rwj; Sat, 29 Oct 2022 17:32:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oQNH7BvFvj63VZFUdBnldfOZ6O3m0AH09nTvJjF9TLw+68R/cB4OKeHxdhwdkWEu2q+lM X-Received: by 2002:a17:906:5a60:b0:78d:b9c2:5bcf with SMTP id my32-20020a1709065a6000b0078db9c25bcfmr5914705ejc.602.1667089937434; Sat, 29 Oct 2022 17:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667089937; cv=none; d=google.com; s=arc-20160816; b=FWOPmyG5+TbGtozMDk79s+8EzY5s0ld5RVXCKrfKHm3gGIwznEUksg1hcdw1dfkrlq 3bfy4WS0nkMkpl2CPxsvjcLC3/oh8dX1mZfso5PBdhRou1KwnqYVrbOPBjNUlfnLwWxo WSGHFJBOH7B6WuIG8CyaYUfgP6lnG/ZwA96gprG12Frm5oZaCwBb9ppFnYOCYuybhgTo Wk6VuctAnkFNGHfvdN1CNf6hxJa95evdn1bewX4M24L+YOymKmmSsQzr5NnksgEcJoyM L9y+L1uapFFN5I+tdyVpBcmavO2DnDRQIR8xgNbH4PBMJghbHex+cwEjscHYYwb5u8D7 CH1A== 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=lCQLB8py1X/NJwP3+BLi4r+G0VNoFsbUa3BWr+xCFoQ=; b=QigVw1oDf54zf4SR5SOB7U14xUop7xBFtnbh8Joqg3NVcwAHJHz5K6xMcC796B6WvI O69OpWlVeekHan/TvwDRywvvKx+MvJDGk0VEQHcWFu5fzk1gzMxC4D3+J4taI2QzUNfX gPA5gVKcea1Brgiupo9p746gi07D+A36hQrfCIa0WfOK18uRdEmaKOyyxABSeEU51P+D +kEpz0tXCqQ43eSgBBoo2KnUJqaOiqYtuwA+YIxmv0WYuQ359nTaldoHTG69oLHecL5P e73qpWpq63Fen/aU1zooUJVMAH5KNhBXQgSyZktscSKelFrEcCunw4CgGyBKEyBslAR7 OttQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jmHp3teu; 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 s25-20020a170906c31900b007a0f4d6bf83si2822215ejz.305.2022.10.29.17.31.47; Sat, 29 Oct 2022 17:32:17 -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=jmHp3teu; 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 S229894AbiJ3ASz (ORCPT + 99 others); Sat, 29 Oct 2022 20:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiJ3ASk (ORCPT ); Sat, 29 Oct 2022 20:18:40 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CDB724BE7 for ; Sat, 29 Oct 2022 17:18:39 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id m15so2556715ilq.2 for ; Sat, 29 Oct 2022 17:18:39 -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=lCQLB8py1X/NJwP3+BLi4r+G0VNoFsbUa3BWr+xCFoQ=; b=jmHp3teuCYigeQt5u903OOVQ/7tU565Ceuoo6r+WKRicQaxX9/qE2YA1qGRDG+YMdE 7uRTAfkhzLe8y/gNNUeTDclMFbUWslOXbXddHaCasYQ0H4j9PvoHdq3yniv5koNpfQ/N lv08Elpb6jFc+MoRgQTFGSqSIfuG6nthwoytr5v06vdcDbTVmVQUXyoYs9qXpBDti4UD UdbVs62YN6Hm1wMry6Y5rNB8hI4RlnZwWHai+gBN3z31leL9xLKRXQO27zoOimEE59zJ lmEqqJn74/bGFEluyielEKYZ2Zt4G+npO5j081lqW4VCdDXX714kv2qMWva0t15zlE8p OhcQ== 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=lCQLB8py1X/NJwP3+BLi4r+G0VNoFsbUa3BWr+xCFoQ=; b=ymoEdhHp2kRLdGavP2k5efh/DKGaC/88a2fs3QhoVLXFNj+4YpUU+NuX88WfEJ/3Pm xll6djC5tCIOf6DJVEq3y7yp2dM83AavBaE4O0tpa8a5OuWEsJUBqDxRqqiYzxABz+/2 NyL0hyrbHTKPEMxz1e6QrRO+r2lw8R93jeDVhhSYbpLq66X6oSjMlnCrXzr/HjoiWyoO 7NaehYkNoy8HRjp6mjd0oqR74McJ8H3xzREuZ3L6/7H4XcPPlob4+MBNkSqetQCYWkdR 5zuyFbCJ5NK5jCH4tN5HJHBOx2MYAi9Q4Imtmtci9TRsi/7RfEraDhtCsAmdrUE2Jung DGxQ== X-Gm-Message-State: ACrzQf1oa3/d86cwFZ6QpZgf3SyFrENrUKasu+kut/Mfrv2+duJ9ohkN 4W+dCvZdqrPuRz7MvjPn0/GarQ== X-Received: by 2002:a05:6e02:152e:b0:2f9:e082:7fc7 with SMTP id i14-20020a056e02152e00b002f9e0827fc7mr3011352ilu.167.1667089118791; Sat, 29 Oct 2022 17:18:38 -0700 (PDT) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id co20-20020a0566383e1400b00375126ae55fsm1087519jab.58.2022.10.29.17.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 17:18:38 -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/9] net: ipa: use ipa_table_mem() in ipa_table_reset_add() Date: Sat, 29 Oct 2022 19:18:21 -0500 Message-Id: <20221030001828.754010-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221030001828.754010-1-elder@linaro.org> References: <20221030001828.754010-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 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 Similar to the previous commit, pass flags rather than a memory region ID to ipa_table_reset_add(), and there use ipa_table_mem() to look up the memory region affected based on those flags. Currently all eight of these table memory regions are assumed to exist, because they all have canaries within them. Stop assuming that will always be the case, and in ipa_table_reset_add() allow these memory regions to be non-existent. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_table.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/net/ipa/ipa_table.c b/drivers/net/ipa/ipa_table.c index 94bb7611e574b..3a14465bf8a64 100644 --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -200,16 +200,17 @@ static dma_addr_t ipa_table_addr(struct ipa *ipa, bool filter_mask, u16 count) } static void ipa_table_reset_add(struct gsi_trans *trans, bool filter, - u16 first, u16 count, enum ipa_mem_id mem_id) + bool hashed, bool ipv6, u16 first, u16 count) { struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi); - const struct ipa_mem *mem = ipa_mem_find(ipa, mem_id); + const struct ipa_mem *mem; dma_addr_t addr; u32 offset; u16 size; - /* Nothing to do if the table memory region is empty */ - if (!mem->size) + /* Nothing to do if the memory region is doesn't exist or is empty */ + mem = ipa_table_mem(ipa, filter, hashed, ipv6); + if (!mem || !mem->size) return; if (filter) @@ -227,7 +228,7 @@ static void ipa_table_reset_add(struct gsi_trans *trans, bool filter, * for the IPv4 and IPv6 non-hashed and hashed filter tables. */ static int -ipa_filter_reset_table(struct ipa *ipa, enum ipa_mem_id mem_id, bool modem) +ipa_filter_reset_table(struct ipa *ipa, bool hashed, bool ipv6, bool modem) { u32 ep_mask = ipa->filter_map; u32 count = hweight32(ep_mask); @@ -253,7 +254,7 @@ ipa_filter_reset_table(struct ipa *ipa, enum ipa_mem_id mem_id, bool modem) if (endpoint->ee_id != ee_id) continue; - ipa_table_reset_add(trans, true, endpoint_id, 1, mem_id); + ipa_table_reset_add(trans, true, hashed, ipv6, endpoint_id, 1); } gsi_trans_commit_wait(trans); @@ -269,18 +270,18 @@ static int ipa_filter_reset(struct ipa *ipa, bool modem) { int ret; - ret = ipa_filter_reset_table(ipa, IPA_MEM_V4_FILTER, modem); + ret = ipa_filter_reset_table(ipa, false, false, modem); if (ret) return ret; - ret = ipa_filter_reset_table(ipa, IPA_MEM_V4_FILTER_HASHED, modem); + ret = ipa_filter_reset_table(ipa, true, false, modem); if (ret) return ret; - ret = ipa_filter_reset_table(ipa, IPA_MEM_V6_FILTER, modem); + ret = ipa_filter_reset_table(ipa, false, true, modem); if (ret) return ret; - ret = ipa_filter_reset_table(ipa, IPA_MEM_V6_FILTER_HASHED, modem); + ret = ipa_filter_reset_table(ipa, true, true, modem); return ret; } @@ -312,13 +313,11 @@ static int ipa_route_reset(struct ipa *ipa, bool modem) count = ipa->route_count - modem_route_count; } - ipa_table_reset_add(trans, false, first, count, IPA_MEM_V4_ROUTE); - ipa_table_reset_add(trans, false, first, count, - IPA_MEM_V4_ROUTE_HASHED); + ipa_table_reset_add(trans, false, false, false, first, count); + ipa_table_reset_add(trans, false, true, false, first, count); - ipa_table_reset_add(trans, false, first, count, IPA_MEM_V6_ROUTE); - ipa_table_reset_add(trans, false, first, count, - IPA_MEM_V6_ROUTE_HASHED); + ipa_table_reset_add(trans, false, false, true, first, count); + ipa_table_reset_add(trans, false, true, true, first, count); gsi_trans_commit_wait(trans); -- 2.34.1