From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id 3B8805922 for ; Wed, 25 Jun 2014 15:54:35 +0200 (CEST) Received: by mail-wi0-f176.google.com with SMTP id n3so7928751wiv.3 for ; Wed, 25 Jun 2014 06:54:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=+qOP4U756lrIJRc9esYcaPUzc3QpuTYo9+bOcVnRUtU=; b=VLkADQK/HJeK52U8+cQKVLz7CZgZBbTWJyM2CXc6BvqKLEty+uv4lIEHk9sqK2wuDf 4scq0gtn/gF6t7xpxCFO2QHWIAphcUQ5OJJr0a/u/L7S4lFefxZB6MdkH5k3/KjYHOyR AU3SrZxm9KM0xuGYiWl8ybXFBTVRPre/PkOiVZeTIEpdTvzNSijOoK64BX4CFFU8mAb/ onnfT23s8bHWs4o+cie6iT9x9Bfyudo+DzRJ6ydYKhIQDHCFx8q63zrR0xoWjZZ94veF NYpmgxANwQP7rqHFwaF3yxoRjDcV93PEgnF4zF3W7HL16mbtj3VKhJ/2jtHk/5lZOT77 jP2w== X-Gm-Message-State: ALoCoQn+uig7dCCznmH4Fz3gvMGGm9Vl44TaFClPV5j9yAMZ3q4AyYuYOvG4g5hDlYv4cs2/0ihc X-Received: by 10.180.79.201 with SMTP id l9mr10657820wix.60.1403704489438; Wed, 25 Jun 2014 06:54:49 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id fh5sm54047077wic.9.2014.06.25.06.54.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jun 2014 06:54:48 -0700 (PDT) From: Thomas Monjalon To: Declan Doherty Date: Wed, 25 Jun 2014 15:54:43 +0200 Message-ID: <6725316.vIZR3J0FYH@xps13> Organization: 6WIND User-Agent: KMail/4.13.1 (Linux/3.14.6-1-ARCH; KDE/4.13.1; x86_64; ; ) In-Reply-To: <1403625828-20956-4-git-send-email-declan.doherty@intel.com> References: <1403621531-30487-1-git-send-email-declan.doherty@intel.com> <1403625828-20956-4-git-send-email-declan.doherty@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v7 3/6] EAL support for link bonding device initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2014 13:54:35 -0000 Hi Declan, 2014-06-24 17:03, Declan Doherty: > Updating functionality in EAL to support adding link bonding > devices via =E2=80=93vdev option. Link bonding devices will be > initialized after all physical devices have been probed and > initialized. [...] > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -62,7 +62,7 @@ rte_eal_driver_unregister(struct rte_driver *driver= ) > } >=20 > int > -rte_eal_dev_init(void) > +rte_eal_dev_init(uint8_t init_pri) > { > =09struct rte_devargs *devargs; > =09struct rte_driver *driver; > @@ -80,30 +80,52 @@ rte_eal_dev_init(void) > =09=09=09continue; >=20 > =09=09TAILQ_FOREACH(driver, &dev_driver_list, next) { > -=09=09=09if (driver->type !=3D PMD_VDEV) > -=09=09=09=09continue; > +=09=09=09/* RTE_DEVTYPE_VIRTUAL can only be a virtual or bonded devi= ce, > +=09=09=09 * virtual devices are initialized pre PCI probing and bond= ed > +=09=09=09 * device are post pci probing */ > +=09=09=09if ((driver->type =3D=3D PMD_VDEV && init_pri =3D=3D > +=09=09=09=09=09PMD_INIT_PRE_PCI_PROBE) || > +=09=09=09=09(driver->type =3D=3D PMD_BDEV && init_pri =3D=3D > +=09=09=09=09=09=09PMD_INIT_POST_PCI_PROBE)) { >=20 > -=09=09=09/* search a driver prefix in virtual device name */ > -=09=09=09if (!strncmp(driver->name, devargs->virtual.drv_name, > -=09=09=09=09=09strlen(driver->name))) { > -=09=09=09=09driver->init(devargs->virtual.drv_name, > -=09=09=09=09=09devargs->args); > -=09=09=09=09break; > +=09=09=09=09/* search a driver prefix in virtual device name */ > +=09=09=09=09if (!strncmp(driver->name, devargs->virtual.drv_name, > +=09=09=09=09=09=09strlen(driver->name))) { > +=09=09=09=09=09printf("init (%u) %s\n", init_pri, devargs- >virtual.drv_name); > +=09=09=09=09=09driver->init(devargs->virtual.drv_name, > +=09=09=09=09=09=09devargs->args); > +=09=09=09=09=09break; > +=09=09=09=09} > =09=09=09} > =09=09} >=20 > -=09=09if (driver =3D=3D NULL) { > -=09=09=09rte_panic("no driver found for %s\n", > -=09=09=09=09 devargs->virtual.drv_name); > +=09=09/* If initializing pre PCI probe, then we don't expect a bonde= d=20 driver > +=09=09 * to be found */ > +=09=09if (init_pri =3D=3D PMD_INIT_PRE_PCI_PROBE && > +=09=09=09=09strncmp(RTE_PMD_BOND, devargs->virtual.drv_name, > +=09=09=09=09=09strlen(RTE_PMD_BOND)) !=3D 0) { > +=09=09=09if (driver =3D=3D NULL) { > +=09=09=09=09rte_panic("no driver found for virtual device %s\n", > +=09=09=09=09=09devargs->virtual.drv_name); > +=09=09=09} > +=09=09} else if (init_pri =3D=3D PMD_INIT_POST_PCI_PROBE && > +=09=09=09=09strncmp(RTE_PMD_BOND, devargs->virtual.drv_name, > +=09=09=09=09=09strlen(RTE_PMD_BOND)) =3D=3D 0) { > +=09=09=09if (driver =3D=3D NULL) { > +=09=09=09=09rte_panic("no driver found for bonded device %s\n", > +=09=09=09=09=09devargs->virtual.drv_name); > +=09=09=09} > =09=09} > =09} >=20 > -=09/* Once the vdevs are initalized, start calling all the pdev driv= ers */ > -=09TAILQ_FOREACH(driver, &dev_driver_list, next) { > -=09=09if (driver->type !=3D PMD_PDEV) > -=09=09=09continue; > -=09=09/* PDEV drivers don't get passed any parameters */ > -=09=09driver->init(NULL, NULL); > +=09/* Once the vdevs are initialized, start calling all the pdev dri= vers */ > +=09if (init_pri =3D=3D PMD_INIT_PRE_PCI_PROBE) { > +=09=09TAILQ_FOREACH(driver, &dev_driver_list, next) { > +=09=09=09if (driver->type !=3D PMD_PDEV) > +=09=09=09=09continue; > +=09=09=09/* PDEV drivers don't get passed any parameters */ > +=09=09=09driver->init(NULL, NULL); > +=09=09} > =09} > =09return 0; > } [...] > --- a/lib/librte_eal/linuxapp/eal/eal.c > +++ b/lib/librte_eal/linuxapp/eal/eal.c > @@ -75,6 +75,7 @@ > #include > #include > #include > +#include >=20 > #include "eal_private.h" > #include "eal_thread.h" > @@ -1097,7 +1098,7 @@ rte_eal_init(int argc, char **argv) > =09RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=3D%x)\n", > =09=09rte_config.master_lcore, (int)thread_id); >=20 > -=09if (rte_eal_dev_init() < 0) > +=09if (rte_eal_dev_init(PMD_INIT_PRE_PCI_PROBE) < 0) > =09=09rte_panic("Cannot init pmd devices\n"); >=20 > =09RTE_LCORE_FOREACH_SLAVE(i) { > @@ -1127,6 +1128,14 @@ rte_eal_init(int argc, char **argv) > =09rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); > =09rte_eal_mp_wait_lcore(); >=20 > +=09/* Probe & Initialize PCI devices */ > +=09if (rte_eal_pci_probe()) > +=09=09=09rte_panic("Cannot probe PCI\n"); > + > +=09/* Initialize any outstanding devices */ > +=09if (rte_eal_dev_init(PMD_INIT_POST_PCI_PROBE) < 0) > +=09=09rte_panic("Cannot init pmd devices\n"); > + > =09return fctret; > } Not sure to understand why you need to split rte_eal_dev_init() in 2 st= eps. Should it be possible to keep existing rte_eal_dev_init() behaviour and= makes=20 further initialization when calling rte_eth_dev_configure()? I've seen it's empty for bonding device: static int bond_ethdev_configure(struct rte_eth_dev *dev __rte_unused) { =09return 0; } Thanks --=20 Thomas