examples/vhost_blk: refactor to increase readability
[dpdk.git] / examples / l2fwd-event / l2fwd_event_generic.c
index b7e467c..2dc95e5 100644 (file)
@@ -42,8 +42,10 @@ l2fwd_event_device_setup_generic(struct l2fwd_resources *rsrc)
 
        /* Event device configurtion */
        rte_event_dev_info_get(event_d_id, &dev_info);
-       evt_rsrc->disable_implicit_release = !!(dev_info.event_dev_cap &
-                                   RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE);
+
+       /* Enable implicit release */
+       if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE)
+               evt_rsrc->disable_implicit_release = 0;
 
        if (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES)
                event_queue_cfg |= RTE_EVENT_QUEUE_CFG_ALL_TYPES;
@@ -70,7 +72,8 @@ l2fwd_event_device_setup_generic(struct l2fwd_resources *rsrc)
                event_d_conf.nb_event_port_enqueue_depth =
                                dev_info.max_event_port_enqueue_depth;
 
-       num_workers = rte_lcore_count() - rte_service_lcore_count();
+       /* Ignore Master core and service cores. */
+       num_workers = rte_lcore_count() - 1 - rte_service_lcore_count();
        if (dev_info.max_event_ports < num_workers)
                num_workers = dev_info.max_event_ports;
 
@@ -109,7 +112,9 @@ l2fwd_event_port_setup_generic(struct l2fwd_resources *rsrc)
                rte_panic("No space is available\n");
 
        memset(&def_p_conf, 0, sizeof(struct rte_event_port_conf));
-       rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf);
+       ret = rte_event_port_default_conf_get(event_d_id, 0, &def_p_conf);
+       if (ret < 0)
+               rte_panic("Error to get default configuration of event port\n");
 
        if (def_p_conf.new_event_threshold < event_p_conf.new_event_threshold)
                event_p_conf.new_event_threshold =
@@ -170,7 +175,10 @@ l2fwd_event_queue_setup_generic(struct l2fwd_resources *rsrc,
        if (!evt_rsrc->evq.event_q_id)
                rte_panic("Memory allocation failure\n");
 
-       rte_event_queue_default_conf_get(event_d_id, 0, &def_q_conf);
+       ret = rte_event_queue_default_conf_get(event_d_id, 0, &def_q_conf);
+       if (ret < 0)
+               rte_panic("Error to get default config of event queue\n");
+
        if (def_q_conf.nb_atomic_flows < event_q_conf.nb_atomic_flows)
                event_q_conf.nb_atomic_flows = def_q_conf.nb_atomic_flows;