From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0069.outbound.protection.outlook.com [104.47.2.69]) by dpdk.org (Postfix) with ESMTP id 3F3AB44BE for ; Fri, 4 May 2018 12:12:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jmyi8BO3uETZkAXZE7briwVUn10+v0i4VeASyRL9yVY=; b=j+RWzwvKVQJ29uVSTG0uN5icNtuezL5uLZhlvNRD8tfEpD64sglMt82l0EeJRTU3PmnFqw1Oa5GDONcpbaJKs/kX0cc5P5+ZavKdyCkgqd4ZV0DyRqQxGYHbqMYsui5/qIVsS3WISTCh1+vZ1jTsmOvKn9BRq8O6v/l4BdQVhRs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by DB6PR0401MB2422.eurprd04.prod.outlook.com (2603:10a6:4:4a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.24; Fri, 4 May 2018 10:12:03 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Fri, 4 May 2018 15:41:28 +0530 Message-Id: <1525428689-8076-7-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525428689-8076-1-git-send-email-nipun.gupta@nxp.com> References: <1525365233-5956-1-git-send-email-nipun.gupta@nxp.com> <1525428689-8076-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR01CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::11) To DB6PR0401MB2422.eurprd04.prod.outlook.com (2603:10a6:4:4a::25) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0401MB2422; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 3:zRAtvl6/FNT1lAYoLuydeZUcM2ziQEgUQusKMSmjp5qUWtfuK/4TulRgHSwU9K6PhQj+svknM6GhbekV2T4z453DPbMQyv4EwSvKLJZWMvpwqsBddexoirElyLrE+etmJKTB81k5vm0mDDWZlzz8vJ0qdlCQPv+UMMqdnRCPFTRVPOhbvit7qIrn64EmPnPCz9y0pi1CwA1CQ913nWT6iRdecfsPIDbvWajVXggfr9iWIkOyOfJXDAYvfuv9otit; 25:5F6NF6SDse4S9vsFko5y/Ksg5gvnvRke2A6fwqC2PIYxeoJFKt0HcuXNK0bZ0604ZXrn5Ptl9j3IDRoo40SehSzSWa+Tbxj2MTXXvvk07I9zu/kEeaxAx+AbyfpDIWGV8GHOoA55YnKQ9CBsAnQUSQ4JzSCV2iEbD2mzfDWK326Bi69sfyOvUVnyicUnMuxK9OoMay7L50etoH5WPu9f+Pjnfz7LSPG3lB9EiMKKdIU00fHxMvCJdLkjMGEy3eNW3R1GBA875pS/ZoUQEKCDt4/Xs9lkKj6fm2S2rLaTPIORzTn0nh4PgqzmdFIv7U1mGqoTl1f+GzGkC71yhg4/mw==; 31:aJFizx63lNmZNf+kj1dl7IMrDFSqv63CBbaVZCIQU/Ip3sajUzKcROTAHMkMgK/8PRcZiSJUGz5u7H0rbcuDbn6UtawYY11+Ig2tQI/PujD4gsoOyeJAVpNtM9gVTQM78JP4kwnJQVivPAeWLfNCLBeQ11hMo+HSzFJKR32WAQxQeCSgWaGcttAl2IefPaopYqCxNE3jPIZ4hF23dfe7302x5Ft2pBp1Jlui2BgdaQ8= X-MS-TrafficTypeDiagnostic: DB6PR0401MB2422: X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 20:jezNDr1y4PnptFLci8ALd5cGcDH8g7O5ARHr0fTZWKxMTPxmaJDwMPlZNsrDacM45wHYOHAOcF5NH3nVGZysdNb56Gtgn/xBVRqcI53iQ0wqgaoh6HfECTmLZU2i9XUs4kCh09HhtPtNNOrufcBV5uGmGiNEtZoIof/xKybOIBmK44+5ZaRXB/NOICe8Vslay5Q7b3OjUT1xFmX4LObR58c47tumgDY28rrrCoaLf5RV6JmYlOGEWx2ix+ncj5aVXDhD/LlWaYrBPJMVH2/F9NqlOFmrIJyPnIgTaMpxT4/bNbeiFzuahYd9xS+lzelRstkYjoB/HVpRzLLuNkofUV10VwhF0MyIrBEXMMt0+PHGlv+Zx6uSYOQKXYplGh7cHJ1OQd/+S05W8+0IBC9Sdm6ffVlFzEBfJDpHt7r0Zf8gt97ZNPxHrs6YxmVpJsE0xKozWxY0SCwdy3nUdRsAcev/W+7+noOsUGr6nJFsz+xh0dq7iAQaaCD5hUixnA7B; 4:a2CFmjQhPLco4XLTOVGVVmfGEkehKN4cIX9D6lODG4ZSkLJvXx7ASPRvt7DApECuOp+zodOOe5o1wDHIU9SMGD1PPiPFpg3DrEyFuRE+sCl462/u7exxyiUnrp4rpzfFgZ4zrzcCURpLAR7PqcDhsUuQ0we/X5aXW5s4cLxeqXeBE9QyIbUa9iKuFgKoVpJ1lpaLptQ1apij731xTbo+c0lxMuvJORDBPXIAMwUFrnPfrtB2aAXzDd/4paZUj464ZGg2LboH3WnWVt82dy9RGMLct2jnr1SzAfAmgwY8zUJgtu/mttxFasGPXaJ/vrQqBWczu0/+U/wD2zbfWUwJBkGbzyke8U/rqje6WV8FH1s= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:DB6PR0401MB2422; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0401MB2422; X-Forefront-PRVS: 06628F7CA4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(39860400002)(346002)(366004)(199004)(189003)(51416003)(53936002)(59450400001)(52116002)(4326008)(8936002)(105586002)(386003)(305945005)(6506007)(26005)(50226002)(55236004)(446003)(186003)(81156014)(5660300001)(76176011)(8676002)(5009440100003)(11346002)(25786009)(68736007)(7736002)(44832011)(106356001)(316002)(16526019)(48376002)(478600001)(6666003)(476003)(3846002)(2616005)(6116002)(16586007)(36756003)(6636002)(81166006)(486006)(956004)(47776003)(6486002)(2906002)(50466002)(86362001)(6512007)(66066001)(97736004)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0401MB2422; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0401MB2422; 23:nlmMfunNTw1WwwLUqIegwtt6Agvq98/P7LXd2XO?= =?us-ascii?Q?kpy4lGbnEfCUW0U7sdSHLQhJLDf88qP4saYQ92GJdpr8JHIZyet7ACAGgeB8?= =?us-ascii?Q?0DctEWJt7qn/3m91oP/1qKZsl7J4S+tMhqST6HMXQsQ3dgJXTljq1wOQtik4?= =?us-ascii?Q?e0Z4nasbwl7U1n4Vlg8pzTKmU6rSPHOG+eAoRgMIPN1gUML/I5YKyThUHn93?= =?us-ascii?Q?GhyqKuXQJCbxpWGaid2aUMO48v+HB0YXbdSv/h9304KnGvBj2cuNGoTruvsc?= =?us-ascii?Q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IfBcpVGL8FJ/p+F14iIrGRlW2o6VxFQM=; 24:TRbICw2FOK//9n84VQboTnG4HI36JKss7UfyiuMg6gqwVyBZ8dS+yTGBUCXMVfecP29AbPCVqtNaFy6RRgYBH+Ykkwb/9bRYpzicxjCrYhk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2422; 7:Ff6j7HmkRv3Nj96Uasn2LQx92YQfdRgnBP85Z7rdkB6Yx3QOHn0lhkcjTc2HpA4D5jmuRsslUZKhs7ISJPu70oYroXO3+xfX4O5VsoFnN0tYhYpece5/XceHCBTUlLvABpAPXL+TaeG7YslepFPq4OFcOMwNqpTmFjW6dFMcgeEUGh4SUuN2hYBwSm4BxYqdginAFcc5Nz+OJJ8DBaQev8l4CoZ5bcKbVGV28ElobDay0mdmLIPfomN/DbYkAtCD X-MS-Office365-Filtering-Correlation-Id: 5135d65e-c052-4eca-3d00-08d5b1a77c90 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2018 10:12:03.9337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5135d65e-c052-4eca-3d00-08d5b1a77c90 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2422 Subject: [dpdk-dev] [PATCH v6 6/7] raw/dpaa2_cmdif: support enqueue dequeue operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2018 10:12:07 -0000 Signed-off-by: Nipun Gupta --- 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 #include #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 - 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