Thread (24 messages) 24 messages, 3 authors, 2022-01-07

Re: [PATCH net-next v4 2/8] net/fungible: Add service module for Fungible drivers

From: Jakub Kicinski <kuba@kernel.org>
Date: 2022-01-05 01:47:47

On Mon,  3 Jan 2022 22:46:51 -0800 Dimitris Michailidis wrote:
Fungible cards have a number of different PCI functions and thus
different drivers, all of which use a common method to initialize and
interact with the device. This commit adds a library module that
collects these common mechanisms. They mainly deal with device
initialization, setting up and destroying queues, and operating an admin
queue. A subset of the FW interface is also included here.

Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
+/* Destroy a funq's component queues on the device. */
+int fun_destroy_queue(struct fun_queue *funq)
+{
+	struct fun_dev *fdev = funq->fdev;
+	int rc1, rc2 = 0, rc3;
+
+	rc1 = fun_destroy_sq(fdev, funq->sqid);
+	if (funq->rq_depth)
+		rc2 = fun_destroy_sq(fdev, funq->rqid);
+	rc3 = fun_destroy_cq(fdev, funq->cqid);
+
+	fun_free_irq(funq);
+
+	if (rc1)
+		return rc1;
+	return rc2 ? rc2 : rc3;
What's the caller going to do with that error code?
Destroy functions are best kept void.

Actually I don't see any callers of this function at all.
Please make sure to remove all dead code.
+}
+
+void fun_free_irq(struct fun_queue *funq)
+{
+	if (funq->irq_handler) {
+		unsigned int vector = funq_irq(funq);
+
+		synchronize_irq(vector);
free_irq() will synchronize, why is this needed?
+		free_irq(vector, funq->irq_data);
+		funq->irq_handler = NULL;
+		funq->irq_data = NULL;
+	}
+}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help