Changeset e3d534f for lib/format_dpdk.c


Ignore:
Timestamp:
03/16/15 14:23:51 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
6c84681
Parents:
a978dec
Message:

Fix DPDK resuming

  • Fix DPDK re-reserving cores on resume
  • Fix DPDK single threaded so that it doesn't reserve a per-pkt core.
  • Fix reset statistic counters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dpdk.c

    r6a6e6a8 re3d534f  
    295295#endif
    296296} ALIGN_STRUCT(CACHE_LINE_SIZE);
     297
     298#if HAS_HW_TIMESTAMPS_82580
     299#define DPDK_EMPTY_STREAM {-1, 0, NULL, -1, 0, 0}
     300#else
     301#define DPDK_EMPTY_STREAM {-1, 0, NULL, -1}
     302#endif
    297303
    298304typedef struct dpdk_per_stream_t dpdk_per_stream_t;
     
    789795
    790796static int dpdk_init_input (libtrace_t *libtrace) {
    791         dpdk_per_stream_t stream = {0};
     797        dpdk_per_stream_t stream = DPDK_EMPTY_STREAM;
    792798        char err[500];
    793799        err[0] = 0;
     
    12681274        int ret, i;
    12691275        struct rte_eth_link link_info; /* Wait for link */
    1270         dpdk_per_stream_t empty_stream = {0};
     1276        dpdk_per_stream_t empty_stream = DPDK_EMPTY_STREAM;
    12711277
    12721278        /* Already started */
     
    13671373                stream->queue_id = i;
    13681374
    1369                 /* TODO we don't use this in the single threaded framework -
    1370                  * So we should not reserve this */
    1371                 stream->lcore = dpdk_reserve_lcore(true, format_data->nic_numa_node);
     1375                if (stream->lcore == -1)
     1376                        stream->lcore = dpdk_reserve_lcore(true, format_data->nic_numa_node);
    13721377
    13731378                if (stream->lcore == -1) {
     
    14091414        fprintf(stderr, "Doing start device\n");
    14101415#endif
     1416        rte_eth_stats_reset(format_data->port);
    14111417        /* Start device */
    14121418        ret = rte_eth_dev_start(format_data->port);
     
    14561462        err[0] = 0;
    14571463
     1464        /* Make sure we don't reserve an extra thread for this */
     1465        FORMAT_DATA_FIRST(libtrace)->queue_id = rte_lcore_id();
     1466
    14581467        if (dpdk_start_streams(FORMAT(libtrace), err, sizeof(err), 1) != 0) {
    14591468                trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, "%s", err);
     
    14831492        int i=0, phys_cores=0;
    14841493        int tot = libtrace->perpkt_thread_count;
     1494        libtrace_list_node_t *n;
    14851495        err[0] = 0;
    14861496
     
    14991509        for (i = 0; i < RTE_MAX_LCORE; ++i) {
    15001510                if (lcore_config[i].detected) {
    1501                         if (rte_lcore_is_enabled(i))
     1511                        if (rte_lcore_is_enabled(i)) {
     1512#if DEBUG
    15021513                                fprintf(stderr, "Found core %d already in use!\n", i);
    1503                         else
     1514#endif
     1515                        } else {
    15041516                                phys_cores++;
    1505                 }
     1517                        }
     1518                }
     1519        }
     1520        /* If we are restarting we have already allocated some threads as such
     1521         * we add these back to the count for this calculation */
     1522        for (n = FORMAT_DATA_HEAD(libtrace); n; n = n->next) {
     1523                dpdk_per_stream_t * stream = n->data;
     1524                if (stream->lcore != -1)
     1525                        phys_cores++;
    15061526        }
    15071527
Note: See TracChangeset for help on using the changeset viewer.