Skip to contentSkip to conversation

enic: replace use of printf with log

PATCH Applied Stephen Hemminger 4 participants 5 messages Feb 14, 2015 – Feb 24, 2015 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 enic: replace use of printf with log

Device driver should log via DPDK log, not to printf which is sends to /dev/null in a daemon application.

---
 lib/librte_pmd_enic/enic_compat.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/librte_pmd_enic/enic_compat.h +7 -4
index b1af838..c3ab76e 100644
@@ -75,10 +75,13 @@
 #define kzalloc(size, flags) calloc(1, size)
 #define kfree(x) free(x)
 
-#define dev_err(x, args...) printf("rte_enic_pmd : Error - " args)
-#define dev_info(x, args...) printf("rte_enic_pmd: Info - " args)
-#define dev_warning(x, args...) printf("rte_enic_pmd: Warning - " args)
-#define dev_trace(x, args...) printf("rte_enic_pmd: Trace - " args)
+#define dev_printk(level, fmt, args...)	\
+	RTE_LOG(level, PMD, "rte_enic_pmd:" fmt, ## args)
+
+#define dev_err(x, args...) dev_printk(ERR, args)
+#define dev_info(x, args...) dev_printk(INFO,  args)
+#define dev_warning(x, args...) dev_printk(WARNING, args)
+#define dev_debug(x, args...) dev_printk(DEBUG, args)
 
 #define __le16 u16
 #define __le32 u32
Signature · 1 line
2.1.4

A message that is not in the archive (sent off-list or not yet received): 1423927979-13607-1-git-send-email-shemming-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org

#2 lore raw

PATCH 2/2 enic: change probe log message level

Drivers should be silent on boot.

---
 lib/librte_pmd_enic/enic_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_pmd_enic/enic_main.c +1 -1
index 48fdca2..c66f139 100644
@@ -1046,7 +1046,7 @@ int enic_probe(struct enic *enic)
 	struct rte_pci_device *pdev = enic->pdev;
 	int err = -1;
 
-	dev_info(enic, " Initializing ENIC PMD version %s\n", DRV_VERSION);
+	dev_debug(enic, " Initializing ENIC PMD version %s\n", DRV_VERSION);
 
 	enic->bar0.vaddr = (void *)pdev->mem_resource[0].addr;
 	enic->bar0.len = pdev->mem_resource[0].len;
Signature · 1 line
2.1.4
Acked-by
#3 lore raw
In reply to a message not in the archive
Quoted 34 lines · Stephen Hemminger

Device driver should log via DPDK log, not to printf which is sends to /dev/null in a daemon application.

---
 lib/librte_pmd_enic/enic_compat.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/librte_pmd_enic/enic_compat.h +7 -4
index b1af838..c3ab76e 100644
@@ -75,10 +75,13 @@
 #define kzalloc(size, flags) calloc(1, size)
 #define kfree(x) free(x)
 
-#define dev_err(x, args...) printf("rte_enic_pmd : Error - " args)
-#define dev_info(x, args...) printf("rte_enic_pmd: Info - " args)
-#define dev_warning(x, args...) printf("rte_enic_pmd: Warning - " args)
-#define dev_trace(x, args...) printf("rte_enic_pmd: Trace - " args)
+#define dev_printk(level, fmt, args...)	\
+	RTE_LOG(level, PMD, "rte_enic_pmd:" fmt, ## args)
+
+#define dev_err(x, args...) dev_printk(ERR, args)
+#define dev_info(x, args...) dev_printk(INFO,  args)
+#define dev_warning(x, args...) dev_printk(WARNING, args)
+#define dev_debug(x, args...) dev_printk(DEBUG, args)
 
 #define __le16 u16
 #define __le32 u32
Signature · 1 line
2.1.4

Series

A message that is not in the archive (sent off-list or not yet received): 20150214162822.GA14643-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org

#5 lore raw
Quoted 30 lines · Neil Horman

Review

Quoted 9 lines · Stephen Hemminger

Device driver should log via DPDK log, not to printf which is sends to /dev/null in a daemon application.

---
 lib/librte_pmd_enic/enic_compat.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/lib/librte_pmd_enic/enic_compat.h

Quoted 19 lines

index b1af838..c3ab76e 100644

lib/librte_pmd_enic/enic_compat.h +7 -4
@@ -75,10 +75,13 @@
 #define kzalloc(size, flags) calloc(1, size)
 #define kfree(x) free(x)
 
-#define dev_err(x, args...) printf("rte_enic_pmd : Error - " args)
-#define dev_info(x, args...) printf("rte_enic_pmd: Info - " args)
-#define dev_warning(x, args...) printf("rte_enic_pmd: Warning - " args)
-#define dev_trace(x, args...) printf("rte_enic_pmd: Trace - " args)
+#define dev_printk(level, fmt, args...)      \
+     RTE_LOG(level, PMD, "rte_enic_pmd:" fmt, ## args)
+
+#define dev_err(x, args...) dev_printk(ERR, args)
+#define dev_info(x, args...) dev_printk(INFO,  args)
+#define dev_warning(x, args...) dev_printk(WARNING, args)
+#define dev_debug(x, args...) dev_printk(DEBUG, args)
 
Quoted 9 lines
Quoted 6 lines
lib/librte_pmd_enic/enic_compat.h +0 -1
 #define __le16 u16
 #define __le32 u32
--

2.1.4

Series

Use of rte_log would be better for init messages, but since the driver makes no difference, this looks good enough to me.
Thanks Stephen.

Signature · 1 line
David Marchand

A message that is not in the archive (sent off-list or not yet received): CALwxeUti=ykMWDLA0X4jKRv9MTwv9tfbsBefhRRuj=QyYu-=NQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Device driver should log via DPDK log, not to printf which is sends to /dev/null in a daemon application.

Quoted 8 lines
Quoted 2 lines

Series

Use of rte_log would be better for init messages, but since the driver makes no difference, this looks good enough to me.
Thanks Stephen.

Applied, thanks