Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4709907rwb; Tue, 6 Sep 2022 11:22:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR6mrWVnKlUSsMzKbkANZbvSo8qV6+JgfDRaKfQAIg2acNN6AcDYyz9X+IW2jlPJ0NlBVm4J X-Received: by 2002:a63:5a41:0:b0:430:673e:1e13 with SMTP id k1-20020a635a41000000b00430673e1e13mr25450374pgm.435.1662488542160; Tue, 06 Sep 2022 11:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662488542; cv=none; d=google.com; s=arc-20160816; b=o+hs9+ldGwayjg76+Ir80oENur9C4pv0gKloCe3p9FAWEUlEOu42+r1gwTzgtH+B9S nayidER7XaJCAEB7+vIDfTGeJ7TS+ao0Kqd1HCpqyzLLMQudtAg27qsuMxT6beECvsrc X+ibhDtUKilE4QxUC/5SqE8Zz/isJeJd3uKJPPpeI6z9tsJkrf3sGRFxUYhr5PF9FwUO QZjpsjo5CO7yz7mVxYZwdRvn+8p+l+8dcjs+0oagR/95haHlM66B0Pf5AaGP9GV1+wxX Ahj5uHlISJRybGeaeZPXAprj3+4hvdkO+P9TKX4mo7gj5mOao2/+Pw6d4lN73iLovpwc IJ5A== 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=iyM6dtbNFzdJQR32hgHiDgJSwSi9j8lAYdcvFPMbXJQ=; b=C1o7fePp7zi+qbsUtYI9MDI5efl02Pm7oz8iTuOCZHQKzQF2td6y6pOr+T+dXy2IUK DCU0leY41FUlayL9BouG5XCV65S+yvN/WvmxC8sJyu5tjkZu6n+rhRfnFbAAZ2lCasbN yF3CUAxElOfE0sxWbS+5vHjc6YPSFa32DavtHuV+lZnUscG9GJjbI6HY1a8v9z7Kq3fm 0V3QZkjQJs14fLsg95pSiCuujIdVn7lFdyPo8QiOoNqBVhTNu2mt/8VOszH10414fYyD wRnnAAmJUaECZEYBT1uO6ynUU1ISxe7sO5fqCTTt1+kBHtHISe0IfQlqPV6POcCP0iQM xj8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JuA28ed5; 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 t5-20020a655545000000b0041a5a80428esi14820576pgr.750.2022.09.06.11.22.00; Tue, 06 Sep 2022 11:22:22 -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=JuA28ed5; 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 S239401AbiIFR3H (ORCPT + 99 others); Tue, 6 Sep 2022 13:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238669AbiIFR2J (ORCPT ); Tue, 6 Sep 2022 13:28:09 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE0532AE33 for ; Tue, 6 Sep 2022 10:19:52 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id r141so9485404iod.4 for ; Tue, 06 Sep 2022 10:19:52 -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=iyM6dtbNFzdJQR32hgHiDgJSwSi9j8lAYdcvFPMbXJQ=; b=JuA28ed5jfpBvyjkILaIrZc370JCraCfaVZn0DwL/4XC41roAyCqdnFq6wu5ilJPe8 eoWcn+CF5cnYMI+CZsOPAmW8Cm6SOsL0uoXmlXjgd0G933yf2HdAEPZATZgyeKG3643P wo8AEnhlzk4tT0kl7vimXVaDzY/I+Hc4FNG6Z4344k7fu+oXyf7Td6Nfs/+hXL0dKpRf twpDyDuurRHgnOt8Er1gujlyEHl4hi658FnSs0YYAMzlP47tpPxNwniaDiBsNltPXKti 8xswIFw9fL1e/NMq7A3wgMkrlIf7zYb3dQ1avCH+hoVmPaNcfEFCa6Fx4lif9SfuupIP 2RJA== 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=iyM6dtbNFzdJQR32hgHiDgJSwSi9j8lAYdcvFPMbXJQ=; b=Nmxl+kkCftNOOlEG+h7n+asVNITtC7tIDozPgwcmbBQP8HU4x7uQFyo1FAwzF5indY aC7nTI2zI2yHz6q6FLMnEhEcJ06EL2Ps05+WlWThYAsJurwF7Z5tk7Zi2rOd42W1wgy+ bqh6cnRJPcxD73UfwF/HmPXn4d/ceNQUj4LrOEi5SJ2jOj2b09lNKzl8a/rffa9qM05R 17PhGfumBYtRvvQiOdkQDE5PGpNZRHlYwgVphBzYHJ9qoUyg6niWtqyBPCgNi6410rH/ nlpGcwWg0KKSeVqEKGE5WN1lbsx01YznNWI/3GyneCN6dJfp4WbSV05saVrwt6bDix9B XXjA== X-Gm-Message-State: ACgBeo0RnrHNnCN2Ccv5EAmJJIfxTXssVU0Hd+VOgCjFlSWNxoXUoajx stCUnlvhMcz2PbxZHtZPH8JkyQ== X-Received: by 2002:a05:6602:2d41:b0:688:e962:2b53 with SMTP id d1-20020a0566022d4100b00688e9622b53mr25867027iow.79.1662484792111; Tue, 06 Sep 2022 10:19:52 -0700 (PDT) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id q10-20020a056e020c2a00b002eb3f5fc4easm5292204ilg.27.2022.09.06.10.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:19:51 -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 5/5] net: ipa: don't have gsi_channel_update() return a value Date: Tue, 6 Sep 2022 12:19:42 -0500 Message-Id: <20220906171942.957704-6-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220906171942.957704-1-elder@linaro.org> References: <20220906171942.957704-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=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 If it finds no completed transactions, gsi_channel_trans_complete() calls gsi_channel_update() to check hardware. If new transactions have completed, gsi_channel_update() records that, then calls gsi_channel_trans_complete() to return the first of those found. This recursion won't go any further, but can be avoided if we have gsi_channel_update() only be responsible for updating state after accessing hardware. Change gsi_channel_update() so it simply checks for and handles new completions, without returning a value. If it needs to call that function, have gsi_channel_trans_complete() determine whether there are new transactions available after the update. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 8 +++----- drivers/net/ipa/gsi_private.h | 6 +++--- drivers/net/ipa/gsi_trans.c | 7 +++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 5471843b665fc..3f97653450bb9 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1475,7 +1475,7 @@ void gsi_channel_doorbell(struct gsi_channel *channel) } /* Consult hardware, move any newly completed transactions to completed list */ -struct gsi_trans *gsi_channel_update(struct gsi_channel *channel) +void gsi_channel_update(struct gsi_channel *channel) { u32 evt_ring_id = channel->evt_ring_id; struct gsi *gsi = channel->gsi; @@ -1494,12 +1494,12 @@ struct gsi_trans *gsi_channel_update(struct gsi_channel *channel) offset = GSI_EV_CH_E_CNTXT_4_OFFSET(evt_ring_id); index = gsi_ring_index(ring, ioread32(gsi->virt + offset)); if (index == ring->index % ring->count) - return NULL; + return; /* Get the transaction for the latest completed event. */ trans = gsi_event_trans(gsi, gsi_ring_virt(ring, index - 1)); if (!trans) - return NULL; + return; /* For RX channels, update each completed transaction with the number * of bytes that were actually received. For TX channels, report @@ -1507,8 +1507,6 @@ struct gsi_trans *gsi_channel_update(struct gsi_channel *channel) * up the network stack. */ gsi_evt_ring_update(gsi, evt_ring_id, index); - - return gsi_channel_trans_complete(channel); } /** diff --git a/drivers/net/ipa/gsi_private.h b/drivers/net/ipa/gsi_private.h index a937811bb1bb7..af4cc13864e21 100644 --- a/drivers/net/ipa/gsi_private.h +++ b/drivers/net/ipa/gsi_private.h @@ -95,12 +95,12 @@ void gsi_channel_trans_exit(struct gsi_channel *channel); void gsi_channel_doorbell(struct gsi_channel *channel); /* gsi_channel_update() - Update knowledge of channel hardware state - * @channel: Channel whose doorbell should be rung + * @channel: Channel to be updated * * Consult hardware, move any newly completed transactions to a - * channel's completed list + * channel's completed list. */ -struct gsi_trans *gsi_channel_update(struct gsi_channel *channel); +void gsi_channel_update(struct gsi_channel *channel); /** * gsi_ring_virt() - Return virtual address for a ring entry diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c index 0b78ae904bacf..03e54fc4376a6 100644 --- a/drivers/net/ipa/gsi_trans.c +++ b/drivers/net/ipa/gsi_trans.c @@ -240,8 +240,11 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel) struct gsi_trans_info *trans_info = &channel->trans_info; u16 trans_id = trans_info->completed_id; - if (trans_id == trans_info->pending_id) - return gsi_channel_update(channel); + if (trans_id == trans_info->pending_id) { + gsi_channel_update(channel); + if (trans_id == trans_info->pending_id) + return NULL; + } return &trans_info->trans[trans_id %= channel->tre_count]; } -- 2.34.1