Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4686375imw; Tue, 19 Jul 2022 11:13:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1syBZnP8l32yaVWB0P40EFIKRHbbXg3FCJ8/4WTak/Ozuefom+7yEwjE4ngNodYUsln+ctV X-Received: by 2002:a17:906:b6c7:b0:726:60aa:1b81 with SMTP id ec7-20020a170906b6c700b0072660aa1b81mr31933971ejb.383.1658254388827; Tue, 19 Jul 2022 11:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658254388; cv=none; d=google.com; s=arc-20160816; b=xG94AXtzVlTcMA19NuOGsdvFiqLQyoGTYeP4+q3/VkKDIXulYcTZ00Xge5T7TdqDEP uRXmOPcr9yj/m5HIGzwcRP5nwUeR4IzXcVJVWhez2iQYsA1CELG8pP11kRMyRb2k9Hdc 1f8uUuu5+b3+6Z0ZUrn4z7nSVeZuCa6RvRUjrXLAk1GnYca9tQB6NBoC7uK8apuDs/ns xP5LCsFidFsolkfc/iQJtL15KFG1fbG3P46iRCL5qfPRQdyOToe7TGiviyuAnnFuwazt zu5hjQVhzkGmDsWnxq3DqRiq9HosV9nDFJxSCK+p+d4fevndia5Z0WDLNZ0Nl5qmEP/a B3Kw== 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=RiJ6za5WGQV1BAnIZFKP4V1CTKa7dcOQ4Ym7UXXJgDw=; b=p1Gy0lzg9BNR2eSjhycA8kZ/yI8DOrdRX187dfJonK1WIHBQUk1+uE5RxuHI+02Oao 5twQbixMQqcPJYqvXzbXWFvW4FrdLQmrV15s8v+Tacba/EzLAeDSOXgE187sBY+UX3c6 Ik/0CpnXEoki12Lkx8yUCOTZPWtIoM1PtAI53UIAxg6UIsJ0iANEnqr90JgDAnV+GrRY /lcdQ1couZrSgoz7pBoQGnekMfUEehhaWubEb3TZaj26AC6qMt3qJgi/rZwWFIPgYL8B p7guIbU170+YQe/8P0mj4lE9D5D8Ebc0mqYosggdVMlQ0YgCwYGHxu9UA5YB+0/JPRYZ 81tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MI0cT46V; 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 p3-20020a17090628c300b00726c53b9203si17162102ejd.860.2022.07.19.11.12.43; Tue, 19 Jul 2022 11:13:08 -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=MI0cT46V; 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 S239905AbiGSSK3 (ORCPT + 99 others); Tue, 19 Jul 2022 14:10:29 -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 S239876AbiGSSK1 (ORCPT ); Tue, 19 Jul 2022 14:10:27 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F94E50199 for ; Tue, 19 Jul 2022 11:10:26 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id f1so2292250ilu.3 for ; Tue, 19 Jul 2022 11:10:26 -0700 (PDT) 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=RiJ6za5WGQV1BAnIZFKP4V1CTKa7dcOQ4Ym7UXXJgDw=; b=MI0cT46VeHZjWnA8I20bS8/dWwD6fXh4FOX8Ip0CBdhoLwLKwSwudRHHyBVKzJ+xio 7644dM7gQBSvsJRoe0L02+t7zdrDRLpmNuaCG7E5KXu1FJm9QnNgKfBhn7LgcZBqMeKO rKbWAbyjZcHB8nFi10JVGlCZfep8jUu2pe8ZTKyvFZghoTzrJT98I1kAb9CUXfk9uFI2 LQnEm4fWGdJuUfuiHT0qRp+KVNF+cQqT3FT3tu81HyY69Te/G3c5AzeNAc13l5DjUE1W U3yw/M7kPinYv8PYTNmfjKU6wmUT8dH6qo08NQFrkGqqg2VNt3tYzuTzY7Q9WJmgvGfw DzgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RiJ6za5WGQV1BAnIZFKP4V1CTKa7dcOQ4Ym7UXXJgDw=; b=vuRGlz+UqQWzYEF/027Eljir1shq6wMYk/kgGw0xrTVzSM+gT3cPY/QsgteC4uMnYu PBn761mtlxSnDo5EMG7coSuc2F+ubUD1gMldGAjlEW6Ma3SimZpAvdfsuIJJ9sn3UgcV S06LvG17RhfmfPaVhb3idq1jM0iSe+AnTzMGpP/oBuLXGBOmWygLQo9QfSrk/Y9IiboK b8agSuhkfEXaHNKeQ4I3kiUxI4VFHIGN+FM9TSgZ6nUbyCGX0eCHtP6/tb/6DnxIkItp uwlWj/UQQVyTsTCAqMr2l/5lMYcafJ8KVWwwPzg69n+VWFQNQOe24VhObk7hWqx7mchq C5XA== X-Gm-Message-State: AJIora8I22TYShn9j6iN/o8c+VMt1bZCeVuYNWiafHIqeHu8fOszFzCn 4XlwXQX29L8Ot9hSvarjS0yr+Q== X-Received: by 2002:a05:6e02:178c:b0:2dc:2783:aac3 with SMTP id y12-20020a056e02178c00b002dc2783aac3mr17297988ilu.142.1658254225533; Tue, 19 Jul 2022 11:10:25 -0700 (PDT) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f6-20020a056e020b4600b002dae42fa5f2sm6089552ilu.56.2022.07.19.11.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:10:25 -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 v2 1/5] net: ipa: add a transaction committed list Date: Tue, 19 Jul 2022 13:10:16 -0500 Message-Id: <20220719181020.372697-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220719181020.372697-1-elder@linaro.org> References: <20220719181020.372697-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 We currently put a transaction on the pending list when it has been committed. But until the channel's doorbell rings, these transactions aren't actually "owned" by the hardware yet. Add a new "committed" state (and list), to represent transactions that have been committed but not yet sent to hardware. Define "pending" to mean committed transactions that have been sent to hardware but have not yet completed. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 5 ++++- drivers/net/ipa/gsi.h | 5 +++-- drivers/net/ipa/gsi_trans.c | 26 ++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 4e46974a69ecd..c70fd4bab1d68 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -718,6 +718,9 @@ static struct gsi_trans *gsi_channel_trans_last(struct gsi_channel *channel) */ if (channel->toward_ipa) { list = &trans_info->alloc; + if (!list_empty(list)) + goto done; + list = &trans_info->committed; if (!list_empty(list)) goto done; list = &trans_info->pending; @@ -1363,7 +1366,7 @@ gsi_event_trans(struct gsi *gsi, struct gsi_event *event) * first *unfilled* event in the ring (following the last filled one). * * Events are sequential within the event ring, and transactions are - * sequential within the transaction pool. + * sequential within the transaction array. * * Note that @index always refers to an element *within* the event ring. */ diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index bad1a78a96ede..1c8941911069d 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -88,7 +88,8 @@ struct gsi_trans_info { spinlock_t spinlock; /* protects updates to the lists */ struct list_head alloc; /* allocated, not committed */ - struct list_head pending; /* committed, awaiting completion */ + struct list_head committed; /* committed, awaiting doorbell */ + struct list_head pending; /* pending, awaiting completion */ struct list_head complete; /* completed, awaiting poll */ struct list_head polled; /* returned by gsi_channel_poll_one() */ }; @@ -184,7 +185,7 @@ void gsi_teardown(struct gsi *gsi); * @gsi: GSI pointer * @channel_id: Channel whose limit is to be returned * - * Return: The maximum number of TREs oustanding on the channel + * Return: The maximum number of TREs outstanding on the channel */ u32 gsi_channel_tre_max(struct gsi *gsi, u32 channel_id); diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 29496ca15825f..45572ebb76e95 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -241,15 +241,31 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel) struct gsi_trans, links); } -/* Move a transaction from the allocated list to the pending list */ +/* Move a transaction from the allocated list to the committed list */ +static void gsi_trans_move_committed(struct gsi_trans *trans) +{ + struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; + struct gsi_trans_info *trans_info = &channel->trans_info; + + spin_lock_bh(&trans_info->spinlock); + + list_move_tail(&trans->links, &trans_info->committed); + + spin_unlock_bh(&trans_info->spinlock); +} + +/* Move transactions from the committed list to the pending list */ static void gsi_trans_move_pending(struct gsi_trans *trans) { struct gsi_channel *channel = &trans->gsi->channel[trans->channel_id]; struct gsi_trans_info *trans_info = &channel->trans_info; + struct list_head list; spin_lock_bh(&trans_info->spinlock); - list_move_tail(&trans->links, &trans_info->pending); + /* Move this transaction and all predecessors to the pending list */ + list_cut_position(&list, &trans_info->committed, &trans->links); + list_splice_tail(&list, &trans_info->pending); spin_unlock_bh(&trans_info->spinlock); } @@ -581,13 +597,14 @@ static void __gsi_trans_commit(struct gsi_trans *trans, bool ring_db) if (channel->toward_ipa) gsi_trans_tx_committed(trans); - gsi_trans_move_pending(trans); + gsi_trans_move_committed(trans); /* Ring doorbell if requested, or if all TREs are allocated */ if (ring_db || !atomic_read(&channel->trans_info.tre_avail)) { /* Report what we're handing off to hardware for TX channels */ if (channel->toward_ipa) gsi_trans_tx_queued(trans); + gsi_trans_move_pending(trans); gsi_channel_doorbell(channel); } } @@ -710,7 +727,7 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) return -ENOMEM; /* We can't use more TREs than there are available in the ring. - * This limits the number of transactions that can be oustanding. + * This limits the number of transactions that can be outstanding. * Worst case is one TRE per transaction (but we actually limit * it to something a little less than that). We allocate resources * for transactions (including transaction structures) based on @@ -747,6 +764,7 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) spin_lock_init(&trans_info->spinlock); INIT_LIST_HEAD(&trans_info->alloc); + INIT_LIST_HEAD(&trans_info->committed); INIT_LIST_HEAD(&trans_info->pending); INIT_LIST_HEAD(&trans_info->complete); INIT_LIST_HEAD(&trans_info->polled); -- 2.34.1