Changeset b15cc48


Ignore:
Timestamp:
11/25/16 14:50:28 (5 years ago)
Author:
Richard Sanger <rsanger@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
c94f107
Parents:
e3b6476
Message:

Fixes bug in DPDK trace_event handling

Reading small bursts of packets is not supported by DPDK and hangs.
Instead we read a larger burst and cache, which is better for performance also.

Fixes #29 broken tracetop with DPDK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dpdk.c

    re3b6476 rb15cc48  
    237237/* For single threaded libtrace we read packets as a batch/burst
    238238 * this is the maximum size of said burst */
    239 #define BURST_SIZE 50
     239#define BURST_SIZE 32
    240240
    241241#define MBUF(x) ((struct rte_mbuf *) x)
     
    22542254                                            libtrace_packet_t *packet) {
    22552255        libtrace_eventobj_t event = {0,0,0.0,0};
    2256         int nb_rx; /* Number of receive packets we've read */
    2257         struct rte_mbuf* pkts_burst[1]; /* Array of 1 pointer(s) to rx buffers */
     2256        size_t nb_rx; /* Number of received packets we've read */
    22582257
    22592258        do {
    22602259
    2261                 /* See if we already have a packet waiting */
    2262                 nb_rx = rte_eth_rx_burst(FORMAT(trace)->port,
    2263                                          FORMAT_DATA_FIRST(trace)->queue_id,
    2264                                          pkts_burst, 1);
    2265 
    2266                 if (nb_rx > 0) {
     2260                /* No packets waiting in our buffer? Try and read some more */
     2261                if (FORMAT(trace)->burst_size == FORMAT(trace)->burst_offset) {
     2262                        nb_rx = rte_eth_rx_burst(FORMAT(trace)->port,
     2263                                                 FORMAT_DATA_FIRST(trace)->queue_id,
     2264                                                 FORMAT(trace)->burst_pkts, BURST_SIZE);
     2265                        if (nb_rx > 0) {
     2266                                dpdk_ready_pkts(trace, FORMAT_DATA_FIRST(trace),
     2267                                                FORMAT(trace)->burst_pkts, nb_rx);
     2268                                FORMAT(trace)->burst_size = nb_rx;
     2269                                FORMAT(trace)->burst_offset = 0;
     2270                        }
     2271                }
     2272
     2273                /* Now do we have packets waiting? */
     2274                if (FORMAT(trace)->burst_size != FORMAT(trace)->burst_offset) {
    22672275                        /* Free the last packet buffer */
    22682276                        if (packet->buffer != NULL) {
     
    22762284                        packet->type = TRACE_RT_DATA_DPDK;
    22772285                        event.type = TRACE_EVENT_PACKET;
    2278                         dpdk_ready_pkts(trace, FORMAT_DATA_FIRST(trace), pkts_burst, 1);
    2279                         packet->buffer = FORMAT(trace)->burst_pkts[0];
     2286                        packet->buffer = FORMAT(trace)->burst_pkts[
     2287                                             FORMAT(trace)->burst_offset++];
    22802288                        dpdk_prepare_packet(trace, packet, packet->buffer, packet->type, 0);
    22812289                        event.size = 1; // TODO should be bytes read, which essentially useless anyway
Note: See TracChangeset for help on using the changeset viewer.