Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antonio Quartulli" <antonio@mandelbit.com>,
	intel-wired-lan@lists.osuosl.org
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v6 6/7] igb: resume the device before changing XDP or XSK settings
Date: Tue, 01 Dec 2026 21:38:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-244286@kernel.org> (raw)
In-Reply-To: <20261130213740.3323814-7-antonio@mandelbit.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] igb: broken failed-resume and 3K-buffer checks in
  igb_xdp_setup()
--

commit 7c39c9b9bbe9f71a6d6b0fe773ef6680942f2a1f
Author: Antonio Quartulli <antonio@mandelbit.com>

igb: resume the device before changing XDP or XSK settings

This commit resumes the device across igb_xdp() via pm_runtime_get_sync()
and handles failed resumes in igb_xdp_setup() and the XSK pool setup paths.

> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 11c136d7bea75..79652ccbfdf00 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -2909,6 +2909,16 @@ static int igb_xdp_setup(struct net_device *dev, struct netdev_bpf *bpf)
>  		}
>  	}
>  
> +	/* After a failed resume the device is detached and its rings have no
> +	 * resources: only update the software state, and don't add a program
> +	 */
> +	if (running && !netif_device_present(dev) &&
> +	    (!adapter->num_rx_queues || !adapter->rx_ring[0]->desc)) {
> +		if (prog && !adapter->xdp_prog)
> +			return -ENODEV;
> +		running = false;
> +	}
> +
>  	old_prog = xchg(&adapter->xdp_prog, prog);
>  	need_reset = (!!prog != !!old_prog);

[Severity: Medium]
Can this failed-resume check miss detached devices when !running, or be
blocked from removing an XDP program by the earlier igb_rx_bufsz() check?

__igb_shutdown() detaches the netdev and calls igb_clear_interrupt_scheme(),
which frees all rings and zeroes adapter->num_rx_queues even when the
interface is down.  If resuming fails while !running (or the interface is
brought down after a failed resume), gating this check on running lets a new
XDP program be attached on a detached device and skips the frame_size >
igb_rx_bufsz(ring) loop completely when adapter->num_rx_queues is 0.
igb_xsk_pool_enable() similarly gates its !adapter->rx_ring[qid]->desc check
on netif_running(netdev) instead of !netif_device_present(netdev).

Conversely, IGB_RING_FLAG_RX_3K_BUFFER is only set on rx_ring during
igb_configure_rx() in __igb_open(), not when igb_init_interrupt_scheme()
allocates the rings:

drivers/net/ethernet/intel/igb/igb_main.c:igb_set_rx_buffer_len() {
    ...
	if (adapter->max_frame_size > IGB_MAX_FRAME_BUILD_SKB ||
	    IGB_2K_TOO_SMALL_WITH_PADDING ||
	    rd32(E1000_RCTL) & E1000_RCTL_SBP)
		set_ring_uses_large_buffer(rx_ring);
    ...
}

If an XDP program was attached with a frame_size requiring 3K buffers (2048 <
frame_size <= 3072) and __igb_resume() later allocates fresh rings in
igb_init_interrupt_scheme() without reaching igb_configure_rx() (because
__igb_open() fails when allocating ring resources, or the interface is
down), igb_rx_bufsz(ring) returns 2048 and the loop above returns -EINVAL
before reaching the failed-resume check, preventing removal or replacement
of the program and leaking old_prog.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130213740.3323814-1-antonio@mandelbit.com?part=6

  reply	other threads:[~2026-12-01 21:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 21:37 [PATCH net v6 0/7] igb: fix runtime PM resume issues Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 1/7] igb: don't wait for RTNL when runtime suspending Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 2/7] igb: don't touch rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 3/7] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-12-01 22:20   ` netdev-bot+sashiko
2026-11-30 21:37 ` [PATCH net v6 4/7] igb: keep the stack's Rx queues that still have an XSK pool Antonio Quartulli
2026-12-01 22:20   ` netdev-bot+sashiko
2026-11-30 21:37 ` [PATCH net v6 5/7] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-11-30 21:37 ` [PATCH net v6 6/7] igb: resume the device before changing XDP or XSK settings Antonio Quartulli
2026-12-01 21:38   ` sashiko-bot [this message]
2026-12-01 22:20   ` netdev-bot+sashiko
2026-11-30 21:37 ` [PATCH net v6 7/7] igb: only allow runtime PM if the device can wake up Antonio Quartulli
2026-12-01 22:20   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-244286@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=antonio@mandelbit.com \
    --cc=bpf@vger.kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox