From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1D03CA0563;
	Tue, 10 Mar 2020 03:19:46 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id C13651BFF4;
	Tue, 10 Mar 2020 03:19:45 +0100 (CET)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id 7A2711BFED
 for <dev@dpdk.org>; Tue, 10 Mar 2020 03:19:43 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
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 19:19:42 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.70,535,1574150400"; d="scan'208";a="442990402"
Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201])
 by fmsmga006.fm.intel.com with ESMTP; 09 Mar 2020 19:19:42 -0700
Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by
 FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Mon, 9 Mar 2020 19:19:42 -0700
Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by
 SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.1713.5; Tue, 10 Mar 2020 10:19:39 +0800
Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by
 SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004;
 Tue, 10 Mar 2020 10:19:39 +0800
From: "Wang, Haiyue" <haiyue.wang@intel.com>
To: "Ye, Xiaolong" <xiaolong.ye@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "Zhang, Qi Z" <qi.z.zhang@intel.com>,
 "Yang, Qiming" <qiming.yang@intel.com>, "Xing, Beilei"
 <beilei.xing@intel.com>, "Zhao1, Wei" <wei.zhao1@intel.com>
Thread-Topic: [PATCH v1 1/4] net/iavf: stop the PCI probe in DCF mode
Thread-Index: AQHV9h4qELUmTI3eKkmDFxPZ1ksLgqg/3ySAgAE4b+A=
Date: Tue, 10 Mar 2020 02:19:39 +0000
Message-ID: <24f139630bb94961b3c4f0f9dd88ca64@intel.com>
References: <20200309141437.11800-1-haiyue.wang@intel.com>
 <20200309141437.11800-2-haiyue.wang@intel.com>
 <20200309153813.GC112283@intel.com>
In-Reply-To: <20200309153813.GC112283@intel.com>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-reaction: no-action
dlp-version: 11.2.0.6
x-originating-ip: [10.239.127.36]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Monday, March 9, 2020 23:38
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qimin=
g.yang@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhao1, Wei <wei.zhao1@intel.com>
> Subject: Re: [PATCH v1 1/4] net/iavf: stop the PCI probe in DCF mode
>=20
> 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=3Ddcf', then it will stop the PCI probe in the iavf PMD.
> >
> >Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> >---
> > 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_ethd=
ev.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 =3D arg;
> >+
> >+	if (arg =3D=3D NULL || value =3D=3D NULL)
> >+		return -EINVAL;
> >+
> >+	if (strcmp(value, "dcf") =3D=3D 0)
> >+		*dcf =3D true;
> >+	else
> >+		*dcf =3D false;
> >+
> >+	return 0;
> >+}
> >+
> >+static bool
> >+check_cap_dcf_enable(struct rte_devargs *devargs)
> >+{
> >+	struct rte_kvargs *kvlist;
> >+	bool enable =3D false;
> >+
> >+	if (devargs =3D=3D NULL)
> >+		return false;
> >+
> >+	kvlist =3D rte_kvargs_parse(devargs->args, NULL);
> >+	if (kvlist =3D=3D NULL)
> >+		return false;
> >+
> >+	rte_kvargs_process(kvlist, "cap", handle_dcf_arg, &enable);
>=20
> Need error handling for failure case.
>  =20

We just need the 'cap=3Ddcf' to check whether it is true, by default
'enable=3Dfalse' can handle all the cases. ;-)

> >+
> >+	rte_kvargs_free(kvlist);
> >+
> >+	return enable;
> >+}
> >+
> > static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unus=
ed,
> > 			     struct rte_pci_device *pci_dev)
> > {
> >+	if (check_cap_dcf_enable(pci_dev->device.devargs))
> >+		return 1; /* continue to probe */
>=20
> This comment is confusing...

Yes, it should be like 'stop this driver probe to scan the next one'.

>=20
> >+
> > 	return rte_eth_dev_pci_generic_probe(pci_dev,
> > 		sizeof(struct iavf_adapter), iavf_dev_init);
> > }
> >@@ -1439,6 +1479,7 @@ static struct rte_pci_driver rte_iavf_pmd =3D {
> > RTE_PMD_REGISTER_PCI(net_iavf, rte_iavf_pmd);
> > RTE_PMD_REGISTER_PCI_TABLE(net_iavf, pci_id_iavf_map);
> > RTE_PMD_REGISTER_KMOD_DEP(net_iavf, "* igb_uio | vfio-pci");
> >+RTE_PMD_REGISTER_PARAM_STRING(net_iavf, "cap=3Ddcf");
> > RTE_INIT(iavf_init_log)
> > {
> > 	iavf_logtype_init =3D rte_log_register("pmd.net.iavf.init");
> >--
> >2.25.1
> >