netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Daniel Jurgens <danielj@nvidia.com>
Cc: netdev@vger.kernel.org, jasowang@redhat.com,
	xuanzhuo@linux.alibaba.com, virtualization@lists.linux.dev,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	abeni@redhat.com, Parav Pandit <parav@nvidia.com>
Subject: Re: [PATCH net-next] virtio_net: Add TX stop and wake counters
Date: Tue, 30 Jan 2024 09:58:12 -0500	[thread overview]
Message-ID: <20240130095645-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20240130142521.18593-1-danielj@nvidia.com>

On Tue, Jan 30, 2024 at 08:25:21AM -0600, Daniel Jurgens wrote:
> Add a tx queue stop and wake counters, they are useful for debugging.
> 
> 	$ ethtool -S ens5f2 | grep 'tx_stop\|tx_wake'
> 	...
> 	tx_queue_1_tx_stop: 16726
> 	tx_queue_1_tx_wake: 16726
> 	...
> 	tx_queue_8_tx_stop: 1500110
> 	tx_queue_8_tx_wake: 1500110
> 
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Hmm isn't one always same as the other, except when queue is stopped?
And when it is stopped you can see that in the status?
So how is having two useful?


> ---
>  drivers/net/virtio_net.c | 26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 3cb8aa193884..7e3c31ceaf7e 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -88,6 +88,8 @@ struct virtnet_sq_stats {
>  	u64_stats_t xdp_tx_drops;
>  	u64_stats_t kicks;
>  	u64_stats_t tx_timeouts;
> +	u64_stats_t tx_stop;
> +	u64_stats_t tx_wake;
>  };
>  
>  struct virtnet_rq_stats {
> @@ -112,6 +114,8 @@ static const struct virtnet_stat_desc virtnet_sq_stats_desc[] = {
>  	{ "xdp_tx_drops",	VIRTNET_SQ_STAT(xdp_tx_drops) },
>  	{ "kicks",		VIRTNET_SQ_STAT(kicks) },
>  	{ "tx_timeouts",	VIRTNET_SQ_STAT(tx_timeouts) },
> +	{ "tx_stop",		VIRTNET_SQ_STAT(tx_stop) },
> +	{ "tx_wake",		VIRTNET_SQ_STAT(tx_wake) },
>  };
>  
>  static const struct virtnet_stat_desc virtnet_rq_stats_desc[] = {
> @@ -843,6 +847,9 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
>  	 */
>  	if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
>  		netif_stop_subqueue(dev, qnum);
> +		u64_stats_update_begin(&sq->stats.syncp);
> +		u64_stats_inc(&sq->stats.tx_stop);
> +		u64_stats_update_end(&sq->stats.syncp);
>  		if (use_napi) {
>  			if (unlikely(!virtqueue_enable_cb_delayed(sq->vq)))
>  				virtqueue_napi_schedule(&sq->napi, sq->vq);
> @@ -851,6 +858,9 @@ static void check_sq_full_and_disable(struct virtnet_info *vi,
>  			free_old_xmit_skbs(sq, false);
>  			if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) {
>  				netif_start_subqueue(dev, qnum);
> +				u64_stats_update_begin(&sq->stats.syncp);
> +				u64_stats_inc(&sq->stats.tx_wake);
> +				u64_stats_update_end(&sq->stats.syncp);
>  				virtqueue_disable_cb(sq->vq);
>  			}
>  		}
> @@ -2163,8 +2173,14 @@ static void virtnet_poll_cleantx(struct receive_queue *rq)
>  			free_old_xmit_skbs(sq, true);
>  		} while (unlikely(!virtqueue_enable_cb_delayed(sq->vq)));
>  
> -		if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
> +		if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
> +			if (netif_tx_queue_stopped(txq)) {
> +				u64_stats_update_begin(&sq->stats.syncp);
> +				u64_stats_inc(&sq->stats.tx_wake);
> +				u64_stats_update_end(&sq->stats.syncp);
> +			}
>  			netif_tx_wake_queue(txq);
> +		}
>  
>  		__netif_tx_unlock(txq);
>  	}
> @@ -2310,8 +2326,14 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget)
>  	virtqueue_disable_cb(sq->vq);
>  	free_old_xmit_skbs(sq, true);
>  
> -	if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
> +	if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS) {
> +		if (netif_tx_queue_stopped(txq)) {
> +			u64_stats_update_begin(&sq->stats.syncp);
> +			u64_stats_inc(&sq->stats.tx_wake);
> +			u64_stats_update_end(&sq->stats.syncp);
> +		}
>  		netif_tx_wake_queue(txq);
> +	}
>  
>  	opaque = virtqueue_enable_cb_prepare(sq->vq);
>  
> -- 
> 2.42.0


  reply	other threads:[~2024-01-30 14:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 14:25 [PATCH net-next] virtio_net: Add TX stop and wake counters Daniel Jurgens
2024-01-30 14:58 ` Michael S. Tsirkin [this message]
2024-01-30 15:40   ` Daniel Jurgens
2024-01-30 15:41     ` Michael S. Tsirkin
2024-01-30 15:50       ` Daniel Jurgens
2024-01-30 15:53         ` Michael S. Tsirkin
2024-01-30 17:33           ` Daniel Jurgens
2024-01-31  2:54             ` Jason Xing
2024-02-02  4:21               ` Jakub Kicinski
2024-02-02  6:52                 ` Jason Xing
2024-02-02 16:01                   ` Jakub Kicinski
2024-02-02 16:46                     ` Daniel Jurgens
2024-02-02 17:38                       ` Jakub Kicinski
2024-06-07  9:16                       ` Jason Xing
2024-06-07 12:36                         ` Dan Jurgens
2024-06-08  0:41                           ` Jason Xing
2024-06-10 17:57                             ` Jakub Kicinski
2024-06-11  2:05                               ` Jason Xing
2024-02-04  1:20                     ` Jason Wang
2024-02-04 12:39                       ` Michael S. Tsirkin
2024-02-05  1:45                         ` Jason Wang
2024-02-07 20:21                           ` Michael S. Tsirkin
2024-02-07 19:38                         ` Daniel Jurgens
2024-02-07 20:19                           ` Michael S. Tsirkin
2024-02-07 20:59                             ` Daniel Jurgens
2024-02-20 18:02                               ` Dan Jurgens
2024-02-20 18:05                                 ` Michael S. Tsirkin
2024-02-20 22:27                                   ` Jakub Kicinski
2024-01-30 15:16 ` Heng Qi
2024-01-30 15:43   ` Daniel Jurgens
2024-01-30 15:52     ` Michael S. Tsirkin

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=20240130095645-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=abeni@redhat.com \
    --cc=danielj@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jasowang@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=parav@nvidia.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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).