Re: [dpdk-dev] [PATCH 32/39] eventdev: add routine to launch eventmode workers
flat view
From: Carrillo, Erik G <hidden>
Date: 2019-06-10 14:46:15
Hi Anoob, One other observation in-line:
-----Original Message----- From: Anoob Joseph <redacted> Sent: Monday, June 3, 2019 12:33 PM To: Jerin Jacob <redacted>; Rao, Nikhil <redacted>; Carrillo, Erik G [off-list ref]; Gujjar, Abhinandan S [off-list ref]; Richardson, Bruce [off-list ref]; De Lara Guarch, Pablo [off-list ref] Cc: Anoob Joseph <redacted>; Narayana Prasad [off-list ref]; dev@dpdk.org; Lukasz Bartosik [off-list ref]; Pavan Nikhilesh [off-list ref]; Hemant Agrawal [off-list ref]; Nipun Gupta [off-list ref]; Van Haaren, Harry [off-list ref]; Mattias Rönnblom [off-list ref]; Ma, Liang J [off-list ref] Subject: [PATCH 32/39] eventdev: add routine to launch eventmode workers With eventmode, workers could be drafted differently according to the capabilities of the underlying event device. The added function would receive an array of such workers and probes the eventmode properties to choose the worker. Signed-off-by: Anoob Joseph <redacted> Signed-off-by: Lukasz Bartosik <redacted> ---
<...Snipped...>
+
+void __rte_experimental
+rte_eventmode_helper_launch_worker(struct
rte_eventmode_helper_conf *mode_conf,
+ struct rte_eventmode_helper_app_worker_params
*app_wrkr,
+ uint8_t nb_wrkr_param)
+{
+ struct rte_eventmode_helper_app_worker_params *match_wrkr;
+ uint32_t lcore_id;
+ struct eventmode_conf *em_conf;
+
+ if (mode_conf == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid conf");
+ return;
+ }
+
+ if (mode_conf->mode_params == NULL) {
+ RTE_EM_HLPR_LOG_ERR("Invalid mode params");
+ return;
+ }
+
+ /* Get eventmode conf */
+ em_conf = (struct eventmode_conf *)(mode_conf->mode_params);
+
+ /* Get core ID */
+ lcore_id = rte_lcore_id();
+
+ /* TODO check capability for rx core */
+
+ /* Check if this is rx core */
+ if (em_conf->eth_core_mask & (1 << lcore_id)) {In the above, eth_core_mask is a uint32_t, but RTE_MAX_LCORE=128 in the common config.
+ rte_eventmode_helper_start_worker_eth_core(em_conf,
lcore_id);
+ return;
+ }
+
+ if (app_wrkr == NULL || nb_wrkr_param == 0) {
+ RTE_EM_HLPR_LOG_ERR("Invalid args");
+ return;
+ }
+
+ /*
+ * This is a regular worker thread. The application would be
+ * registering multiple workers with various capabilities. The
+ * worker to be run will be selected by the capabilities of the
+ * event device configured.
+ */
+
+ /* Get the first matching worker for the event device */
+ match_wrkr = rte_eventmode_helper_find_worker(lcore_id,
+ em_conf,
+ app_wrkr,
+ nb_wrkr_param);
+
+ if (match_wrkr == NULL) {
+ RTE_EM_HLPR_LOG_ERR(
+ "No matching worker registered for lcore %d",
lcore_id);
+ goto clean_and_exit;
+ }
+
+ /* Verify sanity of the matched worker */
+ if (rte_eventmode_helper_verify_match_worker(match_wrkr) != 1)
{
+ RTE_EM_HLPR_LOG_ERR("Error in validating the matched
worker");
+ goto clean_and_exit;
+ }
+
+ /* Launch the worker thread */
+ match_wrkr->worker_thread(mode_conf);
+
+clean_and_exit:
+
+ /* Flag eth_cores to stop, if started */
+ rte_eventmode_helper_stop_worker_eth_core();
+}<...Snipped...> Regards, Erik