From patchwork Tue Jul 19 18:10:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12922869 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FA08C433EF for ; Tue, 19 Jul 2022 18:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239886AbiGSSK2 (ORCPT ); Tue, 19 Jul 2022 14:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239873AbiGSSK1 (ORCPT ); Tue, 19 Jul 2022 14:10:27 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D729225E97 for ; Tue, 19 Jul 2022 11:10:25 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id i5so706304ila.6 for ; Tue, 19 Jul 2022 11:10:25 -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=GydoS3ZwbH2ashV0ARHB9uLsl1jsbJOmyGYX9pK0bwga/hwcM6R5EkxSpkNqWT49rf 17gVkwd4IubfaeKslpxx0vdy4tYPSYbLt6W4lSUnzHKmd7YjP2uh9d48LKGLK1Pm0bDf 6TmhR3Oo438rxzibgNhrc7wj8QsegrCE4zbuEWhVqrUwjbPrrafnsYWEqzqMlHTssT09 yCivqcIzTW5nHPBghhbn4kK3SvW3KcPJEAWfqJ1xnp40ryyHSkXhip32Lh9MLsbBqK5I dMGgbsMTwJIyEHOTcYTBU66QJBhesM1fA//P2V64IQZ3MK0jhPx7ymW7kneRmuQiE0jk P9KA== X-Gm-Message-State: AJIora+9WcrdWkCyAncaA4BpRMb5Dl6DBtDajksW1GNpwsxd8DnqpA5/ F+Yjw9a1geBeLCpbUmicuEs+DA== X-Google-Smtp-Source: AGRyM1tvR+7gAXrdskYPMbxFeak6h5GHdpmtt2p0zWyuTfpwuDxk+dSf7tSEWo6wecMbLvLlSfGqCA== 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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); From patchwork Tue Jul 19 18:10:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12922870 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80BA5C43334 for ; Tue, 19 Jul 2022 18:10:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239908AbiGSSKa (ORCPT ); Tue, 19 Jul 2022 14:10:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239888AbiGSSK2 (ORCPT ); Tue, 19 Jul 2022 14:10:28 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 994F453D09 for ; Tue, 19 Jul 2022 11:10:27 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id h14so885054ilq.12 for ; Tue, 19 Jul 2022 11:10:27 -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=tjQd+IiiTzNLW2LdbGs9lPQ9GQarVE74SKVcOuBSN/0=; b=EO6nnGG7AnCHdAhOKx3ZvF6ZgT16cSGoVTK2lq/NLCf6BjUKWa6H0KbE7hvaWjALeV BiVR2FK3/AkDHidYSZtYsMUdlIM3Y0qUgE2oXOAKslRGn92MOh9uiT3nWSIJU/a9rxwd CaclPQ0DQE4Wujh6tRa8pCCIlMwe9+49hUD55grWtDedItC0M3UIbYb/zSoWreUtRDaV iMDptTymrRSzvdlbOc8HLpuoiSN0s24TtuNyHPSYJY49QLZ/LUHUmW71AyJya3Z+xz6J utAwm1Bm9SimKKZVZH3BOAbDqpbG+lDAyvnNHAAbSxNfdh7CiCvuvcJAyvBgnUCBC0jH Mi9g== 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=tjQd+IiiTzNLW2LdbGs9lPQ9GQarVE74SKVcOuBSN/0=; b=R5nQSU5AiUyfXXKIKQexyHpP5XaP1roAvqxLaKgj40f0wPZMHXpgcMFV8N6WxJ2IeC MuDnA+tAItMZti53vkW/sOkX+YSafiMV4lOOC8taQpf9Bwklj8DnfoBXlfdghqvVPjfM R0xgpC9Ou4K3kS62U2PqQyzZTyPW99FUs02Tgkym5po4QamN7n6PEwpqIxdRHzDgyot6 FfftyZ+n1jgQUaScoe9TctlXgK9sydzabj3Ks8EeFhuzBluvKM4xoM0LzJpfIwoPqqkV Wv/Ip5XE9FILqVf7Gy/mvKJZcLFBEH5SR0m8uwiG0lutKM6GeRJqQSdG9k2UL+rUV1i4 gt6w== X-Gm-Message-State: AJIora9jp3e6LlWc1+/hBaRAH+pR1OX883puB4VHJDk1Y/oyq1kOwY5C KzI0ow7VTQdT37tcKIvRAXlFXg== X-Google-Smtp-Source: AGRyM1u7S9eNd8lYMwmXC70qfb3yIKJ3nAd7Nlrel79rGyVB2YMxLPaLX9QSd8SPdAZOrBiXwcDZKw== X-Received: by 2002:a92:c549:0:b0:2dc:949f:5514 with SMTP id a9-20020a92c549000000b002dc949f5514mr16200897ilj.301.1658254226976; Tue, 19 Jul 2022 11:10:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:10:26 -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 2/5] net: ipa: rearrange transaction initialization Date: Tue, 19 Jul 2022 13:10:17 -0500 Message-Id: <20220719181020.372697-3-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The transaction map is really associated with the transaction pool; move its definition earlier in the gsi_trans_info structure. Rearrange initialization in gsi_channel_trans_init() so it sets the tre_avail value first, then initializes the transaction pool, and finally allocating the transaction map. Update comments. Signed-off-by: Alex Elder --- v2: Fixed the misspelling of "outstanding" in two spots. drivers/net/ipa/gsi.h | 3 +- drivers/net/ipa/gsi_trans.c | 60 +++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 1c8941911069d..c197df64e69a2 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -82,9 +82,10 @@ struct gsi_trans_pool { struct gsi_trans_info { atomic_t tre_avail; /* TREs available for allocation */ struct gsi_trans_pool pool; /* transaction pool */ + struct gsi_trans **map; /* TRE -> transaction map */ + struct gsi_trans_pool sg_pool; /* scatterlist pool */ struct gsi_trans_pool cmd_pool; /* command payload DMA pool */ - struct gsi_trans **map; /* TRE -> transaction map */ spinlock_t spinlock; /* protects updates to the lists */ struct list_head alloc; /* allocated, not committed */ diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 45572ebb76e95..3f52932e9e413 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -709,6 +709,7 @@ void gsi_trans_read_byte_done(struct gsi *gsi, u32 channel_id) int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; + u32 tre_count = channel->tre_count; struct gsi_trans_info *trans_info; u32 tre_max; int ret; @@ -716,30 +717,40 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) /* Ensure the size of a channel element is what's expected */ BUILD_BUG_ON(sizeof(struct gsi_tre) != GSI_RING_ELEMENT_SIZE); - /* The map array is used to determine what transaction is associated - * with a TRE that the hardware reports has completed. We need one - * map entry per TRE. - */ trans_info = &channel->trans_info; - trans_info->map = kcalloc(channel->tre_count, sizeof(*trans_info->map), - GFP_KERNEL); - if (!trans_info->map) - return -ENOMEM; - /* We can't use more TREs than there are available in the ring. + /* The tre_avail field is what ultimately limits the number of + * outstanding transactions and their resources. A transaction + * allocation succeeds only if the TREs available are sufficient + * for what the transaction might need. + */ + tre_max = gsi_channel_tre_max(channel->gsi, channel_id); + atomic_set(&trans_info->tre_avail, tre_max); + + /* We can't use more TREs than the number available in the ring. * 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 - * this maximum number. + * it to something a little less than that). By allocating a + * power-of-two number of transactions we can use an index + * modulo that number to determine the next one that's free. + * Transactions are allocated one at a time. */ - tre_max = gsi_channel_tre_max(channel->gsi, channel_id); - - /* Transactions are allocated one at a time. */ ret = gsi_trans_pool_init(&trans_info->pool, sizeof(struct gsi_trans), tre_max, 1); if (ret) - goto err_kfree; + return -ENOMEM; + + /* A completion event contains a pointer to the TRE that caused + * the event (which will be the last one used by the transaction). + * Each entry in this map records the transaction associated + * with a corresponding completed TRE. + */ + trans_info->map = kcalloc(tre_count, sizeof(*trans_info->map), + GFP_KERNEL); + if (!trans_info->map) { + ret = -ENOMEM; + goto err_trans_free; + } /* A transaction uses a scatterlist array to represent the data * transfers implemented by the transaction. Each scatterlist @@ -751,16 +762,7 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) sizeof(struct scatterlist), tre_max, channel->trans_tre_max); if (ret) - goto err_trans_pool_exit; - - /* Finally, the tre_avail field is what ultimately limits the number - * of outstanding transactions and their resources. A transaction - * allocation succeeds only if the TREs available are sufficient for - * what the transaction might need. Transaction resource pools are - * sized based on the maximum number of outstanding TREs, so there - * will always be resources available if there are TREs available. - */ - atomic_set(&trans_info->tre_avail, tre_max); + goto err_map_free; spin_lock_init(&trans_info->spinlock); INIT_LIST_HEAD(&trans_info->alloc); @@ -771,10 +773,10 @@ int gsi_channel_trans_init(struct gsi *gsi, u32 channel_id) return 0; -err_trans_pool_exit: - gsi_trans_pool_exit(&trans_info->pool); -err_kfree: +err_map_free: kfree(trans_info->map); +err_trans_free: + gsi_trans_pool_exit(&trans_info->pool); dev_err(gsi->dev, "error %d initializing channel %u transactions\n", ret, channel_id); From patchwork Tue Jul 19 18:10:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12922871 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FEB5CCA485 for ; Tue, 19 Jul 2022 18:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239936AbiGSSKt (ORCPT ); Tue, 19 Jul 2022 14:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239906AbiGSSKa (ORCPT ); Tue, 19 Jul 2022 14:10:30 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16BBF49B65 for ; Tue, 19 Jul 2022 11:10:29 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id v1so4456481ilg.4 for ; Tue, 19 Jul 2022 11:10:29 -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=/3MfEitAhQ9m4E4qshsdwyq7KEKS1kBLIYYx8abdrwU=; b=TZsIhSJTBMWwUdtFn9SdzGFEBkIEt7VEc5hLI+MOxa/tg7n2v9bpQi6ip9v/QG2iTK Qaz5UvLQewEPwkpNGixWzAijnOGNseRYImRHPEg8hwp29exhXSwN/e1mhaD9lslz5hEi FgjSxqwxN50uBlo9AzeSnrTsdxB0sJuTpUnhQfDM8Ds2hoQRxY52VTAeRCgT6kUPV0gQ ibYnTfKReRhs25zWt2qMfIEQBc1cYE3Y2Ty8V7BtMG4dhEbFOf0Qbwh7bvgMAbcK5xBK QOwOzFz8DUHOh/pVlPUGdVOEYiJhuN96qCJcM4WQsu0wr4y1+BgTCtrq4ZQdoMsCTrMp kH7w== 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=/3MfEitAhQ9m4E4qshsdwyq7KEKS1kBLIYYx8abdrwU=; b=7QSiAyt5pI0CwzCdTB+nxrjniqt9/hMdct36iVDWjPDfhA3ldiJLgVC9wx9Onic111 V3usDop+TBX3cTX/5LxZsIKkNJ/L1+tBHDHT/pc67xW/r6DS+BF2RRfz0cd76tWHCPWH Av1VggB9o6R/ceyfmEeqtiYftk1DtXlgR6xqFbiks1jgXE52L0tFoE4PjH0yTg0VbyL7 hZBxGRYwKbTCbr1BZbvvD9ARp8bAf8OfqJMyvMiJ6seo8EAlOBCweu1FZgkmugzFeDIa GOOKFJpwTpPLmWMXWTqVQUv7g3P17FZopsej7p/DmFAggT+d5EycQ2Z3EpwIqGf7yuQT xQUA== X-Gm-Message-State: AJIora/PIp6XiWgwgTHm6sdZ4gDwQBefIBe5bbNGKWO04phNC2elejwR itO4JbHntlgo2NxMbVHNySTC7w== X-Google-Smtp-Source: AGRyM1sn7FBERUYrR/ZZP+/wK8XOYGVK73yeLvwb5PyiIU82qXUYzUSU61ptK51fzkm8K9NVNRSDXQ== X-Received: by 2002:a05:6e02:1bcd:b0:2dc:dc40:c08f with SMTP id x13-20020a056e021bcd00b002dcdc40c08fmr7563904ilv.18.1658254228381; Tue, 19 Jul 2022 11:10:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:10:28 -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 3/5] net: ipa: skip some cleanup for unused transactions Date: Tue, 19 Jul 2022 13:10:18 -0500 Message-Id: <20220719181020.372697-4-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In gsi_trans_free(), there's no point in ipa_gsi_trans_release() if a transaction is unused. No used TREs means no IPA layer resources to clean up. So only call ipa_gsi_trans_release() if at least one TRE was used. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 3f52932e9e413..55987e35af2dd 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -404,7 +404,8 @@ void gsi_trans_free(struct gsi_trans *trans) if (!last) return; - ipa_gsi_trans_release(trans); + if (trans->used_count) + ipa_gsi_trans_release(trans); /* Releasing the reserved TREs implicitly frees the sgl[] and * (if present) info[] arrays, plus the transaction itself. From patchwork Tue Jul 19 18:10:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12922872 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1807FC43334 for ; Tue, 19 Jul 2022 18:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239917AbiGSSKu (ORCPT ); Tue, 19 Jul 2022 14:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234662AbiGSSKr (ORCPT ); Tue, 19 Jul 2022 14:10:47 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38ABC54058 for ; Tue, 19 Jul 2022 11:10:30 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id i5so706427ila.6 for ; Tue, 19 Jul 2022 11:10:30 -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=g+HjSH1OT4ZSTM+eXDsDJSu3gPtVsd7iXr5tehMDAHk=; b=GHdqy9jwnxqOSDBsP91TeeCtjW2CEr8BcF4twe6kX3kictIQcvbYlfaH/OghejF6mH jwhhslPX6XiVzOkR4asjq1sG0dIcK+lyG5uWWqbyfYkF2WDM4qy48S5pLQPTXzl7pnn9 9TBcOW98nIa6gU0oKAqRhHGxwZrqqJNna1Qyv43MVJIfP/5plnE9yXH2fc7Rtybgu+Nx VbrESdeHqySuOt2QdJB+hHPh2dzInHmXPdRzRpwJNq2Pdesnc3b7wYoKkjjE03CZ35O4 DnrFTQ2M3aLWTvMyDGcN28usWf8a4GABrds/ykzDmUhhA/YxQo6B6dmS76P0GbDS8j3R bnbg== 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=g+HjSH1OT4ZSTM+eXDsDJSu3gPtVsd7iXr5tehMDAHk=; b=UCNXbrRnmZ0yLEXvzLZ4mHPspYOVAbVtytaGt8v6OvwiBrA3ICBr7Dstb5tj7P+I1r NEOkvPvhaqIfj0kM44si6/31aDpUzPHu3cwx+DDNSItVAtwF4q9jExoUKMbuUeGXA1I+ fPeWrn51CAy9zY54vrFM/dXnbGDl0cZKFyhvBuh354QbYrnli+bv1NQfMTVXq/Jer0AW YaIGgdpxeh2BKeyLxBNRNHIoPV46/akq++XhP0wSzau8mzQmoH2HMJT95cpKQOeIcr5F mMsiggx3tGgmVKLCwD16DGba5EPcpFEFyWzr0V//6IZw0LZx6Ihr91lqwavAIb8mbuBp rJEw== X-Gm-Message-State: AJIora9vm2DlhZ4BdxzSzM7cVgm4E0LjwzNVbyS/Xs/tHOX+nAxVO4kD Z9oQ2e48tj4aqgsqYjSVR/dMMw== X-Google-Smtp-Source: AGRyM1uHKrocN4CdjfBxEuzXdoxSqvRVIcF8w3G7sFbu5gzkImHx+JcjlbyeUGkiqmWs74UGS4SgmQ== X-Received: by 2002:a92:d64a:0:b0:2dc:fa9f:7b27 with SMTP id x10-20020a92d64a000000b002dcfa9f7b27mr3197376ilp.173.1658254229837; Tue, 19 Jul 2022 11:10:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:10:29 -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 4/5] net: ipa: report when the driver has been removed Date: Tue, 19 Jul 2022 13:10:19 -0500 Message-Id: <20220719181020.372697-5-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When the IPA driver has completed its initialization and setup stages, it emits a brief message to the log. Add a small message that reports when it has been removed. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 3757ce3de2c59..96c649d889a7c 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -836,6 +836,8 @@ static int ipa_remove(struct platform_device *pdev) kfree(ipa); ipa_power_exit(power); + dev_info(dev, "IPA driver removed"); + return 0; } From patchwork Tue Jul 19 18:10:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 12922873 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06033C43334 for ; Tue, 19 Jul 2022 18:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239900AbiGSSK4 (ORCPT ); Tue, 19 Jul 2022 14:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239924AbiGSSKs (ORCPT ); Tue, 19 Jul 2022 14:10:48 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8829A54656 for ; Tue, 19 Jul 2022 11:10:31 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id h14so885158ilq.12 for ; Tue, 19 Jul 2022 11:10:31 -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=KhaRQXijU7X7QmaQEbJg0rB5xqhYmbZCHiU1aLyghl0=; b=cT/qMGKV+2myXeCJjPngGGYo3SfWAsIwPQiV98pzR666eLHS2DZ1mIOf/LqGePwL9u f0Jw/BuoJ6IHMNucTxjuXvy/hK4RiHqRBZsLDyijKnahK+zA+/drlkyy3YHg+jhP6Z0N Jzx9xWY/AIfpjGmqaDRosNihj5xylH1VulSciNlJ03QpLd0DonYFFKbnsgDnJmW79Dm7 0iol8fJxSaqIzTx/lk4iXcCm1kF4Iy4FPud87c60LEyl6k91fHVLUrHla4KPAc3cPLvh Pd1PWLcDYONQDLvdRnAPEhYTZBi/NYZ45BGETu3MQrpwcvavFL9xno15lPJycmJCjSty JEpg== 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=KhaRQXijU7X7QmaQEbJg0rB5xqhYmbZCHiU1aLyghl0=; b=UEoeLq+P+27Tlw4tZF9kZgu/15L2EtLIfKw9dZmJ1WGCR+MTZYbcJjiWC+gVj/5Psm bzGHHBI3hBGJAUm/GupbN8M0RYiHC9WVaNS4eU8Wlj8wKljY1rqg3BADWdQ/CUdqLQOe c5NeivrB4Q9+n5G2sbj6kS83VB3gqz9yKA8Lt010/sWR5qnCu15Edpt0ajCAO31my15h NbXzIcYCS/ektG14h5AUEx7r+K5IGahtPdUi+SqyC0JnG/mHJX6lgI+G2MQhM5LTDcnv h8AeN+A+S4hatEM/ScNBUdBHscy3EHEOVAX4PmK5mL4k+MoHwfiuoIUbX/WyoDjLiHQ2 Sc0g== X-Gm-Message-State: AJIora9iOu30Yn4LkZP+zkllN6DI20UL65bxp+O1erYoE4u+08GRn+1u uNGnOCCsRPZ+cdpMsTY7juVNKA== X-Google-Smtp-Source: AGRyM1vYRI0fYrM4kBMueIGB2JLVtJZhd6JKwFFAqUc9U/AgZgLvNp8rhQeoRIsu6T+MJGc9oI7i5Q== X-Received: by 2002:a05:6e02:c86:b0:2dc:e139:444a with SMTP id b6-20020a056e020c8600b002dce139444amr6984067ile.96.1658254231231; Tue, 19 Jul 2022 11:10:31 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 11:10:30 -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 5/5] net: ipa: fix an outdated comment Date: Tue, 19 Jul 2022 13:10:20 -0500 Message-Id: <20220719181020.372697-6-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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since commit 8797972afff3d ("net: ipa: remove command info pool"), we don't allocate "command info" entries for command channel transactions. Fix a comment that seems to suggest we still do. (Even before that commit, the comment was out of place.) Signed-off-by: Alex Elder --- drivers/net/ipa/gsi_trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 55987e35af2dd..18e7e8c405bea 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -362,7 +362,7 @@ struct gsi_trans *gsi_channel_trans_alloc(struct gsi *gsi, u32 channel_id, trans->rsvd_count = tre_count; init_completion(&trans->completion); - /* Allocate the scatterlist and (if requested) info entries. */ + /* Allocate the scatterlist */ trans->sgl = gsi_trans_pool_alloc(&trans_info->sg_pool, tre_count); sg_init_marker(trans->sgl, tre_count);