Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1121876rwj; Sat, 29 Oct 2022 17:21:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Gv+f78j/yz1iHEPoualU6hPMv8U1LtHPkWz0hE/Z1Gw14rBcy3Xdj+qDnP4cEM4d+fOZV X-Received: by 2002:a63:8b42:0:b0:46f:5bd0:1ae2 with SMTP id j63-20020a638b42000000b0046f5bd01ae2mr5852229pge.422.1667089293985; Sat, 29 Oct 2022 17:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667089293; cv=none; d=google.com; s=arc-20160816; b=CO6IFRkKGMlsHmYMuafNNNDkUY5yfjyfEd3XYE9i22sBcQq9KDVW+tu8oW5y6NceIt +O5tOnqXJF/WqwWALptdPOhxXXU6PnpsIvYmX3glShwF8f+/4XzXeNJSTrSPG6Mzq4VM 5z4fVRe0OfsJne8RkFIFfokbm/ZS3WYfgrdpCJzuWZWcNqlw+j+yXFKzLTKzTeRw5FQJ d1Tyb7dsfpj94W4eJqb7eSqlgWEH/tSi477+DY+lqtG1jrjHKdYXWtDUHJRiMMt/4seG FAZGX7X2NvlWEu8xrh/LGqoCuel0z7zbKxk1q3OvzkzbI31BX2GWFwtv1883sUKXhS9e RiTA== 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=XGjf4m+z8VLv96itNVJOvkxO2bjdazwhjFdsDMTWA4k=; b=qGtPXUuYWxHZnHELvXYuwf8MoyUeDeOmd/TIPAcLIkPl8ylFmfHA/lFLFlG/+WEQEi 4wnINJo0y5vob6obF/Wm3946drQAMstB1FPg5Cr8UvIZMPVE6SO78iPD6nF+zw1iT6E8 trBsIqNOspLEn1zwKgJQ88PvV1N1+HZCKekmEnBwKUytHru2PZa1jRdbqF+YiYUFOhJ8 ns6EH/d/CTYkMfUsJiE+GjmsJHp3knv4DgFIRA6B99oQ9M/YySb+3EZCDblmChr0RylH aFK3LRcAzZ3f4IzVkvCty/3TKNh4YLTsA6a9iBJbVcTRXWaRysIwcJlKw6mjTxaaAoys Tqew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b7X1PDwI; 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 b9-20020a170902d50900b0018683763131si3912341plg.501.2022.10.29.17.21.23; Sat, 29 Oct 2022 17:21:33 -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=b7X1PDwI; 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 S229871AbiJ3AT1 (ORCPT + 99 others); Sat, 29 Oct 2022 20:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiJ3ATB (ORCPT ); Sat, 29 Oct 2022 20:19:01 -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 216364F64D for ; Sat, 29 Oct 2022 17:18:51 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id z3so7385622iof.3 for ; Sat, 29 Oct 2022 17:18:51 -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=XGjf4m+z8VLv96itNVJOvkxO2bjdazwhjFdsDMTWA4k=; b=b7X1PDwIHi4vLETogYLVomhE5cORrmJwMBi0/Vo0RRDUfBQPcTKE98mLeyF77BtQQe iO6W+BtVVprtLo2jQ8IxgWYkyGPwkfSiM1tpnriJZB9WLPw0SedYvEIHnQrnjNojEImV 4lKvcE97hdpg+ukZBF0w9voOv/GL5iygsF9iI5gyMPYcfgdneR+ho1f0/tZcC2P3orr0 KUwg9Y4DG5qE0WXMUV8MxCG8vj9b+Nyny3wFNP11GjcT20DqrhOrwVL0CTZW1+TVm/EA XVFrxSucJIyyt8V673dFnd6RgihT970DxPOXOjA+LOQz6WpB8/te/xdEQTMFzWQTH46U CzFA== 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=XGjf4m+z8VLv96itNVJOvkxO2bjdazwhjFdsDMTWA4k=; b=oATkpp2ZYCtXWs7fUeBnXx0c5nQ8oDhTErCjM1kB9hYoKkWvxa+H3BmezEuUEGt3Lz iYf9GGKMT7FYr6A2Ta/P6sEfHy22Ue/7awv3Dmi/D+oj8fgc3O9QkyN4MHCkrVRqG6Z6 W9GfjF2G+jK0+kUH/iJtjDmyzHgpTO52AeeccZ8hnKCUXfxc0C2PQg66dQg/b0Bn1ZGk BYLEWzhRZ2ewSGzaK5Qy9KusPxYODu0F7nuR1PCqqblDEKRTX5UDj3CyhauyQu2Kx5+H G/j5Ke2v2oXbBghKUHpyWcm3xcu4PfS3t9q83WqJNJRfWcsLSjYOP0FOn24QqhwyaH5g 3Nvg== X-Gm-Message-State: ACrzQf2Fpyb/s0tSdWtq5LhkOxVGQt8znhBfc/Anvyrpz6I0DSiO9rqa fegX0rmJneFEXOHzgBpQoFpkzw== X-Received: by 2002:a05:6638:35a2:b0:375:21c3:f5cf with SMTP id v34-20020a05663835a200b0037521c3f5cfmr3380037jal.229.1667089130772; Sat, 29 Oct 2022 17:18:50 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 17:18:50 -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 8/9] net: ipa: use a bitmap for set-up endpoints Date: Sat, 29 Oct 2022 19:18:27 -0500 Message-Id: <20221030001828.754010-9-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=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 Replace the 32-bit unsigned used to track endpoints that have completed setup with a Linux bitmap, to allow an arbitrary number of endpoints to be represented. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa.h | 4 ++-- drivers/net/ipa/ipa_endpoint.c | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index 557101c2d5838..f14d1bd34e7e5 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -66,7 +66,7 @@ struct ipa_interrupt; * @defined: Bitmap of endpoints defined in config data * @available: Bitmap of endpoints supported by hardware * @filtered: Bitmap of endpoints that support filtering - * @set_up: Bit mask indicating endpoints set up + * @set_up: Bitmap of endpoints that are set up for use * @enabled: Bit mask indicating endpoints enabled * @modem_tx_count: Number of defined modem TX endoints * @endpoint: Array of endpoint information @@ -124,7 +124,7 @@ struct ipa { unsigned long *defined; /* Defined in configuration data */ unsigned long *available; /* Supported by hardware */ u64 filtered; /* Support filtering (AP and modem) */ - u32 set_up; + unsigned long *set_up; u32 enabled; u32 modem_tx_count; diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 923299cc46fe5..564a209f75a0f 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1802,12 +1802,12 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint) ipa_endpoint_program(endpoint); - endpoint->ipa->set_up |= BIT(endpoint->endpoint_id); + __set_bit(endpoint->endpoint_id, endpoint->ipa->set_up); } static void ipa_endpoint_teardown_one(struct ipa_endpoint *endpoint) { - endpoint->ipa->set_up &= ~BIT(endpoint->endpoint_id); + __clear_bit(endpoint->endpoint_id, endpoint->ipa->set_up); if (!endpoint->toward_ipa) cancel_delayed_work_sync(&endpoint->replenish_work); @@ -1819,23 +1819,16 @@ void ipa_endpoint_setup(struct ipa *ipa) { u32 endpoint_id; - ipa->set_up = 0; for_each_set_bit(endpoint_id, ipa->defined, ipa->endpoint_count) ipa_endpoint_setup_one(&ipa->endpoint[endpoint_id]); } void ipa_endpoint_teardown(struct ipa *ipa) { - u32 set_up = ipa->set_up; - - while (set_up) { - u32 endpoint_id = __fls(set_up); - - set_up ^= BIT(endpoint_id); + u32 endpoint_id; + for_each_set_bit(endpoint_id, ipa->set_up, ipa->endpoint_count) ipa_endpoint_teardown_one(&ipa->endpoint[endpoint_id]); - } - ipa->set_up = 0; } int ipa_endpoint_config(struct ipa *ipa) @@ -1977,7 +1970,9 @@ void ipa_endpoint_exit(struct ipa *ipa) for_each_set_bit(endpoint_id, ipa->defined, ipa->endpoint_count) ipa_endpoint_exit_one(&ipa->endpoint[endpoint_id]); + bitmap_free(ipa->set_up); bitmap_free(ipa->defined); + ipa->set_up = NULL; ipa->defined = NULL; memset(ipa->name_map, 0, sizeof(ipa->name_map)); @@ -2001,8 +1996,11 @@ int ipa_endpoint_init(struct ipa *ipa, u32 count, /* Set up the defined endpoint bitmap */ ipa->defined = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL); - if (!ipa->defined) { - dev_err(dev, "unable to allocate defined endpoint bitmap\n"); + ipa->set_up = bitmap_zalloc(ipa->endpoint_count, GFP_KERNEL); + if (!ipa->defined || !ipa->set_up) { + dev_err(dev, "unable to allocate endpoint bitmaps\n"); + bitmap_free(ipa->defined); + ipa->defined = NULL; return -ENOMEM; } -- 2.34.1