Skip to contentSkip to conversation

raw/ifpga: replace printf calls with logging

PATCH Superseded Weijun Pan 3 participants 4 messages Apr 8 – Jun 9

lore
Share & tools
lore

Weijun Pan

author
#0 lore raw

PATCH v2 1/1 raw/ifpga: replace printf calls with logging

The ifpga rawdev driver uses printf() directly for runtime messages. DPDK drivers should use the logging framework instead of printing to standard output.

Replace the remaining direct printf() calls in ifpga_rawdev.c with the driver logging macros.

Resend as a standalone patch after the previous submission was accidentally sent together with an unrelated patch.

---
 drivers/raw/ifpga/ifpga_rawdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/raw/ifpga/ifpga_rawdev.c +3 -3
index 5b9b596435..e004e002b7 100644
@@ -434,7 +434,7 @@ static int set_surprise_link_check_aer(
 	uint32_t aer_new0, aer_new1;
 
 	if (!ifpga_rdev || !ifpga_rdev->rawdev) {
-		printf("\n device does not exist\n");
+		IFPGA_RAWDEV_PMD_ERR("device does not exist");
 		return -EFAULT;
 	}
 
@@ -491,7 +491,7 @@ static int set_surprise_link_check_aer(
 		if (fd != -1)
 			close(fd);
 
-		printf(">>>>>>Set AER %x,%x %x,%x\n",
+		IFPGA_RAWDEV_PMD_INFO(">>>>>>Set AER %x,%x %x,%x",
 			ifpga_rdev->aer_old[0], ifpga_rdev->aer_old[1],
 			aer_new0, aer_new1);
 
@@ -527,7 +527,7 @@ ifpga_rawdev_gsd_handle(__rte_unused void *param)
 		}
 
 		if (gsd_enable)
-			printf(">>>>>>Pls Shutdown APP\n");
+			IFPGA_RAWDEV_PMD_WARN(">>>>>>Pls Shutdown APP");
 
 		rte_delay_us(100 * MS);
 	}
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Weijun Pan

The ifpga rawdev driver uses printf() directly for runtime messages. DPDK drivers should use the logging framework instead of printing to standard output.

Replace the remaining direct printf() calls in ifpga_rawdev.c with the driver logging macros.

Resend as a standalone patch after the previous submission was accidentally sent together with an unrelated patch.

JFYI: details about resends or new versions are better put as a notes under the cutline "---", so they get stripped automatically by git when patch is applied.

Quoted 3 lines

---

Agree that these should be properly logged. Only question is the log level for each. One question inline below about that.

Quoted 17 lines
 drivers/raw/ifpga/ifpga_rawdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 5b9b596435..e004e002b7 100644
@@ -434,7 +434,7 @@ static int set_surprise_link_check_aer(
 	uint32_t aer_new0, aer_new1;
 
 	if (!ifpga_rdev || !ifpga_rdev->rawdev) {
-		printf("\n device does not exist\n");
+		IFPGA_RAWDEV_PMD_ERR("device does not exist");
 		return -EFAULT;
 	}
 

drivers/raw/ifpga/ifpga_rawdev.c static int set_surprise_link_check_aer( · line 497

Quoted 8 lines
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
@@ -491,7 +491,7 @@ static int set_surprise_link_check_aer(
 		if (fd != -1)
 			close(fd);
 
-		printf(">>>>>>Set AER %x,%x %x,%x\n",
+		IFPGA_RAWDEV_PMD_INFO(">>>>>>Set AER %x,%x %x,%x",
 			ifpga_rdev->aer_old[0], ifpga_rdev->aer_old[1],
 			aer_new0, aer_new1);
 

I wonder if this needs to be an info message. Might it be better as a debug level one?

Quoted 12 lines
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
@@ -527,7 +527,7 @@ ifpga_rawdev_gsd_handle(__rte_unused void *param)
 		}
 
 		if (gsd_enable)
-			printf(">>>>>>Pls Shutdown APP\n");
+			IFPGA_RAWDEV_PMD_WARN(">>>>>>Pls Shutdown APP");
 
 		rte_delay_us(100 * MS);
 	}
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v3 1/1 raw/ifpga: replace printf calls with logging

In reply to Weijun Pan

The ifpga rawdev driver uses printf() directly for runtime messages. DPDK drivers should use the logging framework instead of printing to standard output.

Replace the remaining direct printf() calls in ifpga_rawdev.c with the driver logging macros.

---
v3:
- change AER register-value log from INFO to DEBUG

---
 drivers/raw/ifpga/ifpga_rawdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/raw/ifpga/ifpga_rawdev.c +3 -3
index 5b9b596435..c6a1b193f7 100644
@@ -434,7 +434,7 @@ static int set_surprise_link_check_aer(
 	uint32_t aer_new0, aer_new1;
 
 	if (!ifpga_rdev || !ifpga_rdev->rawdev) {
-		printf("\n device does not exist\n");
+		IFPGA_RAWDEV_PMD_ERR("device does not exist");
 		return -EFAULT;
 	}
 
@@ -491,7 +491,7 @@ static int set_surprise_link_check_aer(
 		if (fd != -1)
 			close(fd);
 
-		printf(">>>>>>Set AER %x,%x %x,%x\n",
+		IFPGA_RAWDEV_PMD_DEBUG(">>>>>>Set AER %x,%x %x,%x",
 			ifpga_rdev->aer_old[0], ifpga_rdev->aer_old[1],
 			aer_new0, aer_new1);
 
@@ -527,7 +527,7 @@ ifpga_rawdev_gsd_handle(__rte_unused void *param)
 		}
 
 		if (gsd_enable)
-			printf(">>>>>>Pls Shutdown APP\n");
+			IFPGA_RAWDEV_PMD_WARN(">>>>>>Pls Shutdown APP");
 
 		rte_delay_us(100 * MS);
 	}
Signature · 1 line
2.34.1
#3 lore raw
Quoted 10 lines · Weijun Pan

The ifpga rawdev driver uses printf() directly for runtime messages. DPDK drivers should use the logging framework instead of printing to standard output.

Replace the remaining direct printf() calls in ifpga_rawdev.c with the driver logging macros.

Applied, thanks.

Signature · 1 line
David Marchand