From patchwork Fri May 19 02:29:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Liu X-Patchwork-Id: 127054 X-Patchwork-Delegate: thomas@monjalon.net 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 320E642B42; Fri, 19 May 2023 04:33:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C10A840A82; Fri, 19 May 2023 04:33:33 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id D5659406B5 for ; Fri, 19 May 2023 04:33:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684463612; x=1715999612; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=j7rKf1cTPp2vtQ1R/fbyNuJrPcxMDox4vE0UGc3mRq8=; b=VKs/LTOp9C0YhqwUKKsg90ddavT1qfKwkQHV6wz+vnMG8GFBzJvFqSAt ou/KFKPIEHm7yC3G+wjtCmowxjpl94mPzFONjjmulIaxRrL3HQ9FI9Uin AeuA5W12jo6Cohl1sRaIA7EvXLVZrjgI5zQOF2j616sj+eVs4xovfN2Jo LwmI54JxMCvVJ7iZiMDEsihXw0S+8NJXcp78alpS14bSdFjoAvbpup+K/ okShrVtQOYPQ7jj+nCqRPMmGuzM2Dg3moegLFpGqWIA/WsDp0ZpeZkbVB RTxHal66islf0drLGHSI3i3m1x40fhv0Un+pnrMC7BlSLBw+6WZmWb7LY Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="352277886" X-IronPort-AV: E=Sophos;i="6.00,175,1681196400"; d="scan'208";a="352277886" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 19:33:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10714"; a="814564613" X-IronPort-AV: E=Sophos;i="6.00,175,1681196400"; d="scan'208";a="814564613" Received: from npg-dpdk-virtual-marvin.sh.intel.com ([10.67.119.3]) by fmsmga002.fm.intel.com with ESMTP; 18 May 2023 19:33:29 -0700 From: Marvin Liu To: anatoly.burakov@intel.com, dev@dpdk.org Cc: Marvin Liu Subject: [PATCH] eal: allow both allow and block options coexistence Date: Fri, 19 May 2023 10:29:46 +0800 Message-Id: <20230519022946.48138-1-yong.liu@intel.com> X-Mailer: git-send-email 2.24.0.rc1 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 Since all buses share the same eal allow and block options. There's a need to allow both allow and block options coexist. At the same time, this wouldn't be a problem if both allow and block options were present on the same bus. The scan mode of a bus will be set when met the first type option. eg: --allow 0000:05:00.0 --block wq0.0 only pci device 0000:05:00.0 will be scanned all devices except wq0.0 on dsa bus will be scanned eg: --allow 0000:05:00.0 --block 0000:05:00.1 block option will be ingored eg: --block 0000:05:00.1 --allow 0000:05:00.0 allow option will be ignored Signed-off-by: Marvin Liu --- .mailmap | 2 +- lib/eal/common/eal_common_options.c | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/.mailmap b/.mailmap index 0443e461a9..d256696485 100644 --- a/.mailmap +++ b/.mailmap @@ -1548,7 +1548,7 @@ Yogesh Jangra Yogev Chaimovich Yongjie Gu Yongji Xie -Yong Liu +Marvin Liu Yongping Zhang Yongseok Koh Yong Wang diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index 0305933698..0d8f9c5a38 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -1623,24 +1623,15 @@ int eal_parse_common_option(int opt, const char *optarg, struct internal_config *conf) { - static int b_used; - static int a_used; - switch (opt) { case 'b': - if (a_used) - goto ba_conflict; if (eal_option_device_add(RTE_DEVTYPE_BLOCKED, optarg) < 0) return -1; - b_used = 1; break; case 'a': - if (b_used) - goto ba_conflict; if (eal_option_device_add(RTE_DEVTYPE_ALLOWED, optarg) < 0) return -1; - a_used = 1; break; /* coremask */ case 'c': { @@ -1929,11 +1920,6 @@ eal_parse_common_option(int opt, const char *optarg, } return 0; - -ba_conflict: - RTE_LOG(ERR, EAL, - "Options allow (-a) and block (-b) can't be used at the same time\n"); - return -1; } static void