Thread (4 messages) 4 messages, 3 authors, 2025-02-13

Re: [PATCH] net: mana: Add debug logs in MANA network driver

From: Erni Sri Satya Vennela <hidden>
Date: 2025-02-13 07:31:09
Also in: linux-hyperv, lkml

On Tue, Feb 11, 2025 at 05:31:22PM +0100, Andrew Lunn wrote:
On Tue, Feb 11, 2025 at 01:51:55AM -0800, Erni Sri Satya Vennela wrote:
quoted
Add debug statements to assist in debugging and monitoring
driver behaviour, making it easier to identify potential
issues  during development and testing.

Signed-off-by: Erni Sri Satya Vennela <redacted>
---
 .../net/ethernet/microsoft/mana/gdma_main.c   | 52 +++++++++++++----
 .../net/ethernet/microsoft/mana/hw_channel.c  |  6 +-
 drivers/net/ethernet/microsoft/mana/mana_en.c | 58 +++++++++++++++----
 3 files changed, 94 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index be95336ce089..f9839938f0ab 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -666,8 +666,11 @@ int mana_gd_create_hwc_queue(struct gdma_dev *gd,
 
 	gmi = &queue->mem_info;
 	err = mana_gd_alloc_memory(gc, spec->queue_size, gmi);
-	if (err)
+	if (err) {
+		dev_err(gc->dev, "GDMA queue type: %d, size: %u, gdma memory allocation err: %d\n",
+			spec->type, spec->queue_size, err);
I would expect a debug statement to use dev_dbg(). Please update your
commit message.
I'll make sure to make this change in the next version of the patch.
quoted
 		goto free_q;
+	}
 
 	queue->head = 0;
 	queue->tail = 0;
@@ -688,6 +691,8 @@ int mana_gd_create_hwc_queue(struct gdma_dev *gd,
 	*queue_ptr = queue;
 	return 0;
 out:
+	dev_err(gc->dev, "Failed to create queue type %d of size %u, err: %d\n",
+		spec->type, spec->queue_size, err);
 	mana_gd_free_memory(gmi);
 free_q:
 	kfree(queue);
@@ -763,14 +768,18 @@ static int mana_gd_create_dma_region(struct gdma_dev *gd,
 
 	if (resp.hdr.status ||
 	    resp.dma_region_handle == GDMA_INVALID_DMA_REGION) {
-		dev_err(gc->dev, "Failed to create DMA region: 0x%x\n",
-			resp.hdr.status);
 		err = -EPROTO;
 		goto out;
 	}
 
 	gmi->dma_region_handle = resp.dma_region_handle;
+	dev_dbg(gc->dev, "Created DMA region handle 0x%llx\n",
+		gmi->dma_region_handle);
Given all the dev_err() you have added, do this add any value? Is
there a way out of this function which is not a success and does not
print an error?
I wanted to provide more detailed information using dev_err and dev_dbg.
In the next version, I will retain the dev_err in the if condition as it
is, and change the dev_err to dev_dbg in the "out:" label to ensure that
most of the information gets logged.
    Andrew

---
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