From: Chengwen Feng <fengcheng...@huawei.com>

This patch supports set notify and vring relay thread name which is
helpful for debugging.

Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
Signed-off-by: Min Hu (Connor) <humi...@huawei.com>
---
 drivers/vdpa/ifc/ifcvf_vdpa.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 39237ae..8a5efa9 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -37,6 +37,8 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, 
NOTICE);
 #define IFCVF_VDPA_MODE                "vdpa"
 #define IFCVF_SW_FALLBACK_LM   "sw-live-migration"
 
+#define THREAD_NAME_LEN        16
+
 static const char * const ifcvf_valid_arguments[] = {
        IFCVF_VDPA_MODE,
        IFCVF_SW_FALLBACK_LM,
@@ -494,6 +496,7 @@ notify_relay(void *arg)
 static int
 setup_notify_relay(struct ifcvf_internal *internal)
 {
+       char name[THREAD_NAME_LEN];
        int ret;
 
        ret = pthread_create(&internal->tid, NULL, notify_relay,
@@ -502,6 +505,10 @@ setup_notify_relay(struct ifcvf_internal *internal)
                DRV_LOG(ERR, "failed to create notify relay pthread.");
                return -1;
        }
+
+       snprintf(name, sizeof(name), "ifc-notify-%d", internal->vid);
+       rte_thread_setname(internal->tid, name);
+
        return 0;
 }
 
@@ -797,6 +804,7 @@ vring_relay(void *arg)
 static int
 setup_vring_relay(struct ifcvf_internal *internal)
 {
+       char name[THREAD_NAME_LEN];
        int ret;
 
        ret = pthread_create(&internal->tid, NULL, vring_relay,
@@ -805,6 +813,10 @@ setup_vring_relay(struct ifcvf_internal *internal)
                DRV_LOG(ERR, "failed to create ring relay pthread.");
                return -1;
        }
+
+       snprintf(name, sizeof(name), "ifc-vring-%d", internal->vid);
+       rte_thread_setname(internal->tid, name);
+
        return 0;
 }
 
-- 
2.7.4

Reply via email to