From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0076.outbound.protection.outlook.com [104.47.37.76]) by dpdk.org (Postfix) with ESMTP id BDD45FA6E for ; Mon, 19 Dec 2016 16:21:36 +0100 (CET) Received: from CY1PR03CA0006.namprd03.prod.outlook.com (10.174.128.16) by DM2PR0301MB0751.namprd03.prod.outlook.com (10.160.97.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Mon, 19 Dec 2016 15:21:35 +0000 Received: from BL2FFO11OLC009.protection.gbl (2a01:111:f400:7c09::179) by CY1PR03CA0006.outlook.office365.com (2603:10b6:600::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Mon, 19 Dec 2016 15:21:34 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; 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 BL2FFO11OLC009.mail.protection.outlook.com (10.173.160.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 19 Dec 2016 15:21:34 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBJFKMhh029110; Mon, 19 Dec 2016 08:21:30 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Tue, 20 Dec 2016 02:23:57 +0530 Message-ID: <1482180853-18823-19-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1482180853-18823-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131266344947353442; (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)(7916002)(39400400002)(39850400002)(39840400002)(39410400002)(39860400002)(39380400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(77096006)(575784001)(86362001)(92566002)(38730400001)(110136003)(47776003)(50226002)(8936002)(68736007)(81156014)(81166006)(8676002)(5660300001)(85426001)(189998001)(6916009)(2950100002)(6666003)(97736004)(5003940100001)(48376002)(76176999)(50986999)(33646002)(36756003)(626004)(50466002)(69596002)(305945005)(8666005)(356003)(104016004)(106466001)(105606002)(2906002)(2351001)(4326007)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0751; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC009; 1:vvPBgknE0vTIoMXDgTEQHrDjnEI5CR7LSLOpEpNP0ppyGHQeItqAMsAlnyl2lzqGTGSguff0Ke4KzMFVzxQr2yHIAmrq/6hvngaJQehx/6IV8FBOsjeCqT+3Zyergml4spD3aAKQRKfj+agznpuyZYTBtfS1PAOytXl+GdU42XYDFL67A+17rkobJ5cuAtC0npMDJwYNBRsNFuqd3of729DoyKOIIz7OFJ4zOmAbgcCaeoFNj5pae+58fB3IBysxndtj6fvQRyUi14YCgoiNC6wMeYoEvXqff2LDly0j+Dr9Zej2tlln54hQFKE7FTif7xBqYWaUSB1JTB/9RmLHSteKshcmbBRxYv88Y+Zx6KG2Q39zulmzy6x2nZlNhgi5ZxoWuQ/lamMkkXwd4eGyVSLF50CsmAYOJ7IVt4hdINYH2H06ZXMEweEigBpMJnjHBXUQmBCfH+/s86GYjIVjw/iXts3kWoA36DzJUPz1+TUAx7vAQ3OoV+D9Q7FGJbHc5Bq5PNs27ZE1s9HtzAq7oMcwomrSSm0Vjj6z+NWBEi7M3vYHPdeNEwbzYroF6KpH+NCKh9fb57oDPUm/p+XBtRSPOvaSLCopiqTav1pWf3JAocs1Vl9cTW2h5dZnjHCZxgsbN13yP/2UKxmHjOSLP2P1qU9PHkksUojQMNSHzcu1TktNmpGupmR7LsDNkQF0rfY+jPZYbRqqoEOE+N4cP/D9/Ehl+TbQrdUrngE4RNtJ0cyY9H2tIv6hGmOsW+QSfvN+RyCBaPfL93XkYjaAbg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0b226d7b-6b73-4c9c-a611-08d42822b801 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM2PR0301MB0751; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0751; 3:Fb2RmWgTJNnP0lgBci4SgNsVTZqzpbu0y1riN7tTDDeuCfGdH8+nepFrFWzDAmYZKGzH5lPch81XMsudGfjCvDKclaq3/sSVHAwJS4H0gx+1yMD7hnAXB0zpU7kbIxTflVw6d4ib3GFqGqjk4BJzekwIyDFMxpYMgKVv/8AkFzmvBd/WgV5LzDnSXD8blMRIEcGgeZc1UhPjmT+SGEJyXXYl4oQan9cH1qR2FIbyS/nk2uwBl09tjPkTKATjuos8xRXkVpO8Q/g6jlr1FNU74TE5jm0ZFYCR4GOhl9Cpdn0LtUbUuHLC1kGgpk3PiCl8GahyZN8OpJ9tfEsQ35SXMXQoBdNZktgr4anH2ZHuv3+G8kPpurvteYIqgu+EsdDU X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0751; 25:NpKQ9TQq+k7L0aSTVBv2TZ/uBhuW7N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C9g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13017025)(13015025)(13018025)(13024025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123559025)(20161123565025)(20161123556025); SRVR:DM2PR0301MB0751; BCL:0; PCL:0; RULEID:(400006); SRVR:DM2PR0301MB0751; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0751; 4:J/ZS6rnc70qzRWpcb6HLRHkI5RWsFROnrmFo2Rmhhh7bxBzv/zg/klnB9mAlXmWlCrRJbUVvVr9TU3exyR4ZmDqUKlkpffrrk6x0W4Qyb6MDH4rGu5+NUCRmwRhGCyFcBXdMh6vw8NRP2Fl0Ib6MpnCanlmswRp3w+omVnms1EaVnzi3jj30QK6QvbwhDKCfnRHbGtBkTdkeTrQPxhfXSgYLv1fNAvtf5FquLrjPMIUw2/b2RX4i8Ry/LlMiFMMu/Hz0nY9s274T7/osFrR+4gOo8cjtHTeA1QFsKXqMKy5MvfPWqnrfR5yw39O9vwgtkfnlPRbWVuVEbObQiLJT11bALB9Rrs+gTBw+FZErporXo7n908ebsmhPkGNg6dbob6m3gYSqITULKVNbYBon1xKCNCBttnM9pKAFfO5o7I1c8SymLJcJbNiR4ZCFrT7TsUKkNPALdxAvzJ+mmfD1Oe0PyTrXYONZqqVrEUCzM8TnqeoWH6Je1cf9e9T0H+mBwbJjV6ZViaLiAkMcRbrBkmtd6mWKgX2tRbOdogsT6GEtn7heCNJ+UqlZRn/RAUCn6pXUQmx1ihm6fZd2oHO/vYWLX0LjtfDN/g7M44F2CZCRez+xzrVzK7Up4kkTdWMmMTNHEBijqe8N1a9XXzmSkNryV0Ry0PRA/PbFinFFOL2fLUsskNi1PYjiZSDnTLU0jjn1gAVLGstp4ZqTLoAvqxShbsFAUDOdWIj2XfhKg1v+y6gi7N0SndeNWEmoHC1e X-Forefront-PRVS: 01613DFDC8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0751; 23:VyVgVrYMy8FmlZC3KkD7IObu2aat97LDLQd9/xa?= =?us-ascii?Q?LxTQUj/eZU2SFaI1fvLMfLeerJ80St2tvcmaUwmo6x38tchcxDFK8//xG26v?= =?us-ascii?Q?Vva3GOG6j5ESkRL6tqRAJPwN7dhlckeTDg+1uojzH5dzQPQerkorijsBuVb0?= =?us-ascii?Q?HPEya4zjjOH38pVDw95er6YVDyBKGWYbujc0+/zDVXMfPioOg3/v83GL+uRb?= =?us-ascii?Q?28ngOImfQ0tERiUaENxw3YPQWosah8oIcoLUS50ATvfhiR7ru3ZNfqjlRK/z?= =?us-ascii?Q?5XoETpGl7IesPOUwdjmoZIj52MmgLG85jzY2uBxd9OCQblmYfCldlIRDrAfM?= =?us-ascii?Q?XyRIUCGa4b/wLYBkk1U+avQexJXXXW+ZhkmqbkoohZFr5da1T13Xdlawdimz?= =?us-ascii?Q?ZsRuJOZ1m7gZ+3yKJP8Sg3C1dAh/a1QAjsSOLVCaUs4+2yrNDP8DyYDGfN8Q?= =?us-ascii?Q?r5B4Ktt7qNvryONCZlHRnnyRXnt9F1DsC4tlhneChUhwJ8t64Y/K9DZx/N4+?= =?us-ascii?Q?wozOCKEup4FkBoFFqISTC+eJq4yofnHh6gKSF13tk4pOrs8bP2RsdU0iIANd?= =?us-ascii?Q?5f8dyKNyu59JdHPolNYsaQQDBkOb2tusYsBZQMP6tPB5cUPfbiU8Hwwox6n6?= =?us-ascii?Q?ci8wA2qhtflKFByjtepaKXq0Ly6F7XdgQLriMuz6U0mDPnS3WQDI97cyHe/N?= =?us-ascii?Q?BgUfZHxsxm1wqfSC9rJW21NiJQXPDEx3NiOunyInn/lbdQ3RQXOiTwM9AVPw?= =?us-ascii?Q?RYt4S5fK5CmJQneIfSMWfDdwBO5mabcw5IA/sfFdbbivgI5aPKoF0h2loSIu?= =?us-ascii?Q?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HoMojTwAb9gna+j5aKDgZT3ljZ2qWxT6XaIOOtAl92lUw+jn7PkMp64/snWliD; 5:3WB+pwuWemlEkWWLQsejkcnEfBHDfiMYkaAaPnt9ceN4VNWhTsx793a9c4me0vgdgdUbzllBm6FDwp0vIw0kHlx/Jj2YhmOeKF6F61ITvP9NcJp773AeVb8FKZvxm09f58pZIwG+03hOItPYIlaA1kTUSYpOWrpGJXNZOM7JuEWeeyfjAhiveCASIQf1lIMM; 24:akp26jbzScJ4qCSkTkcLiTaXFPziDJEpmsccRCb6fOl/e1/wrekWrD+9qzb5G3DFChZ28da6NC7OnSq3EBnO37LulcMdcgheLPuTUq3fDBE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0751; 7:3PEAHnvpK1jIiLP6u6/Mluug3+a5Du8T48Jc0kyeZitdWPNqHy+K5vF5tkICTfgZlkiDoTKVv6BhzesrEQO/b1f8UOa6/KCJaAGyDMNkpMsQrEerzAKOaV55fuQRfm1JrufpiXPg1g9dxNVxWfCRd7ye5sxJ5c1GaLPBDlKnrxyyW8nvBGMEvwub069gOqXY8RnkCtNY9XkyEXp4VJO8Hc9lf06E6pvAJ0gk4TzIWkYfAkjNK9U4EW/nzAWMF8MkFqzNO+sUK94DZ4lX8KI8I+eyms1cuYs3u10WRVAdB3tnzYeINDJ1Me6n1O3XVYNIiEmKM1UUbqtl/AiQqWmX0ppCq0+X89iVYmseawRNsuRKqUWSv2mxuFdOIIip8yOPRkGFOnCgrqWcGkxRITE5y8X6jW463nOMmq4p1YsAb9GkCvfjJdCujuBAYwrwld/+42HyLal0evNEVWx2PEDjPg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2016 15:21:34.5013 (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: DM2PR0301MB0751 Subject: [dpdk-dev] [PATCHv2 18/34] net/dpaa2: adding eth ops to dpaa2 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, 19 Dec 2016 15:21:37 -0000 Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/Makefile | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 121 +++++++++++++++++++++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 3 + 3 files changed, 126 insertions(+) diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile index 5a1db74..4425b76 100644 --- a/drivers/net/dpaa2/Makefile +++ b/drivers/net/dpaa2/Makefile @@ -46,7 +46,9 @@ endif CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc +CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/qbman/include +CFLAGS += -I$(RTE_SDK)/drivers/common/dpaa2/dpio CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal # versioning export map diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index a0e842c..c0ace68 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -47,20 +47,141 @@ #include #include +#include + #include "dpaa2_ethdev.h" /* Name of the DPAA2 Net PMD */ static const char *drivername = "DPAA2 PMD"; static int +dpaa2_eth_dev_configure(struct rte_eth_dev *dev) +{ + struct rte_eth_dev_data *data = dev->data; + struct rte_eth_conf *eth_conf = &data->dev_conf; + + PMD_INIT_FUNC_TRACE(); + + /* Check for correct configuration */ + if (eth_conf->rxmode.mq_mode != ETH_MQ_RX_RSS && + data->nb_rx_queues > 1) { + PMD_INIT_LOG(ERR, "Distribution is not enabled, " + "but Rx queues more than 1\n"); + return -1; + } + + return 0; +} + +static int +dpaa2_dev_start(struct rte_eth_dev *dev) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int ret; + + PMD_INIT_FUNC_TRACE(); + + ret = dpni_enable(dpni, CMD_PRI_LOW, priv->token); + if (ret) { + PMD_INIT_LOG(ERR, "Failure %d in enabling dpni %d device\n", + ret, priv->hw_id); + return ret; + } + + return 0; +} + +/** + * This routine disables all traffic on the adapter by issuing a + * global reset on the MAC. + */ +static void +dpaa2_dev_stop(struct rte_eth_dev *dev) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int ret; + + PMD_INIT_FUNC_TRACE(); + + ret = dpni_disable(dpni, CMD_PRI_LOW, priv->token); + if (ret) { + PMD_INIT_LOG(ERR, "Failure (ret %d) in disabling dpni %d dev\n", + ret, priv->hw_id); + return; + } +} + +static void +dpaa2_dev_close(struct rte_eth_dev *dev) +{ + struct dpaa2_dev_priv *priv = dev->data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + int ret; + + PMD_INIT_FUNC_TRACE(); + + /* Clean the device first */ + ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token); + if (ret) { + PMD_INIT_LOG(ERR, "Failure cleaning dpni device with" + " error code %d\n", ret); + return; + } +} + +static struct eth_dev_ops dpaa2_ethdev_ops = { + .dev_configure = dpaa2_eth_dev_configure, + .dev_start = dpaa2_dev_start, + .dev_stop = dpaa2_dev_stop, + .dev_close = dpaa2_dev_close, +}; + +static int dpaa2_dev_init(struct rte_eth_dev *eth_dev) { + struct rte_device *dev = eth_dev->device; + struct rte_dpaa2_device *dpaa2_dev; + struct fsl_mc_io *dpni_dev; + struct dpaa2_dev_priv *priv = eth_dev->data->dev_private; + int ret, hw_id; + PMD_INIT_FUNC_TRACE(); /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device); + + hw_id = dpaa2_dev->object_id; + + dpni_dev = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io)); + if (!dpni_dev) { + PMD_INIT_LOG(ERR, "malloc failed for dpni device\n"); + return -1; + } + + dpni_dev->regs = mcp_ptr_list[0]; + ret = dpni_open(dpni_dev, CMD_PRI_LOW, hw_id, &priv->token); + if (ret) { + PMD_INIT_LOG(ERR, "Failure in opening dpni@%d device with" + " error code %d\n", hw_id, ret); + return -1; + } + + /* Clean the device first */ + ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token); + if (ret) { + PMD_INIT_LOG(ERR, "Failure cleaning dpni@%d device with" + " error code %d\n", hw_id, ret); + return -1; + } + + priv->hw = dpni_dev; + priv->hw_id = hw_id; + eth_dev->dev_ops = &dpaa2_ethdev_ops; eth_dev->data->drv_name = drivername; return 0; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 5778780..840b688 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -34,6 +34,9 @@ #ifndef _DPAA2_ETHDEV_H #define _DPAA2_ETHDEV_H +#include +#include + struct dpaa2_dev_priv { void *hw; int32_t hw_id; -- 1.9.1