igc: fix RX timestamp handling and AF_XDP buffer sizing
Subsystems (6)
v3 cover igc: fix RX timestamp handling and AF_XDP buffer sizing
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
Signature · 1 line
2.56.GIT
PATCH v3 1/2 igc: only strip RX timestamp header from first buffer
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.
---
drivers/net/ethernet/intel/igc/igc_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igc/igc_main.c +2 -1
@@ -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 ;
Signature · 1 line
2.56.GIT
[email protected]
AI reviewRe: [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] At this commit by itself, the new first-buffer test !skb && igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP) in igc_clean_rx_irq()…
--
igc: only strip RX timestamp header from first buffer
igc_clean_rx_irq() used to subtract IGC_TS_HDR_LEN from every descriptor with TSIP set, which truncated multi-buffer packets. With this patch the timestamp header is only stripped when skb is NULL, which the commit treats as marking the first buffer of a new packet.
Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0
drivers/net/ethernet/intel/igc/igc_main.c static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) · line 2646
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_main.c +2
-1@@ -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 ;
[Severity: High]
Is skb == NULL a reliable first-buffer marker when an XDP program is attached? The commit message says:
Only consume the timestamp header when skb is NULL, which identifies the first buffer of a new packet.
Suppose igc_xdp_run_prog() returns IGC_XDP_CONSUMED, IGC_XDP_TX or IGC_XDP_REDIRECT for the first, non-EOP buffer of a multi-descriptor frame. Then no skb is built, and igc_clean_rx_irq() moves on to the continuation descriptor with skb still NULL:
/* fetch next buffer in frame if non-eop */ if (igc_is_non_eop(rx_ring, rx_desc)) continue;
The continuation descriptor still has TSIP set, so this check strips IGC_TS_HDR_LEN a second time. If that descriptor holds fewer than 16 bytes, can the unsigned size wrap here?
The continuation buffer then goes through the new-frame path:
if (!skb) {
xdp_init_buff(&ctx.xdp, truesize, &rx_ring->xdp_rxq);
xdp_prepare_buff(&ctx.xdp, pktbuf - igc_rx_offset(rx_ring),
igc_rx_offset(rx_ring) + pkt_offset,
size, true);In that case the XDP program would see a data_end about 4 GiB past data. On XDP_PASS, the same size would reach igc_build_skb() or igc_construct_skb(), and the __skb_put() there does not check it.
At this commit, XDP with multi-descriptor frames looks possible on kernels with PAGE_SIZE >= 8192. igc_set_rx_mode() only clamps RLPML under the small-page #if:
#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);
On large-page kernels, RLPML therefore stays at MAX_JUMBO_FRAME_SIZE while igc_rx_bufsz() returns IGC_RXBUFFER_2048. igc_xdp_set_prog() only checks dev->mtu > ETH_DATA_LEN, not the hardware receive length limit.
This needs RX hardware timestamping enabled, an XDP program that returns a non-PASS verdict for a first buffer, and a peer that sends frames larger than about 2032 bytes.
The next patch in this series, "igc: fix AF_XDP receive buffer size for 2K UMEM chunks", adds igc_set_rlpml(). It caps RLPML at 1526 bytes whenever XDP is enabled, whatever PAGE_SIZE is. It is called from igc_setup_rctl() and igc_xdp_set_prog(). With that change, XDP frames always fit in a single descriptor, and skb == NULL becomes a correct first-buffer marker.
This patch is tagged Cc: stable and could be backported on its own. Should it depend on that follow-up change, or should the two patches be swapped in the series?
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261028083344.3047350-1-p%401g4.org
Re: [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer
Quoted 91 lines · On Thu, Oct 29, 2026 at 11:37:20PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] At this commit by itself, the new first-buffer test
!skb && igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP)in igc_clean_rx_irq()…--
igc: only strip RX timestamp header from first buffer
igc_clean_rx_irq()used to subtractIGC_TS_HDR_LENfrom every descriptor with TSIP set, which truncated multi-buffer packets. With this patch the timestamp header is only stripped when skb is NULL, which the commit treats as marking the first buffer of a new packet.Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0drivers/net/ethernet/intel/igc/igc_main.c static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) · line 2646
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_main.c +2
-1@@ -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 ;[Severity: High]
Is skb == NULL a reliable first-buffer marker when an XDP program is attached? The commit message says:
Only consume the timestamp header when skb is NULL, which identifies the first buffer of a new packet.
Suppose
igc_xdp_run_prog()returnsIGC_XDP_CONSUMED,IGC_XDP_TXorIGC_XDP_REDIRECTfor the first, non-EOP buffer of a multi-descriptor frame. Then no skb is built, andigc_clean_rx_irq()moves on to the continuation descriptor with skb still NULL:/* fetch next buffer in frame if non-eop */ if (igc_is_non_eop(rx_ring, rx_desc)) continue;The continuation descriptor still has TSIP set, so this check strips
IGC_TS_HDR_LENa second time. If that descriptor holds fewer than 16 bytes, can the unsigned size wrap here?The continuation buffer then goes through the new-frame path:
if (!skb) { xdp_init_buff(&ctx.xdp, truesize, &rx_ring->xdp_rxq); xdp_prepare_buff(&ctx.xdp, pktbuf - igc_rx_offset(rx_ring), igc_rx_offset(rx_ring) + pkt_offset, size, true);In that case the XDP program would see a
data_endabout 4 GiB past data. OnXDP_PASS, the same size would reachigc_build_skb()origc_construct_skb(), and the__skb_put()there does not check it.At this commit, XDP with multi-descriptor frames looks possible on kernels with
PAGE_SIZE>= 8192.igc_set_rx_mode()only clamps RLPML under the small-page #if:#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);On large-page kernels, RLPML therefore stays at
MAX_JUMBO_FRAME_SIZEwhileigc_rx_bufsz()returnsIGC_RXBUFFER_2048.igc_xdp_set_prog()only checksdev->mtu>ETH_DATA_LEN, not the hardware receive length limit.This needs RX hardware timestamping enabled, an XDP program that returns a non-PASS verdict for a first buffer, and a peer that sends frames larger than about 2032 bytes.
Quoted 5 lines
The next patch in this series, "igc: fix
AF_XDPreceive buffer size for 2K UMEM chunks", addsigc_set_rlpml(). It caps RLPML at 1526 bytes whenever XDP is enabled, whateverPAGE_SIZEis. It is called fromigc_setup_rctl()andigc_xdp_set_prog(). With that change, XDP frames always fit in a single descriptor, and skb == NULL becomes a correct first-buffer marker.
Wow - finally.
Quoted 4 lines
This patch is tagged Cc: stable and could be backported on its own. Should it depend on that follow-up change, or should the two patches be swapped in the series?
How would we make sure both commits from this set get actually backported together?
Quoted 3 lines
Signature · 2 lines
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261028083344.3047350-1-p%401g4.org
Re: [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer
Quoted 101 lines · Maciej Fijalkowski
Quoted 91 lines · On Thu, Oct 29, 2026 at 11:37:20PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] At this commit by itself, the new first-buffer test
!skb && igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP)in igc_clean_rx_irq()…--
igc: only strip RX timestamp header from first buffer
igc_clean_rx_irq()used to subtractIGC_TS_HDR_LENfrom every descriptor with TSIP set, which truncated multi-buffer packets. With this patch the timestamp header is only stripped when skb is NULL, which the commit treats as marking the first buffer of a new packet.Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0drivers/net/ethernet/intel/igc/igc_main.c static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) · line 2646
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_main.c +2
-1@@ -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 ;[Severity: High]
Is skb == NULL a reliable first-buffer marker when an XDP program is attached? The commit message says:
Only consume the timestamp header when skb is NULL, which identifies the first buffer of a new packet.
Suppose
igc_xdp_run_prog()returnsIGC_XDP_CONSUMED,IGC_XDP_TXorIGC_XDP_REDIRECTfor the first, non-EOP buffer of a multi-descriptor frame. Then no skb is built, andigc_clean_rx_irq()moves on to the continuation descriptor with skb still NULL:/* fetch next buffer in frame if non-eop */ if (igc_is_non_eop(rx_ring, rx_desc)) continue;The continuation descriptor still has TSIP set, so this check strips
IGC_TS_HDR_LENa second time. If that descriptor holds fewer than 16 bytes, can the unsigned size wrap here?The continuation buffer then goes through the new-frame path:
if (!skb) { xdp_init_buff(&ctx.xdp, truesize, &rx_ring->xdp_rxq); xdp_prepare_buff(&ctx.xdp, pktbuf - igc_rx_offset(rx_ring), igc_rx_offset(rx_ring) + pkt_offset, size, true);In that case the XDP program would see a
data_endabout 4 GiB past data. OnXDP_PASS, the same size would reachigc_build_skb()origc_construct_skb(), and the__skb_put()there does not check it.At this commit, XDP with multi-descriptor frames looks possible on kernels with
PAGE_SIZE>= 8192.igc_set_rx_mode()only clamps RLPML under the small-page #if:#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);On large-page kernels, RLPML therefore stays at
MAX_JUMBO_FRAME_SIZEwhileigc_rx_bufsz()returnsIGC_RXBUFFER_2048.igc_xdp_set_prog()only checksdev->mtu>ETH_DATA_LEN, not the hardware receive length limit.This needs RX hardware timestamping enabled, an XDP program that returns a non-PASS verdict for a first buffer, and a peer that sends frames larger than about 2032 bytes.
Quoted 5 lines
The next patch in this series, "igc: fix
AF_XDPreceive buffer size for 2K UMEM chunks", addsigc_set_rlpml(). It caps RLPML at 1526 bytes whenever XDP is enabled, whateverPAGE_SIZEis. It is called fromigc_setup_rctl()andigc_xdp_set_prog(). With that change, XDP frames always fit in a single descriptor, and skb == NULL becomes a correct first-buffer marker.Wow - finally.
Quoted 1 line
Quoted 11 lines
Quoted 3 lines
This patch is tagged Cc: stable and could be backported on its own. Should it depend on that follow-up change, or should the two patches be swapped in the series?
How would we make sure both commits from this set get actually backported together?
Quoted 3 lines
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261028083344.3047350-1-p%401g4.org
I did forget to tag yours for stable, so maybe the will satisfy it?
I think ultimately, it sees all related bugs as one big problem in an effort to catch adjacent. My understanding has been that unless there's true interdependence of patches, ie. kernel will be left broken unless taken together, a series in itself adequately satisfies this requirement.
Should I do a v4 to add the tag? Or can this be rectified through intel's process?
Paul
Re: [PATCH net v3 1/2] igc: only strip RX timestamp header from first buffer
Quoted 121 lines · Paul Moses
Quoted 101 lines · Maciej Fijalkowski
Quoted 91 lines · On Thu, Oct 29, 2026 at 11:37:20PM +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [High] At this commit by itself, the new first-buffer test
!skb && igc_test_staterr(rx_desc, IGC_RXDADV_STAT_TSIP)in igc_clean_rx_irq()…--
igc: only strip RX timestamp header from first buffer
igc_clean_rx_irq()used to subtractIGC_TS_HDR_LENfrom every descriptor with TSIP set, which truncated multi-buffer packets. With this patch the timestamp header is only stripped when skb is NULL, which the commit treats as marking the first buffer of a new packet.Quoted 5 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0drivers/net/ethernet/intel/igc/igc_main.c static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) · line 2646
Quoted 9 lines
drivers/net/ethernet/intel/igc/igc_main.c +2
-1@@ -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 ;[Severity: High]
Is skb == NULL a reliable first-buffer marker when an XDP program is attached? The commit message says:
Only consume the timestamp header when skb is NULL, which identifies the first buffer of a new packet.
Suppose
igc_xdp_run_prog()returnsIGC_XDP_CONSUMED,IGC_XDP_TXorIGC_XDP_REDIRECTfor the first, non-EOP buffer of a multi-descriptor frame. Then no skb is built, andigc_clean_rx_irq()moves on to the continuation descriptor with skb still NULL:/* fetch next buffer in frame if non-eop */ if (igc_is_non_eop(rx_ring, rx_desc)) continue;The continuation descriptor still has TSIP set, so this check strips
IGC_TS_HDR_LENa second time. If that descriptor holds fewer than 16 bytes, can the unsigned size wrap here?The continuation buffer then goes through the new-frame path:
if (!skb) { xdp_init_buff(&ctx.xdp, truesize, &rx_ring->xdp_rxq); xdp_prepare_buff(&ctx.xdp, pktbuf - igc_rx_offset(rx_ring), igc_rx_offset(rx_ring) + pkt_offset, size, true);In that case the XDP program would see a
data_endabout 4 GiB past data. OnXDP_PASS, the same size would reachigc_build_skb()origc_construct_skb(), and the__skb_put()there does not check it.At this commit, XDP with multi-descriptor frames looks possible on kernels with
PAGE_SIZE>= 8192.igc_set_rx_mode()only clamps RLPML under the small-page #if:#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);On large-page kernels, RLPML therefore stays at
MAX_JUMBO_FRAME_SIZEwhileigc_rx_bufsz()returnsIGC_RXBUFFER_2048.igc_xdp_set_prog()only checksdev->mtu>ETH_DATA_LEN, not the hardware receive length limit.This needs RX hardware timestamping enabled, an XDP program that returns a non-PASS verdict for a first buffer, and a peer that sends frames larger than about 2032 bytes.
Quoted 5 lines
The next patch in this series, "igc: fix
AF_XDPreceive buffer size for 2K UMEM chunks", addsigc_set_rlpml(). It caps RLPML at 1526 bytes whenever XDP is enabled, whateverPAGE_SIZEis. It is called fromigc_setup_rctl()andigc_xdp_set_prog(). With that change, XDP frames always fit in a single descriptor, and skb == NULL becomes a correct first-buffer marker.Wow - finally.
Quoted 1 line
Quoted 11 lines
Quoted 3 lines
This patch is tagged Cc: stable and could be backported on its own. Should it depend on that follow-up change, or should the two patches be swapped in the series?
How would we make sure both commits from this set get actually backported together?
Quoted 3 lines
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261028083344.3047350-1-p%401g4.orgI did forget to tag yours for stable, so maybe the will satisfy it?
Quoted 7 lines
I think ultimately, it sees all related bugs as one big problem in an effort to catch adjacent. My understanding has been that unless there's true interdependence of patches, ie. kernel will be left broken unless taken together, a series in itself adequately satisfies this requirement.
Should I do a v4 to add the tag? Or can this be rectified through intel's process?
Jake could you make sure we tag 2/2 as stable backport candidate?
Let's not send v4 and start the whole process again, bots are rather happy so the ball is on tester's side now.
Thanks a lot Paul!
Quoted 2 lines
Paul
PATCH v3 2/2 igc: fix AF_XDP receive buffer size for 2K UMEM chunks
In reply to Paul MosesFrom: Maciej Fijalkowski <[email protected]>
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.
--- 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(-)
drivers/net/ethernet/intel/igc/igc.h +1 -0
@@ -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);
drivers/net/ethernet/intel/igc/igc_main.c +25 -8
@@ -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); }/**
drivers/net/ethernet/intel/igc/igc_xdp.c +7 -4
@@ -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 ; }
Signature · 1 line
2.56.GIT
RE: [PATCH net v3 2/2] igc: fix AF_XDP receive buffer size for 2K UMEM chunks
Quoted 11 lines
-----Original Message-----
From: Paul Moses <[email protected]>
Sent: Wednesday, October 28, 2026 9:35 AM
To: [email protected]
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected];
Quoted 9 lines
[email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Fijalkowski, Maciej <[email protected]>; [email protected]; Loktionov, Aleksandr <[email protected]>; Dahan, AvigailX <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH net v3 2/2] igc: fixAF_XDPreceive buffer size for 2K UMEM chunks
nit: Perhaps use "2 KiB" instead of "2K" here, as the latter does not specify the unit.
Quoted 53 lines
From: Maciej Fijalkowski <[email protected]>
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 fromigc_setup_rctl()instead, next to RCTL.LPE, and fromigc_xdp_set_prog()while the rings are disabled. This avoidsnetif_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 <[email protected]>Signed-off-by Paul Moses <[email protected]>--- 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(-)drivers/net/ethernet/intel/igc/igc.h +1
-0@@ -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,drivers/net/ethernet/intel/igc/igc.h +0
-0u32 location);drivers/net/ethernet/intel/igc/igc_main.c +0
-0
drivers/net/ethernet/intel/igc/igc_main.c static void igc_configure_rx_ring(struct · line 677
Quoted 4 lines
drivers/net/ethernet/intel/igc/igc_main.c +0
-0@@ -674,8 +674,11 @@ static void igc_configure_rx_ring(struct igc_adapter *adapter, ring->next_to_clean =0 ; ring->next_to_use =0 ;
Also, below:
drivers/net/ethernet/intel/igc/igc_main.c static void igc_configure_rx_ring(struct igc_adapter *adapter, · line 679
Quoted 3 lines
drivers/net/ethernet/intel/igc/igc_main.c +3
-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. +*/
"2kb" normally means 2 kilobits, whereas the buffer size here is 2048 bytes. I suggest using "2 KiB" consistently in the subject, commit message, and comments.
...
Also, below:
drivers/net/ethernet/intel/igc/igc_main.c static void igc_setup_mrqc(struct igc_adapter *adapter) · line 854
Quoted 11 lines
drivers/net/ethernet/intel/igc/igc_main.c +2
-0+/* igc's XDP currently does not support jumbo frames. Limit the +* accepted packet size regardless of PAGE_SIZE so it fits in a 2kb
drivers/net/ethernet/intel/igc/igc_main.c +8
-0+* XSK chunk. +*/ +if (igc_xdp_is_enabled (adapter)) + rlpml =ETH_FRAME_LEN +VLAN_HLEN *2 +ETH_FCS_LEN ; + +wr32 (IGC_RLPML , rlpml); +} +
Otherwise, looks fine for me