Thread (8 messages) 8 messages, 2 authors, 2026-01-27

Re: [PATCH net-next v22 4/6] eea: create/destroy rx,tx queues for netdevice open and stop

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-01-27 04:44:44

On Thu, 22 Jan 2026 20:05:06 +0800 Xuan Zhuo wrote:
+int eea_reset_hw_resources(struct eea_net *enet, struct eea_net_init_ctx *ctx)
+{
+	int err;
+
+	if (!netif_running(enet->netdev)) {
+		enet->cfg = ctx->cfg;
+		return 0;
+	}
+
+	err = eea_alloc_rxtx_q_mem(ctx);
+	if (err) {
+		netdev_warn(enet->netdev,
+			    "eea reset: alloc q failed. stop reset. err %d\n",
+			    err);
+		return err;
+	}
+
+	eea_netdev_stop(enet->netdev);
[1]
+	enet_bind_new_q_and_cfg(enet, ctx);
+
+	err = eea_active_ring_and_irq(enet);
+	if (err) {
+		/* Although the notification to hardware or the initial IRQ
+		 * setup has failed (which is, of course, a very low-probability
+		 * event), we do not immediately free the queues resources here.
+		 * Instead, we defer their release until the normal NIC cleanup,
+		 * or until the user or hardware triggers a reset operation.
+		 * Because that the dev is running.
+		 */
+		netdev_err(enet->netdev,
+			   "eea reset: active new ring and irq failed. err %d\n",
+			   err);
+		return err;
+	}
+
+	err = eea_start_rxtx(enet->netdev);
+	if (err)
+		netdev_err(enet->netdev,
+			   "eea reset: start queue failed. err %d\n", err);
This looks questionable, eea_start_rxtx() can only fail if
netif_set_real_num_queues() failed, which in turn may fail 
for sysfs-related reasons. So we're not talking about "rare
HW fail" scenarios in this case. Memory pressure or name collision
would be enough. Seems like this is easy to address. 
Move netif_set_real_num_queues() out of eea_start_rxtx().
This way eea_start_rxtx() can start returning void (can't fail).
In this function you can move the netif_set_real_num_queues()
call where I placed the [1] marker, before any changes were
actually made to the adapter.

Looking closer eea_active_ring_and_irq() is also calling kernel
registration functions which may fail, like request_irq().
You should do all of that before you actually shut down the adapter.
+	return err;
+}
-- 
pw-bot: cr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help