From patchwork Mon Jan 15 11:38:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 124511 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp639954lje; Mon, 15 Jan 2018 03:39:19 -0800 (PST) X-Google-Smtp-Source: ACJfBosXnmqj8DQdu6UY4fC7J47GE6MKDeO9A9aHF2A5lcZgk3tT5UJRGtYCoevxdNw5Uy0MXhGr X-Received: by 10.80.192.72 with SMTP id u8mr8583749edd.109.1516016359896; Mon, 15 Jan 2018 03:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516016359; cv=none; d=google.com; s=arc-20160816; b=JEsVZOrNr1FMk2mh+CIaIgJCAA65btnpIHBbIZCKB9HjD3aL/oMwxkP4HOwyJWnRpu MYbYWykk4kkzJi1OELQVnCuBZenH2YSn0xXuzFQyamuS37B/+Pcq0lCIdjikEDFCJq7m ScA9ITVMEt+p0edbBMlNskzAyCNiISmvdtDd7Kr5W6MgcDWGulxgvX2gAJ4qDpPi6Q69 l5ESNJwn3Nbkn5Ps8uoXuKamuhuPoFEQinOccdpizvEjwKM3BvEVy7GF4fqPiRJMAUUs 5FNb4ikRfBTwff6t8zLL9qjl6dCh3XeUUZggzRNS31+vh/0iM/+GOzlgW0y2oDXkaioF qrpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:cc:to:from :arc-authentication-results; bh=IwQ10d49f+zVlO+RxBYm7nwqnGr3MKYkWeoXCDi5Zw4=; b=j/2M1iA1cAgRlafGtaREPGT/WEnaJiu0GpJw1RJWOzrFsuEukgkEz6ebDyCvxsyGOi 0TpxHwgbyG7lL07kQsFSHYRIdrj8CLgJ7y0b1V9LyjwiiQy8yWhLsY3KW4h6ahHEumyT c5HYcmMMqX4T9Zayr1MsHQJUgk/lvRXnjkMpjD9ojzp7iF58nRhZjbGDnaistgFv1kEk 6pFmc9zTZ0xxPFFbQaIZEp07197DX3C7QSPXLWEoUBZ2c43xQweeFn5hyjDsqyVanF4D hWfAjP8NWufs5+tZOS890mOY1RwMCqobXG8iHEpMxr/QUpedV/5qh7lnrhXt9RcA/k5r Hldg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id q27si5538069edd.522.2018.01.15.03.39.19; Mon, 15 Jan 2018 03:39:19 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 710CB3772; Mon, 15 Jan 2018 12:39:19 +0100 (CET) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0084.outbound.protection.outlook.com [104.47.32.84]) by dpdk.org (Postfix) with ESMTP id 0BE32325F for ; Mon, 15 Jan 2018 12:39:17 +0100 (CET) Received: from CY1PR03CA0025.namprd03.prod.outlook.com (10.174.128.35) by DM5PR03MB2698.namprd03.prod.outlook.com (10.168.197.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 11:39:15 +0000 Received: from BL2FFO11FD010.protection.gbl (2a01:111:f400:7c09::188) by CY1PR03CA0025.outlook.office365.com (2603:10b6:600::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Mon, 15 Jan 2018 11:39:15 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none; intel.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 BL2FFO11FD010.mail.protection.outlook.com (10.173.161.16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 15 Jan 2018 11:39:15 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0FBdCEp020011; Mon, 15 Jan 2018 04:39:13 -0700 From: Hemant Agrawal To: CC: Date: Mon, 15 Jan 2018 17:08:02 +0530 Message-ID: <1516016286-11942-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131604899555000830; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39380400002)(39860400002)(346002)(376002)(2980300002)(1110001)(1109001)(339900001)(3190300001)(189003)(199004)(2906002)(81166006)(305945005)(8936002)(36756003)(105606002)(68736007)(356003)(50226002)(498600001)(51416003)(77096006)(8676002)(81156014)(4326008)(5660300001)(97736004)(48376002)(53936002)(59450400001)(86362001)(16586007)(6666003)(2351001)(104016004)(47776003)(106466001)(6916009)(316002)(50466002)(85426001)(334744003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2698; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD010; 1:UVAi32h6zKVcDh0gOwiIEixK7rD9SQMPOx3PY51asCxJHV2D9c/lhnhHxddie15XOx72MNqoyOkEQpQQLLxUZinLO+5mFenexRQEO+bAym2Le+XBGUPj7YEP3MYkvrtL MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7f56b971-7f65-4db2-41fe-08d55c0c9b24 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2698; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 3:NTQsBgnxoIig6E3bzVFnTLyTBsmNLiJOPUg8ks5XGv4baLyMYXE9DcdldbiLLIqE8VmIO7eIJi3t8M47fzVtWkXvFFKwT7w2kHCr/LM7qOK7CY+D4WWDzf+0avDL/cDAGV5GAPvkqut9UtKzmzlWrU1tQ2tiM6YOoFZV9vLE0y2K/12PuL0ssvJHZWPetqlRKP3wKXqj/H+m/IN/MeqKfufYRIWVKN2WG4Z2wHNS/w72EVBH7EX40PX4UJW0DrnO/EWJTWZl0OISZl0qkjT6/E8yvEtOpXQqVorbNCBSfG2VhvvJ5Z+FIZBQxW5fS/mtsUvjz8wVAnPJkH5p/I+nHedxwbK0lSFRXuLZxPttG44=; 25:NtQT/ctUNtbl38CpCzkbrS7GvQXUVmp6CHAhCFq1h/NKdwFQeLn/VFOSmmwM8CjI5czP+zJxRoKC7dW+G933h/JgKQ7pNm+8AYGi6Bo39GOuXcC9NbsnmsjihsNvcvcbY5E1IMUWMT/VV0WyGmNoUy+8+gqxX002iWUAbDOt1m612WqL1Ml0hiI7In8oEW02rYkhECJorIc+wjcf996HWEXMwGcL5NoKzBoGqq1jz3dzGaztiS3Y7Ycsopzl7trDtaaMwgO9X6esr6KtA2M93MVLloclRUoQrsSfdr98Zz1IBiQ/aq8B/B8uuSoK7Ku6TDeP0WtRCp/dAK8PQ1R5gA== X-MS-TrafficTypeDiagnostic: DM5PR03MB2698: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 31:xP14zcNKQGY2D5qdZ+dhwHndez/zHZz/Isn/y60xfqSt9Y+E+mVhEY3dO/R/3taHGLqz0uwyIPnfbbqdpUufDsQhVdCult79KnkdH3xy6K5V1GF95J9ho/M0BuKEApv65/d7oncSsIApOZSoUxHS/QmfbAf3+uozoYbpgJ242jbcd/6vlL/duzLvUuj7PJThGQiUM5uVFmKoOmp1phEKzbT1lJqSeR0KI8CuchMqyhc=; 4:CYrIWkEEMRyqIR19Uj4AbNMtgnE5MjRh3rDzWZLy141zrBhv4qI7p1ricX8WzveZR2hger11X5XllcqLoCbJD1aog9Pm72HXnP3a3qD3OsiRFoevQfqArW79EQBz02AzsgCn29qhqiDqx4hOGvTaYfSDjGWxSHlrsWWNN0Okntw3rNcijUebSWiuD5UUN7eRM3OFyLcoYKvkf6PTBIKXGla1frAtzaplmb3Y90rXnlh34kRFFQs9rhpbFNTYSVXVv9HxGvXgYQmsOtDqwEh8Smgs4VOkH22ISONMEyxOVfCGYKH7pxhxa+pxT5okkGxPre5MgkJP6AQAifi9WJyDXmeYyoMFItAc8aOc97rakm8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231023)(944501161)(3002001)(6055026)(6096035)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123563025)(20161123556025)(20161123565025)(20161123561025)(201708071742011); SRVR:DM5PR03MB2698; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2698; X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2698; 23:NMkg7N46jA7M3nTE6isLfsyF9sAqH41w0B4qKnztv?= K3aJyau0g+8JTYU6el2ADqMFqc3tZXia10VjdaGVrg9bLOXLFmR5GIrZVvARyP3hMzesqV9eR2DlEvPuDT0xSKK/Y9SsgSZ32uhKmtwpa1rbpIObFXh4SzaHgm8eT/aqXtBjn7j/gFnwLO8AF0cNuzcJxvVyddGnnlSrfr0AYrrLIXBgY2xgfbBTjwJjPT4qUUvCH1hjaUHkRsPv2gyLH332PcCyWN/c9Jq0E4DlFzNq0a/Whq7A49lrprOxP6s5WINJtJ05XdpU6n9dYzxeMFyeSDiIEcdBHrixJR0BhnpneQ/jve79XmD/GylwteTzXHK9yWuzVBl3BGP5LV85CrNT585ybJbH+S5TurdOuR8/KWa1cPWmUhIlS2Tt85Trit8YknBZsgZVMmmB5QFCwm6Z08SEM8ZJTQy0l/vp07Y4npYhIkKUr6jaafzrwEaJmQLZgaIYAcG8T6oGWBhn7hRMHEYv5ZDfOYyTtK4gvRm3uSFMBuOHpr50zssk6ja+Ds5FpaAWVLJ8MsO084oyfeFPkh9c27NOCA/lcXplgb/zdABzouyCH3V4J6CK9392ntatrYKsVJtkfpvRC1wQ7StA2GaoJgHRYu6ltO7eKwMOJWdGTYix+l3cpCkvPHNAEOWMyK09Kxd3YGgknSkSgcHcWnpstnSotLNTkg6eZ8tXDlUlYQyr5TNOCYgsDfaWq/C/ZnqiIqoF2UEqlTIEu6u/vCN+NcLQA3GFgcTfHJyxoNXGpEjVH9r9gY0QgKgktYuXngpkkxL2/sanXYls0/rJv0KNnkLoaMKG0AeH50N1TqSLpSvA/0aZcCDBhooycTXgLaUZpvLunauv/qPYL/ZaZ+HCAvw1WDbjm30YAPO7cr4oU/zz84YO64s5R1IGei9awA6Go2E3IxSFH8KKIDXO1PCItb33ZopfEzVkDmRFptg1DegwVkpquv/ELwSycVAkB5o2tnNGcosdPWaEh/QCykz9ylNnAeON4lJWHGAxBW5uK/ZFcuCYTftt8VCso8= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 6:Sc7V5UouprGNthXUdpohHoTIvtjrTWV6AvihP6g5Nk7kldPgIKGYOhvWqqbwq1IMWa2UuQaG4za4ttA3dTdO/ThYNd9KRT12w/UjhMQF9AoA50aO/SvkCxPAGEwxfnXbP3cYqMLr91+iO/ODcmL22jjlsK68Wk6QDY/TvxEvParEwFcXM1mub+7+NzwmTXqTTTvLYN3ZAeR0QZnvG9I7Kv6QBDnvZ0PV9j+qSTuYSw79McNzC59wZfydxvOqY9nL+v+0bsAsxEAaDK4MMoVDGDZrscZK4kz95z1d2dmubH2gRnZ30kesO3WkdOVI4j2Ra2m1XnQbQ6Fl/HkFFU1xLD4EhPiNI02YuzFW/g0lztw=; 5:/BeyHkeFj+pGk8LFRJKAVxpZx3tttR/MMT9OiH3+k+dAG8dx174U6Tr66X1ZozZAlrdOzgckVcK+Uhtp94b3QIysdlxwDGXRNbIClIH8/jZ4+K+qCrNQhq+EeQg4RxHDlLzFa6mmcwxofydmqrb4oiqzenYq2Odx585ev+cYDEk=; 24:1/KodpsmhxJLf8lQpSz0/OeJwXWUJh5QoOo9bj4Ng+TzZJ+fNYGsgtMfocFVm4l+0vzWiWNcLD+yr2KId6V9luwvLgect7YfvhMtiv4fo8U=; 7:pxUp37N1MkQKI8GNEaKsdt246m7avmvDDf6Sjk/u98a5v295cVSEhotGUJgREsU6DABBbKTnwYbgZYQd4AvzZBvqXqYg7xara+DI39tHSAnO7yf9fi9OTVL4Bg7qQSkCVtHG9ItCez2I8o7QPR81mu77tH6DPo5UolSmVgeat4zEovfOkh/EbHpmaiy8RX2I0arKnMzWaKt80XfcZJfDhAEXIcYdMmuZ88hXYTV5S0ZUfK7aO6KlJb1F3JoXsblm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 11:39:15.3440 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f56b971-7f65-4db2-41fe-08d55c0c9b24 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: DM5PR03MB2698 Subject: [dpdk-dev] [PATCH 1/5] net/dpaa2: support more than 16 burst size in Rx func 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" This patch enhances the Rx function to support more than 16 burst size. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 5 +- drivers/net/dpaa2/dpaa2_rxtx.c | 140 ++++++++++++++++++++++++-------- 2 files changed, 108 insertions(+), 37 deletions(-) -- 2.7.4 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 2e79399..97e61bb 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -95,8 +95,9 @@ struct dpaa2_dpbp_dev { struct queue_storage_info_t { struct qbman_result *dq_storage[NUM_DQS_PER_QUEUE]; struct qbman_result *active_dqs; - int active_dpio_id; - int toggle; + uint8_t active_dpio_id; + uint8_t toggle; + uint8_t last_num_pkts; }; struct dpaa2_queue; diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 53466c3..efad728 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -495,12 +495,12 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { /* Function receive frames for a given device and VQ*/ struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue; - struct qbman_result *dq_storage; + struct qbman_result *dq_storage, *dq_storage1 = 0; uint32_t fqid = dpaa2_q->fqid; - int ret, num_rx = 0; - uint8_t is_last = 0, status; + int ret, num_rx = 0, next_pull = 0, num_pulled, num_to_pull; + uint8_t pending, is_repeat, status; struct qbman_swp *swp; - const struct qbman_fd *fd[DPAA2_DQRR_RING_SIZE], *next_fd; + const struct qbman_fd *fd, *next_fd; struct qbman_pull_desc pulldesc; struct queue_storage_info_t *q_storage = dpaa2_q->q_storage; struct rte_eth_dev *dev = dpaa2_q->dev; @@ -513,37 +513,51 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } } swp = DPAA2_PER_LCORE_PORTAL; - if (!q_storage->active_dqs) { + + /* if the original request for this q was from another portal */ + if (unlikely(DPAA2_PER_LCORE_DPIO->index != + q_storage->active_dpio_id)) { + if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) { + while (!qbman_check_command_complete(get_swp_active_dqs + (DPAA2_PER_LCORE_DPIO->index))) + ; + clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index); + } + q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index; + } + + if (unlikely(!q_storage->active_dqs)) { q_storage->toggle = 0; dq_storage = q_storage->dq_storage[q_storage->toggle]; + q_storage->last_num_pkts = (nb_pkts > DPAA2_DQRR_RING_SIZE) ? + DPAA2_DQRR_RING_SIZE : nb_pkts; qbman_pull_desc_clear(&pulldesc); qbman_pull_desc_set_numframes(&pulldesc, - (nb_pkts > DPAA2_DQRR_RING_SIZE) ? - DPAA2_DQRR_RING_SIZE : nb_pkts); + q_storage->last_num_pkts); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, (dma_addr_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); - if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) { - while (!qbman_check_command_complete( - get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index))) - ; - clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index); - } while (1) { if (qbman_swp_pull(swp, &pulldesc)) { - PMD_RX_LOG(WARNING, "VDQ command is not issued." - "QBMAN is busy\n"); + PMD_RX_LOG(WARNING, + "VDQ command not issued.QBMAN busy\n"); /* Portal was busy, try again */ continue; } break; } q_storage->active_dqs = dq_storage; - q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index; set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage); } + + /* pkt to pull in current pull request */ + num_to_pull = q_storage->last_num_pkts; + + /* Number of packet requested is more than current pull request */ + if (nb_pkts > num_to_pull) + next_pull = nb_pkts - num_to_pull; + dq_storage = q_storage->active_dqs; - rte_prefetch0((void *)((uint64_t)(dq_storage + 1))); /* Check if the previous issued command is completed. * Also seems like the SWP is shared between the Ethernet Driver * and the SEC driver. @@ -552,7 +566,49 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ; if (dq_storage == get_swp_active_dqs(q_storage->active_dpio_id)) clear_swp_active_dqs(q_storage->active_dpio_id); - while (!is_last) { + +repeat: + is_repeat = 0; + + /* issue the deq command one more time to get another set of packets */ + if (next_pull) { + q_storage->toggle ^= 1; + dq_storage1 = q_storage->dq_storage[q_storage->toggle]; + qbman_pull_desc_clear(&pulldesc); + + if (next_pull > DPAA2_DQRR_RING_SIZE) { + qbman_pull_desc_set_numframes(&pulldesc, + DPAA2_DQRR_RING_SIZE); + next_pull = next_pull - DPAA2_DQRR_RING_SIZE; + q_storage->last_num_pkts = DPAA2_DQRR_RING_SIZE; + } else { + qbman_pull_desc_set_numframes(&pulldesc, next_pull); + q_storage->last_num_pkts = next_pull; + next_pull = 0; + } + qbman_pull_desc_set_fq(&pulldesc, fqid); + qbman_pull_desc_set_storage(&pulldesc, dq_storage1, + (dma_addr_t)(DPAA2_VADDR_TO_IOVA(dq_storage1)), 1); + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + PMD_RX_LOG(WARNING, + "VDQ command not issued.QBMAN busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + is_repeat = 1; + q_storage->active_dqs = dq_storage1; + set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage1); + } + + rte_prefetch0((void *)((uint64_t)(dq_storage + 1))); + + num_pulled = 0; + pending = 1; + + do { /* Loop until the dq_storage is updated with * new token by QBMAN */ @@ -563,23 +619,23 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) * setting Condition for Loop termination */ if (qbman_result_DQ_is_pull_complete(dq_storage)) { - is_last = 1; + pending = 0; /* Check for valid frame. */ - status = (uint8_t)qbman_result_DQ_flags(dq_storage); + status = qbman_result_DQ_flags(dq_storage); if (unlikely((status & QBMAN_DQ_STAT_VALIDFRAME) == 0)) continue; } - fd[num_rx] = qbman_result_DQ_fd(dq_storage); + fd = qbman_result_DQ_fd(dq_storage); next_fd = qbman_result_DQ_fd(dq_storage + 1); /* Prefetch Annotation address for the parse results */ - rte_prefetch0((void *)((uint64_t)DPAA2_GET_FD_ADDR(next_fd) + rte_prefetch0((void *)(DPAA2_GET_FD_ADDR(next_fd) + DPAA2_FD_PTA_SIZE + 16)); - if (unlikely(DPAA2_FD_GET_FORMAT(fd[num_rx]) == qbman_fd_sg)) - bufs[num_rx] = eth_sg_fd_to_mbuf(fd[num_rx]); + if (unlikely(DPAA2_FD_GET_FORMAT(fd) == qbman_fd_sg)) + bufs[num_rx] = eth_sg_fd_to_mbuf(fd); else - bufs[num_rx] = eth_fd_to_mbuf(fd[num_rx]); + bufs[num_rx] = eth_fd_to_mbuf(fd); bufs[num_rx]->port = dev->data->port_id; if (dev->data->dev_conf.rxmode.hw_vlan_strip) @@ -587,22 +643,37 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) dq_storage++; num_rx++; - } + num_pulled++; + } while (pending); - if (check_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index)) { - while (!qbman_check_command_complete( - get_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index))) - ; - clear_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index); + /* Another VDQ request pending and this request returned full */ + if (is_repeat) { + /* all packets pulled from this pull request */ + if (num_pulled == num_to_pull) { + /* pkt to pull in current pull request */ + num_to_pull = q_storage->last_num_pkts; + + dq_storage = dq_storage1; + + while (!qbman_check_command_complete(dq_storage)) + ; + goto repeat; + } else { + /* if this request did not returned all pkts */ + goto next_time; + } } + q_storage->toggle ^= 1; dq_storage = q_storage->dq_storage[q_storage->toggle]; + q_storage->last_num_pkts = (nb_pkts > DPAA2_DQRR_RING_SIZE) ? + DPAA2_DQRR_RING_SIZE : nb_pkts; qbman_pull_desc_clear(&pulldesc); - qbman_pull_desc_set_numframes(&pulldesc, DPAA2_DQRR_RING_SIZE); + qbman_pull_desc_set_numframes(&pulldesc, q_storage->last_num_pkts); qbman_pull_desc_set_fq(&pulldesc, fqid); qbman_pull_desc_set_storage(&pulldesc, dq_storage, (dma_addr_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); - /* Issue a volatile dequeue command. */ + /* issue a volatile dequeue command for next pull */ while (1) { if (qbman_swp_pull(swp, &pulldesc)) { PMD_RX_LOG(WARNING, "VDQ command is not issued." @@ -612,12 +683,11 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) break; } q_storage->active_dqs = dq_storage; - q_storage->active_dpio_id = DPAA2_PER_LCORE_DPIO->index; set_swp_active_dqs(DPAA2_PER_LCORE_DPIO->index, dq_storage); +next_time: dpaa2_q->rx_pkts += num_rx; - /* Return the total number of packets received to DPAA2 app */ return num_rx; }