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 A2C2FA0563; Tue, 10 Mar 2020 04:40:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E73091BFFA; Tue, 10 Mar 2020 04:40:22 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id C58AC1BFF6 for ; Tue, 10 Mar 2020 04:40:20 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2020 20:40:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,535,1574150400"; d="scan'208";a="443006250" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga006.fm.intel.com with ESMTP; 09 Mar 2020 20:40:18 -0700 Date: Tue, 10 Mar 2020 11:37:49 +0800 From: Ye Xiaolong To: "Wang, Haiyue" Cc: "dev@dpdk.org" , "Zhang, Qi Z" , "Yang, Qiming" , "Xing, Beilei" , "Zhao1, Wei" Message-ID: <20200310033749.GA6272@intel.com> References: <20200309141437.11800-1-haiyue.wang@intel.com> <20200309141437.11800-2-haiyue.wang@intel.com> <20200309153813.GC112283@intel.com> <24f139630bb94961b3c4f0f9dd88ca64@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24f139630bb94961b3c4f0f9dd88ca64@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v1 1/4] net/iavf: stop the PCI probe in DCF mode 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" On 03/10, Wang, Haiyue wrote: >> -----Original Message----- >> From: Ye, Xiaolong >> Sent: Monday, March 9, 2020 23:38 >> To: Wang, Haiyue >> Cc: dev@dpdk.org; Zhang, Qi Z ; Yang, Qiming ; Xing, >> Beilei ; Zhao1, Wei >> Subject: Re: [PATCH v1 1/4] net/iavf: stop the PCI probe in DCF mode >> >> On 03/09, Haiyue Wang wrote: >> >A new DCF PMD will be introduced, which runs on Intel VF hardware, and >> >it is a pure software design to control the advance functionality (such >> >as switch, ACL) for rest of the VFs. >> > >> >So if the DCF (Device Config Function) mode is specified by the devarg >> >'cap=dcf', then it will stop the PCI probe in the iavf PMD. >> > >> >Signed-off-by: Haiyue Wang >> >--- >> > drivers/net/iavf/iavf_ethdev.c | 41 ++++++++++++++++++++++++++++++++++ >> > 1 file changed, 41 insertions(+) >> > >> >diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c >> >index 34913f9c4..8ff26c0e7 100644 >> >--- a/drivers/net/iavf/iavf_ethdev.c >> >+++ b/drivers/net/iavf/iavf_ethdev.c >> >@@ -1416,9 +1416,49 @@ iavf_dev_uninit(struct rte_eth_dev *dev) >> > return 0; >> > } >> > >> >+static int >> >+handle_dcf_arg(__rte_unused const char *key, const char *value, >> >+ __rte_unused void *arg) >> >+{ >> >+ bool *dcf = arg; >> >+ >> >+ if (arg == NULL || value == NULL) >> >+ return -EINVAL; >> >+ >> >+ if (strcmp(value, "dcf") == 0) >> >+ *dcf = true; >> >+ else >> >+ *dcf = false; >> >+ >> >+ return 0; >> >+} >> >+ >> >+static bool >> >+check_cap_dcf_enable(struct rte_devargs *devargs) >> >+{ >> >+ struct rte_kvargs *kvlist; >> >+ bool enable = false; >> >+ >> >+ if (devargs == NULL) >> >+ return false; >> >+ >> >+ kvlist = rte_kvargs_parse(devargs->args, NULL); >> >+ if (kvlist == NULL) >> >+ return false; >> >+ >> >+ rte_kvargs_process(kvlist, "cap", handle_dcf_arg, &enable); >> >> Need error handling for failure case. >> > >We just need the 'cap=dcf' to check whether it is true, by default >'enable=false' can handle all the cases. ;-) > Yes, from function point of view, this could work. But it is still good practice to check the return value of the function. Thanks, Xiaolong