From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40047.outbound.protection.outlook.com [40.107.4.47]) by dpdk.org (Postfix) with ESMTP id 84B754CC0 for ; Wed, 2 May 2018 19:16:08 +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=Z7V8s0sZP2AzaGk1ii52OOSRIWsPn/rj6BPUoTsLEYs=; b=qZeWEgXVaKk9ITTMtahx5YvIMHguShh1QHvhONNycLzrdN8/WbgkTDheGHL6zXS2HSlYkHlNG+59gq/VqkCduipTQw/KUFFgYS/cGS9IjF21rwScZNQ1FOZRf72pjnpzFmku7nQ8kcsWQYgQ1ieXm78QJxDX+Z4vliZh4Xq/8bw= 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 AM4PR0401MB2419.eurprd04.prod.outlook.com (2603:10a6:200:51::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.715.18; Wed, 2 May 2018 17:16:06 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Wed, 2 May 2018 22:45:28 +0530 Message-Id: <1525281329-27984-7-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525281329-27984-1-git-send-email-nipun.gupta@nxp.com> References: <1524737696-3145-1-git-send-email-nipun.gupta@nxp.com> <1525281329-27984-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: MA1PR0101CA0001.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::11) To AM4PR0401MB2419.eurprd04.prod.outlook.com (2603:10a6:200:51::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM4PR0401MB2419; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 3:6R2a09jA39E2pQs9NR4/AJeW5DYNaMtDTr0Uoo6XNRtp9K2yPYA7osI3e+lmFbsjbnVsPR5BwYYlFv02To0kdIzguy3OeITAYRWjKqYutb3SrAjbk/I68+FRT6fOljzFjiZnMDcKoabiRJZoC4OL3Nuqdq2edElJEJaTlKqkchT6GxUfRtu4jecpGSVpFIplcQdGsIwn+twrGcXPrNQxj2rWUJ7F40SIPBHTpCmMmPUDzEwZmiiNMyx8AvFuEsQY; 25:ZZXQ7I+jzmiCeLxgYyKl2PZ53IWKqESur3m/XToYajYM4gQgWnIx5oBJCEzIRW+fVHbdQaWF5MKL8ORwQhpEcwTwT1K21gY9dwsKoiwIvqJ3GdU/3ZPe3si6CSO1SAq6VrGomNzXPYeNnKJS+dswDY33McZlETss9AtTHIkmIp8SOU65ZxHnCHrKZZ1z1Un0SwF+hOhP5dZgRY14KHhdSvSCjqCj2mIGNwX/BZyNK41WB1M4E9FqQ2wOtpNEGl0Lnrv184tqjbptVmZ5LUPBVoItuLHfPRL5ftDkEfyQDxsXXJk0K0+qIwJOj6uRY3b/jDtqEZxVrT5T2c3R2JiQFQ==; 31:Jw30cQPpzPKTbpwJ53uKlemnCoKjbH+gvJ5/e6i55kyPuelhtP+9CXoOnUkUgLk6o4L+px0oNeSmvANIXOpUTIJin7+5qsIwuFh63WoE6IzBeEb7mbMTHd81vOIOF1JZRiDGEvkgm0eX8hw8jFiJ4e4OjHcqYygfYlqm7oyU3XOnqEJDXojE4pNJX3u8UrFzym9U7rxJFmjzuVU3ditM/YVNrToUhPR5A46ikO8QxL0= X-MS-TrafficTypeDiagnostic: AM4PR0401MB2419: X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 20:aqq2tj5KuUGZ4FhmzlkCh6/3xXY4yxCYZ1Rd6+iiDc/hmP3aRxzyLbgez+PK4eHWAaA7b6tswMi4EOmf9nJDicwxvze5VlM8T2OmRP0piqg4dIVZj1cwoFPXuo6QYZVEqhiLHTaOONTtkY850iKPIw9JGBG85zGIf8BpX1Zp6mP8k7OOkOajTauHO76NBlyRDj4NkFaqsfR38wZZOUeua2NKzcbLB9jHEBUzMN1KpaUsQ3nbtzLzsIC0k/E0tWmiEcVEc4krVtVYbBCUvext3fPhJT0g03X+Erz5I39/OTTnfboBaYB93Fhb6Ypr7GaXukF/ukfEJM09132ii+KtVR+I8xkOhR4mrt3ADVJ04GfKgovXh8Lr4nPdrb5V4xxbw9h9dKE+ws7B9dJn2/YqH01swnOrPqqTTDbB8oTqEpO089rxICVWdRj87k0nkPZIRm9CrNomkNgsjUxtgodOLTfSjqlZgv6x/gpmt7JI2wdq3mcr7YiE+ZKnfq43k1hm; 4:u0KoMB3A7wJBLgX3HXE4PxTXzLWwmmqCYwyQ7EaB+kD247qzt7rZyMZ9qPde575p/SVTP+9cG51s2UnQ6kRDdVsGhk9/Pl96SU48L/1GvYJfhZEDcOSSt97n1KX58zRsPwzVYB/8ely6KzzgVQRyfHpedr/qyPld6l0gJxGjZR8j66dxvSSY+HNSNvY+ErJbF1cxGkaYTbggzDnOdWtp0fzwGXSi1qoVAeSAiLPwdhg8CAKDMkaUMTQrbzf4Ni/dKarR6TOrP7XEkIMj7bad5CW5Jgl2DQH7ZZVTXl8k2XI/Jr1v7Si3po7U1ha/UdS4EW5vx5a0KKmTEDYLGcvkrMKEXUYi5CmAZlItqo6/67o= 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)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM4PR0401MB2419; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB2419; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(39380400002)(346002)(366004)(199004)(189003)(575784001)(956004)(316002)(16586007)(11346002)(3846002)(5009440100003)(6506007)(305945005)(4326008)(6636002)(476003)(97736004)(5660300001)(7736002)(2616005)(48376002)(53936002)(50226002)(86362001)(59450400001)(6512007)(50466002)(6666003)(486006)(446003)(386003)(6116002)(36756003)(55236004)(47776003)(51416003)(6486002)(106356001)(8676002)(2906002)(186003)(68736007)(26005)(8936002)(25786009)(81156014)(105586002)(16526019)(44832011)(478600001)(81166006)(52116002)(66066001)(76176011)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0401MB2419; 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; AM4PR0401MB2419; 23:Ue2HlPBu7YBEnR3CjV3GEwGQyfjTxk0pW8wnQY7?= =?us-ascii?Q?5TD98gaU1U6i5TyZTHkc5WejrNFK4FcU6R45CYGyEPpdCcR+AcHGulpuVru9?= =?us-ascii?Q?LzBkShvvyafwoLEGiypusxlYP/UV4Q8g/mB6hjcDnUeP/Ex6SKodj/+QLqMa?= =?us-ascii?Q?71YSZB/KKsBeomHixfFV1gL/eAJuX1T5XLJAE99WHAJCBYZk5u8CdyyYkjDG?= =?us-ascii?Q?UMoZwTAIf0BTBtuMcVlH1VBGnR8vCupLxK9u5XL348BwKaWCNXU3bZWYvett?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TJylcbiDvjlvJiwgG1Y3Ps48wdRIzrZshi7+fsmKjrYQ+TzD5jxwphrg3mm7f+xQ=; 24:oZ+zxB2sfEsqBjgPksXCsQQZrbTG5lMRPe+a9UteGDsCzxwqKD8jjxuBhmJ8aVCWN431Utn0zNskSPzKUKNAbFVzl2x6czJQFjR49IXFPgA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 7:Vrekr7BJd0bCcA3HjNmt+sEQ0BqWiRVPtEAG6+LT67zKRdBiXtLGGSOGnLFP8qXYzxV2llG7RABiP4D/lyG39zYikGEdYXeQHv1LncOMtcQ2OnHuomUGe1OfYusFcDt6AD6FWMVuZ727jT1jsrzzA4Q3KoVe3rfjZkeTr4gM0O9VJOtvjyv6fCeH28QKWOX3bKYGjkSb5INigTFNblS0GvPeHEnrnryR7euCZKB0fpIciJinKrwyLFvFQlg0VbJu X-MS-Office365-Filtering-Correlation-Id: 073add84-7cf9-4c01-9f03-08d5b050648d X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 17:16:06.0377 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 073add84-7cf9-4c01-9f03-08d5b050648d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB2419 Subject: [dpdk-dev] [PATCH v4 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: Wed, 02 May 2018 17:16:08 -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 | 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 - 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