On Tue, 2016-08-30 at 17:00 -0700, Tom Herbert wrote:
> Add two fields to netdev_queue as head_cnt and tail_cnt. head_cnt is
> incremented for every sent packet in netdev_tx_sent_queue and tail_cnt
> is incremented by the number of packets in netdev_tx_completed_queue.
> So then the number of inflight packets for a queue is simply
> queue->head_cnt - queue->tail_cnt.
> 
> Add inflight_pkts to be reported in sys-fs.
> 
> Signed-off-by: Tom Herbert <t...@herbertland.com>
> ---
>  include/linux/netdevice.h |  4 ++++
>  net/core/net-sysfs.c      | 11 +++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index d122be9..487d1df 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -592,6 +592,8 @@ struct netdev_queue {
>  
>  #ifdef CONFIG_BQL
>       struct dql              dql;
> +     unsigned int            head_cnt;
> +     unsigned int            tail_cnt;
>  #endif
>  } ____cacheline_aligned_in_smp;
>  

You probably should put these fields in the appropriate cache lines of
"struct dql" : It will provide better cache behavior and fill holes.





Reply via email to