event/dpaa2: improve error handling and logs
authorNipun Gupta <nipun.gupta@nxp.com>
Mon, 23 Oct 2017 12:37:06 +0000 (18:07 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Wed, 25 Oct 2017 12:03:43 +0000 (14:03 +0200)
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/event/dpaa2/dpaa2_eventdev.c
drivers/event/dpaa2/dpaa2_hw_dpcon.c

index ee3a164..d1be5de 100644 (file)
@@ -140,11 +140,20 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[],
                         */
                        struct rte_event *ev_temp = rte_malloc(NULL,
                                sizeof(struct rte_event), 0);
+
+                       if (!ev_temp) {
+                               if (!loop)
+                                       return num_tx;
+                               frames_to_send = loop;
+                               PMD_DRV_LOG(ERR, "Unable to allocate memory");
+                               goto send_partial;
+                       }
                        rte_memcpy(ev_temp, event, sizeof(struct rte_event));
                        DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp);
                        DPAA2_SET_FD_LEN((&fd_arr[loop]),
                                         sizeof(struct rte_event));
                }
+send_partial:
                loop = 0;
                while (loop < frames_to_send) {
                        loop += qbman_swp_enqueue_multiple_desc(swp,
index 2c416b5..005e623 100644 (file)
@@ -100,7 +100,7 @@ rte_dpaa2_create_dpcon_device(int dev_fd __rte_unused,
 
        TAILQ_INSERT_TAIL(&dpcon_dev_list, dpcon_node, next);
 
-       PMD_DRV_LOG(DEBUG, "DPAA2: Added [dpcon.%d]", dpcon_id);
+       RTE_LOG(DEBUG, PMD, "DPAA2: Added [dpcon.%d]\n", dpcon_id);
 
        return 0;
 }