From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v7 3/6] EAL support for link bonding device initialization Date: Wed, 25 Jun 2014 15:54:43 +0200 Message-ID: <6725316.vIZR3J0FYH@xps13> 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Cc: dev-VfR2kkLFssw@public.gmane.org To: Declan Doherty Return-path: In-Reply-To: <1403625828-20956-4-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 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