[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <103301d3-4c38-428d-aa31-501654064183@redhat.com>
Date: Wed, 9 Apr 2025 09:32:05 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Mohsin Bashir <mohsin.bashr@...il.com>, netdev@...r.kernel.org
Cc: alexanderduyck@...com, kuba@...nel.org, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, suhui@...china.com,
sanman.p211993@...il.com, vadim.fedorenko@...ux.dev, horms@...nel.org,
kalesh-anakkur.purayil@...adcom.com, kernel-team@...a.com
Subject: Re: [PATCH net-next 2/5] eth: fbnic: add coverage for hw queue stats
On 4/7/25 7:21 PM, Mohsin Bashir wrote:
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
> index 79a01fdd1dd1..e21a315ba694 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
> @@ -403,11 +403,15 @@ static int fbnic_hwtstamp_set(struct net_device *netdev,
> static void fbnic_get_stats64(struct net_device *dev,
> struct rtnl_link_stats64 *stats64)
> {
> + u64 rx_bytes, rx_packets, rx_dropped = 0, rx_errors = 0;
> u64 tx_bytes, tx_packets, tx_dropped = 0;
> - u64 rx_bytes, rx_packets, rx_dropped = 0;
> struct fbnic_net *fbn = netdev_priv(dev);
> + struct fbnic_dev *fbd = fbn->fbd;
> struct fbnic_queue_stats *stats;
> unsigned int start, i;
> + u64 rx_over = 0;
> +
> + fbnic_get_hw_stats(fbd);
>
> stats = &fbn->tx_stats;
>
> @@ -444,9 +448,20 @@ static void fbnic_get_stats64(struct net_device *dev,
> rx_packets = stats->packets;
> rx_dropped = stats->dropped;
>
> + for (i = 0; i < fbd->max_num_queues; i++) {
> + /* Report packets dropped due to CQ/BDQ being full/empty */
> + rx_over += fbd->hw_stats.hw_q[i].rde_pkt_cq_drop.value;
> + rx_over += fbd->hw_stats.hw_q[i].rde_pkt_bdq_drop.value;
I'm possibly missing something, but AFAICS the above statements can be
executed without any lock held. Another thread can concurrently call
fbnic_get_hw_stats() leading to an inconsistent snapshot.
Should fbnic_get_hw_stats() store the values in a local(ly allocated)
struct?
Cheers,
Paolo
Powered by blists - more mailing lists