[v3,26/37] vdpa/ifc: replace use of RTE_LOGTYPE_PMD

Message ID 20231213163820.894987-27-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Replace uso of RTE_LOGTYPE_PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Dec. 13, 2023, 4:36 p.m. UTC
  This driver is using RTE_LOGTYPE_PMD, fix to have a dynamic
type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/vdpa/ifc/base/ifcvf.c       | 14 +++++++-------
 drivers/vdpa/ifc/base/ifcvf_osdep.h |  9 +++++++--
 2 files changed, 14 insertions(+), 9 deletions(-)
  

Patch

diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
index 53e982a52e9d..d8c1595cdb02 100644
--- a/drivers/vdpa/ifc/base/ifcvf.c
+++ b/drivers/vdpa/ifc/base/ifcvf.c
@@ -224,11 +224,10 @@  ifcvf_enable_mq(struct ifcvf_hw *hw)
 	if (mq_cfg) {
 		if (hw->device_type == IFCVF_BLK) {
 			*(u32 *)mq_cfg = nr_queue;
-			RTE_LOG(INFO, PMD, "%d queues are enabled\n", nr_queue);
+			IFCVF_LOG(INFO, "%d queues are enabled", nr_queue);
 		} else {
 			*(u32 *)mq_cfg = nr_queue / 2;
-			RTE_LOG(INFO, PMD, "%d queue pairs are enabled\n",
-				nr_queue / 2);
+			IFCVF_LOG(INFO, "%d queue pairs are enabled", nr_queue / 2);
 		}
 	}
 }
@@ -246,7 +245,7 @@  ifcvf_enable_vring_hw(struct ifcvf_hw *hw, int i)
 
 	cfg = hw->common_cfg;
 	if (!cfg) {
-		RTE_LOG(ERR, PMD, "common_cfg in HW is NULL.\n");
+		IFCVF_LOG(ERR, "common_cfg in HW is NULL.");
 		return -1;
 	}
 
@@ -258,8 +257,7 @@  ifcvf_enable_vring_hw(struct ifcvf_hw *hw, int i)
 		IFCVF_WRITE_REG16(i + 1, &cfg->queue_msix_vector);
 		msix_vector = IFCVF_READ_REG16(&cfg->queue_msix_vector);
 		if (msix_vector == IFCVF_MSI_NO_VECTOR) {
-			RTE_LOG(ERR, PMD, "queue %d, msix vec alloc failed\n",
-				i);
+			IFCVF_LOG(ERR, "queue %d, msix vec alloc failed", i);
 			return -1;
 		}
 	}
@@ -307,7 +305,7 @@  ifcvf_disable_vring_hw(struct ifcvf_hw *hw, int i)
 
 	cfg = hw->common_cfg;
 	if (!cfg) {
-		RTE_LOG(ERR, PMD, "common_cfg in HW is NULL.\n");
+		IFCVF_LOG(ERR, "common_cfg in HW is NULL.");
 		return;
 	}
 
@@ -531,3 +529,5 @@  ifcvf_get_queue_notify_off(struct ifcvf_hw *hw, int qid)
 	return (u8 *)hw->notify_addr[qid] -
 		(u8 *)hw->mem_resource[hw->notify_region].addr;
 }
+
+RTE_LOG_REGISTER_DEFAULT(ifcvf_logtype, INFO);
diff --git a/drivers/vdpa/ifc/base/ifcvf_osdep.h b/drivers/vdpa/ifc/base/ifcvf_osdep.h
index dd2ff08f77cc..7100a8b968a4 100644
--- a/drivers/vdpa/ifc/base/ifcvf_osdep.h
+++ b/drivers/vdpa/ifc/base/ifcvf_osdep.h
@@ -13,8 +13,13 @@ 
 #include <rte_log.h>
 #include <rte_io.h>
 
-#define WARNINGOUT(S, args...)  RTE_LOG(WARNING, PMD, S, ##args)
-#define DEBUGOUT(S, args...)    RTE_LOG(DEBUG, PMD, S, ##args)
+extern int ifcvf_logtype;
+
+#define IFCVF_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, ifcvf_logtype, fmt "\n", ## args)
+
+#define WARNINGOUT(S, args...)  IFCVF_LOG(WARNING, S, ##args)
+#define DEBUGOUT(S, args...)    IFCVF_LOG(DEBUG, S, ##args)
 #define STATIC                  static
 
 #define msec_delay(x)	rte_delay_us_sleep(1000 * (x))