All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Tom Herbert <therbert@google.com>
Cc: brouer@redhat.com, davem@davemloft.net, netdev@vger.kernel.org,
	Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH v2 net-next] net: Functions to report space available in device TX queues
Date: Wed, 3 Sep 2014 15:20:46 +0200	[thread overview]
Message-ID: <20140903152046.3c07a052@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1408250823440.31745@tomh.mtv.corp.google.com>

On Mon, 25 Aug 2014 08:27:56 -0700 (PDT)
Tom Herbert <therbert@google.com> wrote:

> This patch adds netdev_tx_avail_queue and netdev_avail_queue which are
> used to report number of bytes available in transmit queues per BQL. The
> functions call dql_avail which returns BQL limit minus number of
> inflight bytes. These functions can be called without txlock, for
> instance to ascertain how much data should be dequeued from a qdisc in
> a batch. When called without the tx_lock, the result is technically a
> hint, subsequently when the tx_lock is done for a transmit it is
> possible the availability has changed (for example a transmit
> completion may have freed up more space in the queue or changed the
> limit).
> 
> Signed-off-by: Tom Herbert <therbert@google.com>
> ---
>  include/linux/netdevice.h | 28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 0fac884..bdf6c85 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2544,6 +2544,30 @@ static inline void netdev_completed_queue(struct net_device *dev,
>  	netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
>  }
>  
> +static inline int netdev_tx_avail_queue(struct netdev_queue *dev_queue)
> +{
> +#ifdef CONFIG_BQL
> +	return dql_avail(&dev_queue->dql);
> +#else
> +	return DQL_MAX_LIMIT;
> +#endif
> +}
> +
> +/**
> + *	netdev_avail_queue - report how much space is availble for xmit
> + *	@dev: network device
> + *
> + *	Report the amount of space available in the TX queue in terms of
> + *	number of bytes. This returns the number of bytes avaiable per
> + *	DQL. This function may be called without taking the txlock on
> + *	the device, however in that case the result should be taken as
> + *	a (strong) hint.
> + */
> +static inline int netdev_avail_queue(struct net_device *dev)
> +{
> +	return netdev_tx_avail_queue(netdev_get_tx_queue(dev, 0));
> +}
> +

How can this work, when you are always passing 0 to: netdev_get_tx_queue(dev, 0)
???

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Sr. Network Kernel Developer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

  parent reply	other threads:[~2014-09-03 13:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-25 15:27 [PATCH v2 net-next] net: Functions to report space available in device TX queues Tom Herbert
2014-08-26  0:33 ` David Miller
2014-08-26 15:44   ` Tom Herbert
2014-09-03 13:20 ` Jesper Dangaard Brouer [this message]
2014-09-03 13:41   ` Eric Dumazet
2014-09-03 13:49     ` Jesper Dangaard Brouer

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=20140903152046.3c07a052@redhat.com \
    --to=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.