Hi All,

I was working on passive traffic application. That means I receive packets but I transmit nothing. So I have two core one for the capture packet and one for the processing packet. In my case, Worker thread (processing packet) is much slower than the capturing packet. I just want to test this case and to see what happens if the number of enqueue operation is much higher than the dequeue operation.

I realize that I got a segmentation fault if I enqueue packets one by one. Do I miss some point? Why "rte_ring_enqueue_burst" function behaves differently? Any Idea

Here are the loops of cores:

Capture core loop:
while (!quit_signal_rx) {
        const uint16_t nb_rx = rte_eth_rx_burst(0, 0, bufs,BURST_SIZE);
        uint16_t sent = 0;

        // following line seg fault
        for (size_t i = 0; i < nb_rx; i++)
           sent += rte_ring_enqueue_burst(out_ring, (void *)&bufs[i], 1, NULL);

        // Works perfectly
        //sent = rte_ring_enqueue_burst(out_ring, (void *)bufs, nb_rx, NULL);

        if(nb_rx - sent != 0)
                rte_pktmbuf_free_bulk(&bufs[sent],nb_rx - sent);
}


Worker core loop:
while (!quit_signal_work) {
        const uint16_t num = rte_ring_dequeue_burst(in_r,
                                (void *)bufs, BURST_SIZE*1, NULL);
        /* Do a little bit of work for each packet */
        for (i = 0; i < num; i++) {
                uint64_t t = rte_rdtsc()+100000;
                while (rte_rdtsc() < t)
                        rte_pause();
        }

        rte_pktmbuf_free_bulk(bufs,num);
}

Reply via email to