* [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver @ 2018-02-22 9:34 Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta ` (9 more replies) 0 siblings, 10 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta This patch set introduces DPAA2 based Command Interface device driver. This driver is provides communication between the GPP and AIOP Firmware. Patches 1-4: Makes necessary changes and fixes in the DPAA2 bus and mempool region Patches 5-7: Add the DPAA2 CMDIF driver Patches 8-9: Update the respective documentation Nipun Gupta (9): mempool/dpaa2: add functions exposed to DPDK applications bus/fslmc: expose API to free dpci device bus/fslmc: keep Tx queues information for DPCI devices too bus/fslmc: add preprocessors to get flc and frc from fd raw/dpaa2_cmdif: introduce DPAA2 command interface driver raw/dpaa2_cmdif: add attribute get functionality raw/dpaa2_cmdif: support enqueue dequeue operations doc: add DPAA2 CMDIF rawdev guide doc: add dpaa2 command interface rawdev to release notes MAINTAINERS | 7 + config/common_armv8a_linuxapp | 5 + config/common_base | 5 + config/defconfig_arm64-dpaa2-linuxapp-gcc | 6 + doc/api/doxy-api-index.md | 2 + doc/api/doxy-api.conf | 2 + doc/guides/rawdevs/dpaa2_cmdif.rst | 136 +++++++++ doc/guides/rel_notes/release_18_05.rst | 7 + drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 +++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 12 +- drivers/bus/fslmc/rte_bus_fslmc_version.map | 7 + drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 34 +++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 310 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + mk/rte.app.mk | 1 + 23 files changed, 749 insertions(+), 20 deletions(-) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h 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.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 1/9] mempool/dpaa2: add functions exposed to DPDK applications 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta ` (8 subsequent siblings) 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index d77f205..49fcec4 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -63,6 +63,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2] (@ref rte_dpaa2_mempool.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) - **memory**: diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index cda52fd..59cb580 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index efaac96..c9c2511 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -34,4 +34,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 2bd62e8..7d35530 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> +#include "rte_dpaa2_mempool.h" #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -233,6 +234,35 @@ } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_mempool.h> + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index a8aa685..b45e7a9 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -6,3 +6,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 2/9] bus/fslmc: expose API to free dpci device 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta ` (7 subsequent siblings) 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/rte_bus_fslmc_version.map | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index b7db074..c02b9c6 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -101,3 +101,10 @@ DPDK_18.02 { rte_fslmc_get_device_count; } DPDK_17.11; + +DPDK_18.05 { + global: + + rte_dpaa2_free_dpci_dev; + +} DPDK_18.02; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 3/9] bus/fslmc: keep Tx queues information for DPCI devices too 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta ` (6 subsequent siblings) 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta The DPCI devices have oth Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 ++++++++++++++++++++++++++------ drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/event/dpaa2/dpaa2_eventdev.c | 10 +++--- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index fb28e49..6c16e86 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -39,6 +39,7 @@ struct dpci_attr attr; struct dpci_rx_queue_cfg rx_queue_cfg; struct dpci_rx_queue_attr rx_attr; + struct dpci_tx_queue_attr tx_attr; int ret, i; /* Allocate DPAA2 dpci handle */ @@ -70,16 +71,38 @@ } /* Set up the Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); - ret = dpci_set_rx_queue(&dpci_node->dpci, - CMD_PRI_LOW, - dpci_node->token, - 0, &rx_queue_cfg); - if (ret) { - PMD_INIT_LOG(ERR, "Setting Rx queue failed with err code: %d", - ret); - rte_free(dpci_node); - return -1; + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); + ret = dpci_set_rx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, + i, &rx_queue_cfg); + if (ret) { + PMD_INIT_LOG(ERR, "Setting Rx queue failed with err code: %d", + ret); + rte_free(dpci_node); + return -1; + } + + /* Allocate DQ storage for the DPCI Rx queues */ + rxq = &(dpci_node->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + PMD_INIT_LOG(ERR, "q_storage allocation failed\n"); + rte_free(dpci_node); + return -ENOMEM; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + if (dpaa2_alloc_dq_storage(rxq->q_storage)) { + PMD_INIT_LOG(ERR, "dpaa2_alloc_dq_storage failed\n"); + rte_free(dpci_node); + return -ENOMEM; + } } /* Enable the device */ @@ -105,8 +128,20 @@ rte_free(dpci_node); return -1; } + dpci_node->rx_queue[i].fqid = rx_attr.fqid; - dpci_node->queue[i].fqid = rx_attr.fqid; + ret = dpci_get_tx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, i, + &tx_attr); + if (ret != 0) { + PMD_INIT_LOG(ERR, + "Reading device failed with err code: %d", + ret); + rte_free(dpci_node); + return -1; + } + dpci_node->tx_queue[i].fqid = tx_attr.fqid; } dpci_node->dpci_id = dpci_id; diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index d421dbf..3829988 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -142,7 +142,8 @@ struct dpaa2_dpci_dev { uint16_t token; rte_atomic16_t in_use; uint32_t dpci_id; /*HW ID for DPCI object */ - struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES]; }; /*! Global MCP list */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index c3e6fbf..77a0e1a 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -87,10 +87,10 @@ const struct rte_event *event = &ev[num_tx + loop]; if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; else - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; /* Prepare enqueue descriptor */ @@ -730,13 +730,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id; rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO; - dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = dpaa2_eventdev_process_parallel; - dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = dpaa2_eventdev_process_atomic; for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) { - rx_queue_cfg.user_ctx = (uint64_t)(&dpci_dev->queue[i]); + rx_queue_cfg.user_ctx = (uint64_t)(&dpci_dev->rx_queue[i]); ret = dpci_set_rx_queue(&dpci_dev->dpci, CMD_PRI_LOW, dpci_dev->token, i, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 4/9] bus/fslmc: add preprocessors to get flc and frc from fd 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (2 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta ` (5 subsequent siblings) 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta, stable This patch also fixes the typecasting in iova/virt conversion macros Fixes: df0011c92312 ("bus/fslmc: add physical-virtual address translation helpers") Cc: stable@dpdk.org Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 3829988..f8412c8 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -189,7 +189,7 @@ enum qbman_fd_format { ((fd)->simple.frc = (0x80000000 | (len))) #define DPAA2_GET_FD_FRC_PARSE_SUM(fd) \ ((uint16_t)(((fd)->simple.frc & 0xffff0000) >> 16)) -#define DPAA2_SET_FD_FRC(fd, frc) ((fd)->simple.frc = frc) +#define DPAA2_SET_FD_FRC(fd, _frc) ((fd)->simple.frc = _frc) #define DPAA2_RESET_FD_CTRL(fd) ((fd)->simple.ctrl = 0) #define DPAA2_SET_FD_ASAL(fd, asal) ((fd)->simple.ctrl |= (asal << 16)) @@ -226,6 +226,9 @@ enum qbman_fd_format { #define DPAA2_GET_FD_BPID(fd) (((fd)->simple.bpid_offset & 0x00003FFF)) #define DPAA2_GET_FD_IVP(fd) (((fd)->simple.bpid_offset & 0x00004000) >> 14) #define DPAA2_GET_FD_OFFSET(fd) (((fd)->simple.bpid_offset & 0x0FFF0000) >> 16) +#define DPAA2_GET_FD_FRC(fd) ((fd)->simple.frc) +#define DPAA2_GET_FD_FLC(fd) \ + (((uint64_t)((fd)->simple.flc_hi) << 32) + (fd)->simple.flc_lo) #define DPAA2_GET_FLE_OFFSET(fle) (((fle)->fin_bpid_offset & 0x0FFF0000) >> 16) #define DPAA2_SET_FLE_SG_EXT(fle) ((fle)->fin_bpid_offset |= (uint64_t)1 << 29) #define DPAA2_IS_SET_FLE_SG_EXT(fle) \ @@ -329,8 +332,8 @@ static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr) #define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_addr) #define DPAA2_OP_VADDR_TO_IOVA(op) (op) -#define DPAA2_VADDR_TO_IOVA(_vaddr) (_vaddr) -#define DPAA2_IOVA_TO_VADDR(_iova) (_iova) +#define DPAA2_VADDR_TO_IOVA(_vaddr) ((phys_addr_t)(_vaddr)) +#define DPAA2_IOVA_TO_VADDR(_iova) ((void *)(_iova)) #define DPAA2_MODIFY_IOVA_TO_VADDR(_mem, _type) #endif /* RTE_LIBRTE_DPAA2_USE_PHYS_IOVA */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (3 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 13:12 ` Shreyansh Jain 2018-02-22 14:31 ` Jerin Jacob 2018-02-22 9:34 ` [dpdk-dev] [PATCH 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta ` (4 subsequent siblings) 9 siblings, 2 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 6 + config/common_armv8a_linuxapp | 5 + config/common_base | 5 + config/defconfig_arm64-dpaa2-linuxapp-gcc | 6 + drivers/raw/Makefile | 1 + 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 + 10 files changed, 235 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 a646ca3..e06df3b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -725,6 +725,12 @@ F: drivers/crypto/zuc/ F: doc/guides/cryptodevs/zuc.rst F: doc/guides/cryptodevs/features/zuc.ini +Rawdev Drivers +-------------- + +DPAA2 CMDIF +M: Nipun Gupta <nipun.gupta@nxp.com> +F: drivers/raw/dpaa2_cmdif/ Eventdev Drivers ---------------- diff --git a/config/common_armv8a_linuxapp b/config/common_armv8a_linuxapp index 507b28a..32e3cfe 100644 --- a/config/common_armv8a_linuxapp +++ b/config/common_armv8a_linuxapp @@ -94,3 +94,8 @@ CONFIG_RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS=2048 # CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y CONFIG_RTE_DPAA2_SEC_PMD_MAX_NB_SESSIONS=2048 + +# +# Compile DPAA2 Command Intefrace driver +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y diff --git a/config/common_base b/config/common_base index ad03cf4..a549b54 100644 --- a/config/common_base +++ b/config/common_base @@ -587,6 +587,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y # +# Compile DPAA2 CMDIF support +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=n + +# # Compile librte_ring # CONFIG_RTE_LIBRTE_RING=y diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc index afdbc34..ce1ffc5 100644 --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc @@ -42,3 +42,9 @@ CONFIG_RTE_LIBRTE_DPAA2_DEBUG_TX_FREE=n CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_INIT=n CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_RX=n + +# +# Compile DPAA2 Command Intefrace driver +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y + diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index da7c8b4..129945b 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -5,5 +5,6 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$(<configuration>) += <directory> DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += skeleton_rawdev +DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF) += dpaa2_cmdif 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 <stdio.h> +#include <errno.h> +#include <stdint.h> + +#include <rte_bus_vdev.h> +#include <rte_atomic.h> +#include <rte_interrupts.h> +#include <rte_branch_prediction.h> +#include <rte_lcore.h> + +#include <rte_rawdev.h> +#include <rte_rawdev_pmd.h> + +#include <portal/dpaa2_hw_pvt.h> +#include <portal/dpaa2_hw_dpio.h> +#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 <rte_rawdev.h> + +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 3eb41d1..e82d965 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -230,6 +230,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 ifeq ($(CONFIG_RTE_LIBRTE_DPAA2_PMD),y) -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-02-22 9:34 ` [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-02-22 13:12 ` Shreyansh Jain 2018-02-23 6:35 ` Nipun Gupta 2018-02-22 14:31 ` Jerin Jacob 1 sibling, 1 reply; 71+ messages in thread From: Shreyansh Jain @ 2018-02-22 13:12 UTC (permalink / raw) To: Nipun Gupta; +Cc: thomas, hemant.agrawal, dev Hi Nipun, Some trivial inputs: On Thursday 22 February 2018 03:04 PM, Nipun Gupta wrote: > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > MAINTAINERS | 6 + > config/common_armv8a_linuxapp | 5 + > config/common_base | 5 + > config/defconfig_arm64-dpaa2-linuxapp-gcc | 6 + > drivers/raw/Makefile | 1 + > 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 + > 10 files changed, 235 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 a646ca3..e06df3b 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -725,6 +725,12 @@ F: drivers/crypto/zuc/ > F: doc/guides/cryptodevs/zuc.rst > F: doc/guides/cryptodevs/features/zuc.ini > > +Rawdev Drivers > +-------------- > + > +DPAA2 CMDIF > +M: Nipun Gupta <nipun.gupta@nxp.com> > +F: drivers/raw/dpaa2_cmdif/ I think you should put one more new line here. For all the sub-section for Maintainers, there are 2 new lines before new sub-section starts. > > Eventdev Drivers > ---------------- > diff --git a/config/common_armv8a_linuxapp b/config/common_armv8a_linuxapp > index 507b28a..32e3cfe 100644 > --- a/config/common_armv8a_linuxapp > +++ b/config/common_armv8a_linuxapp > @@ -94,3 +94,8 @@ CONFIG_RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS=2048 > # > CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y > CONFIG_RTE_DPAA2_SEC_PMD_MAX_NB_SESSIONS=2048 > + > +# > +# Compile DPAA2 Command Intefrace driver ^^^^^^^^^ Interface - spell mistake > +# > +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y > diff --git a/config/common_base b/config/common_base > index ad03cf4..a549b54 100644 > --- a/config/common_base > +++ b/config/common_base > @@ -587,6 +587,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 > CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y > > # > +# Compile DPAA2 CMDIF support > +# > +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=n > + > +# > # Compile librte_ring > # > CONFIG_RTE_LIBRTE_RING=y > diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc > index afdbc34..ce1ffc5 100644 > --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc > +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc > @@ -42,3 +42,9 @@ CONFIG_RTE_LIBRTE_DPAA2_DEBUG_TX_FREE=n > CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_INIT=n > CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_DRIVER=n > CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_RX=n > + > +# > +# Compile DPAA2 Command Intefrace driver > +# > +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y If already added in armv8a, why is it required in arm64-dpaa2 as well? Rawdevices are intended to be custom and I think they should be added only to the SoC specific configuration files. - Shreyansh ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-02-22 13:12 ` Shreyansh Jain @ 2018-02-23 6:35 ` Nipun Gupta 0 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-23 6:35 UTC (permalink / raw) To: Shreyansh Jain; +Cc: thomas, Hemant Agrawal, dev > -----Original Message----- > From: Shreyansh Jain > Sent: Thursday, February 22, 2018 18:42 > To: Nipun Gupta <nipun.gupta@nxp.com> > Cc: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > dev@dpdk.org > Subject: Re: [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command > interface driver > > Hi Nipun, > > Some trivial inputs: > > On Thursday 22 February 2018 03:04 PM, Nipun Gupta wrote: > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > > --- > > MAINTAINERS | 6 + > > config/common_armv8a_linuxapp | 5 + > > config/common_base | 5 + > > config/defconfig_arm64-dpaa2-linuxapp-gcc | 6 + > > drivers/raw/Makefile | 1 + > > 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 + > > 10 files changed, 235 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 a646ca3..e06df3b 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -725,6 +725,12 @@ F: drivers/crypto/zuc/ > > F: doc/guides/cryptodevs/zuc.rst > > F: doc/guides/cryptodevs/features/zuc.ini > > > > +Rawdev Drivers > > +-------------- > > + > > +DPAA2 CMDIF > > +M: Nipun Gupta <nipun.gupta@nxp.com> > > +F: drivers/raw/dpaa2_cmdif/ > > I think you should put one more new line here. For all the sub-section > for Maintainers, there are 2 new lines before new sub-section starts. Agree.. I'll take care in the next version. > > > > > Eventdev Drivers > > ---------------- > > diff --git a/config/common_armv8a_linuxapp > b/config/common_armv8a_linuxapp > > index 507b28a..32e3cfe 100644 > > --- a/config/common_armv8a_linuxapp > > +++ b/config/common_armv8a_linuxapp > > @@ -94,3 +94,8 @@ > CONFIG_RTE_DPAA_SEC_PMD_MAX_NB_SESSIONS=2048 > > # > > CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y > > CONFIG_RTE_DPAA2_SEC_PMD_MAX_NB_SESSIONS=2048 > > + > > +# > > +# Compile DPAA2 Command Intefrace driver > ^^^^^^^^^ > Interface - spell mistake Agree. I will update. > > > +# > > +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y > > diff --git a/config/common_base b/config/common_base > > index ad03cf4..a549b54 100644 > > --- a/config/common_base > > +++ b/config/common_base > > @@ -587,6 +587,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 > > CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y > > > > # > > +# Compile DPAA2 CMDIF support > > +# > > +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=n > > + > > +# > > # Compile librte_ring > > # > > CONFIG_RTE_LIBRTE_RING=y > > diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc > b/config/defconfig_arm64-dpaa2-linuxapp-gcc > > index afdbc34..ce1ffc5 100644 > > --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc > > +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc > > @@ -42,3 +42,9 @@ CONFIG_RTE_LIBRTE_DPAA2_DEBUG_TX_FREE=n > > CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_INIT=n > > CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_DRIVER=n > > CONFIG_RTE_LIBRTE_DPAA2_SEC_DEBUG_RX=n > > + > > +# > > +# Compile DPAA2 Command Intefrace driver > > +# > > +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF=y > > If already added in armv8a, why is it required in arm64-dpaa2 as well? > Rawdevices are intended to be custom and I think they should be added > only to the SoC specific configuration files. As I understand you suggest this to be part of only arm64-dpaa2 and not in armv8a? Thanks, Nipun > > - > Shreyansh ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-02-22 9:34 ` [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-02-22 13:12 ` Shreyansh Jain @ 2018-02-22 14:31 ` Jerin Jacob 2018-02-23 6:35 ` Nipun Gupta 1 sibling, 1 reply; 71+ messages in thread From: Jerin Jacob @ 2018-02-22 14:31 UTC (permalink / raw) To: Nipun Gupta; +Cc: thomas, hemant.agrawal, shreyansh.jain, dev -----Original Message----- > Date: Thu, 22 Feb 2018 15:04:45 +0530 > From: Nipun Gupta <nipun.gupta@nxp.com> > To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com > CC: dev@dpdk.org, Nipun Gupta <nipun.gupta@nxp.com> > Subject: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command > interface driver > X-Mailer: git-send-email 1.9.1 > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > MAINTAINERS | 6 + > config/common_armv8a_linuxapp | 5 + Please move this change to common config. We already agreed that you guys move the changes to common config in this release. I would like to avoid any compilation errors specific only to arm64 such as this https://dpdk.org/ml/archives/dev/2018-February/091336.html ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-02-22 14:31 ` Jerin Jacob @ 2018-02-23 6:35 ` Nipun Gupta 0 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-23 6:35 UTC (permalink / raw) To: Jerin Jacob; +Cc: thomas, Hemant Agrawal, Shreyansh Jain, dev > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Thursday, February 22, 2018 20:02 > To: Nipun Gupta <nipun.gupta@nxp.com> > Cc: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com>; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 > command interface driver > > -----Original Message----- > > Date: Thu, 22 Feb 2018 15:04:45 +0530 > > From: Nipun Gupta <nipun.gupta@nxp.com> > > To: thomas@monjalon.net, hemant.agrawal@nxp.com, > shreyansh.jain@nxp.com > > CC: dev@dpdk.org, Nipun Gupta <nipun.gupta@nxp.com> > > Subject: [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 > command > > interface driver > > X-Mailer: git-send-email 1.9.1 > > > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > > --- > > MAINTAINERS | 6 + > > config/common_armv8a_linuxapp | 5 + > > Please move this change to common config. > We already agreed that you guys move the changes to common config in > this release. Okay Jerin. We will look into this. Thanks, Nipun > > I would like to avoid any compilation errors specific only to arm64 > such as this > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdpdk.o > rg%2Fml%2Farchives%2Fdev%2F2018- > February%2F091336.html&data=02%7C01%7Cnipun.gupta%40nxp.com%7C631 > e2e423f7e4ee6d74908d57a01123c%7C686ea1d3bc2b4c6fa92cd99c5c301635% > 7C0%7C0%7C636549067385804564&sdata=dinNVoUori7dnl2PaviflV9FeR%2Bj7 > UUpjDexGaxAA60%3D&reserved=0 > > ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 6/9] raw/dpaa2_cmdif: add attribute get functionality 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (4 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta ` (3 subsequent siblings) 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index 0d98d36..9044489 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -29,7 +29,32 @@ /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; +/* + * This API provides the DPCI device ID in 'attr_value'. + * The device ID shall be passed by GPP to the AIOP using CMDIF commands. + */ +static int +dpaa2_cmdif_get_attr(struct rte_rawdev *dev, + const char *attr_name, + uint64_t *attr_value) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(attr_name); + + if (!attr_value) { + DPAA2_CMDIF_ERR("Invalid arguments for getting attributes"); + return -EINVAL; + } + *attr_value = cidev->dpci_id; + + return 0; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { + .attr_get = dpaa2_cmdif_get_attr, }; static int -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (5 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta ` (2 subsequent siblings) 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/raw/dpaa2_cmdif/Makefile | 2 + drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 146 ++++++++++++++++++++++++++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 ++++++ 5 files changed, 185 insertions(+) create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 49fcec4..b9f28be 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -64,6 +64,7 @@ The public API headers are grouped by topics: [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), [dpaa2] (@ref rte_dpaa2_mempool.h), + [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) - **memory**: diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 59cb580..88088d6 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -38,6 +38,7 @@ INPUT = doc/api/doxy-api-index.md \ drivers/net/i40e \ drivers/net/ixgbe \ drivers/net/softnic \ + drivers/raw/dpaa2_cmdif \ lib/librte_eal/common/include \ lib/librte_eal/common/include/generic \ lib/librte_acl \ diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile index 1d91d0c..c570827 100644 --- a/drivers/raw/dpaa2_cmdif/Makefile +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -30,4 +30,6 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF) += dpaa2_cmdif.c +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF)-include += rte_pmd_dpaa2_cmdif.h + 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 index 9044489..a166b91 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -53,8 +53,154 @@ return 0; } +static int +dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_send_cnxt; + struct dpaa2_queue *txq; + struct qbman_fd fd; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_send_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + txq = &(cidev->tx_queue[cmdif_send_cnxt->priority]); + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq->fqid); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + /* Set some of the FD parameters to i. + * For performance reasons do not memset + */ + fd.simple.bpid_offset = 0; + fd.simple.ctrl = 0; + + DPAA2_SET_FD_ADDR(&fd, buffers[0]->buf_addr); + DPAA2_SET_FD_LEN(&fd, cmdif_send_cnxt->size); + DPAA2_SET_FD_FRC(&fd, cmdif_send_cnxt->frc); + DPAA2_SET_FD_FLC(&fd, cmdif_send_cnxt->flc); + + /* Enqueue a packet to the QBMAN */ + do { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); + if (ret < 0 && ret != -EBUSY) + DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret); + } while (ret == -EBUSY); + + DPAA2_CMDIF_DEBUG("Successfully transmitted a packet\n"); + + return 0; +} + +static int +dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_rcv_cnxt; + struct dpaa2_queue *rxq; + struct qbman_swp *swp; + struct qbman_result *dq_storage; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + uint8_t status; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); + dq_storage = rxq->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); + qbman_pull_desc_set_numframes(&pulldesc, 1); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (dma_addr_t)dq_storage, 1); + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_CMDIF_ERR("VDQ cmd not issued. QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + /* + * Loop until the dq_storage is updated with + * new token by QBMAN + */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + + /* + * Check whether Last Pull command is Expired and + * setting Condition for Loop termination + */ + if (qbman_result_DQ_is_pull_complete(dq_storage)) { + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_CMDIF_DEBUG("No frame is delivered\n"); + return 0; + } + } + + /* + * Can avoid "qbman_result_is_DQ" check as + * we are not expecting Notification on this SW-Portal + */ + fd = qbman_result_DQ_fd(dq_storage); + + DPAA2_CMDIF_DEBUG("packet received\n"); + + buffers[0]->buf_addr = (void *)(DPAA2_GET_FD_ADDR(fd) + + DPAA2_GET_FD_OFFSET(fd)); + cmdif_rcv_cnxt->size = DPAA2_GET_FD_LEN(fd); + cmdif_rcv_cnxt->flc = DPAA2_GET_FD_FLC(fd); + cmdif_rcv_cnxt->frc = DPAA2_GET_FD_FRC(fd); + + return 1; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { .attr_get = dpaa2_cmdif_get_attr, + .enqueue_bufs = dpaa2_cmdif_enqueue_bufs, + .dequeue_bufs = dpaa2_cmdif_dequeue_bufs, }; static int diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h new file mode 100644 index 0000000..bd0a444 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_PMD_DPAA2_CMDIF_H__ +#define __RTE_PMD_DPAA2_CMDIF_H__ + +/** + * @file + * + * NXP dpaa2 AIOP CMDIF PMD specific functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** The context required in the I/O path for DPAA2 AIOP Command Interface */ +struct rte_dpaa2_cmdif_context { + /** Size to populate in QBMAN FD */ + uint32_t size; + /** FRC to populate in QBMAN FD */ + uint32_t frc; + /** FLC to populate in QBMAN FD */ + uint64_t flc; + /** Priority of the command. This priority determines DPCI Queue*/ + uint8_t priority; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_PMD_DPAA2_CMDIF_H__ */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 8/9] doc: add DPAA2 CMDIF rawdev guide 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (6 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 1 + doc/guides/rawdevs/dpaa2_cmdif.rst | 136 +++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst diff --git a/MAINTAINERS b/MAINTAINERS index e06df3b..140d4d4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -731,6 +731,7 @@ Rawdev Drivers DPAA2 CMDIF M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_cmdif/ +F: doc/guides/rawdevs/dpaa2_cmdif.rst Eventdev Drivers ---------------- diff --git a/doc/guides/rawdevs/dpaa2_cmdif.rst b/doc/guides/rawdevs/dpaa2_cmdif.rst new file mode 100644 index 0000000..43f4196 --- /dev/null +++ b/doc/guides/rawdevs/dpaa2_cmdif.rst @@ -0,0 +1,136 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2018 NXP + +NXP DPAA2 CMDIF Driver +====================== + +The DPAA2 CMDIF is an implementation of the rawdev API, that provides +communication between the GPP and AIOP (Firmware). This is achieved +via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + +More information can be found at `NXP Official Website +<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. + +Features +-------- + +The DPAA2 CMDIF implements following features in the rawdev API; + +- Getting the object ID of the device (DPCI) using attributes +- I/O to and from the AIOP device using DPCI + +Supported DPAA2 SoCs +-------------------- + +- LS2084A/LS2044A +- LS2088A/LS2048A +- LS1088A/LS1048A + +Prerequisites +------------- + +There are three main pre-requisities for executing DPAA2 CMDIF on a DPAA2 +compatible board: + +1. **ARM 64 Tool Chain** + + For example, the `*aarch64* Linaro Toolchain <https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu>`_. + +2. **Linux Kernel** + + It can be obtained from `NXP's Github hosting <https://github.com/qoriq-open-source/linux>`_. + +3. **Rootfile system** + + Any *aarch64* supporting filesystem can be used. For example, + Ubuntu 15.10 (Wily) or 16.04 LTS (Xenial) userland which can be obtained + from `here <http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.1-base-arm64.tar.gz>`_. + +As an alternative method, DPAA2 CMDIF can also be executed using images provided +as part of SDK from NXP. The SDK includes all the above prerequisites necessary +to bring up a DPAA2 board. + +The following dependencies are not part of DPDK and must be installed +separately: + +- **NXP Linux SDK** + + NXP Linux software development kit (SDK) includes support for family + of QorIQ® ARM-Architecture-based system on chip (SoC) processors + and corresponding boards. + + It includes the Linux board support packages (BSPs) for NXP SoCs, + a fully operational tool chain, kernel and board specific modules. + + SDK and related information can be obtained from: `NXP QorIQ SDK <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_. + +- **DPDK Extra Scripts** + + DPAA2 based resources can be configured easily with the help of ready scripts + as provided in the DPDK Extra repository. + + `DPDK Extras Scripts <https://github.com/qoriq-open-source/dpdk-extras>`_. + +Currently supported by DPDK: + +- NXP SDK **2.0+**. +- MC Firmware version **10.0.0** and higher. +- Supported architectures: **arm64 LE**. + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +.. note:: + + Some part of fslmc bus code (mc flib - object library) routines are + dual licensed (BSD & GPLv2). + +Pre-Installation Configuration +------------------------------ + +Config File Options +~~~~~~~~~~~~~~~~~~~ + +The following options can be modified in the ``config`` file. +Please note that enabling debugging options may affect system performance. + +- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_dpaa2_cmdif`` driver. + +Driver Compilation +~~~~~~~~~~~~~~~~~~ + +To compile the DPAA2 CMDIF PMD for Linux arm64 gcc target, run the +following ``make`` command: + +.. code-block:: console + + cd <DPDK-source-directory> + make config T=arm64-dpaa2-linuxapp-gcc install + +Initialization +-------------- + +The DPAA2 CMDIF is exposed as a vdev device which consists of dpci devices. +On EAL initialization, dpci devices will be probed and then vdev device +can be created from the application code by + +* Invoking ``rte_vdev_init("dpaa2_dpci")`` from the application + +* Using ``--vdev="dpaa2_dpci"`` in the EAL options, which will call + rte_vdev_init() internally + +Example: + +.. code-block:: console + + ./your_cmdif_application --vdev="dpaa2_dpci" + +Limitations +----------- + +Platform Requirement +~~~~~~~~~~~~~~~~~~~~ + +DPAA2 drivers for DPDK can only work on NXP SoCs as listed in the +``Supported DPAA2 SoCs``. -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 9/9] doc: add dpaa2 command interface rawdev to release notes 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (7 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-02-22 9:34 ` Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 9 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-02-22 9:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/guides/rel_notes/release_18_05.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index 3923dc2..db403eb 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -41,6 +41,13 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Added DPAA2 Command Interface Driver (in rawdev).** + + The DPAA2 CMDIF is an implementation of the rawdev API, that provides + communication between the GPP and AIOP (Firmware). This is achieved + via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + + See the :doc:`../rawdevs/dpaa2_cmdif.rst` guide for more details. API Changes ----------- -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (8 preceding siblings ...) 2018-02-22 9:34 ` [dpdk-dev] [PATCH 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta @ 2018-04-07 14:33 ` Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta ` (10 more replies) 9 siblings, 11 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta This patch set introduces DPAA2 based Command Interface device driver. This driver is provides communication between the GPP and AIOP Firmware. Patches 1-4: Makes necessary changes and fixes in the DPAA2 bus and mempool region Patches 5-7: Add the DPAA2 CMDIF driver Patches 8-9: Update the respective documentation Changes in v2: - Move CMDIF compilation to common_linuxapp - Support physical addressing mode Nipun Gupta (9): mempool/dpaa2: add functions exposed to DPDK applications bus/fslmc: expose API to free dpci device bus/fslmc: keep Tx queues information for DPCI devices too bus/fslmc: add preprocessors to get flc and frc from fd raw/dpaa2_cmdif: introduce DPAA2 command interface driver raw/dpaa2_cmdif: add attribute get functionality raw/dpaa2_cmdif: support enqueue dequeue operations doc: add DPAA2 CMDIF rawdev guide doc: add dpaa2 command interface rawdev to release notes MAINTAINERS | 9 + config/common_base | 1 + config/common_linuxapp | 1 + doc/api/doxy-api-index.md | 2 + doc/api/doxy-api.conf | 2 + doc/guides/rawdevs/dpaa2_cmdif.rst | 132 +++++++++ doc/guides/rel_notes/release_18_05.rst | 7 + drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 +++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 12 +- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + drivers/raw/Makefile | 3 + drivers/raw/dpaa2_cmdif/Makefile | 35 +++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + mk/rte.app.mk | 1 + 22 files changed, 719 insertions(+), 21 deletions(-) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h 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.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 1/9] mempool/dpaa2: add functions exposed to DPDK applications 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta @ 2018-04-07 14:33 ` Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta ` (9 subsequent siblings) 10 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index d77f205..49fcec4 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -63,6 +63,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2] (@ref rte_dpaa2_mempool.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) - **memory**: diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index cda52fd..59cb580 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index f0edb32..6a69114 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -28,4 +28,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index ce7a4c5..3c603f5 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> +#include "rte_dpaa2_mempool.h" #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -237,6 +238,35 @@ } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_mempool.h> + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index a8aa685..b45e7a9 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -6,3 +6,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 2/9] bus/fslmc: expose API to free dpci device 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-04-07 14:33 ` Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta ` (8 subsequent siblings) 10 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index f519651..3811792 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -105,5 +105,6 @@ DPDK_18.05 { global: dpaa2_affine_qbman_ethrx_swp; + rte_dpaa2_free_dpci_dev; } DPDK_18.02; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-04-07 14:33 ` Nipun Gupta 2018-04-25 1:47 ` Shreyansh Jain 2018-04-25 3:53 ` Shreyansh Jain 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta ` (7 subsequent siblings) 10 siblings, 2 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta The DPCI devices have oth Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 +++++++++++++++++++++++++------- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/event/dpaa2/dpaa2_eventdev.c | 10 +++--- 3 files changed, 52 insertions(+), 18 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index aee870a..3bf7e7f 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -39,6 +39,7 @@ struct dpci_attr attr; struct dpci_rx_queue_cfg rx_queue_cfg; struct dpci_rx_queue_attr rx_attr; + struct dpci_tx_queue_attr tx_attr; int ret, i; /* Allocate DPAA2 dpci handle */ @@ -67,17 +68,38 @@ return -1; } - /* Set up the Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); - ret = dpci_set_rx_queue(&dpci_node->dpci, - CMD_PRI_LOW, - dpci_node->token, - 0, &rx_queue_cfg); - if (ret) { - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", - ret); - rte_free(dpci_node); - return -1; + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); + ret = dpci_set_rx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, + i, &rx_queue_cfg); + if (ret) { + DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", + ret); + rte_free(dpci_node); + return -1; + } + + /* Allocate DQ storage for the DPCI Rx queues */ + rxq = &(dpci_node->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_BUS_ERR("q_storage allocation failed\n"); + rte_free(dpci_node); + return -ENOMEM; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + if (dpaa2_alloc_dq_storage(rxq->q_storage)) { + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); + rte_free(dpci_node); + return -ENOMEM; + } } /* Enable the device */ @@ -101,8 +123,19 @@ rte_free(dpci_node); return -1; } + dpci_node->rx_queue[i].fqid = rx_attr.fqid; - dpci_node->queue[i].fqid = rx_attr.fqid; + ret = dpci_get_tx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, i, + &tx_attr); + if (ret != 0) { + DPAA2_BUS_ERR("Reading device failed with err code:" + " %d",ret); + rte_free(dpci_node); + return -1; + } + dpci_node->tx_queue[i].fqid = tx_attr.fqid; } dpci_node->dpci_id = dpci_id; diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 4a19d42..bdc33ea 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -142,7 +142,8 @@ struct dpaa2_dpci_dev { uint16_t token; rte_atomic16_t in_use; uint32_t dpci_id; /*HW ID for DPCI object */ - struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES]; }; /*! Global MCP list */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index 9d9c8d3..d91254c 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -87,10 +87,10 @@ const struct rte_event *event = &ev[num_tx + loop]; if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; else - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; /* Prepare enqueue descriptor */ @@ -733,13 +733,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id; rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO; - dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = dpaa2_eventdev_process_parallel; - dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = dpaa2_eventdev_process_atomic; for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) { - rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->queue[i]); + rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]); ret = dpci_set_rx_queue(&dpci_dev->dpci, CMD_PRI_LOW, dpci_dev->token, i, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-04-25 1:47 ` Shreyansh Jain 2018-04-25 3:53 ` Shreyansh Jain 1 sibling, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-04-25 1:47 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev, thomas, Hemant Agrawal > -----Original Message----- > From: Nipun Gupta > Sent: Saturday, April 7, 2018 8:04 PM > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI > devices too > > The DPCI devices have oth Tx and Rx queues. Event devices use > DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. > This patch enables Tx queues configuration too. > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- Nipun, Once you rebase this series on master, feel free to use for this patch: Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-04-25 1:47 ` Shreyansh Jain @ 2018-04-25 3:53 ` Shreyansh Jain 1 sibling, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-04-25 3:53 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev, thomas, Hemant Agrawal Hi Nipun, Apologies for delay in review. 2 quick comments inline. > -----Original Message----- > From: Nipun Gupta > Sent: Saturday, April 7, 2018 8:04 PM > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI > devices too > > The DPCI devices have oth Tx and Rx queues. Event devices use > DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. > This patch enables Tx queues configuration too. > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 > +++++++++++++++++++++++++------- > drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- > drivers/event/dpaa2/dpaa2_eventdev.c | 10 +++--- > 3 files changed, 52 insertions(+), 18 deletions(-) > > diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > index aee870a..3bf7e7f 100644 > --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c > @@ -39,6 +39,7 @@ > struct dpci_attr attr; > struct dpci_rx_queue_cfg rx_queue_cfg; > struct dpci_rx_queue_attr rx_attr; > + struct dpci_tx_queue_attr tx_attr; > int ret, i; > > /* Allocate DPAA2 dpci handle */ > @@ -67,17 +68,38 @@ > return -1; > } > > - /* Set up the Rx Queue */ > - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); > - ret = dpci_set_rx_queue(&dpci_node->dpci, > - CMD_PRI_LOW, > - dpci_node->token, > - 0, &rx_queue_cfg); > - if (ret) { > - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", > - ret); > - rte_free(dpci_node); > - return -1; > + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { > + struct dpaa2_queue *rxq; > + > + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); > + ret = dpci_set_rx_queue(&dpci_node->dpci, > + CMD_PRI_LOW, > + dpci_node->token, > + i, &rx_queue_cfg); > + if (ret) { > + DPAA2_BUS_ERR("Setting Rx queue failed with err code: > %d", > + ret); > + rte_free(dpci_node); > + return -1; > + } > + > + /* Allocate DQ storage for the DPCI Rx queues */ > + rxq = &(dpci_node->rx_queue[i]); > + rxq->q_storage = rte_malloc("dq_storage", > + sizeof(struct queue_storage_info_t), > + RTE_CACHE_LINE_SIZE); > + if (!rxq->q_storage) { > + DPAA2_BUS_ERR("q_storage allocation failed\n"); > + rte_free(dpci_node); > + return -ENOMEM; > + } > + > + memset(rxq->q_storage, 0, sizeof(struct > queue_storage_info_t)); > + if (dpaa2_alloc_dq_storage(rxq->q_storage)) { > + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); > + rte_free(dpci_node); If the q_storage->dq_storage allocation has failed, q_storage too needs to be free'd. > + return -ENOMEM; > + } > } > > /* Enable the device */ > @@ -101,8 +123,19 @@ > rte_free(dpci_node); > return -1; > } > + dpci_node->rx_queue[i].fqid = rx_attr.fqid; > > - dpci_node->queue[i].fqid = rx_attr.fqid; > + ret = dpci_get_tx_queue(&dpci_node->dpci, > + CMD_PRI_LOW, > + dpci_node->token, i, > + &tx_attr); > + if (ret != 0) { > + DPAA2_BUS_ERR("Reading device failed with err code:" > + " %d",ret); > + rte_free(dpci_node); Maybe in this case as well where both, q_storage and dq_storage, need to be released. > + return -1; > + } > + dpci_node->tx_queue[i].fqid = tx_attr.fqid; > } > > dpci_node->dpci_id = dpci_id; [...] ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 4/9] bus/fslmc: add preprocessors to get flc and frc from fd 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (2 preceding siblings ...) 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-04-07 14:34 ` Nipun Gupta 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta ` (6 subsequent siblings) 10 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta, stable This patch also fixes the typecasting in iova/virt conversion macros Fixes: df0011c92312 ("bus/fslmc: add physical-virtual address translation helpers") Cc: stable@dpdk.org Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index bdc33ea..1ef9502 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -189,7 +189,7 @@ enum qbman_fd_format { ((fd)->simple.frc = (0x80000000 | (len))) #define DPAA2_GET_FD_FRC_PARSE_SUM(fd) \ ((uint16_t)(((fd)->simple.frc & 0xffff0000) >> 16)) -#define DPAA2_SET_FD_FRC(fd, frc) ((fd)->simple.frc = frc) +#define DPAA2_SET_FD_FRC(fd, _frc) ((fd)->simple.frc = _frc) #define DPAA2_RESET_FD_CTRL(fd) ((fd)->simple.ctrl = 0) #define DPAA2_SET_FD_ASAL(fd, asal) ((fd)->simple.ctrl |= (asal << 16)) @@ -225,6 +225,9 @@ enum qbman_fd_format { #define DPAA2_GET_FD_BPID(fd) (((fd)->simple.bpid_offset & 0x00003FFF)) #define DPAA2_GET_FD_IVP(fd) (((fd)->simple.bpid_offset & 0x00004000) >> 14) #define DPAA2_GET_FD_OFFSET(fd) (((fd)->simple.bpid_offset & 0x0FFF0000) >> 16) +#define DPAA2_GET_FD_FRC(fd) ((fd)->simple.frc) +#define DPAA2_GET_FD_FLC(fd) \ + (((uint64_t)((fd)->simple.flc_hi) << 32) + (fd)->simple.flc_lo) #define DPAA2_GET_FLE_OFFSET(fle) (((fle)->fin_bpid_offset & 0x0FFF0000) >> 16) #define DPAA2_SET_FLE_SG_EXT(fle) ((fle)->fin_bpid_offset |= (uint64_t)1 << 29) #define DPAA2_IS_SET_FLE_SG_EXT(fle) \ @@ -328,8 +331,8 @@ static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr) #define DPAA2_MBUF_VADDR_TO_IOVA(mbuf) ((mbuf)->buf_addr) #define DPAA2_OP_VADDR_TO_IOVA(op) (op) -#define DPAA2_VADDR_TO_IOVA(_vaddr) (_vaddr) -#define DPAA2_IOVA_TO_VADDR(_iova) (_iova) +#define DPAA2_VADDR_TO_IOVA(_vaddr) ((phys_addr_t)(_vaddr)) +#define DPAA2_IOVA_TO_VADDR(_iova) ((void *)(_iova)) #define DPAA2_MODIFY_IOVA_TO_VADDR(_mem, _type) #endif /* RTE_LIBRTE_DPAA2_USE_PHYS_IOVA */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (3 preceding siblings ...) 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta @ 2018-04-07 14:34 ` Nipun Gupta 2018-04-25 4:18 ` Shreyansh Jain 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta ` (5 subsequent siblings) 10 siblings, 1 reply; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- 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 <nipun.gupta@nxp.com> +F: drivers/raw/dpaa2_cmdif/ + + Eventdev Drivers ---------------- M: Jerin Jacob <jerin.jacob@caviumnetworks.com> 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-$(<configuration>) += <directory> 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 <stdio.h> +#include <errno.h> +#include <stdint.h> + +#include <rte_bus_vdev.h> +#include <rte_atomic.h> +#include <rte_interrupts.h> +#include <rte_branch_prediction.h> +#include <rte_lcore.h> + +#include <rte_rawdev.h> +#include <rte_rawdev_pmd.h> + +#include <portal/dpaa2_hw_pvt.h> +#include <portal/dpaa2_hw_dpio.h> +#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 <rte_rawdev.h> + +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 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-04-25 4:18 ` Shreyansh Jain 0 siblings, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-04-25 4:18 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev, thomas, Hemant Agrawal > -----Original Message----- > From: Nipun Gupta > Sent: Saturday, April 7, 2018 8:04 PM > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command > interface driver > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > 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/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 <rte_rawdev.h> > + > +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) Trivial comment: Would it be better to have two variants - one which prints the function names and which doesn't. ERR/WARNING with function name should be avoided. > + > +#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__ */ [...] ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 6/9] raw/dpaa2_cmdif: add attribute get functionality 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (4 preceding siblings ...) 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-04-07 14:34 ` Nipun Gupta 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta ` (4 subsequent siblings) 10 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index 0d98d36..9044489 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -29,7 +29,32 @@ /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; +/* + * This API provides the DPCI device ID in 'attr_value'. + * The device ID shall be passed by GPP to the AIOP using CMDIF commands. + */ +static int +dpaa2_cmdif_get_attr(struct rte_rawdev *dev, + const char *attr_name, + uint64_t *attr_value) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(attr_name); + + if (!attr_value) { + DPAA2_CMDIF_ERR("Invalid arguments for getting attributes"); + return -EINVAL; + } + *attr_value = cidev->dpci_id; + + return 0; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { + .attr_get = dpaa2_cmdif_get_attr, }; static int -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (5 preceding siblings ...) 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta @ 2018-04-07 14:34 ` Nipun Gupta 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta ` (3 subsequent siblings) 10 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/raw/dpaa2_cmdif/Makefile | 2 + drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 136 ++++++++++++++++++++++++++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++++++ 5 files changed, 175 insertions(+) create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 49fcec4..b9f28be 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -64,6 +64,7 @@ The public API headers are grouped by topics: [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), [dpaa2] (@ref rte_dpaa2_mempool.h), + [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) - **memory**: diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 59cb580..88088d6 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -38,6 +38,7 @@ INPUT = doc/api/doxy-api-index.md \ drivers/net/i40e \ drivers/net/ixgbe \ drivers/net/softnic \ + drivers/raw/dpaa2_cmdif \ lib/librte_eal/common/include \ lib/librte_eal/common/include/generic \ lib/librte_acl \ diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile index 1d91d0c..c570827 100644 --- a/drivers/raw/dpaa2_cmdif/Makefile +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -30,4 +30,6 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF) += dpaa2_cmdif.c +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF)-include += rte_pmd_dpaa2_cmdif.h + 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 index 9044489..c26fc30 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -53,8 +53,144 @@ return 0; } +static int +dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_send_cnxt; + struct dpaa2_queue *txq; + struct qbman_fd fd; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_send_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + txq = &(cidev->tx_queue[cmdif_send_cnxt->priority]); + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq->fqid); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + /* Set some of the FD parameters to i. + * For performance reasons do not memset + */ + fd.simple.bpid_offset = 0; + fd.simple.ctrl = 0; + + DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(buffers[0]->buf_addr)); + DPAA2_SET_FD_LEN(&fd, cmdif_send_cnxt->size); + DPAA2_SET_FD_FRC(&fd, cmdif_send_cnxt->frc); + DPAA2_SET_FD_FLC(&fd, cmdif_send_cnxt->flc); + + /* Enqueue a packet to the QBMAN */ + do { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); + if (ret < 0 && ret != -EBUSY) + DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret); + } while (ret == -EBUSY); + + DPAA2_CMDIF_DEBUG("Successfully transmitted a packet\n"); + + return 0; +} + +static int +dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_rcv_cnxt; + struct dpaa2_queue *rxq; + struct qbman_swp *swp; + struct qbman_result *dq_storage; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + uint8_t status; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); + dq_storage = rxq->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); + qbman_pull_desc_set_numframes(&pulldesc, 1); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (dma_addr_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_CMDIF_ERR("VDQ cmd not issued. QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + /* Check if previous issued command is completed. */ + while (!qbman_check_command_complete(dq_storage)) + ; + /* Loop until the dq_storage is updated with new token by QBMAN */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_CMDIF_DEBUG("No frame is delivered\n"); + return 0; + } + + fd = qbman_result_DQ_fd(dq_storage); + + buffers[0]->buf_addr = DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd) + + DPAA2_GET_FD_OFFSET(fd)); + cmdif_rcv_cnxt->size = DPAA2_GET_FD_LEN(fd); + cmdif_rcv_cnxt->flc = DPAA2_GET_FD_FLC(fd); + cmdif_rcv_cnxt->frc = DPAA2_GET_FD_FRC(fd); + + DPAA2_CMDIF_DEBUG("packet received\n"); + + return 1; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { .attr_get = dpaa2_cmdif_get_attr, + .enqueue_bufs = dpaa2_cmdif_enqueue_bufs, + .dequeue_bufs = dpaa2_cmdif_dequeue_bufs, }; static int diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h new file mode 100644 index 0000000..483b66e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_PMD_DPAA2_CMDIF_H__ +#define __RTE_PMD_DPAA2_CMDIF_H__ + +/** + * @file + * + * NXP dpaa2 AIOP CMDIF PMD specific structures. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** The context required in the I/O path for DPAA2 AIOP Command Interface */ +struct rte_dpaa2_cmdif_context { + /** Size to populate in QBMAN FD */ + uint32_t size; + /** FRC to populate in QBMAN FD */ + uint32_t frc; + /** FLC to populate in QBMAN FD */ + uint64_t flc; + /** Priority of the command. This priority determines DPCI Queue*/ + uint8_t priority; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_PMD_DPAA2_CMDIF_H__ */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (6 preceding siblings ...) 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta @ 2018-04-07 14:34 ` Nipun Gupta 2018-04-16 12:40 ` Hemant Agrawal 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta ` (2 subsequent siblings) 10 siblings, 1 reply; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 1 + doc/guides/rawdevs/dpaa2_cmdif.rst | 132 +++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst diff --git a/MAINTAINERS b/MAINTAINERS index e97da7f..9ef5902 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -732,6 +732,7 @@ Rawdev Drivers DPAA2 CMDIF M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_cmdif/ +F: doc/guides/rawdevs/dpaa2_cmdif.rst Eventdev Drivers diff --git a/doc/guides/rawdevs/dpaa2_cmdif.rst b/doc/guides/rawdevs/dpaa2_cmdif.rst new file mode 100644 index 0000000..b0aec2a --- /dev/null +++ b/doc/guides/rawdevs/dpaa2_cmdif.rst @@ -0,0 +1,132 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2018 NXP + +NXP DPAA2 CMDIF Driver +====================== + +The DPAA2 CMDIF is an implementation of the rawdev API, that provides +communication between the GPP and AIOP (Firmware). This is achieved +via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + +More information can be found at `NXP Official Website +<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. + +Features +-------- + +The DPAA2 CMDIF implements following features in the rawdev API; + +- Getting the object ID of the device (DPCI) using attributes +- I/O to and from the AIOP device using DPCI + +Supported DPAA2 SoCs +-------------------- + +- LS2084A/LS2044A +- LS2088A/LS2048A +- LS1088A/LS1048A + +Prerequisites +------------- + +There are three main pre-requisities for executing DPAA2 CMDIF on a DPAA2 +compatible board: + +1. **ARM 64 Tool Chain** + + For example, the `*aarch64* Linaro Toolchain <https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu>`_. + +2. **Linux Kernel** + + It can be obtained from `NXP's Github hosting <https://github.com/qoriq-open-source/linux>`_. + +3. **Rootfile system** + + Any *aarch64* supporting filesystem can be used. For example, + Ubuntu 15.10 (Wily) or 16.04 LTS (Xenial) userland which can be obtained + from `here <http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.1-base-arm64.tar.gz>`_. + +As an alternative method, DPAA2 CMDIF can also be executed using images provided +as part of SDK from NXP. The SDK includes all the above prerequisites necessary +to bring up a DPAA2 board. + +The following dependencies are not part of DPDK and must be installed +separately: + +- **NXP Linux SDK** + + NXP Linux software development kit (SDK) includes support for family + of QorIQ® ARM-Architecture-based system on chip (SoC) processors + and corresponding boards. + + It includes the Linux board support packages (BSPs) for NXP SoCs, + a fully operational tool chain, kernel and board specific modules. + + SDK and related information can be obtained from: `NXP QorIQ SDK <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_. + +- **DPDK Extra Scripts** + + DPAA2 based resources can be configured easily with the help of ready scripts + as provided in the DPDK Extra repository. + + `DPDK Extras Scripts <https://github.com/qoriq-open-source/dpdk-extras>`_. + +Currently supported by DPDK: + +- NXP SDK **2.0+**. +- MC Firmware version **10.0.0** and higher. +- Supported architectures: **arm64 LE**. + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +.. note:: + + Some part of fslmc bus code (mc flib - object library) routines are + dual licensed (BSD & GPLv2). + +Pre-Installation Configuration +------------------------------ + +Config File Options +~~~~~~~~~~~~~~~~~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_dpaa2_cmdif`` driver. + +Driver Compilation +~~~~~~~~~~~~~~~~~~ + +To compile the DPAA2 CMDIF PMD for Linux arm64 gcc target, run the +following ``make`` command: + +.. code-block:: console + + cd <DPDK-source-directory> + make config T=arm64-dpaa2-linuxapp-gcc install + +Initialization +-------------- + +The DPAA2 CMDIF is exposed as a vdev device which consists of dpci devices. +On EAL initialization, dpci devices will be probed and then vdev device +can be created from the application code by + +* Invoking ``rte_vdev_init("dpaa2_dpci")`` from the application + +* Using ``--vdev="dpaa2_dpci"`` in the EAL options, which will call + rte_vdev_init() internally + +Example: + +.. code-block:: console + + ./your_cmdif_application --vdev="dpaa2_dpci" + +Platform Requirement +~~~~~~~~~~~~~~~~~~~~ + +DPAA2 drivers for DPDK can only work on NXP SoCs as listed in the +``Supported DPAA2 SoCs``. -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-04-16 12:40 ` Hemant Agrawal 0 siblings, 0 replies; 71+ messages in thread From: Hemant Agrawal @ 2018-04-16 12:40 UTC (permalink / raw) To: Nipun Gupta, thomas, hemant.agrawal, shreyansh.jain; +Cc: dev On 4/7/2018 8:04 PM, Nipun Gupta wrote: > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > MAINTAINERS | 1 + > doc/guides/rawdevs/dpaa2_cmdif.rst | 132 +++++++++++++++++++++++++++++++++++++ you also need to add entry in guides/index for these. Also create a rawdevs/index.rst file with dpaa2_cmdif.rst entry ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (7 preceding siblings ...) 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-04-07 14:34 ` Nipun Gupta 2018-04-23 12:23 ` Kovacevic, Marko 2018-04-25 1:50 ` Shreyansh Jain 2018-04-07 14:43 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta 10 siblings, 2 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:34 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/guides/rel_notes/release_18_05.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index e5fac1c..0aebb18 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -58,6 +58,13 @@ New Features * Added support for NVGRE, VXLAN and GENEVE filters in flow API. * Added support for DROP action in flow API. +* **Added DPAA2 Command Interface Driver (in rawdev).** + + The DPAA2 CMDIF is an implementation of the rawdev API, that provides + communication between the GPP and AIOP (Firmware). This is achieved + via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + + See the :doc:`../rawdevs/dpaa2_cmdif.rst` guide for more details. API Changes ----------- -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta @ 2018-04-23 12:23 ` Kovacevic, Marko 2018-04-25 1:50 ` Shreyansh Jain 1 sibling, 0 replies; 71+ messages in thread From: Kovacevic, Marko @ 2018-04-23 12:23 UTC (permalink / raw) To: Nipun Gupta, thomas, hemant.agrawal, shreyansh.jain; +Cc: dev > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > doc/guides/rel_notes/release_18_05.rst | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/doc/guides/rel_notes/release_18_05.rst > b/doc/guides/rel_notes/release_18_05.rst > index e5fac1c..0aebb18 100644 > --- a/doc/guides/rel_notes/release_18_05.rst > +++ b/doc/guides/rel_notes/release_18_05.rst > @@ -58,6 +58,13 @@ New Features > * Added support for NVGRE, VXLAN and GENEVE filters in flow API. > * Added support for DROP action in flow API. > > +* **Added DPAA2 Command Interface Driver (in rawdev).** > + > + The DPAA2 CMDIF is an implementation of the rawdev API, that provides > + communication between the GPP and AIOP (Firmware). This is achieved > + via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. > + > + See the :doc:`../rawdevs/dpaa2_cmdif.rst` guide for more details. You need to remove the .rst extension from above for it to be a clickable and linked to the html version of the file. Once it's done you can add my ack to the second version. Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta 2018-04-23 12:23 ` Kovacevic, Marko @ 2018-04-25 1:50 ` Shreyansh Jain 1 sibling, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-04-25 1:50 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev, thomas, Hemant Agrawal > -----Original Message----- > From: Nipun Gupta > Sent: Saturday, April 7, 2018 8:04 PM > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to > release notes > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > doc/guides/rel_notes/release_18_05.rst | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/doc/guides/rel_notes/release_18_05.rst > b/doc/guides/rel_notes/release_18_05.rst > index e5fac1c..0aebb18 100644 > --- a/doc/guides/rel_notes/release_18_05.rst > +++ b/doc/guides/rel_notes/release_18_05.rst > @@ -58,6 +58,13 @@ New Features > * Added support for NVGRE, VXLAN and GENEVE filters in flow API. > * Added support for DROP action in flow API. > > +* **Added DPAA2 Command Interface Driver (in rawdev).** > + > + The DPAA2 CMDIF is an implementation of the rawdev API, that > provides The ',' in '...rawdev API, that provides' is not required. > + communication between the GPP and AIOP (Firmware). This is achieved Can you please state NXP's QorIQ based AIOP Block or, one liner about AIOP would help someone understand the context. > + via using the DPCI devices exposed by MC for GPP <--> AIOP > interaction. > + > + See the :doc:`../rawdevs/dpaa2_cmdif.rst` guide for more details. Just like the QDMA series, you might want to remove 'rst' from the above. > > API Changes > ----------- > -- > 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (8 preceding siblings ...) 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta @ 2018-04-07 14:43 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta 10 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-07 14:43 UTC (permalink / raw) To: thomas, Hemant Agrawal, Shreyansh Jain; +Cc: dev Forgot to mention - This patch series is rebased on top of series https://dpdk.org/dev/patchwork/patch/37246/ > -----Original Message----- > From: Nipun Gupta > Sent: Saturday, April 07, 2018 20:04 > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver > > This patch set introduces DPAA2 based Command Interface > device driver. > > This driver is provides communication between the GPP and > AIOP Firmware. > > Patches 1-4: > Makes necessary changes and fixes in the DPAA2 bus and > mempool region > Patches 5-7: > Add the DPAA2 CMDIF driver > Patches 8-9: > Update the respective documentation > > Changes in v2: > - Move CMDIF compilation to common_linuxapp > - Support physical addressing mode > > Nipun Gupta (9): > mempool/dpaa2: add functions exposed to DPDK applications > bus/fslmc: expose API to free dpci device > bus/fslmc: keep Tx queues information for DPCI devices too > bus/fslmc: add preprocessors to get flc and frc from fd > raw/dpaa2_cmdif: introduce DPAA2 command interface driver > raw/dpaa2_cmdif: add attribute get functionality > raw/dpaa2_cmdif: support enqueue dequeue operations > doc: add DPAA2 CMDIF rawdev guide > doc: add dpaa2 command interface rawdev to release notes > > MAINTAINERS | 9 + > config/common_base | 1 + > config/common_linuxapp | 1 + > doc/api/doxy-api-index.md | 2 + > doc/api/doxy-api.conf | 2 + > doc/guides/rawdevs/dpaa2_cmdif.rst | 132 +++++++++ > doc/guides/rel_notes/release_18_05.rst | 7 + > drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 57 +++- > drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 12 +- > drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + > drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- > drivers/mempool/dpaa2/Makefile | 2 + > drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ > drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ > .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + > drivers/raw/Makefile | 3 + > drivers/raw/dpaa2_cmdif/Makefile | 35 +++ > drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 > +++++++++++++++++++++ > drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 +++ > drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ > .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + > mk/rte.app.mk | 1 + > 22 files changed, 719 insertions(+), 21 deletions(-) > create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst > create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h > 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.h > create mode 100644 > drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map > > -- > 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 0/7 v3] Introduce DPAA2 Command Interface raw driver 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (9 preceding siblings ...) 2018-04-07 14:43 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 1/7 v3] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta ` (8 more replies) 10 siblings, 9 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta This patch set introduces DPAA2 based Command Interface device driver. This driver is provides communication between the GPP and AIOP Firmware. This patchset is based on top of: https://dpdk.org/dev/patchwork/patch/38798/ Patches 1-3: Makes necessary changes and fixes in the DPAA2 bus and mempool region Patches 4-6: Add the DPAA2 CMDIF driver Patches 7: Update the respective documentation Changes in v2: - Move CMDIF compilation to common_linuxapp - Support physical addressing mode Changes in v3: - Rebased over DPAA2 QDMA patches - Updated logging adding Data Path logs too - Fix up error handling in patch 3 - Merged the two separate doc patches (patch 7) Nipun Gupta (7): mempool/dpaa2: add functions exposed to DPDK applications bus/fslmc: expose API to free dpci device bus/fslmc: keep Tx queues information for DPCI devices too raw/dpaa2_cmdif: introduce DPAA2 command interface driver raw/dpaa2_cmdif: add attribute get functionality raw/dpaa2_cmdif: support enqueue dequeue operations doc: add DPAA2 CMDIF rawdev guide MAINTAINERS | 5 + config/common_base | 5 + config/common_linuxapp | 1 + doc/api/doxy-api-index.md | 2 + doc/api/doxy-api.conf | 2 + doc/guides/rawdevs/dpaa2_cmdif.rst | 132 +++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 + drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 ++++-- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 35 +++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 46 ++++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + mk/rte.app.mk | 1 + 23 files changed, 745 insertions(+), 29 deletions(-) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h 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.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 1/7 v3] mempool/dpaa2: add functions exposed to DPDK applications 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device Nipun Gupta ` (7 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 437d903..12d3e5c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -38,6 +38,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2] (@ref rte_dpaa2_mempool.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 18a7ed4..0ab164f 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index 5125ad1..9e4c87d 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index ce7a4c5..3c603f5 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> +#include "rte_dpaa2_mempool.h" #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -237,6 +238,35 @@ } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_mempool.h> + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index a8aa685..b45e7a9 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -6,3 +6,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 1/7 v3] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-05-01 9:45 ` Shreyansh Jain 2018-04-26 10:14 ` [dpdk-dev] [PATCH 3/7 v3] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta ` (6 subsequent siblings) 8 siblings, 1 reply; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 70fb719..d433714 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -114,5 +114,6 @@ DPDK_18.05 { dpdmai_open; dpdmai_set_rx_queue; dpdmai_set_tx_queue; + rte_dpaa2_free_dpci_dev; } DPDK_18.02; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device 2018-04-26 10:14 ` [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-05-01 9:45 ` Shreyansh Jain 0 siblings, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-05-01 9:45 UTC (permalink / raw) To: Nipun Gupta; +Cc: thomas, hemant.agrawal, dev On Thursday 26 April 2018 03:44 PM, Nipun Gupta wrote: > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map > index 70fb719..d433714 100644 > --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map > +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map > @@ -114,5 +114,6 @@ DPDK_18.05 { > dpdmai_open; > dpdmai_set_rx_queue; > dpdmai_set_tx_queue; > + rte_dpaa2_free_dpci_dev; > > } DPDK_18.02; > Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 3/7 v3] bus/fslmc: keep Tx queues information for DPCI devices too 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 1/7 v3] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 4/7 v3] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta ` (5 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta The DPCI devices have oth Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 +++++++++++++++++++++++--------- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/event/dpaa2/dpaa2_eventdev.c | 10 ++-- 3 files changed, 70 insertions(+), 29 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index aee870a..5ad0374 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -39,13 +39,14 @@ struct dpci_attr attr; struct dpci_rx_queue_cfg rx_queue_cfg; struct dpci_rx_queue_attr rx_attr; + struct dpci_tx_queue_attr tx_attr; int ret, i; /* Allocate DPAA2 dpci handle */ dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0); if (!dpci_node) { DPAA2_BUS_ERR("Memory allocation failed for DPCI Device"); - return -1; + return -ENOMEM; } /* Open the dpci object */ @@ -54,8 +55,7 @@ CMD_PRI_LOW, dpci_id, &dpci_node->token); if (ret) { DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } /* Get the device attributes */ @@ -63,21 +63,40 @@ CMD_PRI_LOW, dpci_node->token, &attr); if (ret != 0) { DPAA2_BUS_ERR("Reading device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } - /* Set up the Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); - ret = dpci_set_rx_queue(&dpci_node->dpci, - CMD_PRI_LOW, - dpci_node->token, - 0, &rx_queue_cfg); - if (ret) { - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", - ret); - rte_free(dpci_node); - return -1; + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); + ret = dpci_set_rx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, + i, &rx_queue_cfg); + if (ret) { + DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", + ret); + goto err; + } + + /* Allocate DQ storage for the DPCI Rx queues */ + rxq = &(dpci_node->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_BUS_ERR("q_storage allocation failed\n"); + ret = -ENOMEM; + goto err; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); + goto err; + } } /* Enable the device */ @@ -85,8 +104,7 @@ CMD_PRI_LOW, dpci_node->token); if (ret != 0) { DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { @@ -96,13 +114,22 @@ dpci_node->token, i, &rx_attr); if (ret != 0) { - DPAA2_BUS_ERR("Rx queue fetch failed with err code:" - " %d", ret); - rte_free(dpci_node); - return -1; + DPAA2_BUS_ERR("Rx queue fetch failed with err code: %d", + ret); + goto err; } + dpci_node->rx_queue[i].fqid = rx_attr.fqid; - dpci_node->queue[i].fqid = rx_attr.fqid; + ret = dpci_get_tx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, i, + &tx_attr); + if (ret != 0) { + DPAA2_BUS_ERR("Reading device failed with err code: %d", + ret); + goto err; + } + dpci_node->tx_queue[i].fqid = tx_attr.fqid; } dpci_node->dpci_id = dpci_id; @@ -111,6 +138,19 @@ TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next); return 0; + +err: + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]); + + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + } + } + rte_free(dpci_node); + + return ret; } struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 8fd4ef9..fba8f54 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -142,7 +142,8 @@ struct dpaa2_dpci_dev { uint16_t token; rte_atomic16_t in_use; uint32_t dpci_id; /*HW ID for DPCI object */ - struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES]; }; /*! Global MCP list */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index f50bb8d..0199d66 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -87,10 +87,10 @@ const struct rte_event *event = &ev[num_tx + loop]; if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; else - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; /* Prepare enqueue descriptor */ @@ -733,13 +733,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id; rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO; - dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = dpaa2_eventdev_process_parallel; - dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = dpaa2_eventdev_process_atomic; for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) { - rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->queue[i]); + rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]); ret = dpci_set_rx_queue(&dpci_dev->dpci, CMD_PRI_LOW, dpci_dev->token, i, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 4/7 v3] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta ` (2 preceding siblings ...) 2018-04-26 10:14 ` [dpdk-dev] [PATCH 3/7 v3] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 5/7 v3] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta ` (4 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 4 + config/common_base | 5 + config/common_linuxapp | 1 + drivers/raw/Makefile | 1 + 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, 223 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 6ad6d81..0871af9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -791,6 +791,10 @@ M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_qdma/ F: doc/guides/rawdevs/dpaa2_qdma.rst +DPAA2 CMDIF +M: Nipun Gupta <nipun.gupta@nxp.com> +F: drivers/raw/dpaa2_cmdif/ + Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index f69e867..8034403 100644 --- a/config/common_base +++ b/config/common_base @@ -617,6 +617,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y # +# Compile PMD for NXP DPAA2 CMDIF raw device +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=n + +# # Compile PMD for NXP DPAA2 QDMA raw device # CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n diff --git a/config/common_linuxapp b/config/common_linuxapp index f752a0f..0e83163 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -37,4 +37,5 @@ 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_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0f2b076..2eb2787 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -6,6 +6,7 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$(<configuration>) += <directory> 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_RAWDEV) += dpaa2_cmdif DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma endif diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile new file mode 100644 index 0000000..66f9c0e --- /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_RAWDEV) += 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 <stdio.h> +#include <errno.h> +#include <stdint.h> + +#include <rte_bus_vdev.h> +#include <rte_atomic.h> +#include <rte_interrupts.h> +#include <rte_branch_prediction.h> +#include <rte_lcore.h> + +#include <rte_rawdev.h> +#include <rte_rawdev_pmd.h> + +#include <portal/dpaa2_hw_pvt.h> +#include <portal/dpaa2_hw_dpio.h> +#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 <rte_rawdev.h> + +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 ff90dec..ce1fd3c 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -248,6 +248,7 @@ endif # CONFIG_RTE_LIBRTE_EVENTDEV ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += -lrte_pmd_dpaa2_cmdif _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma endif # CONFIG_RTE_LIBRTE_FSLMC_BUS endif # CONFIG_RTE_LIBRTE_RAWDEV -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 5/7 v3] raw/dpaa2_cmdif: add attribute get functionality 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta ` (3 preceding siblings ...) 2018-04-26 10:14 ` [dpdk-dev] [PATCH 4/7 v3] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 6/7 v3] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta ` (3 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index 0d98d36..9044489 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -29,7 +29,32 @@ /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; +/* + * This API provides the DPCI device ID in 'attr_value'. + * The device ID shall be passed by GPP to the AIOP using CMDIF commands. + */ +static int +dpaa2_cmdif_get_attr(struct rte_rawdev *dev, + const char *attr_name, + uint64_t *attr_value) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(attr_name); + + if (!attr_value) { + DPAA2_CMDIF_ERR("Invalid arguments for getting attributes"); + return -EINVAL; + } + *attr_value = cidev->dpci_id; + + return 0; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { + .attr_get = dpaa2_cmdif_get_attr, }; static int -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 6/7 v3] raw/dpaa2_cmdif: support enqueue dequeue operations 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta ` (4 preceding siblings ...) 2018-04-26 10:14 ` [dpdk-dev] [PATCH 5/7 v3] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 7/7 v3] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta ` (2 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/raw/dpaa2_cmdif/Makefile | 2 + drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 136 ++++++++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 23 +++-- drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++++++ 6 files changed, 192 insertions(+), 6 deletions(-) create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 12d3e5c..a2f9fde 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -39,6 +39,7 @@ The public API headers are grouped by topics: [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), [dpaa2] (@ref rte_dpaa2_mempool.h), + [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 0ab164f..f2f5237 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -38,6 +38,7 @@ INPUT = doc/api/doxy-api-index.md \ drivers/net/i40e \ drivers/net/ixgbe \ drivers/net/softnic \ + drivers/raw/dpaa2_cmdif \ drivers/raw/dpaa2_qdma \ lib/librte_eal/common/include \ lib/librte_eal/common/include/generic \ diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile index 66f9c0e..fdb0ec8 100644 --- a/drivers/raw/dpaa2_cmdif/Makefile +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -30,4 +30,6 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV)-include += rte_pmd_dpaa2_cmdif.h + 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 index 9044489..521883c 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -53,8 +53,144 @@ return 0; } +static int +dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_send_cnxt; + struct dpaa2_queue *txq; + struct qbman_fd fd; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_send_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + txq = &(cidev->tx_queue[cmdif_send_cnxt->priority]); + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq->fqid); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + /* Set some of the FD parameters to i. + * For performance reasons do not memset + */ + fd.simple.bpid_offset = 0; + fd.simple.ctrl = 0; + + DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(buffers[0]->buf_addr)); + DPAA2_SET_FD_LEN(&fd, cmdif_send_cnxt->size); + DPAA2_SET_FD_FRC(&fd, cmdif_send_cnxt->frc); + DPAA2_SET_FD_FLC(&fd, cmdif_send_cnxt->flc); + + /* Enqueue a packet to the QBMAN */ + do { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); + if (ret < 0 && ret != -EBUSY) + DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret); + } while (ret == -EBUSY); + + DPAA2_CMDIF_DP_DEBUG("Successfully transmitted a packet\n"); + + return 0; +} + +static int +dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_rcv_cnxt; + struct dpaa2_queue *rxq; + struct qbman_swp *swp; + struct qbman_result *dq_storage; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + uint8_t status; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); + dq_storage = rxq->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); + qbman_pull_desc_set_numframes(&pulldesc, 1); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_CMDIF_DP_WARN("VDQ cmd not issued. QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + /* Check if previous issued command is completed. */ + while (!qbman_check_command_complete(dq_storage)) + ; + /* Loop until the dq_storage is updated with new token by QBMAN */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_CMDIF_DP_DEBUG("No frame is delivered\n"); + return 0; + } + + fd = qbman_result_DQ_fd(dq_storage); + + buffers[0]->buf_addr = (void *)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd) + DPAA2_GET_FD_OFFSET(fd)); + cmdif_rcv_cnxt->size = DPAA2_GET_FD_LEN(fd); + cmdif_rcv_cnxt->flc = DPAA2_GET_FD_FLC(fd); + cmdif_rcv_cnxt->frc = DPAA2_GET_FD_FRC(fd); + + DPAA2_CMDIF_DP_DEBUG("packet received\n"); + + return 1; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { .attr_get = dpaa2_cmdif_get_attr, + .enqueue_bufs = dpaa2_cmdif_enqueue_bufs, + .dequeue_bufs = dpaa2_cmdif_dequeue_bufs, }; static int diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h index 5eb0885..598a621 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -9,18 +9,18 @@ extern "C" { #endif -#include <rte_rawdev.h> - 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) + rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "dpaa2_cmdif: " \ + fmt "\n", ## args) + +#define DPAA2_CMDIF_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_cmdif_logtype, "dpaa2_cmdif: %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...) \ @@ -28,6 +28,17 @@ #define DPAA2_CMDIF_WARN(fmt, args...) \ DPAA2_CMDIF_LOG(WARNING, fmt, ## args) +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_CMDIF_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, "dpaa2_cmdif: " fmt "\n", ## args) + +#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_CMDIF_DP_INFO(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args) +#define DPAA2_CMDIF_DP_WARN(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args) + #ifdef __cplusplus } #endif diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h new file mode 100644 index 0000000..483b66e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_PMD_DPAA2_CMDIF_H__ +#define __RTE_PMD_DPAA2_CMDIF_H__ + +/** + * @file + * + * NXP dpaa2 AIOP CMDIF PMD specific structures. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** The context required in the I/O path for DPAA2 AIOP Command Interface */ +struct rte_dpaa2_cmdif_context { + /** Size to populate in QBMAN FD */ + uint32_t size; + /** FRC to populate in QBMAN FD */ + uint32_t frc; + /** FLC to populate in QBMAN FD */ + uint64_t flc; + /** Priority of the command. This priority determines DPCI Queue*/ + uint8_t priority; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_PMD_DPAA2_CMDIF_H__ */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH 7/7 v3] doc: add DPAA2 CMDIF rawdev guide 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta ` (5 preceding siblings ...) 2018-04-26 10:14 ` [dpdk-dev] [PATCH 6/7 v3] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta @ 2018-04-26 10:14 ` Nipun Gupta 2018-05-01 9:45 ` [dpdk-dev] [PATCH 0/7 v3] Introduce DPAA2 Command Interface raw driver Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-04-26 10:14 UTC (permalink / raw) To: shreyansh.jain, thomas, hemant.agrawal; +Cc: dev, Nipun Gupta [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset=y, Size: 6238 bytes --] Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- MAINTAINERS | 1 + doc/guides/rawdevs/dpaa2_cmdif.rst | 132 +++++++++++++++++++++++++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 +++ 4 files changed, 145 insertions(+) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst diff --git a/MAINTAINERS b/MAINTAINERS index 0871af9..2502940 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -794,6 +794,7 @@ F: doc/guides/rawdevs/dpaa2_qdma.rst DPAA2 CMDIF M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_cmdif/ +F: doc/guides/rawdevs/dpaa2_cmdif.rst Eventdev Drivers diff --git a/doc/guides/rawdevs/dpaa2_cmdif.rst b/doc/guides/rawdevs/dpaa2_cmdif.rst new file mode 100644 index 0000000..31a5dae --- /dev/null +++ b/doc/guides/rawdevs/dpaa2_cmdif.rst @@ -0,0 +1,132 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2018 NXP + +NXP DPAA2 CMDIF Driver +====================== + +The DPAA2 CMDIF is an implementation of the rawdev API, that provides +communication between the GPP and AIOP (Firmware). This is achieved +via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + +More information can be found at `NXP Official Website +<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. + +Features +-------- + +The DPAA2 CMDIF implements following features in the rawdev API; + +- Getting the object ID of the device (DPCI) using attributes +- I/O to and from the AIOP device using DPCI + +Supported DPAA2 SoCs +-------------------- + +- LS2084A/LS2044A +- LS2088A/LS2048A +- LS1088A/LS1048A + +Prerequisites +------------- + +There are three main pre-requisities for executing DPAA2 CMDIF on a DPAA2 +compatible board: + +1. **ARM 64 Tool Chain** + + For example, the `*aarch64* Linaro Toolchain <https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu>`_. + +2. **Linux Kernel** + + It can be obtained from `NXP's Github hosting <https://github.com/qoriq-open-source/linux>`_. + +3. **Rootfile system** + + Any *aarch64* supporting filesystem can be used. For example, + Ubuntu 15.10 (Wily) or 16.04 LTS (Xenial) userland which can be obtained + from `here <http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.1-base-arm64.tar.gz>`_. + +As an alternative method, DPAA2 CMDIF can also be executed using images provided +as part of SDK from NXP. The SDK includes all the above prerequisites necessary +to bring up a DPAA2 board. + +The following dependencies are not part of DPDK and must be installed +separately: + +- **NXP Linux SDK** + + NXP Linux software development kit (SDK) includes support for family + of QorIQ® ARM-Architecture-based system on chip (SoC) processors + and corresponding boards. + + It includes the Linux board support packages (BSPs) for NXP SoCs, + a fully operational tool chain, kernel and board specific modules. + + SDK and related information can be obtained from: `NXP QorIQ SDK <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_. + +- **DPDK Extra Scripts** + + DPAA2 based resources can be configured easily with the help of ready scripts + as provided in the DPDK Extra repository. + + `DPDK Extras Scripts <https://github.com/qoriq-open-source/dpdk-extras>`_. + +Currently supported by DPDK: + +- NXP SDK **2.0+**. +- MC Firmware version **10.0.0** and higher. +- Supported architectures: **arm64 LE**. + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +.. note:: + + Some part of fslmc bus code (mc flib - object library) routines are + dual licensed (BSD & GPLv2). + +Pre-Installation Configuration +------------------------------ + +Config File Options +~~~~~~~~~~~~~~~~~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_dpaa2_cmdif`` driver. + +Driver Compilation +~~~~~~~~~~~~~~~~~~ + +To compile the DPAA2 CMDIF PMD for Linux arm64 gcc target, run the +following ``make`` command: + +.. code-block:: console + + cd <DPDK-source-directory> + make config T=arm64-dpaa2-linuxapp-gcc install + +Initialization +-------------- + +The DPAA2 CMDIF is exposed as a vdev device which consists of dpci devices. +On EAL initialization, dpci devices will be probed and then vdev device +can be created from the application code by + +* Invoking ``rte_vdev_init("dpaa2_dpci")`` from the application + +* Using ``--vdev="dpaa2_dpci"`` in the EAL options, which will call + rte_vdev_init() internally + +Example: + +.. code-block:: console + + ./your_cmdif_application --vdev="dpaa2_dpci" + +Platform Requirement +~~~~~~~~~~~~~~~~~~~~ + +DPAA2 drivers for DPDK can only work on NXP SoCs as listed in the +``Supported DPAA2 SoCs``. diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 29b4f6c..7769083 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -11,4 +11,5 @@ application through rawdev API. :maxdepth: 2 :numbered: + dpaa2_cmdif dpaa2_qdma diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index cfcc301..b28d72d 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -148,6 +148,17 @@ New Features See the :doc:`../rawdevs/dpaa2_qdma` guide for more details. +* **Added DPAA2 Command Interface Driver (in rawdev).** + + The DPAA2 CMDIF is an implementation of the rawdev API, that provides + communication between the GPP and NXP's QorIQ based AIOP Block (Firmware). + Advanced IO Processor i.e. AIOP is clusters of programmable RISC engines + optimised for flexible networking and I/O operations. The communication + between GPP and AIOP is achieved via using DPCI devices exposed by MC for + GPP <--> AIOP interaction. + + See the :doc:`../rawdevs/dpaa2_cmdif` guide for more details. + API Changes ----------- -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH 0/7 v3] Introduce DPAA2 Command Interface raw driver 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta ` (6 preceding siblings ...) 2018-04-26 10:14 ` [dpdk-dev] [PATCH 7/7 v3] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-05-01 9:45 ` Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta 8 siblings, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-05-01 9:45 UTC (permalink / raw) To: Nipun Gupta; +Cc: thomas, hemant.agrawal, dev On Thursday 26 April 2018 03:44 PM, Nipun Gupta wrote: > This patch set introduces DPAA2 based Command Interface > device driver. > > This driver is provides communication between the GPP and > AIOP Firmware. > > This patchset is based on top of: > https://dpdk.org/dev/patchwork/patch/38798/ > > Patches 1-3: > Makes necessary changes and fixes in the DPAA2 bus and > mempool region > Patches 4-6: > Add the DPAA2 CMDIF driver > Patches 7: > Update the respective documentation > > Changes in v2: > - Move CMDIF compilation to common_linuxapp > - Support physical addressing mode > > Changes in v3: > - Rebased over DPAA2 QDMA patches > - Updated logging adding Data Path logs too > - Fix up error handling in patch 3 > - Merged the two separate doc patches (patch 7) > > Nipun Gupta (7): > mempool/dpaa2: add functions exposed to DPDK applications > bus/fslmc: expose API to free dpci device > bus/fslmc: keep Tx queues information for DPCI devices too > raw/dpaa2_cmdif: introduce DPAA2 command interface driver > raw/dpaa2_cmdif: add attribute get functionality > raw/dpaa2_cmdif: support enqueue dequeue operations > doc: add DPAA2 CMDIF rawdev guide > Nipun, Can you push the series again with meson support? Regards, Shreyansh ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 0/7] Introduce DPAA2 Command Interface raw driver 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta ` (7 preceding siblings ...) 2018-05-01 9:45 ` [dpdk-dev] [PATCH 0/7 v3] Introduce DPAA2 Command Interface raw driver Shreyansh Jain @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta ` (7 more replies) 8 siblings, 8 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta This patch set introduces DPAA2 based Command Interface device driver. This driver is provides communication between the GPP and AIOP Firmware. This patchset is based on top of: https://dpdk.org/dev/patchwork/patch/39246/ Patches 1-3: Makes necessary changes and fixes in the DPAA2 bus and mempool region Patches 4-6: Add the DPAA2 CMDIF driver Patches 7: Update the respective documentation Changes in v2: - Move CMDIF compilation to common_linuxapp - Support physical addressing mode Changes in v3: - Rebased over DPAA2 QDMA patches - Updated logging adding Data Path logs too - Fix up error handling in patch 3 - Merged the two separate doc patches (patch 7) Changes in v4: - Added meson build support Nipun Gupta (7): mempool/dpaa2: add functions exposed to DPDK applications bus/fslmc: expose API to free dpci device bus/fslmc: keep Tx queues information for DPCI devices too raw/dpaa2_cmdif: introduce DPAA2 command interface driver raw/dpaa2_cmdif: add attribute get functionality raw/dpaa2_cmdif: support enqueue dequeue operations doc: add DPAA2 CMDIF rawdev guide MAINTAINERS | 5 + config/common_base | 5 + config/common_linuxapp | 1 + doc/api/doxy-api-index.md | 2 + doc/api/doxy-api.conf | 2 + doc/guides/rawdevs/dpaa2_cmdif.rst | 144 ++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 + drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 ++++-- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 35 +++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 46 ++++ drivers/raw/dpaa2_cmdif/meson.build | 9 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 25 files changed, 767 insertions(+), 30 deletions(-) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h 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/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-03 13:49 ` Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta ` (6 subsequent siblings) 7 siblings, 1 reply; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 437d903..12d3e5c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -38,6 +38,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2] (@ref rte_dpaa2_mempool.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 88bee03..71fb6b2 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index 5125ad1..9e4c87d 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 5d057fb..e12a0ec 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> +#include "rte_dpaa2_mempool.h" #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -244,6 +245,35 @@ struct dpaa2_memseg_list rte_dpaa2_memsegs } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_mempool.h> + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index 82a5ec0..b9d996a 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -7,3 +7,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-05-03 13:49 ` Shreyansh Jain 0 siblings, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-05-03 13:49 UTC (permalink / raw) To: Nipun Gupta; +Cc: thomas, hemant.agrawal, dev On Wednesday 02 May 2018 10:45 PM, Nipun Gupta wrote: > There are two API's which are required by NXP specific Command Interface > Application (AIOP CMDIF). This patch exposes these two API's. > > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > doc/api/doxy-api-index.md | 1 + > doc/api/doxy-api.conf | 1 + > drivers/mempool/dpaa2/Makefile | 2 + > drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ > drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ > .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ > 6 files changed, 95 insertions(+) > create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h > > diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md > index 437d903..12d3e5c 100644 > --- a/doc/api/doxy-api-index.md > +++ b/doc/api/doxy-api-index.md > @@ -38,6 +38,7 @@ The public API headers are grouped by topics: > [i40e] (@ref rte_pmd_i40e.h), > [bnxt] (@ref rte_pmd_bnxt.h), > [dpaa] (@ref rte_pmd_dpaa.h), > + [dpaa2] (@ref rte_dpaa2_mempool.h), > [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), > [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) > > diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf > index 88bee03..71fb6b2 100644 > --- a/doc/api/doxy-api.conf > +++ b/doc/api/doxy-api.conf > @@ -31,6 +31,7 @@ > PROJECT_NAME = DPDK > INPUT = doc/api/doxy-api-index.md \ > drivers/crypto/scheduler \ > + drivers/mempool/dpaa2 \ > drivers/net/bnxt \ > drivers/net/bonding \ > drivers/net/dpaa \ Nipun, Above doxygen change is appearing under 'device-specific' with 'dpaa2' as tag. I think it should be 'dpaa2_mempool'. - Shreyansh ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 2/7] bus/fslmc: expose API to free dpci device 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta ` (5 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 70fb719..d433714 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -114,5 +114,6 @@ DPDK_18.05 { dpdmai_open; dpdmai_set_rx_queue; dpdmai_set_tx_queue; + rte_dpaa2_free_dpci_dev; } DPDK_18.02; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 3/7] bus/fslmc: keep Tx queues information for DPCI devices too 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta ` (4 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta The DPCI devices have oth Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 +++++++++++++++++++++++--------- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/event/dpaa2/dpaa2_eventdev.c | 10 ++-- 3 files changed, 70 insertions(+), 29 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index aee870a..5ad0374 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -39,13 +39,14 @@ struct dpci_attr attr; struct dpci_rx_queue_cfg rx_queue_cfg; struct dpci_rx_queue_attr rx_attr; + struct dpci_tx_queue_attr tx_attr; int ret, i; /* Allocate DPAA2 dpci handle */ dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0); if (!dpci_node) { DPAA2_BUS_ERR("Memory allocation failed for DPCI Device"); - return -1; + return -ENOMEM; } /* Open the dpci object */ @@ -54,8 +55,7 @@ CMD_PRI_LOW, dpci_id, &dpci_node->token); if (ret) { DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } /* Get the device attributes */ @@ -63,21 +63,40 @@ CMD_PRI_LOW, dpci_node->token, &attr); if (ret != 0) { DPAA2_BUS_ERR("Reading device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } - /* Set up the Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); - ret = dpci_set_rx_queue(&dpci_node->dpci, - CMD_PRI_LOW, - dpci_node->token, - 0, &rx_queue_cfg); - if (ret) { - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", - ret); - rte_free(dpci_node); - return -1; + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); + ret = dpci_set_rx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, + i, &rx_queue_cfg); + if (ret) { + DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", + ret); + goto err; + } + + /* Allocate DQ storage for the DPCI Rx queues */ + rxq = &(dpci_node->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_BUS_ERR("q_storage allocation failed\n"); + ret = -ENOMEM; + goto err; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); + goto err; + } } /* Enable the device */ @@ -85,8 +104,7 @@ CMD_PRI_LOW, dpci_node->token); if (ret != 0) { DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { @@ -96,13 +114,22 @@ dpci_node->token, i, &rx_attr); if (ret != 0) { - DPAA2_BUS_ERR("Rx queue fetch failed with err code:" - " %d", ret); - rte_free(dpci_node); - return -1; + DPAA2_BUS_ERR("Rx queue fetch failed with err code: %d", + ret); + goto err; } + dpci_node->rx_queue[i].fqid = rx_attr.fqid; - dpci_node->queue[i].fqid = rx_attr.fqid; + ret = dpci_get_tx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, i, + &tx_attr); + if (ret != 0) { + DPAA2_BUS_ERR("Reading device failed with err code: %d", + ret); + goto err; + } + dpci_node->tx_queue[i].fqid = tx_attr.fqid; } dpci_node->dpci_id = dpci_id; @@ -111,6 +138,19 @@ TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next); return 0; + +err: + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]); + + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + } + } + rte_free(dpci_node); + + return ret; } struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 09ea603..b09218f 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -142,7 +142,8 @@ struct dpaa2_dpci_dev { uint16_t token; rte_atomic16_t in_use; uint32_t dpci_id; /*HW ID for DPCI object */ - struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES]; }; /*! Global MCP list */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index f50bb8d..0199d66 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -87,10 +87,10 @@ const struct rte_event *event = &ev[num_tx + loop]; if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; else - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; /* Prepare enqueue descriptor */ @@ -733,13 +733,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id; rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO; - dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = dpaa2_eventdev_process_parallel; - dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = dpaa2_eventdev_process_atomic; for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) { - rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->queue[i]); + rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]); ret = dpci_set_rx_queue(&dpci_dev->dpci, CMD_PRI_LOW, dpci_dev->token, i, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta ` (2 preceding siblings ...) 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-03 14:10 ` Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta ` (3 subsequent siblings) 7 siblings, 1 reply; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 4 + config/common_base | 5 + config/common_linuxapp | 1 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 33 +++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 139 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 ++++++ drivers/raw/dpaa2_cmdif/meson.build | 7 ++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 11 files changed, 231 insertions(+), 1 deletion(-) 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/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 3fc4a2c..5255143 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -813,6 +813,10 @@ M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_qdma/ F: doc/guides/rawdevs/dpaa2_qdma.rst +DPAA2 CMDIF +M: Nipun Gupta <nipun.gupta@nxp.com> +F: drivers/raw/dpaa2_cmdif/ + Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index 9b48bcb..0d181ac 100644 --- a/config/common_base +++ b/config/common_base @@ -618,6 +618,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y # +# Compile PMD for NXP DPAA2 CMDIF raw device +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=n + +# # Compile PMD for NXP DPAA2 QDMA raw device # CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n diff --git a/config/common_linuxapp b/config/common_linuxapp index 21b3fe3..5c68cc0 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -38,4 +38,5 @@ 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_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0f2b076..2eb2787 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -6,6 +6,7 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$(<configuration>) += <directory> 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_RAWDEV) += dpaa2_cmdif DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma endif diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile new file mode 100644 index 0000000..66f9c0e --- /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_RAWDEV) += 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..e3e2b64 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -0,0 +1,139 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include <stdio.h> +#include <errno.h> +#include <stdint.h> + +#include <rte_bus_vdev.h> +#include <rte_atomic.h> +#include <rte_interrupts.h> +#include <rte_branch_prediction.h> +#include <rte_lcore.h> + +#include <rte_rawdev.h> +#include <rte_rawdev_pmd.h> + +#include <portal/dpaa2_hw_pvt.h> +#include <portal/dpaa2_hw_dpio.h> +#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("pmd.raw.dpaa2.qdma"); + 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 <rte_rawdev.h> + +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/meson.build b/drivers/raw/dpaa2_cmdif/meson.build new file mode 100644 index 0000000..dd40b7e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +deps += ['rawdev', 'mempool_dpaa2', 'bus_vdev'] +sources = files('dpaa2_cmdif.c') + +allow_experimental_apis = true 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/drivers/raw/meson.build b/drivers/raw/meson.build index 1b298f8..34dfac4 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP -drivers = ['skeleton_rawdev', 'dpaa2_qdma'] +drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' driver_name_fmt = 'rte_pmd_@0@' diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 26a6b0c..26f3563 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -252,6 +252,7 @@ endif # CONFIG_RTE_LIBRTE_EVENTDEV ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += -lrte_pmd_dpaa2_cmdif _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma endif # CONFIG_RTE_LIBRTE_FSLMC_BUS endif # CONFIG_RTE_LIBRTE_RAWDEV -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-05-03 14:10 ` Shreyansh Jain 0 siblings, 0 replies; 71+ messages in thread From: Shreyansh Jain @ 2018-05-03 14:10 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev On Wednesday 02 May 2018 10:45 PM, Nipun Gupta wrote: > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> > --- > MAINTAINERS | 4 + > config/common_base | 5 + > config/common_linuxapp | 1 + > drivers/raw/Makefile | 1 + > drivers/raw/dpaa2_cmdif/Makefile | 33 +++++ > drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 139 +++++++++++++++++++++ > drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 ++++++ > drivers/raw/dpaa2_cmdif/meson.build | 7 ++ > .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + > drivers/raw/meson.build | 2 +- > mk/rte.app.mk | 1 + > 11 files changed, 231 insertions(+), 1 deletion(-) > 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/meson.build > create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map > [...] > diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile > new file mode 100644 > index 0000000..66f9c0e > --- /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 Shared lib (x86_64 build) fails with dependency on rte_mempool_dpaa2. Using: LDLIBS += -lrte_mempool_dpaa2 Succeeds. > + > +EXPORT_MAP := rte_pmd_dpaa2_cmdif_version.map > + > +LIBABIVER := 1 > + > +# > +# all source are stored in SRCS-y > +# > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c > + > +include $(RTE_SDK)/mk/rte.lib.mk ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 5/7] raw/dpaa2_cmdif: add attribute get functionality 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta ` (3 preceding siblings ...) 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta ` (2 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index e3e2b64..bdd7c16 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -29,7 +29,32 @@ /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; +/* + * This API provides the DPCI device ID in 'attr_value'. + * The device ID shall be passed by GPP to the AIOP using CMDIF commands. + */ +static int +dpaa2_cmdif_get_attr(struct rte_rawdev *dev, + const char *attr_name, + uint64_t *attr_value) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(attr_name); + + if (!attr_value) { + DPAA2_CMDIF_ERR("Invalid arguments for getting attributes"); + return -EINVAL; + } + *attr_value = cidev->dpci_id; + + return 0; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { + .attr_get = dpaa2_cmdif_get_attr, }; static int -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta ` (4 preceding siblings ...) 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/raw/dpaa2_cmdif/Makefile | 2 + drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 136 ++++++++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 23 +++-- drivers/raw/dpaa2_cmdif/meson.build | 2 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++++++ 7 files changed, 194 insertions(+), 6 deletions(-) create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 12d3e5c..a2f9fde 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -39,6 +39,7 @@ The public API headers are grouped by topics: [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), [dpaa2] (@ref rte_dpaa2_mempool.h), + [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 71fb6b2..aa66751 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -38,6 +38,7 @@ INPUT = doc/api/doxy-api-index.md \ drivers/net/i40e \ drivers/net/ixgbe \ drivers/net/softnic \ + drivers/raw/dpaa2_cmdif \ drivers/raw/dpaa2_qdma \ lib/librte_eal/common/include \ lib/librte_eal/common/include/generic \ diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile index 66f9c0e..fdb0ec8 100644 --- a/drivers/raw/dpaa2_cmdif/Makefile +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -30,4 +30,6 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV)-include += rte_pmd_dpaa2_cmdif.h + 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 index bdd7c16..7ff111e 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -53,8 +53,144 @@ return 0; } +static int +dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_send_cnxt; + struct dpaa2_queue *txq; + struct qbman_fd fd; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_send_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + txq = &(cidev->tx_queue[cmdif_send_cnxt->priority]); + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq->fqid); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + /* Set some of the FD parameters to i. + * For performance reasons do not memset + */ + fd.simple.bpid_offset = 0; + fd.simple.ctrl = 0; + + DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(buffers[0]->buf_addr)); + DPAA2_SET_FD_LEN(&fd, cmdif_send_cnxt->size); + DPAA2_SET_FD_FRC(&fd, cmdif_send_cnxt->frc); + DPAA2_SET_FD_FLC(&fd, cmdif_send_cnxt->flc); + + /* Enqueue a packet to the QBMAN */ + do { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); + if (ret < 0 && ret != -EBUSY) + DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret); + } while (ret == -EBUSY); + + DPAA2_CMDIF_DP_DEBUG("Successfully transmitted a packet\n"); + + return 0; +} + +static int +dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_rcv_cnxt; + struct dpaa2_queue *rxq; + struct qbman_swp *swp; + struct qbman_result *dq_storage; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + uint8_t status; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); + dq_storage = rxq->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); + qbman_pull_desc_set_numframes(&pulldesc, 1); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_CMDIF_DP_WARN("VDQ cmd not issued. QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + /* Check if previous issued command is completed. */ + while (!qbman_check_command_complete(dq_storage)) + ; + /* Loop until the dq_storage is updated with new token by QBMAN */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_CMDIF_DP_DEBUG("No frame is delivered\n"); + return 0; + } + + fd = qbman_result_DQ_fd(dq_storage); + + buffers[0]->buf_addr = (void *)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd) + DPAA2_GET_FD_OFFSET(fd)); + cmdif_rcv_cnxt->size = DPAA2_GET_FD_LEN(fd); + cmdif_rcv_cnxt->flc = DPAA2_GET_FD_FLC(fd); + cmdif_rcv_cnxt->frc = DPAA2_GET_FD_FRC(fd); + + DPAA2_CMDIF_DP_DEBUG("packet received\n"); + + return 1; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { .attr_get = dpaa2_cmdif_get_attr, + .enqueue_bufs = dpaa2_cmdif_enqueue_bufs, + .dequeue_bufs = dpaa2_cmdif_dequeue_bufs, }; static int diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h index 5eb0885..598a621 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -9,18 +9,18 @@ extern "C" { #endif -#include <rte_rawdev.h> - 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) + rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "dpaa2_cmdif: " \ + fmt "\n", ## args) + +#define DPAA2_CMDIF_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_cmdif_logtype, "dpaa2_cmdif: %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...) \ @@ -28,6 +28,17 @@ #define DPAA2_CMDIF_WARN(fmt, args...) \ DPAA2_CMDIF_LOG(WARNING, fmt, ## args) +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_CMDIF_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, "dpaa2_cmdif: " fmt "\n", ## args) + +#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_CMDIF_DP_INFO(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args) +#define DPAA2_CMDIF_DP_WARN(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args) + #ifdef __cplusplus } #endif diff --git a/drivers/raw/dpaa2_cmdif/meson.build b/drivers/raw/dpaa2_cmdif/meson.build index dd40b7e..4254c39 100644 --- a/drivers/raw/dpaa2_cmdif/meson.build +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -5,3 +5,5 @@ deps += ['rawdev', 'bus_fslmc', 'bus_vdev'] sources = files('dpaa2_cmdif.c') allow_experimental_apis = true + +install_headers('rte_pmd_dpaa2_cmdif.h') diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h new file mode 100644 index 0000000..483b66e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_PMD_DPAA2_CMDIF_H__ +#define __RTE_PMD_DPAA2_CMDIF_H__ + +/** + * @file + * + * NXP dpaa2 AIOP CMDIF PMD specific structures. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** The context required in the I/O path for DPAA2 AIOP Command Interface */ +struct rte_dpaa2_cmdif_context { + /** Size to populate in QBMAN FD */ + uint32_t size; + /** FRC to populate in QBMAN FD */ + uint32_t frc; + /** FLC to populate in QBMAN FD */ + uint64_t flc; + /** Priority of the command. This priority determines DPCI Queue*/ + uint8_t priority; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_PMD_DPAA2_CMDIF_H__ */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v4 7/7] doc: add DPAA2 CMDIF rawdev guide 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta ` (5 preceding siblings ...) 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta @ 2018-05-02 17:15 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-02 17:15 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- MAINTAINERS | 1 + doc/guides/rawdevs/dpaa2_cmdif.rst | 144 +++++++++++++++++++++++++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 +++ 4 files changed, 157 insertions(+) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst diff --git a/MAINTAINERS b/MAINTAINERS index 5255143..e934e2c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -816,6 +816,7 @@ F: doc/guides/rawdevs/dpaa2_qdma.rst DPAA2 CMDIF M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_cmdif/ +F: doc/guides/rawdevs/dpaa2_cmdif.rst Eventdev Drivers diff --git a/doc/guides/rawdevs/dpaa2_cmdif.rst b/doc/guides/rawdevs/dpaa2_cmdif.rst new file mode 100644 index 0000000..20a6099 --- /dev/null +++ b/doc/guides/rawdevs/dpaa2_cmdif.rst @@ -0,0 +1,144 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2018 NXP + +NXP DPAA2 CMDIF Driver +====================== + +The DPAA2 CMDIF is an implementation of the rawdev API, that provides +communication between the GPP and AIOP (Firmware). This is achieved +via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + +More information can be found at `NXP Official Website +<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. + +Features +-------- + +The DPAA2 CMDIF implements following features in the rawdev API; + +- Getting the object ID of the device (DPCI) using attributes +- I/O to and from the AIOP device using DPCI + +Supported DPAA2 SoCs +-------------------- + +- LS2084A/LS2044A +- LS2088A/LS2048A +- LS1088A/LS1048A + +Prerequisites +------------- + +There are three main pre-requisities for executing DPAA2 CMDIF on a DPAA2 +compatible board: + +1. **ARM 64 Tool Chain** + + For example, the `*aarch64* Linaro Toolchain <https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu>`_. + +2. **Linux Kernel** + + It can be obtained from `NXP's Github hosting <https://github.com/qoriq-open-source/linux>`_. + +3. **Rootfile system** + + Any *aarch64* supporting filesystem can be used. For example, + Ubuntu 15.10 (Wily) or 16.04 LTS (Xenial) userland which can be obtained + from `here <http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.1-base-arm64.tar.gz>`_. + +As an alternative method, DPAA2 CMDIF can also be executed using images provided +as part of SDK from NXP. The SDK includes all the above prerequisites necessary +to bring up a DPAA2 board. + +The following dependencies are not part of DPDK and must be installed +separately: + +- **NXP Linux SDK** + + NXP Linux software development kit (SDK) includes support for family + of QorIQ® ARM-Architecture-based system on chip (SoC) processors + and corresponding boards. + + It includes the Linux board support packages (BSPs) for NXP SoCs, + a fully operational tool chain, kernel and board specific modules. + + SDK and related information can be obtained from: `NXP QorIQ SDK <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_. + +- **DPDK Extra Scripts** + + DPAA2 based resources can be configured easily with the help of ready scripts + as provided in the DPDK Extra repository. + + `DPDK Extras Scripts <https://github.com/qoriq-open-source/dpdk-extras>`_. + +Currently supported by DPDK: + +- NXP SDK **2.0+**. +- MC Firmware version **10.0.0** and higher. +- Supported architectures: **arm64 LE**. + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +.. note:: + + Some part of fslmc bus code (mc flib - object library) routines are + dual licensed (BSD & GPLv2). + +Pre-Installation Configuration +------------------------------ + +Config File Options +~~~~~~~~~~~~~~~~~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_dpaa2_cmdif`` driver. + +Enabling logs +------------- + +For enabling logs, use the following EAL parameter: + +.. code-block:: console + + ./your_cmdif_application <EAL args> --log-level=pmd.raw.dpaa2.cmdif,<level> + +Using ``pmd.raw.dpaa2.cmdif`` as log matching criteria, all Event PMD logs can be +enabled which are lower than logging ``level``. + +Driver Compilation +~~~~~~~~~~~~~~~~~~ + +To compile the DPAA2 CMDIF PMD for Linux arm64 gcc target, run the +following ``make`` command: + +.. code-block:: console + + cd <DPDK-source-directory> + make config T=arm64-dpaa2-linuxapp-gcc install + +Initialization +-------------- + +The DPAA2 CMDIF is exposed as a vdev device which consists of dpci devices. +On EAL initialization, dpci devices will be probed and then vdev device +can be created from the application code by + +* Invoking ``rte_vdev_init("dpaa2_dpci")`` from the application + +* Using ``--vdev="dpaa2_dpci"`` in the EAL options, which will call + rte_vdev_init() internally + +Example: + +.. code-block:: console + + ./your_cmdif_application <EAL args> --vdev="dpaa2_dpci" + +Platform Requirement +~~~~~~~~~~~~~~~~~~~~ + +DPAA2 drivers for DPDK can only work on NXP SoCs as listed in the +``Supported DPAA2 SoCs``. diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 29b4f6c..7769083 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -11,4 +11,5 @@ application through rawdev API. :maxdepth: 2 :numbered: + dpaa2_cmdif dpaa2_qdma diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index 22fa74d..d12ed2f 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -172,6 +172,17 @@ New Features See the :doc:`../rawdevs/dpaa2_qdma` guide for more details. +* **Added DPAA2 Command Interface Driver (in rawdev).** + + The DPAA2 CMDIF is an implementation of the rawdev API, that provides + communication between the GPP and NXP's QorIQ based AIOP Block (Firmware). + Advanced IO Processor i.e. AIOP is clusters of programmable RISC engines + optimised for flexible networking and I/O operations. The communication + between GPP and AIOP is achieved via using DPCI devices exposed by MC for + GPP <--> AIOP interaction. + + See the :doc:`../rawdevs/dpaa2_cmdif` guide for more details. + API Changes ----------- -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta ` (6 preceding siblings ...) 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta ` (8 more replies) 7 siblings, 9 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta This patch set introduces DPAA2 based Command Interface device driver. This driver is provides communication between the GPP and AIOP Firmware. This patchset is based on top of: https://dpdk.org/dev/patchwork/patch/39246/ Patches 1-3: Makes necessary changes and fixes in the DPAA2 bus and mempool region Patches 4-6: Add the DPAA2 CMDIF driver Patches 7: Update the respective documentation Changes in v2: - Move CMDIF compilation to common_linuxapp - Support physical addressing mode Changes in v3: - Rebased over DPAA2 QDMA patches - Updated logging adding Data Path logs too - Fix up error handling in patch 3 - Merged the two separate doc patches (patch 7) Changes in v4: - Added meson build support Changes in v5: - Fixed shared build for x86 Nipun Gupta (7): mempool/dpaa2: add functions exposed to DPDK applications bus/fslmc: expose API to free dpci device bus/fslmc: keep Tx queues information for DPCI devices too raw/dpaa2_cmdif: introduce DPAA2 command interface driver raw/dpaa2_cmdif: add attribute get functionality raw/dpaa2_cmdif: support enqueue dequeue operations doc: add DPAA2 CMDIF rawdev guide MAINTAINERS | 5 + config/common_base | 5 + config/common_linuxapp | 1 + doc/api/doxy-api-index.md | 2 + doc/api/doxy-api.conf | 2 + doc/guides/rawdevs/dpaa2_cmdif.rst | 144 ++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 + drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 ++++-- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 36 +++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 46 ++++ drivers/raw/dpaa2_cmdif/meson.build | 9 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 25 files changed, 768 insertions(+), 30 deletions(-) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h 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/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 1/7] mempool/dpaa2: add functions exposed to DPDK applications 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta ` (7 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 437d903..dd57f55 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -38,6 +38,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 88bee03..71fb6b2 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index 5125ad1..9e4c87d 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 5d057fb..e12a0ec 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> +#include "rte_dpaa2_mempool.h" #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -244,6 +245,35 @@ struct dpaa2_memseg_list rte_dpaa2_memsegs } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_mempool.h> + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index 82a5ec0..b9d996a 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -7,3 +7,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 2/7] bus/fslmc: expose API to free dpci device 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta ` (6 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 70fb719..d433714 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -114,5 +114,6 @@ DPDK_18.05 { dpdmai_open; dpdmai_set_rx_queue; dpdmai_set_tx_queue; + rte_dpaa2_free_dpci_dev; } DPDK_18.02; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 3/7] bus/fslmc: keep Tx queues information for DPCI devices too 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta ` (5 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta The DPCI devices have oth Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 +++++++++++++++++++++++--------- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/event/dpaa2/dpaa2_eventdev.c | 10 ++-- 3 files changed, 70 insertions(+), 29 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index aee870a..5ad0374 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -39,13 +39,14 @@ struct dpci_attr attr; struct dpci_rx_queue_cfg rx_queue_cfg; struct dpci_rx_queue_attr rx_attr; + struct dpci_tx_queue_attr tx_attr; int ret, i; /* Allocate DPAA2 dpci handle */ dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0); if (!dpci_node) { DPAA2_BUS_ERR("Memory allocation failed for DPCI Device"); - return -1; + return -ENOMEM; } /* Open the dpci object */ @@ -54,8 +55,7 @@ CMD_PRI_LOW, dpci_id, &dpci_node->token); if (ret) { DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } /* Get the device attributes */ @@ -63,21 +63,40 @@ CMD_PRI_LOW, dpci_node->token, &attr); if (ret != 0) { DPAA2_BUS_ERR("Reading device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } - /* Set up the Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); - ret = dpci_set_rx_queue(&dpci_node->dpci, - CMD_PRI_LOW, - dpci_node->token, - 0, &rx_queue_cfg); - if (ret) { - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", - ret); - rte_free(dpci_node); - return -1; + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); + ret = dpci_set_rx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, + i, &rx_queue_cfg); + if (ret) { + DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", + ret); + goto err; + } + + /* Allocate DQ storage for the DPCI Rx queues */ + rxq = &(dpci_node->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_BUS_ERR("q_storage allocation failed\n"); + ret = -ENOMEM; + goto err; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); + goto err; + } } /* Enable the device */ @@ -85,8 +104,7 @@ CMD_PRI_LOW, dpci_node->token); if (ret != 0) { DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { @@ -96,13 +114,22 @@ dpci_node->token, i, &rx_attr); if (ret != 0) { - DPAA2_BUS_ERR("Rx queue fetch failed with err code:" - " %d", ret); - rte_free(dpci_node); - return -1; + DPAA2_BUS_ERR("Rx queue fetch failed with err code: %d", + ret); + goto err; } + dpci_node->rx_queue[i].fqid = rx_attr.fqid; - dpci_node->queue[i].fqid = rx_attr.fqid; + ret = dpci_get_tx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, i, + &tx_attr); + if (ret != 0) { + DPAA2_BUS_ERR("Reading device failed with err code: %d", + ret); + goto err; + } + dpci_node->tx_queue[i].fqid = tx_attr.fqid; } dpci_node->dpci_id = dpci_id; @@ -111,6 +138,19 @@ TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next); return 0; + +err: + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]); + + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + } + } + rte_free(dpci_node); + + return ret; } struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 09ea603..b09218f 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -142,7 +142,8 @@ struct dpaa2_dpci_dev { uint16_t token; rte_atomic16_t in_use; uint32_t dpci_id; /*HW ID for DPCI object */ - struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES]; }; /*! Global MCP list */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index f50bb8d..0199d66 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -87,10 +87,10 @@ const struct rte_event *event = &ev[num_tx + loop]; if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; else - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; /* Prepare enqueue descriptor */ @@ -733,13 +733,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id; rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO; - dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = dpaa2_eventdev_process_parallel; - dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = dpaa2_eventdev_process_atomic; for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) { - rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->queue[i]); + rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]); ret = dpci_set_rx_queue(&dpci_dev->dpci, CMD_PRI_LOW, dpci_dev->token, i, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (2 preceding siblings ...) 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta ` (4 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 4 + config/common_base | 5 + config/common_linuxapp | 1 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 34 +++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 139 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 ++++++ drivers/raw/dpaa2_cmdif/meson.build | 7 ++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 11 files changed, 232 insertions(+), 1 deletion(-) 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/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map diff --git a/MAINTAINERS b/MAINTAINERS index b72b048..95d639e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -810,6 +810,10 @@ M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_qdma/ F: doc/guides/rawdevs/dpaa2_qdma.rst +DPAA2 CMDIF +M: Nipun Gupta <nipun.gupta@nxp.com> +F: drivers/raw/dpaa2_cmdif/ + Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index 9b48bcb..0d181ac 100644 --- a/config/common_base +++ b/config/common_base @@ -618,6 +618,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y # +# Compile PMD for NXP DPAA2 CMDIF raw device +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=n + +# # Compile PMD for NXP DPAA2 QDMA raw device # CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n diff --git a/config/common_linuxapp b/config/common_linuxapp index 21b3fe3..5c68cc0 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -38,4 +38,5 @@ 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_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0f2b076..2eb2787 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -6,6 +6,7 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$(<configuration>) += <directory> 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_RAWDEV) += dpaa2_cmdif DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma endif diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile new file mode 100644 index 0000000..5f9b8bf --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -0,0 +1,34 @@ +# 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_bus_vdev +LDLIBS += -lrte_eal +LDLIBS += -lrte_kvargs +LDLIBS += -lrte_mempool_dpaa2 +LDLIBS += -lrte_rawdev + +EXPORT_MAP := rte_pmd_dpaa2_cmdif_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += 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..e3e2b64 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -0,0 +1,139 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include <stdio.h> +#include <errno.h> +#include <stdint.h> + +#include <rte_bus_vdev.h> +#include <rte_atomic.h> +#include <rte_interrupts.h> +#include <rte_branch_prediction.h> +#include <rte_lcore.h> + +#include <rte_rawdev.h> +#include <rte_rawdev_pmd.h> + +#include <portal/dpaa2_hw_pvt.h> +#include <portal/dpaa2_hw_dpio.h> +#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("pmd.raw.dpaa2.qdma"); + 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 <rte_rawdev.h> + +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/meson.build b/drivers/raw/dpaa2_cmdif/meson.build new file mode 100644 index 0000000..91a77ce --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +deps += ['rawdev', 'mempool_dpaa2', 'bus_vdev'] +sources = files('dpaa2_cmdif.c') + +allow_experimental_apis = true 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/drivers/raw/meson.build b/drivers/raw/meson.build index 1b298f8..34dfac4 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP -drivers = ['skeleton_rawdev', 'dpaa2_qdma'] +drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' driver_name_fmt = 'rte_pmd_@0@' diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 26a6b0c..26f3563 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -252,6 +252,7 @@ endif # CONFIG_RTE_LIBRTE_EVENTDEV ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += -lrte_pmd_dpaa2_cmdif _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma endif # CONFIG_RTE_LIBRTE_FSLMC_BUS endif # CONFIG_RTE_LIBRTE_RAWDEV -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 5/7] raw/dpaa2_cmdif: add attribute get functionality 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (3 preceding siblings ...) 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta ` (3 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index e3e2b64..bdd7c16 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -29,7 +29,32 @@ /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; +/* + * This API provides the DPCI device ID in 'attr_value'. + * The device ID shall be passed by GPP to the AIOP using CMDIF commands. + */ +static int +dpaa2_cmdif_get_attr(struct rte_rawdev *dev, + const char *attr_name, + uint64_t *attr_value) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(attr_name); + + if (!attr_value) { + DPAA2_CMDIF_ERR("Invalid arguments for getting attributes"); + return -EINVAL; + } + *attr_value = cidev->dpci_id; + + return 0; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { + .attr_get = dpaa2_cmdif_get_attr, }; static int -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (4 preceding siblings ...) 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta ` (2 subsequent siblings) 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/raw/dpaa2_cmdif/Makefile | 2 + drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 136 ++++++++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 23 +++-- drivers/raw/dpaa2_cmdif/meson.build | 2 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++++++ 7 files changed, 194 insertions(+), 6 deletions(-) create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index dd57f55..55d075c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -39,6 +39,7 @@ The public API headers are grouped by topics: [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), + [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 71fb6b2..aa66751 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -38,6 +38,7 @@ INPUT = doc/api/doxy-api-index.md \ drivers/net/i40e \ drivers/net/ixgbe \ drivers/net/softnic \ + drivers/raw/dpaa2_cmdif \ drivers/raw/dpaa2_qdma \ lib/librte_eal/common/include \ lib/librte_eal/common/include/generic \ diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile index 5f9b8bf..9b863dd 100644 --- a/drivers/raw/dpaa2_cmdif/Makefile +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -31,4 +31,6 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV)-include += rte_pmd_dpaa2_cmdif.h + 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 index bdd7c16..7ff111e 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -53,8 +53,144 @@ return 0; } +static int +dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_send_cnxt; + struct dpaa2_queue *txq; + struct qbman_fd fd; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_send_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + txq = &(cidev->tx_queue[cmdif_send_cnxt->priority]); + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq->fqid); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + /* Set some of the FD parameters to i. + * For performance reasons do not memset + */ + fd.simple.bpid_offset = 0; + fd.simple.ctrl = 0; + + DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(buffers[0]->buf_addr)); + DPAA2_SET_FD_LEN(&fd, cmdif_send_cnxt->size); + DPAA2_SET_FD_FRC(&fd, cmdif_send_cnxt->frc); + DPAA2_SET_FD_FLC(&fd, cmdif_send_cnxt->flc); + + /* Enqueue a packet to the QBMAN */ + do { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); + if (ret < 0 && ret != -EBUSY) + DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret); + } while (ret == -EBUSY); + + DPAA2_CMDIF_DP_DEBUG("Successfully transmitted a packet\n"); + + return 0; +} + +static int +dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_rcv_cnxt; + struct dpaa2_queue *rxq; + struct qbman_swp *swp; + struct qbman_result *dq_storage; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + uint8_t status; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); + dq_storage = rxq->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); + qbman_pull_desc_set_numframes(&pulldesc, 1); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_CMDIF_DP_WARN("VDQ cmd not issued. QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + /* Check if previous issued command is completed. */ + while (!qbman_check_command_complete(dq_storage)) + ; + /* Loop until the dq_storage is updated with new token by QBMAN */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_CMDIF_DP_DEBUG("No frame is delivered\n"); + return 0; + } + + fd = qbman_result_DQ_fd(dq_storage); + + buffers[0]->buf_addr = (void *)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd) + DPAA2_GET_FD_OFFSET(fd)); + cmdif_rcv_cnxt->size = DPAA2_GET_FD_LEN(fd); + cmdif_rcv_cnxt->flc = DPAA2_GET_FD_FLC(fd); + cmdif_rcv_cnxt->frc = DPAA2_GET_FD_FRC(fd); + + DPAA2_CMDIF_DP_DEBUG("packet received\n"); + + return 1; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { .attr_get = dpaa2_cmdif_get_attr, + .enqueue_bufs = dpaa2_cmdif_enqueue_bufs, + .dequeue_bufs = dpaa2_cmdif_dequeue_bufs, }; static int diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h index 5eb0885..598a621 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -9,18 +9,18 @@ extern "C" { #endif -#include <rte_rawdev.h> - 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) + rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "dpaa2_cmdif: " \ + fmt "\n", ## args) + +#define DPAA2_CMDIF_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_cmdif_logtype, "dpaa2_cmdif: %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...) \ @@ -28,6 +28,17 @@ #define DPAA2_CMDIF_WARN(fmt, args...) \ DPAA2_CMDIF_LOG(WARNING, fmt, ## args) +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_CMDIF_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, "dpaa2_cmdif: " fmt "\n", ## args) + +#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_CMDIF_DP_INFO(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args) +#define DPAA2_CMDIF_DP_WARN(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args) + #ifdef __cplusplus } #endif diff --git a/drivers/raw/dpaa2_cmdif/meson.build b/drivers/raw/dpaa2_cmdif/meson.build index 91a77ce..8c90943 100644 --- a/drivers/raw/dpaa2_cmdif/meson.build +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -5,3 +5,5 @@ deps += ['rawdev', 'mempool_dpaa2', 'bus_vdev'] sources = files('dpaa2_cmdif.c') allow_experimental_apis = true + +install_headers('rte_pmd_dpaa2_cmdif.h') diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h new file mode 100644 index 0000000..483b66e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_PMD_DPAA2_CMDIF_H__ +#define __RTE_PMD_DPAA2_CMDIF_H__ + +/** + * @file + * + * NXP dpaa2 AIOP CMDIF PMD specific structures. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** The context required in the I/O path for DPAA2 AIOP Command Interface */ +struct rte_dpaa2_cmdif_context { + /** Size to populate in QBMAN FD */ + uint32_t size; + /** FRC to populate in QBMAN FD */ + uint32_t frc; + /** FLC to populate in QBMAN FD */ + uint64_t flc; + /** Priority of the command. This priority determines DPCI Queue*/ + uint8_t priority; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_PMD_DPAA2_CMDIF_H__ */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v5 7/7] doc: add DPAA2 CMDIF rawdev guide 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (5 preceding siblings ...) 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta @ 2018-05-03 16:33 ` Nipun Gupta 2018-05-04 7:15 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-03 16:33 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- MAINTAINERS | 1 + doc/guides/rawdevs/dpaa2_cmdif.rst | 144 +++++++++++++++++++++++++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 +++ 4 files changed, 157 insertions(+) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst diff --git a/MAINTAINERS b/MAINTAINERS index 95d639e..ae6d07a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -813,6 +813,7 @@ F: doc/guides/rawdevs/dpaa2_qdma.rst DPAA2 CMDIF M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_cmdif/ +F: doc/guides/rawdevs/dpaa2_cmdif.rst Eventdev Drivers diff --git a/doc/guides/rawdevs/dpaa2_cmdif.rst b/doc/guides/rawdevs/dpaa2_cmdif.rst new file mode 100644 index 0000000..20a6099 --- /dev/null +++ b/doc/guides/rawdevs/dpaa2_cmdif.rst @@ -0,0 +1,144 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2018 NXP + +NXP DPAA2 CMDIF Driver +====================== + +The DPAA2 CMDIF is an implementation of the rawdev API, that provides +communication between the GPP and AIOP (Firmware). This is achieved +via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + +More information can be found at `NXP Official Website +<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. + +Features +-------- + +The DPAA2 CMDIF implements following features in the rawdev API; + +- Getting the object ID of the device (DPCI) using attributes +- I/O to and from the AIOP device using DPCI + +Supported DPAA2 SoCs +-------------------- + +- LS2084A/LS2044A +- LS2088A/LS2048A +- LS1088A/LS1048A + +Prerequisites +------------- + +There are three main pre-requisities for executing DPAA2 CMDIF on a DPAA2 +compatible board: + +1. **ARM 64 Tool Chain** + + For example, the `*aarch64* Linaro Toolchain <https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu>`_. + +2. **Linux Kernel** + + It can be obtained from `NXP's Github hosting <https://github.com/qoriq-open-source/linux>`_. + +3. **Rootfile system** + + Any *aarch64* supporting filesystem can be used. For example, + Ubuntu 15.10 (Wily) or 16.04 LTS (Xenial) userland which can be obtained + from `here <http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.1-base-arm64.tar.gz>`_. + +As an alternative method, DPAA2 CMDIF can also be executed using images provided +as part of SDK from NXP. The SDK includes all the above prerequisites necessary +to bring up a DPAA2 board. + +The following dependencies are not part of DPDK and must be installed +separately: + +- **NXP Linux SDK** + + NXP Linux software development kit (SDK) includes support for family + of QorIQ® ARM-Architecture-based system on chip (SoC) processors + and corresponding boards. + + It includes the Linux board support packages (BSPs) for NXP SoCs, + a fully operational tool chain, kernel and board specific modules. + + SDK and related information can be obtained from: `NXP QorIQ SDK <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_. + +- **DPDK Extra Scripts** + + DPAA2 based resources can be configured easily with the help of ready scripts + as provided in the DPDK Extra repository. + + `DPDK Extras Scripts <https://github.com/qoriq-open-source/dpdk-extras>`_. + +Currently supported by DPDK: + +- NXP SDK **2.0+**. +- MC Firmware version **10.0.0** and higher. +- Supported architectures: **arm64 LE**. + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +.. note:: + + Some part of fslmc bus code (mc flib - object library) routines are + dual licensed (BSD & GPLv2). + +Pre-Installation Configuration +------------------------------ + +Config File Options +~~~~~~~~~~~~~~~~~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_dpaa2_cmdif`` driver. + +Enabling logs +------------- + +For enabling logs, use the following EAL parameter: + +.. code-block:: console + + ./your_cmdif_application <EAL args> --log-level=pmd.raw.dpaa2.cmdif,<level> + +Using ``pmd.raw.dpaa2.cmdif`` as log matching criteria, all Event PMD logs can be +enabled which are lower than logging ``level``. + +Driver Compilation +~~~~~~~~~~~~~~~~~~ + +To compile the DPAA2 CMDIF PMD for Linux arm64 gcc target, run the +following ``make`` command: + +.. code-block:: console + + cd <DPDK-source-directory> + make config T=arm64-dpaa2-linuxapp-gcc install + +Initialization +-------------- + +The DPAA2 CMDIF is exposed as a vdev device which consists of dpci devices. +On EAL initialization, dpci devices will be probed and then vdev device +can be created from the application code by + +* Invoking ``rte_vdev_init("dpaa2_dpci")`` from the application + +* Using ``--vdev="dpaa2_dpci"`` in the EAL options, which will call + rte_vdev_init() internally + +Example: + +.. code-block:: console + + ./your_cmdif_application <EAL args> --vdev="dpaa2_dpci" + +Platform Requirement +~~~~~~~~~~~~~~~~~~~~ + +DPAA2 drivers for DPDK can only work on NXP SoCs as listed in the +``Supported DPAA2 SoCs``. diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 29b4f6c..7769083 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -11,4 +11,5 @@ application through rawdev API. :maxdepth: 2 :numbered: + dpaa2_cmdif dpaa2_qdma diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index 22fa74d..d12ed2f 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -172,6 +172,17 @@ New Features See the :doc:`../rawdevs/dpaa2_qdma` guide for more details. +* **Added DPAA2 Command Interface Driver (in rawdev).** + + The DPAA2 CMDIF is an implementation of the rawdev API, that provides + communication between the GPP and NXP's QorIQ based AIOP Block (Firmware). + Advanced IO Processor i.e. AIOP is clusters of programmable RISC engines + optimised for flexible networking and I/O operations. The communication + between GPP and AIOP is achieved via using DPCI devices exposed by MC for + GPP <--> AIOP interaction. + + See the :doc:`../rawdevs/dpaa2_cmdif` guide for more details. + API Changes ----------- -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (6 preceding siblings ...) 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-05-04 7:15 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta 8 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 7:15 UTC (permalink / raw) To: thomas, Hemant Agrawal, Shreyansh Jain; +Cc: dev There is an intermediate patch compilation break. Will fix this and resend. Apologies for this and I will take care of this from next time. Thanks, Nipun > -----Original Message----- > From: Nipun Gupta > Sent: Thursday, May 3, 2018 10:04 PM > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver > > This patch set introduces DPAA2 based Command Interface > device driver. > > This driver is provides communication between the GPP and > AIOP Firmware. > > This patchset is based on top of: > https://dpdk.org/dev/patchwork/patch/39246/ > > Patches 1-3: > Makes necessary changes and fixes in the DPAA2 bus and > mempool region > Patches 4-6: > Add the DPAA2 CMDIF driver > Patches 7: > Update the respective documentation > > Changes in v2: > - Move CMDIF compilation to common_linuxapp > - Support physical addressing mode > > Changes in v3: > - Rebased over DPAA2 QDMA patches > - Updated logging adding Data Path logs too > - Fix up error handling in patch 3 > - Merged the two separate doc patches (patch 7) > > Changes in v4: > - Added meson build support > > Changes in v5: > - Fixed shared build for x86 > > Nipun Gupta (7): > mempool/dpaa2: add functions exposed to DPDK applications > bus/fslmc: expose API to free dpci device > bus/fslmc: keep Tx queues information for DPCI devices too > raw/dpaa2_cmdif: introduce DPAA2 command interface driver > raw/dpaa2_cmdif: add attribute get functionality > raw/dpaa2_cmdif: support enqueue dequeue operations > doc: add DPAA2 CMDIF rawdev guide > > MAINTAINERS | 5 + > config/common_base | 5 + > config/common_linuxapp | 1 + > doc/api/doxy-api-index.md | 2 + > doc/api/doxy-api.conf | 2 + > doc/guides/rawdevs/dpaa2_cmdif.rst | 144 ++++++++++ > doc/guides/rawdevs/index.rst | 1 + > doc/guides/rel_notes/release_18_05.rst | 11 + > drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 ++++-- > drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- > drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + > drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- > drivers/mempool/dpaa2/Makefile | 2 + > drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ > drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ > .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + > drivers/raw/Makefile | 1 + > drivers/raw/dpaa2_cmdif/Makefile | 36 +++ > drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 > +++++++++++++++++++++ > drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 46 ++++ > drivers/raw/dpaa2_cmdif/meson.build | 9 + > drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ > .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + > drivers/raw/meson.build | 2 +- > mk/rte.app.mk | 1 + > 25 files changed, 768 insertions(+), 30 deletions(-) > create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst > create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h > 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/meson.build > create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h > create mode 100644 > drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map > > -- > 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta ` (7 preceding siblings ...) 2018-05-04 7:15 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta ` (7 more replies) 8 siblings, 8 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta This patch set introduces DPAA2 based Command Interface device driver. This driver is provides communication between the GPP and AIOP Firmware. This patchset is based on top of: https://dpdk.org/dev/patchwork/patch/39246/ Patches 1-3: Makes necessary changes and fixes in the DPAA2 bus and mempool region Patches 4-6: Add the DPAA2 CMDIF driver Patches 7: Update the respective documentation Changes in v2: - Move CMDIF compilation to common_linuxapp - Support physical addressing mode Changes in v3: - Rebased over DPAA2 QDMA patches - Updated logging adding Data Path logs too - Fix up error handling in patch 3 - Merged the two separate doc patches (patch 7) Changes in v4: - Added meson build support Changes in v5: - Fixed shared build for x86 Changes in v6: - Fixed intermediate shared build break (patch 4) Nipun Gupta (7): mempool/dpaa2: add functions exposed to DPDK applications bus/fslmc: expose API to free dpci device bus/fslmc: keep Tx queues information for DPCI devices too raw/dpaa2_cmdif: introduce DPAA2 command interface driver raw/dpaa2_cmdif: add attribute get functionality raw/dpaa2_cmdif: support enqueue dequeue operations doc: add DPAA2 CMDIF rawdev guide MAINTAINERS | 5 + config/common_base | 5 + config/common_linuxapp | 1 + doc/api/doxy-api-index.md | 2 + doc/api/doxy-api.conf | 2 + doc/guides/rawdevs/dpaa2_cmdif.rst | 144 ++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 + drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 ++++-- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + drivers/event/dpaa2/dpaa2_eventdev.c | 10 +- drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 +++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 36 +++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 300 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 46 ++++ drivers/raw/dpaa2_cmdif/meson.build | 9 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 25 files changed, 768 insertions(+), 30 deletions(-) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h 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/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 1/7] mempool/dpaa2: add functions exposed to DPDK applications 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta ` (6 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 437d903..dd57f55 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -38,6 +38,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 88bee03..71fb6b2 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index 5125ad1..9e4c87d 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 5d057fb..e12a0ec 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> +#include "rte_dpaa2_mempool.h" #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> @@ -244,6 +245,35 @@ struct dpaa2_memseg_list rte_dpaa2_memsegs } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rte_mempool.h> + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index 82a5ec0..b9d996a 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -7,3 +7,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 2/7] bus/fslmc: expose API to free dpci device 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta ` (5 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 70fb719..d433714 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -114,5 +114,6 @@ DPDK_18.05 { dpdmai_open; dpdmai_set_rx_queue; dpdmai_set_tx_queue; + rte_dpaa2_free_dpci_dev; } DPDK_18.02; -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 3/7] bus/fslmc: keep Tx queues information for DPCI devices too 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta ` (4 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta The DPCI devices have oth Tx and Rx queues. Event devices use DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues. This patch enables Tx queues configuration too. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> --- drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 86 +++++++++++++++++++++++--------- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 3 +- drivers/event/dpaa2/dpaa2_eventdev.c | 10 ++-- 3 files changed, 70 insertions(+), 29 deletions(-) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index aee870a..5ad0374 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -39,13 +39,14 @@ struct dpci_attr attr; struct dpci_rx_queue_cfg rx_queue_cfg; struct dpci_rx_queue_attr rx_attr; + struct dpci_tx_queue_attr tx_attr; int ret, i; /* Allocate DPAA2 dpci handle */ dpci_node = rte_malloc(NULL, sizeof(struct dpaa2_dpci_dev), 0); if (!dpci_node) { DPAA2_BUS_ERR("Memory allocation failed for DPCI Device"); - return -1; + return -ENOMEM; } /* Open the dpci object */ @@ -54,8 +55,7 @@ CMD_PRI_LOW, dpci_id, &dpci_node->token); if (ret) { DPAA2_BUS_ERR("Resource alloc failure with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } /* Get the device attributes */ @@ -63,21 +63,40 @@ CMD_PRI_LOW, dpci_node->token, &attr); if (ret != 0) { DPAA2_BUS_ERR("Reading device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } - /* Set up the Rx Queue */ - memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); - ret = dpci_set_rx_queue(&dpci_node->dpci, - CMD_PRI_LOW, - dpci_node->token, - 0, &rx_queue_cfg); - if (ret) { - DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", - ret); - rte_free(dpci_node); - return -1; + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq; + + memset(&rx_queue_cfg, 0, sizeof(struct dpci_rx_queue_cfg)); + ret = dpci_set_rx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, + i, &rx_queue_cfg); + if (ret) { + DPAA2_BUS_ERR("Setting Rx queue failed with err code: %d", + ret); + goto err; + } + + /* Allocate DQ storage for the DPCI Rx queues */ + rxq = &(dpci_node->rx_queue[i]); + rxq->q_storage = rte_malloc("dq_storage", + sizeof(struct queue_storage_info_t), + RTE_CACHE_LINE_SIZE); + if (!rxq->q_storage) { + DPAA2_BUS_ERR("q_storage allocation failed\n"); + ret = -ENOMEM; + goto err; + } + + memset(rxq->q_storage, 0, sizeof(struct queue_storage_info_t)); + ret = dpaa2_alloc_dq_storage(rxq->q_storage); + if (ret) { + DPAA2_BUS_ERR("dpaa2_alloc_dq_storage failed\n"); + goto err; + } } /* Enable the device */ @@ -85,8 +104,7 @@ CMD_PRI_LOW, dpci_node->token); if (ret != 0) { DPAA2_BUS_ERR("Enabling device failed with err code: %d", ret); - rte_free(dpci_node); - return -1; + goto err; } for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { @@ -96,13 +114,22 @@ dpci_node->token, i, &rx_attr); if (ret != 0) { - DPAA2_BUS_ERR("Rx queue fetch failed with err code:" - " %d", ret); - rte_free(dpci_node); - return -1; + DPAA2_BUS_ERR("Rx queue fetch failed with err code: %d", + ret); + goto err; } + dpci_node->rx_queue[i].fqid = rx_attr.fqid; - dpci_node->queue[i].fqid = rx_attr.fqid; + ret = dpci_get_tx_queue(&dpci_node->dpci, + CMD_PRI_LOW, + dpci_node->token, i, + &tx_attr); + if (ret != 0) { + DPAA2_BUS_ERR("Reading device failed with err code: %d", + ret); + goto err; + } + dpci_node->tx_queue[i].fqid = tx_attr.fqid; } dpci_node->dpci_id = dpci_id; @@ -111,6 +138,19 @@ TAILQ_INSERT_TAIL(&dpci_dev_list, dpci_node, next); return 0; + +err: + for (i = 0; i < DPAA2_DPCI_MAX_QUEUES; i++) { + struct dpaa2_queue *rxq = &(dpci_node->rx_queue[i]); + + if (rxq->q_storage) { + dpaa2_free_dq_storage(rxq->q_storage); + rte_free(rxq->q_storage); + } + } + rte_free(dpci_node); + + return ret; } struct dpaa2_dpci_dev *rte_dpaa2_alloc_dpci_dev(void) diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 09ea603..b09218f 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -142,7 +142,8 @@ struct dpaa2_dpci_dev { uint16_t token; rte_atomic16_t in_use; uint32_t dpci_id; /*HW ID for DPCI object */ - struct dpaa2_queue queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue rx_queue[DPAA2_DPCI_MAX_QUEUES]; + struct dpaa2_queue tx_queue[DPAA2_DPCI_MAX_QUEUES]; }; /*! Global MCP list */ diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index f50bb8d..0199d66 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -87,10 +87,10 @@ const struct rte_event *event = &ev[num_tx + loop]; if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; else - fqid = evq_info->dpci->queue[ + fqid = evq_info->dpci->rx_queue[ DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; /* Prepare enqueue descriptor */ @@ -733,13 +733,13 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, rx_queue_cfg.dest_cfg.dest_id = dpcon_dev->dpcon_id; rx_queue_cfg.dest_cfg.priority = DPAA2_EVENT_DEFAULT_DPCI_PRIO; - dpci_dev->queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_PARALLEL_QUEUE].cb = dpaa2_eventdev_process_parallel; - dpci_dev->queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = + dpci_dev->rx_queue[DPAA2_EVENT_DPCI_ATOMIC_QUEUE].cb = dpaa2_eventdev_process_atomic; for (i = 0 ; i < DPAA2_EVENT_DPCI_MAX_QUEUES; i++) { - rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->queue[i]); + rx_queue_cfg.user_ctx = (size_t)(&dpci_dev->rx_queue[i]); ret = dpci_set_rx_queue(&dpci_dev->dpci, CMD_PRI_LOW, dpci_dev->token, i, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta ` (2 preceding siblings ...) 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta ` (3 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- MAINTAINERS | 4 + config/common_base | 5 + config/common_linuxapp | 1 + drivers/raw/Makefile | 1 + drivers/raw/dpaa2_cmdif/Makefile | 34 +++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 137 +++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 35 ++++++ drivers/raw/dpaa2_cmdif/meson.build | 7 ++ .../dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map | 4 + drivers/raw/meson.build | 2 +- mk/rte.app.mk | 1 + 11 files changed, 230 insertions(+), 1 deletion(-) 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/meson.build create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif_version.map diff --git a/MAINTAINERS b/MAINTAINERS index b72b048..95d639e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -810,6 +810,10 @@ M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_qdma/ F: doc/guides/rawdevs/dpaa2_qdma.rst +DPAA2 CMDIF +M: Nipun Gupta <nipun.gupta@nxp.com> +F: drivers/raw/dpaa2_cmdif/ + Eventdev Drivers ---------------- diff --git a/config/common_base b/config/common_base index 9b48bcb..0d181ac 100644 --- a/config/common_base +++ b/config/common_base @@ -618,6 +618,11 @@ CONFIG_RTE_RAWDEV_MAX_DEVS=10 CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV=y # +# Compile PMD for NXP DPAA2 CMDIF raw device +# +CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV=n + +# # Compile PMD for NXP DPAA2 QDMA raw device # CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n diff --git a/config/common_linuxapp b/config/common_linuxapp index 8ee495b..ea804b7 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -38,4 +38,5 @@ 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_RAWDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=y diff --git a/drivers/raw/Makefile b/drivers/raw/Makefile index 0f2b076..2eb2787 100644 --- a/drivers/raw/Makefile +++ b/drivers/raw/Makefile @@ -6,6 +6,7 @@ include $(RTE_SDK)/mk/rte.vars.mk # DIRS-$(<configuration>) += <directory> 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_RAWDEV) += dpaa2_cmdif DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma endif diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile new file mode 100644 index 0000000..5f9b8bf --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -0,0 +1,34 @@ +# 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_bus_vdev +LDLIBS += -lrte_eal +LDLIBS += -lrte_kvargs +LDLIBS += -lrte_mempool_dpaa2 +LDLIBS += -lrte_rawdev + +EXPORT_MAP := rte_pmd_dpaa2_cmdif_version.map + +LIBABIVER := 1 + +# +# all source are stored in SRCS-y +# +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += 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..789fe36 --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#include <stdio.h> +#include <errno.h> +#include <stdint.h> + +#include <rte_bus_vdev.h> +#include <rte_atomic.h> +#include <rte_interrupts.h> +#include <rte_branch_prediction.h> +#include <rte_lcore.h> + +#include <rte_rawdev.h> +#include <rte_rawdev_pmd.h> + +#include <portal/dpaa2_hw_pvt.h> +#include <portal/dpaa2_hw_dpio.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("pmd.raw.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 <rte_rawdev.h> + +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/meson.build b/drivers/raw/dpaa2_cmdif/meson.build new file mode 100644 index 0000000..91a77ce --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018 NXP + +deps += ['rawdev', 'mempool_dpaa2', 'bus_vdev'] +sources = files('dpaa2_cmdif.c') + +allow_experimental_apis = true 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/drivers/raw/meson.build b/drivers/raw/meson.build index 1b298f8..34dfac4 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP -drivers = ['skeleton_rawdev', 'dpaa2_qdma'] +drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma'] std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' driver_name_fmt = 'rte_pmd_@0@' diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 26a6b0c..26f3563 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -252,6 +252,7 @@ endif # CONFIG_RTE_LIBRTE_EVENTDEV ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_RAWDEV) += -lrte_pmd_skeleton_rawdev ifeq ($(CONFIG_RTE_EAL_VFIO)$(CONFIG_RTE_LIBRTE_FSLMC_BUS),yy) +_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += -lrte_pmd_dpaa2_cmdif _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += -lrte_pmd_dpaa2_qdma endif # CONFIG_RTE_LIBRTE_FSLMC_BUS endif # CONFIG_RTE_LIBRTE_RAWDEV -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 5/7] raw/dpaa2_cmdif: add attribute get functionality 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta ` (3 preceding siblings ...) 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta ` (2 subsequent siblings) 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index 789fe36..c16bb12 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -28,7 +28,33 @@ /* CMDIF driver object */ static struct rte_vdev_driver dpaa2_cmdif_drv; -static const struct rte_rawdev_ops dpaa2_cmdif_ops; +/* + * This API provides the DPCI device ID in 'attr_value'. + * The device ID shall be passed by GPP to the AIOP using CMDIF commands. + */ +static int +dpaa2_cmdif_get_attr(struct rte_rawdev *dev, + const char *attr_name, + uint64_t *attr_value) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(attr_name); + + if (!attr_value) { + DPAA2_CMDIF_ERR("Invalid arguments for getting attributes"); + return -EINVAL; + } + *attr_value = cidev->dpci_id; + + return 0; +} + +static const struct rte_rawdev_ops dpaa2_cmdif_ops = { + .attr_get = dpaa2_cmdif_get_attr, +}; static int dpaa2_cmdif_create(const char *name, -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta ` (4 preceding siblings ...) 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-05-05 18:44 ` [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver Shreyansh Jain 7 siblings, 0 replies; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/raw/dpaa2_cmdif/Makefile | 2 + drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 137 ++++++++++++++++++++++++++ drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 23 +++-- drivers/raw/dpaa2_cmdif/meson.build | 2 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 35 +++++++ 7 files changed, 195 insertions(+), 6 deletions(-) create mode 100644 drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index dd57f55..55d075c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -39,6 +39,7 @@ The public API headers are grouped by topics: [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), [dpaa2_mempool] (@ref rte_dpaa2_mempool.h), + [dpaa2_cmdif] (@ref rte_pmd_dpaa2_cmdif.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 71fb6b2..aa66751 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -38,6 +38,7 @@ INPUT = doc/api/doxy-api-index.md \ drivers/net/i40e \ drivers/net/ixgbe \ drivers/net/softnic \ + drivers/raw/dpaa2_cmdif \ drivers/raw/dpaa2_qdma \ lib/librte_eal/common/include \ lib/librte_eal/common/include/generic \ diff --git a/drivers/raw/dpaa2_cmdif/Makefile b/drivers/raw/dpaa2_cmdif/Makefile index 5f9b8bf..9b863dd 100644 --- a/drivers/raw/dpaa2_cmdif/Makefile +++ b/drivers/raw/dpaa2_cmdif/Makefile @@ -31,4 +31,6 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif.c +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV)-include += rte_pmd_dpaa2_cmdif.h + 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 index c16bb12..911301b 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -18,6 +18,7 @@ #include <portal/dpaa2_hw_pvt.h> #include <portal/dpaa2_hw_dpio.h> #include "dpaa2_cmdif_logs.h" +#include "rte_pmd_dpaa2_cmdif.h" /* Dynamic log type identifier */ int dpaa2_cmdif_logtype; @@ -52,8 +53,144 @@ return 0; } +static int +dpaa2_cmdif_enqueue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_send_cnxt; + struct dpaa2_queue *txq; + struct qbman_fd fd; + struct qbman_eq_desc eqdesc; + struct qbman_swp *swp; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_send_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + txq = &(cidev->tx_queue[cmdif_send_cnxt->priority]); + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc); + qbman_eq_desc_set_fq(&eqdesc, txq->fqid); + qbman_eq_desc_set_no_orp(&eqdesc, 0); + qbman_eq_desc_set_response(&eqdesc, 0, 0); + + /* Set some of the FD parameters to i. + * For performance reasons do not memset + */ + fd.simple.bpid_offset = 0; + fd.simple.ctrl = 0; + + DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(buffers[0]->buf_addr)); + DPAA2_SET_FD_LEN(&fd, cmdif_send_cnxt->size); + DPAA2_SET_FD_FRC(&fd, cmdif_send_cnxt->frc); + DPAA2_SET_FD_FLC(&fd, cmdif_send_cnxt->flc); + + /* Enqueue a packet to the QBMAN */ + do { + ret = qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); + if (ret < 0 && ret != -EBUSY) + DPAA2_CMDIF_ERR("Transmit failure with err: %d\n", ret); + } while (ret == -EBUSY); + + DPAA2_CMDIF_DP_DEBUG("Successfully transmitted a packet\n"); + + return 0; +} + +static int +dpaa2_cmdif_dequeue_bufs(struct rte_rawdev *dev, + struct rte_rawdev_buf **buffers, + unsigned int count, + rte_rawdev_obj_t context) +{ + struct dpaa2_dpci_dev *cidev = dev->dev_private; + struct rte_dpaa2_cmdif_context *cmdif_rcv_cnxt; + struct dpaa2_queue *rxq; + struct qbman_swp *swp; + struct qbman_result *dq_storage; + const struct qbman_fd *fd; + struct qbman_pull_desc pulldesc; + uint8_t status; + int ret; + + DPAA2_CMDIF_FUNC_TRACE(); + + RTE_SET_USED(count); + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_CMDIF_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + cmdif_rcv_cnxt = (struct rte_dpaa2_cmdif_context *)(context); + rxq = &(cidev->rx_queue[cmdif_rcv_cnxt->priority]); + dq_storage = rxq->q_storage->dq_storage[0]; + + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, rxq->fqid); + qbman_pull_desc_set_numframes(&pulldesc, 1); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_CMDIF_DP_WARN("VDQ cmd not issued. QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + /* Check if previous issued command is completed. */ + while (!qbman_check_command_complete(dq_storage)) + ; + /* Loop until the dq_storage is updated with new token by QBMAN */ + while (!qbman_result_has_new_result(swp, dq_storage)) + ; + + /* Check for valid frame. */ + status = (uint8_t)qbman_result_DQ_flags(dq_storage); + if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) { + DPAA2_CMDIF_DP_DEBUG("No frame is delivered\n"); + return 0; + } + + fd = qbman_result_DQ_fd(dq_storage); + + buffers[0]->buf_addr = (void *)DPAA2_IOVA_TO_VADDR( + DPAA2_GET_FD_ADDR(fd) + DPAA2_GET_FD_OFFSET(fd)); + cmdif_rcv_cnxt->size = DPAA2_GET_FD_LEN(fd); + cmdif_rcv_cnxt->flc = DPAA2_GET_FD_FLC(fd); + cmdif_rcv_cnxt->frc = DPAA2_GET_FD_FRC(fd); + + DPAA2_CMDIF_DP_DEBUG("packet received\n"); + + return 1; +} + static const struct rte_rawdev_ops dpaa2_cmdif_ops = { .attr_get = dpaa2_cmdif_get_attr, + .enqueue_bufs = dpaa2_cmdif_enqueue_bufs, + .dequeue_bufs = dpaa2_cmdif_dequeue_bufs, }; static int diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h index 5eb0885..598a621 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -9,18 +9,18 @@ extern "C" { #endif -#include <rte_rawdev.h> - 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) + rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "dpaa2_cmdif: " \ + fmt "\n", ## args) + +#define DPAA2_CMDIF_DEBUG(fmt, args...) \ + rte_log(RTE_LOG_DEBUG, dpaa2_cmdif_logtype, "dpaa2_cmdif: %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...) \ @@ -28,6 +28,17 @@ #define DPAA2_CMDIF_WARN(fmt, args...) \ DPAA2_CMDIF_LOG(WARNING, fmt, ## args) +/* DP Logs, toggled out at compile time if level lower than current level */ +#define DPAA2_CMDIF_DP_LOG(level, fmt, args...) \ + RTE_LOG_DP(level, PMD, "dpaa2_cmdif: " fmt "\n", ## args) + +#define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args) +#define DPAA2_CMDIF_DP_INFO(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(INFO, fmt, ## args) +#define DPAA2_CMDIF_DP_WARN(fmt, args...) \ + DPAA2_CMDIF_DP_LOG(WARNING, fmt, ## args) + #ifdef __cplusplus } #endif diff --git a/drivers/raw/dpaa2_cmdif/meson.build b/drivers/raw/dpaa2_cmdif/meson.build index 91a77ce..8c90943 100644 --- a/drivers/raw/dpaa2_cmdif/meson.build +++ b/drivers/raw/dpaa2_cmdif/meson.build @@ -5,3 +5,5 @@ deps += ['rawdev', 'mempool_dpaa2', 'bus_vdev'] sources = files('dpaa2_cmdif.c') allow_experimental_apis = true + +install_headers('rte_pmd_dpaa2_cmdif.h') diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h new file mode 100644 index 0000000..483b66e --- /dev/null +++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_PMD_DPAA2_CMDIF_H__ +#define __RTE_PMD_DPAA2_CMDIF_H__ + +/** + * @file + * + * NXP dpaa2 AIOP CMDIF PMD specific structures. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** The context required in the I/O path for DPAA2 AIOP Command Interface */ +struct rte_dpaa2_cmdif_context { + /** Size to populate in QBMAN FD */ + uint32_t size; + /** FRC to populate in QBMAN FD */ + uint32_t frc; + /** FLC to populate in QBMAN FD */ + uint64_t flc; + /** Priority of the command. This priority determines DPCI Queue*/ + uint8_t priority; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_PMD_DPAA2_CMDIF_H__ */ -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta ` (5 preceding siblings ...) 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta @ 2018-05-04 10:11 ` Nipun Gupta 2018-05-08 12:08 ` Thomas Monjalon 2018-05-05 18:44 ` [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver Shreyansh Jain 7 siblings, 1 reply; 71+ messages in thread From: Nipun Gupta @ 2018-05-04 10:11 UTC (permalink / raw) To: thomas, hemant.agrawal, shreyansh.jain; +Cc: dev, Nipun Gupta Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Acked-by: Marko Kovacevic <marko.kovacevic@intel.com> --- MAINTAINERS | 1 + doc/guides/rawdevs/dpaa2_cmdif.rst | 144 +++++++++++++++++++++++++++++++++ doc/guides/rawdevs/index.rst | 1 + doc/guides/rel_notes/release_18_05.rst | 11 +++ 4 files changed, 157 insertions(+) create mode 100644 doc/guides/rawdevs/dpaa2_cmdif.rst diff --git a/MAINTAINERS b/MAINTAINERS index 95d639e..ae6d07a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -813,6 +813,7 @@ F: doc/guides/rawdevs/dpaa2_qdma.rst DPAA2 CMDIF M: Nipun Gupta <nipun.gupta@nxp.com> F: drivers/raw/dpaa2_cmdif/ +F: doc/guides/rawdevs/dpaa2_cmdif.rst Eventdev Drivers diff --git a/doc/guides/rawdevs/dpaa2_cmdif.rst b/doc/guides/rawdevs/dpaa2_cmdif.rst new file mode 100644 index 0000000..20a6099 --- /dev/null +++ b/doc/guides/rawdevs/dpaa2_cmdif.rst @@ -0,0 +1,144 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright 2018 NXP + +NXP DPAA2 CMDIF Driver +====================== + +The DPAA2 CMDIF is an implementation of the rawdev API, that provides +communication between the GPP and AIOP (Firmware). This is achieved +via using the DPCI devices exposed by MC for GPP <--> AIOP interaction. + +More information can be found at `NXP Official Website +<http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/qoriq-arm-processors:QORIQ-ARM>`_. + +Features +-------- + +The DPAA2 CMDIF implements following features in the rawdev API; + +- Getting the object ID of the device (DPCI) using attributes +- I/O to and from the AIOP device using DPCI + +Supported DPAA2 SoCs +-------------------- + +- LS2084A/LS2044A +- LS2088A/LS2048A +- LS1088A/LS1048A + +Prerequisites +------------- + +There are three main pre-requisities for executing DPAA2 CMDIF on a DPAA2 +compatible board: + +1. **ARM 64 Tool Chain** + + For example, the `*aarch64* Linaro Toolchain <https://releases.linaro.org/components/toolchain/binaries/6.3-2017.02/aarch64-linux-gnu>`_. + +2. **Linux Kernel** + + It can be obtained from `NXP's Github hosting <https://github.com/qoriq-open-source/linux>`_. + +3. **Rootfile system** + + Any *aarch64* supporting filesystem can be used. For example, + Ubuntu 15.10 (Wily) or 16.04 LTS (Xenial) userland which can be obtained + from `here <http://cdimage.ubuntu.com/ubuntu-base/releases/16.04/release/ubuntu-base-16.04.1-base-arm64.tar.gz>`_. + +As an alternative method, DPAA2 CMDIF can also be executed using images provided +as part of SDK from NXP. The SDK includes all the above prerequisites necessary +to bring up a DPAA2 board. + +The following dependencies are not part of DPDK and must be installed +separately: + +- **NXP Linux SDK** + + NXP Linux software development kit (SDK) includes support for family + of QorIQ® ARM-Architecture-based system on chip (SoC) processors + and corresponding boards. + + It includes the Linux board support packages (BSPs) for NXP SoCs, + a fully operational tool chain, kernel and board specific modules. + + SDK and related information can be obtained from: `NXP QorIQ SDK <http://www.nxp.com/products/software-and-tools/run-time-software/linux-sdk/linux-sdk-for-qoriq-processors:SDKLINUX>`_. + +- **DPDK Extra Scripts** + + DPAA2 based resources can be configured easily with the help of ready scripts + as provided in the DPDK Extra repository. + + `DPDK Extras Scripts <https://github.com/qoriq-open-source/dpdk-extras>`_. + +Currently supported by DPDK: + +- NXP SDK **2.0+**. +- MC Firmware version **10.0.0** and higher. +- Supported architectures: **arm64 LE**. + +- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment. + +.. note:: + + Some part of fslmc bus code (mc flib - object library) routines are + dual licensed (BSD & GPLv2). + +Pre-Installation Configuration +------------------------------ + +Config File Options +~~~~~~~~~~~~~~~~~~~ + +The following options can be modified in the ``config`` file. + +- ``CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV`` (default ``y``) + + Toggle compilation of the ``lrte_pmd_dpaa2_cmdif`` driver. + +Enabling logs +------------- + +For enabling logs, use the following EAL parameter: + +.. code-block:: console + + ./your_cmdif_application <EAL args> --log-level=pmd.raw.dpaa2.cmdif,<level> + +Using ``pmd.raw.dpaa2.cmdif`` as log matching criteria, all Event PMD logs can be +enabled which are lower than logging ``level``. + +Driver Compilation +~~~~~~~~~~~~~~~~~~ + +To compile the DPAA2 CMDIF PMD for Linux arm64 gcc target, run the +following ``make`` command: + +.. code-block:: console + + cd <DPDK-source-directory> + make config T=arm64-dpaa2-linuxapp-gcc install + +Initialization +-------------- + +The DPAA2 CMDIF is exposed as a vdev device which consists of dpci devices. +On EAL initialization, dpci devices will be probed and then vdev device +can be created from the application code by + +* Invoking ``rte_vdev_init("dpaa2_dpci")`` from the application + +* Using ``--vdev="dpaa2_dpci"`` in the EAL options, which will call + rte_vdev_init() internally + +Example: + +.. code-block:: console + + ./your_cmdif_application <EAL args> --vdev="dpaa2_dpci" + +Platform Requirement +~~~~~~~~~~~~~~~~~~~~ + +DPAA2 drivers for DPDK can only work on NXP SoCs as listed in the +``Supported DPAA2 SoCs``. diff --git a/doc/guides/rawdevs/index.rst b/doc/guides/rawdevs/index.rst index 29b4f6c..7769083 100644 --- a/doc/guides/rawdevs/index.rst +++ b/doc/guides/rawdevs/index.rst @@ -11,4 +11,5 @@ application through rawdev API. :maxdepth: 2 :numbered: + dpaa2_cmdif dpaa2_qdma diff --git a/doc/guides/rel_notes/release_18_05.rst b/doc/guides/rel_notes/release_18_05.rst index 22fa74d..d12ed2f 100644 --- a/doc/guides/rel_notes/release_18_05.rst +++ b/doc/guides/rel_notes/release_18_05.rst @@ -172,6 +172,17 @@ New Features See the :doc:`../rawdevs/dpaa2_qdma` guide for more details. +* **Added DPAA2 Command Interface Driver (in rawdev).** + + The DPAA2 CMDIF is an implementation of the rawdev API, that provides + communication between the GPP and NXP's QorIQ based AIOP Block (Firmware). + Advanced IO Processor i.e. AIOP is clusters of programmable RISC engines + optimised for flexible networking and I/O operations. The communication + between GPP and AIOP is achieved via using DPCI devices exposed by MC for + GPP <--> AIOP interaction. + + See the :doc:`../rawdevs/dpaa2_cmdif` guide for more details. + API Changes ----------- -- 1.9.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-05-08 12:08 ` Thomas Monjalon 0 siblings, 0 replies; 71+ messages in thread From: Thomas Monjalon @ 2018-05-08 12:08 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev, hemant.agrawal, shreyansh.jain 04/05/2018 12:11, Nipun Gupta: > --- a/doc/guides/rel_notes/release_18_05.rst > +++ b/doc/guides/rel_notes/release_18_05.rst > +* **Added DPAA2 Command Interface Driver (in rawdev).** > + > + The DPAA2 CMDIF is an implementation of the rawdev API, that provides > + communication between the GPP and NXP's QorIQ based AIOP Block (Firmware). > + Advanced IO Processor i.e. AIOP is clusters of programmable RISC engines > + optimised for flexible networking and I/O operations. The communication > + between GPP and AIOP is achieved via using DPCI devices exposed by MC for > + GPP <--> AIOP interaction. > + > + See the :doc:`../rawdevs/dpaa2_cmdif` guide for more details. Must add this line in the list of libraries: + librte_pmd_dpaa2_cmdif.so.1 ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta ` (6 preceding siblings ...) 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta @ 2018-05-05 18:44 ` Shreyansh Jain 2018-05-08 12:27 ` Thomas Monjalon 7 siblings, 1 reply; 71+ messages in thread From: Shreyansh Jain @ 2018-05-05 18:44 UTC (permalink / raw) To: Nipun Gupta, thomas, Hemant Agrawal; +Cc: dev > -----Original Message----- > From: Nipun Gupta > Sent: Friday, May 4, 2018 3:41 PM > To: thomas@monjalon.net; Hemant Agrawal <hemant.agrawal@nxp.com>; > Shreyansh Jain <shreyansh.jain@nxp.com> > Cc: dev@dpdk.org; Nipun Gupta <nipun.gupta@nxp.com> > Subject: [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver > > This patch set introduces DPAA2 based Command Interface > device driver. > > This driver is provides communication between the GPP and > AIOP Firmware. > > This patchset is based on top of: > https://dpdk.org/dev/patchwork/patch/39246/ > > Patches 1-3: > Makes necessary changes and fixes in the DPAA2 bus and > mempool region > Patches 4-6: > Add the DPAA2 CMDIF driver > Patches 7: > Update the respective documentation > > Changes in v2: > - Move CMDIF compilation to common_linuxapp > - Support physical addressing mode > > Changes in v3: > - Rebased over DPAA2 QDMA patches > - Updated logging adding Data Path logs too > - Fix up error handling in patch 3 > - Merged the two separate doc patches (patch 7) > > Changes in v4: > - Added meson build support > > Changes in v5: > - Fixed shared build for x86 > > Changes in v6: > - Fixed intermediate shared build break (patch 4) > Series-Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> ^ permalink raw reply [flat|nested] 71+ messages in thread
* Re: [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver 2018-05-05 18:44 ` [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver Shreyansh Jain @ 2018-05-08 12:27 ` Thomas Monjalon 0 siblings, 0 replies; 71+ messages in thread From: Thomas Monjalon @ 2018-05-08 12:27 UTC (permalink / raw) To: Nipun Gupta; +Cc: dev, Shreyansh Jain, Hemant Agrawal 05/05/2018 20:44, Shreyansh Jain: > From: Nipun Gupta > > > > This patch set introduces DPAA2 based Command Interface > > device driver. > > > > This driver is provides communication between the GPP and > > AIOP Firmware. > > Series-Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> Applied, thanks ^ permalink raw reply [flat|nested] 71+ messages in thread
end of thread, other threads:[~2018-05-08 12:27 UTC | newest] Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-02-22 9:34 [dpdk-dev] [PATCH 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-02-22 13:12 ` Shreyansh Jain 2018-02-23 6:35 ` Nipun Gupta 2018-02-22 14:31 ` Jerin Jacob 2018-02-23 6:35 ` Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-02-22 9:34 ` [dpdk-dev] [PATCH 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 1/9] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 2/9] bus/fslmc: expose API to free dpci device Nipun Gupta 2018-04-07 14:33 ` [dpdk-dev] [PATCH v2 3/9] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-04-25 1:47 ` Shreyansh Jain 2018-04-25 3:53 ` Shreyansh Jain 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 4/9] bus/fslmc: add preprocessors to get flc and frc from fd Nipun Gupta 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 5/9] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-04-25 4:18 ` Shreyansh Jain 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 6/9] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 7/9] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 8/9] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-04-16 12:40 ` Hemant Agrawal 2018-04-07 14:34 ` [dpdk-dev] [PATCH v2 9/9] doc: add dpaa2 command interface rawdev to release notes Nipun Gupta 2018-04-23 12:23 ` Kovacevic, Marko 2018-04-25 1:50 ` Shreyansh Jain 2018-04-07 14:43 ` [dpdk-dev] [PATCH v2 0/9] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 0/7 v3] " Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 1/7 v3] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 2/7 v3] bus/fslmc: expose API to free dpci device Nipun Gupta 2018-05-01 9:45 ` Shreyansh Jain 2018-04-26 10:14 ` [dpdk-dev] [PATCH 3/7 v3] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 4/7 v3] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 5/7 v3] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 6/7 v3] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta 2018-04-26 10:14 ` [dpdk-dev] [PATCH 7/7 v3] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-05-01 9:45 ` [dpdk-dev] [PATCH 0/7 v3] Introduce DPAA2 Command Interface raw driver Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 0/7] " Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-05-03 13:49 ` Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-05-03 14:10 ` Shreyansh Jain 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta 2018-05-02 17:15 ` [dpdk-dev] [PATCH v4 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta 2018-05-03 16:33 ` [dpdk-dev] [PATCH v5 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-05-04 7:15 ` [dpdk-dev] [PATCH v5 0/7] Introduce DPAA2 Command Interface raw driver Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 " Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 1/7] mempool/dpaa2: add functions exposed to DPDK applications Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 2/7] bus/fslmc: expose API to free dpci device Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 3/7] bus/fslmc: keep Tx queues information for DPCI devices too Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 4/7] raw/dpaa2_cmdif: introduce DPAA2 command interface driver Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 5/7] raw/dpaa2_cmdif: add attribute get functionality Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations Nipun Gupta 2018-05-04 10:11 ` [dpdk-dev] [PATCH v6 7/7] doc: add DPAA2 CMDIF rawdev guide Nipun Gupta 2018-05-08 12:08 ` Thomas Monjalon 2018-05-05 18:44 ` [dpdk-dev] [PATCH v6 0/7] Introduce DPAA2 Command Interface raw driver Shreyansh Jain 2018-05-08 12:27 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).