Thread (11 messages) 11 messages, 3 authors, 2025-10-22

Re: [PATCH net-next v7 3/5] eea: probe the netdevice and create adminq

From: Paolo Abeni <pabeni@redhat.com>
Date: 2025-10-21 07:48:44

On 10/16/25 1:06 PM, Xuan Zhuo wrote:
+int eea_adminq_destroy_q(struct eea_net *enet, u32 qidx, int num)
+{
+	struct device *dev = enet->edev->dma_dev;
+	dma_addr_t dma_addr;
+	__le16 *buf;
+	int i, err;
+	u32 size;
+
+	if (qidx == 0 && num == -1)
+		return eea_adminq_exec(enet, EEA_AQ_CMD_QUEUE_DESTROY_ALL,
+				       NULL, 0, NULL, 0);
+
+	size = sizeof(__le16) * num;
+	buf = dma_alloc_coherent(dev, size, &dma_addr, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
AFAICS all the callers of this function use num == -1 argument, why is
this other case needed? I guess it could land in a follow-up actually
using it.

Requiring memory allocation to perform cleanup operation is dangerous:
it may fail under memory pressure, making the memory pressure even worse.

You could instead pre-allocate the buffer at initialization time.

Otherwise LGTM,

Thanks,

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help