From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796174180; b=Zas36xf7yoJax9Z3ZeCv9Oj+BFWPXGH6Vky3zhSJAfXNAzSTl1IeJfQYI6bR0A7v1buo eCnEnrY+UThDuP+dbg6cZ8KyWbunelZ3jVcSle9no7OjJIyGMi6q/ZR5rcT0ImM7mX1SC /XsXeCP/yiBzUf1EzuoFIn2vwZ2QebweJySOdlR5tQTqkyP4eJI48taQkxbXyzjgDR69l Wger+CqAj/UKzlljITnnv3G+cCmgB3MACO4GpXIz4WRzXGgI3EFw6Cbz6yiWcD6FRkgbV cae20A1RrdoB6bj8ip0JchwxsyEkxKyh92n36JsgSyXDZIttjKdP61RSEQ2PK7pIefg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796174180; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=TWduJxmOA2Ypdl8lff9qQhZMmFyT8w8iQTR6iI3jrqY=; b=F4AUl/TNgxKBlxVxqH+0dRAyU25816h6kQaws9hs/+vpxBwIE8n+2W9u37TmsJFCyBCS Lt9wpafxr2rHHVVvqysA4m2hoW1Ij5HLQUFcffOSH+pn9HH4JboUsF09Tjpc5+vJThnq6 ZhCRrmZxFBmRnQAr7h9CdOtL4rna6lZnJjqF6Dy34zbksBKyflcZ151D+LK+Cq+RXtlCQ xm00IxIltJ4XRP9cyIrnc8r1sr4LC4hI4M3e2jhruqHyv9dnibYkFRJ61gIVCIZuyyBMe RlBU7ede5C0BW9123gKHNPdSarCmEETixIYr8LAX5j4peTR2I1p+U17SLIa7wuRXsAg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cHXLbKv6; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 587D6606A323 for ; Wed, 2 Dec 2026 01:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cHXLbKv6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 200D91F00893; Wed, 2 Dec 2026 01:16:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796174180; bh=TWduJxmOA2Ypdl8lff9qQhZMmFyT8w8iQTR6iI3jrqY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=cHXLbKv6389Nyy98N8RItyXyg7cijVFH0X8aYUFfB4J1LHLriDLyzPDWC58cNy+PG 8dHV1BYEx/Mj24KcfrkNkh9fuPGN9IU2k+LxLLjAgswrDEeKqDWVHEoGQp6m5Fy58i mN2gx/6ZcwaJlAUntbX68nGAo4Ba2+31bV3Xgvkf244nVLxqpt1zH1P//lv9Amw48+ 38thW9k5BtjjysSkUV9ixAUJ0ZyyT1GpHf12JjFGThNQuE6p7bePFMxNreXJCIaRw1 sG4Ih1kKpiGGlLN+8iUytM826fdokH48SVPXpxAnfuRwqpQrkxh9QuOB5uEZFsVVqy H1JSCx+z5b9ZA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RFC net-next 08/12] net: enic: add native XDP RX, TX, and redirect Reply-To: sashiko-reviews@lists.linux.dev To: "Satish Kharat" Cc: bpf@vger.kernel.org In-Reply-To: <20261130-enic-xdp-rfc-p1-20261130-v1-8-3be5458c9118@cisco.com> References: <20261130-enic-xdp-rfc-p1-20261130-v1-0-3be5458c9118@cisco.com> <20261130-enic-xdp-rfc-p1-20261130-v1-8-3be5458c9118@cisco.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 01:16:19 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] net: enic: unaligned truesize in enic_rq_alloc_buf() misaligns skb_shared_info - [Medium] net: enic: datapath_open set after unmasking IRQs in enic_open() - [Medium] net: enic: skipped enic_ext_cq() on reset error paths -- commit 4b53d4ae435146c6750ed4d9efd1c19cb925255f Author: Satish Kharat net: enic: add native XDP RX, TX, and redirect This commit adds native XDP support to enic, including page-pool RX queue registration, XDP_PASS/DROP/TX/REDIRECT handling, ndo_xdp_xmit, and RX VLAN stripping reconfiguration when XDP is attached. > diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/et= hernet/cisco/enic/enic_main.c > index 430fd6b210e88..4c1ea75654bb0 100644 > --- a/drivers/net/ethernet/cisco/enic/enic_main.c > +++ b/drivers/net/ethernet/cisco/enic/enic_main.c [ ... ] > @@ -1813,10 +2016,21 @@ static int enic_open(struct net_device *netdev) > for (i =3D 0; i < enic->intr_count; i++) > vnic_intr_unmask(&enic->intr[i]); > =20 > + WRITE_ONCE(enic->datapath_open, true); [Severity: Medium] Should datapath_open be set to true before unmasking interrupts in enic_open()? NAPI and the device are already enabled at this point, so an RQ interrupt can fire as soon as its vector is unmasked while the loop is still unmasking the remaining vectors: CPU0 CPU1 enic_open() vnic_intr_unmask(&intr[0]) enic_isr_msix() ... enic_poll_msix_rq() ... enic_xdp_run() enic_xdp_xmit_frame() !READ_ONCE(enic->datapath_ope= n) <-- drops XDP_TX frame WRITE_ONCE(enic->datapath_open, true) Any XDP_TX (or concurrent enic_xdp_xmit()) frame processed in that window sees datapath_open =3D=3D false and is dropped with -ENETDOWN. [ ... ] > @@ -2311,28 +2679,61 @@ static void enic_reset(struct work_struct *work) > dev_close(enic->netdev); > goto reset_out; > } > + if (enic_has_admin_chan(enic)) > + enic->admin_reopen_pending =3D true; > =20 > - enic_stop(enic->netdev); > + /* A forced stop can already have reset the vNIC. */ > + __enic_stop(enic->netdev, &stop_reset_done); > if (enic_is_sriov_vf_v2(enic)) > enic_mbox_vf_link_state_reset(enic); > + if (READ_ONCE(enic->dma_blocked)) { > + enic_set_api_busy(enic, false); > + call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev); > + rtnl_unlock(); > + return; > + } > =20 > - enic_dev_soft_reset(enic); > - enic_reset_addr_lists(enic); > - enic_init_vnic_resources(enic); > - enic_set_rss_nic_cfg(enic); > - enic_dev_set_ig_vlan_rewrite_mode(enic); > - enic_ext_cq(enic); > + if (!stop_reset_done) { > + /* The admin channel is down; quarantine was handled above. */ > + err =3D enic_dev_soft_reset(enic); > + if (err) { > + netdev_err(enic->netdev, > + "soft reset failed: %d; blocking PCI DMA\n", > + err); > + enic_block_pci_dma(enic); > + enic_set_api_busy(enic, false); > + call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev); > + rtnl_unlock(); > + return; > + } > + enic_reset_addr_lists(enic); > + enic_init_vnic_resources(enic); > + enic->vlan_rewrite_valid =3D false; > + err =3D enic_set_rss_nic_cfg(enic); > + if (err) { > + netdev_err(enic->netdev, > + "failed to restore NIC configuration after reset: %d\n", > + err); > + goto reset_out; > + } > + err =3D enic_dev_set_ig_vlan_rewrite_mode(enic); > + if (err) { > + netdev_err(enic->netdev, > + "failed to restore ingress VLAN rewrite after reset: %d\n", > + err); > + goto reset_out; > + } > + enic->vlan_rewrite_valid =3D true; > + enic_ext_cq(enic); > + } [Severity: Medium] If enic_set_rss_nic_cfg() or enic_dev_set_ig_vlan_rewrite_mode() fails here (or in the identical block in enic_tx_hang_reset()), does jumping to reset_out leave the hardware RQ CQ entry size out of sync with enic->ext_cq? The soft or hang reset reverts the vNIC firmware to 16-byte RQ CQ entries. A later enic_open() retries VLAN rewrite and NIC_CFG through vlan_rewrite_valid and niccfg_valid, but it does not call enic_ext_cq(), so RX and admin RQ completion polling will decode 32-byte or 64-byte CQ entries while firmware writes 16-byte entries. enic_finish_dma_quiesce() avoids this by still calling enic_ext_cq() when those commands fail. > diff --git a/drivers/net/ethernet/cisco/enic/enic_rq.c b/drivers/net/ethe= rnet/cisco/enic/enic_rq.c > index 82ef15296a100..350e42c556ade 100644 > --- a/drivers/net/ethernet/cisco/enic/enic_rq.c > +++ b/drivers/net/ethernet/cisco/enic/enic_rq.c > @@ -276,7 +276,7 @@ int enic_rq_alloc_buf(struct vnic_rq *rq) > struct enic_rq_stats *rqstats =3D &erq->stats; > unsigned int headroom =3D erq->xdp_enabled ? ENIC_XDP_HEADROOM : 0; > unsigned int offset =3D 0; > - unsigned int len =3D netdev->mtu + VLAN_ETH_HLEN; > + unsigned int len =3D netdev->mtu + enic_rx_l2_len(enic); > unsigned int os_buf_index =3D 0; > dma_addr_t dma_addr; > struct vnic_rq_buf *buf =3D rq->to_use; [Severity: High] Can unaligned buf->truesize in enic_rq_alloc_buf() misalign skb_shared_info when an XDP buffer or frame is converted to an skb? With XDP attached, rx_vlan_strip is false, so enic_rx_l2_len(enic) is ENIC_RX_MAX_L2_LEN (22 bytes) and truesize is netdev->mtu + 22 + ENIC_XDP_HEADROOM + ENIC_XDP_TAILROOM, which is not aligned to SKB_DATA_ALIGN() (for example, 2098 bytes at MTU 1500). drivers/net/ethernet/cisco/enic/enic_rq.c:enic_rq_alloc_buf() { ... unsigned int truesize =3D len + headroom; if (erq->xdp_enabled) truesize +=3D ENIC_XDP_TAILROOM; ... page =3D page_pool_dev_alloc(erq->pool, &offset, &truesize); ... buf->truesize =3D truesize; } When two or more buffers fit in a page (such as MTU <=3D 1450 on 4K pages, = or MTU 1500 on 16K/64K pages), page_pool_alloc_netmem() aligns its internal frag_offset step but only writes the aligned size back to *size on the last fragment of the page. Non-final fragments keep the unaligned truesize, which enic_xdp_run() passes to xdp_init_buff() as frame_sz, placing xdp_data_hard_end() and skb_shinfo(skb) at an unaligned address when building an skb (e.g. after XDP_REDIRECT to cpumap or veth). Aligning truesize with SKB_DATA_ALIGN() (or aligning len before computing truesize) in enic_rq_alloc_buf() and enic_open() avoids this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130-enic-xdp-r= fc-p1-20261130-v1-0-3be5458c9118@cisco.com?part=3D8