eal: set name when creating a control thread
[dpdk.git] / lib / librte_pdump / rte_pdump.c
index 29a6c99..0612632 100644 (file)
@@ -139,7 +139,7 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp)
 {
        struct rte_mbuf *m_dup, *seg, **prev;
        uint32_t pktlen;
-       uint8_t nseg;
+       uint16_t nseg;
 
        m_dup = rte_pktmbuf_alloc(mp);
        if (unlikely(m_dup == NULL))
@@ -353,7 +353,7 @@ set_pdump_rxtx_cbs(struct pdump_request *p)
                                &port);
                if (ret < 0) {
                        RTE_LOG(ERR, PDUMP,
-                               "failed to get potid for device id=%s\n",
+                               "failed to get port id for device id=%s\n",
                                p->data.en_v1.device);
                        return -EINVAL;
                }
@@ -365,7 +365,7 @@ set_pdump_rxtx_cbs(struct pdump_request *p)
                                &port);
                if (ret < 0) {
                        RTE_LOG(ERR, PDUMP,
-                               "failed to get potid for device id=%s\n",
+                               "failed to get port id for device id=%s\n",
                                p->data.dis_v1.device);
                        return -EINVAL;
                }
@@ -577,20 +577,15 @@ rte_pdump_init(const char *path)
        }
 
        /* create the host thread to wait/handle pdump requests */
-       ret = pthread_create(&pdump_thread, NULL, pdump_thread_main, NULL);
+       snprintf(thread_name, sizeof(thread_name), "pdump-thread");
+       ret = rte_ctrl_thread_create(&pdump_thread, thread_name, NULL,
+                               pdump_thread_main, NULL);
        if (ret != 0) {
                RTE_LOG(ERR, PDUMP,
                        "Failed to create the pdump thread:%s, %s:%d\n",
-                       strerror(errno), __func__, __LINE__);
+                       strerror(-ret), __func__, __LINE__);
                return -1;
        }
-       /* Set thread_name for aid in debugging. */
-       snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "pdump-thread");
-       ret = rte_thread_setname(pdump_thread, thread_name);
-       if (ret != 0) {
-               RTE_LOG(DEBUG, PDUMP,
-                       "Failed to set thread name for pdump handling\n");
-       }
 
        return 0;
 }
@@ -604,7 +599,7 @@ rte_pdump_uninit(void)
        if (ret != 0) {
                RTE_LOG(ERR, PDUMP,
                        "Failed to cancel the pdump thread:%s, %s:%d\n",
-                       strerror(errno), __func__, __LINE__);
+                       strerror(ret), __func__, __LINE__);
                return -1;
        }