From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150080.outbound.protection.outlook.com [40.107.15.80]) by dpdk.org (Postfix) with ESMTP id AB6421B192 for ; Thu, 4 Apr 2019 13:04:25 +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:X-MS-Exchange-SenderADCheck; bh=KO9LUO99ZWhjrHunjS0vv1O1Q2xt40sziIusmTPAW9s=; b=kHnxBTk1OiYWmVMzDGvoIT/0VJoPCdcb9lZPKlF2YXUS/AKkkwAkxDGlpGdNFd8hrPUhzBylJiVcfmR01vpFl2WgEqle34coI+fknaUb+iZGH8GEnVWNv1sIj8PuixrFpNR85wRFwlrf5zOCtZrsWbpm37wuc3yGcA32f2dQKnI= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2543.eurprd04.prod.outlook.com (10.168.65.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.19; Thu, 4 Apr 2019 11:04:23 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::18e3:39b6:c61d:3f18]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::18e3:39b6:c61d:3f18%12]) with mapi id 15.20.1750.017; Thu, 4 Apr 2019 11:04:23 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "thomas@monjalon.net" , Shreyansh Jain , Yi Liu Thread-Topic: [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support Thread-Index: AQHU6tYpKDHwc8S1dE+qLEl8Ips7Bg== Date: Thu, 4 Apr 2019 11:04:23 +0000 Message-ID: <20190404110215.14410-4-hemant.agrawal@nxp.com> References: <20190326121610.28024-1-hemant.agrawal@nxp.com> <20190404110215.14410-1-hemant.agrawal@nxp.com> In-Reply-To: <20190404110215.14410-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [92.120.1.72] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BMXPR01CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::27) To VI1PR0401MB2541.eurprd04.prod.outlook.com (2603:10a6:800:56::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 17613a2c-3a31-4a70-ab34-08d6b8ed4b96 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR0401MB2543; x-ms-traffictypediagnostic: VI1PR0401MB2543: x-microsoft-antispam-prvs: x-forefront-prvs: 0997523C40 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(366004)(39860400002)(199004)(189003)(6916009)(6486002)(53936002)(50226002)(2906002)(8936002)(2616005)(86362001)(54906003)(7736002)(11346002)(44832011)(486006)(316002)(8676002)(6512007)(446003)(1076003)(66066001)(5640700003)(99286004)(3846002)(6116002)(478600001)(386003)(5660300002)(26005)(81166006)(25786009)(1730700003)(76176011)(68736007)(102836004)(476003)(14454004)(4326008)(71200400001)(105586002)(81156014)(97736004)(256004)(14444005)(2501003)(186003)(2351001)(106356001)(30864003)(6436002)(305945005)(71190400001)(52116002)(6506007)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2543; H:VI1PR0401MB2541.eurprd04.prod.outlook.com; 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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TY3KjL28fhQDLuLUyoBragjSE1cUaQaNRaGAzmPxCuN/ymc6Vg/WqwHxP+QptUzTlMdzg4hXvl3nng8mbHqRIFiaSzK9c3Sw5KX6QA6MESGPTWKZgKq8rzeS5YWOJ9WbTQyR8bZSQBMmpXZjIl2JIundOvmGRKsAG4ldTikn27100lIC1ZPSGRQf1y5fH7bB4rg91hgvkPcXFsSJCEq9/JvMSzuLWfQB4qqQLmGZqELpbE/bK9lVgcjSEAt9RpOvzT/aROe00OuGFhVXuBozXd87v1TstuVq0+nrGvwSzqUvzbzY0R3eCq0PrAeYC1XSKjYnYI8ApXbbUsfyptj0yuZHmKxv7mw+V3nIQinorbCw83Oa/69QQfWfs0Fkz4O/ns0EeMeHG1zWZLJ4UOSaiX7MQLNdX+fqYg8abnkBBS4= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17613a2c-3a31-4a70-ab34-08d6b8ed4b96 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2019 11:04:23.7443 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2543 Subject: [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support 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: Thu, 04 Apr 2019 11:04:26 -0000 This patch adds support the batch processing for the qdma jobs Signed-off-by: Hemant Agrawal Signed-off-by: Yi Liu --- drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 305 ++++++++++---------- drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 6 +- 2 files changed, 164 insertions(+), 147 deletions(-) diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/d= paa2_qdma.c index 88c11a3d2..a1351e648 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include #include @@ -395,21 +396,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle, DPAA2_SET_FLE_FIN(fle); } =20 -static int -dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev, - uint16_t txq_id, - uint16_t vq_id, - struct rte_qdma_job *job) +int +rte_qdma_vq_enqueue_multi(uint16_t vq_id, + struct rte_qdma_job **job, + uint16_t nb_jobs) { + struct qdma_virt_queue *qdma_vq =3D &qdma_vqs[vq_id]; + struct qdma_hw_queue *qdma_pq =3D qdma_vq->hw_queue; + struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; struct qdma_io_meta *io_meta; - struct qbman_fd fd; + struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; struct dpaa2_queue *txq; struct qbman_fle *fle; struct qbman_eq_desc eqdesc; struct qbman_swp *swp; int ret; + uint32_t num_to_send =3D 0; + uint16_t num_tx =3D 0; + uint16_t num_txed =3D 0; =20 - DPAA2_QDMA_FUNC_TRACE(); + /* Return error in case of wrong lcore_id */ + if (rte_lcore_id() !=3D qdma_vq->lcore_id) { + DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core", + vq_id); + return -1; + } =20 if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret =3D dpaa2_affine_qbman_swp(); @@ -420,7 +431,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev, } swp =3D DPAA2_PER_LCORE_PORTAL; =20 - txq =3D &(dpdmai_dev->tx_queue[txq_id]); + txq =3D &(dpdmai_dev->tx_queue[qdma_pq->queue_id]); =20 /* Prepare enqueue descriptor */ qbman_eq_desc_clear(&eqdesc); @@ -428,97 +439,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_de= v, qbman_eq_desc_set_no_orp(&eqdesc, 0); qbman_eq_desc_set_response(&eqdesc, 0, 0); =20 - /* - * Get an FLE/SDD from FLE pool. - * Note: IO metadata is before the FLE and SDD memory. - */ - ret =3D rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta)); - if (ret) { - DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE"); - return ret; - } - - /* Set the metadata */ - io_meta->cnxt =3D (size_t)job; - io_meta->id =3D vq_id; - - fle =3D (struct qbman_fle *)(io_meta + 1); - - /* populate Frame descriptor */ - memset(&fd, 0, sizeof(struct qbman_fd)); - DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle)); - DPAA2_SET_FD_COMPOUND_FMT(&fd); - DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX); + while (nb_jobs > 0) { + uint32_t loop; + + num_to_send =3D (nb_jobs > dpaa2_eqcr_size) ? + dpaa2_eqcr_size : nb_jobs; + + for (loop =3D 0; loop < num_to_send; loop++) { + /* + * Get an FLE/SDD from FLE pool. + * Note: IO metadata is before the FLE and SDD memory. + */ + ret =3D rte_mempool_get(qdma_dev.fle_pool, + (void **)(&io_meta)); + if (ret) { + DPAA2_QDMA_DP_WARN("Me alloc failed for FLE"); + return ret; + } =20 - /* Populate FLE */ - memset(fle, 0, QDMA_FLE_POOL_SIZE); - dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags); + /* Set the metadata */ + io_meta->cnxt =3D (size_t)job[num_tx]; + io_meta->id =3D vq_id; =20 - /* Enqueue the packet to the QBMAN */ - do { - ret =3D qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); - if (ret < 0 && ret !=3D -EBUSY) - DPAA2_QDMA_ERR("Transmit failure with err: %d", ret); - } while (ret =3D=3D -EBUSY); + fle =3D (struct qbman_fle *)(io_meta + 1); =20 - DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet"); + /* populate Frame descriptor */ + memset(&fd_arr[loop], 0, sizeof(struct qbman_fd)); + DPAA2_SET_FD_ADDR(&fd_arr[loop], + DPAA2_VADDR_TO_IOVA(fle)); + DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]); + DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX); =20 - return ret; -} + /* Populate FLE */ + memset(fle, 0, QDMA_FLE_POOL_SIZE); + dpaa2_qdma_populate_fle(fle, job[num_tx]->src, + job[num_tx]->dest, + job[num_tx]->len, + job[num_tx]->flags); =20 -int __rte_experimental -rte_qdma_vq_enqueue_multi(uint16_t vq_id, - struct rte_qdma_job **job, - uint16_t nb_jobs) -{ - int i, ret; + num_tx++; + } =20 - DPAA2_QDMA_FUNC_TRACE(); + /* Enqueue the packet to the QBMAN */ + uint32_t enqueue_loop =3D 0; + while (enqueue_loop < num_to_send) { + enqueue_loop +=3D qbman_swp_enqueue_multiple(swp, + &eqdesc, + &fd_arr[enqueue_loop], + NULL, + num_to_send - enqueue_loop); + } =20 - for (i =3D 0; i < nb_jobs; i++) { - ret =3D rte_qdma_vq_enqueue(vq_id, job[i]); - if (ret < 0) - break; + num_txed +=3D num_to_send; + nb_jobs -=3D num_to_send; } - - return i; + qdma_vq->num_enqueues +=3D num_txed; + return num_txed; } =20 -int __rte_experimental +int rte_qdma_vq_enqueue(uint16_t vq_id, struct rte_qdma_job *job) { - struct qdma_virt_queue *qdma_vq =3D &qdma_vqs[vq_id]; - struct qdma_hw_queue *qdma_pq =3D qdma_vq->hw_queue; - struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; int ret; =20 - DPAA2_QDMA_FUNC_TRACE(); - - /* Return error in case of wrong lcore_id */ - if (rte_lcore_id() !=3D qdma_vq->lcore_id) { - DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core", - vq_id); - return -EINVAL; - } - - ret =3D dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job); + ret =3D rte_qdma_vq_enqueue_multi(vq_id, &job, 1); if (ret < 0) { DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret); return ret; } =20 - qdma_vq->num_enqueues++; - return 1; } =20 /* Function to receive a QDMA job for a given device and queue*/ static int -dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev, +dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev, uint16_t rxq_id, uint16_t *vq_id, - struct rte_qdma_job **job) + struct rte_qdma_job **job, + uint16_t nb_jobs) { struct qdma_io_meta *io_meta; struct dpaa2_queue *rxq; @@ -531,8 +531,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev, uint8_t status; int ret; =20 - DPAA2_QDMA_FUNC_TRACE(); - if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret =3D dpaa2_affine_qbman_swp(); if (ret) { @@ -541,7 +539,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev, } } swp =3D DPAA2_PER_LCORE_PORTAL; - rxq =3D &(dpdmai_dev->rx_queue[rxq_id]); dq_storage =3D rxq->q_storage->dq_storage[0]; fqid =3D rxq->fqid; @@ -551,7 +548,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev= , qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); - qbman_pull_desc_set_numframes(&pulldesc, 1); + if (nb_jobs > dpaa2_dqrr_size) + qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size); + else + qbman_pull_desc_set_numframes(&pulldesc, nb_jobs); =20 while (1) { if (qbman_swp_pull(swp, &pulldesc)) { @@ -561,125 +561,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_= dev, break; } =20 - /* Check if previous issued command is completed. */ + rte_prefetch0((void *)((size_t)(dq_storage + 1))); + /* Check if the previous issued command is completed. */ while (!qbman_check_command_complete(dq_storage)) ; - /* Loop until dq_storage is updated with new token by QBMAN */ - while (!qbman_check_new_result(dq_storage)) - ; =20 - /* Check for valid frame. */ - status =3D qbman_result_DQ_flags(dq_storage); - if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) =3D=3D 0)) { - DPAA2_QDMA_DP_DEBUG("No frame is delivered"); - return 0; - } + int num_pulled =3D 0; + int pending =3D 1; + do { + /* Loop until the dq_storage is updated with + * new token by QBMAN + */ + while (!qbman_check_new_result(dq_storage)) + ; =20 - /* Get the FD */ - fd =3D qbman_result_DQ_fd(dq_storage); + rte_prefetch0((void *)((size_t)(dq_storage + 2))); + /* Check whether Last Pull command is Expired and + * setting Condition for Loop termination + */ + if (qbman_result_DQ_is_pull_complete(dq_storage)) { + pending =3D 0; + /* Check for valid frame. */ + status =3D qbman_result_DQ_flags(dq_storage); + if (unlikely((status & + QBMAN_DQ_STAT_VALIDFRAME) =3D=3D 0)) + continue; + } + fd =3D qbman_result_DQ_fd(dq_storage); =20 - /* - * Fetch metadata from FLE. job and vq_id were set - * in metadata in the enqueue operation. - */ - fle =3D (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); - io_meta =3D (struct qdma_io_meta *)(fle) - 1; - if (vq_id) - *vq_id =3D io_meta->id; + /* + * Fetch metadata from FLE. job and vq_id were set + * in metadata in the enqueue operation. + */ + fle =3D (struct qbman_fle *) + DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); + io_meta =3D (struct qdma_io_meta *)(fle) - 1; + if (vq_id) + vq_id[num_pulled] =3D io_meta->id; =20 - *job =3D (struct rte_qdma_job *)(size_t)io_meta->cnxt; - (*job)->status =3D DPAA2_GET_FD_ERR(fd); + job[num_pulled] =3D (struct rte_qdma_job *)(size_t)io_meta->cnxt; + job[num_pulled]->status =3D DPAA2_GET_FD_ERR(fd); =20 - /* Free FLE to the pool */ - rte_mempool_put(qdma_dev.fle_pool, io_meta); + /* Free FLE to the pool */ + rte_mempool_put(qdma_dev.fle_pool, io_meta); =20 - DPAA2_QDMA_DP_DEBUG("packet received"); + dq_storage++; + num_pulled++; + } while (pending && (num_pulled <=3D dpaa2_dqrr_size)); =20 - return 1; + return num_pulled; } =20 -int __rte_experimental +int rte_qdma_vq_dequeue_multi(uint16_t vq_id, struct rte_qdma_job **job, uint16_t nb_jobs) -{ - int i; - - DPAA2_QDMA_FUNC_TRACE(); - - for (i =3D 0; i < nb_jobs; i++) { - job[i] =3D rte_qdma_vq_dequeue(vq_id); - if (!job[i]) - break; - } - - return i; -} - -struct rte_qdma_job * __rte_experimental -rte_qdma_vq_dequeue(uint16_t vq_id) { struct qdma_virt_queue *qdma_vq =3D &qdma_vqs[vq_id]; struct qdma_hw_queue *qdma_pq =3D qdma_vq->hw_queue; - struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; - struct rte_qdma_job *job =3D NULL; struct qdma_virt_queue *temp_qdma_vq; - int dequeue_budget =3D QDMA_DEQUEUE_BUDGET; - int ring_count, ret, i; - uint16_t temp_vq_id; - - DPAA2_QDMA_FUNC_TRACE(); + struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; + int ring_count, ret =3D 0, i; =20 /* Return error in case of wrong lcore_id */ if (rte_lcore_id() !=3D (unsigned int)(qdma_vq->lcore_id)) { - DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core", + DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core", vq_id); - return NULL; + return -1; } =20 /* Only dequeue when there are pending jobs on VQ */ if (qdma_vq->num_enqueues =3D=3D qdma_vq->num_dequeues) - return NULL; + return 0; + + if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs)) + nb_jobs =3D (qdma_vq->num_enqueues - qdma_vq->num_dequeues); =20 if (qdma_vq->exclusive_hw_queue) { /* In case of exclusive queue directly fetch from HW queue */ - ret =3D dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id, - NULL, &job); + ret =3D dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id, + NULL, job, nb_jobs); if (ret < 0) { DPAA2_QDMA_ERR( "Dequeue from DPDMAI device failed: %d", ret); - return NULL; + return ret; } + qdma_vq->num_dequeues +=3D ret; } else { + uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX]; /* * Get the QDMA completed jobs from the software ring. * In case they are not available on the ring poke the HW * to fetch completed jobs from corresponding HW queues */ ring_count =3D rte_ring_count(qdma_vq->status_ring); - if (ring_count =3D=3D 0) { + if (ring_count < nb_jobs) { /* TODO - How to have right budget */ - for (i =3D 0; i < dequeue_budget; i++) { - ret =3D dpdmai_dev_dequeue(dpdmai_dev, - qdma_pq->queue_id, &temp_vq_id, &job); - if (ret =3D=3D 0) - break; - temp_qdma_vq =3D &qdma_vqs[temp_vq_id]; + ret =3D dpdmai_dev_dequeue_multijob(dpdmai_dev, + qdma_pq->queue_id, + temp_vq_id, job, nb_jobs); + for (i =3D 0; i < ret; i++) { + temp_qdma_vq =3D &qdma_vqs[temp_vq_id[i]]; rte_ring_enqueue(temp_qdma_vq->status_ring, - (void *)(job)); + (void *)(job[i])); ring_count =3D rte_ring_count( qdma_vq->status_ring); - if (ring_count) - break; } } =20 - /* Dequeue job from the software ring to provide to the user */ - rte_ring_dequeue(qdma_vq->status_ring, (void **)&job); - if (job) - qdma_vq->num_dequeues++; + if (ring_count) { + /* Dequeue job from the software ring + * to provide to the user + */ + ret =3D rte_ring_dequeue_bulk(qdma_vq->status_ring, + (void **)job, ring_count, NULL); + if (ret) + qdma_vq->num_dequeues +=3D ret; + } } =20 + return ret; +} + +struct rte_qdma_job * +rte_qdma_vq_dequeue(uint16_t vq_id) +{ + int ret; + struct rte_qdma_job *job =3D NULL; + + ret =3D rte_qdma_vq_dequeue_multi(vq_id, &job, 1); + if (ret < 0) + DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret); + return job; } =20 diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa= 2_qdma/rte_pmd_dpaa2_qdma.h index c9697b4d7..e1ccc19e8 100644 --- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h +++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h @@ -12,6 +12,9 @@ * */ =20 +/** Maximum qdma burst size */ +#define RTE_QDMA_BURST_NB_MAX 32 + /** Determines the mode of operation */ enum { /** @@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id, * Number of QDMA jobs requested for dequeue by the user. * * @returns - * Number of jobs actually dequeued. + * - >=3D0: Number of jobs successfully received + * - <0: Error code. */ int rte_qdma_vq_dequeue_multi(uint16_t vq_id, --=20 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 19F2DA0679 for ; Thu, 4 Apr 2019 13:04:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 594331B1F2; Thu, 4 Apr 2019 13:04:32 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150080.outbound.protection.outlook.com [40.107.15.80]) by dpdk.org (Postfix) with ESMTP id AB6421B192 for ; Thu, 4 Apr 2019 13:04:25 +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:X-MS-Exchange-SenderADCheck; bh=KO9LUO99ZWhjrHunjS0vv1O1Q2xt40sziIusmTPAW9s=; b=kHnxBTk1OiYWmVMzDGvoIT/0VJoPCdcb9lZPKlF2YXUS/AKkkwAkxDGlpGdNFd8hrPUhzBylJiVcfmR01vpFl2WgEqle34coI+fknaUb+iZGH8GEnVWNv1sIj8PuixrFpNR85wRFwlrf5zOCtZrsWbpm37wuc3yGcA32f2dQKnI= Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com (10.168.65.19) by VI1PR0401MB2543.eurprd04.prod.outlook.com (10.168.65.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.19; Thu, 4 Apr 2019 11:04:23 +0000 Received: from VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::18e3:39b6:c61d:3f18]) by VI1PR0401MB2541.eurprd04.prod.outlook.com ([fe80::18e3:39b6:c61d:3f18%12]) with mapi id 15.20.1750.017; Thu, 4 Apr 2019 11:04:23 +0000 From: Hemant Agrawal To: "dev@dpdk.org" CC: "thomas@monjalon.net" , Shreyansh Jain , Yi Liu Thread-Topic: [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support Thread-Index: AQHU6tYpKDHwc8S1dE+qLEl8Ips7Bg== Date: Thu, 4 Apr 2019 11:04:23 +0000 Message-ID: <20190404110215.14410-4-hemant.agrawal@nxp.com> References: <20190326121610.28024-1-hemant.agrawal@nxp.com> <20190404110215.14410-1-hemant.agrawal@nxp.com> In-Reply-To: <20190404110215.14410-1-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [92.120.1.72] x-mailer: git-send-email 2.17.1 x-clientproxiedby: BMXPR01CA0041.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::27) To VI1PR0401MB2541.eurprd04.prod.outlook.com (2603:10a6:800:56::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 17613a2c-3a31-4a70-ab34-08d6b8ed4b96 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600139)(711020)(4605104)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR0401MB2543; x-ms-traffictypediagnostic: VI1PR0401MB2543: x-microsoft-antispam-prvs: x-forefront-prvs: 0997523C40 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(366004)(39860400002)(199004)(189003)(6916009)(6486002)(53936002)(50226002)(2906002)(8936002)(2616005)(86362001)(54906003)(7736002)(11346002)(44832011)(486006)(316002)(8676002)(6512007)(446003)(1076003)(66066001)(5640700003)(99286004)(3846002)(6116002)(478600001)(386003)(5660300002)(26005)(81166006)(25786009)(1730700003)(76176011)(68736007)(102836004)(476003)(14454004)(4326008)(71200400001)(105586002)(81156014)(97736004)(256004)(14444005)(2501003)(186003)(2351001)(106356001)(30864003)(6436002)(305945005)(71190400001)(52116002)(6506007)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2543; H:VI1PR0401MB2541.eurprd04.prod.outlook.com; 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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: TY3KjL28fhQDLuLUyoBragjSE1cUaQaNRaGAzmPxCuN/ymc6Vg/WqwHxP+QptUzTlMdzg4hXvl3nng8mbHqRIFiaSzK9c3Sw5KX6QA6MESGPTWKZgKq8rzeS5YWOJ9WbTQyR8bZSQBMmpXZjIl2JIundOvmGRKsAG4ldTikn27100lIC1ZPSGRQf1y5fH7bB4rg91hgvkPcXFsSJCEq9/JvMSzuLWfQB4qqQLmGZqELpbE/bK9lVgcjSEAt9RpOvzT/aROe00OuGFhVXuBozXd87v1TstuVq0+nrGvwSzqUvzbzY0R3eCq0PrAeYC1XSKjYnYI8ApXbbUsfyptj0yuZHmKxv7mw+V3nIQinorbCw83Oa/69QQfWfs0Fkz4O/ns0EeMeHG1zWZLJ4UOSaiX7MQLNdX+fqYg8abnkBBS4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17613a2c-3a31-4a70-ab34-08d6b8ed4b96 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2019 11:04:23.7443 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2543 Subject: [dpdk-dev] [PATCH v2 4/7] raw/dpaa2_qdma: add burst mode support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190404110423.XRb25VXl0Y0GVCL5R16c90t1ITdyz8O--7c6Usepokg@z> This patch adds support the batch processing for the qdma jobs Signed-off-by: Hemant Agrawal Signed-off-by: Yi Liu --- drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 305 ++++++++++---------- drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h | 6 +- 2 files changed, 164 insertions(+), 147 deletions(-) diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/d= paa2_qdma.c index 88c11a3d2..a1351e648 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include #include @@ -395,21 +396,31 @@ dpaa2_qdma_populate_fle(struct qbman_fle *fle, DPAA2_SET_FLE_FIN(fle); } =20 -static int -dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev, - uint16_t txq_id, - uint16_t vq_id, - struct rte_qdma_job *job) +int +rte_qdma_vq_enqueue_multi(uint16_t vq_id, + struct rte_qdma_job **job, + uint16_t nb_jobs) { + struct qdma_virt_queue *qdma_vq =3D &qdma_vqs[vq_id]; + struct qdma_hw_queue *qdma_pq =3D qdma_vq->hw_queue; + struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; struct qdma_io_meta *io_meta; - struct qbman_fd fd; + struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; struct dpaa2_queue *txq; struct qbman_fle *fle; struct qbman_eq_desc eqdesc; struct qbman_swp *swp; int ret; + uint32_t num_to_send =3D 0; + uint16_t num_tx =3D 0; + uint16_t num_txed =3D 0; =20 - DPAA2_QDMA_FUNC_TRACE(); + /* Return error in case of wrong lcore_id */ + if (rte_lcore_id() !=3D qdma_vq->lcore_id) { + DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core", + vq_id); + return -1; + } =20 if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret =3D dpaa2_affine_qbman_swp(); @@ -420,7 +431,7 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_dev, } swp =3D DPAA2_PER_LCORE_PORTAL; =20 - txq =3D &(dpdmai_dev->tx_queue[txq_id]); + txq =3D &(dpdmai_dev->tx_queue[qdma_pq->queue_id]); =20 /* Prepare enqueue descriptor */ qbman_eq_desc_clear(&eqdesc); @@ -428,97 +439,86 @@ dpdmai_dev_enqueue(struct dpaa2_dpdmai_dev *dpdmai_de= v, qbman_eq_desc_set_no_orp(&eqdesc, 0); qbman_eq_desc_set_response(&eqdesc, 0, 0); =20 - /* - * Get an FLE/SDD from FLE pool. - * Note: IO metadata is before the FLE and SDD memory. - */ - ret =3D rte_mempool_get(qdma_dev.fle_pool, (void **)(&io_meta)); - if (ret) { - DPAA2_QDMA_DP_WARN("Memory alloc failed for FLE"); - return ret; - } - - /* Set the metadata */ - io_meta->cnxt =3D (size_t)job; - io_meta->id =3D vq_id; - - fle =3D (struct qbman_fle *)(io_meta + 1); - - /* populate Frame descriptor */ - memset(&fd, 0, sizeof(struct qbman_fd)); - DPAA2_SET_FD_ADDR(&fd, DPAA2_VADDR_TO_IOVA(fle)); - DPAA2_SET_FD_COMPOUND_FMT(&fd); - DPAA2_SET_FD_FRC(&fd, QDMA_SER_CTX); + while (nb_jobs > 0) { + uint32_t loop; + + num_to_send =3D (nb_jobs > dpaa2_eqcr_size) ? + dpaa2_eqcr_size : nb_jobs; + + for (loop =3D 0; loop < num_to_send; loop++) { + /* + * Get an FLE/SDD from FLE pool. + * Note: IO metadata is before the FLE and SDD memory. + */ + ret =3D rte_mempool_get(qdma_dev.fle_pool, + (void **)(&io_meta)); + if (ret) { + DPAA2_QDMA_DP_WARN("Me alloc failed for FLE"); + return ret; + } =20 - /* Populate FLE */ - memset(fle, 0, QDMA_FLE_POOL_SIZE); - dpaa2_qdma_populate_fle(fle, job->src, job->dest, job->len, job->flags); + /* Set the metadata */ + io_meta->cnxt =3D (size_t)job[num_tx]; + io_meta->id =3D vq_id; =20 - /* Enqueue the packet to the QBMAN */ - do { - ret =3D qbman_swp_enqueue_multiple(swp, &eqdesc, &fd, NULL, 1); - if (ret < 0 && ret !=3D -EBUSY) - DPAA2_QDMA_ERR("Transmit failure with err: %d", ret); - } while (ret =3D=3D -EBUSY); + fle =3D (struct qbman_fle *)(io_meta + 1); =20 - DPAA2_QDMA_DP_DEBUG("Successfully transmitted a packet"); + /* populate Frame descriptor */ + memset(&fd_arr[loop], 0, sizeof(struct qbman_fd)); + DPAA2_SET_FD_ADDR(&fd_arr[loop], + DPAA2_VADDR_TO_IOVA(fle)); + DPAA2_SET_FD_COMPOUND_FMT(&fd_arr[loop]); + DPAA2_SET_FD_FRC(&fd_arr[loop], QDMA_SER_CTX); =20 - return ret; -} + /* Populate FLE */ + memset(fle, 0, QDMA_FLE_POOL_SIZE); + dpaa2_qdma_populate_fle(fle, job[num_tx]->src, + job[num_tx]->dest, + job[num_tx]->len, + job[num_tx]->flags); =20 -int __rte_experimental -rte_qdma_vq_enqueue_multi(uint16_t vq_id, - struct rte_qdma_job **job, - uint16_t nb_jobs) -{ - int i, ret; + num_tx++; + } =20 - DPAA2_QDMA_FUNC_TRACE(); + /* Enqueue the packet to the QBMAN */ + uint32_t enqueue_loop =3D 0; + while (enqueue_loop < num_to_send) { + enqueue_loop +=3D qbman_swp_enqueue_multiple(swp, + &eqdesc, + &fd_arr[enqueue_loop], + NULL, + num_to_send - enqueue_loop); + } =20 - for (i =3D 0; i < nb_jobs; i++) { - ret =3D rte_qdma_vq_enqueue(vq_id, job[i]); - if (ret < 0) - break; + num_txed +=3D num_to_send; + nb_jobs -=3D num_to_send; } - - return i; + qdma_vq->num_enqueues +=3D num_txed; + return num_txed; } =20 -int __rte_experimental +int rte_qdma_vq_enqueue(uint16_t vq_id, struct rte_qdma_job *job) { - struct qdma_virt_queue *qdma_vq =3D &qdma_vqs[vq_id]; - struct qdma_hw_queue *qdma_pq =3D qdma_vq->hw_queue; - struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; int ret; =20 - DPAA2_QDMA_FUNC_TRACE(); - - /* Return error in case of wrong lcore_id */ - if (rte_lcore_id() !=3D qdma_vq->lcore_id) { - DPAA2_QDMA_ERR("QDMA enqueue for vqid %d on wrong core", - vq_id); - return -EINVAL; - } - - ret =3D dpdmai_dev_enqueue(dpdmai_dev, qdma_pq->queue_id, vq_id, job); + ret =3D rte_qdma_vq_enqueue_multi(vq_id, &job, 1); if (ret < 0) { DPAA2_QDMA_ERR("DPDMAI device enqueue failed: %d", ret); return ret; } =20 - qdma_vq->num_enqueues++; - return 1; } =20 /* Function to receive a QDMA job for a given device and queue*/ static int -dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev, +dpdmai_dev_dequeue_multijob(struct dpaa2_dpdmai_dev *dpdmai_dev, uint16_t rxq_id, uint16_t *vq_id, - struct rte_qdma_job **job) + struct rte_qdma_job **job, + uint16_t nb_jobs) { struct qdma_io_meta *io_meta; struct dpaa2_queue *rxq; @@ -531,8 +531,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev, uint8_t status; int ret; =20 - DPAA2_QDMA_FUNC_TRACE(); - if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret =3D dpaa2_affine_qbman_swp(); if (ret) { @@ -541,7 +539,6 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev, } } swp =3D DPAA2_PER_LCORE_PORTAL; - rxq =3D &(dpdmai_dev->rx_queue[rxq_id]); dq_storage =3D rxq->q_storage->dq_storage[0]; fqid =3D rxq->fqid; @@ -551,7 +548,10 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_dev= , qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, (uint64_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); - qbman_pull_desc_set_numframes(&pulldesc, 1); + if (nb_jobs > dpaa2_dqrr_size) + qbman_pull_desc_set_numframes(&pulldesc, dpaa2_dqrr_size); + else + qbman_pull_desc_set_numframes(&pulldesc, nb_jobs); =20 while (1) { if (qbman_swp_pull(swp, &pulldesc)) { @@ -561,125 +561,138 @@ dpdmai_dev_dequeue(struct dpaa2_dpdmai_dev *dpdmai_= dev, break; } =20 - /* Check if previous issued command is completed. */ + rte_prefetch0((void *)((size_t)(dq_storage + 1))); + /* Check if the previous issued command is completed. */ while (!qbman_check_command_complete(dq_storage)) ; - /* Loop until dq_storage is updated with new token by QBMAN */ - while (!qbman_check_new_result(dq_storage)) - ; =20 - /* Check for valid frame. */ - status =3D qbman_result_DQ_flags(dq_storage); - if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) =3D=3D 0)) { - DPAA2_QDMA_DP_DEBUG("No frame is delivered"); - return 0; - } + int num_pulled =3D 0; + int pending =3D 1; + do { + /* Loop until the dq_storage is updated with + * new token by QBMAN + */ + while (!qbman_check_new_result(dq_storage)) + ; =20 - /* Get the FD */ - fd =3D qbman_result_DQ_fd(dq_storage); + rte_prefetch0((void *)((size_t)(dq_storage + 2))); + /* Check whether Last Pull command is Expired and + * setting Condition for Loop termination + */ + if (qbman_result_DQ_is_pull_complete(dq_storage)) { + pending =3D 0; + /* Check for valid frame. */ + status =3D qbman_result_DQ_flags(dq_storage); + if (unlikely((status & + QBMAN_DQ_STAT_VALIDFRAME) =3D=3D 0)) + continue; + } + fd =3D qbman_result_DQ_fd(dq_storage); =20 - /* - * Fetch metadata from FLE. job and vq_id were set - * in metadata in the enqueue operation. - */ - fle =3D (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); - io_meta =3D (struct qdma_io_meta *)(fle) - 1; - if (vq_id) - *vq_id =3D io_meta->id; + /* + * Fetch metadata from FLE. job and vq_id were set + * in metadata in the enqueue operation. + */ + fle =3D (struct qbman_fle *) + DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); + io_meta =3D (struct qdma_io_meta *)(fle) - 1; + if (vq_id) + vq_id[num_pulled] =3D io_meta->id; =20 - *job =3D (struct rte_qdma_job *)(size_t)io_meta->cnxt; - (*job)->status =3D DPAA2_GET_FD_ERR(fd); + job[num_pulled] =3D (struct rte_qdma_job *)(size_t)io_meta->cnxt; + job[num_pulled]->status =3D DPAA2_GET_FD_ERR(fd); =20 - /* Free FLE to the pool */ - rte_mempool_put(qdma_dev.fle_pool, io_meta); + /* Free FLE to the pool */ + rte_mempool_put(qdma_dev.fle_pool, io_meta); =20 - DPAA2_QDMA_DP_DEBUG("packet received"); + dq_storage++; + num_pulled++; + } while (pending && (num_pulled <=3D dpaa2_dqrr_size)); =20 - return 1; + return num_pulled; } =20 -int __rte_experimental +int rte_qdma_vq_dequeue_multi(uint16_t vq_id, struct rte_qdma_job **job, uint16_t nb_jobs) -{ - int i; - - DPAA2_QDMA_FUNC_TRACE(); - - for (i =3D 0; i < nb_jobs; i++) { - job[i] =3D rte_qdma_vq_dequeue(vq_id); - if (!job[i]) - break; - } - - return i; -} - -struct rte_qdma_job * __rte_experimental -rte_qdma_vq_dequeue(uint16_t vq_id) { struct qdma_virt_queue *qdma_vq =3D &qdma_vqs[vq_id]; struct qdma_hw_queue *qdma_pq =3D qdma_vq->hw_queue; - struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; - struct rte_qdma_job *job =3D NULL; struct qdma_virt_queue *temp_qdma_vq; - int dequeue_budget =3D QDMA_DEQUEUE_BUDGET; - int ring_count, ret, i; - uint16_t temp_vq_id; - - DPAA2_QDMA_FUNC_TRACE(); + struct dpaa2_dpdmai_dev *dpdmai_dev =3D qdma_pq->dpdmai_dev; + int ring_count, ret =3D 0, i; =20 /* Return error in case of wrong lcore_id */ if (rte_lcore_id() !=3D (unsigned int)(qdma_vq->lcore_id)) { - DPAA2_QDMA_ERR("QDMA dequeue for vqid %d on wrong core", + DPAA2_QDMA_WARN("QDMA dequeue for vqid %d on wrong core", vq_id); - return NULL; + return -1; } =20 /* Only dequeue when there are pending jobs on VQ */ if (qdma_vq->num_enqueues =3D=3D qdma_vq->num_dequeues) - return NULL; + return 0; + + if (qdma_vq->num_enqueues < (qdma_vq->num_dequeues + nb_jobs)) + nb_jobs =3D (qdma_vq->num_enqueues - qdma_vq->num_dequeues); =20 if (qdma_vq->exclusive_hw_queue) { /* In case of exclusive queue directly fetch from HW queue */ - ret =3D dpdmai_dev_dequeue(dpdmai_dev, qdma_pq->queue_id, - NULL, &job); + ret =3D dpdmai_dev_dequeue_multijob(dpdmai_dev, qdma_pq->queue_id, + NULL, job, nb_jobs); if (ret < 0) { DPAA2_QDMA_ERR( "Dequeue from DPDMAI device failed: %d", ret); - return NULL; + return ret; } + qdma_vq->num_dequeues +=3D ret; } else { + uint16_t temp_vq_id[RTE_QDMA_BURST_NB_MAX]; /* * Get the QDMA completed jobs from the software ring. * In case they are not available on the ring poke the HW * to fetch completed jobs from corresponding HW queues */ ring_count =3D rte_ring_count(qdma_vq->status_ring); - if (ring_count =3D=3D 0) { + if (ring_count < nb_jobs) { /* TODO - How to have right budget */ - for (i =3D 0; i < dequeue_budget; i++) { - ret =3D dpdmai_dev_dequeue(dpdmai_dev, - qdma_pq->queue_id, &temp_vq_id, &job); - if (ret =3D=3D 0) - break; - temp_qdma_vq =3D &qdma_vqs[temp_vq_id]; + ret =3D dpdmai_dev_dequeue_multijob(dpdmai_dev, + qdma_pq->queue_id, + temp_vq_id, job, nb_jobs); + for (i =3D 0; i < ret; i++) { + temp_qdma_vq =3D &qdma_vqs[temp_vq_id[i]]; rte_ring_enqueue(temp_qdma_vq->status_ring, - (void *)(job)); + (void *)(job[i])); ring_count =3D rte_ring_count( qdma_vq->status_ring); - if (ring_count) - break; } } =20 - /* Dequeue job from the software ring to provide to the user */ - rte_ring_dequeue(qdma_vq->status_ring, (void **)&job); - if (job) - qdma_vq->num_dequeues++; + if (ring_count) { + /* Dequeue job from the software ring + * to provide to the user + */ + ret =3D rte_ring_dequeue_bulk(qdma_vq->status_ring, + (void **)job, ring_count, NULL); + if (ret) + qdma_vq->num_dequeues +=3D ret; + } } =20 + return ret; +} + +struct rte_qdma_job * +rte_qdma_vq_dequeue(uint16_t vq_id) +{ + int ret; + struct rte_qdma_job *job =3D NULL; + + ret =3D rte_qdma_vq_dequeue_multi(vq_id, &job, 1); + if (ret < 0) + DPAA2_QDMA_DP_WARN("DPDMAI device dequeue failed: %d", ret); + return job; } =20 diff --git a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h b/drivers/raw/dpaa= 2_qdma/rte_pmd_dpaa2_qdma.h index c9697b4d7..e1ccc19e8 100644 --- a/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h +++ b/drivers/raw/dpaa2_qdma/rte_pmd_dpaa2_qdma.h @@ -12,6 +12,9 @@ * */ =20 +/** Maximum qdma burst size */ +#define RTE_QDMA_BURST_NB_MAX 32 + /** Determines the mode of operation */ enum { /** @@ -225,7 +228,8 @@ rte_qdma_vq_enqueue(uint16_t vq_id, * Number of QDMA jobs requested for dequeue by the user. * * @returns - * Number of jobs actually dequeued. + * - >=3D0: Number of jobs successfully received + * - <0: Error code. */ int rte_qdma_vq_dequeue_multi(uint16_t vq_id, --=20 2.17.1