From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hemant Agrawal Subject: Re: [PATCH 10/32] net/dpaa2: introducing dpaa2 bus driver for fsl-mc bus Date: Wed, 7 Dec 2016 12:27:38 +0530 Message-ID: References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1480875447-23680-11-git-send-email-hemant.agrawal@nxp.com> <5858af6b-8fba-02f0-9a1d-0210ef113920@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , To: Ferruh Yigit , Return-path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0072.outbound.protection.outlook.com [104.47.33.72]) by dpdk.org (Postfix) with ESMTP id B02AE2C8 for ; Wed, 7 Dec 2016 07:57:47 +0100 (CET) In-Reply-To: <5858af6b-8fba-02f0-9a1d-0210ef113920@intel.com> 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 12/7/2016 1:19 AM, Ferruh Yigit wrote: > On 12/4/2016 6:17 PM, Hemant Agrawal wrote: >> The DPAA2 bus driver is a rte_bus driver which scans the fsl-mc bus. >> >> Signed-off-by: Hemant Agrawal >> --- >> drivers/net/Makefile | 2 +- >> drivers/net/dpaa2/Makefile | 60 ++++++++++++++ >> drivers/net/dpaa2/dpaa2_bus.c | 99 +++++++++++++++++++++++ >> drivers/net/dpaa2/rte_dpaa2.h | 121 ++++++++++++++++++++++++++++ >> drivers/net/dpaa2/rte_pmd_dpaa2_version.map | 4 + >> mk/rte.app.mk | 1 + >> 6 files changed, 286 insertions(+), 1 deletion(-) >> create mode 100644 drivers/net/dpaa2/Makefile >> create mode 100644 drivers/net/dpaa2/dpaa2_bus.c >> create mode 100644 drivers/net/dpaa2/rte_dpaa2.h >> create mode 100644 drivers/net/dpaa2/rte_pmd_dpaa2_version.map >> >> diff --git a/drivers/net/Makefile b/drivers/net/Makefile >> index bc93230..2bcf67b 100644 >> --- a/drivers/net/Makefile >> +++ b/drivers/net/Makefile >> @@ -55,7 +55,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx >> DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio >> DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 >> DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt >> - >> +DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 > > Add as alphabetically sorted manner please. > >> ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) >> DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost >> endif # $(CONFIG_RTE_LIBRTE_VHOST) >> diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile >> new file mode 100644 >> index 0000000..a99ce22 >> --- /dev/null >> +++ b/drivers/net/dpaa2/Makefile >> @@ -0,0 +1,60 @@ >> +# BSD LICENSE >> +# >> +# Copyright (c) 2016 NXP. All rights reserved. >> +# >> +# Redistribution and use in source and binary forms, with or without >> +# modification, are permitted provided that the following conditions >> +# are met: >> +# >> +# * Redistributions of source code must retain the above copyright >> +# notice, this list of conditions and the following disclaimer. >> +# * Redistributions in binary form must reproduce the above copyright >> +# notice, this list of conditions and the following disclaimer in >> +# the documentation and/or other materials provided with the >> +# distribution. >> +# * Neither the name of NXP nor the names of its >> +# contributors may be used to endorse or promote products derived >> +# from this software without specific prior written permission. >> +# >> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + >> +include $(RTE_SDK)/mk/rte.vars.mk >> + >> +# >> +# library name >> +# >> +LIB = librte_pmd_dpaa2.a >> + >> +CFLAGS += -O3 >> +CFLAGS += $(WERROR_FLAGS) >> + >> +CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2 >> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/ >> +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal > > Last two shouldn't be required. > >> + >> +# versioning export map >> +EXPORT_MAP := rte_pmd_dpaa2_version.map >> + >> +# library version >> +LIBABIVER := 1 >> + >> + >> +# Interfaces with DPDK >> +SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_bus.c >> + >> +# library dependencies >> +DEPDIRS-y += lib/librte_eal >> +DEPDIRS-y += drivers/common/dpaa/mc >> +DEPDIRS-y += drivers/common/dpaa/qbman > > Again for consistency, DEPDIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += > agree, will fix it in v2 >> + >> +include $(RTE_SDK)/mk/rte.lib.mk >> diff --git a/drivers/net/dpaa2/dpaa2_bus.c b/drivers/net/dpaa2/dpaa2_bus.c >> new file mode 100644 >> index 0000000..571066c >> --- /dev/null >> +++ b/drivers/net/dpaa2/dpaa2_bus.c >> @@ -0,0 +1,99 @@ >> +/*- >> + * BSD LICENSE >> + * >> + * Copyright (c) 2016 NXP. All rights reserved. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions >> + * are met: >> + * >> + * * Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * * Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in >> + * the documentation and/or other materials provided with the >> + * distribution. >> + * * Neither the name of NXP nor the names of its >> + * contributors may be used to endorse or promote products derived >> + * from this software without specific prior written permission. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + */ >> + >> +#include >> +#include >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "eal_filesystem.h" >> +#include "eal_private.h" >> + >> +void >> +rte_dpaa2_register(struct rte_dpaa2_driver *driver) >> +{ >> + struct rte_bus *bus; >> + >> + bus = rte_eal_get_bus("dpaa2"); >> + if (!bus) { >> + RTE_LOG(ERR, EAL, "DPAA2 bus not registered\n"); >> + return; >> + } >> + >> + rte_eal_bus_add_driver(bus, &driver->driver); >> +} >> + >> +void >> +rte_dpaa2_unregister(struct rte_dpaa2_driver *driver) >> +{ >> + struct rte_bus *bus; >> + >> + bus = driver->driver.bus; >> + if (!bus) { >> + RTE_LOG(ERR, EAL, "Unable to find bus for device\n"); >> + return; >> + } >> + >> + rte_eal_bus_remove_driver(&driver->driver); >> +} >> + >> +int rte_dpaa2_probe(struct rte_driver *driver __rte_unused, >> + struct rte_device *device __rte_unused) >> +{ >> + return 0; >> +} >> + >> +int rte_dpaa2_scan(struct rte_bus *bus_d __rte_unused) >> +{ >> + return 0; >> +} >> + >> +int rte_dpaa2_match(struct rte_driver *driver __rte_unused, >> + struct rte_device *device __rte_unused) >> +{ >> + return 0; >> +} >> + >> +struct rte_bus dpaa2_bus = { >> + .scan = rte_dpaa2_scan, >> + .match = rte_dpaa2_match, >> + .probe = rte_dpaa2_probe, >> +}; >> + >> +RTE_REGISTER_BUS(dpaa2, dpaa2_bus); >> diff --git a/drivers/net/dpaa2/rte_dpaa2.h b/drivers/net/dpaa2/rte_dpaa2.h >> new file mode 100644 >> index 0000000..b36eed8 >> --- /dev/null >> +++ b/drivers/net/dpaa2/rte_dpaa2.h >> @@ -0,0 +1,121 @@ >> +/*- >> + * BSD LICENSE >> + * >> + * Copyright (c) 2016 NXP. All rights reserved. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions >> + * are met: >> + * >> + * * Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * * Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in >> + * the documentation and/or other materials provided with the >> + * distribution. >> + * * Neither the name of NXP nor the names of its >> + * contributors may be used to endorse or promote products derived >> + * from this software without specific prior written permission. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + */ >> + >> +#ifndef _RTE_DPAA2_H_ >> +#define _RTE_DPAA2_H_ >> + >> +/** >> + * @file >> + * >> + * RTE DPAA2 Interface >> + */ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> +#include >> + >> + >> +struct rte_dpaa2_driver; >> +/** >> + * A structure describing a DPAA2 device. >> + */ >> +struct rte_dpaa2_device { >> + TAILQ_ENTRY(rte_dpaa2_device) next; /**< Next probed DPAA2 device. */ >> + struct rte_device device; /**< Inherit core device */ >> + uint16_t dev_type; /**< Device Type */ >> + uint16_t object_id; /**< DPAA2 Object ID */ >> + struct rte_intr_handle intr_handle; /**< Interrupt handle */ >> + struct rte_dpaa2_driver *driver; /**< Associated driver */ >> +}; >> + >> +/** >> + * A structure describing a DPAA2 driver. >> + */ >> +struct rte_dpaa2_driver { >> + TAILQ_ENTRY(rte_dpaa2_driver) next; /**< Next in list. */ >> + struct rte_driver driver; /**< Inherit core driver. */ >> + uint32_t drv_flags; /**< Flags contolling handling of device. */ >> +}; >> + >> +/** >> + * Register a DPAA2 driver. >> + * >> + * @param driver >> + * A pointer to a rte_dpaa2_driver structure describing the driver >> + * to be registered. >> + */ >> +void rte_dpaa2_register(struct rte_dpaa2_driver *driver); >> + >> +/** >> + * Unregister a DPAA2 driver. >> + * >> + * @param driver >> + * A pointer to a rte_dpaa2_driver structure describing the driver >> + * to be unregistered. >> + */ >> +void rte_dpaa2_unregister(struct rte_dpaa2_driver *driver); >> + >> +/** >> + * >> + */ >> +int rte_dpaa2_probe(struct rte_driver *driver, struct rte_device *device); >> +int rte_dpaa2_match(struct rte_driver *driver, struct rte_device *device); >> +int rte_dpaa2_scan(struct rte_bus *bus); > > Shouldn't these functions be static? agree, will fix it in v2 > >> + >> +/** Helper for DPAA2 device registration from driver (eth, crypto) instance */ >> +#define RTE_PMD_REGISTER_DPAA2(nm, dpaa2_drv) \ >> +RTE_INIT(dpaa2initfn_ ##nm); \ >> +static void dpaa2initfn_ ##nm(void) \ >> +{\ >> + (dpaa2_drv).driver.name = RTE_STR(nm);\ >> + rte_dpaa2_register(&dpaa2_drv); \ >> +} \ >> +RTE_PMD_EXPORT_NAME(nm, __COUNTER__) >> + >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif /* _RTE_DPAA2_H_ */ >> diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map >> new file mode 100644 >> index 0000000..31eca32 >> --- /dev/null >> +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map >> @@ -0,0 +1,4 @@ >> +DPDK_17.02 { >> + >> + local: *; >> +}; >> diff --git a/mk/rte.app.mk b/mk/rte.app.mk >> index f75f0e2..9e1c17c 100644 >> --- a/mk/rte.app.mk >> +++ b/mk/rte.app.mk >> @@ -101,6 +101,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile >> >> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond >> _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore >> +_LDLIBS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += -lrte_pmd_dpaa2 -ldpaa2_mc -ldpaa2_qbman > > This should go within no shared library case (below), in a sorted manner > please. > ok, will fix it in v2 > btw, for shared compilation, PMDs loaded dynamically, as plugins. For > dpaa case, there will be multiple libraries, not if it will work with > multiple -d params for each lib, it worth testing. > I will look into it. >> >> ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) >> # plugins (link only if static libraries) >> > >