examples/eventdev: fix 32-bit coremask

This commit fixes a bug in 32-bit environments when a core mask greater
than 32-bits is requested. The fix is to convert the bitmask logic to
64 bits, aligning 64 and 32 bit implementations.

Fixes: adb5d548 ("examples/eventdev_pipeline_sw_pmd: add sample app")
Cc: stable@dpdk.org

Reported-by: Jun W Zhou <junx.w.zhou@intel.com>
Suggested-by: Mao Jiang <maox.jiang@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
This commit is contained in:
Harry van Haaren 2020-06-16 17:56:03 +01:00 committed by Jerin Jacob
parent 50ea81d24c
commit ff0f1040b6
2 changed files with 9 additions and 9 deletions

View File

@ -81,7 +81,7 @@ parse_coremask(const char *coremask)
val = xdigit2val(c);
for (j = 0; j < BITS_HEX && idx < MAX_NUM_CORE; j++, idx++) {
if ((1 << j) & val) {
mask |= (1UL << idx);
mask |= (1ULL << idx);
count++;
}
}
@ -232,10 +232,10 @@ parse_app_args(int argc, char **argv)
usage();
for (i = 0; i < MAX_NUM_CORE; i++) {
fdata->rx_core[i] = !!(rx_lcore_mask & (1UL << i));
fdata->tx_core[i] = !!(tx_lcore_mask & (1UL << i));
fdata->sched_core[i] = !!(sched_lcore_mask & (1UL << i));
fdata->worker_core[i] = !!(worker_lcore_mask & (1UL << i));
fdata->rx_core[i] = !!(rx_lcore_mask & (1ULL << i));
fdata->tx_core[i] = !!(tx_lcore_mask & (1ULL << i));
fdata->sched_core[i] = !!(sched_lcore_mask & (1ULL << i));
fdata->worker_core[i] = !!(worker_lcore_mask & (1ULL << i));
if (fdata->worker_core[i])
cdata.num_workers++;

View File

@ -51,10 +51,10 @@ struct fastpath_data {
bool rx_single;
bool tx_single;
bool sched_single;
unsigned int rx_core[MAX_NUM_CORE];
unsigned int tx_core[MAX_NUM_CORE];
unsigned int sched_core[MAX_NUM_CORE];
unsigned int worker_core[MAX_NUM_CORE];
uint64_t rx_core[MAX_NUM_CORE];
uint64_t tx_core[MAX_NUM_CORE];
uint64_t sched_core[MAX_NUM_CORE];
uint64_t worker_core[MAX_NUM_CORE];
struct setup_data cap;
} __rte_cache_aligned;