Example #1
0
/*****************************************************************************
 * mem_handle_cmdline_opt()
 * --tcb-pool-sz configuration - size in K (*1024) of the tcb mempool
 *      default: GCFG_TCB_POOL_SIZE
 * --ucb-pool-sz configuration - size in K (*1024) of the ucb mempool
 *      default: GCFG_UCB_POOL_SIZE
 * --mbuf-pool-sz configuration - size in K (*1024) of the mbuf mempool
 *      default: GCFG_MBUF_POOL_SIZE
 * --mbuf-hdr-pool-sz configuration - size in K (*1024) of the mbuf hdr mempool
 *      default: GCFG_MBUF_HDR_POOL_SIZE
 ****************************************************************************/
bool mem_handle_cmdline_opt(const char *opt_name, char *opt_arg)
{
    global_config_t *cfg = cfg_get_config();

    if (!cfg)
        TPG_ERROR_ABORT("ERROR: Unable to get config!\n");

    if (strcmp(opt_name, "tcb-pool-sz") == 0) {
        cfg->gcfg_tcb_pool_size = atoi(opt_arg) * 1024ULL;
        return true;
    }

    if (strcmp(opt_name, "ucb-pool-sz") == 0) {
        cfg->gcfg_ucb_pool_size = atoi(opt_arg) * 1024ULL;
        return true;
    }

    if (strcmp(opt_name, "mbuf-pool-sz") == 0) {
        cfg->gcfg_mbuf_poolsize = atoi(opt_arg) * 1024UL;
        return true;
    }

    if (strcmp(opt_name, "mbuf-hdr-pool-sz") == 0) {
        cfg->gcfg_mbuf_hdr_poolsize = atoi(opt_arg) * 1024UL;
        return true;
    }

    return false;
}
Example #2
0
/*****************************************************************************
 * start_cores()
 ****************************************************************************/
static void start_cores(void)
{
    uint32_t core;

    /*
     * Fire up the packet processing cores
     */
    RTE_LCORE_FOREACH_SLAVE(core) {
        int index = rte_lcore_index(core);

        switch (index) {
        case TPG_CORE_IDX_CLI:
            assert(false);
        break;
        case TPG_CORE_IDX_TEST_MGMT:
            rte_eal_remote_launch(test_mgmt_loop, NULL, core);
        break;
        default:
            assert(index >= TPG_NR_OF_NON_PACKET_PROCESSING_CORES);
            rte_eal_remote_launch(pkt_receive_loop, NULL, core);
        }
    }

    /*
     * Wait for packet cores to finish initialization.
     */
    RTE_LCORE_FOREACH_SLAVE(core) {
        int   error;
        msg_t msg;

        if (!cfg_is_pkt_core(core))
            continue;

        msg_init(&msg, MSG_PKTLOOP_INIT_WAIT, core, 0);
        /* BLOCK waiting for msg to be processed */
        error = msg_send(&msg, 0);
        if (error)
            TPG_ERROR_ABORT("ERROR: Failed to send pktloop init wait msg: %s(%d)!\n",
                            rte_strerror(-error), -error);
    }
}
Example #3
0
/*****************************************************************************
 * tlkp_udp_lcore_init()
 ****************************************************************************/
void tlkp_udp_lcore_init(uint32_t lcore_id)
{
    unsigned int i;

    RTE_PER_LCORE(tlkp_ucb_hash_table) =
        rte_zmalloc_socket("udp_hash_table", rte_eth_dev_count() *
                           TPG_HASH_BUCKET_SIZE *
                           sizeof(tlkp_hash_bucket_t),
                           RTE_CACHE_LINE_SIZE,
                           rte_lcore_to_socket_id(lcore_id));
    if (RTE_PER_LCORE(tlkp_ucb_hash_table) == NULL) {
        TPG_ERROR_ABORT("[%d]: Failed to allocate per lcore udp htable!\n",
                        rte_lcore_index(lcore_id));
    }

    for (i = 0; i < (rte_eth_dev_count() * TPG_HASH_BUCKET_SIZE); i++) {
        /*
         * Initialize all list headers.
         */
        LIST_INIT((&RTE_PER_LCORE(tlkp_ucb_hash_table)[i]));
    }
}