From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0085.outbound.protection.outlook.com [104.47.41.85]) by dpdk.org (Postfix) with ESMTP id 050611B265 for ; Thu, 12 Oct 2017 13:03:39 +0200 (CEST) Received: from CY4PR03CA0076.namprd03.prod.outlook.com (2603:10b6:910:4d::17) by SN2PR03MB2365.namprd03.prod.outlook.com (2603:10b6:804:e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 12 Oct 2017 11:03:38 +0000 Received: from BY2FFO11FD023.protection.gbl (2a01:111:f400:7c0c::139) by CY4PR03CA0076.outlook.office365.com (2603:10b6:910:4d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.77.21 via Frontend Transport; Thu, 12 Oct 2017 11:03:38 +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 BY2FFO11FD023.mail.protection.outlook.com (10.1.15.212) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Thu, 12 Oct 2017 11:03:37 +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 v9CB3Uki001793; Thu, 12 Oct 2017 04:03:35 -0700 From: Nipun Gupta To: CC: , , , Nipun Gupta Date: Thu, 12 Oct 2017 22:48:47 +0530 Message-ID: <1507828729-18194-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1507828729-18194-1-git-send-email-nipun.gupta@nxp.com> References: <1507657887-11366-1-git-send-email-nipun.gupta@nxp.com> <1507828729-18194-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131522798180947172; (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)(346002)(39380400002)(376002)(2980300002)(1109001)(1110001)(339900001)(199003)(51234002)(189002)(498600001)(8656003)(76176999)(50986999)(305945005)(36756003)(356003)(53936002)(50226002)(68736007)(81156014)(81166006)(4326008)(8676002)(5660300001)(48376002)(8936002)(77096006)(6916009)(16586007)(105606002)(2950100002)(5890100001)(86362001)(33646002)(85426001)(104016004)(50466002)(6666003)(54906003)(189998001)(97736004)(106466001)(47776003)(2351001)(316002)(2906002)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2365; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD023; 1:MwQFGRNXMsl+iYZjtSTLaBGqPTVo3isSuRjYXNRO6tIUNVRHHX0qLVMtN2UBn3wTaqfA7YouPqog0ePzHtkVMW9Ud6/ceU5zYIWko+oePAWU+Ve7ijuMjIfJC1+ffG17 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc7c0aa3-738c-4d20-7383-08d51160e3e5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:SN2PR03MB2365; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2365; 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bjuh+wxkYeD9pLYxdPr6mzaXq3AZVmMUa2SA+kDUbZMuDHQPR18xJM8UdomUHo9Fe9x7BHdvBV1/7P+Avf4WkQWfFbxsavDrymiukFrK3u0PdQVcpDZlQW6n33SApTdj8Bvn/l0BT8MDyMe0PTqrI/Ayra7hGXWwOIt4vlGB5QPzVw1AEr1jPT/JLq7uvnuii1WsgaEoPuNV48q87/WH2MZC3H+epdQVRpFYJU+NzPDop5hCEh8YZq2eFMQfJRNrAEZg= 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)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123565025)(20161123561025)(20161123556025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN2PR03MB2365; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN2PR03MB2365; X-Forefront-PRVS: 04583CED1A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2365; 23:NtvcCIrp6s1F/erypLbTCoCV0fM6lSEP2XwIzSZBm?= =?us-ascii?Q?QEk+M2KbAZdoKuv9PJ8aU7jG3B5o8cm3NHyNtDHLj4fyx+5n9ci5W1grcj1K?= =?us-ascii?Q?WYX5GYFhpx/x8wcWWb0oA4PJfa934te5x9y91+gwLfcaLVvfAy4H9JOmadG+?= =?us-ascii?Q?YU8XwM8F5sJ5ivNZ9I9VK6UPLdMKnmD+ozSTq6/BQx5u+OAromY5xF9DXTQ8?= =?us-ascii?Q?mJzYUb6QNPfM2Op7ZalYIJsR4LR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kWF6uMeBnv5lqcel6CnCUn8OuX4xPjYlctY0MWExAbqOyy8Y9?= =?us-ascii?Q?qu8FPkmr3kbmfPvkjgqC/Uj+DgQW65JrVp4?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2365; 6:0Tt7q+NaDDfc0yDU0l4LfYE2QVY+eJNy1j/Xz6v4HvAifktAoNkzXTyiXm+mVE1QcJQSEJ+rZO8lzl2QOr2Zvbvxwk8vKpQLec+ocDp5ibAzQ3U3rg+hw5otPy9yGpaAaSDmtbusLp/gjea/Yzoq3SB4fM8V2VxTD7OYOQN08uSpu0p+3FUxeAWyK4QfJV/fR743Wlg9cMdx02M5+VT3cal4kMvFO4JQY8BWqSefiXlBwEvRIgrMh6gfjGQMPmdBS/9HfQLb/R0abLO+TWY3gT4k8TRZ3q6rIoyjMsz2hDdeyIkxUkcT0c8yiPUmljEhCYutThxvz3OMdCSVqrgqww==; 5:ZpKfqd7ENF/NzfU0NhE2o0isLTR5S+N5dGpJGdt2CAwFEOd12L7Y+suKjHHCSWazlEICnqfctnz0LfvGkHDJdI1nE9UKibRuY0G0x95putXmOGbagse2/CoA+KFK8LxB7dJlF/KwFJEvcqTqjaLbNA==; 24:mV2acKCbt3n1tlsUAVQpRp3/OLROMxwZkeyclBGV0NB2ZMFDZR6/n4IUQ3LtxYfjLrb8TMZII4RNeLXfONhKWedbtN/oya6mdIx3KMyttCw=; 7:eGUzMQabDiAP/2+XUVhrFWrUdNq6A9v/X9LWRdFs36EHLQR5PX2o9QFJWIi+F1MMJhmIm5f1fndgqRZLI51rpwgu3kieemBnAhpguclUQttE4JkLY2Cv15zrdzDUpyAj0uF8kr4ZTUkWak4BaNTOJ0v/3KLbK325I6Gt4yoFeQd8mKDdgOT9knQqb+n21WL1M/7+uiX8nODIqyanYzW4dA7Vp2hfUKqYN+DW3ZO9NvI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2017 11:03:37.8919 (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: SN2PR03MB2365 Subject: [dpdk-dev] [PATCH v2 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: Thu, 12 Oct 2017 11:03:40 -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 39c32b3..724719a 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1634,6 +1634,73 @@ void 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; + + 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 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