Skip to contentSkip to conversation

ixgbe: fix AF_XDP tx byte count

PATCH In review William Tu 3 participants 4 messages Apr 3, 2019 – Apr 4, 2019

Subsystems (3)
lore
Share & tools
lore

William Tu

author
#0 lore raw

PATCH 1/2 ixgbe: fix AF_XDP tx byte count

The tx bytecount is done twice. When running './xdpsock -t -N -i eth3' and 'ip -s link show dev eth3' The avg packet size is 120 instead of 60. So remove the extra one.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +0 -1
index bfe95ce0bd7f..71b8474a9b4c 100644
@@ -704,7 +704,6 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
 			xsk_frames++;
 
 		tx_bi->xdpf = NULL;
-		total_bytes += tx_bi->bytecount;
 
 		tx_bi++;
 		tx_desc++;
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 ixgbe: fix AF_XDP tx packet count.

The total_packets count at ixgbe_clean_xdp_tx_irq is always zero when testing with xdpsock -t -N. Set the gso_segs to 1 to make the tx packet count correct.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +1 -0
index 71b8474a9b4c..1a60764fb39b 100644
@@ -640,6 +640,7 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)
 		tx_bi = &xdp_ring->tx_buffer_info[xdp_ring->next_to_use];
 		tx_bi->bytecount = len;
 		tx_bi->xdpf = NULL;
+		tx_bi->gso_segs = 1;
 
 		tx_desc = IXGBE_TX_DESC(xdp_ring, xdp_ring->next_to_use);
 		tx_desc->read.buffer_addr = cpu_to_le64(dma);
Signature · 1 line
2.7.4
#2 lore raw
In reply to William Tu

[ +Jeff ]

Given these two are contained to ixgbe, I presume Jeff wants to pick these up instead via his tree?

Quoted 23 lines · William Tu

The tx bytecount is done twice. When running './xdpsock -t -N -i eth3' and 'ip -s link show dev eth3' The avg packet size is 120 instead of 60. So remove the extra one.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +0 -1
index bfe95ce0bd7f..71b8474a9b4c 100644
@@ -704,7 +704,6 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
 			xsk_frames++;
 
 		tx_bi->xdpf = NULL;
-		total_bytes += tx_bi->bytecount;
 
 		tx_bi++;
 		tx_desc++;
#3 lore raw
Quoted 8 lines · Daniel Borkmann

[ +Jeff ]

Given these two are contained to ixgbe, I presume Jeff wants to pick these up instead via his tree?

Yes, I will be picking them up.

Quoted 26 lines
Quoted 25 lines · William Tu

The tx bytecount is done twice. When running './xdpsock -t -N -i eth3' and 'ip -s link show dev eth3' The avg packet size is 120 instead of 60. So remove the extra one.

---
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 1 -

1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +0 -1
index bfe95ce0bd7f..71b8474a9b4c 100644
@@ -704,7 +704,6 @@ bool ixgbe_clean_xdp_tx_irq(struct ixgbe_q_vector *q_vector,
           xsk_frames++;
 
       tx_bi->xdpf = NULL;
-        total_bytes += tx_bi->bytecount;
 
       tx_bi++;
       tx_desc++;