Example #1
0
void app_main_loop()
{
    uint8_t ports_to_poll[1] = { 0 };
	int skip = 0;
	int drv_poll_interval = get_max_drv_poll_interval_in_micros(0);

	app_glue_init_poll_intervals(drv_poll_interval/2,
			1000 /*timer_poll_interval*/,
			drv_poll_interval/10,drv_poll_interval/10);
	while(1) {
		app_glue_periodic(0,ports_to_poll,1);
		skip++;
		if(skip == 100) {
			user_on_transmission_opportunity(udp_socket);
			user_data_available_cbk(udp_socket);
			skip = 0;
		}
	}
}
void ipaugenblick_main_loop()
{
    struct rte_mbuf *mbuf;
    uint8_t ports_to_poll[1] = { 0 };
    int drv_poll_interval = get_max_drv_poll_interval_in_micros(0);
    app_glue_init_poll_intervals(drv_poll_interval/(2*MAX_PKT_BURST),
                                 100 /*timer_poll_interval*/,
                                 drv_poll_interval/(10*MAX_PKT_BURST),
                                drv_poll_interval/(60*MAX_PKT_BURST));
    
    ipaugenblick_service_api_init(COMMAND_POOL_SIZE,DATA_RINGS_SIZE,DATA_RINGS_SIZE);
    TAILQ_INIT(&buffers_available_notification_socket_list_head);
    TAILQ_INIT(&ipaugenblick_clients_list_head);
    init_systick(rte_lcore_id());
    ipaugenblick_log(IPAUGENBLICK_LOG_INFO,"IPAugenblick service initialized\n");
    while(1) {
        process_commands();
	app_glue_periodic(1,ports_to_poll,1);
        while(!TAILQ_EMPTY(&buffers_available_notification_socket_list_head)) {
            if(get_buffer_count() > 0) {
                struct socket *sock = TAILQ_FIRST(&buffers_available_notification_socket_list_head);
                socket_satelite_data_t *socket_data = get_user_data(sock);
		if(socket_data->socket->type == SOCK_DGRAM)
		   	user_set_socket_tx_space(&g_ipaugenblick_sockets[socket_data->ringset_idx].tx_space,sk_stream_wspace(socket_data->socket->sk));
		//printf("%s %d %d %d %d\n",__FILE__,__LINE__,socket_data->ringset_idx,g_ipaugenblick_sockets[socket_data->ringset_idx].tx_space,sk_stream_wspace(socket_data->socket->sk));
                if(!ipaugenblick_mark_writable(socket_data)) { 
                    sock->buffers_available_notification_queue_present = 0;
                    TAILQ_REMOVE(&buffers_available_notification_socket_list_head,sock,buffers_available_notification_queue_entry); 
                }
                else {
                    break;
                }
            }
            else {
                break;
            }
        }
    }
}