From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 777E5A0508; Thu, 7 Apr 2022 04:59:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 13CD64287C; Thu, 7 Apr 2022 04:59:09 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id EEFFE4289D for ; Thu, 7 Apr 2022 04:59:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649300347; x=1680836347; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WDsMFwS6mcRzNwmIl//IO5h3Qnlb7SWHClfjuytGiRA=; b=R2aoodjkND7SCZcQ2Zriypf7b2Gsx+IVWOoTU9yeRA6WP7vkrxFKU+rx D0y3mg2JbEwUGkgkFcruRQVWySgjCw8equMI6j+UtKOGHoB+Ik3GWgjx0 eJ7w3TY2CBz1cC5/hL4O3wcqZu2nRmCbFgEnUthhVyXsmWoVRO08eODU9 Vlvp4peeiGvL+8fBmFZLLCohlaeGiCQoUX8etsroDxwwxzdojYJg4qSL8 +5ylhef1GYLaJzFQDIohX29DoGDiGCevxmDHAM9B8Y+GvEivDLumg2Bl7 eNFHW5gheKzyJpQzVot2/coubrOxeK+7i5He2BBm0PlL498HTYn8H5qpv w==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="248738394" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="248738394" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:59:06 -0700 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="570850636" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 19:59:03 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Alvin Zhang , Steven Zou , Kevin Liu Subject: [PATCH 18/39] net/ice: support buildin recipe configuration Date: Thu, 7 Apr 2022 10:56:45 +0000 Message-Id: <20220407105706.18889-19-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220407105706.18889-1-kevinx.liu@intel.com> References: <20220407105706.18889-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Alvin Zhang Support parsing 'br'(buildin recipe) parameter in device parameter list. Signed-off-by: Steven Zou Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/ice_dcf_ethdev.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c index 90787d8c49..a165f74e26 100644 --- a/drivers/net/ice/ice_dcf_ethdev.c +++ b/drivers/net/ice/ice_dcf_ethdev.c @@ -1807,6 +1807,23 @@ ice_dcf_cap_check_handler(__rte_unused const char *key, return -1; } +static int +parse_bool(const char *key, const char *value, void *args) +{ + bool *i = (bool *)args; + int num = atoi(value); + + if (num != 0 && num != 1) { + PMD_DRV_LOG(WARNING, + "invalid value:\"%s\" for key:\"%s\", must be 0 or 1", + value, key); + return -1; + } + + *i = (bool)num; + return 0; +} + static int ice_dcf_cap_selected(struct ice_dcf_adapter *adapter, struct rte_devargs *devargs) @@ -1814,7 +1831,9 @@ ice_dcf_cap_selected(struct ice_dcf_adapter *adapter, struct ice_adapter *ad = &adapter->parent; struct rte_kvargs *kvlist; const char *key_cap = "cap"; + const char *key_br = "br"; int ret = 0; + bool br = 0; if (devargs == NULL) return 0; @@ -1832,6 +1851,11 @@ ice_dcf_cap_selected(struct ice_dcf_adapter *adapter, &adapter->real_hw.multi_inst) < 0) goto exit; + /* dcf capability selected when there's a key-value pair: cap=dcf */ + if (rte_kvargs_process(kvlist, key_br, parse_bool, &br) < 0) + goto exit; + + ad->hw.use_buildin_recipe = br; ret = 1; exit: @@ -2008,4 +2032,4 @@ static struct rte_pci_driver rte_ice_dcf_pmd = { RTE_PMD_REGISTER_PCI(net_ice_dcf, rte_ice_dcf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_ice_dcf, pci_id_ice_dcf_map); RTE_PMD_REGISTER_KMOD_DEP(net_ice_dcf, "* igb_uio | vfio-pci"); -RTE_PMD_REGISTER_PARAM_STRING(net_ice_dcf, "cap=dcf|mdcf"); +RTE_PMD_REGISTER_PARAM_STRING(net_ice_dcf, "cap=dcf|mdcf br=<1|0>"); -- 2.33.1