Skip to content

Commit 10dec71

Browse files
committed
net: mana: Set tx_packets to post gso processing packet count
jira LE-4365 Rebuild_History Non-Buildable kernel-6.12.0-55.38.1.el10_0 commit-author Shradha Gupta <[email protected]> commit 7399ef9 Allow tx_packets and tx_bytes counter in the driver to represent the packets transmitted post GSO processing. Currently they are populated as bigger pre-GSO packets and bytes Signed-off-by: Shradha Gupta <[email protected]> Reviewed-by: Haiyang Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]> (cherry picked from commit 7399ef9) Signed-off-by: Jonathan Maple <[email protected]>
1 parent ac3647b commit 10dec71

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
250250
struct netdev_queue *net_txq;
251251
struct mana_stats_tx *tx_stats;
252252
struct gdma_queue *gdma_sq;
253+
int err, len, num_gso_seg;
253254
unsigned int csum_type;
254255
struct mana_txq *txq;
255256
struct mana_cq *cq;
256-
int err, len;
257257

258258
if (unlikely(!apc->port_is_up))
259259
goto tx_drop;
@@ -406,6 +406,7 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
406406
skb_queue_tail(&txq->pending_skbs, skb);
407407

408408
len = skb->len;
409+
num_gso_seg = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
409410
net_txq = netdev_get_tx_queue(ndev, txq_idx);
410411

411412
err = mana_gd_post_work_request(gdma_sq, &pkg.wqe_req,
@@ -430,10 +431,13 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
430431
/* skb may be freed after mana_gd_post_work_request. Do not use it. */
431432
skb = NULL;
432433

434+
/* Populated the packet and bytes counters based on post GSO packet
435+
* calculations
436+
*/
433437
tx_stats = &txq->stats;
434438
u64_stats_update_begin(&tx_stats->syncp);
435-
tx_stats->packets++;
436-
tx_stats->bytes += len;
439+
tx_stats->packets += num_gso_seg;
440+
tx_stats->bytes += len + ((num_gso_seg - 1) * gso_hs);
437441
u64_stats_update_end(&tx_stats->syncp);
438442

439443
tx_busy:

0 commit comments

Comments
 (0)