Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp279221rwb; Fri, 2 Sep 2022 14:06:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR5vKM/1BK8CN1+fwq3nP8O6KG1mN8z4v00cHxeY4Hoqj+2AOd8Y0cAPJsQQrYq+zndZvyHl X-Received: by 2002:a05:6402:71a:b0:447:ebb2:18f2 with SMTP id w26-20020a056402071a00b00447ebb218f2mr29652936edx.408.1662152775980; Fri, 02 Sep 2022 14:06:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662152775; cv=none; d=google.com; s=arc-20160816; b=Uty71nH/ddjqbXrn+gphO97wq5DcPiMDk7QNJimMNUiMIUQ1INd5NdG+qX8izD9LwM tp/6tsrVgY2IKib7zn4pcFi1YT9J4v1TU0TA6WrFWYkvUAaGFJ+MY4Nf8UFPyMwf1f1W 1zofAF7jWbZFtg422XmQHmPwnTCa9hD5vnClslrs3TRGYzvUwcvCGYvo9rFMY9ToAiDO YgSzFixReSt6hkWwsUioo0vEDMZPSvF+hkuIRTRDfppvygUI3MrEWMOsyqwu87+w8EzC 8RoIqeQehUUKDxprwHZ8j1gtJzMhNCzdfVfHfXJveBgoQScZotwZCumuYhXqvI9DU8uu XzxQ== 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=Hl3DE3DGBmmIurt4RnwSIbwXbwcvmQfsOkHdcjb4ehA=; b=Mciai3MSbsmPmBdgcA42kgNdfViuIT1wGWeOam3GswKrs9Ao8zusSwsiayLLwwuQ31 F4Kks5H/VGVt1yr7oX0VFokEutleO9Fae9VsxuLtRob5z5L0yIB2VqpanVbjLiMxTOh4 mbsuwNpn6j9aeT5xqF1cjKMI8snWC56aOWffPc5Zv4O7JrFFTZbxT6lMw8gVKDoBZbIj 5FKquza0eLmMxFBFbsx4wyvbaVo8T7803c/Edxa+31KxUCdM2aO8uRLOGLIVV7cduzoZ BvU6EjrYSNxxpxU89kXTyhxcaoAfuZjY1vMRUyS19TxX8SE8tbnw1w9zyLCpV21Xm6Td T4dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIFAP19q; 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 v6-20020a056402348600b0043c2919cfd3si2516860edc.602.2022.09.02.14.05.47; Fri, 02 Sep 2022 14:06:15 -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=nIFAP19q; 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 S230502AbiIBVCe (ORCPT + 99 others); Fri, 2 Sep 2022 17:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230460AbiIBVC0 (ORCPT ); Fri, 2 Sep 2022 17:02:26 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B37EAB4E84 for ; Fri, 2 Sep 2022 14:02:24 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id p187so2635659iod.8 for ; Fri, 02 Sep 2022 14:02:24 -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; bh=Hl3DE3DGBmmIurt4RnwSIbwXbwcvmQfsOkHdcjb4ehA=; b=nIFAP19qCeoYKPNI7pbOjx3eI6VLjPRIQwMe1yCLxXwR/qvklSstwH5D2RrS3K1ekL B/nFskNKtZLOfjx6Ro5SJnDLg2SkF2Doao6PZd/B+8hvr1pS/HzhdNKG40sWUA/Ymaq8 boBbWsnHZ9VEPqeVngwQ1Ac5bg5ixgmE0TexIIcZl+5/ZUL2cxgMMCBGs+OTpYpobd0L 1ZPKkKlNoS/zVoFNSMoYC2QKgXc8gWAIuYlS5kpslpk2sYKjm6lyJJv53fP5xd4LoSt4 GvGMGxG0Gu/qeG6UcU/LWRGVIYRcCcz5VTCk/NIiuc5KMbc/lkPQOfZpwJ7+ThXabsjN B1Sg== 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; bh=Hl3DE3DGBmmIurt4RnwSIbwXbwcvmQfsOkHdcjb4ehA=; b=z2dZnT9BfBQa9LTbMPckbCkPbq14SidxUo84NNO+pq9NvmiHuEVsIr2MGTyo8PpOfd 7oFrHCKiKl0qIFDks2+VdolXNrQ1nYoo/nG5D1b9cgBZeCPmMUmOeqKPbj8JanTolMBC 9fPwZR7eeAoPF8bkn0rVzRUVTzffn212lL4ljKHNN+qR5yq612N725OKlpWGoe9RKt63 iidzVHDcaGihm9NzAk97hhTREf9HlSn9cAJ3i61cEyDQ+XMqTA4+CXOb3qrLj0aq8dsZ YWVAG1nzaTg5dKetGx/zAFEXUUdE1l0e6RGVRRly5M881JWT9vh1N+1u99bagt0bZYvI oJ0A== X-Gm-Message-State: ACgBeo1WpgBxcFxBsU18Ezj5VCPG/H8kMXa6qbG1vfN6sf5w6rZWWpTx GvEEV49Qc8wx1TWoTG+pdpzxew== X-Received: by 2002:a6b:5d01:0:b0:688:ac7c:95ec with SMTP id r1-20020a6b5d01000000b00688ac7c95ecmr18308999iob.142.1662152544086; Fri, 02 Sep 2022 14:02:24 -0700 (PDT) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id i7-20020a0566022c8700b00689e718d971sm1259208iow.51.2022.09.02.14.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 14:02:23 -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, bjorn.andersson@linaro.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/6] net: ipa: use IDs for last allocated transaction Date: Fri, 2 Sep 2022 16:02:14 -0500 Message-Id: <20220902210218.745873-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220902210218.745873-1-elder@linaro.org> References: <20220902210218.745873-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,T_SCC_BODY_TEXT_LINE 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 Use the allocated and free transaction IDs to determine whether the "last" transaction used for quiescing a channel is in allocated state. The last allocated transaction that has not been committed (if any) immediately precedes the first free transaction in the transaction array. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 0ea98fa5dee56..135e51980d793 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -711,6 +711,8 @@ static struct gsi_trans *gsi_channel_trans_last(struct gsi_channel *channel) { struct gsi_trans_info *trans_info = &channel->trans_info; struct gsi_trans *trans; + u16 trans_index; + u16 trans_id; spin_lock_bh(&trans_info->spinlock); @@ -718,10 +720,14 @@ static struct gsi_trans *gsi_channel_trans_last(struct gsi_channel *channel) * before we disabled transmits, so check for that. */ if (channel->toward_ipa) { - trans = list_last_entry_or_null(&trans_info->alloc, - struct gsi_trans, links); - if (trans) + /* The last allocated transaction precedes the first free */ + if (trans_info->allocated_id != trans_info->free_id) { + trans_id = trans_info->free_id - 1; + trans_index = trans_id % channel->tre_count; + trans = &trans_info->trans[trans_index]; goto done; + } + trans = list_last_entry_or_null(&trans_info->committed, struct gsi_trans, links); if (trans) -- 2.34.1