Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2578807pxb; Thu, 3 Feb 2022 09:28:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoBcopxFfAtWecx/ElSSRCPbP5TYxdk/L0BBig0VuUqYdIvTYtoGFMgV5Ew7bqARNe5joX X-Received: by 2002:a17:902:b941:: with SMTP id h1mr35958614pls.73.1643909312052; Thu, 03 Feb 2022 09:28:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643909312; cv=none; d=google.com; s=arc-20160816; b=YFfJHEnhrczb2sbOoMFFDQ6T9TbXOdq7UhLSKrSYsvHqqTsd+mggKeKfdq5w5Xf4Or FCuOnj0PAz1t2H3QlXCCAIvaR0BwxGqoNGclQ8j6dgcwYY/kAHHeJTlEsItiFJOXRhZm zM8O9lzfJNen0ZLkiAfFEfApAGopBIpRyhX5qYo+8JowQ2GQrwf9x8LBwZwhm57rq6oV /iO4m5DbvuOzxlFDyaa5h55xxTiU02mJnXjttuHV1PJ1K4OIxdO/CR9PAd10PgaTbF5A +QjzaNbmc/YKXFvjAXBaxsAdgHgaUwU91WALuSkVSd+bphvuZ/U+EWKlZFONutkaRYH3 HrIw== 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=YVeOmvrDZv3hJhW6Jsr2R6/Y4bCLC3bv8VO35vQkvl0=; b=b8HNd9ei7UQgYeSevWiOauMQoWJdQAo9qkzmCAS98n4ltLPJX3R37nlFeAG1hMjzuF 8rZ3p24CS8U8f1S6tpwS3MpYr9Ousw9BkQXTqhXpXE3MFnctgu4cp4yWZ/KvZKTVk/+5 5oqliJqhjxcMxjL/jYaS8GQyAukbw1Ee5pKyh6PtSOkMQVVjbr1W26DtYYwD9ZHx/X02 QpPA2JfCc2KEE0dpXHt0a9EhLNo2xwMbFlDxlDzB5/drMwX7eERwEIzqhTcTVVEega8k AGwy8r+DO6TF+IsiXeb/8tkvVK2l2043KpHDq+cT3bJw1c/HtQYUSc91+ztpJmaSxUwq Mh3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sb4qc8l3; 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 c1si9037633pgi.293.2022.02.03.09.28.19; Thu, 03 Feb 2022 09:28:32 -0800 (PST) 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=Sb4qc8l3; 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 S1352732AbiBCRKc (ORCPT + 99 others); Thu, 3 Feb 2022 12:10:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352572AbiBCRJr (ORCPT ); Thu, 3 Feb 2022 12:09:47 -0500 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 D1F7DC06173D for ; Thu, 3 Feb 2022 09:09:46 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id y17so2674833ilm.1 for ; Thu, 03 Feb 2022 09:09:46 -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=YVeOmvrDZv3hJhW6Jsr2R6/Y4bCLC3bv8VO35vQkvl0=; b=Sb4qc8l3d6fQWal2+nYncDQdeid9w3iJdshg8xNvNmQ4F//S3vBoRXD26En58ipbPo flL859XADrQx9pKN8Fb/GpOOZUfnf9NU5/iRRCma9rMXw994X/c3opxOJd3evH47XII3 T3iBsCsTcP3WZeKrU87xqe+D4lxJgFmfL2TTABvTsj+RpgSbxKEcmRZhb+zuneWMluLw Xv2MXEL2Gp6uAsjYiZFmegoeXMHlura4ysUAl5wpYogmlxq0SWOf0pw0c5CxCrq7rb9j w0hbl3o3FJU+/NPDtukSpF/nXxZf3ACDksHVonvoJnjhuCdXjwVlkYo2Pdapl2FJZECj FORA== 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=YVeOmvrDZv3hJhW6Jsr2R6/Y4bCLC3bv8VO35vQkvl0=; b=ELRNEuGeX5kHIZfpddFLyhDg7MDk79uWTtZUuy2fIK26PPLd74iaRSEuw+M+jRC9Hz aZmfG/chNyss8fBZ+/OMMLYKtjS8SlOI/pgTa95pL8g+uWiIaXOJ5FXJ6iGdkFSBoijh 8Slr4t1kCg/y1zhspOok0S+aV/JZe47OpoOHCAkzZskNws/O3yQKCQIjCieCoaWQAR/x 5r1cDpCxslMzjZsGH4BQdKLjOQ00jUpNhg1mIJxvpC90QkbYiByANRsBIL5LZvXimNsh 17B3rDJowjP4cSEnoZaQOnsCVN0DUlRskX+7RfX+l5pKhIp58TilyUM3Mg+gy+gCF8/J i45g== X-Gm-Message-State: AOAM5319tYPQ/M6vVlpVffxD0blIgiyLnYB6kObBQ+iHlAxrtRVJVxNy 8W2QK2FAzBGzNM2UtHa0aTXWgA== X-Received: by 2002:a05:6e02:15c8:: with SMTP id q8mr21128743ilu.19.1643908186272; Thu, 03 Feb 2022 09:09:46 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 09:09:45 -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 10/10] net: ipa: determine replenish doorbell differently Date: Thu, 3 Feb 2022 11:09:27 -0600 Message-Id: <20220203170927.770572-11-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 Rather than tracking the number of receive buffer transactions that have been submitted without a doorbell, just track the total number of transactions that have been issued. Then ring the doorbell when that number modulo the replenish batch size is 0. The effect is roughly the same, but the new count is slightly more interesting, and this approach will someday allow the replenish batch size to be tuned at runtime. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 12 ++++++++---- drivers/net/ipa/ipa_endpoint.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index a236edf5bf068..888e94278a84f 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -25,7 +25,8 @@ #define atomic_dec_not_zero(v) atomic_add_unless((v), -1, 0) -#define IPA_REPLENISH_BATCH 16 +/* Hardware is told about receive buffers once a "batch" has been queued */ +#define IPA_REPLENISH_BATCH 16 /* Must be non-zero */ /* The amount of RX buffer space consumed by standard skb overhead */ #define IPA_RX_BUFFER_OVERHEAD (PAGE_SIZE - SKB_MAX_ORDER(NET_SKB_PAD, 0)) @@ -1086,14 +1087,15 @@ static void ipa_endpoint_replenish(struct ipa_endpoint *endpoint) return; while ((trans = ipa_endpoint_trans_alloc(endpoint, 1))) { + bool doorbell; + if (ipa_endpoint_replenish_one(endpoint, trans)) goto try_again_later; - if (++endpoint->replenish_ready == IPA_REPLENISH_BATCH) - endpoint->replenish_ready = 0; /* Ring the doorbell if we've got a full batch */ - gsi_trans_commit(trans, !endpoint->replenish_ready); + doorbell = !(++endpoint->replenish_count % IPA_REPLENISH_BATCH); + gsi_trans_commit(trans, doorbell); } clear_bit(IPA_REPLENISH_ACTIVE, endpoint->replenish_flags); @@ -1863,6 +1865,8 @@ u32 ipa_endpoint_init(struct ipa *ipa, u32 count, enum ipa_endpoint_name name; u32 filter_map; + BUILD_BUG_ON(!IPA_REPLENISH_BATCH); + if (!ipa_endpoint_data_valid(ipa, count, data)) return 0; /* Error */ diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h index 9a37f9387f011..12fd5b16c18eb 100644 --- a/drivers/net/ipa/ipa_endpoint.h +++ b/drivers/net/ipa/ipa_endpoint.h @@ -65,7 +65,7 @@ enum ipa_replenish_flag { * @evt_ring_id: GSI event ring used by the endpoint * @netdev: Network device pointer, if endpoint uses one * @replenish_flags: Replenishing state flags - * @replenish_ready: Number of replenish transactions without doorbell + * @replenish_count: Total number of replenish transactions committed * @replenish_work: Work item used for repeated replenish failures */ struct ipa_endpoint { @@ -84,7 +84,7 @@ struct ipa_endpoint { /* Receive buffer replenishing for RX endpoints */ DECLARE_BITMAP(replenish_flags, IPA_REPLENISH_COUNT); - u32 replenish_ready; + u64 replenish_count; struct delayed_work replenish_work; /* global wq */ }; -- 2.32.0