From patchwork Mon Jan 11 18:07:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 12011349 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36FF1C433DB for ; Mon, 11 Jan 2021 18:01:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B097229CA for ; Mon, 11 Jan 2021 18:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390088AbhAKSAs (ORCPT ); Mon, 11 Jan 2021 13:00:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389642AbhAKSAr (ORCPT ); Mon, 11 Jan 2021 13:00:47 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52187C061794 for ; Mon, 11 Jan 2021 10:00:07 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id 91so694974wrj.7 for ; Mon, 11 Jan 2021 10:00:07 -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; bh=i5vkZMIp6m8L5GT9AIEfOu/P1P8j2pgSz4aGREmv2dc=; b=I/AKHGG3HMoRNy9lYcu3nJW8P7K50NkFE3b0sIJR4X1p8WYUTccsLtiyI0q81OljfG /Ejv1bmW1NNaPlUdEzB5SS4Xz0th4TlfipWApn2JyVw0ppDEmVpVAFyk3n3/6CjK96If cpgLvyCfMcQSGUUgQLqZKZjC00no64RfBbpdPs2Os/bNpB3M+HwF2hb6xEz/lrZQjytg Ryg5pOBQZ4cXDp2Vo7+M3qpVIO6HjpUWebrG9MR0meOhjcgFpCGB7jO+jot1bqfIgVuF ebXeYOhdRHmKN7mucpPo2msHkd95Hd38u5js9ulbMtmjSq4JgPZNE4pOu1P1LOfWXK/1 gWLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=i5vkZMIp6m8L5GT9AIEfOu/P1P8j2pgSz4aGREmv2dc=; b=RZuFwFjmz1OYLa8ySgPiG7soiTc9ZMCLaiASVovlMZVqEZpQqekIJyLMZFdjQ9VPhC cEnk2Xg8r3rwfmqslsNFkEdqIcDLlMk0+aDwDvFeV79gHoSspbQK9aoKg8mHVfiUKrHQ XlyFK568jqHf93dOiShtwpmkdg87mhUA8fKLdHK8VrGvnH4RGWqhFzZrUCVqpn/nSrML Jo0kjikquSvT24PZ1iXYxtJkF58PAOvYa2aNADGXGffZfCtv0xXzAit61Lc+fDxc/Jyb kluhAQHyixaPbutwwAqliIqB6lYoBqh3WGeWTHuUE72hsvIJ5XdO8R0G/zYOfhnT+YGH h1Jw== X-Gm-Message-State: AOAM5339sxUuMHwlosuHXJlKYTFe7v5jtGJ9kYWeTbhd+P5A0OyEP8o3 r8kKiMwjeA0bKcW8mnkxZrLeFtFcqvkjSQ== X-Google-Smtp-Source: ABdhPJyJUY4VchB207CwJz2pmCVJkJfTUIdTxaXswHaiiPtGVLt3mk/Nn2cUZ2JDTVWPpNyeMkyrvw== X-Received: by 2002:adf:d085:: with SMTP id y5mr317551wrh.41.1610388006052; Mon, 11 Jan 2021 10:00:06 -0800 (PST) Received: from localhost.localdomain ([88.122.66.28]) by smtp.gmail.com with ESMTPSA id s12sm77662wmh.29.2021.01.11.10.00.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jan 2021 10:00:05 -0800 (PST) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, manivannan.sadhasivam@linaro.org, Hemant Kumar Subject: [PATCH net-next 1/3] bus: mhi: core: Add helper API to return number of free TREs Date: Mon, 11 Jan 2021 19:07:40 +0100 Message-Id: <1610388462-16322-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Hemant Kumar Introduce mhi_get_free_desc_count() API to return number of TREs available to queue buffer. MHI clients can use this API to know before hand if ring is full without calling queue API. Signed-off-by: Hemant Kumar Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 12 ++++++++++++ include/linux/mhi.h | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 3db1108..4e31f4f 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -309,6 +309,18 @@ int mhi_destroy_device(struct device *dev, void *data) return 0; } +int mhi_get_free_desc_count(struct mhi_device *mhi_dev, + enum dma_data_direction dir) +{ + struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl; + struct mhi_chan *mhi_chan = (dir == DMA_TO_DEVICE) ? + mhi_dev->ul_chan : mhi_dev->dl_chan; + struct mhi_ring *tre_ring = &mhi_chan->tre_ring; + + return get_nr_avail_ring_elements(mhi_cntrl, tre_ring); +} +EXPORT_SYMBOL_GPL(mhi_get_free_desc_count); + void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason) { struct mhi_driver *mhi_drv; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index cd571ad..62da830 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -614,6 +614,15 @@ void mhi_set_mhi_state(struct mhi_controller *mhi_cntrl, void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason); /** + * mhi_get_free_desc_count - Get transfer ring length + * Get # of TD available to queue buffers + * @mhi_dev: Device associated with the channels + * @dir: Direction of the channel + */ +int mhi_get_free_desc_count(struct mhi_device *mhi_dev, + enum dma_data_direction dir); + +/** * mhi_prepare_for_power_up - Do pre-initialization before power up. * This is optional, call this before power up if * the controller does not want bus framework to From patchwork Mon Jan 11 18:07:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 12011351 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B175C433E9 for ; Mon, 11 Jan 2021 18:01:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49C4422BF3 for ; Mon, 11 Jan 2021 18:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390099AbhAKSA4 (ORCPT ); Mon, 11 Jan 2021 13:00:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389777AbhAKSAz (ORCPT ); Mon, 11 Jan 2021 13:00:55 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DACA7C06179F for ; Mon, 11 Jan 2021 10:00:08 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id d13so651567wrc.13 for ; Mon, 11 Jan 2021 10:00:08 -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; bh=Hzqb7q+hCD/lNO+yAqM3iVZkO0rtWj2v+FJjuf+pTrs=; b=hZIh7sgU6+OWulN4iAr/CSGMYEVlRNUWfrhwvHqyX+9uB5/UXXgHZCYIrq/R1wdrnL dx5Mw80y2Lmog+E7nU93dYmdS7Bt7aXshIvtzR1/CpFPqMAlq8s5NQFSLETZhnAe+Nw/ AfM5Cz6ivbeUIXYotBm4aaVIWA1CAQmA547mi7wwRdFFA3FZECyttjIrzMUHapD6vMu6 GVNaHXxShKIrTUTL5wJd36oiI+ehGbqafCSs03J0IK4GxGH+nMWfSBCVlqiQXnqg9SMO a6L7pequbilhvqR8JCRoSo34i3MhVBDiG/77knTbDjL2340l00lNSJQujGz6gsYtuvcc A9OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hzqb7q+hCD/lNO+yAqM3iVZkO0rtWj2v+FJjuf+pTrs=; b=pVSucXlzNGTQ37+HbgoGnd+tbmSR94/6Lwpy1B9hHaB14OCG/Cv0o3KCfaF4D9DAhW oOvdMzPj67sMRUIwefSLQjqA3CnFvZLPTyoQnB6784OR62AS9g21ZJyyJLu8pwAAQ/Y/ KT5U4y30/MDjJyD19a+giD957F4UmxEs9cTyZxcydWejfeKN+ZzkrsTKS/Cly/Y4Vdsy DGjKKlq/dfki7EcTvpYLh6OUHkt/WCwnHzZbDet+l0BDhuWCNedKwN4tef3jDz8PvVUV F77EC5IdL4OK3Zo8ggrJIJ95EAIWMEIKyjWONOXie5WcDYjS0nT/8IxYgPmZsktto3jk RTCQ== X-Gm-Message-State: AOAM532RUFfS70CVgey/XB+bxGnR4vtZsxh2Qc3dNE4dzOWTfANt2wS2 kCEgOR4+u0aktMFoGT3OkH+/Kg== X-Google-Smtp-Source: ABdhPJzBnCL1cadHeT+qcud0r1WtPCyJdKFEtr18jPtmmL6y3tlUv8AiYQmcEaa1eTDWmEBYVevA7Q== X-Received: by 2002:adf:c6c4:: with SMTP id c4mr324727wrh.348.1610388007564; Mon, 11 Jan 2021 10:00:07 -0800 (PST) Received: from localhost.localdomain ([88.122.66.28]) by smtp.gmail.com with ESMTPSA id s12sm77662wmh.29.2021.01.11.10.00.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jan 2021 10:00:07 -0800 (PST) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, manivannan.sadhasivam@linaro.org, Loic Poulain Subject: [PATCH net-next 2/3] net: mhi: Get RX queue size from MHI core Date: Mon, 11 Jan 2021 19:07:41 +0100 Message-Id: <1610388462-16322-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610388462-16322-1-git-send-email-loic.poulain@linaro.org> References: <1610388462-16322-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The RX queue size can be determined at runtime by retrieving the number of available transfer descriptors. Signed-off-by: Loic Poulain --- drivers/net/mhi_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c index b7f7f2e..3da820b 100644 --- a/drivers/net/mhi_net.c +++ b/drivers/net/mhi_net.c @@ -257,9 +257,6 @@ static int mhi_net_probe(struct mhi_device *mhi_dev, mhi_netdev->mdev = mhi_dev; SET_NETDEV_DEV(ndev, &mhi_dev->dev); - /* All MHI net channels have 128 ring elements (at least for now) */ - mhi_netdev->rx_queue_sz = 128; - INIT_DELAYED_WORK(&mhi_netdev->rx_refill, mhi_net_rx_refill_work); u64_stats_init(&mhi_netdev->stats.rx_syncp); u64_stats_init(&mhi_netdev->stats.tx_syncp); @@ -269,6 +266,9 @@ static int mhi_net_probe(struct mhi_device *mhi_dev, if (err) goto out_err; + /* Number of transfer descriptors determines size of the queue */ + mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE); + err = register_netdev(ndev); if (err) goto out_err; From patchwork Mon Jan 11 18:07:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 12011353 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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EF6AC433E6 for ; Mon, 11 Jan 2021 18:01:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2103922B51 for ; Mon, 11 Jan 2021 18:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390095AbhAKSAu (ORCPT ); Mon, 11 Jan 2021 13:00:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389642AbhAKSAu (ORCPT ); Mon, 11 Jan 2021 13:00:50 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B581CC0617A2 for ; Mon, 11 Jan 2021 10:00:09 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id d26so658512wrb.12 for ; Mon, 11 Jan 2021 10:00:09 -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; bh=o6VGoAvdQqK2Elm/WglYXBR1TIROqoxTQR1mS7lNbWE=; b=aLk7IIrYOoT9OrCVSPE3z2FFJ1Xk5rl6flPGwWw+SVoHZR9jZCqnS3nY2Bez/LTD7n AJDxaBpmCuGzCaat+TV9ATjpIOyHfTNHXTMHCmeFJofwk3QqOcV9eTrMoSLp9cwggKIa 2Nts+5CNIgS+frKqiYBujR7DzUK7KjOJaF50LJFXzI//pb8eoFpPiT9fUD9C+ddjJ4nU /GWSqCicpYzywN1vYI+WgIw9L7WReZNmCgAIx94xjpZ29wmmww0PS+4l7hbLVAbbLnSP bxPEDhECF7QsbC8pmjCu4Ai7jwkV5ih5m8C4hQpVaBZzl8hEW1O/NyFB+lclPuiAhHMe LX0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o6VGoAvdQqK2Elm/WglYXBR1TIROqoxTQR1mS7lNbWE=; b=a8gDBaFGqHgX+PDgZ0TSgTHkavExWieC7F8B78bJ++1qT59EC3cDlLoJ8rPcjM3r5q d6VMAgmbz317U9XAEUHv4zAZn/p3zm/hG4XnAjEWP3QCrj0Z0BT7IktkNCR+Fr8fBrOT F7+F9Jtj2pqFvtChdoMRALjfYNHcGrXwaX/qoS+CBxHYVG2LcWbOpQu3HkL7+nIyTfUy b4uWogf9qbqZBMFft2II7V5415hyQSyniZg9NE80cZcLf+wzQH5feIfSGehJFrExh/zZ 7Ao2i8kjhrswByks8SJxJTU5HoUuQU5aAuM6mW1CnE+q8blNtgP0N/J0/s9vtbsZjv0Y 2kJg== X-Gm-Message-State: AOAM530MvTpNUG9WiM9mnww2rvAhnLcocl6oUyNTo0psuQerCEwFEX3U isDRhV8TIcZJy/pISS5QpJxzkA== X-Google-Smtp-Source: ABdhPJzi2t0QSDqbMVVERhCWyviasFN3RzwpxZkNJ+UuNvy2xJa8gUxSK0qYABBBdRmrPdor0PMZ1w== X-Received: by 2002:adf:e406:: with SMTP id g6mr291971wrm.255.1610388008461; Mon, 11 Jan 2021 10:00:08 -0800 (PST) Received: from localhost.localdomain ([88.122.66.28]) by smtp.gmail.com with ESMTPSA id s12sm77662wmh.29.2021.01.11.10.00.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jan 2021 10:00:08 -0800 (PST) From: Loic Poulain To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, manivannan.sadhasivam@linaro.org, Loic Poulain Subject: [PATCH net-next 3/3] net: mhi: Get rid of local rx queue count Date: Mon, 11 Jan 2021 19:07:42 +0100 Message-Id: <1610388462-16322-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1610388462-16322-1-git-send-email-loic.poulain@linaro.org> References: <1610388462-16322-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new mhi_get_free_desc_count helper to track queue usage instead of relying on the locally maintained rx_queued count. Signed-off-by: Loic Poulain --- drivers/net/mhi_net.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/mhi_net.c b/drivers/net/mhi_net.c index 3da820b..f83562d 100644 --- a/drivers/net/mhi_net.c +++ b/drivers/net/mhi_net.c @@ -25,7 +25,6 @@ struct mhi_net_stats { u64_stats_t tx_bytes; u64_stats_t tx_errors; u64_stats_t tx_dropped; - atomic_t rx_queued; struct u64_stats_sync tx_syncp; struct u64_stats_sync rx_syncp; }; @@ -138,9 +137,9 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev, { struct mhi_net_dev *mhi_netdev = dev_get_drvdata(&mhi_dev->dev); struct sk_buff *skb = mhi_res->buf_addr; - int remaining; + int free_desc_count; - remaining = atomic_dec_return(&mhi_netdev->stats.rx_queued); + free_desc_count = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE); if (unlikely(mhi_res->transaction_status)) { dev_kfree_skb_any(skb); @@ -164,7 +163,7 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev, } /* Refill if RX buffers queue becomes low */ - if (remaining <= mhi_netdev->rx_queue_sz / 2) + if (free_desc_count >= mhi_netdev->rx_queue_sz / 2) schedule_delayed_work(&mhi_netdev->rx_refill, 0); } @@ -211,7 +210,7 @@ static void mhi_net_rx_refill_work(struct work_struct *work) struct sk_buff *skb; int err; - while (atomic_read(&mhi_netdev->stats.rx_queued) < mhi_netdev->rx_queue_sz) { + while (!mhi_queue_is_full(mdev, DMA_FROM_DEVICE)) { skb = netdev_alloc_skb(ndev, size); if (unlikely(!skb)) break; @@ -224,8 +223,6 @@ static void mhi_net_rx_refill_work(struct work_struct *work) break; } - atomic_inc(&mhi_netdev->stats.rx_queued); - /* Do not hog the CPU if rx buffers are consumed faster than * queued (unlikely). */ @@ -233,7 +230,7 @@ static void mhi_net_rx_refill_work(struct work_struct *work) } /* If we're still starved of rx buffers, reschedule later */ - if (unlikely(!atomic_read(&mhi_netdev->stats.rx_queued))) + if (mhi_get_free_desc_count(mdev, DMA_FROM_DEVICE) == mhi_netdev->rx_queue_sz) schedule_delayed_work(&mhi_netdev->rx_refill, HZ / 2); }