* [PATCH net-next 0/5] eth: fbnic: report software queue stats
@ 2025-02-11 18:13 Jakub Kicinski
2025-02-11 18:13 ` [PATCH net-next 1/5] net: report csum_complete via qstats Jakub Kicinski
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 18:13 UTC (permalink / raw)
To: davem
Cc: alexanderduyck, netdev, edumazet, pabeni, andrew+netdev, horms,
Jakub Kicinski
Fill in typical software queue stats.
# ./pyynl/cli.py --spec netlink/specs/netdev.yaml --dump qstats-get
[{'ifindex': 2,
'rx-alloc-fail': 0,
'rx-bytes': 398064076,
'rx-csum-complete': 271,
'rx-csum-none': 0,
'rx-packets': 276044,
'tx-bytes': 7223770,
'tx-needs-csum': 28148,
'tx-packets': 28449,
'tx-stop': 0,
'tx-wake': 0}]
Note that we don't collect csum-unnecessary, just the uncommon
cases (and unnecessary is all the rest of the packets). There
is no programatic use for these stats AFAIK, just manual debug.
Jakub Kicinski (5):
net: report csum_complete via qstats
eth: fbnic: wrap tx queue stats in a struct
eth: fbnic: report software Rx queue stats
eth: fbnic: report software Tx queue stats
eth: fbnic: re-sort the objects in the Makefile
drivers/net/ethernet/meta/fbnic/Makefile | 3 +-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 16 +++-
include/net/netdev_queues.h | 1 +
.../net/ethernet/meta/fbnic/fbnic_ethtool.c | 8 +-
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 22 +++++-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 74 +++++++++++++++----
net/core/netdev-genl.c | 1 +
7 files changed, 102 insertions(+), 23 deletions(-)
--
2.48.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH net-next 1/5] net: report csum_complete via qstats
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
@ 2025-02-11 18:13 ` Jakub Kicinski
2025-02-11 19:34 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 2/5] eth: fbnic: wrap tx queue stats in a struct Jakub Kicinski
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 18:13 UTC (permalink / raw)
To: davem
Cc: alexanderduyck, netdev, edumazet, pabeni, andrew+netdev, horms,
Jakub Kicinski, jdamato
Commit 13c7c941e729 ("netdev: add qstat for csum complete") reserved
the entry for csum complete in the qstats uAPI. Start reporting this
value now that we have a driver which needs it.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jdamato@fastly.com
---
include/net/netdev_queues.h | 1 +
net/core/netdev-genl.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
index 73d3401261a6..825141d675e5 100644
--- a/include/net/netdev_queues.h
+++ b/include/net/netdev_queues.h
@@ -23,6 +23,7 @@ struct netdev_queue_stats_rx {
u64 hw_drops;
u64 hw_drop_overruns;
+ u64 csum_complete;
u64 csum_unnecessary;
u64 csum_none;
u64 csum_bad;
diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index 0dcd4faefd8d..c18bb53d13fd 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -581,6 +581,7 @@ netdev_nl_stats_write_rx(struct sk_buff *rsp, struct netdev_queue_stats_rx *rx)
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_ALLOC_FAIL, rx->alloc_fail) ||
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_HW_DROPS, rx->hw_drops) ||
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_HW_DROP_OVERRUNS, rx->hw_drop_overruns) ||
+ netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_COMPLETE, rx->csum_complete) ||
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_UNNECESSARY, rx->csum_unnecessary) ||
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_NONE, rx->csum_none) ||
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_BAD, rx->csum_bad) ||
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 2/5] eth: fbnic: wrap tx queue stats in a struct
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
2025-02-11 18:13 ` [PATCH net-next 1/5] net: report csum_complete via qstats Jakub Kicinski
@ 2025-02-11 18:13 ` Jakub Kicinski
2025-02-11 19:41 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 3/5] eth: fbnic: report software Rx queue stats Jakub Kicinski
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 18:13 UTC (permalink / raw)
To: davem
Cc: alexanderduyck, netdev, edumazet, pabeni, andrew+netdev, horms,
Jakub Kicinski
The queue stats struct is used for Rx and Tx queues. Wrap
the Tx stats in a struct and a union, so that we can reuse
the same space for Rx stats on Rx queues.
This also makes it easy to add an assert to the stat handling
code to catch new stats not being aggregated on shutdown.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 8 ++++++--
drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c | 8 ++++----
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 10 ++++++----
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
index c2a94f31f71b..d6ae8462584f 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
@@ -57,8 +57,12 @@ struct fbnic_queue_stats {
u64 packets;
u64 bytes;
u64 dropped;
- u64 ts_packets;
- u64 ts_lost;
+ union {
+ struct {
+ u64 ts_packets;
+ u64 ts_lost;
+ } twq;
+ };
struct u64_stats_sync syncp;
};
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
index 9503c36620c6..fb7139a1da46 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
@@ -1224,14 +1224,14 @@ static void fbnic_get_ts_stats(struct net_device *netdev,
unsigned int start;
int i;
- ts_stats->pkts = fbn->tx_stats.ts_packets;
- ts_stats->lost = fbn->tx_stats.ts_lost;
+ ts_stats->pkts = fbn->tx_stats.twq.ts_packets;
+ ts_stats->lost = fbn->tx_stats.twq.ts_lost;
for (i = 0; i < fbn->num_tx_queues; i++) {
ring = fbn->tx[i];
do {
start = u64_stats_fetch_begin(&ring->stats.syncp);
- ts_packets = ring->stats.ts_packets;
- ts_lost = ring->stats.ts_lost;
+ ts_packets = ring->stats.twq.ts_packets;
+ ts_lost = ring->stats.twq.ts_lost;
} while (u64_stats_fetch_retry(&ring->stats.syncp, start));
ts_stats->pkts += ts_packets;
ts_stats->lost += ts_lost;
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index d4d7027df9a0..b60dd1c9918e 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -444,7 +444,7 @@ static void fbnic_clean_twq0(struct fbnic_napi_vector *nv, int napi_budget,
if (unlikely(discard)) {
u64_stats_update_begin(&ring->stats.syncp);
ring->stats.dropped += total_packets;
- ring->stats.ts_lost += ts_lost;
+ ring->stats.twq.ts_lost += ts_lost;
u64_stats_update_end(&ring->stats.syncp);
netdev_tx_completed_queue(txq, total_packets, total_bytes);
@@ -507,7 +507,7 @@ static void fbnic_clean_tsq(struct fbnic_napi_vector *nv,
skb_tstamp_tx(skb, &hwtstamp);
u64_stats_update_begin(&ring->stats.syncp);
- ring->stats.ts_packets++;
+ ring->stats.twq.ts_packets++;
u64_stats_update_end(&ring->stats.syncp);
}
@@ -1065,8 +1065,10 @@ void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
fbn->tx_stats.bytes += stats->bytes;
fbn->tx_stats.packets += stats->packets;
fbn->tx_stats.dropped += stats->dropped;
- fbn->tx_stats.ts_lost += stats->ts_lost;
- fbn->tx_stats.ts_packets += stats->ts_packets;
+ fbn->tx_stats.twq.ts_lost += stats->twq.ts_lost;
+ fbn->tx_stats.twq.ts_packets += stats->twq.ts_packets;
+ /* Remember to add new stats here */
+ BUILD_BUG_ON(sizeof(fbn->tx_stats.twq) / 8 != 2);
}
static void fbnic_remove_tx_ring(struct fbnic_net *fbn,
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 3/5] eth: fbnic: report software Rx queue stats
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
2025-02-11 18:13 ` [PATCH net-next 1/5] net: report csum_complete via qstats Jakub Kicinski
2025-02-11 18:13 ` [PATCH net-next 2/5] eth: fbnic: wrap tx queue stats in a struct Jakub Kicinski
@ 2025-02-11 18:13 ` Jakub Kicinski
2025-02-11 19:49 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 4/5] eth: fbnic: report software Tx " Jakub Kicinski
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 18:13 UTC (permalink / raw)
To: davem
Cc: alexanderduyck, netdev, edumazet, pabeni, andrew+netdev, horms,
Jakub Kicinski
Gather and report software Rx queue stats - checksum stats
and allocation failures.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 5 +++
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 12 +++++-
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 43 +++++++++++++++----
3 files changed, 51 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
index d6ae8462584f..3fe4d1b6baad 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
@@ -62,6 +62,11 @@ struct fbnic_queue_stats {
u64 ts_packets;
u64 ts_lost;
} twq;
+ struct {
+ u64 alloc_failed;
+ u64 csum_complete;
+ u64 csum_none;
+ } rx;
};
struct u64_stats_sync syncp;
};
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index 14e7a8384bce..ceb6d1de9bcf 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -487,8 +487,9 @@ static void fbnic_get_queue_stats_rx(struct net_device *dev, int idx,
struct fbnic_net *fbn = netdev_priv(dev);
struct fbnic_ring *rxr = fbn->rx[idx];
struct fbnic_queue_stats *stats;
+ u64 bytes, packets, alloc_fail;
+ u64 csum_complete, csum_none;
unsigned int start;
- u64 bytes, packets;
if (!rxr)
return;
@@ -498,10 +499,16 @@ static void fbnic_get_queue_stats_rx(struct net_device *dev, int idx,
start = u64_stats_fetch_begin(&stats->syncp);
bytes = stats->bytes;
packets = stats->packets;
+ alloc_fail = stats->rx.alloc_failed;
+ csum_complete = stats->rx.csum_complete;
+ csum_none = stats->rx.csum_none;
} while (u64_stats_fetch_retry(&stats->syncp, start));
rx->bytes = bytes;
rx->packets = packets;
+ rx->alloc_fail = alloc_fail;
+ rx->csum_complete = csum_complete;
+ rx->csum_none = csum_none;
}
static void fbnic_get_queue_stats_tx(struct net_device *dev, int idx,
@@ -538,6 +545,9 @@ static void fbnic_get_base_stats(struct net_device *dev,
rx->bytes = fbn->rx_stats.bytes;
rx->packets = fbn->rx_stats.packets;
+ rx->alloc_fail = fbn->rx_stats.rx.alloc_failed;
+ rx->csum_complete = fbn->rx_stats.rx.csum_complete;
+ rx->csum_none = fbn->rx_stats.rx.csum_none;
}
static const struct netdev_stat_ops fbnic_stat_ops = {
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index b60dd1c9918e..66ba36fd3c08 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -198,12 +198,15 @@ fbnic_tx_offloads(struct fbnic_ring *ring, struct sk_buff *skb, __le64 *meta)
}
static void
-fbnic_rx_csum(u64 rcd, struct sk_buff *skb, struct fbnic_ring *rcq)
+fbnic_rx_csum(u64 rcd, struct sk_buff *skb, struct fbnic_ring *rcq,
+ u64 *csum_cmpl, u64 *csum_none)
{
skb_checksum_none_assert(skb);
- if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM)))
+ if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
+ (*csum_none)++;
return;
+ }
if (FIELD_GET(FBNIC_RCD_META_L4_CSUM_UNNECESSARY, rcd)) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -212,6 +215,7 @@ fbnic_rx_csum(u64 rcd, struct sk_buff *skb, struct fbnic_ring *rcq)
skb->ip_summed = CHECKSUM_COMPLETE;
skb->csum = (__force __wsum)csum;
+ (*csum_cmpl)++;
}
}
@@ -661,8 +665,13 @@ static void fbnic_fill_bdq(struct fbnic_napi_vector *nv, struct fbnic_ring *bdq)
struct page *page;
page = page_pool_dev_alloc_pages(nv->page_pool);
- if (!page)
+ if (!page) {
+ u64_stats_update_begin(&bdq->stats.syncp);
+ bdq->stats.rx.alloc_failed++;
+ u64_stats_update_end(&bdq->stats.syncp);
+
break;
+ }
fbnic_page_pool_init(bdq, i, page);
fbnic_bd_prep(bdq, i, page);
@@ -875,12 +884,13 @@ static void fbnic_rx_tstamp(struct fbnic_napi_vector *nv, u64 rcd,
static void fbnic_populate_skb_fields(struct fbnic_napi_vector *nv,
u64 rcd, struct sk_buff *skb,
- struct fbnic_q_triad *qt)
+ struct fbnic_q_triad *qt,
+ u64 *csum_cmpl, u64 *csum_none)
{
struct net_device *netdev = nv->napi.dev;
struct fbnic_ring *rcq = &qt->cmpl;
- fbnic_rx_csum(rcd, skb, rcq);
+ fbnic_rx_csum(rcd, skb, rcq, csum_cmpl, csum_none);
if (netdev->features & NETIF_F_RXHASH)
skb_set_hash(skb,
@@ -898,7 +908,8 @@ static bool fbnic_rcd_metadata_err(u64 rcd)
static int fbnic_clean_rcq(struct fbnic_napi_vector *nv,
struct fbnic_q_triad *qt, int budget)
{
- unsigned int packets = 0, bytes = 0, dropped = 0;
+ unsigned int packets = 0, bytes = 0, dropped = 0, alloc_failed = 0;
+ u64 csum_complete = 0, csum_none = 0;
struct fbnic_ring *rcq = &qt->cmpl;
struct fbnic_pkt_buff *pkt;
s32 head0 = -1, head1 = -1;
@@ -947,14 +958,22 @@ static int fbnic_clean_rcq(struct fbnic_napi_vector *nv,
/* Populate skb and invalidate XDP */
if (!IS_ERR_OR_NULL(skb)) {
- fbnic_populate_skb_fields(nv, rcd, skb, qt);
+ fbnic_populate_skb_fields(nv, rcd, skb, qt,
+ &csum_complete,
+ &csum_none);
packets++;
bytes += skb->len;
napi_gro_receive(&nv->napi, skb);
} else {
- dropped++;
+ if (!skb) {
+ alloc_failed++;
+ dropped++;
+ } else {
+ dropped++;
+ }
+
fbnic_put_pkt_buff(nv, pkt, 1);
}
@@ -977,6 +996,9 @@ static int fbnic_clean_rcq(struct fbnic_napi_vector *nv,
/* Re-add ethernet header length (removed in fbnic_build_skb) */
rcq->stats.bytes += ETH_HLEN * packets;
rcq->stats.dropped += dropped;
+ rcq->stats.rx.alloc_failed += alloc_failed;
+ rcq->stats.rx.csum_complete += csum_complete;
+ rcq->stats.rx.csum_none += csum_none;
u64_stats_update_end(&rcq->stats.syncp);
/* Unmap and free processed buffers */
@@ -1054,6 +1076,11 @@ void fbnic_aggregate_ring_rx_counters(struct fbnic_net *fbn,
fbn->rx_stats.bytes += stats->bytes;
fbn->rx_stats.packets += stats->packets;
fbn->rx_stats.dropped += stats->dropped;
+ fbn->rx_stats.rx.alloc_failed += stats->rx.alloc_failed;
+ fbn->rx_stats.rx.csum_complete += stats->rx.csum_complete;
+ fbn->rx_stats.rx.csum_none += stats->rx.csum_none;
+ /* Remember to add new stats here */
+ BUILD_BUG_ON(sizeof(fbn->tx_stats.rx) / 8 != 3);
}
void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 4/5] eth: fbnic: report software Tx queue stats
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
` (2 preceding siblings ...)
2025-02-11 18:13 ` [PATCH net-next 3/5] eth: fbnic: report software Rx queue stats Jakub Kicinski
@ 2025-02-11 18:13 ` Jakub Kicinski
2025-02-11 19:52 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile Jakub Kicinski
2025-02-13 0:50 ` [PATCH net-next 0/5] eth: fbnic: report software queue stats patchwork-bot+netdevbpf
5 siblings, 1 reply; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 18:13 UTC (permalink / raw)
To: davem
Cc: alexanderduyck, netdev, edumazet, pabeni, andrew+netdev, horms,
Jakub Kicinski
Gather and report software Tx queue stats - checksum stats
and queue stop / start.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 3 +++
.../net/ethernet/meta/fbnic/fbnic_netdev.c | 10 ++++++++
drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 23 +++++++++++++++----
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
index 3fe4d1b6baad..57ae95a6cbfa 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
@@ -59,8 +59,11 @@ struct fbnic_queue_stats {
u64 dropped;
union {
struct {
+ u64 csum_partial;
u64 ts_packets;
u64 ts_lost;
+ u64 stop;
+ u64 wake;
} twq;
struct {
u64 alloc_failed;
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
index ceb6d1de9bcf..b12672d1607e 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_netdev.c
@@ -517,6 +517,7 @@ static void fbnic_get_queue_stats_tx(struct net_device *dev, int idx,
struct fbnic_net *fbn = netdev_priv(dev);
struct fbnic_ring *txr = fbn->tx[idx];
struct fbnic_queue_stats *stats;
+ u64 stop, wake, csum;
unsigned int start;
u64 bytes, packets;
@@ -528,10 +529,16 @@ static void fbnic_get_queue_stats_tx(struct net_device *dev, int idx,
start = u64_stats_fetch_begin(&stats->syncp);
bytes = stats->bytes;
packets = stats->packets;
+ csum = stats->twq.csum_partial;
+ stop = stats->twq.stop;
+ wake = stats->twq.wake;
} while (u64_stats_fetch_retry(&stats->syncp, start));
tx->bytes = bytes;
tx->packets = packets;
+ tx->needs_csum = csum;
+ tx->stop = stop;
+ tx->wake = wake;
}
static void fbnic_get_base_stats(struct net_device *dev,
@@ -542,6 +549,9 @@ static void fbnic_get_base_stats(struct net_device *dev,
tx->bytes = fbn->tx_stats.bytes;
tx->packets = fbn->tx_stats.packets;
+ tx->needs_csum = fbn->tx_stats.twq.csum_partial;
+ tx->stop = fbn->tx_stats.twq.stop;
+ tx->wake = fbn->tx_stats.twq.wake;
rx->bytes = fbn->rx_stats.bytes;
rx->packets = fbn->rx_stats.packets;
diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
index 66ba36fd3c08..24d2b528b66c 100644
--- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
+++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
@@ -113,6 +113,11 @@ static int fbnic_maybe_stop_tx(const struct net_device *dev,
res = netif_txq_maybe_stop(txq, fbnic_desc_unused(ring), size,
FBNIC_TX_DESC_WAKEUP);
+ if (!res) {
+ u64_stats_update_begin(&ring->stats.syncp);
+ ring->stats.twq.stop++;
+ u64_stats_update_end(&ring->stats.syncp);
+ }
return !res;
}
@@ -191,6 +196,9 @@ fbnic_tx_offloads(struct fbnic_ring *ring, struct sk_buff *skb, __le64 *meta)
skb->csum_offset / 2));
*meta |= cpu_to_le64(FBNIC_TWD_FLAG_REQ_CSO);
+ u64_stats_update_begin(&ring->stats.syncp);
+ ring->stats.twq.csum_partial++;
+ u64_stats_update_end(&ring->stats.syncp);
*meta |= cpu_to_le64(FIELD_PREP(FBNIC_TWD_L2_HLEN_MASK, l2len / 2) |
FIELD_PREP(FBNIC_TWD_L3_IHLEN_MASK, i3len / 2));
@@ -460,9 +468,13 @@ static void fbnic_clean_twq0(struct fbnic_napi_vector *nv, int napi_budget,
ring->stats.packets += total_packets;
u64_stats_update_end(&ring->stats.syncp);
- netif_txq_completed_wake(txq, total_packets, total_bytes,
- fbnic_desc_unused(ring),
- FBNIC_TX_DESC_WAKEUP);
+ if (!netif_txq_completed_wake(txq, total_packets, total_bytes,
+ fbnic_desc_unused(ring),
+ FBNIC_TX_DESC_WAKEUP)) {
+ u64_stats_update_begin(&ring->stats.syncp);
+ ring->stats.twq.wake++;
+ u64_stats_update_end(&ring->stats.syncp);
+ }
}
static void fbnic_clean_tsq(struct fbnic_napi_vector *nv,
@@ -1092,10 +1104,13 @@ void fbnic_aggregate_ring_tx_counters(struct fbnic_net *fbn,
fbn->tx_stats.bytes += stats->bytes;
fbn->tx_stats.packets += stats->packets;
fbn->tx_stats.dropped += stats->dropped;
+ fbn->tx_stats.twq.csum_partial += stats->twq.csum_partial;
fbn->tx_stats.twq.ts_lost += stats->twq.ts_lost;
fbn->tx_stats.twq.ts_packets += stats->twq.ts_packets;
+ fbn->tx_stats.twq.stop += stats->twq.stop;
+ fbn->tx_stats.twq.wake += stats->twq.wake;
/* Remember to add new stats here */
- BUILD_BUG_ON(sizeof(fbn->tx_stats.twq) / 8 != 2);
+ BUILD_BUG_ON(sizeof(fbn->tx_stats.twq) / 8 != 5);
}
static void fbnic_remove_tx_ring(struct fbnic_net *fbn,
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
` (3 preceding siblings ...)
2025-02-11 18:13 ` [PATCH net-next 4/5] eth: fbnic: report software Tx " Jakub Kicinski
@ 2025-02-11 18:13 ` Jakub Kicinski
2025-02-11 19:54 ` Joe Damato
2025-02-13 0:50 ` [PATCH net-next 0/5] eth: fbnic: report software queue stats patchwork-bot+netdevbpf
5 siblings, 1 reply; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 18:13 UTC (permalink / raw)
To: davem
Cc: alexanderduyck, netdev, edumazet, pabeni, andrew+netdev, horms,
Jakub Kicinski
Looks like recent commit broke the sort order, fix it.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/meta/fbnic/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/meta/fbnic/Makefile b/drivers/net/ethernet/meta/fbnic/Makefile
index 239b2258ec65..0dbc634adb4b 100644
--- a/drivers/net/ethernet/meta/fbnic/Makefile
+++ b/drivers/net/ethernet/meta/fbnic/Makefile
@@ -20,6 +20,7 @@ fbnic-y := fbnic_csr.o \
fbnic_pci.o \
fbnic_phylink.o \
fbnic_rpc.o \
+ fbnic_time.o \
fbnic_tlv.o \
fbnic_txrx.o \
- fbnic_time.o
+# End of objects
--
2.48.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 1/5] net: report csum_complete via qstats
2025-02-11 18:13 ` [PATCH net-next 1/5] net: report csum_complete via qstats Jakub Kicinski
@ 2025-02-11 19:34 ` Joe Damato
0 siblings, 0 replies; 14+ messages in thread
From: Joe Damato @ 2025-02-11 19:34 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
On Tue, Feb 11, 2025 at 10:13:52AM -0800, Jakub Kicinski wrote:
> Commit 13c7c941e729 ("netdev: add qstat for csum complete") reserved
> the entry for csum complete in the qstats uAPI. Start reporting this
> value now that we have a driver which needs it.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: jdamato@fastly.com
> ---
> include/net/netdev_queues.h | 1 +
> net/core/netdev-genl.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/include/net/netdev_queues.h b/include/net/netdev_queues.h
> index 73d3401261a6..825141d675e5 100644
> --- a/include/net/netdev_queues.h
> +++ b/include/net/netdev_queues.h
> @@ -23,6 +23,7 @@ struct netdev_queue_stats_rx {
> u64 hw_drops;
> u64 hw_drop_overruns;
>
> + u64 csum_complete;
> u64 csum_unnecessary;
> u64 csum_none;
> u64 csum_bad;
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index 0dcd4faefd8d..c18bb53d13fd 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -581,6 +581,7 @@ netdev_nl_stats_write_rx(struct sk_buff *rsp, struct netdev_queue_stats_rx *rx)
> netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_ALLOC_FAIL, rx->alloc_fail) ||
> netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_HW_DROPS, rx->hw_drops) ||
> netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_HW_DROP_OVERRUNS, rx->hw_drop_overruns) ||
> + netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_COMPLETE, rx->csum_complete) ||
> netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_UNNECESSARY, rx->csum_unnecessary) ||
> netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_NONE, rx->csum_none) ||
> netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_CSUM_BAD, rx->csum_bad) ||
Reviewed-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 2/5] eth: fbnic: wrap tx queue stats in a struct
2025-02-11 18:13 ` [PATCH net-next 2/5] eth: fbnic: wrap tx queue stats in a struct Jakub Kicinski
@ 2025-02-11 19:41 ` Joe Damato
0 siblings, 0 replies; 14+ messages in thread
From: Joe Damato @ 2025-02-11 19:41 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
On Tue, Feb 11, 2025 at 10:13:53AM -0800, Jakub Kicinski wrote:
> The queue stats struct is used for Rx and Tx queues. Wrap
> the Tx stats in a struct and a union, so that we can reuse
> the same space for Rx stats on Rx queues.
>
> This also makes it easy to add an assert to the stat handling
> code to catch new stats not being aggregated on shutdown.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 8 ++++++--
> drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c | 8 ++++----
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 10 ++++++----
> 3 files changed, 16 insertions(+), 10 deletions(-)
Read through the driver and changes look good to me. Since I don't
have an fbnic or a lot of familiarity with the driver, I'll provide
a more modest:
Acked-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 3/5] eth: fbnic: report software Rx queue stats
2025-02-11 18:13 ` [PATCH net-next 3/5] eth: fbnic: report software Rx queue stats Jakub Kicinski
@ 2025-02-11 19:49 ` Joe Damato
0 siblings, 0 replies; 14+ messages in thread
From: Joe Damato @ 2025-02-11 19:49 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
On Tue, Feb 11, 2025 at 10:13:54AM -0800, Jakub Kicinski wrote:
> Gather and report software Rx queue stats - checksum stats
> and allocation failures.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 5 +++
> .../net/ethernet/meta/fbnic/fbnic_netdev.c | 12 +++++-
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 43 +++++++++++++++----
> 3 files changed, 51 insertions(+), 9 deletions(-)
Acked-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 4/5] eth: fbnic: report software Tx queue stats
2025-02-11 18:13 ` [PATCH net-next 4/5] eth: fbnic: report software Tx " Jakub Kicinski
@ 2025-02-11 19:52 ` Joe Damato
0 siblings, 0 replies; 14+ messages in thread
From: Joe Damato @ 2025-02-11 19:52 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
On Tue, Feb 11, 2025 at 10:13:55AM -0800, Jakub Kicinski wrote:
> Gather and report software Tx queue stats - checksum stats
> and queue stop / start.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.h | 3 +++
> .../net/ethernet/meta/fbnic/fbnic_netdev.c | 10 ++++++++
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 23 +++++++++++++++----
> 3 files changed, 32 insertions(+), 4 deletions(-)
Acked-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile
2025-02-11 18:13 ` [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile Jakub Kicinski
@ 2025-02-11 19:54 ` Joe Damato
2025-02-11 22:32 ` Jakub Kicinski
0 siblings, 1 reply; 14+ messages in thread
From: Joe Damato @ 2025-02-11 19:54 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
On Tue, Feb 11, 2025 at 10:13:56AM -0800, Jakub Kicinski wrote:
> Looks like recent commit broke the sort order, fix it.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> drivers/net/ethernet/meta/fbnic/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/meta/fbnic/Makefile b/drivers/net/ethernet/meta/fbnic/Makefile
> index 239b2258ec65..0dbc634adb4b 100644
> --- a/drivers/net/ethernet/meta/fbnic/Makefile
> +++ b/drivers/net/ethernet/meta/fbnic/Makefile
> @@ -20,6 +20,7 @@ fbnic-y := fbnic_csr.o \
> fbnic_pci.o \
> fbnic_phylink.o \
> fbnic_rpc.o \
> + fbnic_time.o \
> fbnic_tlv.o \
> fbnic_txrx.o \
> - fbnic_time.o
> +# End of objects
Incredibly minor nit, do you want to remove the trailing '\' after
fbnic_txrx.o which is the new last line to keep the format
consistent with how it was previously?
Your call, but I definitely feel bad pointing that out and
potentially causing a re-spin, so:
Acked-by: Joe Damato <jdamato@fastly.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile
2025-02-11 19:54 ` Joe Damato
@ 2025-02-11 22:32 ` Jakub Kicinski
2025-02-12 16:17 ` Alexander Lobakin
0 siblings, 1 reply; 14+ messages in thread
From: Jakub Kicinski @ 2025-02-11 22:32 UTC (permalink / raw)
To: Joe Damato
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
On Tue, 11 Feb 2025 11:54:37 -0800 Joe Damato wrote:
> Incredibly minor nit, do you want to remove the trailing '\' after
> fbnic_txrx.o which is the new last line to keep the format
> consistent with how it was previously?
The point of having the comment is that the last real line can have the
trailing \ and therefore will not need to be modified when an object is
added after it :)
Thanks for the reviews!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile
2025-02-11 22:32 ` Jakub Kicinski
@ 2025-02-12 16:17 ` Alexander Lobakin
0 siblings, 0 replies; 14+ messages in thread
From: Alexander Lobakin @ 2025-02-12 16:17 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Joe Damato, davem, alexanderduyck, netdev, edumazet, pabeni,
andrew+netdev, horms
From: Jakub Kicinski <kuba@kernel.org>
Date: Tue, 11 Feb 2025 14:32:34 -0800
> On Tue, 11 Feb 2025 11:54:37 -0800 Joe Damato wrote:
>> Incredibly minor nit, do you want to remove the trailing '\' after
>> fbnic_txrx.o which is the new last line to keep the format
>> consistent with how it was previously?
>
> The point of having the comment is that the last real line can have the
> trailing \ and therefore will not need to be modified when an object is
> added after it :)
Nice idea :D
>
> Thanks for the reviews!
Series:
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Thanks,
Olek
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH net-next 0/5] eth: fbnic: report software queue stats
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
` (4 preceding siblings ...)
2025-02-11 18:13 ` [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile Jakub Kicinski
@ 2025-02-13 0:50 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 14+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-13 0:50 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, alexanderduyck, netdev, edumazet, pabeni, andrew+netdev,
horms
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 11 Feb 2025 10:13:51 -0800 you wrote:
> Fill in typical software queue stats.
>
> # ./pyynl/cli.py --spec netlink/specs/netdev.yaml --dump qstats-get
> [{'ifindex': 2,
> 'rx-alloc-fail': 0,
> 'rx-bytes': 398064076,
> 'rx-csum-complete': 271,
> 'rx-csum-none': 0,
> 'rx-packets': 276044,
> 'tx-bytes': 7223770,
> 'tx-needs-csum': 28148,
> 'tx-packets': 28449,
> 'tx-stop': 0,
> 'tx-wake': 0}]
>
> [...]
Here is the summary with links:
- [net-next,1/5] net: report csum_complete via qstats
https://git.kernel.org/netdev/net-next/c/34eea78a1112
- [net-next,2/5] eth: fbnic: wrap tx queue stats in a struct
(no matching commit)
- [net-next,3/5] eth: fbnic: report software Rx queue stats
(no matching commit)
- [net-next,4/5] eth: fbnic: report software Tx queue stats
(no matching commit)
- [net-next,5/5] eth: fbnic: re-sort the objects in the Makefile
https://git.kernel.org/netdev/net-next/c/0ec023282a9d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-02-13 0:50 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 18:13 [PATCH net-next 0/5] eth: fbnic: report software queue stats Jakub Kicinski
2025-02-11 18:13 ` [PATCH net-next 1/5] net: report csum_complete via qstats Jakub Kicinski
2025-02-11 19:34 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 2/5] eth: fbnic: wrap tx queue stats in a struct Jakub Kicinski
2025-02-11 19:41 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 3/5] eth: fbnic: report software Rx queue stats Jakub Kicinski
2025-02-11 19:49 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 4/5] eth: fbnic: report software Tx " Jakub Kicinski
2025-02-11 19:52 ` Joe Damato
2025-02-11 18:13 ` [PATCH net-next 5/5] eth: fbnic: re-sort the objects in the Makefile Jakub Kicinski
2025-02-11 19:54 ` Joe Damato
2025-02-11 22:32 ` Jakub Kicinski
2025-02-12 16:17 ` Alexander Lobakin
2025-02-13 0:50 ` [PATCH net-next 0/5] eth: fbnic: report software queue stats patchwork-bot+netdevbpf
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).