From: sashiko-bot@kernel.org
To: "Satish Kharat" <satishkh@cisco.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH RFC net-next 08/12] net: enic: add native XDP RX, TX, and redirect
Date: Wed, 02 Dec 2026 01:16:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-244591@kernel.org> (raw)
In-Reply-To: <20261130-enic-xdp-rfc-p1-20261130-v1-8-3be5458c9118@cisco.com>
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 <satishkh@cisco.com>
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/ethernet/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 = 0; i < enic->intr_count; i++)
> vnic_intr_unmask(&enic->intr[i]);
>
> + 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_open)
<-- 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 == 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 = true;
>
> - 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;
> + }
>
> - 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 = 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 = false;
> + err = 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 = 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 = 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/ethernet/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 = &erq->stats;
> unsigned int headroom = erq->xdp_enabled ? ENIC_XDP_HEADROOM : 0;
> unsigned int offset = 0;
> - unsigned int len = netdev->mtu + VLAN_ETH_HLEN;
> + unsigned int len = netdev->mtu + enic_rx_l2_len(enic);
> unsigned int os_buf_index = 0;
> dma_addr_t dma_addr;
> struct vnic_rq_buf *buf = 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 = len + headroom;
if (erq->xdp_enabled)
truesize += ENIC_XDP_TAILROOM;
...
page = page_pool_dev_alloc(erq->pool, &offset, &truesize);
...
buf->truesize = truesize;
}
When two or more buffers fit in a page (such as MTU <= 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.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130-enic-xdp-rfc-p1-20261130-v1-0-3be5458c9118@cisco.com?part=8
next prev parent reply other threads:[~2026-12-02 1:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 1:15 [PATCH RFC net-next 00/12] enic: add native XDP and AF_XDP support Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 01/12] net: enic: bound skb TX rollback to current packet Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 02/12] net: enic: tag work queue descriptor ownership Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 03/12] net: enic: gate native XDP on mixed RQ descriptor capability Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 04/12] net: enic: expose per-queue XDP and AF_XDP counters Satish Kharat
2026-12-02 1:16 ` sashiko-bot
2026-12-01 1:15 ` [PATCH RFC net-next 05/12] net: enic: complete XDP frames by WQ descriptor ownership Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 06/12] net: enic: reserve XDP head and tailroom in RX pages Satish Kharat
2026-12-02 1:16 ` sashiko-bot
2026-12-01 1:15 ` [PATCH RFC net-next 07/12] net: enic: publish partial receive descriptor batches Satish Kharat
2026-12-02 1:16 ` sashiko-bot
2026-12-01 1:15 ` [PATCH RFC net-next 08/12] net: enic: add native XDP RX, TX, and redirect Satish Kharat
2026-12-02 1:16 ` sashiko-bot [this message]
2026-12-01 1:15 ` [PATCH RFC net-next 09/12] net: enic: batch AF_XDP TX completions by pool Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 10/12] net: enic: add AF_XDP zero-copy RX and TX Satish Kharat
2026-12-02 1:16 ` sashiko-bot
2026-12-01 1:15 ` [PATCH RFC net-next 11/12] selftests/xsk: exercise XDP detach with bound socket Satish Kharat
2026-12-01 1:15 ` [PATCH RFC net-next 12/12] net: enic: count XDP and AF_XDP TX in queue statistics Satish Kharat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-244591@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=satishkh@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.