* [PATCH net v3 0/2] igc: fix RX timestamp handling and AF_XDP buffer sizing
@ 2026-10-28 8:34 Paul Moses
2026-10-28 8:35 ` [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer Paul Moses
2026-10-28 8:35 ` [PATCH net v3 2/2] igc: fix AF_XDP receive buffer size for 2K UMEM chunks Paul Moses
0 siblings, 2 replies; 3+ messages in thread
From: Paul Moses @ 2026-10-28 8:34 UTC (permalink / raw)
To: intel-wired-lan
Cc: netdev, anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev,
davem, edumazet, kuba, pabeni, ast, daniel, hawk, john.fastabend,
sdf, vedang.patel, jithu.joseph, maciej.fijalkowski,
andre.guedes, aleksandr.loktionov, avigailx.dahan, linux-kernel,
bpf, stable
v2..v3
Restore the original timestamp fix and description instead of tracking
frame boundaries. Patch 2 carries Maciej's AF_XDP buffer-size fix unchanged.
v1..v2
Changed commit message in attempt to satisfy bots. No code changes.
Maciej's patch:
https://lore.kernel.org/all/at+t%2FjHczGvyXKRN@boxer/
#
# REPRO
#
# Receiver: igc / enp1s0 / 10.0.5.175
# Sender: RTL8125B / enP4p65s0 / 10.0.5.165
# Both hosts
sudo ip link set dev enp1s0 mtu 9000
sudo ip link set dev enP4p65s0 mtu 9000
# Baseline: RX timestamping off
sudo hwstamp_ctl -i enp1s0 -t 0 -r 0
ping -n -M do -c 5 -s 8972 10.0.5.175
# 5/5 received
# Enable RX timestamping only
sudo hwstamp_ctl -i enp1s0 -t 0 -r 1
# Receiver
sudo timeout 20 tcpdump -ni enp1s0 -s 0 -w /tmp/igc-jumbo.pcap \
'icmp and host 10.0.5.165'
# Sender
ping -n -M do -c 5 -W 2 -s 8972 10.0.5.175
# 0/5 received
# Receiver
sudo tcpdump -nn -e -vvv -r /tmp/igc-jumbo.pcap
# length 8950
# [total length 9000 > length 8936] (invalid)
# wrong icmp cksum
# Expected Ethernet length: 9014
# Captured length: 8950
# Loss: 64 = 4 continuation buffers * 16 bytes
# Disable RX timestamping again
sudo hwstamp_ctl -i enp1s0 -t 0 -r 0
ping -n -M do -c 5 -s 8972 10.0.5.175
# 5/5 received
--
2.56.GIT
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer
2026-10-28 8:34 [PATCH net v3 0/2] igc: fix RX timestamp handling and AF_XDP buffer sizing Paul Moses
@ 2026-10-28 8:35 ` Paul Moses
2026-10-28 8:35 ` [PATCH net v3 2/2] igc: fix AF_XDP receive buffer size for 2K UMEM chunks Paul Moses
1 sibling, 0 replies; 3+ messages in thread
From: Paul Moses @ 2026-10-28 8:35 UTC (permalink / raw)
To: intel-wired-lan
Cc: netdev, anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev,
davem, edumazet, kuba, pabeni, ast, daniel, hawk, john.fastabend,
sdf, vedang.patel, jithu.joseph, maciej.fijalkowski,
andre.guedes, aleksandr.loktionov, avigailx.dahan, linux-kernel,
bpf, stable
igc_clean_rx_irq() strips IGC_TS_HDR_LEN whenever a descriptor reports
IGC_RXDADV_STAT_TSIP. For multi-buffer packets, continuation descriptors
retain TSIP even though the inline timestamp is present only in the first
RX buffer.
Subtracting the header length from each continuation buffer truncates
jumbo packets by 16 bytes per continuation and leaves the packet length
larger than the received data.
Only consume the timestamp header when skb is NULL, which identifies the
first buffer of a new packet. An skb carried in rx_ring->skb remains
non-NULL when packet assembly resumes in a later NAPI poll.
Link: https://lore.kernel.org/all/20260625-igb-rx-ts-fix-v3-1-99b3efa08dca@aweta.nl/
Fixes: e1ed4f92a625 ("igc: Refactor Rx timestamp handling")
Cc: stable@vger.kernel.org
Signed-off-by: Paul Moses <p@1g4.org>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: Avigail Dahan <avigailx.dahan@intel.com>
---
drivers/net/ethernet/intel/igc/igc_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 1fb5f3cbe..41b293dc1 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -2639,7 +2639,8 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)
pktbuf = page_address(rx_buffer->page) + rx_buffer->page_offset;
- if (igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP)) {
+ if (!skb &&
+ igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP)) {
ctx.rx_ts = pktbuf;
pkt_offset = IGC_TS_HDR_LEN;
size -= IGC_TS_HDR_LEN;
--
2.56.GIT
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net v3 2/2] igc: fix AF_XDP receive buffer size for 2K UMEM chunks
2026-10-28 8:34 [PATCH net v3 0/2] igc: fix RX timestamp handling and AF_XDP buffer sizing Paul Moses
2026-10-28 8:35 ` [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer Paul Moses
@ 2026-10-28 8:35 ` Paul Moses
1 sibling, 0 replies; 3+ messages in thread
From: Paul Moses @ 2026-10-28 8:35 UTC (permalink / raw)
To: intel-wired-lan
Cc: netdev, anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev,
davem, edumazet, kuba, pabeni, ast, daniel, hawk, john.fastabend,
sdf, vedang.patel, jithu.joseph, maciej.fijalkowski,
andre.guedes, aleksandr.loktionov, avigailx.dahan, linux-kernel,
bpf, stable
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
SRRCTL.BSIZEPKT has a granularity of 1 KiB. With a 2 KiB UMEM
chunk and the default XDP headroom, xsk_pool_get_rx_frame_size()
returns 1792. Programming this value truncates the hardware receive
buffer size to 1 KiB, even though an MTU-sized frame fits in the
usable UMEM area.
XDP on igc is limited to MTU 1500, so configure a 2 KiB receive
buffer for XSK rings. Limit RLPML to the maximum supported Ethernet
frame size while XDP is attached, regardless of PAGE_SIZE, to avoid
oversized frames spanning descriptors or exceeding the usable UMEM
space.
RLPML is currently programmed from igc_set_rx_mode(), which can run
without RTNL, for example on an IPv6 multicast join, and could then
use a stale XDP state. RLPML does not depend on the address lists.
Program it from igc_setup_rctl() instead, next to RCTL.LPE, and from
igc_xdp_set_prog() while the rings are disabled. This avoids
netif_addr_lock_bh() usage.
Validate that the XSK frame size accommodates a maximum-size frame
with two VLAN tags, FCS and the optional inline RX timestamp. Check
against the maximum supported XDP MTU, rather than the current MTU,
which can change after the socket is bound.
Fixes: fc9df2a0b520 ("igc: Enable RX via AF_XDP zero-copy")
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Paul Moses <p@1g4.org>
---
drivers/net/ethernet/intel/igc/igc.h | 1 +
drivers/net/ethernet/intel/igc/igc_main.c | 33 +++++++++++++++++------
drivers/net/ethernet/intel/igc/igc_xdp.c | 11 +++++---
3 files changed, 33 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index 17f213cc9..ad1062f85 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -765,6 +765,7 @@ static inline s32 igc_read_phy_reg(struct igc_hw *hw, u32 offset, u16 *data)
return -EOPNOTSUPP;
}
+void igc_set_rlpml(struct igc_adapter *adapter);
void igc_reinit_locked(struct igc_adapter *);
struct igc_nfc_rule *igc_get_nfc_rule(struct igc_adapter *adapter,
u32 location);
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 41b293dc1..6b418dc71 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -674,8 +674,11 @@ static void igc_configure_rx_ring(struct igc_adapter *adapter,
ring->next_to_clean = 0;
ring->next_to_use = 0;
+ /* igc's XDP limits MTU to 1500; all XSK RX buffers can use 2kb;
+ * RLPML limits the receive length to fit after UMEM headroom.
+ */
if (ring->xsk_pool)
- buf_size = xsk_pool_get_rx_frame_size(ring->xsk_pool);
+ buf_size = IGC_RXBUFFER_2048;
else if (ring_uses_large_buffer(ring))
buf_size = IGC_RXBUFFER_3072;
else
@@ -830,6 +833,25 @@ static void igc_setup_mrqc(struct igc_adapter *adapter)
wr32(IGC_MRQC, mrqc);
}
+void igc_set_rlpml(struct igc_adapter *adapter)
+{
+ struct igc_hw *hw = &adapter->hw;
+ u32 rlpml = MAX_JUMBO_FRAME_SIZE;
+
+#if (PAGE_SIZE < 8192)
+ if (adapter->max_frame_size <= IGC_MAX_FRAME_BUILD_SKB)
+ rlpml = IGC_MAX_FRAME_BUILD_SKB;
+#endif
+ /* igc's XDP currently does not support jumbo frames. Limit the
+ * accepted packet size regardless of PAGE_SIZE so it fits in a 2kb
+ * XSK chunk.
+ */
+ if (igc_xdp_is_enabled(adapter))
+ rlpml = ETH_FRAME_LEN + VLAN_HLEN * 2 + ETH_FCS_LEN;
+
+ wr32(IGC_RLPML, rlpml);
+}
+
/**
* igc_setup_rctl - configure the receive control registers
* @adapter: Board private structure
@@ -874,6 +896,7 @@ static void igc_setup_rctl(struct igc_adapter *adapter)
IGC_RCTL_CFIEN); /* Disable VLAN CFIEN Filter */
}
+ igc_set_rlpml(adapter);
wr32(IGC_RCTL, rctl);
}
@@ -4117,7 +4140,7 @@ static void igc_set_rx_mode(struct net_device *netdev)
{
struct igc_adapter *adapter = netdev_priv(netdev);
struct igc_hw *hw = &adapter->hw;
- u32 rctl = 0, rlpml = MAX_JUMBO_FRAME_SIZE;
+ u32 rctl = 0;
int count;
/* Check for Promiscuous and All Multicast modes */
@@ -4147,12 +4170,6 @@ static void igc_set_rx_mode(struct net_device *netdev)
/* update state of unicast and multicast */
rctl |= rd32(IGC_RCTL) & ~(IGC_RCTL_UPE | IGC_RCTL_MPE);
wr32(IGC_RCTL, rctl);
-
-#if (PAGE_SIZE < 8192)
- if (adapter->max_frame_size <= IGC_MAX_FRAME_BUILD_SKB)
- rlpml = IGC_MAX_FRAME_BUILD_SKB;
-#endif
- wr32(IGC_RLPML, rlpml);
}
/**
diff --git a/drivers/net/ethernet/intel/igc/igc_xdp.c b/drivers/net/ethernet/intel/igc/igc_xdp.c
index 9eb47b4be..a0f1ecb2e 100644
--- a/drivers/net/ethernet/intel/igc/igc_xdp.c
+++ b/drivers/net/ethernet/intel/igc/igc_xdp.c
@@ -34,6 +34,8 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog,
}
old_prog = xchg(&adapter->xdp_prog, prog);
+ if (if_running && need_update)
+ igc_set_rlpml(adapter);
if (old_prog)
bpf_prog_put(old_prog);
@@ -69,11 +71,12 @@ static int igc_xdp_enable_pool(struct igc_adapter *adapter,
return -EINVAL;
frame_size = xsk_pool_get_rx_frame_size(pool);
- if (frame_size < ETH_FRAME_LEN + VLAN_HLEN * 2) {
+ if (frame_size < ETH_FRAME_LEN + VLAN_HLEN * 2 +
+ ETH_FCS_LEN + IGC_TS_HDR_LEN) {
/* When XDP is enabled, the driver doesn't support frames that
- * span over multiple buffers. To avoid that, we check if xsk
- * frame size is big enough to fit the max ethernet frame size
- * + vlan double tagging.
+ * span multiple buffers. Check the maximum supported MTU, not
+ * current MTU, as it may change while the pool is bound. Account
+ * for double VLAN tags, FCS and inline RX timestamping.
*/
return -EOPNOTSUPP;
}
--
2.56.GIT
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-28 8:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 8:34 [PATCH net v3 0/2] igc: fix RX timestamp handling and AF_XDP buffer sizing Paul Moses
2026-10-28 8:35 ` [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer Paul Moses
2026-10-28 8:35 ` [PATCH net v3 2/2] igc: fix AF_XDP receive buffer size for 2K UMEM chunks Paul Moses
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®