From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0078.outbound.protection.outlook.com [104.47.40.78]) by dpdk.org (Postfix) with ESMTP id 2AE951B768 for ; Mon, 16 Oct 2017 17:29:28 +0200 (CEST) Received: from BN6PR03CA0073.namprd03.prod.outlook.com (10.164.122.139) by MWHPR03MB2704.namprd03.prod.outlook.com (10.168.207.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Mon, 16 Oct 2017 15:29:27 +0000 Received: from BL2FFO11FD015.protection.gbl (2a01:111:f400:7c09::110) by BN6PR03CA0073.outlook.office365.com (2603:10b6:405:6f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.77.7 via Frontend Transport; Mon, 16 Oct 2017 15:29:27 +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 BL2FFO11FD015.mail.protection.outlook.com (10.173.160.223) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Mon, 16 Oct 2017 15:29:26 +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 v9GFTHP8021125; Mon, 16 Oct 2017 08:29:23 -0700 From: Nipun Gupta To: CC: , , , Nipun Gupta Date: Tue, 17 Oct 2017 03:14:33 +0530 Message-ID: <1508190275-32305-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508190275-32305-1-git-send-email-nipun.gupta@nxp.com> References: <1507657887-11366-1-git-send-email-nipun.gupta@nxp.com> <1508190275-32305-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131526413671718308; (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)(39860400002)(346002)(39380400002)(376002)(2980300002)(1109001)(1110001)(339900001)(51234002)(199003)(189002)(5003940100001)(53936002)(68736007)(305945005)(105606002)(81156014)(189998001)(2950100002)(81166006)(316002)(106466001)(86362001)(97736004)(33646002)(8656003)(8676002)(356003)(8936002)(6916009)(50226002)(5660300001)(69596002)(6666003)(2351001)(5890100001)(50986999)(36756003)(76176999)(498600001)(77096006)(104016004)(47776003)(85426001)(4326008)(50466002)(2906002)(48376002)(16586007)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2704; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD015; 1:ypIpI/kcHJE1sVTgtaGbUpQjqiHJXI3xoHMqyJQ6REcW/f9LggpeA8OdHyZqUn2k68mfXOWUGVntDYlzCD1pnsQGcCaa32HrKsOtdKcQCarv88OHLysfrPxFkPdkTRnL MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 877829e4-018a-4972-d29c-08d514aaafdf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:MWHPR03MB2704; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 3:TMypUlPX3Dv73jWyC79bkHUntByWP+rHzCSgtHbCx9x1qHV5qWIaHR7lGgAu0FJgvAz7AyrwJylEYiQ4iE7WWryEABw6b5jozx/3bV6itBWV8AP9irtEV5QHTTQwB3AEtMlZJHw6MQOvOMbJDMvSMrjv6gnYp6CHl7aJORKBLKgHwPu3sgpHVCejXYzAe+Wv+P3NPCOi4HQush6Jbg4mhaGf7vBWPtFzjqE/IiTDQXF1GLjYTsiFkXAbvZe+vTaqR786Up1d8skspt9IDMnEt56YSB5Ly29J6LoVEyELkcFojnduUOPks7aeW2l8c84jOEU11rlEKgLhmogATrUMxIPaSMUW8feC9pct0ZVDZOs=; 25:az/YmKOl0apy/kjpckJBmxoaXhcznz3R738r4fqXCsdLedRx40SV7cp/ZlpLsa1BpzGZoP92JuMhN+ricrYovLeyh2eNIbEAB52BF/70yC1lHfmIaKl1g0KtBUm53GgLk4l0qvd/OgSyvbVUERK6cvHbDzVYtBQHE2yLblfVwbtcplYqskOPMSeRfRnu3tduPpohHK3WCl3TC7ogOLnoyZUeRTG2TohU38RsGih1G+7lD7VYKaoPJFPsbWpVuYNQaYm5Lp56RLAZ9D75TzhVZ+qIHXYCFkv6qEveAduG51crsiLdLPRwNxmft4QId3hAMJ6jrlkHYKFIAOQDOSpOzA== X-MS-TrafficTypeDiagnostic: MWHPR03MB2704: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 31:nyPeNjYa/j/9vK7cTUOa7D1FuH7a/7coOBs1zwHz0y8lzFxY2Ye9KyPHANzuMS4mLSL0X8cglQ67oNNSeVkF532roov6ykqRq5do1/De09cj5l7ksAOjec23rTErjzqg+JHrUWZ2r4uOhEKo2SnJQMIhIr0rEDeravBQj8PgGDMkou5rUCMWJyoza8+ANKijDMCxgll/Qy3wZDBqLxY8PumxYawJpGLu527V0Alf70k=; 4:2lst7bx+m0uA9+fhVkpW/Ei4e07INa/M+yt53o2MUN6rHtdQHLUUNZ/AYb99ryyvd0lMt5OkN/ZBI51C/U/LEenLX+7l3vzKQfDJZusQNyo02ZAZautrQoHWulpUumeAbJiSA50B5+nzkyfjESw+oE8jNn8j/ZiRn3gzEhf1D+SvtzBTpYSR7ZqS2yPhIcpKgCh1I9SljVhNKMfpT/v8DPKsflkaf4p3G3+ITFbCAhG5psRHauPLXfUEtXxWoAnmvWRMqvCaSL9qCvadhYezhDeyOzEZhPNMMBPj4gWOnXo= 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)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6055026)(6096035)(20161123565025)(20161123561025)(20161123563025)(20161123556025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB2704; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB2704; X-Forefront-PRVS: 0462918D61 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2704; 23:qv9LvZsOw444nLN3sTSa/Je1H4g1Qr/YTQa9Mwvs+?= =?us-ascii?Q?Mf04dw/w0CNVPPL23tktRCQ2rMkQoFr0XzMW7cWkfkQpvyi8JBk25VC2qg97?= =?us-ascii?Q?mbGAf7dLoJbEPW8T0HC7pPrzkJbM4falI2tTuBH1n9mhcZ9w67RcYFmXM7G+?= =?us-ascii?Q?ubQ6UthqST1aKJ+lsRBQQNGPpJ3R4nUqlRk6l5gKxC+dLnf18RMMdjFVUCAM?= =?us-ascii?Q?57jalmq0yVc/uAZlS6H+TDSAohmaK3nx2TG7jQLpar2WkFI9XmHfJfHYikA/?= =?us-ascii?Q?3PdjbcNgwMwPGVBTXsVvYZw7cf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FRkf4iy5grYsmkafoUVgVHtCvGspOeXon5+BF9UDHwJrX/j2swQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 6:mmlVpQBS7e8esJYGZ1gp/ns209vl08tifYZEcEGHYuF8D7BJYy5kCRwLYcFV5mgbT1x4gLfswJnTj4nsNaL0KdJUZeSIhEp8EzlM4zf4GTr0eqkCttUnrTgsi7YrxuyH5EHFlo21pBFDx5M2PUUfbHZ7kwskLlVTICLkFZFSXBMJvNNwvkrdT5EnU1+gCwyTag7tT3lG3OeLb/S941bwkJ1qDdB053X0fvtNlXvG/kPQREF38SvvIQn2t5yEQdQqJNWYhhn7RlOMvVcCd907P9AIV5Cf3AbOUDKG2Vun6A+3Ej/4Wzm4bnGKTDTEQPArxIL/PbbzW69NB524H+OVzw==; 5:63ORQk6Jnc3vDAdx0AVmfji7SIRPQa1XfVPkkTjAX/MK5kiDGqjKFp1U1Wi8Hp/BNX13otZrYzo7eDVGc4zxITCHoPrnn4OkJLICJRn4BD2Ley6r9vp6CwqY4idKW/OWNEJf5ABSnbWcIcs69pRMoQ==; 24:UMuDpLp9UpaG9JX2ZC6Fxcd+g7y7XeMIGd0ppPepfNvr8PVxpI/jsm9rdA8N1o06SCtTz5u9MNJ1/ZN04imGKB4rnedwq6qAcqPXddad5u4=; 7:tIhGx5/AlAM2RXK6F426axtFhAaNf/zxu24h45iQ3CMVV+k1f6U8cWzdm78+6Wxcjp+3HC0+kaY9RgkyeS79C6lik9HBawJtCGvxF8r9aeDHRP7QXjnlMajJ+AfUVdpv/9gqpCQh85s/t7HYgImdky2mD5k+r7VuagwHWjBs/04HKY9e4ZiUjjlzhLnZz/GhKoK7nCRgs4nh6WBzEU6FCPmugE2OnkaE2uakT/i+QHg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2017 15:29:26.8130 (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: MWHPR03MB2704 Subject: [dpdk-dev] [PATCH v3 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: Mon, 16 Oct 2017 15:29:29 -0000 Signed-off-by: Nipun Gupta --- 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