netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>,
	"Eric Dumazet" <edumazet@google.com>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 3/3] r8169: use new macro netif_subqueue_completed_wake in the tx cleanup path
Date: Thu, 13 Apr 2023 12:25:50 -0700	[thread overview]
Message-ID: <ac076400-e086-15be-47db-59556413094f@intel.com> (raw)
In-Reply-To: <3ef7166d-ce47-e24c-1df4-bb76a39c96c3@gmail.com>



On 4/13/2023 12:16 PM, Heiner Kallweit wrote:
> Use new net core macro netif_subqueue_completed_wake to simplify
> the code of the tx cleanup path.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  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);


We used to use a smp_store_mb here, but now its safe to just WRITE_ONCE?
Assuming that's correct:

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> -		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

  reply	other threads:[~2023-04-13 19:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 19:13 [PATCH net-next 0/3] r8169: use new macros from netdev_queues.h Heiner Kallweit
2023-04-13 19:14 ` [PATCH net-next 1/3] net: add macro netif_subqueue_completed_wake Heiner Kallweit
2023-04-13 19:22   ` Jacob Keller
2023-04-13 19:15 ` [PATCH net-next 2/3] r8169: use new macro netif_subqueue_maybe_stop in rtl8169_start_xmit Heiner Kallweit
2023-04-13 19:24   ` Jacob Keller
2023-04-15  1:53   ` Jakub Kicinski
2023-04-15  7:14     ` Heiner Kallweit
2023-04-13 19:16 ` [PATCH net-next 3/3] r8169: use new macro netif_subqueue_completed_wake in the tx cleanup path Heiner Kallweit
2023-04-13 19:25   ` Jacob Keller [this message]
2023-04-13 19:36     ` Heiner Kallweit
2023-04-13 21:04       ` Jacob Keller
2023-04-13 19:17 ` [PATCH net-next 0/3] r8169: use new macros from netdev_queues.h Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac076400-e086-15be-47db-59556413094f@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).