Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1592353pxb; Tue, 8 Feb 2022 23:25:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxbqDbOHEqhCo5kdOqdWoA6naavzZhZqb8/weyx+HldvEqNuP2sRTWHR9glv/amBe+WkCV X-Received: by 2002:a05:6402:3585:: with SMTP id y5mr640146edc.104.1644391511253; Tue, 08 Feb 2022 23:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644391511; cv=none; d=google.com; s=arc-20160816; b=UHBxcg0If7ap8gfxlPzh0hERSaXdIENhmnTL6SWglXUqrbCmrUjU0V87TKdr1VfvQm BG3Kj3NabNrhL/3tiIK83N1S4UCslbNN0djXo0gLpWJhKIq37UAy1pEgb+PRSqxlnlC2 bUIreGWRf/nCti2Fu1Cp4xmHxN9LxU6UkqrCNAt2Tn4iCn8l7EAHkBqU7azoXdVgccJP eQAmBUS/RC7DYCPYvSOJhi4ZuX1bLV3MxR2b/NSfQm6Q3xWFRiLV0nQA4FeFLhhikWgd j5evqkh+AytRDUfezfgZ2AR6TmpO6JzpCe1eM4LmI20WkE1cAKQC4Sn+VUllY4yv8CvA rIIw== 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=HDx7zrECt0lRbn6ErTR+Jkn99RQBQ9k/kBc416RdGfc=; b=Cli8/QYz5EX/ACCq4BtTMPVh/QKS1nZWnU9SCoj4xnPq+KmknXw1zfu3rhVcctKOC+ tVGsptqA2iJr3SYu9NxDi1Vm5Ugg39kQUBROR+uqWxZ+qAMUUF4gMbifsPuU0+EjXKf4 f7kbu+2yNLEkN5DukW+nXioRWr/mb355YcH/wxFYKMMmDcpZIJ8KXXPev3i5CGg8qgdF 6BxBgrShXsTBMUD57psYrJcG92DBFl0di8ZyCjt59D1erBlA+JIA6u6YiyFYp8HhxDxi nWuB3BlG95YLMoZkLFQTPctIKluwPGBDlLygjINn/bR+QtzKnmkNiBWfnGAMkGEdGz0U I1SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TjhIqGFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt19si2544908ejc.0.2022.02.08.23.24.46; Tue, 08 Feb 2022 23:25:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TjhIqGFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1352569AbiBCRJq (ORCPT + 99 others); Thu, 3 Feb 2022 12:09:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352518AbiBCRJe (ORCPT ); Thu, 3 Feb 2022 12:09:34 -0500 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBFD6C06173B for ; Thu, 3 Feb 2022 09:09:34 -0800 (PST) Received: by mail-il1-x12b.google.com with SMTP id x6so2629364ilg.9 for ; Thu, 03 Feb 2022 09:09:34 -0800 (PST) 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=HDx7zrECt0lRbn6ErTR+Jkn99RQBQ9k/kBc416RdGfc=; b=TjhIqGFUReCXhgyjJ7DYcxUGbwXOKufhBPP/MOfmOvCSCBciZLnMwUeQ96hHaYkQPb lmcXyk96hPRDuWXI0U4tfltE2PTFy94slEmLlUkMikgjc2mX4NaIZdMbsYi3vVgXUtLf 3YqeDO5DObZCYFaZNU/k77u71LZnlgWBREW3JkuyIMXxbEBYiraQH9uwOApbxT+f0HHq IPZRTRGXrykjXtyqoMdbZjTS3TX+C0VomNYjfidqyKVA5tM7R4+/TtMd269gBnGqYPJk 0tDgyYuigex5iJggC8A1l+9B81XV3rbvr+YEspMGTts3br3ZINHht2U2/qVM9ejsz5bG WndQ== 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=HDx7zrECt0lRbn6ErTR+Jkn99RQBQ9k/kBc416RdGfc=; b=oFpSaRNAiVPzNZ117AgXmax1Ch7+JNnQB787HR1zU8dXvgI8eqhfYIHOhFPPNDjtMc t107EjfQ7XBA6ahty2ebOncIOnuI4EztgqSnzf3eI/Gpgl+AAMgGelGmtOtrVXqd0z0d 47oTA913OoH+QC2tBg8nUYiRQ+VkKsuMAPFGEBKJPZLVJWHFgIe2H00bGLedJqoMbOtM wIZYzgW+Dp6AKNN5UDH0whWMlbExTdds3pgRDUh/n5vLAvl/0iqJ2pfDBFgKZGYlSQLI n0fi1gff/J7JE/8aakpqqBjrN0v236CalUUZ9mMjgDdBLSFK4KFE9c4xJdaMhaJ8V8ra M01A== X-Gm-Message-State: AOAM5319zM/8Hd+/FVrt16kfPmgU48syQJiX8U2wxZlXt2j3E8GgyxgT F3xjClZkHHhMHyuGRoIVDG5DCg== X-Received: by 2002:a92:d4ce:: with SMTP id o14mr20659791ilm.218.1643908174073; Thu, 03 Feb 2022 09:09:34 -0800 (PST) Received: from localhost.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id m12sm21869671iow.54.2022.02.03.09.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 09:09:33 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, mka@chromium.org, evgreen@chromium.org, cpratapa@codeaurora.org, avuyyuru@codeaurora.org, jponduru@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 01/10] net: ipa: kill replenish_saved Date: Thu, 3 Feb 2022 11:09:18 -0600 Message-Id: <20220203170927.770572-2-elder@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220203170927.770572-1-elder@linaro.org> References: <20220203170927.770572-1-elder@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The replenish_saved field keeps track of the number of times a new buffer is added to the backlog when replenishing is disabled. We don't really use it though, so there's no need for us to track it separately. Whether replenishing is enabled or not, we can simply increment the backlog. Get rid of replenish_saved, and initialize and increment the backlog where it would have otherwise been used. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 17 ++++------------- drivers/net/ipa/ipa_endpoint.h | 2 -- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index fffd0a784ef2c..a9f6d4083f869 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1090,9 +1090,8 @@ static int ipa_endpoint_replenish_one(struct ipa_endpoint *endpoint) * endpoint, based on the number of entries in the underlying channel ring * buffer. If an endpoint's "backlog" is non-zero, it indicates how many * more receive buffers can be supplied to the hardware. Replenishing for - * an endpoint can be disabled, in which case requests to replenish a - * buffer are "saved", and transferred to the backlog once it is re-enabled - * again. + * an endpoint can be disabled, in which case buffers are not queued to + * the hardware. */ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one) { @@ -1102,7 +1101,7 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint, bool add_one) if (!test_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags)) { if (add_one) - atomic_inc(&endpoint->replenish_saved); + atomic_inc(&endpoint->replenish_backlog); return; } @@ -1147,11 +1146,8 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint) { struct gsi *gsi = &endpoint->ipa->gsi; u32 max_backlog; - u32 saved; set_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags); - while ((saved = atomic_xchg(&endpoint->replenish_saved, 0))) - atomic_add(saved, &endpoint->replenish_backlog); /* Start replenishing if hardware currently has no buffers */ max_backlog = gsi_channel_tre_max(gsi, endpoint->channel_id); @@ -1161,11 +1157,7 @@ static void ipa_endpoint_replenish_enable(struct ipa_endpoint *endpoint) static void ipa_endpoint_replenish_disable(struct ipa_endpoint *endpoint) { - u32 backlog; - clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags); - while ((backlog = atomic_xchg(&endpoint->replenish_backlog, 0))) - atomic_add(backlog, &endpoint->replenish_saved); } static void ipa_endpoint_replenish_work(struct work_struct *work) @@ -1727,9 +1719,8 @@ static void ipa_endpoint_setup_one(struct ipa_endpoint *endpoint) */ clear_bit(IPA_REPLENISH_ENABLED, endpoint->replenish_flags); clear_bit(IPA_REPLENISH_ACTIVE, endpoint->replenish_flags); - atomic_set(&endpoint->replenish_saved, + atomic_set(&endpoint->replenish_backlog, gsi_channel_tre_max(gsi, endpoint->channel_id)); - atomic_set(&endpoint->replenish_backlog, 0); INIT_DELAYED_WORK(&endpoint->replenish_work, ipa_endpoint_replenish_work); } diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h index 0313cdc607de3..c95816d882a74 100644 --- a/drivers/net/ipa/ipa_endpoint.h +++ b/drivers/net/ipa/ipa_endpoint.h @@ -66,7 +66,6 @@ enum ipa_replenish_flag { * @netdev: Network device pointer, if endpoint uses one * @replenish_flags: Replenishing state flags * @replenish_ready: Number of replenish transactions without doorbell - * @replenish_saved: Replenish requests held while disabled * @replenish_backlog: Number of buffers needed to fill hardware queue * @replenish_work: Work item used for repeated replenish failures */ @@ -87,7 +86,6 @@ struct ipa_endpoint { /* Receive buffer replenishing for RX endpoints */ DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT); u32 replenish_ready; - atomic_t replenish_saved; atomic_t replenish_backlog; struct delayed_work replenish_work; /* global wq */ }; -- 2.32.0