Skip to content

Commit 59deadd

Browse files
Shradha GuptaNipaLocal
authored andcommitted
net: mana: Set tx_packets to post gso processing packet count
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: NipaLocal <nipa@local>
1 parent a5cb78c commit 59deadd

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
@@ -251,10 +251,10 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
251251
struct netdev_queue *net_txq;
252252
struct mana_stats_tx *tx_stats;
253253
struct gdma_queue *gdma_sq;
254+
int err, len, num_gso_seg;
254255
unsigned int csum_type;
255256
struct mana_txq *txq;
256257
struct mana_cq *cq;
257-
int err, len;
258258

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

409409
len = skb->len;
410+
num_gso_seg = skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
410411
net_txq = netdev_get_tx_queue(ndev, txq_idx);
411412

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

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

440444
tx_busy:

0 commit comments

Comments
 (0)