From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0073.outbound.protection.outlook.com [104.47.36.73]) by dpdk.org (Postfix) with ESMTP id 4FF981B270 for ; Tue, 10 Oct 2017 13:36:31 +0200 (CEST) Received: from BN6PR03CA0012.namprd03.prod.outlook.com (10.168.230.150) by CO2PR03MB2359.namprd03.prod.outlook.com (10.166.93.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 10 Oct 2017 11:36:29 +0000 Received: from BN1BFFO11FD032.protection.gbl (2a01:111:f400:7c10::1:192) by BN6PR03CA0012.outlook.office365.com (2603:10b6:404:23::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend Transport; Tue, 10 Oct 2017 11:36:29 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD032.mail.protection.outlook.com (10.58.144.95) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Tue, 10 Oct 2017 11:36:29 +0000 Received: from b27504-OptiPlex-790.ap.freescale.net (b27504-OptiPlex-790.ap.freescale.net [10.232.132.60]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id v9ABaJOf014848; Tue, 10 Oct 2017 04:36:25 -0700 From: Nipun Gupta To: CC: , , , Nipun Gupta Date: Tue, 10 Oct 2017 23:21:25 +0530 Message-ID: <1507657887-11366-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507657887-11366-1-git-send-email-nipun.gupta@nxp.com> References: <1507657887-11366-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131521089896647997; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(346002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(51234002)(6916009)(498600001)(4326008)(16586007)(76176999)(50986999)(189998001)(5660300001)(5890100001)(54906003)(50226002)(33646002)(106466001)(105606002)(2351001)(97736004)(68736007)(48376002)(50466002)(8936002)(5003940100001)(104016004)(305945005)(8676002)(36756003)(81166006)(81156014)(69596002)(356003)(77096006)(2950100002)(85426001)(2906002)(316002)(8656003)(53936002)(47776003)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2359; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD032; 1:SoYBC7QsysErqQtSJRsznPnjwx8/rtxHnCv5hz01f3n4rAbXNqXbhilOo5m8VEBtMgjqXAz5tcMm62ZC84GIKhNsZk4JOKNcyWSV9EOh6J39T3rhMZPjm9SG4OmCpyx0 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67d622bb-23bb-4728-abdc-08d50fd32637 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CO2PR03MB2359; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2359; 3:1Jc2DUDuaKEKH84mZIKXLUngyGDwfy+P/ZwpCeIc8hZcwy+hQ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ED+kCI8fUAkVlFszrQdhEmJfsjdptB5Q0UsEAGndRDgxEM6nyk8fMzZ6dm94S43yBcGKh/0i12acI9i04OENmR9Fogd13kAkXj1JXCqhY+FWoODVzQTkcw3hrFuYnvWvzBq9Yip90dVOpVkNK3o6w2JPWTt/XxjOzQUgssemkFOriapGMCkZQdV8Y= 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)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123556025)(20161123565025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(20161123561025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2359; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2359; X-Forefront-PRVS: 04569283F9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2359; 23:TNEM6QjlxzJrfPBj2o5NT9E95dovvI+/Zt0r7p420?= =?us-ascii?Q?0PG97STnQq0Mjaauw6YOSdxRQKdMEBgX/xLTzYKu6GWzSATlbi1dzStvq8OC?= =?us-ascii?Q?EnvjtzpcDdAmujkEDSMB+99GJtlAlOo2aSU3bl7EAqeLizknsJXtd6NWVDe0?= =?us-ascii?Q?kbSpcLjNJf/FjrFzweSg9FE+MODuF578v4DWIUtWfGHprH7v5KjGYCDpzkaL?= =?us-ascii?Q?b7QIrr7lCSR8xoYVNowsXyqpWY9cClY8kwOaY+6IGO6enVgLYbBYPwADoz3+?= =?us-ascii?Q?BEm3s+sUE2bYhtUjZRMmYNlr10fJ55NbB7kZlKULgCRs+vN5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jRxb4stpFdydInx25ZpQEf0Pz10Kw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2359; 6:8qCMK1CPPUQRC0xpx25IQeMnYUqYVoRrlopdwrdHrsAO/rUUXc2dHpexM7Zi4GsbuXVeYBt7dD8nJDWppfo5O5lSnP+eATMMPitzEHqNcV1dA4f2Op3W+cuKjiqy5n8h9NogUiNmsUUu+XR1q+yLKxLqcZ+KU+t7HS0j+p2rPlpnH9ldvBHzNS2VNwLuu6nYoXiXQC5ZSjsBwovHjbjsR+NmsJmtYKKzQlELA318xhYKsfF1/n5BlzMopUwtnCZ1KCNhHjL8/b2ySP8xt/oZKDorQRNllncScpb/1JXREJq14oMgVasYvAvUOCaOMzmhO413ZL3+ZWI3qme3BhP5yg==; 5:rRCBxcpCbppf4C/JtyEVvwBx8l+pPGO6l9SbEHLwrcAHv0fe8pdFpQs6K0/8mNH+7w+InHgx2qNPxp2oK/qdIsur60i67/m1Y+6bTEy6OXqQUQIUpjcSvRZOV9uD3FN99c3tvjjxbtm94U2GnR25Mg==; 24:V8vu0JU2Lm1ZesgHi02ojQG0lmH10Bob+oWC+XNZxIz/4LsBisMO5vVL0pETvv64We97DqYqTgfEQnxX/xBnRR9MIj/EKp1ln+WxYWFkFIo=; 7:6qB4BZ/YduTDs2RAUZnvYc8MiHgclCfMffY8K5h1G/07ZApK+DgUEqPjFsqNoaTTD9y0mzHB0iGNxsHzFIrI8ZkC/H0KQPaxdtTqq3O1IoNfx1KyKEA/GVNh0ev1JhAwI1y1BVvlnVDRK+5BJQtAWa6sQ6Naxytz1dao6yrtS3VYKE8mkgvLi0d0bwQiFocy24/b3hQ3ARQ9ESXNS8s6FCG+2+gWwADoQSfaF8mXakY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2017 11:36:29.4307 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR03MB2359 Subject: [dpdk-dev] [PATCH 2/4] 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: Tue, 10 Oct 2017 11:36:32 -0000 Signed-off-by: Nipun Gupta --- drivers/net/dpaa2/dpaa2_ethdev.c | 67 +++++++++++++++++++++++++++++ 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, 109 insertions(+) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 429b3a0..73b139d 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1299,6 +1299,73 @@ void dpaa2_dev_stats_reset(struct rte_eth_dev *dev) return ret; } +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; + + 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; + } + + if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL) + dpaa2_ethq->cb = dpaa2_dev_process_parallel_event; + else + return -1; + + 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; + } + + return 0; +} + 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 a2902da..03258fd 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 @@ -99,8 +101,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 3c057a3..bcdc1c3 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -517,6 +517,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