Intel Wired LAN Driver Updates 2026-02-06 (libeth, ice, i40e, ixgbe)
Subsystems (5)
Tony Nguyen
maintainerFor libeth/ice:
Alexander adds support for devmem/io_uring Rx and Tx.
Quoting Alexander:
Now that ice uses libeth for managing Rx buffers and supports configurable header split, it's ready to get support for sending and receiving packets with unreadable (to the kernel) frags.
Extend libeth just a little bit to allow creating PPs with custom memory providers and make sure ice works correctly with the netdev ops locking. Then add the full set of queue_mgmt_ops and don't unmap unreadable frags on Tx completion.
No perf regressions for the regular flows and no code duplication implied.
Credits to the fbnic developers, which's code helped me understand the memory providers and queue_mgmt_ops logics and served as a reference.
For ice:
Simon Horman adds const modifier to read only member of a struct.
For i40e:
Yury Norov removes an unneeded check of bitmap_weight().
Andy Shevchenko adds a missing include.
For ixgbe:
Aleksandr changes declaration of a bitmap to utilize DECLARE_BITMAP() macro.
The following are changes since commit 24cf78c738318f3d2b961a1ab4b3faf1eca860d7:
net/mlx5e: SHAMPO, Switch to header memcpy
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 100GbE
Aleksandr Loktionov (1):
ixgbe: refactor: use DECLARE_BITMAP for ring state field
Alexander Lobakin (5):
libeth: pass Rx queue index to PP when creating a fill queue
libeth: handle creating pools with unreadable buffers
ice: migrate to netdev ops lock
ice: implement Rx queue management ops
ice: add support for transmitting unreadable frags
Andy Shevchenko (1):
i40e: Add missing header
Simon Horman (1):
ice: Make name member of struct ice_cgu_pin_desc const
Yury Norov (NVIDIA) (1):
i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
.../net/ethernet/intel/i40e/i40e_ethtool.c | 21 +- drivers/net/ethernet/intel/i40e/i40e_hmc.h | 2 + drivers/net/ethernet/intel/iavf/iavf_txrx.c | 1 + drivers/net/ethernet/intel/ice/ice_base.c | 259 +++++++++++++----- drivers/net/ethernet/intel/ice/ice_base.h | 2 + drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + drivers/net/ethernet/intel/ice/ice_lib.c | 150 ++++++++-- drivers/net/ethernet/intel/ice/ice_lib.h | 12 +- drivers/net/ethernet/intel/ice/ice_main.c | 55 ++-- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 2 +- drivers/net/ethernet/intel/ice/ice_sf_eth.c | 2 + drivers/net/ethernet/intel/ice/ice_txrx.c | 43 ++- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 + drivers/net/ethernet/intel/ice/ice_xsk.c | 4 +- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 13 + drivers/net/ethernet/intel/idpf/idpf_txrx.h | 2 + drivers/net/ethernet/intel/ixgbe/ixgbe.h | 27 +- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 56 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 2 +- drivers/net/ethernet/intel/libeth/rx.c | 46 ++++ include/net/libeth/rx.h | 2 + include/net/libeth/tx.h | 2 +- 23 files changed, 527 insertions(+), 183 deletions(-)
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 1/9 libeth: pass Rx queue index to PP when creating a fill queue
From: Alexander Lobakin <[email protected]>
Since recently, page_pool_create() accepts optional stack index of the Rx queue which the pool will be created for. It can then be used on control path for stuff like memory providers. Add the same field to libeth_fq and pass the index from all the drivers using libeth for managing Rx to simplify implementing MP support later.
idpf has one libeth_fq per buffer/fill queue and each Rx queue has two fill queues, but since fill queues can never be shared, we can store the corresponding Rx queue index there during the initialization to pass it to libeth.
--- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 1 + drivers/net/ethernet/intel/ice/ice_base.c | 2 ++ drivers/net/ethernet/intel/idpf/idpf_txrx.c | 13 +++++++++++++ drivers/net/ethernet/intel/idpf/idpf_txrx.h | 2 ++ drivers/net/ethernet/intel/libeth/rx.c | 1 + include/net/libeth/rx.h | 2 ++ 6 files changed, 21 insertions(+)
drivers/net/ethernet/intel/iavf/iavf_txrx.c +1 -0
@@ -771,6 +771,7 @@ int iavf_setup_rx_descriptors(struct iavf_ring *rx_ring) .count = rx_ring->count, .buf_len = LIBIE_MAX_RX_BUF_LEN, .nid = NUMA_NO_NODE, + .idx = rx_ring->queue_index, };int ret;
drivers/net/ethernet/intel/ice/ice_base.c +2 -0
@@ -607,6 +607,7 @@ static int ice_rxq_pp_create(struct ice_rx_ring *rq)struct libeth_fq fq = { .count = rq->count, .nid =NUMA_NO_NODE , + .idx = rq->q_index, .hsplit = rq->vsi->hsplit, .xdp =ice_is_xdp_ena_vsi (rq->vsi), .buf_len =LIBIE_MAX_RX_BUF_LEN ,
@@ -629,6 +630,7 @@ static int ice_rxq_pp_create(struct ice_rx_ring *rq) .count = rq->count, .type = LIBETH_FQE_HDR, .nid = NUMA_NO_NODE, + .idx = rq->q_index, .xdp = ice_is_xdp_ena_vsi(rq->vsi), };
drivers/net/ethernet/intel/idpf/idpf_txrx.c +13 -0
@@ -558,6 +558,7 @@ static int idpf_rx_hdr_buf_alloc_all(struct idpf_buf_queue *bufq) .type = LIBETH_FQE_HDR, .xdp = idpf_xdp_enabled(bufq->q_vector->vport), .nid = idpf_q_vector_to_mem(bufq->q_vector), + .idx = bufq->rxq_idx, };int ret;
@@ -700,6 +701,7 @@ static int idpf_rx_bufs_init_singleq(struct idpf_rx_queue *rxq) .type = LIBETH_FQE_MTU, .buf_len = IDPF_RX_MAX_BUF_SZ, .nid = idpf_q_vector_to_mem(rxq->q_vector), + .idx = rxq->idx, };int ret;
@@ -760,6 +762,7 @@ static int idpf_rx_bufs_init(struct idpf_buf_queue *bufq, .hsplit = idpf_queue_has(HSPLIT_EN, bufq), .xdp = idpf_xdp_enabled(bufq->q_vector->vport), .nid = idpf_q_vector_to_mem(bufq->q_vector), + .idx = bufq->rxq_idx, };int ret;
@@ -1919,6 +1922,16 @@ static int idpf_rxq_group_alloc(struct idpf_vport *vport,LIBETH_RX_LL_LEN ;idpf_rxq_set_descids (rsrc, q); } + +if (!idpf_is_queue_model_split (rsrc->rxq_model)) +continue ; + +for (u32 j =0 ; j < rsrc->num_bufqs_per_qgrp; j++) { +struct idpf_buf_queue *bufq; + + bufq = &rx_qgrp->splitq.bufq_sets[j].bufq; + bufq->rxq_idx = rx_qgrp->splitq.rxq_sets[0 ]->rxq.idx; + } } err_alloc:
drivers/net/ethernet/intel/idpf/idpf_txrx.h +2 -0
@@ -748,6 +748,7 @@ libeth_cacheline_set_assert(struct idpf_tx_queue, 64,* @size: Length of descriptor ring in bytes * @dma: Physical address of ring * @q_vector: Backreference to associated vector +* @rxq_idx: stack index of the corresponding Rx queue * @rx_buffer_low_watermark: RX buffer low watermark * @rx_hbuf_size: Header buffer size * @rx_buf_size: Buffer size
@@ -791,6 +792,7 @@ struct idpf_buf_queue {dma_addr_t dma;struct idpf_q_vector *q_vector; +u16 rxq_idx;u16 rx_buffer_low_watermark;u16 rx_hbuf_size;
drivers/net/ethernet/intel/libeth/rx.c +1 -0
@@ -156,6 +156,7 @@ int libeth_rx_fq_create(struct libeth_fq *fq, struct napi_struct *napi) .order = LIBETH_RX_PAGE_ORDER, .pool_size = fq->count, .nid = fq->nid, + .queue_idx = fq->idx, .dev = napi->dev->dev.parent, .netdev = napi->dev, .napi = napi,
include/net/libeth/rx.h +2 -0
@@ -71,6 +71,7 @@ enum libeth_fqe_type {* @xdp: flag indicating whether XDP is enabled * @buf_len: HW-writeable length per each buffer * @nid: ID of the closest NUMA node with memory +* @idx: stack index of the corresponding Rx queue */ struct libeth_fq { struct_group_tagged(libeth_fq_fp, fp,
@@ -88,6 +89,7 @@ struct libeth_fq {u32 buf_len;int nid; +u32 idx; };int libeth_rx_fq_create (struct libeth_fq *fq,struct napi_struct *napi);
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 2/9 libeth: handle creating pools with unreadable buffers
In reply to Tony NguyenFrom: Alexander Lobakin <[email protected]>
libeth uses netmems for quite some time already, so in order to support unreadable frags / memory providers, it only needs to set PP_FLAG_ALLOW_UNREADABLE_NETMEM when needed.
Also add a couple sanity checks to make sure the driver didn't mess up the configuration options and, in case when an MP is installed, return the truesize always equal to PAGE_SIZE, so that libeth_rx_alloc() will never try to allocate frags. Memory providers manage buffers on their own and expect 1:1 buffer / HW Rx descriptor association.
Bonus: mention in the libeth_sqe_type description that LIBETH_SQE_EMPTY should also be used for netmem Tx SQEs -- they don't need DMA unmapping.
--- drivers/net/ethernet/intel/libeth/rx.c | 45 ++++++++++++++++++++++++++ include/net/libeth/tx.h | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/libeth/rx.c +45 -0
@@ -6,6 +6,7 @@#include <linux/export.h> #include <net/libeth/rx.h> +#include <net/netdev_queues.h> /* Rx buffer management */
@@ -139,9 +140,50 @@ static bool libeth_rx_page_pool_params_zc(struct libeth_fq *fq, fq->buf_len =clamp (mtu,LIBETH_RX_BUF_STRIDE , max); fq->truesize = fq->buf_len; +/* +* Allow frags only for kernel pages. `fq->truesize == pp->max_len` +* will always fall back to regular page_pool_alloc_netmems() +* regardless of the MTU / FQ buffer size. +*/ +if (pp->flags &PP_FLAG_ALLOW_UNREADABLE_NETMEM ) + fq->truesize = pp->max_len; +return true; } +/** +* libeth_rx_page_pool_check_unread - check input params for unreadable MPs +* @fq: buffer queue to check +* @pp: &page_pool_params for the queue +* +* Make sure we don't create an invalid pool with full-frame unreadable +* buffers, bidirectional unreadable buffers or so, and configure the +* ZC payload pool accordingly. +* +* Return: true on success, false on invalid input params. +*/ +static bool libeth_rx_page_pool_check_unread (const struct libeth_fq *fq, +struct page_pool_params *pp) +{ +if (!pp->netdev) +return true; + +if (!netif_rxq_has_unreadable_mp (pp->netdev, pp->queue_idx)) +return true; + +/* For now, the core stack doesn't allow XDP with unreadable frags */ +if (fq->xdp) +return false; + +/* It should be either a header pool or a ZC payload pool */ +if (fq->type ==LIBETH_FQE_HDR ) +return !fq->hsplit; + + pp->flags |=PP_FLAG_ALLOW_UNREADABLE_NETMEM ; + +return fq->hsplit; +} +/** * libeth_rx_fq_create - create a PP with the default libeth settings * @fq: buffer queue struct to fill
@@ -165,6 +207,9 @@ int libeth_rx_fq_create(struct libeth_fq *fq, struct napi_struct *napi)struct page_pool *pool;int ret; +if (!libeth_rx_page_pool_check_unread (fq, &pp)) +return -EINVAL ; + pp.dma_dir = fq->xdp ?DMA_BIDIRECTIONAL :DMA_FROM_DEVICE ;if (!fq->hsplit)
include/net/libeth/tx.h +1 -1
@@ -12,7 +12,7 @@/** * enum libeth_sqe_type - type of &libeth_sqe to act on Tx completion -* @LIBETH_SQE_EMPTY: unused/empty OR XDP_TX/XSk frame, no action required +* @LIBETH_SQE_EMPTY: empty OR netmem/XDP_TX/XSk frame, no action required * @LIBETH_SQE_CTX: context descriptor with empty SQE, no action required * @LIBETH_SQE_SLAB: kmalloc-allocated buffer, unmap and kfree() * @LIBETH_SQE_FRAG: mapped skb frag, only unmap DMA
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 3/9 ice: migrate to netdev ops lock
In reply to Tony NguyenFrom: Alexander Lobakin <[email protected]>
Queue management ops unconditionally enable netdev locking. The same lock is taken by default by several NAPI configuration functions, such as napi_enable() and netif_napi_set_irq().
Request ops locking in advance and make sure we use the _locked counterparts of those functions to avoid deadlocks, taking the lock manually where needed (suspend/resume, queue rebuild and resets).
--- drivers/net/ethernet/intel/ice/ice_base.c | 63 ++++++-- drivers/net/ethernet/intel/ice/ice_base.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.c | 150 +++++++++++++++++--- drivers/net/ethernet/intel/ice/ice_lib.h | 7 +- drivers/net/ethernet/intel/ice/ice_main.c | 54 ++++--- drivers/net/ethernet/intel/ice/ice_sf_eth.c | 1 + drivers/net/ethernet/intel/ice/ice_xsk.c | 4 +- 7 files changed, 225 insertions(+), 56 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +54 -9
@@ -153,8 +153,8 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, u16 v_idx)* handler here (i.e. resume, reset/rebuild, etc.) */ if (vsi->netdev) -netif_napi_add_config (vsi->netdev, &q_vector->napi, - ice_napi_poll, v_idx); +netif_napi_add_config_locked (vsi->netdev, &q_vector->napi, + ice_napi_poll, v_idx); out:/* tie q_vector and VSI together */
@@ -196,7 +196,7 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int v_idx)/* only VSI with an associated netdev is set up with NAPI */ if (vsi->netdev) -netif_napi_del (&q_vector->napi); +netif_napi_del_locked (&q_vector->napi);/* release MSIX interrupt if q_vector had interrupt allocated */ if (q_vector->irq.index <0 )
@@ -896,13 +896,15 @@ int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx) }/** -* ice_vsi_alloc_q_vectors - Allocate memory for interrupt vectors +* ice_vsi_alloc_q_vectors_locked - Allocate memory for interrupt vectors * @vsi: the VSI being configured * -* We allocate one q_vector per queue interrupt. If allocation fails we -* return -ENOMEM. +* Should be called only under the netdev lock. +* We allocate one q_vector per queue interrupt. +* +* Return: 0 on success, -ENOMEM if allocation fails. */ -int ice_vsi_alloc_q_vectors (struct ice_vsi *vsi) +int ice_vsi_alloc_q_vectors_locked (struct ice_vsi *vsi) {struct device *dev =ice_pf_to_dev (vsi->back);u16 v_idx;
@@ -929,6 +931,30 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)return v_idx ?0 : err; } +/** +* ice_vsi_alloc_q_vectors - Allocate memory for interrupt vectors +* @vsi: the VSI being configured +* +* We allocate one q_vector per queue interrupt. +* +* Return: 0 on success, -ENOMEM if allocation fails. +*/ +int ice_vsi_alloc_q_vectors (struct ice_vsi *vsi) +{ +struct net_device *dev = vsi->netdev; +int ret; + +if (dev) +netdev_lock (dev); + + ret =ice_vsi_alloc_q_vectors_locked (vsi); + +if (dev) +netdev_unlock (dev); + +return ret; +} +/** * ice_vsi_map_rings_to_vectors - Map VSI rings to interrupt vectors * @vsi: the VSI being configured
@@ -992,10 +1018,12 @@ void ice_vsi_map_rings_to_vectors(struct ice_vsi *vsi) }/** -* ice_vsi_free_q_vectors - Free memory allocated for interrupt vectors +* ice_vsi_free_q_vectors_locked - Free memory allocated for interrupt vectors * @vsi: the VSI having memory freed +* +* Should be called only under the netdev lock. */ -void ice_vsi_free_q_vectors (struct ice_vsi *vsi) +void ice_vsi_free_q_vectors_locked (struct ice_vsi *vsi) {int v_idx;
@@ -1005,6 +1033,23 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi) vsi->num_q_vectors =0 ; } +/** +* ice_vsi_free_q_vectors - Free memory allocated for interrupt vectors +* @vsi: the VSI having memory freed +*/ +void ice_vsi_free_q_vectors (struct ice_vsi *vsi) +{ +struct net_device *dev = vsi->netdev; + +if (dev) +netdev_lock (dev); + +ice_vsi_free_q_vectors_locked (vsi); + +if (dev) +netdev_unlock (dev); +} +/** * ice_cfg_tstamp - Configure Tx time stamp queue * @tx_ring: Tx ring to be configured with timestamping
drivers/net/ethernet/intel/ice/ice_base.h +2 -0
@@ -12,8 +12,10 @@ int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg);int ice_vsi_ctrl_one_rx_ring (struct ice_vsi *vsi,bool ena,u16 rxq_idx,bool wait);int ice_vsi_wait_one_rx_ring (struct ice_vsi *vsi,bool ena,u16 rxq_idx); +int ice_vsi_alloc_q_vectors_locked (struct ice_vsi *vsi);int ice_vsi_alloc_q_vectors (struct ice_vsi *vsi);void ice_vsi_map_rings_to_vectors (struct ice_vsi *vsi); +void ice_vsi_free_q_vectors_locked (struct ice_vsi *vsi);void ice_vsi_free_q_vectors (struct ice_vsi *vsi);int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_tx_ring **tx_rings,u16 q_idx);
drivers/net/ethernet/intel/ice/ice_lib.c +130 -20
274 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.h +5 -2
@@ -53,9 +53,11 @@ struct ice_vsi * ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params);void ice_vsi_set_napi_queues (struct ice_vsi *vsi); -void ice_napi_add (struct ice_vsi *vsi); - +void ice_vsi_set_napi_queues_locked (struct ice_vsi *vsi);void ice_vsi_clear_napi_queues (struct ice_vsi *vsi); +void ice_vsi_clear_napi_queues_locked (struct ice_vsi *vsi); + +void ice_napi_add (struct ice_vsi *vsi);int ice_vsi_release (struct ice_vsi *vsi);
@@ -66,6 +68,7 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked);void ice_vsi_decfg (struct ice_vsi *vsi);void ice_dis_vsi (struct ice_vsi *vsi,bool locked); +int ice_vsi_rebuild_locked (struct ice_vsi *vsi,u32 vsi_flags);int ice_vsi_rebuild (struct ice_vsi *vsi,u32 vsi_flags);int ice_vsi_cfg (struct ice_vsi *vsi);struct ice_vsi *ice_vsi_alloc (struct ice_pf *pf);
drivers/net/ethernet/intel/ice/ice_main.c +31 -23
121 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_sf_eth.c +1 -0
@@ -58,6 +58,7 @@ static int ice_sf_cfg_netdev(struct ice_dynamic_port *dyn_port,eth_hw_addr_set (netdev, dyn_port->hw_addr);ether_addr_copy (netdev->perm_addr, dyn_port->hw_addr); netdev->netdev_ops = &ice_sf_netdev_ops; + netdev->request_ops_lock = true;SET_NETDEV_DEVLINK_PORT (netdev, devlink_port); err =register_netdev (netdev);
drivers/net/ethernet/intel/ice/ice_xsk.c +2 -2
@@ -33,9 +33,9 @@ ice_qvec_toggle_napi(struct ice_vsi *vsi, struct ice_q_vector *q_vector,return ;if (enable) -napi_enable (&q_vector->napi); +napi_enable_locked (&q_vector->napi);else -napi_disable (&q_vector->napi); +napi_disable_locked (&q_vector->napi); }/**
Signature · 1 line
2.47.1
Jakub Kicinski
maintainerRe: [net-next,3/9] ice: migrate to netdev ops lock
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
ice: migrate to netdev ops lock
This commit migrates the ice driver to use the netdev ops lock by requesting ops locking and using _locked counterparts of NAPI configuration functions to avoid deadlocks during suspend/resume, queue rebuild and resets.
Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_lib.c +0
-0
[ ... ]
Quoted 14 lines
drivers/net/ethernet/intel/ice/ice_lib.c +6
-2@@ -2308,10 +2308,14 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi) }/** -* ice_vsi_cfg_def - configure default VSI based on the type +* ice_vsi_cfg_def_locked - configure default VSI based on the type * @vsi: pointer to VSI +* +* Should be called only with the netdev lock taken. +* +* Return: 0 on success, -errno on failure. */ -static int ice_vsi_cfg_def (struct ice_vsi *vsi) +static int ice_vsi_cfg_def_locked (struct ice_vsi *vsi)
[ ... ]
drivers/net/ethernet/intel/ice/ice_lib.c
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_lib.c +4
-0+unroll_vector_base: +/* reclaim SW interrupts back to the common pool */ +unroll_alloc_q_vector: +ice_vsi_free_q_vectors (vsi);
Should this be ice_vsi_free_q_vectors_locked(vsi)?
ice_vsi_cfg_def_locked() is called with the netdev lock held (either by ice_vsi_cfg_def() wrapper or directly from callers like ice_vsi_rebuild_locked()). The error path here calls ice_vsi_free_q_vectors() which tries to acquire the netdev lock:
ice_vsi_cfg_def_locked() [netdev lock held]
-> ice_vsi_free_q_vectors()
-> netdev_lock(dev) /* deadlock - already held */
This would deadlock when an error triggers unroll_vector_base or unroll_alloc_q_vector paths (e.g., memory allocation failure in ice_vsi_alloc_rings() or ice_vsi_alloc_ring_stats()).
[ ... ]
drivers/net/ethernet/intel/ice/ice_lib.c void ice_vsi_close(struct ice_vsi *vsi) · line 2752
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_lib.c +1
-1@@ -2703,7 +2748,7 @@ void ice_vsi_close(struct ice_vsi *vsi) {if (!test_and_set_bit (ICE_VSI_DOWN , vsi->state))ice_down (vsi); -ice_vsi_clear_napi_queues (vsi); +ice_vsi_clear_napi_queues_locked (vsi);
ice_vsi_clear_napi_queues_locked() expects the netdev lock to be held. Are all callers of ice_vsi_close() holding the netdev lock?
Looking at ice_sf_dev_remove():
ice_sf_dev_remove()
-> ice_vsi_close(vsi) /* no netdev_lock held */ -> ice_sf_decfg_netdev() /* unregisters netdev later */
And ice_dis_vsi() when !netif_running(vsi->netdev):
ice_dis_vsi(vsi, false)
-> ice_vsi_close(vsi) /* rtnl_lock only taken when netif_running */
Both paths call ice_vsi_close() without holding the netdev lock while the netdev is still registered, which could trigger netdev_assert_locked_or_invisible warnings.
[ ... ]
Quoted 17 lines
drivers/net/ethernet/intel/ice/ice_lib.c +3
-2@@ -3069,16 +3152,17 @@ }/** -* ice_vsi_rebuild - Rebuild VSI after reset +* ice_vsi_rebuild_locked - Rebuild VSI after reset * @vsi: VSI to be rebuild * @vsi_flags: flags used for VSI rebuild flow * * Set vsi_flags to ICE_VSI_FLAG_INIT to initialize a new VSI, or * ICE_VSI_FLAG_NO_INIT to rebuild an existing VSI in hardware. +* Should be called only under the netdev lock. * * Returns 0 on success and negative value on failure */ -int ice_vsi_rebuild (struct ice_vsi *vsi,u32 vsi_flags) +int ice_vsi_rebuild_locked (struct ice_vsi *vsi,u32 vsi_flags)
[ ... ]
drivers/net/ethernet/intel/ice/ice_lib.c
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_lib.c +5
-0+free_coalesce: +kfree (coalesce); +decfg: +if (ret) +ice_vsi_decfg (vsi);
Should this be ice_vsi_decfg_locked(vsi)?
ice_vsi_rebuild_locked() is called with the netdev lock already held (either by the ice_vsi_rebuild() wrapper or by callers like ice_vsi_recfg_qs()). The error path at label 'decfg:' calls ice_vsi_decfg() which tries to acquire the lock again:
ice_vsi_rebuild_locked() [netdev lock held]
-> ice_vsi_decfg()
-> netdev_lock(dev) /* deadlock - already held */
This would deadlock when an error occurs after ice_vsi_cfg_def_locked() succeeds but a later operation fails.
Signature · 1 line
pw-bot: cr
Alexander Lobakin
maintainerRe: [net-next,3/9] ice: migrate to netdev ops lock
From: Jakub Kicinski <[email protected]>
Date: Tue, 10 Feb 2026 20:24:58 -0800
Hi,
Quoted 118 lines
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
ice: migrate to netdev ops lockThis commit migrates the ice driver to use the netdev ops lock by requesting ops locking and using
_lockedcounterparts of NAPI configuration functions to avoid deadlocks during suspend/resume, queue rebuild and resets.Quoted 3 lines
drivers/net/ethernet/intel/ice/ice_lib.c +0
-0[ ... ]
Quoted 14 lines
drivers/net/ethernet/intel/ice/ice_lib.c +6
-2@@ -2308,10 +2308,14 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, struct ice_vsi *vsi) }/** -* ice_vsi_cfg_def - configure default VSI based on the type +* ice_vsi_cfg_def_locked - configure default VSI based on the type * @vsi: pointer to VSI +* +* Should be called only with the netdev lock taken. +* +* Return: 0 on success, -errno on failure. */ -static int ice_vsi_cfg_def (struct ice_vsi *vsi) +static int ice_vsi_cfg_def_locked (struct ice_vsi *vsi)[ ... ]
drivers/net/ethernet/intel/ice/ice_lib.c
Quoted 4 lines
drivers/net/ethernet/intel/ice/ice_lib.c +4
-0+unroll_vector_base: +/* reclaim SW interrupts back to the common pool */ +unroll_alloc_q_vector: +ice_vsi_free_q_vectors (vsi);Should this be
ice_vsi_free_q_vectors_locked(vsi)?
ice_vsi_cfg_def_locked()is called with the netdev lock held (either byice_vsi_cfg_def()wrapper or directly from callers likeice_vsi_rebuild_locked()). The error path here callsice_vsi_free_q_vectors()which tries to acquire the netdev lock:
ice_vsi_cfg_def_locked()[netdev lock held]
->ice_vsi_free_q_vectors()-> netdev_lock(dev) /* deadlock - already held */This would deadlock when an error triggers
unroll_vector_baseorunroll_alloc_q_vectorpaths (e.g., memory allocation failure inice_vsi_alloc_rings()orice_vsi_alloc_ring_stats()).[ ... ]
drivers/net/ethernet/intel/ice/ice_lib.c void ice_vsi_close(struct ice_vsi *vsi) · line 2752
Quoted 7 lines
drivers/net/ethernet/intel/ice/ice_lib.c +1
-1@@ -2703,7 +2748,7 @@ void ice_vsi_close(struct ice_vsi *vsi) {if (!test_and_set_bit (ICE_VSI_DOWN , vsi->state))ice_down (vsi); -ice_vsi_clear_napi_queues (vsi); +ice_vsi_clear_napi_queues_locked (vsi);
ice_vsi_clear_napi_queues_locked()expects the netdev lock to be held. Are all callers ofice_vsi_close()holding the netdev lock?Looking at
ice_sf_dev_remove():
ice_sf_dev_remove()
->ice_vsi_close(vsi)/* nonetdev_lockheld */ ->ice_sf_decfg_netdev()/* unregisters netdev later */And
ice_dis_vsi()when !netif_running(vsi->netdev):
ice_dis_vsi(vsi, false)
->ice_vsi_close(vsi)/*rtnl_lockonly taken whennetif_running*/Both paths call
ice_vsi_close()without holding the netdev lock while the netdev is still registered, which could triggernetdev_assert_locked_or_invisiblewarnings.[ ... ]
Quoted 17 lines
drivers/net/ethernet/intel/ice/ice_lib.c +3
-2@@ -3069,16 +3152,17 @@ }/** -* ice_vsi_rebuild - Rebuild VSI after reset +* ice_vsi_rebuild_locked - Rebuild VSI after reset * @vsi: VSI to be rebuild * @vsi_flags: flags used for VSI rebuild flow * * Set vsi_flags to ICE_VSI_FLAG_INIT to initialize a new VSI, or * ICE_VSI_FLAG_NO_INIT to rebuild an existing VSI in hardware. +* Should be called only under the netdev lock. * * Returns 0 on success and negative value on failure */ -int ice_vsi_rebuild (struct ice_vsi *vsi,u32 vsi_flags) +int ice_vsi_rebuild_locked (struct ice_vsi *vsi,u32 vsi_flags)[ ... ]
drivers/net/ethernet/intel/ice/ice_lib.c
Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_lib.c +5
-0+free_coalesce: +kfree (coalesce); +decfg: +if (ret) +ice_vsi_decfg (vsi);Should this be
ice_vsi_decfg_locked(vsi)?
ice_vsi_rebuild_locked()is called with the netdev lock already held (either by theice_vsi_rebuild()wrapper or by callers likeice_vsi_recfg_qs()). The error path at label 'decfg:' callsice_vsi_decfg()which tries to acquire the lock again:
Quoted 6 lines
ice_vsi_rebuild_locked()[netdev lock held]
->ice_vsi_decfg()-> netdev_lock(dev) /* deadlock - already held */This would deadlock when an error occurs after
ice_vsi_cfg_def_locked()succeeds but a later operation fails.
Tony also fed the series to AI, two times, and each time he got a different answer.
The series was on iwl-next for 1.5 months and only one bug was reported, which I fixed immediately.
I can take a look into this, but wouldn't be better if we take the series now and then have 2 months to fix bugs if any appears?
Thanks,
Olek
Jakub Kicinski
maintainerRe: [net-next,3/9] ice: migrate to netdev ops lock
Quoted 20 lines · On Wed, 11 Feb 2026 14:51:56 +0100 Alexander Lobakin wrote:
Quoted 13 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+free_coalesce: + kfree(coalesce); +decfg: + if (ret) + ice_vsi_decfg(vsi);Should this be
ice_vsi_decfg_locked(vsi)?
ice_vsi_rebuild_locked()is called with the netdev lock already held (either by theice_vsi_rebuild()wrapper or by callers likeice_vsi_recfg_qs()). The error path at label 'decfg:' callsice_vsi_decfg()which tries to acquire the lock again:Quoted 6 lines
ice_vsi_rebuild_locked()[netdev lock held]
->ice_vsi_decfg()-> netdev_lock(dev) /* deadlock - already held */This would deadlock when an error occurs after
ice_vsi_cfg_def_locked()succeeds but a later operation fails.
Quoted 7 lines
Tony also fed the series to AI, two times, and each time he got a different answer.
The series was on iwl-next for 1.5 months and only one bug was reported, which I fixed immediately.I can take a look into this, but wouldn't be better if we take the series now and then have 2 months to fix bugs if any appears?
I understand the frustration, but unless the review is a false positive I don't see how we can ignore it.
Looking at the PR rate from Intel I suspect you may be better off pointing your frustration at the internal process? There seems to be a net-next PR every 2 weeks in 2026. It's not like the 1.5 mo was spent waiting on upstream?
Alexander Lobakin
maintainerRe: [net-next,3/9] ice: migrate to netdev ops lock
From: Jakub Kicinski <[email protected]>
Date: Wed, 11 Feb 2026 08:55:14 -0800
Quoted 29 lines · On Wed, 11 Feb 2026 14:51:56 +0100 Alexander Lobakin wrote:
Quoted 20 lines
Quoted 13 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+free_coalesce: + kfree(coalesce); +decfg: + if (ret) + ice_vsi_decfg(vsi);Should this be
ice_vsi_decfg_locked(vsi)?
ice_vsi_rebuild_locked()is called with the netdev lock already held (either by theice_vsi_rebuild()wrapper or by callers likeice_vsi_recfg_qs()). The error path at label 'decfg:' callsice_vsi_decfg()which tries to acquire the lock again:Quoted 6 lines
ice_vsi_rebuild_locked()[netdev lock held]
->ice_vsi_decfg()-> netdev_lock(dev) /* deadlock - already held */This would deadlock when an error occurs after
ice_vsi_cfg_def_locked()succeeds but a later operation fails.Quoted 7 lines
Tony also fed the series to AI, two times, and each time he got a different answer.
The series was on iwl-next for 1.5 months and only one bug was reported, which I fixed immediately.I can take a look into this, but wouldn't be better if we take the series now and then have 2 months to fix bugs if any appears?
Quoted 7 lines
I understand the frustration, but unless the review is a false positive I don't see how we can ignore it.
Looking at the PR rate from Intel I suspect you may be better off pointing your frustration at the internal process? There seems to be a net-next PR every 2 weeks in 2026. It's not like the 1.5 mo was spent waiting on upstream?
I'm not frustrated at all :> I mentioned those 1.5 months only to say that during that time, none of the users of our tree faced any bugs, except one case which was fixed a long ago.
Anyway, this last PR was just a try to squeeze in at the end of the window to compensate that it took a bit too long for the val to test the series. It's not a problem at all if it won't.
Maybe I'll even add support for zcrx large buffers in meantime instead of sending a followup later.
I can't say it's a false positive, but I can't confirm the AI is absolutely correct here. At least a couple places mentioned that "shouldn't work" in fact works. It's not just me being Sarah Connor when it comes to AI, I just don't want people to trust it too much or authors to waste time proving that AI is wrong.
Your call whether to drop it or take (this PR also contains several patches not related to netmem, I think they shouldn't be dropped?).
Thanks,
Olek
Re: [net-next,3/9] ice: migrate to netdev ops lock
Quoted 4 lines · Alexander Lobakin
I'm not frustrated at all :> I mentioned those 1.5 months only to say that during that time, none of the users of our tree faced any bugs, except one case which was fixed a long ago.
I wouldn't trust an absence of reports in the case of subtle locking issues like this. At least one of the reports here is obviously valid:
ice_vsi_cfg_def_locked holds the netdev lock but calls ice_vsi_free_q_vectors in its goto cleanup logic.
Its a mistake in cleanup flow which is likely untested. Of course users haven't reproduced this because they haven't managed to get a failure that would trigger a cleanup.
Quoted 6 lines
I can't say it's a false positive, but I can't confirm the AI is absolutely correct here. At least a couple places mentioned that "shouldn't work" in fact works. It's not just me being Sarah Connor when it comes to AI, I just don't want people to trust it too much or authors to waste time proving that AI is wrong.
I agree it is important to take the AI report with a grain of salt, and it is incredibly frustrating when you see a bogus report that hallucinated some data.
Unfortunately, in this case its a real (if extremely unlikely to trigger in practice) issue.
Quoted 5 lines
Your call whether to drop it or take (this PR also contains several patches not related to netmem, I think they shouldn't be dropped?).
Thanks,
Olek
Tony Nguyen
maintainerPATCH 4/9 ice: implement Rx queue management ops
In reply to Tony NguyenFrom: Alexander Lobakin <[email protected]>
Now ice is ready to get queue_mgmt_ops support. It already has API to disable/reconfig/enable one particular queue (for XSk). Reuse as much of its code as possible to implement Rx queue management callbacks and vice versa -- ice_queue_mem_{alloc,free}() can be reused during ifup/ifdown to elide code duplication. With this, ice passes the io_uring zcrx selftests, meaning the Rx part of netmem/MP support is done.
--- drivers/net/ethernet/intel/ice/ice_base.c | 194 +++++++++++++------ drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + drivers/net/ethernet/intel/ice/ice_lib.h | 5 + drivers/net/ethernet/intel/ice/ice_main.c | 2 +- drivers/net/ethernet/intel/ice/ice_sf_eth.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.c | 26 ++- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 + 7 files changed, 166 insertions(+), 66 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +138 -56
@@ -651,6 +651,43 @@ static int ice_rxq_pp_create(struct ice_rx_ring *rq)return err; } +static int ice_queue_mem_alloc (struct net_device *dev, +struct netdev_queue_config *qcfg, +void *per_queue_mem,int idx) +{ +const struct ice_netdev_priv *priv =netdev_priv (dev); +const struct ice_rx_ring *real = priv->vsi->rx_rings[idx]; +struct ice_rx_ring *new = per_queue_mem; +int ret; + + new->count = real->count; + new->netdev = real->netdev; + new->q_index = real->q_index; + new->q_vector = real->q_vector; + new->vsi = real->vsi; + + ret =ice_rxq_pp_create (new); +if (ret) +return ret; + +if (!netif_running (dev)) +return 0 ; + + ret =__xdp_rxq_info_reg (&new->xdp_rxq, new->netdev, new->q_index, + new->q_vector->napi.napi_id, new->rx_buf_len); +if (ret) + goto err_destroy_fq; + +xdp_rxq_info_attach_page_pool (&new->xdp_rxq, new->pp); + +return 0 ; + +err_destroy_fq: +ice_rxq_pp_destroy (new); + +return ret; +} +/** * ice_vsi_cfg_rxq - Configure an Rx queue * @ring: the ring being configured
@@ -665,23 +702,12 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)int err;if (ring->vsi->type ==ICE_VSI_PF || ring->vsi->type ==ICE_VSI_SF ) { -if (!xdp_rxq_info_is_reg (&ring->xdp_rxq)) { - err =__xdp_rxq_info_reg (&ring->xdp_rxq, ring->netdev, - ring->q_index, - ring->q_vector->napi.napi_id, - ring->rx_buf_len); -if (err) -return err; - } -ice_rx_xsk_pool (ring); err =ice_realloc_rx_xdp_bufs (ring, ring->xsk_pool);if (err)return err;if (ring->xsk_pool) { -xdp_rxq_info_unreg (&ring->xdp_rxq); - rx_buf_len =xsk_pool_get_rx_frame_size (ring->xsk_pool); err = __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
@@ -700,20 +726,10 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)dev_info (dev,"Registered XDP mem model MEM_TYPE_XSK_BUFF_POOL on Rx ring %d\n" , ring->q_index); }else { - err =ice_rxq_pp_create (ring); + err =ice_queue_mem_alloc (ring->netdev,NULL , ring, + ring->q_index);if (err)return err; - -if (!xdp_rxq_info_is_reg (&ring->xdp_rxq)) { - err =__xdp_rxq_info_reg (&ring->xdp_rxq, ring->netdev, - ring->q_index, - ring->q_vector->napi.napi_id, - ring->rx_buf_len); -if (err) - goto err_destroy_fq; - } -xdp_rxq_info_attach_page_pool (&ring->xdp_rxq, - ring->pp); } }
@@ -722,7 +738,7 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)if (err) {dev_err (dev,"ice_setup_rx_ctx failed for RxQ %d, err %d\n" , ring->q_index, err); - goto err_destroy_fq; + goto err_clean_rq; }if (ring->xsk_pool) {
@@ -753,12 +769,12 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring) err =ice_alloc_rx_bufs (ring, num_bufs);if (err) - goto err_destroy_fq; + goto err_clean_rq;return 0 ; -err_destroy_fq: -ice_rxq_pp_destroy (ring); +err_clean_rq: +ice_clean_rx_ring (ring);return err; }
@@ -1470,27 +1486,7 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, u16 q_idx) sizeof(vsi->xdp_rings[q_idx]->ring_stats->stats)); } -/** -* ice_qp_clean_rings - Cleans all the rings of a given index -* @vsi: VSI that contains rings of interest -* @q_idx: ring index in array -*/ -static void ice_qp_clean_rings (struct ice_vsi *vsi,u16 q_idx) -{ -ice_clean_tx_ring (vsi->tx_rings[q_idx]); -if (vsi->xdp_rings) -ice_clean_tx_ring (vsi->xdp_rings[q_idx]); -ice_clean_rx_ring (vsi->rx_rings[q_idx]); -} - -/** -* ice_qp_dis - Disables a queue pair -* @vsi: VSI of interest -* @q_idx: ring index in array -* -* Returns 0 on success, negative on failure. -*/ -int ice_qp_dis (struct ice_vsi *vsi,u16 q_idx) +static int __ice_qp_dis (struct ice_vsi *vsi,u16 q_idx) {struct ice_txq_meta txq_meta = { };struct ice_q_vector *q_vector;
@@ -1529,23 +1525,35 @@ int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) }ice_vsi_ctrl_one_rx_ring (vsi, false, q_idx, false); -ice_qp_clean_rings (vsi, q_idx);ice_qp_reset_stats (vsi, q_idx); +ice_clean_tx_ring (vsi->tx_rings[q_idx]); +if (vsi->xdp_rings) +ice_clean_tx_ring (vsi->xdp_rings[q_idx]); +return fail; }/** -* ice_qp_ena - Enables a queue pair +* ice_qp_dis - Disables a queue pair * @vsi: VSI of interest * @q_idx: ring index in array * * Returns 0 on success, negative on failure. */ -int ice_qp_ena (struct ice_vsi *vsi,u16 q_idx) +int ice_qp_dis (struct ice_vsi *vsi,u16 q_idx) +{ +int ret; + + ret =__ice_qp_dis (vsi, q_idx); +ice_clean_rx_ring (vsi->rx_rings[q_idx]); + +return ret; +} + +static int __ice_qp_ena (struct ice_vsi *vsi,u16 q_idx,int fail) {struct ice_q_vector *q_vector; -int fail =0 ;bool link_up;int err;
@@ -1563,10 +1571,6 @@ int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)ice_tx_xsk_pool (vsi, q_idx); } - err =ice_vsi_cfg_single_rxq (vsi, q_idx); -if (!fail) - fail = err; - q_vector = vsi->rx_rings[q_idx]->q_vector;ice_qvec_cfg_msix (vsi, q_vector, q_idx);
@@ -1587,3 +1591,81 @@ int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)return fail; } + +/** +* ice_qp_ena - Enables a queue pair +* @vsi: VSI of interest +* @q_idx: ring index in array +* +* Returns 0 on success, negative on failure. +*/ +int ice_qp_ena (struct ice_vsi *vsi,u16 q_idx) +{ +return __ice_qp_ena (vsi, q_idx,ice_vsi_cfg_single_rxq (vsi, q_idx)); +} + +static int ice_queue_start (struct net_device *dev, +struct netdev_queue_config *qcfg, +void *per_queue_mem,int idx) +{ +const struct ice_netdev_priv *priv =netdev_priv (dev); +struct ice_rx_ring *real = priv->vsi->rx_rings[idx]; +struct ice_rx_ring *new = per_queue_mem; +struct napi_struct *napi; +int ret; + + real->pp = new->pp; + real->rx_fqes = new->rx_fqes; + real->hdr_fqes = new->hdr_fqes; + real->hdr_pp = new->hdr_pp; + + real->hdr_truesize = new->hdr_truesize; + real->truesize = new->truesize; + real->rx_hdr_len = new->rx_hdr_len; + real->rx_buf_len = new->rx_buf_len; + +memcpy (&real->xdp_rxq, &new->xdp_rxq,sizeof (new->xdp_rxq)); + + ret =ice_setup_rx_ctx (real); +if (ret) +return ret; + + napi = &real->q_vector->napi; + +page_pool_enable_direct_recycling (real->pp, napi); +if (real->hdr_pp) +page_pool_enable_direct_recycling (real->hdr_pp, napi); + + ret =ice_alloc_rx_bufs (real,ICE_DESC_UNUSED (real)); + +return __ice_qp_ena (priv->vsi, idx, ret); +} + +static int ice_queue_stop (struct net_device *dev,void *per_queue_mem, +int idx) +{ +const struct ice_netdev_priv *priv =netdev_priv (dev); +struct ice_rx_ring *real = priv->vsi->rx_rings[idx]; +int ret; + + ret =__ice_qp_dis (priv->vsi, idx); +if (ret) +return ret; + +page_pool_disable_direct_recycling (real->pp); +if (real->hdr_pp) +page_pool_disable_direct_recycling (real->hdr_pp); + +ice_zero_rx_ring (real); +memcpy (per_queue_mem, real,sizeof (*real)); + +return 0 ; +} + +const struct netdev_queue_mgmt_ops ice_queue_mgmt_ops = { + .ndo_queue_mem_alloc = ice_queue_mem_alloc, + .ndo_queue_mem_free = ice_queue_mem_free, + .ndo_queue_mem_size =sizeof (struct ice_rx_ring ), + .ndo_queue_start = ice_queue_start, + .ndo_queue_stop = ice_queue_stop, +};
drivers/net/ethernet/intel/ice/ice_ethtool.c +1 -0
@@ -3338,6 +3338,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, rx_rings[i].cached_phctime = pf->ptp.cached_phc_time; rx_rings[i].desc =NULL ; rx_rings[i].xdp_buf =NULL ; +memset (&rx_rings[i].xdp_rxq,0 ,sizeof (rx_rings[i].xdp_rxq));/* this is to allow wr32 to have something to write to * during early allocation of Rx buffers
drivers/net/ethernet/intel/ice/ice_lib.h +5 -0
@@ -4,6 +4,8 @@#ifndef _ICE_LIB_H_#define _ICE_LIB_H_ +#include <net/netdev_queues.h> +#include "ice.h" #include "ice_vlan.h"
@@ -133,4 +135,7 @@ void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f);void ice_init_feature_support (struct ice_pf *pf);bool ice_vsi_is_rx_queue_active (struct ice_vsi *vsi);void ice_vsi_update_l2tsel (struct ice_vsi *vsi,enum ice_l2tsel l2tsel); + +extern const struct netdev_queue_mgmt_ops ice_queue_mgmt_ops; +#endif /* !_ICE_LIB_H_ */
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -3525,7 +3525,7 @@ static void ice_set_ops(struct ice_vsi *vsi) } netdev->netdev_ops = &ice_netdev_ops; - netdev->request_ops_lock = true; + netdev->queue_mgmt_ops = &ice_queue_mgmt_ops; netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; netdev->xdp_metadata_ops = &ice_xdp_md_ops;ice_set_ethtool_ops (netdev);
drivers/net/ethernet/intel/ice/ice_sf_eth.c +1 -1
@@ -58,7 +58,7 @@ static int ice_sf_cfg_netdev(struct ice_dynamic_port *dyn_port,eth_hw_addr_set (netdev, dyn_port->hw_addr);ether_addr_copy (netdev->perm_addr, dyn_port->hw_addr); netdev->netdev_ops = &ice_sf_netdev_ops; - netdev->request_ops_lock = true; + netdev->queue_mgmt_ops = &ice_queue_mgmt_ops;SET_NETDEV_DEVLINK_PORT (netdev, devlink_port); err =register_netdev (netdev);
drivers/net/ethernet/intel/ice/ice_txrx.c +18 -8
@@ -530,17 +530,13 @@ void ice_rxq_pp_destroy(struct ice_rx_ring *rq) rq->hdr_pp =NULL ; } -/** -* ice_clean_rx_ring - Free Rx buffers -* @rx_ring: ring to be cleaned -*/ -void ice_clean_rx_ring (struct ice_rx_ring *rx_ring) +void ice_queue_mem_free (struct net_device *dev,void *per_queue_mem) { -u32 size; +struct ice_rx_ring *rx_ring = per_queue_mem;if (rx_ring->xsk_pool) {ice_xsk_clean_rx_ring (rx_ring); - goto rx_skip_free; +return ; }/* ring already cleared, nothing to do */
@@ -567,8 +563,12 @@ void ice_clean_rx_ring(struct ice_rx_ring *rx_ring) }ice_rxq_pp_destroy (rx_ring); +} + +void ice_zero_rx_ring (struct ice_rx_ring *rx_ring) +{ +size_t size; -rx_skip_free:/* Zero out the descriptor ring */ size =ALIGN (rx_ring->count *sizeof (union ice_32byte_rx_desc ),PAGE_SIZE );
@@ -578,6 +578,16 @@ void ice_clean_rx_ring(struct ice_rx_ring *rx_ring) rx_ring->next_to_use =0 ; } +/** +* ice_clean_rx_ring - Free Rx buffers +* @rx_ring: ring to be cleaned +*/ +void ice_clean_rx_ring (struct ice_rx_ring *rx_ring) +{ +ice_queue_mem_free (rx_ring->netdev, rx_ring); +ice_zero_rx_ring (rx_ring); +} +/** * ice_free_rx_ring - Free Rx resources * @rx_ring: ring to clean the resources from
drivers/net/ethernet/intel/ice/ice_txrx.h +2 -0
@@ -458,6 +458,8 @@ u16 ice_select_queue(struct net_device *dev, struct sk_buff *skb, struct net_device *sb_dev);void ice_clean_tx_ring (struct ice_tx_ring *tx_ring); +void ice_queue_mem_free (struct net_device *dev,void *per_queue_mem); +void ice_zero_rx_ring (struct ice_rx_ring *rx_ring);void ice_clean_rx_ring (struct ice_rx_ring *rx_ring);int ice_setup_tx_ring (struct ice_tx_ring *tx_ring);int ice_setup_rx_ring (struct ice_rx_ring *rx_ring);
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 5/9 ice: add support for transmitting unreadable frags
In reply to Tony NguyenFrom: Alexander Lobakin <[email protected]>
Advertise netmem Tx support in ice. The only change needed is to set ICE_TX_BUF_FRAG conditionally, only when skb_frag_is_net_iov() is false. Otherwise, the Tx buffer type will be ICE_TX_BUF_EMPTY and the driver will skip the DMA unmapping operation.
--- drivers/net/ethernet/intel/ice/ice_main.c | 1 + drivers/net/ethernet/intel/ice/ice_sf_eth.c | 1 + drivers/net/ethernet/intel/ice/ice_txrx.c | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -0
@@ -3526,6 +3526,7 @@ static void ice_set_ops(struct ice_vsi *vsi) netdev->netdev_ops = &ice_netdev_ops; netdev->queue_mgmt_ops = &ice_queue_mgmt_ops; + netdev->netmem_tx = true; netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; netdev->xdp_metadata_ops = &ice_xdp_md_ops;ice_set_ethtool_ops (netdev);
drivers/net/ethernet/intel/ice/ice_sf_eth.c +1 -0
@@ -59,6 +59,7 @@ static int ice_sf_cfg_netdev(struct ice_dynamic_port *dyn_port,ether_addr_copy (netdev->perm_addr, dyn_port->hw_addr); netdev->netdev_ops = &ice_sf_netdev_ops; netdev->queue_mgmt_ops = &ice_queue_mgmt_ops; + netdev->netmem_tx = true;SET_NETDEV_DEVLINK_PORT (netdev, devlink_port); err =register_netdev (netdev);
drivers/net/ethernet/intel/ice/ice_txrx.c +13 -4
@@ -113,11 +113,17 @@ ice_prgm_fdir_fltr(struct ice_vsi *vsi, struct ice_fltr_desc *fdir_desc,static void ice_unmap_and_free_tx_buf (struct ice_tx_ring *ring,struct ice_tx_buf *tx_buf) { -if (tx_buf->type !=ICE_TX_BUF_XDP_TX &&dma_unmap_len (tx_buf, len)) +switch (tx_buf->type) { +case ICE_TX_BUF_DUMMY : +case ICE_TX_BUF_FRAG : +case ICE_TX_BUF_SKB : +case ICE_TX_BUF_XDP_XMIT :dma_unmap_page (ring->dev,dma_unmap_addr (tx_buf, dma),dma_unmap_len (tx_buf, len),DMA_TO_DEVICE ); +break ; + }switch (tx_buf->type) {case ICE_TX_BUF_DUMMY :
@@ -337,12 +343,14 @@ static bool ice_clean_tx_irq(struct ice_tx_ring *tx_ring, int napi_budget) }/* unmap any remaining paged data */ -if (dma_unmap_len (tx_buf, len)) { +if (tx_buf->type !=ICE_TX_BUF_EMPTY ) {dma_unmap_page (tx_ring->dev,dma_unmap_addr (tx_buf, dma),dma_unmap_len (tx_buf, len),DMA_TO_DEVICE ); +dma_unmap_len_set (tx_buf, len,0 ); + tx_buf->type =ICE_TX_BUF_EMPTY ; } }ice_trace (clean_tx_irq_unmap_eop, tx_ring, tx_desc, tx_buf);
@@ -1492,7 +1500,8 @@ ice_tx_map(struct ice_tx_ring *tx_ring, struct ice_tx_buf *first, DMA_TO_DEVICE); tx_buf = &tx_ring->tx_buf[i]; - tx_buf->type =ICE_TX_BUF_FRAG ; +if (!skb_frag_is_net_iov (frag)) + tx_buf->type =ICE_TX_BUF_FRAG ; }/* record SW timestamp if HW timestamp is not available */
@@ -2367,7 +2376,7 @@ void ice_clean_ctrl_tx_irq(struct ice_tx_ring *tx_ring) }/* unmap the data header */ -if (dma_unmap_len (tx_buf, len)) +if (tx_buf->type !=ICE_TX_BUF_EMPTY ) dma_unmap_single(tx_ring->dev, dma_unmap_addr(tx_buf, dma), dma_unmap_len(tx_buf, len),
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 6/9 ice: Make name member of struct ice_cgu_pin_desc const
In reply to Tony NguyenFrom: Simon Horman <[email protected]>
The name member of struct ice_cgu_pin_desc never modified. Make it const.
Found by inspection.
Compile tested only.
--- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +1 -1
@@ -258,7 +258,7 @@ enum ice_si_cgu_out_pins { };struct ice_cgu_pin_desc { -char *name; +const char *name;u8 index;enum dpll_pin_type type;u32 freq_supp_num;
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 7/9 i40e: drop useless bitmap_weight() call in i40e_set_rxfh_fields()
In reply to Tony NguyenFrom: "Yury Norov (NVIDIA)" <[email protected]>
bitmap_weight() is O(N) and useless here, because the following for_each_set_bit() returns immediately in case of empty flow_pctypes.
--- .../net/ethernet/intel/i40e/i40e_ethtool.c | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +8 -13
@@ -3625,6 +3625,7 @@ static int i40e_set_rxfh_fields(struct net_device *netdev, ((u64 )i40e_read_rx_ctl (hw,I40E_PFQF_HENA (1 )) <<32 );DECLARE_BITMAP (flow_pctypes,FLOW_PCTYPES_SIZE );u64 i_set, i_setc; +u8 flow_id;bitmap_zero (flow_pctypes,FLOW_PCTYPES_SIZE );
@@ -3708,20 +3709,14 @@ static int i40e_set_rxfh_fields(struct net_device *netdev,return -EINVAL ; } -if (bitmap_weight (flow_pctypes,FLOW_PCTYPES_SIZE )) { -u8 flow_id; +for_each_set_bit (flow_id, flow_pctypes,FLOW_PCTYPES_SIZE ) { + i_setc = (u64 )i40e_read_rx_ctl (hw,I40E_GLQF_HASH_INSET (0 , flow_id)) | + ((u64 )i40e_read_rx_ctl (hw,I40E_GLQF_HASH_INSET (1 , flow_id)) <<32 ); + i_set =i40e_get_rss_hash_bits (&pf->hw, nfc, i_setc); -for_each_set_bit (flow_id, flow_pctypes,FLOW_PCTYPES_SIZE ) { - i_setc = (u64 )i40e_read_rx_ctl (hw,I40E_GLQF_HASH_INSET (0 , flow_id)) | - ((u64 )i40e_read_rx_ctl (hw,I40E_GLQF_HASH_INSET (1 , flow_id)) <<32 ); - i_set =i40e_get_rss_hash_bits (&pf->hw, nfc, i_setc); - -i40e_write_rx_ctl (hw,I40E_GLQF_HASH_INSET (0 , flow_id), - (u32 )i_set); -i40e_write_rx_ctl (hw,I40E_GLQF_HASH_INSET (1 , flow_id), - (u32)(i_set >>32 )); - hena |=BIT_ULL (flow_id); - } +i40e_write_rx_ctl (hw,I40E_GLQF_HASH_INSET (0 , flow_id), (u32 )i_set); +i40e_write_rx_ctl (hw,I40E_GLQF_HASH_INSET (1 , flow_id), (u32)(i_set >>32 )); + hena |=BIT_ULL (flow_id); }i40e_write_rx_ctl (hw,I40E_PFQF_HENA (0 ), (u32 )hena);
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 8/9 i40e: Add missing header
In reply to Tony NguyenFrom: Andy Shevchenko <[email protected]>
When cleaning up another header I have met this build error:
drivers/net/ethernet/intel/i40e/i40e_hmc.h:105:22: error: implicit declaration of function 'upper_32_bits' [-Wimplicit-function-declaration]
105 | val1 = (u32)(upper_32_bits(pa)); \
This is due to missing header, add it to fix the possible issue.
--- drivers/net/ethernet/intel/i40e/i40e_hmc.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_hmc.h +2 -0
@@ -4,6 +4,8 @@#ifndef _I40E_HMC_H_#define _I40E_HMC_H_ +#include <linux/wordpart.h> +#include "i40e_alloc.h" #include "i40e_io.h" #include "i40e_register.h"
Signature · 1 line
2.47.1
Tony Nguyen
maintainerPATCH 9/9 ixgbe: refactor: use DECLARE_BITMAP for ring state field
In reply to Tony NguyenFrom: Aleksandr Loktionov <[email protected]>
Convert the ring state field from 'unsigned long' to a proper bitmap using DECLARE_BITMAP macro, aligning with the implementation pattern already used in the i40e driver.
This change:
- Adds __IXGBE_RING_STATE_NBITS as the bitmap size sentinel to enum ixgbe_ring_state_t (consistent with i40e's __I40E_RING_STATE_NBITS)
- Changes 'unsigned long state' to 'DECLARE_BITMAP(state, __IXGBE_RING_STATE_NBITS)' in struct ixgbe_ring
- Removes the address-of operator (&) when passing ring->state to bit manipulation functions, as bitmap arrays naturally decay to pointers
The change maintains functional equivalence while using the more appropriate kernel bitmap API, consistent with other Intel Ethernet drivers.
--- drivers/net/ethernet/intel/ixgbe/ixgbe.h | 27 ++++----- drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 4 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 56 +++++++++---------- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 2 +- 4 files changed, 45 insertions(+), 44 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +14 -13
@@ -322,10 +322,11 @@ enum ixgbe_ring_state_t { __IXGBE_HANG_CHECK_ARMED, __IXGBE_TX_XDP_RING, __IXGBE_TX_DISABLED, + __IXGBE_RING_STATE_NBITS, /* must be last */ };#define ring_uses_build_skb (ring) \ - test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, &(ring)->state) + test_bit(__IXGBE_RX_BUILD_SKB_ENABLED, (ring)->state)struct ixgbe_fwd_adapter {unsigned long active_vlans[BITS_TO_LONGS (VLAN_N_VID )];
@@ -336,23 +337,23 @@ struct ixgbe_fwd_adapter { };#define check_for_tx_hang (ring) \ - test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) + test_bit(__IXGBE_TX_DETECT_HANG, (ring)->state)#define set_check_for_tx_hang (ring) \ - set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) + set_bit(__IXGBE_TX_DETECT_HANG, (ring)->state)#define clear_check_for_tx_hang (ring) \ - clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state) + clear_bit(__IXGBE_TX_DETECT_HANG, (ring)->state)#define ring_is_rsc_enabled (ring) \ - test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) + test_bit(__IXGBE_RX_RSC_ENABLED, (ring)->state)#define set_ring_rsc_enabled (ring) \ - set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) + set_bit(__IXGBE_RX_RSC_ENABLED, (ring)->state)#define clear_ring_rsc_enabled (ring) \ - clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state) + clear_bit(__IXGBE_RX_RSC_ENABLED, (ring)->state)#define ring_is_xdp (ring) \ - test_bit(__IXGBE_TX_XDP_RING, &(ring)->state) + test_bit(__IXGBE_TX_XDP_RING, (ring)->state)#define set_ring_xdp (ring) \ - set_bit(__IXGBE_TX_XDP_RING, &(ring)->state) + set_bit(__IXGBE_TX_XDP_RING, (ring)->state)#define clear_ring_xdp (ring) \ - clear_bit(__IXGBE_TX_XDP_RING, &(ring)->state) + clear_bit(__IXGBE_TX_XDP_RING, (ring)->state)struct ixgbe_ring {struct ixgbe_ring *next;/* pointer to next ring in q_vector */ struct ixgbe_q_vector *q_vector;/* backpointer to host q_vector */
@@ -364,7 +365,7 @@ struct ixgbe_ring {struct ixgbe_tx_buffer *tx_buffer_info;struct ixgbe_rx_buffer *rx_buffer_info; }; -unsigned long state; +DECLARE_BITMAP (state, __IXGBE_RING_STATE_NBITS);u8 __iomem *tail;dma_addr_t dma;/* phys. address of descriptor ring */ unsigned int size;/* length in bytes */
@@ -453,7 +454,7 @@ struct ixgbe_ring_feature {*/ static inline unsigned int ixgbe_rx_bufsz (struct ixgbe_ring *ring) { -if (test_bit (__IXGBE_RX_3K_BUFFER, &ring->state)) +if (test_bit (__IXGBE_RX_3K_BUFFER, ring->state))return IXGBE_RXBUFFER_3K ;#if (PAGE_SIZE <8192 )if (ring_uses_build_skb (ring))
@@ -465,7 +466,7 @@ static inline unsigned int ixgbe_rx_bufsz(struct ixgbe_ring *ring)static inline unsigned int ixgbe_rx_pg_order (struct ixgbe_ring *ring) {#if (PAGE_SIZE <8192 ) -if (test_bit (__IXGBE_RX_3K_BUFFER, &ring->state)) +if (test_bit (__IXGBE_RX_3K_BUFFER, ring->state))return 1 ;#endif return 0 ;
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +2 -2
@@ -979,7 +979,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,* can be marked as checksum errors. */ if (adapter->hw.mac.type == ixgbe_mac_82599EB) -set_bit (__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); +set_bit (__IXGBE_RX_CSUM_UDP_ZERO_ERR, ring->state);#ifdef IXGBE_FCOE if (adapter->netdev->fcoe_mtu) {
@@ -987,7 +987,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, f = &adapter->ring_feature[RING_F_FCOE ];if ((rxr_idx >= f->offset) && (rxr_idx < f->offset + f->indices)) - set_bit(__IXGBE_RX_FCOE, &ring->state); + set_bit(__IXGBE_RX_FCOE, ring->state); }#endif /* IXGBE_FCOE */
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +28 -28
189 lines not on this page · raw message
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +1 -1
@@ -524,7 +524,7 @@ int ixgbe_xsk_wakeup(struct net_device *dev, u32 qid, u32 flags) ring = adapter->xdp_ring[qid]; -if (test_bit (__IXGBE_TX_DISABLED, &ring->state)) +if (test_bit (__IXGBE_TX_DISABLED, ring->state))return -ENETDOWN ;if (!ring->xsk_pool)
Signature · 1 line
2.47.1