当前位置: 首页>>代码示例>>C++>>正文


C++ rte_exit函数代码示例

本文整理汇总了C++中rte_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ rte_exit函数的具体用法?C++ rte_exit怎么用?C++ rte_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rte_exit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
    int32_t ret;
    uint8_t lcore_id;

    /* Signal */
    signal(SIGINT,(void *)app_print);
 

    clrscr();
    // call before the rte_eal_init()
    (void)rte_set_application_usage_hook(app_usage);

    init_probe(&probe);
    
    ret = rte_eal_init(argc, argv);
    if (ret < 0)
        rte_exit(EXIT_FAILURE, "Failed in rte_eal_init\n");
    argc -= ret;
    argv += ret;
    
    ret = app_parse_args(argc, argv);
    if (ret < 0)
        rte_exit(EXIT_FAILURE, "Invalid arguments\n");
  
    app_init(&probe);

    RTE_LCORE_FOREACH_SLAVE(lcore_id) {
        rte_eal_remote_launch(launch_probe, NULL, lcore_id);
    }
    rte_delay_ms(5000);     // wait for the lcores to start up

    // Wait for all of the cores to stop runing and exit.

    clrscr();
    app_logo(8, 0, APP_NAME); 
    //process_hashtable();
    rte_eal_mp_wait_lcore(); 

    return 0;
}
开发者ID:NachtZ,项目名称:dpdk-snort-1,代码行数:41,代码来源:snort-main.c

示例2: init_shm_rings

/**
 * Set up the DPDK rings which will be used to pass packets, via
 * pointers, between the multi-process server and NF processes.
 * Each NF needs one RX queue.
 */
static int
init_shm_rings(void) {
        unsigned i;
        unsigned socket_id;
        const char * rq_name;
        const char * tq_name;
        const char * msg_q_name;
        const unsigned ringsize = NF_QUEUE_RINGSIZE;
        const unsigned msgringsize = NF_MSG_QUEUE_SIZE;

        // use calloc since we allocate for all possible NFs
        // ensure that all fields are init to 0 to avoid reading garbage
        // TODO plopreiato, move to creation when a NF starts
        for (i = 0; i < MAX_NFS; i++) {
                /* Create an RX queue for each NF */
                socket_id = rte_socket_id();
                rq_name = get_rx_queue_name(i);
                tq_name = get_tx_queue_name(i);
                msg_q_name = get_msg_queue_name(i);
                nfs[i].instance_id = i;
                nfs[i].rx_q = rte_ring_create(rq_name,
                                ringsize, socket_id,
                                RING_F_SC_DEQ);                 /* multi prod, single cons */
                nfs[i].tx_q = rte_ring_create(tq_name,
                                ringsize, socket_id,
                                RING_F_SC_DEQ);                 /* multi prod, single cons */
                nfs[i].msg_q = rte_ring_create(msg_q_name,
                                msgringsize, socket_id,
                                RING_F_SC_DEQ);                 /* multi prod, single cons */

                if (nfs[i].rx_q == NULL)
                        rte_exit(EXIT_FAILURE, "Cannot create rx ring queue for NF %u\n", i);

                if (nfs[i].tx_q == NULL)
                        rte_exit(EXIT_FAILURE, "Cannot create tx ring queue for NF %u\n", i);

                if (nfs[i].msg_q == NULL)
                        rte_exit(EXIT_FAILURE, "Cannot create msg queue for NF %u\n", i);
        }
        return 0;
}
开发者ID:nks5295,项目名称:openNetVM,代码行数:46,代码来源:onvm_init.c

示例3: configure_tx_buffer

static void
configure_tx_buffer(uint8_t port_id, uint16_t size)
{
    int ret;

    /* Initialize TX buffers */
    tx_buffer[port_id] = rte_zmalloc_socket("tx_buffer",
                                            RTE_ETH_TX_BUFFER_SIZE(size), 0,
                                            rte_eth_dev_socket_id(port_id));
    if (tx_buffer[port_id] == NULL)
        rte_exit(EXIT_FAILURE, "Cannot allocate buffer for tx on port %u\n",
                 (unsigned) port_id);

    rte_eth_tx_buffer_init(tx_buffer[port_id], size);

    ret = rte_eth_tx_buffer_set_err_callback(tx_buffer[port_id],
            flush_tx_error_callback, (void *)(intptr_t)port_id);
    if (ret < 0)
        rte_exit(EXIT_FAILURE, "Cannot set error callback for "
                 "tx buffer on port %u\n", (unsigned) port_id);
}
开发者ID:XianliangJ,项目名称:mtcp,代码行数:21,代码来源:client.c

示例4: setup_shared_variables

static void
setup_shared_variables(void)
{
    const struct rte_memzone *qw_memzone;

    qw_memzone = rte_memzone_lookup(QUOTA_WATERMARK_MEMZONE_NAME);
    if (qw_memzone == NULL)
        rte_exit(EXIT_FAILURE, "Couldn't find memzone\n");

    quota = qw_memzone->addr;
    low_watermark = (unsigned int *) qw_memzone->addr + sizeof(int);
}
开发者ID:kimi8187,项目名称:Pktgen-DPDK,代码行数:12,代码来源:qwctl.c

示例5: create_flow_distributor_table

/*
 * Create flow distributor table which will contain all the flows
 * that will be distributed among the nodes
 */
static void
create_flow_distributor_table(void)
{
	uint8_t socket_id = rte_socket_id();

	/* create table */
	efd_table = rte_efd_create("flow table", num_flows * 2, sizeof(uint32_t),
			1 << socket_id,	socket_id);

	if (efd_table == NULL)
		rte_exit(EXIT_FAILURE, "Problem creating the flow table\n");
}
开发者ID:Di0gen,项目名称:test_jenkins_project,代码行数:16,代码来源:init.c

示例6: sp_init

void
sp_init(struct socket_ctx *ctx, int socket_id, unsigned ep)
{
	const char *name;
	const struct acl4_rules *rules_out, *rules_in;
	unsigned nb_out_rules, nb_in_rules;

	if (ctx == NULL)
		rte_exit(EXIT_FAILURE, "NULL context.\n");

	if (ctx->sp_ipv4_in != NULL)
		rte_exit(EXIT_FAILURE, "Inbound SP DB for socket %u already "
				"initialized\n", socket_id);

	if (ctx->sp_ipv4_out != NULL)
		rte_exit(EXIT_FAILURE, "Outbound SP DB for socket %u already "
				"initialized\n", socket_id);

	if (ep == 0) {
		rules_out = acl4_rules_in;
		nb_out_rules = RTE_DIM(acl4_rules_in);
		rules_in = acl4_rules_out;
		nb_in_rules = RTE_DIM(acl4_rules_out);
	} else if (ep == 1) {
		rules_out = acl4_rules_out;
		nb_out_rules = RTE_DIM(acl4_rules_out);
		rules_in = acl4_rules_in;
		nb_in_rules = RTE_DIM(acl4_rules_in);
	} else
		rte_exit(EXIT_FAILURE, "Invalid EP value %u. "
				"Only 0 or 1 supported.\n", ep);

	name = "sp_ipv4_in";
	ctx->sp_ipv4_in = (struct sp_ctx *)acl4_init(name, socket_id,
			rules_in, nb_in_rules);

	name = "sp_ipv4_out";
	ctx->sp_ipv4_out = (struct sp_ctx *)acl4_init(name, socket_id,
			rules_out, nb_out_rules);
}
开发者ID:0day-ci,项目名称:dpdk,代码行数:40,代码来源:sp.c

示例7: rte_eal_config_create

/* create memory configuration in shared/mmap memory. Take out
 * a write lock on the memsegs, so we can auto-detect primary/secondary.
 * This means we never close the file while running (auto-close on exit).
 * We also don't lock the whole file, so that in future we can use read-locks
 * on other parts, e.g. memzones, to detect if there are running secondary
 * processes. */
static void
rte_eal_config_create(void)
{
	void *rte_mem_cfg_addr;
	int retval;

	const char *pathname = eal_runtime_config_path();

	if (internal_config.no_shconf)
		return;

	/* map the config before hugepage address so that we don't waste a page */
	if (internal_config.base_virtaddr != 0)
		rte_mem_cfg_addr = (void *)
			RTE_ALIGN_FLOOR(internal_config.base_virtaddr -
			sizeof(struct rte_mem_config), sysconf(_SC_PAGE_SIZE));
	else
		rte_mem_cfg_addr = NULL;

	if (mem_cfg_fd < 0){
		mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);
		if (mem_cfg_fd < 0)
			rte_panic("Cannot open '%s' for rte_mem_config\n", pathname);
	}

	retval = ftruncate(mem_cfg_fd, sizeof(*rte_config.mem_config));
	if (retval < 0){
		close(mem_cfg_fd);
		rte_panic("Cannot resize '%s' for rte_mem_config\n", pathname);
	}

	retval = fcntl(mem_cfg_fd, F_SETLK, &wr_lock);
	if (retval < 0){
		close(mem_cfg_fd);
		rte_exit(EXIT_FAILURE, "Cannot create lock on '%s'. Is another primary "
				"process running?\n", pathname);
	}

	rte_mem_cfg_addr = mmap(rte_mem_cfg_addr, sizeof(*rte_config.mem_config),
				PROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);

	if (rte_mem_cfg_addr == MAP_FAILED){
		rte_panic("Cannot mmap memory for rte_config\n");
	}
	memcpy(rte_mem_cfg_addr, &early_mem_config, sizeof(early_mem_config));
	rte_config.mem_config = (struct rte_mem_config *) rte_mem_cfg_addr;

	/* store address of the config in the config itself so that secondary
	 * processes could later map the config into this exact location */
	rte_config.mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;

}
开发者ID:AMildner,项目名称:MoonGen,代码行数:58,代码来源:eal.c

示例8: process_pkts

static void process_pkts(struct rte_mbuf *buf[], int n)
{
	int i;
	uint8_t *pkt;
	int ret;
	uint32_t ft[5];
	unsigned char *payload;
	int len;
	for(i = 0; i < n; i++)
	{   
#ifdef EXEC_MBUF_PA_CNT
		uint32_t lcoreid = rte_lcore_id();
		uint32_t *count;
		struct rte_hash *h = lcore_args[lcoreid].pa_ht;
		if(rte_hash_lookup_data(h, (const void *)&(buf[i]->buf_physaddr), (void**)&count) >= 0)
		{
			*count = *count + 1;
		}
		else
		{
			if(pacnt_hash_add(h, (const void *)&(buf[i]->buf_physaddr), 1) < 0)
			{
				rte_exit(EINVAL, "pacnt hash add failed in lcore %d\n", lcoreid);
			}
		}
#endif
#if defined(EXEC_PC) || defined(EXEC_HASH)
		parse_packet_to_tuple(buf[i], ft);
#ifdef EXEC_PC
		ret = packet_classifier_search(ft);       
		if(ret < 0)
		{
			fprintf(stderr, "packet classifing failed!\n");
		}
#else
		ret = hash_table_lkup((void*)ft);
#endif
#endif
#ifdef EXEC_CRC
		calc_chk_sum(buf[i]);
#endif
#ifdef EXEC_DPI
		ret = get_payload(buf[i], &payload, &len);
		if(ret < 0)
		{
			fprintf(stderr, "packet get payload failed!\n");
			continue;
		}
		ret = dpi_engine_exec(payload, len);
#endif
	}
}
开发者ID:FI-Lab,项目名称:dpdk-cc-benchmarks,代码行数:52,代码来源:main.c

示例9: main

int main(int argc, char *argv[])
{
    int eal_init_ret = rte_eal_init(argc, argv);
    if (eal_init_ret < 0) {
        rte_exit(EXIT_FAILURE, "Invalid EAL parameters\n");
    }

    FLAGS_logtostderr = 1;
    google::InitGoogleLogging(argv[0]);
    ::testing::InitGoogleTest(&argc, argv);

    return RUN_ALL_TESTS();
}
开发者ID:tigerjibo,项目名称:dpdk_dpi,代码行数:13,代码来源:main.cpp

示例10: onvm_sc_create

struct onvm_service_chain*
onvm_sc_create(void)
{
        struct onvm_service_chain *chain;

        chain = rte_calloc("ONVM_sercice_chain",
                        1, sizeof(struct onvm_service_chain), 0);
        if (chain == NULL) {
                rte_exit(EXIT_FAILURE, "Cannot allocate memory for service chain\n");
        }

	return chain;
}
开发者ID:Kumangus,项目名称:openNetVM,代码行数:13,代码来源:onvm_sc_mgr.c

示例11: MAIN

int MAIN(int argc, char **argv)
{
    int ret;
    struct cmdline *cl;

    rte_set_log_level(RTE_LOG_INFO);

    ret = rte_eal_init(argc, argv);
    if (ret < 0)
        rte_exit(EXIT_FAILURE, "Cannot initialize EAL\n");

    setup_shared_variables();

    cl = cmdline_stdin_new(qwctl_ctx, "qwctl> ");
    if (cl == NULL)
        rte_exit(EXIT_FAILURE, "Cannot create cmdline instance\n");

    cmdline_interact(cl);
    cmdline_stdin_exit(cl);

    return 0;
}
开发者ID:kimi8187,项目名称:Pktgen-DPDK,代码行数:22,代码来源:qwctl.c

示例12: ovnm_nf_info_init

/**
 * CALLED BY NF:
 * Create a new nf_info struct for this NF
 * Pass a unique tag for this NF
 */
static struct onvm_nf_info *
ovnm_nf_info_init(const char *tag)
{
        void *mempool_data;
        struct onvm_nf_info *info;

        if (rte_mempool_get(nf_info_mp, &mempool_data) < 0) {
                rte_exit(EXIT_FAILURE, "Failed to get client info memory");
        }

        if (mempool_data == NULL) {
                rte_exit(EXIT_FAILURE, "Client Info struct not allocated");
        }

        info = (struct onvm_nf_info*) mempool_data;
        info->instance_id = initial_instance_id;
        info->service_id = service_id;
        info->status = NF_WAITING_FOR_ID;
        info->tag = tag;

        return info;
}
开发者ID:Kumangus,项目名称:openNetVM,代码行数:27,代码来源:onvm_nflib.c

示例13: setup_shared_variables

void
setup_shared_variables(void)
{
    const struct rte_memzone *qw_memzone;

    qw_memzone = rte_memzone_reserve(QUOTA_WATERMARK_MEMZONE_NAME, 2 * sizeof(int),
                                     rte_socket_id(), RTE_MEMZONE_2MB);
    if (qw_memzone == NULL)
        rte_exit(EXIT_FAILURE, "%s\n", rte_strerror(rte_errno));

    quota = qw_memzone->addr;
    low_watermark = (unsigned int *) qw_memzone->addr + sizeof(int);
}
开发者ID:AceKatz,项目名称:networking_research,代码行数:13,代码来源:init.c

示例14: parse_portid

static uint8_t
parse_portid(const char *portid_str)
{
	char *end;
	unsigned id;

	id = strtoul(portid_str, &end, 10);

	if (end == portid_str || *end != '\0' || id > RTE_MAX_ETHPORTS)
		rte_exit(EXIT_FAILURE, "Invalid port number\n");

	return (uint8_t) id;
}
开发者ID:Leon555,项目名称:dpdk,代码行数:13,代码来源:bridge.c

示例15: init_info_queue

/**
 * Allocate a rte_ring for newly created NFs
 */
static int
init_info_queue(void)
{
        incoming_msg_queue = rte_ring_create(
                _MGR_MSG_QUEUE_NAME,
                MAX_NFS,
                rte_socket_id(),
                RING_F_SC_DEQ); // MP enqueue (default), SC dequeue

        if (incoming_msg_queue == NULL)
                rte_exit(EXIT_FAILURE, "Cannot create incoming msg queue\n");

        return 0;
}
开发者ID:nks5295,项目名称:openNetVM,代码行数:17,代码来源:onvm_init.c


注:本文中的rte_exit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。