* [PATCH v1 iwl-net 0/2] idpf: Fix Rx header split overflow edge cases.
@ 2026-12-05 12:43 Kuniyuki Iwashima
2026-12-05 12:43 ` [PATCH v1 iwl-net 1/2] idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa() Kuniyuki Iwashima
2026-12-05 12:43 ` [PATCH v1 iwl-net 2/2] idpf: Linearise headers and fix segments calculation in idpf_rx_rsc() Kuniyuki Iwashima
0 siblings, 2 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-12-05 12:43 UTC (permalink / raw)
To: Alexander Lobakin, Tony Nguyen, Przemek Kitszel
Cc: Madhu Chittim, Phani Burra, Sridhar Samudrala, Brian Vazquez,
David Decotigny, Li Li, Kuniyuki Iwashima, Kuniyuki Iwashima,
intel-wired-lan
This series fixes two bugs on the splitq Rx header split overflow
(!hdr_len) path in idpf.
Patch 1 skips idpf_rx_hsplit_wa() when pkt_len is 0 so an empty
descriptor is not recycled twice.
Patch 2 pulls the IP and TCP headers (including TCP options) in
idpf_rx_rsc() before accessing ip_hdr(), ipv6_hdr(), and tcp_hdr(),
and computes rsc_segments from the TCP payload length rather than
skb->data_len.
Kuniyuki Iwashima (2):
idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa().
idpf: Linearise headers and fix segments calculation in idpf_rx_rsc().
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 45 ++++++++++++---------
1 file changed, 27 insertions(+), 18 deletions(-)
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 iwl-net 1/2] idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa().
2026-12-05 12:43 [PATCH v1 iwl-net 0/2] idpf: Fix Rx header split overflow edge cases Kuniyuki Iwashima
@ 2026-12-05 12:43 ` Kuniyuki Iwashima
2026-12-05 13:07 ` sashiko-bot
2026-12-05 12:43 ` [PATCH v1 iwl-net 2/2] idpf: Linearise headers and fix segments calculation in idpf_rx_rsc() Kuniyuki Iwashima
1 sibling, 1 reply; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-12-05 12:43 UTC (permalink / raw)
To: Alexander Lobakin, Tony Nguyen, Przemek Kitszel
Cc: Madhu Chittim, Phani Burra, Sridhar Samudrala, Brian Vazquez,
David Decotigny, Li Li, Kuniyuki Iwashima, Kuniyuki Iwashima,
intel-wired-lan
When header split fails to separate the header (!hdr_len) and pkt_len
is 0, idpf_rx_splitq_clean() calls idpf_rx_hsplit_wa() with pkt_len == 0.
idpf_rx_hsplit_wa() invokes libeth_rx_sync_for_cpu(buf, 0), which
immediately recycles the payload netmem. Execution then continues
to the payload label, where libeth_xdp_process_buff(xdp, rx_buf, 0)
calls libeth_rx_sync_for_cpu() and recycles the same netmem a
second time.
Let's skip idpf_rx_hsplit_wa() when pkt_len is 0 so empty descriptors
are handled once by libeth_xdp_process_buff().
Fixes: 90912f9f4f2d ("idpf: convert header split mode to libeth + napi_build_skb()")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index e3a68b4e97d5..c4fc046b041a 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -3699,9 +3699,11 @@ static int idpf_rx_splitq_clean(struct idpf_rx_queue *rxq, int budget)
hdr = &rx_bufq->hdr_buf[buf_id];
if (unlikely(!hdr_len && !xdp->data)) {
- hdr_len = idpf_rx_hsplit_wa(hdr, rx_buf, pkt_len);
- /* If failed, drop both buffers by setting len to 0 */
- pkt_len -= hdr_len ? : pkt_len;
+ if (pkt_len) {
+ hdr_len = idpf_rx_hsplit_wa(hdr, rx_buf, pkt_len);
+ /* If failed, drop both buffers by setting len to 0 */
+ pkt_len -= hdr_len ? : pkt_len;
+ }
u64_stats_update_begin(&rxq->stats_sync);
u64_stats_inc(&rxq->q_stats.hsplit_buf_ovf);
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 iwl-net 2/2] idpf: Linearise headers and fix segments calculation in idpf_rx_rsc().
2026-12-05 12:43 [PATCH v1 iwl-net 0/2] idpf: Fix Rx header split overflow edge cases Kuniyuki Iwashima
2026-12-05 12:43 ` [PATCH v1 iwl-net 1/2] idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa() Kuniyuki Iwashima
@ 2026-12-05 12:43 ` Kuniyuki Iwashima
1 sibling, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-12-05 12:43 UTC (permalink / raw)
To: Alexander Lobakin, Tony Nguyen, Przemek Kitszel
Cc: Madhu Chittim, Phani Burra, Sridhar Samudrala, Brian Vazquez,
David Decotigny, Li Li, Kuniyuki Iwashima, Kuniyuki Iwashima,
intel-wired-lan
idpf_rx_rsc() accesses ip_hdr(), ipv6_hdr(), and tcp_hdr() directly
without ensuring the L3 and L4 headers are pulled into the linear data
area, which can fail when idpf_rx_hsplit_wa() only copies ETH_HLEN.
It also computes rsc_segments from skb->data_len instead of the TCP
payload length, omitting bytes in the linear head and miscounting when
TCP options are present.
Let's pull the IP and TCP headers (including TCP options) in
idpf_rx_rsc() and compute rsc_segments from the TCP payload length.
Fixes: 3a8845af66ed ("idpf: add RX splitq napi poll support")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_txrx.c | 37 ++++++++++++---------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
index c4fc046b041a..555a87f45e32 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
@@ -3393,10 +3393,10 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
const struct virtchnl2_rx_flex_desc_adv_nic_3 *rx_desc,
struct libeth_rx_pt decoded)
{
+ u16 l3_start = 0, l4_start;
u16 rsc_segments, rsc_seg_len;
- u16 l3_start = 0;
bool ipv4, ipv6;
- int len;
+ u32 thlen, len;
if (unlikely(libeth_rx_pt_get_ip_ver(decoded) ==
LIBETH_RX_PT_OUTER_L2))
@@ -3412,34 +3412,41 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
if (unlikely(!(ipv4 ^ ipv6)))
return -EINVAL;
- rsc_segments = DIV_ROUND_UP(skb->data_len, rsc_seg_len);
-
- NAPI_GRO_CB(skb)->count = rsc_segments;
- skb_shinfo(skb)->gso_size = rsc_seg_len;
-
if (unlikely(eth_type_vlan(skb->protocol)))
l3_start = VLAN_HLEN;
+ l4_start = l3_start + (ipv4 ? sizeof(struct iphdr) :
+ sizeof(struct ipv6hdr));
+ if (unlikely(!pskb_may_pull(skb, l4_start + sizeof(struct tcphdr))))
+ return -EINVAL;
+
skb_set_network_header(skb, l3_start);
+ skb_set_transport_header(skb, l4_start);
+
+ thlen = tcp_hdrlen(skb);
+ if (unlikely(thlen < sizeof(struct tcphdr) ||
+ !pskb_may_pull(skb, l4_start + thlen)))
+ return -EINVAL;
+
+ len = skb->len - l4_start;
+ if (unlikely(len <= thlen))
+ return -EINVAL;
+
+ rsc_segments = DIV_ROUND_UP(len - thlen, rsc_seg_len);
+
+ NAPI_GRO_CB(skb)->count = rsc_segments;
+ skb_shinfo(skb)->gso_size = rsc_seg_len;
if (ipv4) {
struct iphdr *ipv4h = ip_hdr(skb);
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
-
- /* Reset and set transport header offset in skb */
- skb_set_transport_header(skb, l3_start + sizeof(struct iphdr));
- len = skb->len - skb_transport_offset(skb);
-
- /* Compute the TCP pseudo header checksum*/
tcp_hdr(skb)->check =
~tcp_v4_check(len, ipv4h->saddr, ipv4h->daddr, 0);
} else {
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
- skb_set_transport_header(skb, l3_start + sizeof(struct ipv6hdr));
- len = skb->len - skb_transport_offset(skb);
tcp_hdr(skb)->check =
~tcp_v6_check(len, &ipv6h->saddr, &ipv6h->daddr, 0);
}
--
2.56.1.915.g69d5ec7298-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 iwl-net 1/2] idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa().
2026-12-05 12:43 ` [PATCH v1 iwl-net 1/2] idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa() Kuniyuki Iwashima
@ 2026-12-05 13:07 ` sashiko-bot
0 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-12-05 13:07 UTC (permalink / raw)
To: Kuniyuki Iwashima; +Cc: intel-wired-lan
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] idpf: empty descriptors still count hsplit_buf_ovf in
idpf_rx_splitq_clean()
--
commit af024d94ffa2c65eeae02d75ee9e7e6166de24ad
Author: Kuniyuki Iwashima <kuniyu@google.com>
idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa().
This commit guards idpf_rx_hsplit_wa() in idpf_rx_splitq_clean() with a
non-zero pkt_len check so empty descriptors do not double-recycle the
payload netmem.
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index e3a68b4e97d59..c4fc046b041a7 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> @@ -3699,9 +3699,11 @@ static int idpf_rx_splitq_clean(struct idpf_rx_queue *rxq, int budget)
> hdr = &rx_bufq->hdr_buf[buf_id];
>
> if (unlikely(!hdr_len && !xdp->data)) {
> - hdr_len = idpf_rx_hsplit_wa(hdr, rx_buf, pkt_len);
> - /* If failed, drop both buffers by setting len to 0 */
> - pkt_len -= hdr_len ? : pkt_len;
> + if (pkt_len) {
> + hdr_len = idpf_rx_hsplit_wa(hdr, rx_buf, pkt_len);
> + /* If failed, drop both buffers by setting len to 0 */
> + pkt_len -= hdr_len ? : pkt_len;
> + }
>
> u64_stats_update_begin(&rxq->stats_sync);
> u64_stats_inc(&rxq->q_stats.hsplit_buf_ovf);
[Severity: Low]
Should empty descriptors still increment rxq->q_stats.hsplit_buf_ovf here?
When pkt_len is 0, no header buffer overflow occurred and
idpf_rx_hsplit_wa() is skipped, yet hsplit_buf_ovf is still incremented.
Moving the pkt_len check into if (unlikely(!hdr_len && pkt_len && !xdp->data))
avoids the extra nesting and prevents miscounting empty descriptors.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205124319.2264197-1-kuniyu@google.com?part=1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-05 13:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 12:43 [PATCH v1 iwl-net 0/2] idpf: Fix Rx header split overflow edge cases Kuniyuki Iwashima
2026-12-05 12:43 ` [PATCH v1 iwl-net 1/2] idpf: Avoid double recycle on empty packet in idpf_rx_hsplit_wa() Kuniyuki Iwashima
2026-12-05 13:07 ` sashiko-bot
2026-12-05 12:43 ` [PATCH v1 iwl-net 2/2] idpf: Linearise headers and fix segments calculation in idpf_rx_rsc() Kuniyuki Iwashima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox