Skip to content

Commit b2cbbf3

Browse files
committed
net: mana: Set tx_packets to post gso processing packet count
jira LE-4385 Rebuild_History Non-Buildable kernel-5.14.0-570.52.1.el9_6 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 179040e commit b2cbbf3

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
@@ -249,10 +249,10 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
249249
struct netdev_queue *net_txq;
250250
struct mana_stats_tx *tx_stats;
251251
struct gdma_queue *gdma_sq;
252+
int err, len, num_gso_seg;
252253
unsigned int csum_type;
253254
struct mana_txq *txq;
254255
struct mana_cq *cq;
255-
int err, len;
256256

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

407407
len = skb->len;
408+
num_gso_seg = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
408409
net_txq = netdev_get_tx_queue(ndev, txq_idx);
409410

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

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

438442
tx_busy:

0 commit comments

Comments
 (0)