From patchwork Mon Apr 17 09:36:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13213583 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 CEF0AC77B72 for ; Mon, 17 Apr 2023 09:40:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230298AbjDQJjv (ORCPT ); Mon, 17 Apr 2023 05:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbjDQJjm (ORCPT ); Mon, 17 Apr 2023 05:39:42 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47DB26580 for ; Mon, 17 Apr 2023 02:38:53 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5050491cb04so3246822a12.0 for ; Mon, 17 Apr 2023 02:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681724332; x=1684316332; 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=+VAYy4x1VW7GQjpcDHqlJKO18XulsfdzrpJC5dPxENk=; b=LjVjCt2gIN1rmNUD/vSXgbPSctlygwjrGweJ37AJDnSFttvyNhHuwRi5DbJvWqocXi N37qEQn1VKexTWKEgQyC0o2epxzHVHnPfcSdjy43cWOApW1ahIDselKosxroyRdmF7di MlXy7wIwt34u9zgV9RKSJK5A/TqBjKBPW1i+kikEwFiRYWZK6AAWzrQGSC9eZpcgt7+v m8ThIuv7rbWgfb1yOsPV/H8srZ0TtXwnBcppD4chKTYyFx5jSlmNPzrZRkWnlYBOTK/P 56hW7qI4J90HfvkcJTYVvltOIfZmcXi94mWu1+gW3vzJR5JYVeaMZttC5RuNyavQAWx1 m2Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681724332; x=1684316332; 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=+VAYy4x1VW7GQjpcDHqlJKO18XulsfdzrpJC5dPxENk=; b=XKhT3g3oLu8v+PHRW+XNB+Lc64QGtOjw/qgisxqEUQTbS5eESrbnNkyelrUlLGYobc i5s/waIDOJBhT5SYSt8wwNuT6qT7RaPsUT7ovk1d5hhCcMhnjQ82HOEN8Q537z1a8uy8 BWCND65fDQrFFQxlZgVvqjnUvc3ZLn+R0K0ockJ0GDxOhjcgvwu0/bSsoCPmgIh13N9x Manzx1UvoMx6SL7zRtmRyW5pGH7ajA9x1i1/ubdpOoLg1LzBO8g+CCet96qG/zUYoMvY VPJeu/XXJOTTdF7HmHa1mmtOYYQnsoL59zDqC0DGoSRCRkvBZ0vV5DHjfUXtDW2i0UEZ +1Eg== X-Gm-Message-State: AAQBX9cNg9xRqbEpElyUK/UjW3Tuvr4lxZBsm7PwYAB6AgOxj9w9qnID t97tutBN/osNvo0ieHmLpHA= X-Google-Smtp-Source: AKy350bRFnwFpsvymQ2Qxke4LZ6yvhQRbtWbU0uJgqEyF/6glZL9ROnID6wU+iXGN1KyuVSVEJ/B+Q== X-Received: by 2002:aa7:d593:0:b0:506:9984:9239 with SMTP id r19-20020aa7d593000000b0050699849239mr4033113edq.26.1681724331455; Mon, 17 Apr 2023 02:38:51 -0700 (PDT) Received: from ?IPV6:2a01:c22:770d:1c00:59f1:1548:39fc:ccd5? (dynamic-2a01-0c22-770d-1c00-59f1-1548-39fc-ccd5.c22.pool.telefonica.de. [2a01:c22:770d:1c00:59f1:1548:39fc:ccd5]) by smtp.googlemail.com with ESMTPSA id r12-20020a170906c28c00b0094f2f0c9ed9sm2956423ejz.167.2023.04.17.02.38.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Apr 2023 02:38:51 -0700 (PDT) Message-ID: <0e7ad48c-d745-2b23-d529-79866702b6f9@gmail.com> Date: Mon, 17 Apr 2023 11:36:15 +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 v3 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: <7147a001-3d9c-a48d-d398-a94c666aa65b@gmail.com> In-Reply-To: <7147a001-3d9c-a48d-d398-a94c666aa65b@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. Reviewed-by: Jacob Keller Signed-off-by: Heiner Kallweit --- 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 Mon Apr 17 09:37:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13213585 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 C1181C77B70 for ; Mon, 17 Apr 2023 09:40:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230304AbjDQJkV (ORCPT ); Mon, 17 Apr 2023 05:40:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjDQJjq (ORCPT ); Mon, 17 Apr 2023 05:39:46 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6660E1BCB for ; Mon, 17 Apr 2023 02:38:59 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id u3so10439063ejj.12 for ; Mon, 17 Apr 2023 02:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681724333; x=1684316333; 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=VGc/AXBbd3S7d1pfj4NXOSpGX22EGMAWawOhVjM8r1Y=; b=SBXMJP8x4UF5byWwUAKoX68wMXB1iy+JYIKx4DgcaEvcx06aSb5EHlK5YwL3NyOgHP RxVUrn4QzesZfAiEfQnP5MKHEofTeER61tfS86tgIznH+CLAaYJ5U0TSo5CIG9zK9fDK 1bfO+GjtdUl9By6e7065lDqagiLNUP4U7RK59Mx0jqY/bA+ObIojmb5qK12rurr9I610 WO1F64bnQESuxxZgoRwoiqMaskxMhVPA5LOPW04UucOWo/2NN+yK7ZrvN1UD6lIJjBsz jzmNMiR1ms1hUlIxrI7I3Vhb9YD1WhttiVKz3xEN7zHuacZjgbtjDYBP04AI46xVaHw7 PLUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681724333; x=1684316333; 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=VGc/AXBbd3S7d1pfj4NXOSpGX22EGMAWawOhVjM8r1Y=; b=GfidH6iNuEYo+OGUjZCWlMDrGLQs+h9zCqC5WQsdfqOCLVP2lSxT9jbqL3m8AQBzA2 y+juXGu3HJ8lmK+k3ZFKH1CM5ZzBmwyCnksxrPOqL3JYN3BbvuK2BG/3qLXCjYYz0EK7 f813o2oAXo2VpRpHy3D5c2OKd1P8pcQ1CsLTlRnyu51qjEZGqEiLpAduth4uWpZDJ3fI +qf6702RsNHhi47gNvu9zCyOf6+GGr5C7HIAvJEqq5lX4Ec4i1Ksja6wXt2wB/9kjn3O RFIX0KXx9msTdvz9HElVdBdJQf4cq9O1H1fC10e+cRLAtoFzVwyi21K0gbWU9I+GEKd1 V1RQ== X-Gm-Message-State: AAQBX9flf3ZugqBtFMEofrNJtEFdWuGvxZbU6XpQShZCV6QhehgWM715 8rZzAZbtfdaGpfdEMD89eBQ= X-Google-Smtp-Source: AKy350bWfPlfY83PQ/nuCszjfxi7O2zL+vfXiP37NGqtKAz5zFCQf3tQ5LAeg2vU2bhLJpMYb/Pljw== X-Received: by 2002:a17:906:4e53:b0:930:f953:9614 with SMTP id g19-20020a1709064e5300b00930f9539614mr7008362ejw.1.1681724332714; Mon, 17 Apr 2023 02:38:52 -0700 (PDT) Received: from ?IPV6:2a01:c22:770d:1c00:59f1:1548:39fc:ccd5? (dynamic-2a01-0c22-770d-1c00-59f1-1548-39fc-ccd5.c22.pool.telefonica.de. [2a01:c22:770d:1c00:59f1:1548:39fc:ccd5]) by smtp.googlemail.com with ESMTPSA id gy23-20020a170906f25700b0094f31208918sm2923500ejb.108.2023.04.17.02.38.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Apr 2023 02:38:52 -0700 (PDT) Message-ID: <8a12a0fd-849a-82c2-fdd5-8ece23111318@gmail.com> Date: Mon, 17 Apr 2023 11:37:20 +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 v3 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: <7147a001-3d9c-a48d-d398-a94c666aa65b@gmail.com> In-Reply-To: <7147a001-3d9c-a48d-d398-a94c666aa65b@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 --- v2: - ring doorbell if queue was stopped v3: - remove change log from commit message --- drivers/net/ethernet/realtek/r8169_main.c | 39 +++++++---------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 9f8357bbc..fff44d46b 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 */ @@ -4245,27 +4244,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) rtl8169_doorbell(tp); return NETDEV_TX_OK; @@ -4400,7 +4382,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 Mon Apr 17 09:38:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13213586 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 D17A7C77B78 for ; Mon, 17 Apr 2023 09:40:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjDQJkY (ORCPT ); Mon, 17 Apr 2023 05:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbjDQJjr (ORCPT ); Mon, 17 Apr 2023 05:39:47 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F03235A4 for ; Mon, 17 Apr 2023 02:39:00 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id u3so10439225ejj.12 for ; Mon, 17 Apr 2023 02:39:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681724334; x=1684316334; 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=tRUb1jq6dyRB1byqY/bTgCFESHTySsZnF7VVr6Rsffk=; b=arecx17cX1mMOuW4wOrHUcWd5k6pvudYg+wa4n4o/rtQGsloHelKlX+fCwN2W98DlY nhNPMAVbuDR/alIBmYTeW3Z1zJXyLBvI88kb7OyVjH35IOwBmMUYS/19vC6NoFM/6bJp /NHGvnxCE0Yxi7ZHPTOSYwLwtQJsp432R5tCamjmTTu02yz+5qzYfrUyiuiaEz02/bmD Bh3HGuWCay9dF+I0Yb6+cUpp5yaF5taTsgxnXyofwaUJylyy9PD5wKnFdqLCiIVQglMP /+ilS8HBIaiREeMu+3P8qjUM2WrUr9BTeDA1KaVHZW+We2ecGx9JuggzqLPtFI1h62G+ T7nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681724334; x=1684316334; 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=tRUb1jq6dyRB1byqY/bTgCFESHTySsZnF7VVr6Rsffk=; b=cJsdTciee29kZJG/ZOV80sUqXI3PlysUzTIFmhFnC2Waw9sdI7zVMnS4mM0jWeWeWB VNaitXZmd/fYCj8o40zZhbtNFAizRyIlJIT6F3SBIUrV0UoVMUY2mhCQNffssxKI2Ec7 s4srTAy6g/XOUu78jxQGj2+mL7euyY16c4KBAZcNUKl7iP23TVEyNm9jqtP4+s/6B3dX OF92pMq+o9ohKSRiPTRiKFRMqyqmIIutTszxd8zn+CunTI+PXQFppm1C08fG3K6p9Kgx sn7YKXbLo/jm0vafi+GZqD/V1b2yV6HuA0mGOtznqEA0kcBySnMsLwb9Bog+w4Nbym4x bO9g== X-Gm-Message-State: AAQBX9d4wDO8IoYtcmb1KJmOg1Mf6VYImElxVx5sXA+FtUqLtexpwx03 mhKhSsSo9YiVY2xhGqgsTJ8= X-Google-Smtp-Source: AKy350Yx2sUMUEOGDehcXSjRShH6arkO46HnfzAKg2R9phj312niRh/ge7t36YWMqYPgxDPbC9Rd7A== X-Received: by 2002:a17:906:6bd9:b0:94e:43ce:95f6 with SMTP id t25-20020a1709066bd900b0094e43ce95f6mr7263966ejs.47.1681724333999; Mon, 17 Apr 2023 02:38:53 -0700 (PDT) Received: from ?IPV6:2a01:c22:770d:1c00:59f1:1548:39fc:ccd5? (dynamic-2a01-0c22-770d-1c00-59f1-1548-39fc-ccd5.c22.pool.telefonica.de. [2a01:c22:770d:1c00:59f1:1548:39fc:ccd5]) by smtp.googlemail.com with ESMTPSA id a12-20020a170906368c00b0094e8de89111sm6277995ejc.201.2023.04.17.02.38.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Apr 2023 02:38:53 -0700 (PDT) Message-ID: Date: Mon, 17 Apr 2023 11:38:36 +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 v3 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: <7147a001-3d9c-a48d-d398-a94c666aa65b@gmail.com> In-Reply-To: <7147a001-3d9c-a48d-d398-a94c666aa65b@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. Reviewed-by: Jacob Keller Signed-off-by: Heiner Kallweit --- 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 fff44d46b..a7e376e7e 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -4371,20 +4371,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