From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0077.outbound.protection.outlook.com [104.47.40.77]) by dpdk.org (Postfix) with ESMTP id 00BDE99B1 for ; Thu, 25 May 2017 20:10:07 +0200 (CEST) Received: from CY1PR03CA0009.namprd03.prod.outlook.com (10.174.128.19) by BLUPR03MB167.namprd03.prod.outlook.com (10.255.212.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Thu, 25 May 2017 18:10:05 +0000 Received: from BN1BFFO11FD034.protection.gbl (2a01:111:f400:7c10::1:181) by CY1PR03CA0009.outlook.office365.com (2603:10b6:600::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Thu, 25 May 2017 18:10:04 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD034.mail.protection.outlook.com (10.58.144.97) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Thu, 25 May 2017 18:10:03 +0000 Received: from b27504-OptiPlex-790.ap.freescale.net (b27504-OptiPlex-790.ap.freescale.net [10.232.132.60]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v4PI84WR022340; Thu, 25 May 2017 11:10:01 -0700 From: Nipun Gupta To: CC: , , , , , , Nipun Gupta Date: Thu, 25 May 2017 23:37:47 +0530 Message-ID: <1495735671-4917-17-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495735671-4917-1-git-send-email-nipun.gupta@nxp.com> References: <1495735671-4917-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131402094042899645; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39450400003)(39850400002)(39840400002)(39410400002)(39400400002)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(53936002)(356003)(38730400002)(110136004)(33646002)(50466002)(81166006)(48376002)(50226002)(8936002)(5003940100001)(106466001)(54906002)(8656002)(498600001)(2351001)(85426001)(4326008)(77096006)(5660300001)(2906002)(189998001)(6666003)(47776003)(305945005)(104016004)(105606002)(8676002)(36756003)(86362001)(6916009)(50986999)(2950100002)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB167; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD034; 1:CyWFd95aq+Uyr3ixtj+5p5h7T0NV+pdYlEFmB5u6o0sGXwkZTZVdkqAydkI7PbgNrqqtUM/C0cpuqhXiVp0eG48MPed8sNeLBG2wtofdT8LeqmCydZSoKWNcDvkbUGTZR1YpLo2Wy5SLfmhzImQmNzl0aRGXSb39j46uDc5PqgtyjwhWmLeakmQjSZ9l/xq2qG8ioEu8agQfdlK0tAp5740nzHXOxKrQc6tVicx6F0yhDd5z4jmloaSuhBN2t7ertdXAVxEXuDEGHUoImbUiuWZbzYc/+2aKrRchIBZKhw0OKWfJsxNctSrOf6KzYRx0bHwuqvKpM7Bo9vku19mZ+sKJe/IH7W0kR+SEhoaP0fYl0p7llrr5IVLoqxk/sCnWacggH+4dYYJCTXD+OPPT5KGXP/XPbNo1a/fFJyO17bU6jlopNxyMKop+euH2EXkDrAJdFNj20G57uMbZ+ZNOtdGYZrfsEHYv3yncJLGZMvCAcltl09nYCK/9oGXuFQ+fMQ0YTaQBn09q53FQVQ9V8yTHOhdoYT7H6dcP3T9nw1ZUjmg6tyf3EDz0Ww/Pg/ZOkK8XZMsFXmZpMxzcDVVfqTyQyg6WmpjDHj6w9nrjJrT6YW1QQm3QebkoDeq9TJOIXPGfpwYHVhJ0K5bd+xluB2QGWOycbdeXgqgn+dYiXH7KsI9TF+nZuR/wCwxMA6l3zFvhIbEq8y9fbu0oi+CAFF45reaQYTAUC1n6tRtm6jNxobe0SKbQDfDEi3AWsyks667665hhH19pd+FmJlwcRw== MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR03MB167: X-MS-Office365-Filtering-Correlation-Id: a346d72d-fed7-4df0-59b5-08d4a399448f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BLUPR03MB167; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB167; 3:QZ4xdNwUeZV4ZGW96GxGaMSCrCzV5tbLoZM6zJZJggNUCZ5aOwRYElJ3oS3GeZXTn14Lem4sN7W5P5brggmsgCFB8Pb1Hzov8ieHbuxJmOjvnuuAE3E1IaCUXcClwdIRG1a8tSYHY9s2CD3ofI5wui8YQ4m9ssf6rMuJw2cIhb1Ud+8O14Sacp9B1PuVFWQgXWxsCXXiSDqLVhHL+LhyabKALnurXDQYc0eMPzSzsZ9uuFxx1fWzINGhNkBH+DhujUL6L2ovNWcw4IM+g8dc6gSEsvGQhK01QMJU4F7FkrSOri9P5nlT4XUF9kyu3eiS/CdS9+3o66pdygIpaT/zlbkvKsW8P8dcKvJw6/sPnOE7Pw+osJCuHRmhM6LBquSHezyxNrvWfAi3k/mT56Zy6WS7ppgrTa8rrTVNj91nC81+AO8eKkN0Ktep1fd2MlZ4; 25:orKwyMuq6quBM+8zZ5Par5/pGHtI/ZXVvUGf3JPvNs7Lx6LVK5G0kM7hQHT0K9dBt1K4kPQK2cfLv8wJ86W92L2YAKvzfbvz+bYMh0tbr6EAIBUc7otWqkyejy7PfFVI+h9ED5+9arJpd5zGshMf1vlbKUpa5CWHim7zXHGuLn25hw9HKCbD/NysXBJKJV0Yj1EkMAE2K96ygBKhScJ4Lp7sLSu3wjZyRpzaniUW6ND+0waITHsxk40EorH2Uv5tMUbRnJVtQ37d+AyrJR0oFDhlYDe5rBgs6AVHO2asDBLHNvXlnYpjnJU97WP6RfYe7H7ONDHXmDquVbhDI6TUYmHjdMhzX5Ql/0El/49hTrp+UhVgPlTUi+xB8iS2Ef58lUJ5BV3t37HFZe0NJJndpUxeSKHDpguLrvGbCXzorsvLXx7VbEOkrZp02VV0GzzNLD9BbX2uK2+AMmd94lpd7U+PmFZSVDNeTv2wPLylC9Q= X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB167; 31:1hCIkeD9Y5H5LQREuqrPiryoMIQ6NLCwXPQQAGUhHhlCXIdGzLK3ihQnT8t6A9j823COwHeHIUjajkf229CqGGqWzeHm/m9u+EEWwoMUw4nOnc28jxSohrbL8wu8Gia8mSjjjecF+p1tJExr6ENSmrYizAmxHNpw1RTqqmYm/CmJhzxKt+C34wEBr0mrpnM0jwImgulPOzCRHKg7rCk9qoYDvcjJte1rvkdgkr+uQ18cY4LXzJY5gAenR/M2hIqz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13018025)(8121501046)(13017025)(5005006)(13015025)(13023025)(13024025)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123565025)(20161123556025)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123559100)(20161123561025); SRVR:BLUPR03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eIVqI41RgoswGkNCiJLhSVCHo5TwEsa5ENbPRz?= =?us-ascii?Q?F6bO30N9A8s0iPsKBO9P+ZPmYvuDMkfR0vwiSgsplUIefquJb+zGRZsStUns?= =?us-ascii?Q?SYevXhF0QYkOekLa49vxJy3D3wAeuKd2V8ajIjf0jqoR2pp+pTz6dr1P5rT1?= =?us-ascii?Q?42yg9ujOGAzNBVtlHOE1f7MzLKNtGvlqde7VUJJHvEYY9VuEzmqWVdFH/V4I?= =?us-ascii?Q?=3D?= X-Forefront-PRVS: 0318501FAE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB167; 23:VWqopgMOMQgc81Hgh0tHoPMInDA4Bd5Lq2RkVcsHME?= =?us-ascii?Q?lGehyyRpdbCjTpKXT78Srxf8r6SiFltn9PQ6oAVfHhh09jZdb1k9UBRbMnv5?= =?us-ascii?Q?wQKZpcgcJJoqXG3C2CFA2tCBqONiwkYyE2QeeD0maQZkyfqgXCDtOvxFLYUp?= =?us-ascii?Q?ar6b9JNf3U9Gw4/pCbIJi/85/odz55WvNpevZAMxd8LnJ+SXhAw+3MB3pKcc?= =?us-ascii?Q?XPFeuyFvxVnbGQe9o5/4xxvPELNcdrti/cDmUy2niNAbwTOhsPL/WuJc6lnH?= =?us-ascii?Q?Kc88+sEbtG7EXTx3Xdgwu9tP4pecpJ5njyyjSs/ORsqXuiG50ZlD9pBcF5E9?= =?us-ascii?Q?HUt7iJS3Y2+UatGJ7UW8F5B3mFhcBUAYRzAFLFzYOEBP4iSNU3Rxo3rWJolr?= =?us-ascii?Q?MZpJs1HOHhKSf7zjnmuM2kFKKJua9f4QsNECtt348Zjmh9s4oXSgb/4SuO7R?= =?us-ascii?Q?9RUaDhRpg/Y8sCI1u08G9remrp/bxn11SYisrLT8lBtQvof3n0CpO2olMFpX?= =?us-ascii?Q?9D1J1K61U0fU8QUYc+1BWry7YKRef8PBh7ta6jPdqhaJmDfVblfW8LTB5jfF?= =?us-ascii?Q?1ZyA+X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a7E9e+EF3YRcGoxj0nGmHzGdELleGW20V6hlrbGT4RJruMykxBRsek3LHqT6uxK2grgXjpGDDe6F2WH2MSZlF07UBIqNDufzMCsd0UuRIb70HUo4DCrEg20U0Ih8BsJUtfyx/hte/y73FxSwbXnRhWwaS8QYJsSRiB+jn76VmV5gs3FOI6wqFirJQZFfyFJxeuTr1scTgfwGC/NMcDIJdexiGqtK/32h9dcUzCVlghsL7yOMR0u0OZwdWNiTgs4CiltlAdpblDuraSj1bNOIUzvj1O+ZxzJnJ5FguX5kSkIJiJnstpBwBEe0c39aGt4mdL1AI7A==; 5:zyhm08Nnq4cBwurTiubuYzptB50qiJjL0Bx8kFonzoovz7oUJudo4TnHKwKaSZUsKB/kTWxA8me14Js402nGvbedZTGp9zY28yM97wflqFfdXS+XHsdzYyiqSt1ms4w/z26krEjZUh1v9P6yio5HbpiYOckxniumtx3tURy+eivMUVm2CUOWBHwO28HvdJ6w; 24:39tbFzNegqran8/ntCzeu1kKv2PmggFvAPRjBwd8iHuyQxNssLpAa4e1T+k05zGkF9p4hD8PXhjT17tLD4zmNB40eAeUVskgYMrmPj107pY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB167; 7:/AHqUhNYWs19p3WYXKU+TOXVGYE8oKyk0BiG1hMuzYCzsEUouM8eLpnFFxKcdW/QUc5HB1DiWRPI1h91vDUWkMPvcpNNjbr/j1bDPa0e3IHgI8tL0mwZdRxzjHU4hGrC0m823Tj70l30rHt+hEGojxM+dJA+ISjnFv4Sw6jdbFwd1dF8ltOeR3gWF9YJX4vVZrB7HOR1olyanHPlDttLa21edf1YdKcE0U+fXuYY5LtXakvqA5o8bF7RzvrEYNTVfVC3YRNIlqBfbXBZyQJhrxbO4RGUHN5cS3tVn2vWRUEXNB4V6pPtuKFhACQxr5H49td3nxB8/HvVVJBp6ymIBA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2017 18:10:03.9779 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB167 Subject: [dpdk-dev] [PATCH 16/20] event/dpaa2: add enqueue and dequeue functionality 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, 25 May 2017 18:10:08 -0000 Signed-off-by: Nipun Gupta --- drivers/event/dpaa2/dpaa2_eventdev.c | 170 +++++++++++++++++++++++++++++++++-- 1 file changed, 163 insertions(+), 7 deletions(-) diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index cfb52bb..3f3e4a6 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -74,11 +75,85 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[], uint16_t nb_events) { + struct rte_eventdev *ev_dev = + ((struct dpaa2_io_portal_t *)port)->eventdev; + struct dpaa2_eventdev *priv = ev_dev->data->dev_private; + uint32_t queue_id = ev[0].queue_id; + struct evq_info_t *evq_info = &priv->evq_info[queue_id]; + uint32_t fqid; + struct qbman_swp *swp; + struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; + uint32_t loop, frames_to_send; + struct qbman_eq_desc eqdesc[MAX_TX_RING_SLOTS]; + uint16_t num_tx = 0; + int ret; + RTE_SET_USED(port); - RTE_SET_USED(ev); - RTE_SET_USED(nb_events); - return 0; + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + PMD_DRV_LOG(ERR, PMD, "Failure in affining portal\n"); + return 0; + } + } + + swp = DPAA2_PER_LCORE_PORTAL; + + while (nb_events) { + frames_to_send = (nb_events >> 3) ? + MAX_TX_RING_SLOTS : nb_events; + + for (loop = 0; loop < frames_to_send; loop++) { + const struct rte_event *event = &ev[num_tx + loop]; + + if (event->sched_type != RTE_SCHED_TYPE_ATOMIC) + fqid = evq_info->dpci->queue[ + DPAA2_EVENT_DPCI_PARALLEL_QUEUE].fqid; + else + fqid = evq_info->dpci->queue[ + DPAA2_EVENT_DPCI_ATOMIC_QUEUE].fqid; + + /* Prepare enqueue descriptor */ + qbman_eq_desc_clear(&eqdesc[loop]); + qbman_eq_desc_set_fq(&eqdesc[loop], fqid); + qbman_eq_desc_set_no_orp(&eqdesc[loop], 0); + qbman_eq_desc_set_response(&eqdesc[loop], 0, 0); + + if (event->impl_opaque) { + uint8_t dqrr_index = event->impl_opaque - 1; + + qbman_eq_desc_set_dca(&eqdesc[loop], 1, + dqrr_index, 0); + DPAA2_PER_LCORE_DPIO->dqrr_size--; + DPAA2_PER_LCORE_DPIO->dqrr_held &= + ~(1 << dqrr_index); + } + + memset(&fd_arr[loop], 0, sizeof(struct qbman_fd)); + + /* + * todo - need to align with hw context data + * to avoid copy + */ + struct rte_event *ev_temp = rte_malloc(NULL, + sizeof(struct rte_event), 0); + rte_memcpy(ev_temp, event, sizeof(struct rte_event)); + DPAA2_SET_FD_ADDR((&fd_arr[loop]), ev_temp); + DPAA2_SET_FD_LEN((&fd_arr[loop]), + sizeof(struct rte_event)); + } + loop = 0; + while (loop < frames_to_send) { + loop += qbman_swp_enqueue_multiple_eqdesc(swp, + &eqdesc[loop], &fd_arr[loop], + frames_to_send - loop); + } + num_tx += frames_to_send; + nb_events -= frames_to_send; + } + + return num_tx; } static uint16_t @@ -87,16 +162,91 @@ return dpaa2_eventdev_enqueue_burst(port, ev, 1); } +static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp, + const struct qbman_fd *fd, + const struct qbman_result *dq, + struct rte_event *ev) +{ + struct rte_event *ev_temp = + (struct rte_event *)DPAA2_GET_FD_ADDR(fd); + rte_memcpy(ev, ev_temp, sizeof(struct rte_event)); + rte_free(ev_temp); + + qbman_swp_dqrr_consume(swp, dq); +} + +static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, + const struct qbman_fd *fd, + const struct qbman_result *dq, + struct rte_event *ev) +{ + struct rte_event *ev_temp = + (struct rte_event *)DPAA2_GET_FD_ADDR(fd); + uint8_t dqrr_index = qbman_get_dqrr_idx(dq); + + RTE_SET_USED(swp); + + rte_memcpy(ev, ev_temp, sizeof(struct rte_event)); + rte_free(ev_temp); + ev->impl_opaque = dqrr_index + 1; + DPAA2_PER_LCORE_DPIO->dqrr_size++; + DPAA2_PER_LCORE_DPIO->dqrr_held |= 1 << dqrr_index; +} + static uint16_t dpaa2_eventdev_dequeue_burst(void *port, struct rte_event ev[], uint16_t nb_events, uint64_t timeout_ticks) { + const struct qbman_result *dq; + struct qbman_swp *swp; + const struct qbman_fd *fd; + struct dpaa2_queue *rxq; + int num_pkts = 0, ret, i = 0; + RTE_SET_USED(port); - RTE_SET_USED(ev); - RTE_SET_USED(nb_events); RTE_SET_USED(timeout_ticks); - return 0; + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + PMD_DRV_LOG(ERR, PMD, "Failure in affining portal\n"); + return 0; + } + } + + swp = DPAA2_PER_LCORE_PORTAL; + + /* Check if there are atomic contexts to be released */ + while (DPAA2_PER_LCORE_DPIO->dqrr_size) { + if (DPAA2_PER_LCORE_DPIO->dqrr_held & (1 << i)) { + dq = qbman_get_dqrr_from_idx(swp, i); + qbman_swp_dqrr_consume(swp, dq); + DPAA2_PER_LCORE_DPIO->dqrr_size--; + } + i++; + } + DPAA2_PER_LCORE_DPIO->dqrr_held = 0; + + do { + dq = qbman_swp_dqrr_next(swp); + if (!dq) + return 0; + + fd = qbman_result_DQ_fd(dq); + + rxq = (struct dpaa2_queue *)qbman_result_DQ_fqd_ctx(dq); + if (rxq) { + rxq->cb(swp, fd, dq, &ev[num_pkts]); + } else { + qbman_swp_dqrr_consume(swp, dq); + PMD_DRV_LOG(ERR, PMD, "Null Return VQ received\n"); + return 0; + } + + num_pkts++; + } while (num_pkts < nb_events); + + return num_pkts; } static uint16_t @@ -397,11 +547,17 @@ int ret, i; /*Do settings to get the frame on a DPCON object*/ - rx_queue_cfg.options = DPCI_QUEUE_OPT_DEST; + rx_queue_cfg.options = DPCI_QUEUE_OPT_DEST | + DPCI_QUEUE_OPT_USER_CTX; rx_queue_cfg.dest_cfg.dest_type = DPCI_DEST_DPCON; 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 = + dpaa2_eventdev_process_parallel; + dpci_dev->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]); ret = dpci_set_rx_queue(&dpci_dev->dpci, -- 1.9.1