From patchwork Wed Oct 12 23:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sevincer, Abdullah" X-Patchwork-Id: 118098 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 69EBFA00C2; Thu, 13 Oct 2022 01:51:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1B2642C27; Thu, 13 Oct 2022 01:51:05 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 0BFC542C27 for ; Thu, 13 Oct 2022 01:51:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665618664; x=1697154664; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hw2Z23jK2/NoCFTItVAVZZSwl2EpQ2uDI8Wvr0UOex8=; b=EQKRzYv1pk/ZqQH+brWlhtMKVwJ6EcK6JoF5LeK/2d6dwayd1BkY8pZR el8Fm8uAvEW9z/qn279gAXOFh5uBm0N1e6FjGmc7t3A73iDvG1hB9T3co e3ryzv5sIAilXCLGFph1YpH2gNFULOplt+foNn4AZzmyMhNqpZHo3LDWC 9vufCBhpOcB1lGpvEa7x1j7bGyddABYwGvrcV8CHw1Sb8kuBogh8kLLda qNkoa9lfpJmFi5ioiR/tBHDjvP0X0KTfj48aho9KaUH6RJW5UHSNKJy2x 6CY1ndZ7YsMgC1jJ4wczIpRCNQVsA3h8lvR3oyYnH+GJbqZA0LskSjz+7 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="366936403" X-IronPort-AV: E=Sophos;i="5.95,180,1661842800"; d="scan'208";a="366936403" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 16:50:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="604746838" X-IronPort-AV: E=Sophos;i="5.95,180,1661842800"; d="scan'208";a="604746838" Received: from txanpdk02.an.intel.com ([10.123.117.76]) by orsmga006.jf.intel.com with ESMTP; 12 Oct 2022 16:50:41 -0700 From: Abdullah Sevincer To: dev@dpdk.org Cc: jerinj@marvell.com, Abdullah Sevincer Subject: [PATCH v2 2/4] event/dlb2: add check valid producer coremask Date: Wed, 12 Oct 2022 18:50:35 -0500 Message-Id: <20221012235037.3293072-2-abdullah.sevincer@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221012235037.3293072-1-abdullah.sevincer@intel.com> References: <20221012143247.3239356-1-abdullah.sevincer@intel.com, shivani.doneria@intel.com> <20221012235037.3293072-1-abdullah.sevincer@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This commit add checks during port probing for validating producer core masks if they are a subset of eal coremask. Error is returned if producer coremask is not a subset of eal coremask. Signed-off-by: Abdullah Sevincer --- drivers/event/dlb2/pf/base/dlb2_resource.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c index 3f36acb6a4..dd8390a013 100644 --- a/drivers/event/dlb2/pf/base/dlb2_resource.c +++ b/drivers/event/dlb2/pf/base/dlb2_resource.c @@ -918,9 +918,8 @@ int dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args) { const struct dlb2_devargs *args = (const struct dlb2_devargs *)probe_args; - const char *mask = NULL; - int cpu = 0, cnt = 0, cores[RTE_MAX_LCORE]; - int i; + const char *mask = args ? args->producer_coremask : NULL; + int cpu = 0, cnt = 0, cores[RTE_MAX_LCORE], i; if (args) { mask = (const char *)args->producer_coremask; @@ -933,16 +932,17 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args) hw->num_prod_cores = 0; for (i = 0; i < RTE_MAX_LCORE; i++) { + bool is_pcore = (mask && cores[i] != -1); + if (rte_lcore_is_enabled(i)) { - if (mask) { + if (is_pcore) { /* * Populate the producer cores from parsed * coremask */ - if (cores[i] != -1) { - hw->prod_core_list[cores[i]] = i; - hw->num_prod_cores++; - } + hw->prod_core_list[cores[i]] = i; + hw->num_prod_cores++; + } else if ((++cnt == DLB2_EAL_PROBE_CORE || rte_lcore_count() < DLB2_EAL_PROBE_CORE)) { /* @@ -952,7 +952,12 @@ dlb2_resource_probe(struct dlb2_hw *hw, const void *probe_args) cpu = i; break; } + } else if (is_pcore) { + DLB2_LOG_ERR("Producer coremask(%s) must be a subset of EAL coremask", + mask); + return -1; } + } /* Use the first core in producer coremask to probe */ if (hw->num_prod_cores)