Skip to contentSkip to conversation

no longer use RTE_LOGTYPE_PMD

PATCH In review Stephen Hemminger 4 participants 18 messages Feb 26, 2019 – Feb 28, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover no longer use RTE_LOGTYPE_PMD

Almost all usages of RTE_LOGTYPE_PMD have been replaced by per driver log types in current version. This patch series fixes the few remaining stragglers to use local logging.

Stephen Hemminger (5):
eal: drop unused RTE_PROC_PRIMARY_OR macros crypto/virtio: use local log type
eventdev: use same log macro for all unsupported calls
eal: remove RTE_PMD_DEBUG_TRACE
sfc: don't use RTE_LOGTYPE_PMD

 drivers/crypto/virtio/virtio_logs.h     |  4 +-
 drivers/net/sfc/sfc.c                   |  4 +-
 lib/librte_eal/common/include/rte_dev.h | 56 +------------------------
 lib/librte_eventdev/rte_eventdev.c      |  4 +-
 4 files changed, 9 insertions(+), 59 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 eal: drop unused RTE_PROC_PRIMARY_OR macros

No usage in current DPDK code base.

---
 lib/librte_eal/common/include/rte_dev.h | 15 ---------------
 1 file changed, 15 deletions(-)
lib/librte_eal/common/include/rte_dev.h +0 -15
index a9724dc9181c..5e16a4f86b70 100644
@@ -76,21 +76,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
 #define RTE_PMD_DEBUG_TRACE(...) (void)0
 #endif
 
-/* Macros for checking for restricting functions to primary instance only */
-#define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-		return retval; \
-	} \
-} while (0)
-
-#define RTE_PROC_PRIMARY_OR_RET() do { \
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
-		RTE_PMD_DEBUG_TRACE("Cannot run in secondary processes\n"); \
-		return; \
-	} \
-} while (0)
-
 /* Macros to check for invalid function pointers */
 #define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
 	if ((func) == NULL) { \
Signature · 1 line
2.17.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] eal: drop unused RTE_PROC_PRIMARY_OR macros

Reviewed-by Rami Rosen <ramirose at gmail.com>
#3 lore raw

PATCH 2/5 crypto/virtio: use local log type

In reply to Stephen Hemminger

The virtio crypto driver was using PMD log type and it should be using the local log type.

Fixes 25500d4b8076 ("crypto/virtio: support device init")
---
 drivers/crypto/virtio/virtio_logs.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/virtio/virtio_logs.h +3 -1
index 26a286cf81ec..1ee3819309f7 100644
@@ -7,8 +7,10 @@
 
 #include <rte_log.h>
 
+extern int virtio_crypto_logtype_init;
+
 #define PMD_INIT_LOG(level, fmt, args...) \
-	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \
+	rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_init, \
 		"PMD: %s(): " fmt "\n", __func__, ##args)
 
 #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
Signature · 1 line
2.17.1
#4 lore raw

PATCH 3/5 eventdev: use same log macro for all unsupported calls

In reply to Stephen Hemminger

The driver already hase RTE_EDEV_XXX log macros so use them in two more places.

---
 lib/librte_eventdev/rte_eventdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_eventdev/rte_eventdev.c +2 -2
index ebaf3087d925..4d4f07919554 100644
@@ -892,7 +892,7 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	dev = &rte_eventdevs[dev_id];
 
 	if (*dev->dev_ops->port_link == NULL) {
-		RTE_PMD_DEBUG_TRACE("Function not supported\n");
+		RTE_EDEV_LOG_ERR("Function not supported\n");
 		rte_errno = -ENOTSUP;
 		return 0;
 	}
@@ -951,7 +951,7 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 	dev = &rte_eventdevs[dev_id];
 
 	if (*dev->dev_ops->port_unlink == NULL) {
-		RTE_PMD_DEBUG_TRACE("Function not supported\n");
+		RTE_EDEV_LOG_ERR("Function not supported");
 		rte_errno = -ENOTSUP;
 		return 0;
 	}
Signature · 1 line
2.17.1
#5 lore raw

PATCH 4/5 eal: remove RTE_PMD_DEBUG_TRACE

In reply to Stephen Hemminger

The RTE_PMD_DEBUG_TRACE was only enabled for EVENTDEV_DEBUG and that configuration is now handled by RTE_EDEV_LOG macros.

---
 lib/librte_eal/common/include/rte_dev.h | 41 ++-----------------------
 1 file changed, 2 insertions(+), 39 deletions(-)
lib/librte_eal/common/include/rte_dev.h +2 -39
index 5e16a4f86b70..3cad4bce57bf 100644
@@ -43,52 +43,15 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
 
-__attribute__((format(printf, 2, 0)))
-static inline void
-rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-
-	{
-		char buffer[vsnprintf(NULL, 0, fmt, ap) + 1];
-
-		va_end(ap);
-
-		va_start(ap, fmt);
-		vsnprintf(buffer, sizeof(buffer), fmt, ap);
-		va_end(ap);
-
-		rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s",
-			func_name, buffer);
-	}
-}
-
-/*
- * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the
- * RTE_*_RET() macros defined below is compiled in debug mode.
- */
-#if defined(RTE_LIBRTE_EVENTDEV_DEBUG)
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...) (void)0
-#endif
-
 /* Macros to check for invalid function pointers */
 #define RTE_FUNC_PTR_OR_ERR_RET(func, retval) do { \
-	if ((func) == NULL) { \
-		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+	if ((func) == NULL) \
 		return retval; \
-	} \
 } while (0)
 
 #define RTE_FUNC_PTR_OR_RET(func) do { \
-	if ((func) == NULL) { \
-		RTE_PMD_DEBUG_TRACE("Function not supported\n"); \
+	if ((func) == NULL) \
 		return; \
-	} \
 } while (0)
 
 /**
Signature · 1 line
2.17.1
#6 lore raw

PATCH 5/5 sfc: don't use RTE_LOGTYPE_PMD

In reply to Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
 drivers/net/sfc/sfc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +2 -2
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
 		++lt_prefix_str_size; /* Reserve space for prefix separator */
 		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
 	} else {
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 	}
 
 	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
 	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
 	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
 	lt_str[lt_prefix_str_size - 1] = '.';
Signature · 1 line
2.17.1
#7 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
 drivers/net/sfc/sfc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
 		++lt_prefix_str_size; /* Reserve space for prefix separator */
 		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
 	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
 	}
 
 	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
 	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
 	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
 	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Andrew,

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Thanks,
ferruh

#8 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

Quoted 34 lines · Ferruh Yigit
Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
  drivers/net/sfc/sfc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
  		++lt_prefix_str_size; /* Reserve space for prefix separator */
  		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
  	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
  	}
 
  	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
  	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
  	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
  	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Quoted 7 lines

Andrew,

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Thanks,
ferruh

I'm OK to use  sfc_logtype_driverif dynamic log type register fails, but what should I do if sfc_logtype_driverregister fails?

Andrew.

#9 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

Quoted 37 lines · Andrew Rybchenko
Quoted 36 lines · Ferruh Yigit
Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
  drivers/net/sfc/sfc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
  		++lt_prefix_str_size; /* Reserve space for prefix separator */
  		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
  	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
  	}
 
  	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
  	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
  	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
  	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Andrew,

Quoted 8 lines
Quoted 5 lines

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Thanks,
ferruh

I'm OK to use  sfc_logtype_driverif dynamic log type register fails, but what should I do if sfc_logtype_driverregister fails?

Right. Same concern is valid for all dynamic log registration but we are ignoring it.

What do you think instead of each pmd/lib cover the error case, 'rte_log_register_type_and_pick_level()' & 'rte_log_register()' always return valid value. Like if they fail internally, return 'RTE_LOGTYPE_GENERIC' kind of value.

#10 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

Quoted 47 lines · Ferruh Yigit
Quoted 37 lines · Andrew Rybchenko
Quoted 36 lines · Ferruh Yigit
Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
  drivers/net/sfc/sfc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
  		++lt_prefix_str_size; /* Reserve space for prefix separator */
  		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
  	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
  	}
 
  	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
  	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
  	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
  	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Andrew,

Quoted 8 lines
Quoted 5 lines

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Thanks,
ferruh

I'm OK to use  sfc_logtype_driverif dynamic log type register fails, but what should I do if sfc_logtype_driverregister fails?

Quoted 7 lines

Right. Same concern is valid for all dynamic log registration but we are ignoring it.

What do you think instead of each pmd/lib cover the error case, 'rte_log_register_type_and_pick_level()' & 'rte_log_register()' always return valid value. Like if they fail internally, return 'RTE_LOGTYPE_GENERIC' kind of value.

Changing the log functions is one above step, are you OK to replace all occurrence of 'RTE_LOGTYPE_PMD' with 'sfc_logtype_driver' in 'sfc_register_logtype()', there is one more occurrence than this patch updates.

I see your point to keep the one in 'sfc_driver_register_logtype()', perhaps we can address it later separately with above suggestion or something else.

#11 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

Quoted 46 lines · Ferruh Yigit
Quoted 45 lines · Ferruh Yigit
Quoted 44 lines · Andrew Rybchenko
Quoted 34 lines · Ferruh Yigit
Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
   drivers/net/sfc/sfc.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
   		++lt_prefix_str_size; /* Reserve space for prefix separator */
   		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
   	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
   	}
 
   	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
   	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
   	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
   	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Quoted 7 lines

Andrew,

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Thanks,
ferruh

I'm OK to use  sfc_logtype_driverif dynamic log type register fails, but what should I do if sfc_logtype_driverregister fails?

Quoted 7 lines
Quoted 7 lines

Right. Same concern is valid for all dynamic log registration but we are ignoring it.

What do you think instead of each pmd/lib cover the error case, 'rte_log_register_type_and_pick_level()' & 'rte_log_register()' always return valid value. Like if they fail internally, return 'RTE_LOGTYPE_GENERIC' kind of value.

Above makes sense.

Quoted 3 lines

Changing the log functions is one above step, are you OK to replace all occurrence of 'RTE_LOGTYPE_PMD' with 'sfc_logtype_driver' in 'sfc_register_logtype()', there is one more occurrence than this patch updates.

Yes

Quoted 2 lines

I see your point to keep the one in 'sfc_driver_register_logtype()', perhaps we can address it later separately with above suggestion or something else.

OK.

Thanks,
Andrew.

#12 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

In reply to Andrew Rybchenko
Quoted 40 lines · On Wed, 27 Feb 2019 14:24:21 +0300 Andrew Rybchenko…
Quoted 39 lines · Ferruh Yigit
Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
  drivers/net/sfc/sfc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
  		++lt_prefix_str_size; /* Reserve space for prefix separator */
  		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
  	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
  	}
 
  	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
  	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
  	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
  	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Andrew,

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Quoted 7 lines
Quoted 2 lines

Thanks,
ferruh

I'm OK to use  sfc_logtype_driverif dynamic log type register fails, but what should I do if sfc_logtype_driverregister fails?

Andrew.

I don't like drivers that try to do something different than every other driver in DPDK. The solarflare driver is doing lots of extra effort to have multiple fine grain log types. Not sure if there is any value to this. In a real world situation for diagnosis you would want to turn on logs across everything in the driver, then filter as needed later.

#13 lore raw

Re: [PATCH 5/5] sfc: don't use RTE_LOGTYPE_PMD

Quoted 45 lines · Stephen Hemminger
Quoted 42 lines · On Wed, 27 Feb 2019 14:24:21 +0300 Andrew Rybchenko…
Quoted 41 lines · Ferruh Yigit
Quoted 18 lines · Stephen Hemminger

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
   drivers/net/sfc/sfc.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc.c +0 -1
index 898603884fa0..2cd7126015fd 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
   		++lt_prefix_str_size; /* Reserve space for prefix separator */
   		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
   	} else {
-		return RTE_LOGTYPE_PMD;

drivers/net/sfc/sfc.c sfc_register_logtype(const struct rte_pci_addr *pci_addr, · line 1126

Quoted 10 lines
drivers/net/sfc/sfc.c +2 -1
+		return sfc_logtype_driver;
   	}
 
   	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
   	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
   	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
   	lt_str[lt_prefix_str_size - 1] = '.';

Overall I think it is good idea to remove RTE_LOGTYPE_PMD, but sfc has a few more usage of it around same manner, as a fallback value if allocating dynamic one fails.

Andrew,

Can be possible to update this sfc patch to completely eliminate RTE_LOGTYPE_PMD usage? What do you think?

Thanks,
ferruh

Quoted 8 lines
Quoted 4 lines

I'm OK to use  sfc_logtype_driverif dynamic log type register fails, but what should I do if sfc_logtype_driverregister fails?

Andrew.

I don't like drivers that try to do something different than every other driver in DPDK. The solarflare driver is doing lots of extra effort to have multiple fine grain log types. Not sure if there is any value to this. In a real world situation for diagnosis you would want to turn on logs across everything in the driver, then filter as needed later.

We really use logging configuration facilities which we have in the driver and, thanks to dynamic logging design (IMO really good design), both your and our logging usage scenarios can coexist.

Andrew.

#14 lore raw

PATCH v2 1/1 net/sfc: do not use PMD logtype

In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>

The sfc driver was still using RTE_LOGTYPE_PMD which was superseded by local logging.

---
v2:
* Replaced all RTE_LOGTYPE_PMD instances in sfc_register_logtype()
* ternary replaced with if and multiple return because of the compiler error:
error: operand of ?: changes signedness from ‘int’ to ‘uint32_t’ {aka ‘unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]

---
 drivers/net/sfc/sfc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/sfc/sfc.c +6 -3
index 898603884..fd4156f78 100644
@@ -1115,12 +1115,12 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
 		++lt_prefix_str_size; /* Reserve space for prefix separator */
 		lt_str_size_max = lt_prefix_str_size + PCI_PRI_STR_SIZE + 1;
 	} else {
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 	}
 
 	lt_str = rte_zmalloc("logtype_str", lt_str_size_max, 0);
 	if (lt_str == NULL)
-		return RTE_LOGTYPE_PMD;
+		return sfc_logtype_driver;
 
 	strncpy(lt_str, lt_prefix_str, lt_prefix_str_size);
 	lt_str[lt_prefix_str_size - 1] = '.';
@@ -1131,5 +1131,8 @@ sfc_register_logtype(const struct rte_pci_addr *pci_addr,
 	ret = rte_log_register_type_and_pick_level(lt_str, ll_default);
 	rte_free(lt_str);
 
-	return (ret < 0) ? RTE_LOGTYPE_PMD : ret;
+	if (ret < 0)
+		return sfc_logtype_driver;
+
+	return ret;
 }
Signature · 1 line
2.20.1
Reviewed-by on the v1 series
#16 lore raw
In reply to Stephen Hemminger
Quoted 10 lines · Stephen Hemminger

Almost all usages of RTE_LOGTYPE_PMD have been replaced by per driver log types in current version. This patch series fixes the few remaining stragglers to use local logging.

Stephen Hemminger (5):
eal: drop unused RTE_PROC_PRIMARY_OR macros crypto/virtio: use local log type
eventdev: use same log macro for all unsupported calls
eal: remove RTE_PMD_DEBUG_TRACE
sfc: don't use RTE_LOGTYPE_PMD

For series,

(except 5/5 which has v2)

#17 lore raw
Quoted 12 lines · Ferruh Yigit
Quoted 10 lines · Stephen Hemminger

Almost all usages of RTE_LOGTYPE_PMD have been replaced by per driver log types in current version. This patch series fixes the few remaining stragglers to use local logging.

Stephen Hemminger (5):
eal: drop unused RTE_PROC_PRIMARY_OR macros crypto/virtio: use local log type
eventdev: use same log macro for all unsupported calls
eal: remove RTE_PMD_DEBUG_TRACE
sfc: don't use RTE_LOGTYPE_PMD

Quoted 5 lines

For series,

(except 5/5 which has v2)

Series applied to dpdk-next-net/master, thanks.