X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fip_pipeline%2Finit.c;h=be148fcabe6a566840c8be4ec9c21f115a40d489;hb=7236d2bfe0acc48330e3c2a3dfac4ada9a792cd8;hp=4fed47420f0c58885da59fc1786df2b6097ed115;hpb=3f2c9f3bb6c642f302ff6459f5a8a9e23a2f954b;p=dpdk.git diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 4fed47420f..be148fcabe 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -35,8 +35,10 @@ #include #include #include +#ifdef RTE_EXEC_ENV_LINUXAPP #include #include +#endif #include #include #include @@ -67,7 +69,8 @@ static void app_init_core_map(struct app_params *app) { APP_LOG(app, HIGH, "Initializing CPU core map ..."); - app->core_map = cpu_core_map_init(4, 32, 4, 0); + app->core_map = cpu_core_map_init(RTE_MAX_NUMA_NODES, RTE_MAX_LCORE, + 4, 0); if (app->core_map == NULL) rte_panic("Cannot create CPU core map\n"); @@ -76,11 +79,14 @@ app_init_core_map(struct app_params *app) cpu_core_map_print(app->core_map); } +/* Core Mask String in Hex Representation */ +#define APP_CORE_MASK_STRING_SIZE ((64 * APP_CORE_MASK_SIZE) / 8 * 2 + 1) + static void app_init_core_mask(struct app_params *app) { - uint64_t mask = 0; uint32_t i; + char core_mask_str[APP_CORE_MASK_STRING_SIZE]; for (i = 0; i < app->n_pipelines; i++) { struct app_pipeline_params *p = &app->pipeline_params[i]; @@ -94,17 +100,18 @@ app_init_core_mask(struct app_params *app) if (lcore_id < 0) rte_panic("Cannot create CPU core mask\n"); - mask |= 1LLU << lcore_id; + app_core_enable_in_core_mask(app, lcore_id); } - app->core_mask = mask; - APP_LOG(app, HIGH, "CPU core mask = 0x%016" PRIx64, app->core_mask); + app_core_build_core_mask_string(app, core_mask_str); + APP_LOG(app, HIGH, "CPU core mask = 0x%s", core_mask_str); } static void app_init_eal(struct app_params *app) { char buffer[256]; + char core_mask_str[APP_CORE_MASK_STRING_SIZE]; struct app_eal_params *p = &app->eal_params; uint32_t n_args = 0; uint32_t i; @@ -112,7 +119,8 @@ app_init_eal(struct app_params *app) app->eal_argv[n_args++] = strdup(app->app_name); - snprintf(buffer, sizeof(buffer), "-c%" PRIx64, app->core_mask); + app_core_build_core_mask_string(app, core_mask_str); + snprintf(buffer, sizeof(buffer), "-c%s", core_mask_str); app->eal_argv[n_args++] = strdup(buffer); if (p->coremap) { @@ -322,16 +330,14 @@ app_init_mempool(struct app_params *app) struct app_mempool_params *p = &app->mempool_params[i]; APP_LOG(app, HIGH, "Initializing %s ...", p->name); - app->mempool[i] = rte_mempool_create( - p->name, - p->pool_size, - p->buffer_size, - p->cache_size, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - p->cpu_socket_id, - 0); + app->mempool[i] = rte_pktmbuf_pool_create( + p->name, + p->pool_size, + p->cache_size, + 0, /* priv_size */ + p->buffer_size - + sizeof(struct rte_mbuf), /* mbuf data size */ + p->cpu_socket_id); if (app->mempool[i] == NULL) rte_panic("%s init error\n", p->name); @@ -711,7 +717,8 @@ app_link_up_internal(struct app_params *app, struct app_link_params *cp) /* PMD link up */ status = rte_eth_dev_set_link_up(cp->pmd_id); - if (status < 0) + /* Do not panic if PMD does not provide link up functionality */ + if (status < 0 && status != -ENOTSUP) rte_panic("%s (%" PRIu32 "): PMD set link up error %" PRId32 "\n", cp->name, cp->pmd_id, status); @@ -727,7 +734,8 @@ app_link_down_internal(struct app_params *app, struct app_link_params *cp) /* PMD link down */ status = rte_eth_dev_set_link_down(cp->pmd_id); - if (status < 0) + /* Do not panic if PMD does not provide link down functionality */ + if (status < 0 && status != -ENOTSUP) rte_panic("%s (%" PRIu32 "): PMD set link down error %" PRId32 "\n", cp->name, cp->pmd_id, status); @@ -1160,6 +1168,15 @@ app_init_tm(struct app_params *app) } } +#ifndef RTE_EXEC_ENV_LINUXAPP +static void +app_init_tap(struct app_params *app) { + if (app->n_pktq_tap == 0) + return; + + rte_panic("TAP device not supported.\n"); +} +#else static void app_init_tap(struct app_params *app) { @@ -1187,6 +1204,7 @@ app_init_tap(struct app_params *app) app->tap[i] = fd; } } +#endif #ifdef RTE_LIBRTE_KNI static int @@ -1404,6 +1422,7 @@ void app_pipeline_params_get(struct app_params *app, out->burst_size = app->tm_params[in->id].burst_read; break; } +#ifdef RTE_EXEC_ENV_LINUXAPP case APP_PKTQ_IN_TAP: { struct app_pktq_tap_params *tap_params = @@ -1420,6 +1439,7 @@ void app_pipeline_params_get(struct app_params *app, out->burst_size = app->tap_params[in->id].burst_read; break; } +#endif #ifdef RTE_LIBRTE_KNI case APP_PKTQ_IN_KNI: { @@ -1564,6 +1584,7 @@ void app_pipeline_params_get(struct app_params *app, app->tm_params[in->id].burst_write; break; } +#ifdef RTE_EXEC_ENV_LINUXAPP case APP_PKTQ_OUT_TAP: { struct rte_port_fd_writer_params *params = @@ -1575,6 +1596,7 @@ void app_pipeline_params_get(struct app_params *app, app->tap_params[in->id].burst_write; break; } +#endif #ifdef RTE_LIBRTE_KNI case APP_PKTQ_OUT_KNI: {