From nobody Mon Apr 6 16:47:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 768333E929F; Wed, 18 Mar 2026 16:36:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851789; cv=none; b=BkyL7KgLmUiwJtysPvP3jf5GhLCmLJWE4Phn9xq7wodVZWdsHiopG+24cCXltonlpmz8wSKVzTKJhBl855gM9EpC2/6PNwqM1gZHnfYFWz8Spx8pkMKZM8mnMwUH/+f0CLonvnZjz4P87J7DQ7yfO4GDRj8kcRPI+wYg+xwCybk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851789; c=relaxed/simple; bh=mQnN/CizJwiQJ0lXtrC3uqpFki5L4HzDyDOxvO6TXMk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cYDhWxnT+GC53bCXSxMdGHUWguz1FlOHePvnMkt+LOXDKGxXuosKBPBOhIHPrGYIFTktiLf9XkNL2ZmDAl3GKeoWZcoS8BpurCW+N/QsNdRCZGJfTm8ggT6mbKJX9ZdO0EzYdaFssKvByGfu75RNf6m55o52iRJAdsQ5MapiJaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KZKJJAsO; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KZKJJAsO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773851786; x=1805387786; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mQnN/CizJwiQJ0lXtrC3uqpFki5L4HzDyDOxvO6TXMk=; b=KZKJJAsOLp+Jf/EizJAZZJdxzNkRl71C7u+zotPdEmWtrYeMl1zKh6Bb qnc9oIPDbYrEV4osbRmZNI9TB3Afx+WpK8U/bE/gY8d0lrZz1tYuyOcnT /DUfa8ePccCIjSvZERWpZrTJMBxl3Qs+rLu3iWcv8pvplRHxTl1ZWX5Lb kjelLvKqDe1jH2GI221cz0m2w1Y8MsJrNA3oMPJeIJhdAUKr2gxJV7P4O 5Cu98NwaV/5ZAoFRt+Iz5rrIAp0U3k1i1Fktzr6BPgE00aSgEh2mndBdO 2wHurmWJVlg9ykafHfXt9AkPlNvZNfAmwiz82aZImVSJ9Kmo83nb8YEJi g==; X-CSE-ConnectionGUID: vPp7YHNuQC+5Qpq0fRwsgQ== X-CSE-MsgGUID: gRsaCHLPTICDmU7ZTbsbtA== X-IronPort-AV: E=McAfee;i="6800,10657,11733"; a="62479382" X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="62479382" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 09:36:26 -0700 X-CSE-ConnectionGUID: pNXloGNVQgCkZi36+Im57w== X-CSE-MsgGUID: wS/egQozS1CejQGlntD4Bw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="218687666" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa010.fm.intel.com with ESMTP; 18 Mar 2026 09:36:23 -0700 From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Cc: Alexander Lobakin , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jacob Keller , Aleksandr Loktionov , nxne.cnse.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next v4 1/5] libeth: pass Rx queue index to PP when creating a fill queue Date: Wed, 18 Mar 2026 17:35:01 +0100 Message-ID: <20260318163505.31765-2-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260318163505.31765-1-aleksander.lobakin@intel.com> References: <20260318163505.31765-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Jacob Keller Reviewed-by: Aleksandr Loktionov Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 2 ++ include/net/libeth/rx.h | 2 ++ 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/libeth/rx.c | 1 + 6 files changed, 21 insertions(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h b/drivers/net/ethe= rnet/intel/idpf/idpf_txrx.h index 4be5b3b6d3ed..a0d92adf11c4 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h @@ -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; =20 struct idpf_q_vector *q_vector; + u16 rxq_idx; =20 u16 rx_buffer_low_watermark; u16 rx_hbuf_size; diff --git a/include/net/libeth/rx.h b/include/net/libeth/rx.h index 5d991404845e..3b3d7acd13c9 100644 --- a/include/net/libeth/rx.h +++ b/include/net/libeth/rx.h @@ -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 { =20 u32 buf_len; int nid; + u32 idx; }; =20 int libeth_rx_fq_create(struct libeth_fq *fq, struct napi_struct *napi); diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethe= rnet/intel/iavf/iavf_txrx.c index 363c42bf3dcf..d3c68659162b 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -771,6 +771,7 @@ int iavf_setup_rx_descriptors(struct iavf_ring *rx_ring) .count =3D rx_ring->count, .buf_len =3D LIBIE_MAX_RX_BUF_LEN, .nid =3D NUMA_NO_NODE, + .idx =3D rx_ring->queue_index, }; int ret; =20 diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethern= et/intel/ice/ice_base.c index 1667f686ff75..f162cdfc62a7 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.c +++ b/drivers/net/ethernet/intel/ice/ice_base.c @@ -609,6 +609,7 @@ static int ice_rxq_pp_create(struct ice_rx_ring *rq) struct libeth_fq fq =3D { .count =3D rq->count, .nid =3D NUMA_NO_NODE, + .idx =3D rq->q_index, .hsplit =3D rq->vsi->hsplit, .xdp =3D ice_is_xdp_ena_vsi(rq->vsi), .buf_len =3D LIBIE_MAX_RX_BUF_LEN, @@ -631,6 +632,7 @@ static int ice_rxq_pp_create(struct ice_rx_ring *rq) .count =3D rq->count, .type =3D LIBETH_FQE_HDR, .nid =3D NUMA_NO_NODE, + .idx =3D rq->q_index, .xdp =3D ice_is_xdp_ena_vsi(rq->vsi), }; =20 diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethe= rnet/intel/idpf/idpf_txrx.c index 252259993022..45ee5b80479a 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c @@ -557,6 +557,7 @@ static int idpf_rx_hdr_buf_alloc_all(struct idpf_buf_qu= eue *bufq) .type =3D LIBETH_FQE_HDR, .xdp =3D idpf_xdp_enabled(bufq->q_vector->vport), .nid =3D idpf_q_vector_to_mem(bufq->q_vector), + .idx =3D bufq->rxq_idx, }; int ret; =20 @@ -699,6 +700,7 @@ static int idpf_rx_bufs_init_singleq(struct idpf_rx_que= ue *rxq) .type =3D LIBETH_FQE_MTU, .buf_len =3D IDPF_RX_MAX_BUF_SZ, .nid =3D idpf_q_vector_to_mem(rxq->q_vector), + .idx =3D rxq->idx, }; int ret; =20 @@ -759,6 +761,7 @@ static int idpf_rx_bufs_init(struct idpf_buf_queue *buf= q, .hsplit =3D idpf_queue_has(HSPLIT_EN, bufq), .xdp =3D idpf_xdp_enabled(bufq->q_vector->vport), .nid =3D idpf_q_vector_to_mem(bufq->q_vector), + .idx =3D bufq->rxq_idx, }; int ret; =20 @@ -1913,6 +1916,16 @@ static int idpf_rxq_group_alloc(struct idpf_vport *v= port, LIBETH_RX_LL_LEN; idpf_rxq_set_descids(rsrc, q); } + + if (!idpf_is_queue_model_split(rsrc->rxq_model)) + continue; + + for (u32 j =3D 0; j < rsrc->num_bufqs_per_qgrp; j++) { + struct idpf_buf_queue *bufq; + + bufq =3D &rx_qgrp->splitq.bufq_sets[j].bufq; + bufq->rxq_idx =3D rx_qgrp->splitq.rxq_sets[0]->rxq.idx; + } } =20 err_alloc: diff --git a/drivers/net/ethernet/intel/libeth/rx.c b/drivers/net/ethernet/= intel/libeth/rx.c index 62521a1f4ec9..8874b714cdcc 100644 --- a/drivers/net/ethernet/intel/libeth/rx.c +++ b/drivers/net/ethernet/intel/libeth/rx.c @@ -156,6 +156,7 @@ int libeth_rx_fq_create(struct libeth_fq *fq, struct na= pi_struct *napi) .order =3D LIBETH_RX_PAGE_ORDER, .pool_size =3D fq->count, .nid =3D fq->nid, + .queue_idx =3D fq->idx, .dev =3D napi->dev->dev.parent, .netdev =3D napi->dev, .napi =3D napi, --=20 2.53.0 From nobody Mon Apr 6 16:47:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E61463EB7FF; Wed, 18 Mar 2026 16:36:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851793; cv=none; b=knnu2be7jJRKny21t18Y4thli4B+0LI/GnFg3hc3JynFzl2z9BfmVKRJBoND1hEl3gQKbW6GrA/jofZzGKUZTL8cgOPTjqi5gIrgBT22DuqpjuJOxbtDdg+xgT0x4y4gnBsMxugfSZBneKD5OxvdOS+TXpTu1D4Pzp5DcF0D9Io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851793; c=relaxed/simple; bh=dbnQ/MMu1E+QSK5rCsf9tW1qv5XIaaGwExNh2lKHdx4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pu/MpF5B9Is0ATCVNRGDRUXBV4jH8m7IdDuTb/p1lVokSN6ei+6csmeEbozVxjEr0mJlyZ2vmGOmFjDFDrh8hW3WByjAQXWNWsdccCG18JUooZSyfePOw0GiOXMunZefxaysCKDzhhvxEqFfUKMDvcGciUd0GyCgBvVg6JcdDus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DtWjBE0V; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DtWjBE0V" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773851790; x=1805387790; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dbnQ/MMu1E+QSK5rCsf9tW1qv5XIaaGwExNh2lKHdx4=; b=DtWjBE0VWmcR28k7eVbnpuKAUmjAVirpB3AYd4vuTYxQeS1KX1zV7bGZ RY1z4lV/g/Zf+VKMs6M30TbqLTe/w6d4RZZvAU/tBsDwx44Qcpj+g7JVA 4EQG1boytuc+sfusqqZR+Pd0rHisIopOUHP9693xtmO0z0varLBvLgCJM jxvG0GZll5KBQnnwkpLMm3JIAR99vXY62z6WgpPO+OPjsCypFLtxZ7llz iXRxdxodAG5gh5RfULDJQKH/5xAmkdaxDAulLgnd0IvOgrKVMGAUdJRRa N0P4wuwfc/ZRazabKalsu4Hp+VYA682X1BkG4UsvBCThAaMUpwTk97tUw Q==; X-CSE-ConnectionGUID: dN/Lhr1YTI+8uPktZIVR2Q== X-CSE-MsgGUID: bY7c1TIlSpesj7KwUtVbzw== X-IronPort-AV: E=McAfee;i="6800,10657,11733"; a="62479392" X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="62479392" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 09:36:29 -0700 X-CSE-ConnectionGUID: JbaXq9VsReu+4V0r1YipzA== X-CSE-MsgGUID: lQ4EQzCYToqmocSB6nSDTQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="218687686" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa010.fm.intel.com with ESMTP; 18 Mar 2026 09:36:26 -0700 From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Cc: Alexander Lobakin , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jacob Keller , Aleksandr Loktionov , nxne.cnse.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next v4 2/5] libeth: handle creating pools with unreadable buffers Date: Wed, 18 Mar 2026 17:35:02 +0100 Message-ID: <20260318163505.31765-3-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260318163505.31765-1-aleksander.lobakin@intel.com> References: <20260318163505.31765-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Jacob Keller Reviewed-by: Aleksandr Loktionov Signed-off-by: Alexander Lobakin --- include/net/libeth/tx.h | 2 +- drivers/net/ethernet/intel/libeth/rx.c | 42 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/include/net/libeth/tx.h b/include/net/libeth/tx.h index c3db5c6f1641..a66fc2b3a114 100644 --- a/include/net/libeth/tx.h +++ b/include/net/libeth/tx.h @@ -12,7 +12,7 @@ =20 /** * 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 diff --git a/drivers/net/ethernet/intel/libeth/rx.c b/drivers/net/ethernet/= intel/libeth/rx.c index 8874b714cdcc..11e6e8f353ef 100644 --- a/drivers/net/ethernet/intel/libeth/rx.c +++ b/drivers/net/ethernet/intel/libeth/rx.c @@ -6,6 +6,7 @@ #include =20 #include +#include =20 /* Rx buffer management */ =20 @@ -139,9 +140,47 @@ static bool libeth_rx_page_pool_params_zc(struct libet= h_fq *fq, fq->buf_len =3D clamp(mtu, LIBETH_RX_BUF_STRIDE, max); fq->truesize =3D fq->buf_len; =20 + /* + * Allow frags only for kernel pages. `fq->truesize =3D=3D 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 =3D pp->max_len; + return true; } =20 +/** + * 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 (!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 =3D=3D LIBETH_FQE_HDR) + return !fq->hsplit; + + pp->flags |=3D 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 +204,9 @@ int libeth_rx_fq_create(struct libeth_fq *fq, struct na= pi_struct *napi) struct page_pool *pool; int ret; =20 + if (!libeth_rx_page_pool_check_unread(fq, &pp)) + return -EINVAL; + pp.dma_dir =3D fq->xdp ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE; =20 if (!fq->hsplit) --=20 2.53.0 From nobody Mon Apr 6 16:47:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D32893ED5B3; Wed, 18 Mar 2026 16:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851798; cv=none; b=O6AWvjgVhDYjUsY8Op5+r1NFOBbo+BYDXrfk5dWi77N6g/snc42Z0QSS9uneyIC5eZJYX1mOY/9LclgPlQrqBzIdAMqc3ixi3PVXOh0zWu3Nz/tRbzEFVXwo8GHP2wYR0hpgUr/TOAWzTVWVUiIin/VRLKueN+aKMXUJtr2YeRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851798; c=relaxed/simple; bh=7Qe+Tn0ezkkUmo2HWoE6xz/lIjuvJpLgE1Cim2Ilk8I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BcnTZxwWN9/qV02OyRYS4CVx5KQsuGebQ0/o2XNRvw4PGWvDypI6tcVd/k086j9MdR4q2Zqfmikgna9w/kFvHjBd8F7P/S4PLz/BfJAzVn70SR1LtQ+Txgtgatc5sEAFBzRFZO7ZOrQPTU0kEPtUhTFTPLj7LKH0cUcrqTLIves= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KE50ZEWy; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KE50ZEWy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773851794; x=1805387794; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7Qe+Tn0ezkkUmo2HWoE6xz/lIjuvJpLgE1Cim2Ilk8I=; b=KE50ZEWy/KQdkgql0XEEH+EcjaHq0e/lumZ7H0m6xHLj0bvBEBG9YjJe oVHR4rT2bnp2qcHGasQ44HerJVrg8OFw3i/N7GPhi4c4Q/1N41Q3ZHBzi gJqjRRXxTBNqcmyRRSAVdwBIyFLDZbYGlk9aNDdiwKmGUZWdTV4szvLhF UOtENLWtqah8j1Wy2dXVxwzSn2yo76x4JUcP/FuF1wFYJMIoyDR4+qWlj vZ8ytcGLMC3bXfESVnAID4t3Qn9ihHErnSTgPgZ+KHRXb8RqaT6KnsD5t RTMDFIozV8LvhTzEjC4POmRbrYl34RLqmiEv0iE2AVpsL6vhTjWsRktuV g==; X-CSE-ConnectionGUID: 5SqV/4glRDiAEhVgDbesVQ== X-CSE-MsgGUID: qWw6e3TAQfieyqxpIgjxcg== X-IronPort-AV: E=McAfee;i="6800,10657,11733"; a="62479403" X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="62479403" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 09:36:33 -0700 X-CSE-ConnectionGUID: /IcuEaiuQmePtb2887HC/w== X-CSE-MsgGUID: RME+DRLBSQ2NFIiMOM1VRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="218687707" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa010.fm.intel.com with ESMTP; 18 Mar 2026 09:36:29 -0700 From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Cc: Alexander Lobakin , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jacob Keller , Aleksandr Loktionov , nxne.cnse.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next v4 3/5] ice: migrate to netdev ops lock Date: Wed, 18 Mar 2026 17:35:03 +0100 Message-ID: <20260318163505.31765-4-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260318163505.31765-1-aleksander.lobakin@intel.com> References: <20260318163505.31765-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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). Reviewed-by: Jacob Keller Reviewed-by: Aleksandr Loktionov Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/intel/ice/ice_base.h | 2 + drivers/net/ethernet/intel/ice/ice_lib.h | 13 +- drivers/net/ethernet/intel/ice/ice_base.c | 63 +++++- drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 15 +- drivers/net/ethernet/intel/ice/ice_lib.c | 225 +++++++++++++++---- drivers/net/ethernet/intel/ice/ice_main.c | 73 +++--- drivers/net/ethernet/intel/ice/ice_sf_eth.c | 3 + drivers/net/ethernet/intel/ice/ice_xsk.c | 4 +- 8 files changed, 299 insertions(+), 99 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_base.h b/drivers/net/ethern= et/intel/ice/ice_base.h index d28294247599..99b2c7232829 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.h +++ b/drivers/net/ethernet/intel/ice/ice_base.h @@ -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_ri= ngs, u16 q_idx); diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/etherne= t/intel/ice/ice_lib.h index 49454d98dcfe..476fa54ec4e8 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_lib.h @@ -53,19 +53,24 @@ struct ice_vsi * ice_vsi_setup(struct ice_pf *pf, struct ice_vsi_cfg_params *params); =20 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); =20 int ice_vsi_release(struct ice_vsi *vsi); =20 void ice_vsi_close(struct ice_vsi *vsi); =20 -int ice_ena_vsi(struct ice_vsi *vsi, bool locked); +int ice_ena_vsi_locked(struct ice_vsi *vsi); +int ice_ena_vsi(struct ice_vsi *vsi); =20 void ice_vsi_decfg(struct ice_vsi *vsi); -void ice_dis_vsi(struct ice_vsi *vsi, bool locked); +void ice_dis_vsi_locked(struct ice_vsi *vsi); +void ice_dis_vsi(struct ice_vsi *vsi); =20 +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); diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethern= et/intel/ice/ice_base.c index f162cdfc62a7..1add82d894bb 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.c +++ b/drivers/net/ethernet/intel/ice/ice_base.c @@ -155,8 +155,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); =20 out: /* tie q_vector and VSI together */ @@ -198,7 +198,7 @@ static void ice_free_q_vector(struct ice_vsi *vsi, int = v_idx) =20 /* 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); =20 /* release MSIX interrupt if q_vector had interrupt allocated */ if (q_vector->irq.index < 0) @@ -886,13 +886,15 @@ int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, boo= l ena, u16 rxq_idx) } =20 /** - * 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 =3D ice_pf_to_dev(vsi->back); u16 v_idx; @@ -919,6 +921,30 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi) return v_idx ? 0 : err; } =20 +/** + * 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 =3D vsi->netdev; + int ret; + + if (dev) + netdev_lock(dev); + + ret =3D 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 @@ -982,10 +1008,12 @@ void ice_vsi_map_rings_to_vectors(struct ice_vsi *vs= i) } =20 /** - * ice_vsi_free_q_vectors - Free memory allocated for interrupt vectors + * ice_vsi_free_q_vectors_locked - Free memory allocated for interrupt vec= tors * @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; =20 @@ -995,6 +1023,23 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi) vsi->num_q_vectors =3D 0; } =20 +/** + * 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 =3D 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 diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/eth= ernet/intel/ice/ice_dcb_lib.c index bd77f1c001ee..2ca3fc6e8abd 100644 --- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c @@ -273,14 +273,13 @@ void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi) * ice_dcb_ena_dis_vsi - disable certain VSIs for DCB config/reconfig * @pf: pointer to the PF instance * @ena: true to enable VSIs, false to disable - * @locked: true if caller holds RTNL lock, false otherwise * * Before a new DCB configuration can be applied, VSIs of type PF, SWITCHD= EV * and CHNL need to be brought down. Following completion of DCB configura= tion * the VSIs that were downed need to be brought up again. This helper func= tion * does both. */ -static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena, bool locked) +static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool ena) { int i; =20 @@ -294,9 +293,9 @@ static void ice_dcb_ena_dis_vsi(struct ice_pf *pf, bool= ena, bool locked) case ICE_VSI_CHNL: case ICE_VSI_PF: if (ena) - ice_ena_vsi(vsi, locked); + ice_ena_vsi(vsi); else - ice_dis_vsi(vsi, locked); + ice_dis_vsi(vsi); break; default: continue; @@ -416,7 +415,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_c= fg *new_cfg, bool locked) rtnl_lock(); =20 /* disable VSIs affected by DCB changes */ - ice_dcb_ena_dis_vsi(pf, false, true); + ice_dcb_ena_dis_vsi(pf, false); =20 memcpy(curr_cfg, new_cfg, sizeof(*curr_cfg)); memcpy(&curr_cfg->etsrec, &curr_cfg->etscfg, sizeof(curr_cfg->etsrec)); @@ -445,7 +444,7 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_c= fg *new_cfg, bool locked) =20 out: /* enable previously downed VSIs */ - ice_dcb_ena_dis_vsi(pf, true, true); + ice_dcb_ena_dis_vsi(pf, true); if (!locked) rtnl_unlock(); free_cfg: @@ -1107,7 +1106,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, =20 rtnl_lock(); /* disable VSIs affected by DCB changes */ - ice_dcb_ena_dis_vsi(pf, false, true); + ice_dcb_ena_dis_vsi(pf, false); =20 ret =3D ice_query_port_ets(pi, &buf, sizeof(buf), NULL); if (ret) { @@ -1119,7 +1118,7 @@ ice_dcb_process_lldp_set_mib_change(struct ice_pf *pf, ice_pf_dcb_recfg(pf, false); =20 /* enable previously downed VSIs */ - ice_dcb_ena_dis_vsi(pf, true, true); + ice_dcb_ena_dis_vsi(pf, true); unlock_rtnl: rtnl_unlock(); out: diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/etherne= t/intel/ice/ice_lib.c index 689c6025ea82..cd0a20816abe 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -2304,10 +2304,14 @@ static int ice_vsi_cfg_tc_lan(struct ice_pf *pf, st= ruct ice_vsi *vsi) } =20 /** - * 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) { struct device *dev =3D ice_pf_to_dev(vsi->back); struct ice_pf *pf =3D vsi->back; @@ -2350,7 +2354,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi) case ICE_VSI_CTRL: case ICE_VSI_SF: case ICE_VSI_PF: - ret =3D ice_vsi_alloc_q_vectors(vsi); + ret =3D ice_vsi_alloc_q_vectors_locked(vsi); if (ret) goto unroll_vsi_init; =20 @@ -2400,7 +2404,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi) * creates a VSI and corresponding structures for bookkeeping * purpose */ - ret =3D ice_vsi_alloc_q_vectors(vsi); + ret =3D ice_vsi_alloc_q_vectors_locked(vsi); if (ret) goto unroll_vsi_init; =20 @@ -2451,7 +2455,7 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi) unroll_vector_base: /* reclaim SW interrupts back to the common pool */ unroll_alloc_q_vector: - ice_vsi_free_q_vectors(vsi); + ice_vsi_free_q_vectors_locked(vsi); unroll_vsi_init: ice_vsi_delete_from_hw(vsi); unroll_get_qs: @@ -2463,6 +2467,28 @@ static int ice_vsi_cfg_def(struct ice_vsi *vsi) return ret; } =20 +/** + * ice_vsi_cfg_def - configure default VSI based on the type + * @vsi: pointer to VSI + * + * Return: 0 on success, -errno on failure. + */ +static int ice_vsi_cfg_def(struct ice_vsi *vsi) +{ + struct net_device *dev =3D vsi->netdev; + int ret; + + if (dev) + netdev_lock(dev); + + ret =3D ice_vsi_cfg_def_locked(vsi); + + if (dev) + netdev_unlock(dev); + + return ret; +} + /** * ice_vsi_cfg - configure a previously allocated VSI * @vsi: pointer to VSI @@ -2497,10 +2523,12 @@ int ice_vsi_cfg(struct ice_vsi *vsi) } =20 /** - * ice_vsi_decfg - remove all VSI configuration + * ice_vsi_decfg_locked - remove all VSI configuration * @vsi: pointer to VSI + * + * Should be called only under the netdev lock. */ -void ice_vsi_decfg(struct ice_vsi *vsi) +static void ice_vsi_decfg_locked(struct ice_vsi *vsi) { struct ice_pf *pf =3D vsi->back; int err; @@ -2518,7 +2546,7 @@ void ice_vsi_decfg(struct ice_vsi *vsi) ice_destroy_xdp_rings(vsi, ICE_XDP_CFG_PART); =20 ice_vsi_clear_rings(vsi); - ice_vsi_free_q_vectors(vsi); + ice_vsi_free_q_vectors_locked(vsi); ice_vsi_put_qs(vsi); ice_vsi_free_arrays(vsi); =20 @@ -2533,6 +2561,23 @@ void ice_vsi_decfg(struct ice_vsi *vsi) vsi->agg_node->num_vsis--; } =20 +/** + * ice_vsi_decfg - remove all VSI configuration + * @vsi: pointer to VSI + */ +void ice_vsi_decfg(struct ice_vsi *vsi) +{ + struct net_device *dev =3D vsi->netdev; + + if (dev) + netdev_lock(dev); + + ice_vsi_decfg_locked(vsi); + + if (dev) + netdev_unlock(dev); +} + /** * ice_vsi_setup - Set up a VSI by a given type * @pf: board private structure @@ -2706,18 +2751,19 @@ void ice_vsi_close(struct ice_vsi *vsi) if (!test_and_set_bit(ICE_VSI_DOWN, vsi->state)) ice_down(vsi); =20 - ice_vsi_clear_napi_queues(vsi); + ice_vsi_clear_napi_queues_locked(vsi); ice_vsi_free_irq(vsi); ice_vsi_free_tx_rings(vsi); ice_vsi_free_rx_rings(vsi); } =20 /** - * ice_ena_vsi - resume a VSI - * @vsi: the VSI being resume - * @locked: is the rtnl_lock already held + * ice_ena_vsi_locked - resume a VSI (without taking the netdev lock) + * @vsi: VSI to resume + * + * Return: 0 on success, -errno on failure. */ -int ice_ena_vsi(struct ice_vsi *vsi, bool locked) +int ice_ena_vsi_locked(struct ice_vsi *vsi) { int err =3D 0; =20 @@ -2728,15 +2774,8 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) =20 if (vsi->netdev && (vsi->type =3D=3D ICE_VSI_PF || vsi->type =3D=3D ICE_VSI_SF)) { - if (netif_running(vsi->netdev)) { - if (!locked) - rtnl_lock(); - + if (netif_running(vsi->netdev)) err =3D ice_open_internal(vsi->netdev); - - if (!locked) - rtnl_unlock(); - } } else if (vsi->type =3D=3D ICE_VSI_CTRL) { err =3D ice_vsi_open_ctrl(vsi); } @@ -2745,11 +2784,34 @@ int ice_ena_vsi(struct ice_vsi *vsi, bool locked) } =20 /** - * ice_dis_vsi - pause a VSI + * ice_ena_vsi - resume a VSI + * @vsi: VSI to resume + * + * Return: 0 on success, -errno on failure. + */ +int ice_ena_vsi(struct ice_vsi *vsi) +{ + struct net_device *dev =3D vsi->netdev; + int ret; + + if (dev) + netdev_lock(dev); + + ret =3D ice_ena_vsi_locked(vsi); + + if (dev) + netdev_unlock(dev); + + return ret; +} + +/** + * ice_dis_vsi_locked - pause a VSI * @vsi: the VSI being paused - * @locked: is the rtnl_lock already held + * + * The caller must always hold the netdev lock. */ -void ice_dis_vsi(struct ice_vsi *vsi, bool locked) +void ice_dis_vsi_locked(struct ice_vsi *vsi) { bool already_down =3D test_bit(ICE_VSI_DOWN, vsi->state); =20 @@ -2758,14 +2820,9 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked) if (vsi->netdev && (vsi->type =3D=3D ICE_VSI_PF || vsi->type =3D=3D ICE_VSI_SF)) { if (netif_running(vsi->netdev)) { - if (!locked) - rtnl_lock(); already_down =3D test_bit(ICE_VSI_DOWN, vsi->state); if (!already_down) ice_vsi_close(vsi); - - if (!locked) - rtnl_unlock(); } else if (!already_down) { ice_vsi_close(vsi); } @@ -2775,12 +2832,30 @@ void ice_dis_vsi(struct ice_vsi *vsi, bool locked) } =20 /** - * ice_vsi_set_napi_queues - associate netdev queues with napi + * ice_dis_vsi - pause a VSI + * @vsi: the VSI being paused + */ +void ice_dis_vsi(struct ice_vsi *vsi) +{ + struct net_device *dev =3D vsi->netdev; + + if (dev) + netdev_lock(dev); + + ice_dis_vsi_locked(vsi); + + if (dev) + netdev_unlock(dev); +} + +/** + * ice_vsi_set_napi_queues_locked - associate netdev queues with napi * @vsi: VSI pointer * * Associate queue[s] with napi for all vectors. + * Must be called only with the netdev_lock taken. */ -void ice_vsi_set_napi_queues(struct ice_vsi *vsi) +void ice_vsi_set_napi_queues_locked(struct ice_vsi *vsi) { struct net_device *netdev =3D vsi->netdev; int q_idx, v_idx; @@ -2788,7 +2863,6 @@ void ice_vsi_set_napi_queues(struct ice_vsi *vsi) if (!netdev) return; =20 - ASSERT_RTNL(); ice_for_each_rxq(vsi, q_idx) if (vsi->rx_rings[q_idx] && vsi->rx_rings[q_idx]->q_vector) netif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_RX, @@ -2802,17 +2876,37 @@ void ice_vsi_set_napi_queues(struct ice_vsi *vsi) ice_for_each_q_vector(vsi, v_idx) { struct ice_q_vector *q_vector =3D vsi->q_vectors[v_idx]; =20 - netif_napi_set_irq(&q_vector->napi, q_vector->irq.virq); + netif_napi_set_irq_locked(&q_vector->napi, q_vector->irq.virq); } } =20 /** - * ice_vsi_clear_napi_queues - dissociate netdev queues from napi + * ice_vsi_set_napi_queues - associate VSI queues with NAPIs * @vsi: VSI pointer * + * Version of ice_vsi_set_napi_queues_locked() that takes the netdev_lock, + * to use it outside of the net_device_ops context. + */ +void ice_vsi_set_napi_queues(struct ice_vsi *vsi) +{ + struct net_device *netdev =3D vsi->netdev; + + if (!netdev) + return; + + netdev_lock(netdev); + ice_vsi_set_napi_queues_locked(vsi); + netdev_unlock(netdev); +} + +/** + * ice_vsi_clear_napi_queues_locked - dissociate netdev queues from napi + * @vsi: VSI to process + * * Clear the association between all VSI queues queue[s] and napi. + * Must be called only with the netdev_lock taken. */ -void ice_vsi_clear_napi_queues(struct ice_vsi *vsi) +void ice_vsi_clear_napi_queues_locked(struct ice_vsi *vsi) { struct net_device *netdev =3D vsi->netdev; int q_idx, v_idx; @@ -2820,12 +2914,11 @@ void ice_vsi_clear_napi_queues(struct ice_vsi *vsi) if (!netdev) return; =20 - ASSERT_RTNL(); /* Clear the NAPI's interrupt number */ ice_for_each_q_vector(vsi, v_idx) { struct ice_q_vector *q_vector =3D vsi->q_vectors[v_idx]; =20 - netif_napi_set_irq(&q_vector->napi, -1); + netif_napi_set_irq_locked(&q_vector->napi, -1); } =20 ice_for_each_txq(vsi, q_idx) @@ -2835,6 +2928,25 @@ void ice_vsi_clear_napi_queues(struct ice_vsi *vsi) netif_queue_set_napi(netdev, q_idx, NETDEV_QUEUE_TYPE_RX, NULL); } =20 +/** + * ice_vsi_clear_napi_queues - dissociate VSI queues from NAPIs + * @vsi: VSI to process + * + * Version of ice_vsi_clear_napi_queues_locked() that takes the netdev loc= k, + * to use it outside of the net_device_ops context. + */ +void ice_vsi_clear_napi_queues(struct ice_vsi *vsi) +{ + struct net_device *netdev =3D vsi->netdev; + + if (!netdev) + return; + + netdev_lock(netdev); + ice_vsi_clear_napi_queues_locked(vsi); + netdev_unlock(netdev); +} + /** * ice_napi_add - register NAPI handler for the VSI * @vsi: VSI for which NAPI handler is to be registered @@ -3072,16 +3184,17 @@ ice_vsi_realloc_stat_arrays(struct ice_vsi *vsi) } =20 /** - * 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 + * Return: 0 on success, -errno 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) { struct ice_coalesce_stored *coalesce; int prev_num_q_vectors; @@ -3102,8 +3215,8 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flag= s) if (ret) goto unlock; =20 - ice_vsi_decfg(vsi); - ret =3D ice_vsi_cfg_def(vsi); + ice_vsi_decfg_locked(vsi); + ret =3D ice_vsi_cfg_def_locked(vsi); if (ret) goto unlock; =20 @@ -3133,12 +3246,38 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_fl= ags) kfree(coalesce); decfg: if (ret) - ice_vsi_decfg(vsi); + ice_vsi_decfg_locked(vsi); unlock: mutex_unlock(&vsi->xdp_state_lock); return ret; } =20 +/** + * ice_vsi_rebuild - 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. + * + * Return: 0 on success, -errno on failure. + */ +int ice_vsi_rebuild(struct ice_vsi *vsi, u32 vsi_flags) +{ + struct net_device *dev =3D vsi->netdev; + int ret; + + if (dev) + netdev_lock(dev); + + ret =3D ice_vsi_rebuild_locked(vsi, vsi_flags); + + if (dev) + netdev_unlock(dev); + + return ret; +} + /** * ice_is_reset_in_progress - check for a reset in progress * @state: PF state field diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index e7308e381e2f..84e419eaf07c 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -507,16 +507,15 @@ static void ice_sync_fltr_subtask(struct ice_pf *pf) /** * ice_pf_dis_all_vsi - Pause all VSIs on a PF * @pf: the PF - * @locked: is the rtnl_lock already held */ -static void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked) +static void ice_pf_dis_all_vsi(struct ice_pf *pf) { int node; int v; =20 ice_for_each_vsi(pf, v) if (pf->vsi[v]) - ice_dis_vsi(pf->vsi[v], locked); + ice_dis_vsi(pf->vsi[v]); =20 for (node =3D 0; node < ICE_MAX_PF_AGG_NODES; node++) pf->pf_agg_node[node].num_vsis =3D 0; @@ -605,7 +604,7 @@ ice_prepare_for_reset(struct ice_pf *pf, enum ice_reset= _req reset_type) ice_clear_hw_tbls(hw); /* disable the VSIs and their queues that are not already DOWN */ set_bit(ICE_VSI_REBUILD_PENDING, ice_get_main_vsi(pf)->state); - ice_pf_dis_all_vsi(pf, false); + ice_pf_dis_all_vsi(pf); =20 if (test_bit(ICE_FLAG_PTP_SUPPORTED, pf->flags)) ice_ptp_prepare_for_reset(pf, reset_type); @@ -3525,6 +3524,7 @@ static void ice_set_ops(struct ice_vsi *vsi) } =20 netdev->netdev_ops =3D &ice_netdev_ops; + netdev->request_ops_lock =3D true; netdev->udp_tunnel_nic_info =3D &pf->hw.udp_tunnel_nic; netdev->xdp_metadata_ops =3D &ice_xdp_md_ops; ice_set_ethtool_ops(netdev); @@ -4131,6 +4131,7 @@ bool ice_is_wol_supported(struct ice_hw *hw) * @locked: is adev device_lock held * * Only change the number of queues if new_tx, or new_rx is non-0. + * Note that it should be called only with the netdev lock taken. * * Returns 0 on success. */ @@ -4156,7 +4157,7 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx,= int new_tx, bool locked) =20 /* set for the next time the netdev is started */ if (!netif_running(vsi->netdev)) { - err =3D ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); + err =3D ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT); if (err) goto rebuild_err; dev_dbg(ice_pf_to_dev(pf), "Link is down, queue count change happens whe= n link is brought up\n"); @@ -4164,7 +4165,7 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx,= int new_tx, bool locked) } =20 ice_vsi_close(vsi); - err =3D ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); + err =3D ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT); if (err) goto rebuild_err; =20 @@ -5502,7 +5503,7 @@ static void ice_prepare_for_shutdown(struct ice_pf *p= f) dev_dbg(ice_pf_to_dev(pf), "Tearing down internal switch for shutdown\n"); =20 /* disable the VSIs and their queues that are not already DOWN */ - ice_pf_dis_all_vsi(pf, false); + ice_pf_dis_all_vsi(pf); =20 ice_for_each_vsi(pf, v) if (pf->vsi[v]) @@ -5538,16 +5539,17 @@ static int ice_reinit_interrupt_scheme(struct ice_p= f *pf) =20 /* Remap vectors and rings, after successful re-init interrupts */ ice_for_each_vsi(pf, v) { - if (!pf->vsi[v]) + struct ice_vsi *vsi =3D pf->vsi[v]; + + if (!vsi) continue; =20 - ret =3D ice_vsi_alloc_q_vectors(pf->vsi[v]); + ret =3D ice_vsi_alloc_q_vectors(vsi); if (ret) goto err_reinit; - ice_vsi_map_rings_to_vectors(pf->vsi[v]); - rtnl_lock(); - ice_vsi_set_napi_queues(pf->vsi[v]); - rtnl_unlock(); + + ice_vsi_map_rings_to_vectors(vsi); + ice_vsi_set_napi_queues(vsi); } =20 ret =3D ice_req_irq_msix_misc(pf); @@ -5560,13 +5562,15 @@ static int ice_reinit_interrupt_scheme(struct ice_p= f *pf) return 0; =20 err_reinit: - while (v--) - if (pf->vsi[v]) { - rtnl_lock(); - ice_vsi_clear_napi_queues(pf->vsi[v]); - rtnl_unlock(); - ice_vsi_free_q_vectors(pf->vsi[v]); - } + while (v--) { + struct ice_vsi *vsi =3D pf->vsi[v]; + + if (!vsi) + continue; + + ice_vsi_clear_napi_queues(vsi); + ice_vsi_free_q_vectors(vsi); + } =20 return ret; } @@ -5629,14 +5633,17 @@ static int ice_suspend(struct device *dev) * to CPU0. */ ice_free_irq_msix_misc(pf); + ice_for_each_vsi(pf, v) { - if (!pf->vsi[v]) + struct ice_vsi *vsi =3D pf->vsi[v]; + + if (!vsi) continue; - rtnl_lock(); - ice_vsi_clear_napi_queues(pf->vsi[v]); - rtnl_unlock(); - ice_vsi_free_q_vectors(pf->vsi[v]); + + ice_vsi_clear_napi_queues(vsi); + ice_vsi_free_q_vectors(vsi); } + ice_clear_interrupt_scheme(pf); =20 pci_save_state(pdev); @@ -6764,7 +6771,7 @@ static void ice_napi_enable_all(struct ice_vsi *vsi) ice_init_moderation(q_vector); =20 if (q_vector->rx.rx_ring || q_vector->tx.tx_ring) - napi_enable(&q_vector->napi); + napi_enable_locked(&q_vector->napi); } } =20 @@ -7263,7 +7270,7 @@ static void ice_napi_disable_all(struct ice_vsi *vsi) struct ice_q_vector *q_vector =3D vsi->q_vectors[q_idx]; =20 if (q_vector->rx.rx_ring || q_vector->tx.tx_ring) - napi_disable(&q_vector->napi); + napi_disable_locked(&q_vector->napi); =20 cancel_work_sync(&q_vector->tx.dim.work); cancel_work_sync(&q_vector->rx.dim.work); @@ -7563,7 +7570,7 @@ int ice_vsi_open(struct ice_vsi *vsi) if (err) goto err_set_qs; =20 - ice_vsi_set_napi_queues(vsi); + ice_vsi_set_napi_queues_locked(vsi); } =20 err =3D ice_up_complete(vsi); @@ -7649,7 +7656,7 @@ static int ice_vsi_rebuild_by_type(struct ice_pf *pf,= enum ice_vsi_type type) vsi->vsi_num =3D ice_get_hw_vsi_num(&pf->hw, vsi->idx); =20 /* enable the VSI */ - err =3D ice_ena_vsi(vsi, false); + err =3D ice_ena_vsi(vsi); if (err) { dev_err(dev, "enable VSI failed, err %d, VSI index %d, type %s\n", err, vsi->idx, ice_vsi_type_str(type)); @@ -9255,7 +9262,7 @@ static int ice_setup_tc_mqprio_qdisc(struct net_devic= e *netdev, void *type_data) return 0; =20 /* Pause VSI queues */ - ice_dis_vsi(vsi, true); + ice_dis_vsi_locked(vsi); =20 if (!hw && !test_bit(ICE_FLAG_TC_MQPRIO, pf->flags)) ice_remove_q_channels(vsi, true); @@ -9294,14 +9301,14 @@ static int ice_setup_tc_mqprio_qdisc(struct net_dev= ice *netdev, void *type_data) cur_rxq =3D vsi->num_rxq; =20 /* proceed with rebuild main VSI using correct number of queues */ - ret =3D ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); + ret =3D ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT); if (ret) { /* fallback to current number of queues */ dev_info(dev, "Rebuild failed with new queues, try with current number o= f queues\n"); vsi->req_txq =3D cur_txq; vsi->req_rxq =3D cur_rxq; clear_bit(ICE_RESET_FAILED, pf->state); - if (ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT)) { + if (ice_vsi_rebuild_locked(vsi, ICE_VSI_FLAG_NO_INIT)) { dev_err(dev, "Rebuild of main VSI failed again\n"); return ret; } @@ -9357,7 +9364,7 @@ static int ice_setup_tc_mqprio_qdisc(struct net_devic= e *netdev, void *type_data) vsi->all_enatc =3D 0; } /* resume VSI */ - ice_ena_vsi(vsi, true); + ice_ena_vsi_locked(vsi); =20 return ret; } diff --git a/drivers/net/ethernet/intel/ice/ice_sf_eth.c b/drivers/net/ethe= rnet/intel/ice/ice_sf_eth.c index 2cf04bc6edce..a751782cd852 100644 --- a/drivers/net/ethernet/intel/ice/ice_sf_eth.c +++ b/drivers/net/ethernet/intel/ice/ice_sf_eth.c @@ -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 =3D &ice_sf_netdev_ops; + netdev->request_ops_lock =3D true; SET_NETDEV_DEVLINK_PORT(netdev, devlink_port); =20 err =3D register_netdev(netdev); @@ -183,7 +184,9 @@ static void ice_sf_dev_remove(struct auxiliary_device *= adev) devlink =3D priv_to_devlink(sf_dev->priv); devl_lock(devlink); =20 + netdev_lock(vsi->netdev); ice_vsi_close(vsi); + netdev_unlock(vsi->netdev); =20 ice_sf_decfg_netdev(vsi); ice_devlink_destroy_sf_dev_port(sf_dev); diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/etherne= t/intel/ice/ice_xsk.c index 0643017541c3..be0cb548487a 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -33,9 +33,9 @@ ice_qvec_toggle_napi(struct ice_vsi *vsi, struct ice_q_ve= ctor *q_vector, return; =20 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); } =20 /** --=20 2.53.0 From nobody Mon Apr 6 16:47:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB98D347FF4; Wed, 18 Mar 2026 16:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851801; cv=none; b=V5FQKFPS2Xvqre9P46dNd5RlKEFKhG2RwlKTHSRpBZeZYe573KQzeM0sqo1I+Dydpfp/ftJCRRbQOggKT1SRKtsr2aMehzzKOvYoOLiAjbmlzAmyCY0VDKBhqJe9Ivkv7GnpteSWrGnlvg+9bEEX2tC4A2860YgoZD72kMYXkNk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851801; c=relaxed/simple; bh=A1c9nMFHPORLTWdGmk0Rd+UFcfF1Ppfnkf3ANtVtCZI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S4VEepqPFtgcJdQOUKzX2wpG30ZB1wEmuEoE+F9O9GT+SgAqh1H0rrInvttA3vguLU8Bgltcm0YkCE2ZuvSz4peyM7DwEi+VEMl6hVjXVobdwbQJRBfgPg+p/8uxBnsRdrTWUYyhCR8NiakPeZTTUd54YaprDSLUzVkwlwKUP4o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=An4UdN4F; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="An4UdN4F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773851798; x=1805387798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A1c9nMFHPORLTWdGmk0Rd+UFcfF1Ppfnkf3ANtVtCZI=; b=An4UdN4FwdXB0fYmKCv9Bkx9g8cfrvMVAw/1AoHvEPVgOc9GjTlpacDf oQ4kmNwDwDlpx/nr+3yOn+8WiNXsDb0Tbv/GUacs3ncp05jfYlA6YIa+f TauRgkjCt8oHqLExGGd3VxaKZQ5thjrfple2Wy4bulSjOjGZPPZ/Fto/d 0GzS+VrOaEAxazzopqdsNiuCoGvtlYflDHTs/mznK3eiBylmfdaASExUg x+XfHGnqncUdBg6BYEYQjFfvqKX3QAZWb5RDpas/2WHFfb5DKEXvZL7dA 575lNGgqBSfCV0QrXXgSc6ahapVExVRXzjbf/25Eey3Jk4X6eYI4m0gCV w==; X-CSE-ConnectionGUID: TljfXe/BSy+88UPM+LFaUA== X-CSE-MsgGUID: V6sqaHg/Td2jsCFMOtJgig== X-IronPort-AV: E=McAfee;i="6800,10657,11733"; a="62479414" X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="62479414" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 09:36:37 -0700 X-CSE-ConnectionGUID: EpMPPGHfRomUaorpWNce1g== X-CSE-MsgGUID: tdfgLWsTS2Wt610Z1cgEgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="218687710" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa010.fm.intel.com with ESMTP; 18 Mar 2026 09:36:33 -0700 From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Cc: Alexander Lobakin , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jacob Keller , Aleksandr Loktionov , nxne.cnse.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next v4 4/5] ice: implement Rx queue management ops Date: Wed, 18 Mar 2026 17:35:04 +0100 Message-ID: <20260318163505.31765-5-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260318163505.31765-1-aleksander.lobakin@intel.com> References: <20260318163505.31765-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Jacob Keller Reviewed-by: Aleksandr Loktionov Signed-off-by: Alexander Lobakin --- drivers/net/ethernet/intel/ice/ice_lib.h | 5 + drivers/net/ethernet/intel/ice/ice_txrx.h | 2 + drivers/net/ethernet/intel/ice/ice_base.c | 182 +++++++++++++++----- 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 ++- 6 files changed, 165 insertions(+), 54 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/etherne= t/intel/ice/ice_lib.h index 476fa54ec4e8..e1e85976e523 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_lib.h @@ -4,6 +4,8 @@ #ifndef _ICE_LIB_H_ #define _ICE_LIB_H_ =20 +#include + #include "ice.h" #include "ice_vlan.h" =20 @@ -135,4 +137,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_ */ diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethern= et/intel/ice/ice_txrx.h index b6547e1b7c42..557b5e656bb0 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.h +++ b/drivers/net/ethernet/intel/ice/ice_txrx.h @@ -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); diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethern= et/intel/ice/ice_base.c index 1add82d894bb..4e0b8895c303 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.c +++ b/drivers/net/ethernet/intel/ice/ice_base.c @@ -653,6 +653,43 @@ static int ice_rxq_pp_create(struct ice_rx_ring *rq) return err; } =20 +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 =3D netdev_priv(dev); + const struct ice_rx_ring *real =3D priv->vsi->rx_rings[idx]; + struct ice_rx_ring *new =3D per_queue_mem; + int ret; + + new->count =3D real->count; + new->netdev =3D real->netdev; + new->q_index =3D real->q_index; + new->q_vector =3D real->q_vector; + new->vsi =3D real->vsi; + + ret =3D ice_rxq_pp_create(new); + if (ret) + return ret; + + if (!netif_running(dev)) + return 0; + + ret =3D __xdp_rxq_info_reg(&new->xdp_rxq, new->netdev, new->q_index, + new->q_vector->napi.napi_id, new->truesize); + 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 @@ -691,19 +728,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 ri= ng %d\n", ring->q_index); } else { - err =3D ice_rxq_pp_create(ring); + err =3D ice_queue_mem_alloc(ring->netdev, NULL, ring, + ring->q_index); if (err) return err; - - err =3D __xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev, - ring->q_index, - ring->q_vector->napi.napi_id, - ring->truesize); - if (err) - goto err_destroy_fq; - - xdp_rxq_info_attach_page_pool(&ring->xdp_rxq, - ring->pp); } } =20 @@ -712,7 +740,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; } =20 if (ring->xsk_pool) { @@ -743,12 +771,12 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring) err =3D ice_alloc_rx_bufs(ring, num_bufs); =20 if (err) - goto err_destroy_fq; + goto err_clean_rq; =20 return 0; =20 -err_destroy_fq: - ice_rxq_pp_destroy(ring); +err_clean_rq: + ice_clean_rx_ring(ring); =20 return err; } @@ -1460,27 +1488,7 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, = u16 q_idx) sizeof(vsi->xdp_rings[q_idx]->ring_stats->stats)); } =20 -/** - * 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 =3D { }; struct ice_q_vector *q_vector; @@ -1519,23 +1527,35 @@ int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx) } =20 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); =20 + ice_clean_tx_ring(vsi->tx_rings[q_idx]); + if (vsi->xdp_rings) + ice_clean_tx_ring(vsi->xdp_rings[q_idx]); + return fail; } =20 /** - * 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 =3D __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 =3D 0; bool link_up; int err; =20 @@ -1553,10 +1573,6 @@ int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx) ice_tx_xsk_pool(vsi, q_idx); } =20 - err =3D ice_vsi_cfg_single_rxq(vsi, q_idx); - if (!fail) - fail =3D err; - q_vector =3D vsi->rx_rings[q_idx]->q_vector; ice_qvec_cfg_msix(vsi, q_vector, q_idx); =20 @@ -1577,3 +1593,81 @@ int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx) =20 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 =3D netdev_priv(dev); + struct ice_rx_ring *real =3D priv->vsi->rx_rings[idx]; + struct ice_rx_ring *new =3D per_queue_mem; + struct napi_struct *napi; + int ret; + + real->pp =3D new->pp; + real->rx_fqes =3D new->rx_fqes; + real->hdr_fqes =3D new->hdr_fqes; + real->hdr_pp =3D new->hdr_pp; + + real->hdr_truesize =3D new->hdr_truesize; + real->truesize =3D new->truesize; + real->rx_hdr_len =3D new->rx_hdr_len; + real->rx_buf_len =3D new->rx_buf_len; + + memcpy(&real->xdp_rxq, &new->xdp_rxq, sizeof(new->xdp_rxq)); + + ret =3D ice_setup_rx_ctx(real); + if (ret) + return ret; + + napi =3D &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 =3D 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 =3D netdev_priv(dev); + struct ice_rx_ring *real =3D priv->vsi->rx_rings[idx]; + int ret; + + ret =3D __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 =3D { + .ndo_queue_mem_alloc =3D ice_queue_mem_alloc, + .ndo_queue_mem_free =3D ice_queue_mem_free, + .ndo_queue_mem_size =3D sizeof(struct ice_rx_ring), + .ndo_queue_start =3D ice_queue_start, + .ndo_queue_stop =3D ice_queue_stop, +}; diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 84e419eaf07c..3ba7f49205f1 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3524,7 +3524,7 @@ static void ice_set_ops(struct ice_vsi *vsi) } =20 netdev->netdev_ops =3D &ice_netdev_ops; - netdev->request_ops_lock =3D true; + netdev->queue_mgmt_ops =3D &ice_queue_mgmt_ops; netdev->udp_tunnel_nic_info =3D &pf->hw.udp_tunnel_nic; netdev->xdp_metadata_ops =3D &ice_xdp_md_ops; ice_set_ethtool_ops(netdev); diff --git a/drivers/net/ethernet/intel/ice/ice_sf_eth.c b/drivers/net/ethe= rnet/intel/ice/ice_sf_eth.c index a751782cd852..bd5eeb27d3f8 100644 --- a/drivers/net/ethernet/intel/ice/ice_sf_eth.c +++ b/drivers/net/ethernet/intel/ice/ice_sf_eth.c @@ -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 =3D &ice_sf_netdev_ops; - netdev->request_ops_lock =3D true; + netdev->queue_mgmt_ops =3D &ice_queue_mgmt_ops; SET_NETDEV_DEVLINK_PORT(netdev, devlink_port); =20 err =3D register_netdev(netdev); diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethern= et/intel/ice/ice_txrx.c index a2cd4cf37734..59b2ab09b87a 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -530,17 +530,13 @@ void ice_rxq_pp_destroy(struct ice_rx_ring *rq) rq->hdr_pp =3D NULL; } =20 -/** - * 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 =3D per_queue_mem; =20 if (rx_ring->xsk_pool) { ice_xsk_clean_rx_ring(rx_ring); - goto rx_skip_free; + return; } =20 /* ring already cleared, nothing to do */ @@ -569,8 +565,12 @@ void ice_clean_rx_ring(struct ice_rx_ring *rx_ring) } =20 ice_rxq_pp_destroy(rx_ring); +} + +void ice_zero_rx_ring(struct ice_rx_ring *rx_ring) +{ + size_t size; =20 -rx_skip_free: /* Zero out the descriptor ring */ size =3D ALIGN(rx_ring->count * sizeof(union ice_32byte_rx_desc), PAGE_SIZE); @@ -580,6 +580,16 @@ void ice_clean_rx_ring(struct ice_rx_ring *rx_ring) rx_ring->next_to_use =3D 0; } =20 +/** + * 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 --=20 2.53.0 From nobody Mon Apr 6 16:47:46 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70BD13EB815; Wed, 18 Mar 2026 16:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851803; cv=none; b=nyx6BZi+YAs4Cn4W9eHX6UJ6v9gx65smDgIO169DZH+/zx6oB0Puc/77lmDS/o3UYCj+DbrOxBNMxzxvlmSardEhzdztJw2P42iY3ICR0xG4HXuKjQAqPCLseUTwPJhA7A6xNR4B2fbEm5PHglfO9CAJEUBmBKvu81mLryUtvww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773851803; c=relaxed/simple; bh=sOhBhAiO4ncz9AORE7Sqln8Yo3y63hhhZ9bOmuNuU0Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ezd9f485UigP0as34TO25QjerzmIkhlx5tP3rWs9nySoVhZP3DygbG221zGXgaER/rku2sUBCvZ8ZQNxRB4WfKaj/Bs4zG/sHbelHeh085kjcJTV7I4b96D8SGYxOxVI6s3iBsctTm0ET2v8hjOwkZ5ycFDGntkbga4pkT4z64s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AVxT9cy9; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AVxT9cy9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773851800; x=1805387800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sOhBhAiO4ncz9AORE7Sqln8Yo3y63hhhZ9bOmuNuU0Q=; b=AVxT9cy9T1XQNIxz+vMQP4NFIk0uXSfmrsSIv6qNlFqTwUceMWVMJsA2 UXYckfKsWatlpUrQfZzyzIfJISQUeHitg/sxip3hfaaFLxOEXN0Z1lpHh 08wM9gRa2Ht6K4beD38aN8QH3fHUW5jRC4dDCjqMM9S5UtWXYn2h4jYYL DeZ4KJUw9wv3jhuubVDU5qH4B4s9JQVXcsbq7grnCUiAmPDk03LdFPofG wriLiAAFTvlSdWdDJ2BLj1tqg62BIMWcz++ondE8bfesY2wwSykdgH0UE vKowS4A32plvAOVn26EGwvrSrrhY5wj8aZdRkaJKAzsgM+Q0NMjTuZGqD Q==; X-CSE-ConnectionGUID: xstL7E12TF6SNp/DqeuyNQ== X-CSE-MsgGUID: 7h3tXwL7SguZLBFrV+YIyg== X-IronPort-AV: E=McAfee;i="6800,10657,11733"; a="62479429" X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="62479429" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2026 09:36:40 -0700 X-CSE-ConnectionGUID: K4SXE6kVT9WOfwd8Gbk4eA== X-CSE-MsgGUID: 5Y3ixdK3TVSFIBoWm3aZZQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,127,1770624000"; d="scan'208";a="218687713" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa010.fm.intel.com with ESMTP; 18 Mar 2026 09:36:37 -0700 From: Alexander Lobakin To: intel-wired-lan@lists.osuosl.org Cc: Alexander Lobakin , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Jacob Keller , Aleksandr Loktionov , nxne.cnse.osdt.itp.upstreaming@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH iwl-next v4 5/5] ice: add support for transmitting unreadable frags Date: Wed, 18 Mar 2026 17:35:05 +0100 Message-ID: <20260318163505.31765-6-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260318163505.31765-1-aleksander.lobakin@intel.com> References: <20260318163505.31765-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Jacob Keller Reviewed-by: Aleksandr Loktionov Signed-off-by: Alexander Lobakin --- 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(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 3ba7f49205f1..9ef258d5ab48 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3525,6 +3525,7 @@ static void ice_set_ops(struct ice_vsi *vsi) =20 netdev->netdev_ops =3D &ice_netdev_ops; netdev->queue_mgmt_ops =3D &ice_queue_mgmt_ops; + netdev->netmem_tx =3D true; netdev->udp_tunnel_nic_info =3D &pf->hw.udp_tunnel_nic; netdev->xdp_metadata_ops =3D &ice_xdp_md_ops; ice_set_ethtool_ops(netdev); diff --git a/drivers/net/ethernet/intel/ice/ice_sf_eth.c b/drivers/net/ethe= rnet/intel/ice/ice_sf_eth.c index bd5eeb27d3f8..f3ac5dfabc0c 100644 --- a/drivers/net/ethernet/intel/ice/ice_sf_eth.c +++ b/drivers/net/ethernet/intel/ice/ice_sf_eth.c @@ -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 =3D &ice_sf_netdev_ops; netdev->queue_mgmt_ops =3D &ice_queue_mgmt_ops; + netdev->netmem_tx =3D true; SET_NETDEV_DEVLINK_PORT(netdev, devlink_port); =20 err =3D register_netdev(netdev); diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethern= et/intel/ice/ice_txrx.c index 59b2ab09b87a..3008745c2b39 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -113,11 +113,17 @@ ice_prgm_fdir_fltr(struct ice_vsi *vsi, struct ice_fl= tr_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 !=3D 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; + } =20 switch (tx_buf->type) { case ICE_TX_BUF_DUMMY: @@ -337,12 +343,14 @@ static bool ice_clean_tx_irq(struct ice_tx_ring *tx_r= ing, int napi_budget) } =20 /* unmap any remaining paged data */ - if (dma_unmap_len(tx_buf, len)) { + if (tx_buf->type !=3D 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 =3D ICE_TX_BUF_EMPTY; } } ice_trace(clean_tx_irq_unmap_eop, tx_ring, tx_desc, tx_buf); @@ -1494,7 +1502,8 @@ ice_tx_map(struct ice_tx_ring *tx_ring, struct ice_tx= _buf *first, DMA_TO_DEVICE); =20 tx_buf =3D &tx_ring->tx_buf[i]; - tx_buf->type =3D ICE_TX_BUF_FRAG; + if (!skb_frag_is_net_iov(frag)) + tx_buf->type =3D ICE_TX_BUF_FRAG; } =20 /* record SW timestamp if HW timestamp is not available */ @@ -2366,7 +2375,7 @@ void ice_clean_ctrl_tx_irq(struct ice_tx_ring *tx_rin= g) } =20 /* unmap the data header */ - if (dma_unmap_len(tx_buf, len)) + if (tx_buf->type !=3D ICE_TX_BUF_EMPTY) dma_unmap_single(tx_ring->dev, dma_unmap_addr(tx_buf, dma), dma_unmap_len(tx_buf, len), --=20 2.53.0