Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp591295rwi; Wed, 2 Nov 2022 15:53:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67um3iQEGTeERMx4yF/FaVP2WZ2QwWjuAiU24oKeuQfaJkI/caVIvVIdw/YeRm4K/fkHX+ X-Received: by 2002:a17:902:e843:b0:186:b180:3c3a with SMTP id t3-20020a170902e84300b00186b1803c3amr27446836plg.66.1667429620727; Wed, 02 Nov 2022 15:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667429620; cv=none; d=google.com; s=arc-20160816; b=aWMcZLlbaKQ28VA+85xCfkIm2PLIK06/xegq/HJDF9NRBkzdz5knXachMWUGw3g0bo /26GK8cgDWrPKrKj5f85YE6HZExYmK8fKSan8G87X862Jqgogdja2PGg8eF5x1dSh3Bp FIBgwtmRGAf8dD+gvYUCdZE6weTw27MAOWnmBsaiGCQMZLSyrzJEyRQpIVCVmq28e2e3 aIvwcKn4escHZzyZaWqozRvHyFyX19qLSqxtJPu9Oygg4MGhrNlrejMWfm0zvMmfXFxn VYNf+x1Amut7mXYf4YrM876iggqkTHh00lHxwHIpYxxnmow3cqNbDc2BlM9Y+QWLyuX1 qHzw== 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=TuSIm6zkmedABAvq2UwBAYV4xbyYTMteFf1q6GY7XpAiozo7z5v3EqwSsO/nasEvsO 8KXY6W6CsWsswN5vy81k+ZD4AEf3eDphGTtUtK/0jZoXSEdGZs/BAzun03yPN1fMTIpo 44eX7UYVhjLTP9qmZ+NCxlOQIGSu5r17XRUOtozPYTV2tNAMnc9lb6xzaAnzmzxawujX Co+4KkW4sw2DloyccQ2blNi8JIEZgptLGCQncQryZM4aIJ14a9jk4MyVhxMhjuh+2Waa 92H2008iJ/k1Gkc1FLpo3anXiXN0G9LNdsaqbei1Hc7NFENeE3ajWqNHN5bw+/AATY+0 3YNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SNCDbmVK; 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 p5-20020a170902ebc500b001869b988da6si17012492plg.402.2022.11.02.15.53.27; Wed, 02 Nov 2022 15:53:40 -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=SNCDbmVK; 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 S231483AbiKBWL7 (ORCPT + 98 others); Wed, 2 Nov 2022 18:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbiKBWLs (ORCPT ); Wed, 2 Nov 2022 18:11:48 -0400 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 9B9586460 for ; Wed, 2 Nov 2022 15:11:46 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id y6so13257409iof.9 for ; Wed, 02 Nov 2022 15:11: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=lCQLB8py1X/NJwP3+BLi4r+G0VNoFsbUa3BWr+xCFoQ=; b=SNCDbmVKKb+oXB9d2PZfmQ6sGlOAEy3WH57N0KnFlaRTGlopsX4RUr79DscWszmB8b PvOTMZ/Zje2FeFenOosF179eV+2gHKT+RhYyJJxeqalnyvaFj/Ko9I0uRe1njB26FVIu if4zwr6/CLuEGz7bb0ftItu0VKeJFDYb3ldhClkNqMbeI75zlVEdeD2DrvgaLePddd8C xZtLIB83w2j6hsppp8THKQDIx0y26rOZuf4miBG9qpshQKHxl9uAt3StG5ztrUC8RoYp S58COHsH9YR141+iYlNzVv3Z8O57oS3p220BASIl8IMnBbddAy2l4VCsEiuLe+OF0x2b tG/Q== 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=eJrHQQjhKt9gIC6jCMaowxpySZX08t9tO93W4QN7vmp2EjZhfROSwvAD4FewvdLs3R 7Hfvkkjv8B99k07J+wqTh3KKCtJ42IekVs5aveLStKrpVevKpm+RVGvbB3IPTBv/Kapv UNcr3tuugHX2biD4JNpccrjMyFaJmTCBiQPKrKQY76FnVaLN+cdIhF5CZHEtbWjXbeVJ ciUttyRitbefkYPChp8VESBtXshRP6lY+oQFCb8LwJMvjTfn/WuCrfnfY/CXgg3RTa+6 74cDLDHHkhuBRQIlwLw1BnhVgYb8IwPmN8cSIR/W3O9lGvplX1k5AmWeAwSZzyJuChCk zRJA== X-Gm-Message-State: ACrzQf1FT1UHxNVsNK4k9UFPJHv9XRqW1VjoAkcNt+6eAlvvFMYqm1gB ciG+KcL5FB92OOmWX/fYlOE5oL0ja+CDKg== X-Received: by 2002:a05:6602:2dc7:b0:6a5:14e5:d709 with SMTP id l7-20020a0566022dc700b006a514e5d709mr16658698iow.54.1667427105992; Wed, 02 Nov 2022 15:11:45 -0700 (PDT) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id f8-20020a02a108000000b0037465a1dd3fsm5073974jag.156.2022.11.02.15.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 15:11:45 -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 v2 2/9] net: ipa: use ipa_table_mem() in ipa_table_reset_add() Date: Wed, 2 Nov 2022 17:11:32 -0500 Message-Id: <20221102221139.1091510-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221102221139.1091510-1-elder@linaro.org> References: <20221102221139.1091510-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