From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8655AA04A5; Tue, 16 Jun 2020 18:54:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6857C1BF9F; Tue, 16 Jun 2020 18:54:56 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 44C6B1BFAC; Tue, 16 Jun 2020 18:54:54 +0200 (CEST) IronPort-SDR: 6hprF8jc2VsCOQYaePhXodG3gA5ucl/fwmcAyqH/KTCKGd72sgd24xVPGYLKKMxd2r9fm4NKlf 2b2E8nLDSc8Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 09:54:53 -0700 IronPort-SDR: XApYJfFPnW8H/3MOItg7OcibxhTH9W5PJLb+taQnvP4H+XFSlLPJvxs8B2JvsEsJlkpvgQXO9n MbCOHlnSjs9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,518,1583222400"; d="scan'208";a="476529843" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.209]) by fmsmga005.fm.intel.com with ESMTP; 16 Jun 2020 09:54:51 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: junx.w.zhou@intel.com, maox.jiang@intel.com, Harry van Haaren , stable@dpdk.org Date: Tue, 16 Jun 2020 17:56:03 +0100 Message-Id: <20200616165603.61456-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] examples/eventdev_pipeline: fix 32-bit coremask logic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Zhou Suggested-by: Mao Jiang Signed-off-by: Harry van Haaren --- examples/eventdev_pipeline/main.c | 10 +++++----- examples/eventdev_pipeline/pipeline_common.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 21958269f..4ac582153 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -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++; diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index c7245f7f0..6a4287602 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -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; -- 2.17.1