From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by dpdk.org (Postfix) with ESMTP id 32DD61B3A0 for ; Mon, 9 Jul 2018 13:57:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1bZE+mkuG0rxOlp5tadMceaCFT0gldtNVk+vgAIRp3s=; b=yUGS7gWcaOFfmt2PQ4zrhtIvfuLZ+WcJomQECGwIuQha8sWC2O6CYn12ZNAnXZ9tY9MG8MK39EyTgKeV8l9x4Nh/SmoJuzMOEGUSWcKPx4GbKbAEB5w+P608ZiOxVvb+k0xdt/7lhWr7j/haO+GIniQdppPSq3q11TLP/YtJtQo= Received: from DB7PR05MB4426.eurprd05.prod.outlook.com (52.134.109.15) by DB7PR05MB4122.eurprd05.prod.outlook.com (52.134.107.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Mon, 9 Jul 2018 11:57:37 +0000 Received: from DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::d9c6:913c:c361:f7b7]) by DB7PR05MB4426.eurprd05.prod.outlook.com ([fe80::d9c6:913c:c361:f7b7%6]) with mapi id 15.20.0930.016; Mon, 9 Jul 2018 11:57:37 +0000 From: Shahaf Shuler To: Adrien Mazarguil CC: "dev@dpdk.org" Thread-Topic: [PATCH v4 09/10] net/mlx5: add parameter for port representors Thread-Index: AQHUFDyZ2IKBe6YD0kukdLKGlR6zcaSGzo+g Date: Mon, 9 Jul 2018 11:57:37 +0000 Message-ID: References: <20180704172322.22571-1-adrien.mazarguil@6wind.com> <20180705083934.5535-1-adrien.mazarguil@6wind.com> <20180705083934.5535-10-adrien.mazarguil@6wind.com> In-Reply-To: <20180705083934.5535-10-adrien.mazarguil@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR05MB4122; 7:NWk1IM8Qp7Pq1U0FvLrN7z033TYpmdpDV5jFlghrqU9L5ll0m50/bZI87GqT0sYKbSarcjrGCXAheIy0roGDrKZSZRk7KdLLcQ2WkrziesOb2hQSp2NZWw76opLodPHSh78bEjk33pKIJvzDNmxyQ/+pBtzdrz46hmkzgO+fg+9/axCUSauETJprzGHO/7o2ALcXFYti/ak7EcgQ2of4DuuMLmYBtBaNSTJbkfbdcovhdxZi2GF3u9/japX9JEGW x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 5d579c54-0bed-4f59-6979-08d5e5932a34 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB7PR05MB4122; x-ms-traffictypediagnostic: DB7PR05MB4122: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB7PR05MB4122; BCL:0; PCL:0; RULEID:; SRVR:DB7PR05MB4122; x-forefront-prvs: 07283408BE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39860400002)(136003)(396003)(189003)(199004)(8936002)(55016002)(81166006)(4326008)(81156014)(7736002)(25786009)(74316002)(305945005)(33656002)(478600001)(2906002)(8676002)(3846002)(6916009)(256004)(14454004)(6246003)(5660300001)(9686003)(6116002)(14444005)(53936002)(97736004)(476003)(486006)(7696005)(76176011)(102836004)(446003)(6506007)(99286004)(26005)(11346002)(186003)(68736007)(2900100001)(5250100002)(229853002)(575784001)(316002)(86362001)(6436002)(106356001)(105586002)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR05MB4122; H:DB7PR05MB4426.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: crzKR4M7VuSF0+Oyzc9CJ/2DrBgZDzLs8DkXkBdkktah1DPupr1OV63w2MfXVNZupxnKiX7OsyB+903Nn7BS1/zpV2rJ2ABIFtRAeVpV9KLdJxzYbidNkJfmR9yQXmve+OI0+xYFAljYJdqZ0qVlLpTuWdypTfdtdsLGLRSbAGoM49SnR11VIPdinjpcW3eJmvdgADwuM9/0Q/kjSgPWQWLq0IAbRwJ5prjCo/z0lnC60YqPIkZQhZPwPNls2+y7Yf27jlaE/MbLUJ588seJEL3wvoLJoHbJOLq1TSQVe+ukB2OFv7Ju+jsR2Av566i/lLqHJRi/8EUFsPkb2ED6ixckJztnZV8rkLuPxe1DPZ8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d579c54-0bed-4f59-6979-08d5e5932a34 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2018 11:57:37.2513 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4122 Subject: Re: [dpdk-dev] [PATCH v4 09/10] net/mlx5: add parameter for port representors 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: , X-List-Received-Date: Mon, 09 Jul 2018 11:57:38 -0000 Thursday, July 5, 2018 11:46 AM, Adrien Mazarguil: > Subject: [PATCH v4 09/10] net/mlx5: add parameter for port representors >=20 > Prior to this patch, all port representors detected on a given device wer= e > probed and Ethernet devices instantiated for each of them. >=20 > This patch adds support for the standard "representor" parameter, which > implies that port representors are not probed by default anymore, except > for the list provided through device arguments. >=20 > (Patch based on prior work from Yuanhan Liu) >=20 > Signed-off-by: Adrien Mazarguil > Reviewed-by: Xueming Li > -- > v3 changes: >=20 > - Adapted representor detection to the reworked mlx5_dev_spawn(). >=20 > v2 changes: >=20 > - Added error message for when rte_eth_devargs_parse() fails. > --- > doc/guides/nics/mlx5.rst | 12 ++++++++ > doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ > drivers/net/mlx5/mlx5.c | 41 ++++++++++++++++++++++++++-= - > 3 files changed, 52 insertions(+), 3 deletions(-) >=20 > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index > 7dd9c1c5e..0d0d21727 100644 > --- a/doc/guides/nics/mlx5.rst > +++ b/doc/guides/nics/mlx5.rst > @@ -392,6 +392,18 @@ Run-time configuration >=20 > Disabled by default. >=20 > +- ``representor`` parameter [list] > + > + This parameter can be used to instantiate DPDK Ethernet devices from > + existing port (or VF) representors configured on the device. > + > + It is a standard parameter whose format is described in > + :ref:`ethernet_device_standard_device_arguments`. > + > + For instance, to probe port representors 0 through 2:: > + > + representor=3D[0-2] > + > Firmware configuration > ~~~~~~~~~~~~~~~~~~~~~~ >=20 > diff --git a/doc/guides/prog_guide/poll_mode_drv.rst > b/doc/guides/prog_guide/poll_mode_drv.rst > index 4b69f6cbe..b2cf48354 100644 > --- a/doc/guides/prog_guide/poll_mode_drv.rst > +++ b/doc/guides/prog_guide/poll_mode_drv.rst > @@ -360,6 +360,8 @@ Ethernet Device API >=20 > The Ethernet device API exported by the Ethernet PMDs is described in th= e > *DPDK API Reference*. >=20 > +.. _ethernet_device_standard_device_arguments: > + > Ethernet Device Standard Device Arguments > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >=20 > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index > 6592480bf..12a77afa8 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -92,6 +92,9 @@ > /* Activate Netlink support in VF mode. */ #define MLX5_VF_NL_EN > "vf_nl_en" >=20 > +/* Select port representors to instantiate. */ #define MLX5_REPRESENTOR > +"representor" > + > #ifndef HAVE_IBV_MLX5_MOD_MPW > #define MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED (1 << 2) #define > MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW (1 << 3) @@ -443,6 +446,9 > @@ mlx5_args_check(const char *key, const char *val, void *opaque) > struct mlx5_dev_config *config =3D opaque; > unsigned long tmp; >=20 > + /* No-op, port representors are processed in mlx5_dev_spawn(). */ > + if (!strcmp(MLX5_REPRESENTOR, key)) > + return 0; > errno =3D 0; > tmp =3D strtoul(val, NULL, 0); > if (errno) { > @@ -515,6 +521,7 @@ mlx5_args(struct mlx5_dev_config *config, struct > rte_devargs *devargs) > MLX5_RX_VEC_EN, > MLX5_L3_VXLAN_EN, > MLX5_VF_NL_EN, > + MLX5_REPRESENTOR, > NULL, > }; > struct rte_kvargs *kvlist; > @@ -672,7 +679,9 @@ mlx5_uar_init_secondary(struct rte_eth_dev *dev) > * > * @return > * A valid Ethernet device object on success, NULL otherwise and rte_e= rrno > - * is set. > + * is set. The following error is defined: > + * > + * EBUSY: device is not supposed to be spawned. > */ > static struct rte_eth_dev * > mlx5_dev_spawn(struct rte_device *dpdk_dev, @@ -723,6 +732,26 @@ > mlx5_dev_spawn(struct rte_device *dpdk_dev, > int own_domain_id =3D 0; > unsigned int i; >=20 > + /* Determine if this port representor is supposed to be spawned. */ > + if (switch_info->representor && dpdk_dev->devargs) { > + struct rte_eth_devargs eth_da; > + > + err =3D rte_eth_devargs_parse(dpdk_dev->devargs->args, > ð_da); > + if (err) { > + rte_errno =3D -err; > + DRV_LOG(ERR, "failed to process device arguments: > %s", > + strerror(rte_errno)); > + return NULL; > + } > + for (i =3D 0; i < eth_da.nb_representor_ports; ++i) > + if (eth_da.representor_ports[i] =3D=3D > + (uint16_t)switch_info->port_name) > + break; > + if (i =3D=3D eth_da.nb_representor_ports) { > + rte_errno =3D EBUSY; Why EBUSY is the correct errno? Will another attempts to probe the device c= an be successful?=20 > + return NULL; > + } > + } > /* Prepare shared data between primary and secondary process. */ > mlx5_prepare_shared_data(); > errno =3D 0; > @@ -1343,8 +1372,12 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, >=20 > list[i].eth_dev =3D mlx5_dev_spawn > (&pci_dev->device, list[i].ibv_dev, vf, &list[i].info); > - if (!list[i].eth_dev) > - break; > + if (!list[i].eth_dev) { > + if (rte_errno !=3D EBUSY) > + break; > + /* Device is disabled, ignore it. */ > + continue; > + } > restore =3D list[i].eth_dev->data->dev_flags; > rte_eth_copy_pci_info(list[i].eth_dev, pci_dev); > /* Restore non-PCI flags cleared by the above call. */ @@ - > 1370,6 +1403,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv > __rte_unused, > ret =3D -rte_errno; > /* Roll back. */ > while (i--) { > + if (!list[i].eth_dev) > + continue; > mlx5_dev_close(list[i].eth_dev); > if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > rte_free(list[i].eth_dev->data- > >dev_private); > -- > 2.11.0