From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01hn0220.outbound.protection.outlook.com [104.47.2.220]) by dpdk.org (Postfix) with ESMTP id 12AB41BB22 for ; Sat, 7 Apr 2018 16:34:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JtdhOH08PwQxMxAwjpIz8KDYxz3IWq5yRA9Fhf0ViI4=; b=cOpZ/RsxuBbr2paNg8/2y1v+a4GAuSj5gtkqGRkFcD2UV5RC57Ciil34n+X7c/cgRkfwSUPIzR8LkKuW3jjSW0omDv9h2jcIDVqlscxh6grWeSXZQfNfAvQ+padYnRa6fRvOOAdPHNWaIXeqE7pmwHmsvkQYS+lT3fZnHxvCBFg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by DB6PR0401MB2424.eurprd04.prod.outlook.com (2603:10a6:4:4a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Sat, 7 Apr 2018 14:34:56 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Sat, 7 Apr 2018 20:04:01 +0530 Message-Id: <1523111645-8076-6-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1523111645-8076-1-git-send-email-nipun.gupta@nxp.com> References: <1519292089-13851-1-git-send-email-nipun.gupta@nxp.com> <1523111645-8076-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR0101CA0017.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::27) To DB6PR0401MB2424.eurprd04.prod.outlook.com (2603:10a6:4:4a::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb9f453a-1ce6-49c6-39b0-08d59c94bc51 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0401MB2424; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2424; 3:FQgynMJWo3V1yXaeFLQvBFR3Uv1iLgQdZPPyAWCbeJOp+6v5pOtX8z1IPbD2T55cd+5kvr4QPxRbJkRSHB0lrnpQ6N1egO+z0U5JaJnIPkbfh5k6wjV9Q0bwJAuKrDhCBwrXfMODoWMTdNEIhTPWbzWQle9k4ksAdpyMaAdRU+GN/uhX2wLE+OfUQl3EjWhoewx9J2CQXkWKeF+RHgE0939ZNZMKyRXuT0vBeFKJTx/DuoosOSVLTbGgV6hdhRP0; 25:NEYSOMwmT+dS8e1OQYKVXpKxfWlNoMGLsj6SyqbOU75YPyK6F0O94M0r3j/mWfiB1qY/0BYgqSONHxVddtaJ1M80inZDXHpdnasuZpSZEIaub7jWtD1hFfOJ6Aijhw+I+znX+BpxHWDf/kkHKnngCiTA2n0s/fwKc+NEaT/yOEInQS6cbN07Galg/WMULL/0ULD+h7RzTk1jS1tXprbh/NQyTYFHHv2XHWenBJxClkrGKM9va5PXxfz1kLrH0sEDvHky0Z9ZezdZpY1naXmP1MNsw0sqtCjrDmZKVoPuV5uO4viKMOn85OrAQueJOMA++XLxK5IIenlb2Bx/53MiHA==; 31:4rjfGFqHPd0lUbWIfBTGm/i5mgm6+kXvRtFDI6tJ6hSF3k8rj2y7Z9iv6j0IbocsBysCHHUzWCKTFgMkc37SFlA8E1pFW9w8tjEx1f3hpfrZAQ43BCUmBnQ3Vq/qFievaZKpAn/mbfRt0mTVBTZnHA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ft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(66839620246622)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231221)(2232076)(944501327)(52105095)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB6PR0401MB2424; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0401MB2424; X-Forefront-PRVS: 0635D5275E X-Forefront-Antispam-Report: SFV:SPM; SFS:(10009020)(979002)(396003)(39380400002)(366004)(376002)(346002)(39860400002)(189003)(199004)(105586002)(26005)(446003)(5009440100003)(48376002)(50226002)(186003)(16526019)(53936002)(47776003)(50466002)(52116002)(476003)(6486002)(36756003)(76176011)(305945005)(575784001)(86362001)(66066001)(6512007)(6116002)(2616005)(51416003)(956004)(2906002)(16586007)(3846002)(4326008)(7736002)(8936002)(478600001)(81156014)(81166006)(486006)(11346002)(5660300001)(97736004)(316002)(6636002)(55236004)(6666003)(59450400001)(8676002)(25786009)(386003)(106356001)(6506007)(68736007)(59010400001)(110426004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1501; SCL:5; SRVR:DB6PR0401MB2424; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0401MB2424; 23:VDgS+DmDXAZFrXP/exe5vmcEJEza7+oSasNA+0U?= =?us-ascii?Q?47CXgvN3zQRRmejaUP0pQASF/zdA5lmOdP8hOdkBWCh60+Fw8yCl5qUrL7Kn?= =?us-ascii?Q?znAqR3CwzvwY6//jn8fKjibBh1KIAxO8UG3Gr21kR7vmOBAbMsd6yqEycz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79f7J8ztdVdvLmJX3rvpHJh66ZDfI46Yt8d2koWv2nJ4X0Q3zIC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2018 14:34:56.0388 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb9f453a-1ce6-49c6-39b0-08d59c94bc51 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2424 Subject: [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 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: Sat, 07 Apr 2018 14:34:58 -0000 Signed-off-by: Nipun Gupta --- MAINTAINERS | 8 ++ config/common_base | 1 + config/common_linuxapp | 1 + drivers/raw/Makefile | 3 + drivers/raw/dpaa2_cmdif/Makefile | 33 +++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 139 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 ++++++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + mk/rte.app.mk | 1 + 9 files changed, 225 insertions(+) create mode 100644 drivers/raw/dpaa2_cmdif/Makefile create mode 100644 drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c create mode 100644 drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map diff --git a/MAINTAINERS b/MAINTAINERS index ed3251d..e97da7f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -726,6 +726,14 @@ F: doc/guides/cryptodevs/zuc.rst F: doc/guides/cryptodevs/features/zuc.ini +Rawdev Drivers +-------------- + +DPAA2 CMDIF +M: Nipun Gupta +F: drivers/raw/dpaa2_cmdif/ + + Eventdev Drivers ---------------- M: Jerin Jacob diff --git a/config/common_base b/config/common_base index c09c7cf..9c4361f 100644 --- a/config/common_base +++ b/config/common_base @@ -191,6 +191,7 @@ CONFIG_RTE_LIBRTE_DPAA2_USE_PHYS_IOVA=y # CONFIG_RTE_LIBRTE_DPAA2_PMD=n CONFIG_RTE_LIBRTE_DPAA2_DEBUG_DRIVER=n +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=n # # Compile burst-oriented Amazon ENA PMD driver diff --git a/config/common_linuxapp b/config/common_linuxapp index d0437e5..f25b3ea 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -37,3 +37,4 @@ CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y CONFIG_RTE_LIBRTE_DPAA2_PMD=y CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index da7c8b4..de3e662 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -5,5 +5,8 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$() += DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += skeleton_rawdev +ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF) += dpaa2_cmdif +endif include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile new file mode 100644 index 0000000..1d91d0c --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_pmd_dpaa2_cmdif.a + +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) + +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include + +LDLIBS += -lrte_bus_fslmc +LDLIBS += -lrte_eal +LDLIBS += -lrte_rawdev +LDLIBS += -lrte_bus_vdev +LDLIBS += -lrte_kvargs + +EXPORT_MAP := rte_pmd_dpaa2_cmdif_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF) += dpaa2_cmdif.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c new file mode 100644 index 0000000..0d98d36 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -0,0 +1,139 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "rte_pmd_dpaa2_cmdif.h" +#include "dpaa2_cmdif_logs.h" + +/* Dynamic log type identifier */ +int dpaa2_cmdif_logtype; + +/* CMDIF driver name */ +#define DPAA2_CMDIF_PMD_NAME dpaa2_dpci + +/* CMDIF driver object */ +static struct rte_vdev_driver dpaa2_cmdif_drv; + +static const struct rte_rawdev_ops dpaa2_cmdif_ops = { +}; + +static int +dpaa2_cmdif_create(const char *name, + struct rte_vdev_device *vdev, + int socket_id) +{ + struct rte_rawdev *rawdev; + struct dpaa2_dpci_dev *cidev; + + /* Allocate device structure */ + rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct dpaa2_dpci_dev), + socket_id); + if (!rawdev) { + DPAA2_CMDIF_ERR("Unable to allocate rawdevice"); + return -EINVAL; + } + + rawdev->dev_ops = &dpaa2_cmdif_ops; + rawdev->device = &vdev->device; + rawdev->driver_name = vdev->device.driver->name; + + /* For secondary processes, the primary has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + cidev = rte_dpaa2_alloc_dpci_dev(); + if (!cidev) { + DPAA2_CMDIF_ERR("Unable to allocate CI device"); + rte_rawdev_pmd_release(rawdev); + return -ENODEV; + } + + rawdev->dev_private = cidev; + + return 0; +} + +static int +dpaa2_cmdif_destroy(const char *name) +{ + int ret; + struct rte_rawdev *rdev; + + rdev = rte_rawdev_pmd_get_named_dev(name); + if (!rdev) { + DPAA2_CMDIF_ERR("Invalid device name (%s)", name); + return -EINVAL; + } + + /* The primary process will only free the DPCI device */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_dpaa2_free_dpci_dev(rdev->dev_private); + + ret = rte_rawdev_pmd_release(rdev); + if (ret) + DPAA2_CMDIF_DEBUG("Device cleanup failed"); + + return 0; +} + +static int +dpaa2_cmdif_probe(struct rte_vdev_device *vdev) +{ + const char *name; + int ret = 0; + + name = rte_vdev_device_name(vdev); + + DPAA2_CMDIF_INFO("Init %s on NUMA node %d", name, rte_socket_id()); + + ret = dpaa2_cmdif_create(name, vdev, rte_socket_id()); + + return ret; +} + +static int +dpaa2_cmdif_remove(struct rte_vdev_device *vdev) +{ + const char *name; + int ret; + + name = rte_vdev_device_name(vdev); + + DPAA2_CMDIF_INFO("Closing %s on NUMA node %d", name, rte_socket_id()); + + ret = dpaa2_cmdif_destroy(name); + + return ret; +} + +static struct rte_vdev_driver dpaa2_cmdif_drv = { + .probe = dpaa2_cmdif_probe, + .remove = dpaa2_cmdif_remove +}; + +RTE_PMD_REGISTER_VDEV(DPAA2_CMDIF_PMD_NAME, dpaa2_cmdif_drv); + +RTE_INIT(dpaa2_cmdif_init_log); + +static void +dpaa2_cmdif_init_log(void) +{ + dpaa2_cmdif_logtype = rte_log_register("dpaa2.cmdif"); + if (dpaa2_cmdif_logtype >= 0) + rte_log_set_level(dpaa2_cmdif_logtype, RTE_LOG_INFO); +} diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h new file mode 100644 index 0000000..5eb0885 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __DPAA2_CMDIF_LOGS_H__ +#define __DPAA2_CMDIF_LOGS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +extern int dpaa2_cmdif_logtype; + +#define DPAA2_CMDIF_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "%s(): " fmt "\n", \ + __func__, ##args) + +#define DPAA2_CMDIF_FUNC_TRACE() DPAA2_CMDIF_LOG(DEBUG, ">>") + +#define DPAA2_CMDIF_DEBUG(fmt, args...) \ + DPAA2_CMDIF_LOG(DEBUG, fmt, ## args) +#define DPAA2_CMDIF_INFO(fmt, args...) \ + DPAA2_CMDIF_LOG(INFO, fmt, ## args) +#define DPAA2_CMDIF_ERR(fmt, args...) \ + DPAA2_CMDIF_LOG(ERR, fmt, ## args) +#define DPAA2_CMDIF_WARN(fmt, args...) \ + DPAA2_CMDIF_LOG(WARNING, fmt, ## args) + +#ifdef __cplusplus +} +#endif + +#endif /* __DPAA2_CMDIF_LOGS_H__ */ diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map new file mode 100644 index 0000000..9b9ab1a --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map @@ -0,0 +1,4 @@ +DPDK_18.05 { + + local: *; +}; diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 2585908..a6828c8 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -245,6 +245,7 @@ endif # CONFIG_RTE_LIBRTE_EVENTDEV ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF) += -lrte_pmd_dpaa2_cmdif endif # CONFIG_RTE_LIBRTE_RAWDEV -- 1.9.1