From patchwork Thu Apr 13 19:14:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13210579 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 C5CFAC77B71 for ; Thu, 13 Apr 2023 19:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjDMTRk (ORCPT ); Thu, 13 Apr 2023 15:17:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjDMTR1 (ORCPT ); Thu, 13 Apr 2023 15:17:27 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30EB78A6C for ; Thu, 13 Apr 2023 12:17:08 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id w24so5647012wra.10 for ; Thu, 13 Apr 2023 12:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681413426; x=1684005426; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2q0HQIUhPWAzcQCkg0eTFX++gXWvkSpk9XcUgGpc4nU=; b=l9Jr2aY2hOUlGEM9L/eEXLenSA3k/nBQWmzCjtebTFttB0xMi8KLQns4QjoC4socU5 ALYohLa8HxcoMTnTRV6WayQGcuFVW6yKl3GSh8idkz1T54TEXh0Dm1gxkEc4t0XW1lX1 7aZY92qt79Sh55j02fGZXI6uxBx4ftZSwF7/WXb4z0Z0OUp9HA55qMJ3VFQne2TF+tZ7 CVTLy7FKltmebMWS560ctUeKYpVWYZQZiAXIqj3elpYbCTuqlTv9AYBGixrEL/+lNKaB F2yn6lU9ZSr+6a9I72gFrfbbD9V8iiscntYXTQ/uLSXjuB2qoIq9ROT/GWVxEe/qT83C tCcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681413426; x=1684005426; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2q0HQIUhPWAzcQCkg0eTFX++gXWvkSpk9XcUgGpc4nU=; b=ZRmmWD4eKNYqmGSEO6sevZqK/blR75vf41cB7PcDC28q3+DCfKNzdDyfoQ7UkPAQP6 W9uKFbJx9me1PYqlm50zL8PniYPx3pZmfBuN0X0lL9BG0z39MrKn7+xiyjLqIg4+ckKN PwsNMKT7p7FiTB7RUm5RGrBfqEynHFvzViKUAGfEVu+OkkGfexFStD1792F+D5fltpVD 77/w0Foma0tTEAXBVj6KH8jtuuV1hGot5lf/QKGeu9XrLOSR8M6OABrxbwCtuMxMOoJi w1dX8FMfdiGBKCOutLWptm8bRj/oHkv28Qep02SpSm4mqi6vYxYpUeOzPIckTQJSHU2F rlfA== X-Gm-Message-State: AAQBX9cD1eAwKE1wLrvQSS97Kqh6ISoJM4oxD99RRKfhS36znAhSsX/i ACX1fY3UDpL7L4dnHFXwY7s= X-Google-Smtp-Source: AKy350ane0GxrqlVI6m4nVR4t887/4StBUQbj/OR8q/Jl+3TvnQOQyhuLTJiwuQ0lXaAWZLw3ih5ig== X-Received: by 2002:a5d:5284:0:b0:2f2:7906:7323 with SMTP id c4-20020a5d5284000000b002f279067323mr2423984wrv.42.1681413426405; Thu, 13 Apr 2023 12:17:06 -0700 (PDT) Received: from ?IPV6:2a01:c22:738e:4400:f580:be04:1a64:fc5e? (dynamic-2a01-0c22-738e-4400-f580-be04-1a64-fc5e.c22.pool.telefonica.de. [2a01:c22:738e:4400:f580:be04:1a64:fc5e]) by smtp.googlemail.com with ESMTPSA id c14-20020adfe74e000000b002cefcac0c62sm1919241wrn.9.2023.04.13.12.17.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Apr 2023 12:17:06 -0700 (PDT) Message-ID: <16e51984-a539-24d4-a2d6-604c0b75f14b@gmail.com> Date: Thu, 13 Apr 2023 21:14:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: [PATCH net-next 1/3] net: add macro netif_subqueue_completed_wake Content-Language: en-US From: Heiner Kallweit To: Jakub Kicinski , David Miller , Paolo Abeni , Eric Dumazet , Realtek linux nic maintainers Cc: "netdev@vger.kernel.org" References: <32e7eaf4-7e1c-04ce-eee5-a190349b31f9@gmail.com> In-Reply-To: <32e7eaf4-7e1c-04ce-eee5-a190349b31f9@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add netif_subqueue_completed_wake, complementing the subqueue versions netif_subqueue_try_stop and netif_subqueue_maybe_stop. Signed-off-by: Heiner Kallweit Reviewed-by: Jacob Keller --- include/net/netdev_queues.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h index b26fdb441..d68b0a483 100644 --- a/include/net/netdev_queues.h +++ b/include/net/netdev_queues.h @@ -160,4 +160,14 @@ netdev_txq_completed_mb(struct netdev_queue *dev_queue, netif_txq_maybe_stop(txq, get_desc, stop_thrs, start_thrs); \ }) +#define netif_subqueue_completed_wake(dev, idx, pkts, bytes, \ + get_desc, start_thrs) \ + ({ \ + struct netdev_queue *txq; \ + \ + txq = netdev_get_tx_queue(dev, idx); \ + netif_txq_completed_wake(txq, pkts, bytes, \ + get_desc, start_thrs); \ + }) + #endif From patchwork Thu Apr 13 19:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13210577 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 82B72C77B73 for ; Thu, 13 Apr 2023 19:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbjDMTRh (ORCPT ); Thu, 13 Apr 2023 15:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbjDMTR1 (ORCPT ); Thu, 13 Apr 2023 15:17:27 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252A19005 for ; Thu, 13 Apr 2023 12:17:09 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id s2so11977961wra.7 for ; Thu, 13 Apr 2023 12:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681413427; x=1684005427; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=raFo48GDQifsTU8IasICU/ffWeXP8x/4SWkf8yN3YHo=; b=aNZGMXB3OhSNIUqGfHlYiBiW5VPgQ//i26dKMhqAwJ8W2TULEJFrBC7dBMdO6t1U3W /BBv3ql03HvsymfpdVymQgef0996x2B8ek79GP8hOlkUdo2C9cl5LF33PHli0w62b6sJ sG/2rRGRJ0rY5UtWJJGY8ZDEMWJ142qIY4N4cwTe30fRP0kNUp17T14oVXJPMfznWwKB 1pZkkhtUftDdV1qSgxT5wWZpVVtM6mMUufidYL5cD62t5hdsBOC1yc3VapI+NgMrm2of jgoOx97AMZqrszyv5j1cvP2S1kRRqDscs1J76UL+iy58krCRz7YdjDSThdKKDdehRqgj 8dzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681413427; x=1684005427; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=raFo48GDQifsTU8IasICU/ffWeXP8x/4SWkf8yN3YHo=; b=V870IHJiUw9X4re/9iOB30dl5MC3BDHpZTq6cKZ0d1DYyLX85r4aDr7Fr+mVNiwvPU tZNFOvF/DH+TMIEhnr3MN9HDyThjyg95xHr1tqepN2Y1/Cj6iSqLX+Zk757cLCtvwfll E1R3YrtoOMUc0HBxIAZzdOuiH6C0Q7KPc7pZ7NFYiGFt/o89ykrCqpCWd0W2RBfw1l1H e6RgjPdFPdDDt++rFsispBdh7RpeFn9dKGNjYHBXQdDuFcxXJQvWvOGXhxf6IzlEcOWA BaAPI4t/IebOnezcrdvj45HZ4npJLnCFpT0pH2nEOzc3ka7ovQQPHdL0XViXVdJdEYI4 XUxw== X-Gm-Message-State: AAQBX9fgZoeEdDOP6MuLW+JCrF67XDfFqiaYzmQDcG27htxWhlVjkNp1 kuacPv0rY760TQC87fEkZfY= X-Google-Smtp-Source: AKy350Z5kKKmMxHmvE8BmAYn/AtmkxF+XTNmnCGLCQNo/DhpLEDahF4jzVDoQDQo/ykTYr1cUQ/oWw== X-Received: by 2002:a5d:6a89:0:b0:2f5:ce19:8ec2 with SMTP id s9-20020a5d6a89000000b002f5ce198ec2mr2208121wru.11.1681413427543; Thu, 13 Apr 2023 12:17:07 -0700 (PDT) Received: from ?IPV6:2a01:c22:738e:4400:f580:be04:1a64:fc5e? (dynamic-2a01-0c22-738e-4400-f580-be04-1a64-fc5e.c22.pool.telefonica.de. [2a01:c22:738e:4400:f580:be04:1a64:fc5e]) by smtp.googlemail.com with ESMTPSA id b5-20020a5d45c5000000b002c6e8af1037sm1855372wrs.104.2023.04.13.12.17.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Apr 2023 12:17:07 -0700 (PDT) Message-ID: Date: Thu, 13 Apr 2023 21:15:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: [PATCH net-next 2/3] r8169: use new macro netif_subqueue_maybe_stop in rtl8169_start_xmit Content-Language: en-US From: Heiner Kallweit To: Jakub Kicinski , David Miller , Paolo Abeni , Eric Dumazet , Realtek linux nic maintainers Cc: "netdev@vger.kernel.org" References: <32e7eaf4-7e1c-04ce-eee5-a190349b31f9@gmail.com> In-Reply-To: <32e7eaf4-7e1c-04ce-eee5-a190349b31f9@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use new net core macro netif_subqueue_maybe_stop in the start_xmit path to simplify the code. Whilst at it, set the tx queue start threshold to twice the stop threshold. Before values were the same, resulting in stopping/starting the queue more often than needed. Signed-off-by: Heiner Kallweit Reviewed-by: Jacob Keller --- drivers/net/ethernet/realtek/r8169_main.c | 42 +++++++---------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 9f8357bbc..3f0b78fd9 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "r8169.h" #include "r8169_firmware.h" @@ -68,6 +69,8 @@ #define NUM_RX_DESC 256 /* Number of Rx descriptor registers */ #define R8169_TX_RING_BYTES (NUM_TX_DESC * sizeof(struct TxDesc)) #define R8169_RX_RING_BYTES (NUM_RX_DESC * sizeof(struct RxDesc)) +#define R8169_TX_STOP_THRS (MAX_SKB_FRAGS + 1) +#define R8169_TX_START_THRS (2 * R8169_TX_STOP_THRS) #define OCP_STD_PHY_BASE 0xa400 @@ -4162,13 +4165,9 @@ static bool rtl8169_tso_csum_v2(struct rtl8169_private *tp, return true; } -static bool rtl_tx_slots_avail(struct rtl8169_private *tp) +static unsigned int rtl_tx_slots_avail(struct rtl8169_private *tp) { - unsigned int slots_avail = READ_ONCE(tp->dirty_tx) + NUM_TX_DESC - - READ_ONCE(tp->cur_tx); - - /* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */ - return slots_avail > MAX_SKB_FRAGS; + return READ_ONCE(tp->dirty_tx) + NUM_TX_DESC - READ_ONCE(tp->cur_tx); } /* Versions RTL8102e and from RTL8168c onwards support csum_v2 */ @@ -4198,7 +4197,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, struct rtl8169_private *tp = netdev_priv(dev); unsigned int entry = tp->cur_tx % NUM_TX_DESC; struct TxDesc *txd_first, *txd_last; - bool stop_queue, door_bell; + bool door_bell; + int stop_queue; u32 opts[2]; if (unlikely(!rtl_tx_slots_avail(tp))) { @@ -4245,27 +4245,10 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, WRITE_ONCE(tp->cur_tx, tp->cur_tx + frags + 1); - stop_queue = !rtl_tx_slots_avail(tp); - if (unlikely(stop_queue)) { - /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must - * not miss a ring update when it notices a stopped queue. - */ - smp_wmb(); - netif_stop_queue(dev); - /* Sync with rtl_tx: - * - publish queue status and cur_tx ring index (write barrier) - * - refresh dirty_tx ring index (read barrier). - * May the current thread have a pessimistic view of the ring - * status and forget to wake up queue, a racing rtl_tx thread - * can't. - */ - smp_mb__after_atomic(); - if (rtl_tx_slots_avail(tp)) - netif_start_queue(dev); - door_bell = true; - } - - if (door_bell) + stop_queue = netif_subqueue_maybe_stop(dev, 0, rtl_tx_slots_avail(tp), + R8169_TX_STOP_THRS, + R8169_TX_START_THRS); + if (door_bell || stop_queue < 0) rtl8169_doorbell(tp); return NETDEV_TX_OK; @@ -4400,7 +4383,8 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp, * ring status. */ smp_store_mb(tp->dirty_tx, dirty_tx); - if (netif_queue_stopped(dev) && rtl_tx_slots_avail(tp)) + if (netif_queue_stopped(dev) && + rtl_tx_slots_avail(tp) >= R8169_TX_START_THRS) netif_wake_queue(dev); /* * 8168 hack: TxPoll requests are lost when the Tx packets are From patchwork Thu Apr 13 19:16:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13210576 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 662FFC77B61 for ; Thu, 13 Apr 2023 19:17:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbjDMTRe (ORCPT ); Thu, 13 Apr 2023 15:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbjDMTR2 (ORCPT ); Thu, 13 Apr 2023 15:17:28 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C8D89029 for ; Thu, 13 Apr 2023 12:17:10 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id s12so6775913wrb.1 for ; Thu, 13 Apr 2023 12:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681413429; x=1684005429; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=metY6p2SbdJqId2s/ZvyI/bQ/cGWvZRnBDqDhbQZMIE=; b=kmi+zNxL0MSlh+eOey+H51dNusOGo3cbvr5nXSZJ54pQvypaimh3GSesNFC4fyvWc2 Hg0Pl8LT/1OYOTS3MJ2PjKMbmuaaFog4Kz1VdAGTwATHXVub5+aPuMZD+CbDkmP49OL0 PD3GHmTY8dNya6gYGbLGXiKsCQxOD6Z19R6ZwBHfJjEP75pA9PKfxdoGxUgu351IdhiC 6U+lRiRaq9XCzG80Mo1CtyF7ayE9vMBxEMZJqB1l81u+e6G3Kc3tlQmJ7b1xdpURTU65 bk/4E30bArP/mjBdYeK2HK4wC5gukOzXRiU173YqOEjMwsOBN5N81fk6SCXdIZ20wGW1 Vrug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681413429; x=1684005429; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=metY6p2SbdJqId2s/ZvyI/bQ/cGWvZRnBDqDhbQZMIE=; b=D0+LQ1Qeh7apUr68nuwsbUO3kgFDXLlOBdcKNA43Rg8qaJnZ04YGsYj+Uvh7GiXQXD wdgaDUvc7NGJdBRjT1DmVTJCjd3m+ashItZw9lir2LXlTp+2pwp7FzkDyJzN620EYHQT 0Ar1VHBjyZ3wtYEvJ+didWwnOvnuumm6FoT1PgzEu2b3POWxdVZiYFN1TJQ7kWTlQNcO elw7Dhoar2eNIh57EwaCd8Rr1PKI/bbYSQEpAHIboUScOKNECJJxgdOfk8tv7Ilu9RlL UDXTUmwtUaQGiG0jm6r9bSDOvVa8i9LMVCiBEnbzULZyCYRd0WZRTUiuiZPHPUmuvoKG lG0A== X-Gm-Message-State: AAQBX9dWSOpQyP2C/cyiQB3lpiYcCSOpT/kf8Z/9H3vLpJA1Utjq1TSl bPgWZE36RZnNlNwXNB8rdTQ= X-Google-Smtp-Source: AKy350b1Ysik5kbmA/JKfQ8tcr35fiHpSR7W1kIqMs/So95B7qWURD9DKb1ESAFs5IFmjHVrdWyBqQ== X-Received: by 2002:adf:e74c:0:b0:2e6:348:5fef with SMTP id c12-20020adfe74c000000b002e603485fefmr2055376wrn.55.1681413428692; Thu, 13 Apr 2023 12:17:08 -0700 (PDT) Received: from ?IPV6:2a01:c22:738e:4400:f580:be04:1a64:fc5e? (dynamic-2a01-0c22-738e-4400-f580-be04-1a64-fc5e.c22.pool.telefonica.de. [2a01:c22:738e:4400:f580:be04:1a64:fc5e]) by smtp.googlemail.com with ESMTPSA id r12-20020adff10c000000b002cfe685bfd6sm1870221wro.108.2023.04.13.12.17.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Apr 2023 12:17:08 -0700 (PDT) Message-ID: <3ef7166d-ce47-e24c-1df4-bb76a39c96c3@gmail.com> Date: Thu, 13 Apr 2023 21:16:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: [PATCH net-next 3/3] r8169: use new macro netif_subqueue_completed_wake in the tx cleanup path Content-Language: en-US From: Heiner Kallweit To: Jakub Kicinski , David Miller , Paolo Abeni , Eric Dumazet , Realtek linux nic maintainers Cc: "netdev@vger.kernel.org" References: <32e7eaf4-7e1c-04ce-eee5-a190349b31f9@gmail.com> In-Reply-To: <32e7eaf4-7e1c-04ce-eee5-a190349b31f9@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use new net core macro netif_subqueue_completed_wake to simplify the code of the tx cleanup path. Signed-off-by: Heiner Kallweit Reviewed-by: Jacob Keller --- drivers/net/ethernet/realtek/r8169_main.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 3f0b78fd9..5cfdb60ab 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4372,20 +4372,12 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp, } if (tp->dirty_tx != dirty_tx) { - netdev_completed_queue(dev, pkts_compl, bytes_compl); dev_sw_netstats_tx_add(dev, pkts_compl, bytes_compl); + WRITE_ONCE(tp->dirty_tx, dirty_tx); - /* Sync with rtl8169_start_xmit: - * - publish dirty_tx ring index (write barrier) - * - refresh cur_tx ring index and queue status (read barrier) - * May the current thread miss the stopped queue condition, - * a racing xmit thread can only have a right view of the - * ring status. - */ - smp_store_mb(tp->dirty_tx, dirty_tx); - if (netif_queue_stopped(dev) && - rtl_tx_slots_avail(tp) >= R8169_TX_START_THRS) - netif_wake_queue(dev); + netif_subqueue_completed_wake(dev, 0, pkts_compl, bytes_compl, + rtl_tx_slots_avail(tp), + R8169_TX_START_THRS); /* * 8168 hack: TxPoll requests are lost when the Tx packets are * too close. Let's kick an extra TxPoll request when a burst