[PATCH RFC net-next 05/12] net: enic: complete XDP frames by WQ descriptor ownership
From: Satish Kharat
Date: Mon Nov 30 2026 - 20:16:41 EST
The common WQ cleanup path also serves XDP frames. Use the ownership
tag to unmap DMA only when the driver mapped it, then return the frame.
The skb path is unchanged. XDP posting is enabled later in the series.
Signed-off-by: Satish Kharat <satishkh@xxxxxxxxx>
---
drivers/net/ethernet/cisco/enic/enic_wq.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/cisco/enic/enic_wq.c b/drivers/net/ethernet/cisco/enic/enic_wq.c
index 07936f8b4231..ceab5a8e68cf 100644
--- a/drivers/net/ethernet/cisco/enic/enic_wq.c
+++ b/drivers/net/ethernet/cisco/enic/enic_wq.c
@@ -2,6 +2,7 @@
// Copyright 2025 Cisco Systems, Inc. All rights reserved.
#include <net/netdev_queues.h>
+#include <net/xdp.h>
#include "enic_res.h"
#include "enic.h"
#include "enic_wq.h"
@@ -41,6 +42,21 @@ static void enic_wq_cq_desc_dec(const struct cq_desc *desc_arg, bool ext_wq,
void enic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf)
{
struct enic *enic = vnic_dev_priv(wq->vdev);
+ struct xdp_frame *xdpf;
+
+ if (buf->type == VNIC_WQ_BUF_XDP) {
+ xdpf = buf->os_buf;
+ if (buf->xdp_dma_mapped)
+ dma_unmap_single(&enic->pdev->dev, buf->dma_addr,
+ buf->len, DMA_TO_DEVICE);
+ if (xdpf)
+ xdp_return_frame(xdpf);
+ buf->os_buf = NULL;
+ buf->dma_addr = 0;
+ buf->xdp_dma_mapped = false;
+ buf->type = VNIC_WQ_BUF_SKB;
+ return;
+ }
if (buf->sop)
dma_unmap_single(&enic->pdev->dev, buf->dma_addr, buf->len,
--
2.43.0