From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0072.outbound.protection.outlook.com [104.47.38.72]) by dpdk.org (Postfix) with ESMTP id 2DB9F1B397 for ; Mon, 23 Oct 2017 08:21:59 +0200 (CEST) Received: from BN3PR03CA0061.namprd03.prod.outlook.com (10.167.1.149) by BN3PR03MB2355.namprd03.prod.outlook.com (10.166.74.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Mon, 23 Oct 2017 06:21:57 +0000 Received: from BY2FFO11FD042.protection.gbl (2a01:111:f400:7c0c::117) by BN3PR03CA0061.outlook.office365.com (2a01:111:e400:7a4d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4 via Frontend Transport; Mon, 23 Oct 2017 06:21:57 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.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 BY2FFO11FD042.mail.protection.outlook.com (10.1.14.227) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.156.4 via Frontend Transport; Mon, 23 Oct 2017 06:21:57 +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 v9N6LntV000944; Sun, 22 Oct 2017 23:21:54 -0700 From: Nipun Gupta To: CC: , , , Nipun Gupta Date: Mon, 23 Oct 2017 18:07:03 +0530 Message-ID: <1508762226-18938-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508762226-18938-1-git-send-email-nipun.gupta@nxp.com> References: <1507657887-11366-1-git-send-email-nipun.gupta@nxp.com> <1508762226-18938-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131532133173243453; (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)(39860400002)(39380400002)(346002)(376002)(2980300002)(1109001)(1110001)(339900001)(51234002)(189002)(199003)(68736007)(5890100001)(5660300001)(189998001)(85426001)(498600001)(2351001)(53936002)(36756003)(50226002)(106466001)(105606002)(8936002)(47776003)(48376002)(305945005)(8676002)(356003)(104016004)(81156014)(50466002)(81166006)(97736004)(6916009)(4326008)(54906003)(76176999)(2906002)(2950100002)(6666003)(8656005)(316002)(50986999)(8656005)(86362001)(33646002)(16586007)(5003940100001)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2355; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD042; 1:FSpVXj6HJFapjcFO1LHLH1gO3VEodP12j1dBIsoTn8AME6ZQPXZX6zMF6A0bptBnoNF3tbL8BJfks0qDJ+vboKbL1we8n4tCD+A1mvO5IfBYtT+fH2LuOvTazCZVxIGQ MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fee4c133-1f0c-4d00-2335-08d519de5cbb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 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AiGD1CskjL44w+D7SliWgpddTDez1ngbra90ZOQF7Q1ocmNURtZBTcDBGP/2u2TFO3BicdhkNTW1CsRReA+i+F1va+F9o2JXXTO0CEcStZm3oO4jM3pYN7FrVmk8YR9DyvQE63607GxOaTJWU14WwEBspz5N05qq6zFV/TGZ5CQpLHGWMs5HnjSoLjbOM5kn/JjnpazZ9K6UEG3ImTk1hhXTrJKPkC1C0sJTQ1vOgjSzDhRY+XD5mf2qHh0= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3231020)(3002001)(6055026)(6096035)(20161123559100)(20161123565025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123561025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2355; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2355; X-Forefront-PRVS: 046985391D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2355; 23:yT9Q3Wv0131GEwEAiFhOGvwFs6WHkDrcx/1N2tBKl?= =?us-ascii?Q?4qzANvEub/9OcIZjdFwVzRkB6O5llvYOlaslWY6OmOH1ADj61xKfpdvzY3kq?= =?us-ascii?Q?VcGaTmFfLLJq1l/y+nZ34wgRDNxWqH3CZ4nsOeNqId38WOEI9CsjxgPWKPfq?= =?us-ascii?Q?m8GKnJmXSCutSyXkETm/FiJHi5yh4KK7BnzrNaWEZajsdMmkZtHec8tIKv0B?= =?us-ascii?Q?mskGmTltFnkA967NWLluIjhcw2/asHq8FlX9IcFyPcaaXPO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9WRbTrA79wIp2uMuUAFMoW2PqLX8RQyl4I514Brvxb4oTqYj44Nfr?= =?us-ascii?Q?6lGVjuoAOZXbFJm6R+I6GCEcP8NBbBnEPG0uYqrYrYTeXPjq3hDFOKfRg=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 6:+Mr6hTT+niWNx3lzBw7k+bSLnJyyEmpELz1LRDhO4AKkGkujjxIbN39L+/Q7qidg+EKaEEMi06te3IxSVzItUdHUgNycRZaZaedc+cujaeaiY8h1SbXooPMVokGTDldlIwWZYIGAFdMElm+c8AfDl/cRYxrgf7JOMyFjftVUXq4yCUrF1QTssby/5TWrovwOGZSFiI/MaD9KRDRNxRZqNPPYiDdrc+8sKaUA6wHmZ439fY58RguHZbdHz4HuusSmWj4CECN/MiPku63VjYI9zmrjrQdF5YVKIQG7FOzmKekNfUY6DKDnCRyUpMl4k8o9bMyqNSiWyRclAc0NMUQV3g==; 5:dwh4iI4s7SuzsFFKb1tg3nSp66jTCe7zWbGMn/3A+g522grZydof/6TojzwZ3Y8riqEh/mdje9oEU4xYIleGNshPirbW0RJbooIM/ozgr76vSYGdcmtAQDKQUbI56YaDV6Cj9m1oCcfWJ23iiqbn0w==; 24:7jXQhoWzXEg1DZsIXq1ipGSvEr12qk7MhZmTuJic2gZxZ8o2G2M3BKONPfwdE8kuH7pOS4rM+yM4P7GReKwwHS0hQy5tZXTHyKZ4CEWwjmY=; 7:byXSAPoKJAueEGPMFp0t0FEBkfaDVRHsqDavkKIL6RCNKcJZij1av41RbicrCSI5jEDrlrRKRwcUVUWRFDlPfIujd3SDV1HO+o60+o5fZAexCMelT+EKsyd6lUCXT3GSvQVW0fThNOiuun3KXINHfcDBo1VlYZJyHj1aiXKzf6+KVVlkn3btgeM/PYAV+9z7rX5aV5vNQgZyVu5mPLZoQVe5G0k74op6EKcwkbOYA28= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2017 06:21:57.0123 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fee4c133-1f0c-4d00-2335-08d519de5cbb 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: BN3PR03MB2355 Subject: [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter 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: Mon, 23 Oct 2017 06:21:59 -0000 Signed-off-by: Nipun Gupta Acked-by: Hemant Agrawal --- Changes in v3: Check the queue schedule type before configuring MC (Hemant) drivers/net/dpaa2/dpaa2_ethdev.c | 62 +++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 15 +++++++ drivers/net/dpaa2/dpaa2_rxtx.c | 20 ++++++++++ drivers/net/dpaa2/rte_pmd_dpaa2_version.map | 7 ++++ 4 files changed, 104 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 1ac607c..14d79b9 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1634,6 +1634,68 @@ int dpaa2_dev_stats_get(struct rte_eth_dev *dev, return 0; } +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev, + int eth_rx_queue_id, + uint16_t dpcon_id, + const struct rte_event_eth_rx_adapter_queue_conf *queue_conf) +{ + struct dpaa2_dev_priv *eth_priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw; + struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id]; + uint8_t flow_id = dpaa2_ethq->flow_id; + struct dpni_queue cfg; + uint8_t options; + int ret; + + if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL) + dpaa2_ethq->cb = dpaa2_dev_process_parallel_event; + else + return -EINVAL; + + memset(&cfg, 0, sizeof(struct dpni_queue)); + options = DPNI_QUEUE_OPT_DEST; + cfg.destination.type = DPNI_DEST_DPCON; + cfg.destination.id = dpcon_id; + cfg.destination.priority = queue_conf->ev.priority; + + options |= DPNI_QUEUE_OPT_USER_CTX; + cfg.user_context = (uint64_t)(dpaa2_ethq); + + ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX, + dpaa2_ethq->tc_index, flow_id, options, &cfg); + if (ret) { + RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret); + return ret; + } + + memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event)); + + return 0; +} + +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev, + int eth_rx_queue_id) +{ + struct dpaa2_dev_priv *eth_priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw; + struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id]; + uint8_t flow_id = dpaa2_ethq->flow_id; + struct dpni_queue cfg; + uint8_t options; + int ret; + + memset(&cfg, 0, sizeof(struct dpni_queue)); + options = DPNI_QUEUE_OPT_DEST; + cfg.destination.type = DPNI_DEST_NONE; + + ret = dpni_set_queue(dpni, CMD_PRI_LOW, eth_priv->token, DPNI_QUEUE_RX, + dpaa2_ethq->tc_index, flow_id, options, &cfg); + if (ret) + RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret); + + return ret; +} + static struct eth_dev_ops dpaa2_ethdev_ops = { .dev_configure = dpaa2_eth_dev_configure, .dev_start = dpaa2_dev_start, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 7b14ae0..b8e94aa 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -34,6 +34,8 @@ #ifndef _DPAA2_ETHDEV_H #define _DPAA2_ETHDEV_H +#include + #include #include @@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev, int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist); +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev, + int eth_rx_queue_id, + uint16_t dpcon_id, + const struct rte_event_eth_rx_adapter_queue_conf *queue_conf); + +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev, + int eth_rx_queue_id); + uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); +void dpaa2_dev_process_parallel_event(struct qbman_swp *swp, + const struct qbman_fd *fd, + const struct qbman_result *dq, + struct dpaa2_queue *rxq, + struct rte_event *ev); uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); #endif /* _DPAA2_ETHDEV_H */ diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 7cfa73a..a317f7f 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -514,6 +514,26 @@ static inline int __attribute__((hot)) return num_rx; } +void __attribute__((hot)) +dpaa2_dev_process_parallel_event(struct qbman_swp *swp, + const struct qbman_fd *fd, + const struct qbman_result *dq, + struct dpaa2_queue *rxq, + struct rte_event *ev) +{ + ev->mbuf = eth_fd_to_mbuf(fd); + + ev->flow_id = rxq->ev.flow_id; + ev->sub_event_type = rxq->ev.sub_event_type; + ev->event_type = RTE_EVENT_TYPE_ETHDEV; + ev->op = RTE_EVENT_OP_NEW; + ev->sched_type = rxq->ev.sched_type; + ev->queue_id = rxq->ev.queue_id; + ev->priority = rxq->ev.priority; + + qbman_swp_dqrr_consume(swp, dq); +} + /* * Callback to handle sending packets through WRIOP based interface */ diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map index 8591cc0..b741bc0 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map @@ -2,3 +2,10 @@ DPDK_17.05 { local: *; }; + +DPDK_17.11 { + global: + + dpaa2_eth_eventq_attach; + dpaa2_eth_eventq_detach; +}; -- 1.9.1