From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0085.outbound.protection.outlook.com [104.47.34.85]) by dpdk.org (Postfix) with ESMTP id 785E738EB for ; Wed, 31 Aug 2016 13:02:17 +0200 (CEST) Received: from BLUPR0301CA0007.namprd03.prod.outlook.com (10.162.113.145) by CY1PR0301MB2010.namprd03.prod.outlook.com (10.164.2.16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Wed, 31 Aug 2016 11:02:02 +0000 Received: from BY2FFO11FD026.protection.gbl (2a01:111:f400:7c0c::132) by BLUPR0301CA0007.outlook.office365.com (2a01:111:e400:5259::17) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Wed, 31 Aug 2016 11:02:02 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) 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.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 BY2FFO11FD026.mail.protection.outlook.com (10.1.15.215) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Wed, 31 Aug 2016 11:02:02 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7VB0laf010481; Wed, 31 Aug 2016 04:02:00 -0700 From: Shreyansh Jain To: CC: Shreyansh Jain , Jan Viktorin , Hemant Agrawal Date: Wed, 31 Aug 2016 16:30:35 +0530 Message-ID: <1472641235-23626-15-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472641235-23626-1-git-send-email-shreyansh.jain@nxp.com> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1472641235-23626-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131171149231762505; (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)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(5003940100001)(77096005)(105606002)(92566002)(19580405001)(19580395003)(586003)(8676002)(97736004)(110136002)(36756003)(229853001)(48376002)(2906002)(50986999)(189998001)(50226002)(2950100001)(4326007)(7846002)(50466002)(8936002)(626004)(47776003)(76176999)(106466001)(11100500001)(5890100001)(81156014)(33646002)(2351001)(87936001)(81166006)(86362001)(5660300001)(68736007)(104016004)(8666005)(85426001)(356003)(305945005)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB2010; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD026; 1:3L+7+SCXqxllqYqnEVu2vAKC2G3Srk5Yr5QQM2o4MSVIaGPrHQVeeCwcxKLaf/j269v8E7mbFMggvJ7IXaK7AZWtr3O2QjUwy7mjlYxapIg5q00XmxZFiEcKBy+6CY5suxTuCzkPEcoCZIRByCLhZelDQN7P/eKtYfEALPxsjiBNaN9FflP+JxyrrqhWVu3JizorJ8qmmc3aETIfl0pzIiuFhuYmca0P6IJYtNeYhMLbBFJ31ruxEzlnW+ncS4cH5R9+QPiuCSfYbvrs844gf/0zxG16CyZwCeG2LZc03sF+mCUZxM+FvACBvIuDHo75fGzgrpVNwIslzbJivkMado/4h2/jnrCMm95YQmJMSE3baojBq8TGsGdMZFioLU0J5u/OrPxzx0JBJuuVnLcjsgPWivgnGdOudcIE2/2aILdCXFWHgHwkSMZrVnC+P5WYyysIb90TprdxNFUcDxPgMKEiQ7fpMBUHu/mUNk5mQMMr0heG3NgVT9/oohlaEAtMkZ7zvsOzVYkTp/FoFPjUJmBxY7DLLBdDMotKxk5XyYgIKIFH4X3HZZUnNYk4zaSs33bEWkcxqxyZqwxWSs/3kuR0kePdl2HT1lpEp0TrvIm29OipEbXFghahp54OWRGcWYHHDdxqVnVh3tioaMgy7iq4aZMhIZqU95aggYoZM5fP9IDE3mKYb+CA3dLyptJpdO7Da27toBoklDqAyGPX++8/yQ6d+JBOkS9QCHoRaPU= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a6b0efeb-b593-4406-cae9-08d3d18e3d31 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2010; 2:6ytm3ScPkvj6SNrM9yhSi+kKNUty4PnCUyaa2rPOrrSqa9U43yBQALuLJ70zAwYr6OoYGPQozXnV+y8qNxpP465Y/TqDvrO3utGnBCdQJcGRXG4NPiyaBYa/m29DpX+MeqoB71MHFtgKhXXAwtBBNQJ9Vo0HNjsf3SLkeyQz0zsm9mPpfalv31sGRx3hynB9; 3:wkypL20+mylefNUw3fPcdLc/NHtFPsx1fPX7jlzQxJyfg/p9+wPO5vo8GncUej23olvCARe9KFiAu9louVHheysNSMWfZmL0oMqaTRl01RK9BqiRv5x2o+Fu/I1HIJKd76FFHQfnq7vpAwndKsHT5bV/NeX9MU7ZJ6HkK4HxGcTUrObwk9ec9Tl0mXUQBrZ5aCJMkKXk7isWa4HBXkEb6nclCSKeblBgyoYvpevDfnA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB2010; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2010; 25:pPkVBWYBrex1khEXsMfs9rFlNpFNJ2vhguuwqI5ssdi+xe9iipNmIrD28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uxtUJaCHb8x9p6zkCTifc38rJdtPks/4T4/mWJZibOUyskWa10OdcI2GZTeHR0hNpiszk6Lmxxgn59yuMWfFOQARoxqwvr6KMIuRNkRukDoaQqMzWWdi6w56TP39TQydLBJPQ5PtQ57U7fEEZB/Z9HHk+0JaKgwMc30KyDbvhtrKml4yOg+jZmMHFuV26wfboRz/gz5E+sLQWU6384qFihfPxXmY93rDtx5rzaGsucOC8v6L86ni9KqKGcHQ66I2MKYs1LbYLqW/XaXz6nYsg7pRTSswc5fmchXhLhrRZbAfHT5bHvU2ab52JkKsbl2icfzUEQWUvtivXLEjJGzoHG6ApKt0W+/Z8c4JaM87GoaLuvKL2PziIQE7eF/UGBHlAokXMBEqj5vSWzjvn0XqKttXjPzkDoVZorbcKCyWoQXZhCdJonxFjkgM1EWP9pX7GtZ1KX72CPrSvfRk+o= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB2010; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB2010; X-Forefront-PRVS: 00514A2FE6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB2010; 23:3CMLLb4qDMc62oIBty0QX/uCz+Jobb9/Z/1LZac?= =?us-ascii?Q?jQt9d7onnEy9iZiFbkzQ99JhMDyybyhpGURNxIYOEYEvzdni/+eERSJoxk4X?= =?us-ascii?Q?Bmz3+HHmqXPqEdiNpdh2rnG+94gsUCmT6LE56i6G5fm+9mNUtnDbiRoSpdK+?= =?us-ascii?Q?aD12CYR5f3eCjmAjRdjZ+014OG1q0odR+fjy0f1uNgqeS8eoye0PfgKT0yfB?= =?us-ascii?Q?WwVfaOmyVzxr1W4+cyMzrcyaMEcjy5SgpAv77zb5slec8cLmCG2MY6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Q9qJFwhfQHiqqUzMQPyIa4wHEgKj6?= =?us-ascii?Q?Oxywp0vROJ1bEc7/vT72QYeyQxSQwTGiIqnhG?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2010; 6:lJa92JqENx7EU4NoRAi/oPSAOUFkdIaFib0/8/R3lfbJVxRPyEGx7E+Wd7zVsKrq2SSnL4zWT2vCW/h99CyoppK/avfZPr2ZARS4+9Z3NnZj/a6Scc/W9DV8sGivhfGpUeVl0JfyelYT0lOPUWd4h5XOvteN2hicpn3fBnUSUU6dqmEwQJA+95f5Hx0B/fK3hb7YM+kByOk9+Po+IrqmofupjzFbsfek+iv5GhGQ7kYJlBZTVyoO/LWemO5mvUM9XF1KgGH1dSwvP9yw/cuQ4Ic6hvS1hgmeb0TitBTxew8=; 5:K57I/zX4nhgv9jNP6JgsBwHvh+XDldlvIn2ci4syT7kU1ttuqLpBy0WEUibEnpnQbS3DA6J7Zwj+0nMDbsNYjkisDHX05gTKKx+ItQoNN+CFAI9Thadg12P9/6dF4ntTzRfMmyLcq4CkYqo8u6CM0FM6s3mZe4iIjas20WBWaxo=; 24:8n9QvwdRP3pbzSflbPH1WNWviugyWfyRHPR6Iumgt4laGwx1x33TscsdQ3lNtfeTjavJe232YYvDDPUGRFSVY3EwNOGMqPCQh60X5Q8SSss=; 7:Roa/RPApK2ccPqus0RzAL3ge2P0xZyO7szCHHFVrmLz4LY1Oe/QJ7y5dRRCCxDPvDwVH5aWbdY76DGWsWJl+3d5diz1R/d2s4Deh1MukMngWzIvcKVb+kFujGEc+7lkBNx9BjdZ3Q/uyTs6LQ7wtZ1tOdTwBBVaRp3q1LWZ/zSLN5aCPp+ttjbW/MV7tGxejsZACGYfVo3EbVPCrs1cu2er3t6+J57Q7WSzs+OWExgTZdmALR9SaNRVK+xWj5d0Y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 11:02:02.9578 (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: CY1PR0301MB2010 Subject: [dpdk-dev] [PATCH v2 14/14] ether: Support rte_soc_driver/device for etherdev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Aug 2016 11:02:18 -0000 - eth_driver/rte_eth_dev embeds rte_soc_driver/device for relating SoC PMDs to ethernet devices. - Add probe and remove functions linked to eth_dev_init/uninit Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain Signed-off-by: Hemant Agrawal --- lib/librte_ether/rte_ethdev.c | 129 ++++++++++++++++++++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 31 ++++++++++ 2 files changed, 160 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 4fa65ca..b57d7b2 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -326,6 +326,101 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) } int +rte_eth_dev_soc_probe(struct rte_soc_driver *soc_drv, + struct rte_soc_device *soc_dev) +{ + struct eth_driver *eth_drv; + struct rte_eth_dev *eth_dev; + char ethdev_name[RTE_ETH_NAME_MAX_LEN]; + + int diag; + + eth_drv = container_of(soc_drv, struct eth_driver, soc_drv); + + rte_eal_soc_device_name(&soc_dev->addr, ethdev_name, + sizeof(ethdev_name)); + + eth_dev = rte_eth_dev_allocate(ethdev_name); + if (eth_dev == NULL) + return -ENOMEM; + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + eth_dev->data->dev_private = rte_zmalloc( + "ethdev private structure", + eth_drv->dev_private_size, + RTE_CACHE_LINE_SIZE); + if (eth_dev->data->dev_private == NULL) + rte_panic("Cannot allocate memzone for private port " + "data\n"); + } + eth_dev->soc_dev = soc_dev; + eth_dev->driver = eth_drv; + eth_dev->data->rx_mbuf_alloc_failed = 0; + + /* init user callbacks */ + TAILQ_INIT(&(eth_dev->link_intr_cbs)); + + /* + * Set the default MTU. + */ + eth_dev->data->mtu = ETHER_MTU; + + /* Invoke PMD device initialization function */ + diag = (*eth_drv->eth_dev_init)(eth_dev); + if (diag == 0) + return 0; + + RTE_PMD_DEBUG_TRACE("driver %s: eth_dev_init(%s) failed\n", + soc_drv->driver.name, + soc_dev->addr.name); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_free(eth_dev->data->dev_private); + rte_eth_dev_release_port(eth_dev); + return diag; +} + +int +rte_eth_dev_soc_remove(struct rte_soc_device *soc_dev) +{ + const struct eth_driver *eth_drv; + struct rte_eth_dev *eth_dev; + char ethdev_name[RTE_ETH_NAME_MAX_LEN]; + int ret; + + if (soc_dev == NULL) + return -EINVAL; + + rte_eal_soc_device_name(&soc_dev->addr, ethdev_name, + sizeof(ethdev_name)); + + eth_dev = rte_eth_dev_allocated(ethdev_name); + if (eth_dev == NULL) + return -ENODEV; + + eth_drv = container_of(soc_dev->driver, struct eth_driver, soc_drv); + + /* Invoke PMD device uninit function */ + if (*eth_drv->eth_dev_uninit) { + ret = (*eth_drv->eth_dev_uninit)(eth_dev); + if (ret) + return ret; + } + + /* free ether device */ + rte_eth_dev_release_port(eth_dev); + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_free(eth_dev->data->dev_private); + + eth_dev->soc_dev = NULL; + eth_dev->driver = NULL; + eth_dev->data = NULL; + + return 0; +} + + +int rte_eth_dev_is_valid_port(uint8_t port_id) { if (port_id >= RTE_MAX_ETHPORTS || @@ -1555,6 +1650,7 @@ rte_eth_dev_info_get(uint8_t port_id, struct rte_eth_dev_info *dev_info) RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); (*dev->dev_ops->dev_infos_get)(dev, dev_info); dev_info->pci_dev = dev->pci_dev; + dev_info->soc_dev = dev->soc_dev; dev_info->driver_name = dev->data->drv_name; dev_info->nb_rx_queues = dev->data->nb_rx_queues; dev_info->nb_tx_queues = dev->data->nb_tx_queues; @@ -2530,8 +2626,13 @@ static inline struct rte_intr_handle *eth_dev_get_intr_handle(struct rte_eth_dev *dev) { if (dev->pci_dev) { + RTE_VERIFY(dev->soc_dev == NULL); return &dev->pci_dev->intr_handle; } + if (dev->soc_dev) { + RTE_VERIFY(dev->pci_dev == NULL); + return &dev->soc_dev->intr_handle; + } RTE_VERIFY(0); return NULL; @@ -2572,9 +2673,15 @@ static inline const char *eth_dev_get_driver_name(const struct rte_eth_dev *dev) { if (dev->pci_dev) { + RTE_VERIFY(dev->soc_dev == NULL); return dev->driver->pci_drv.driver.name; } + if (dev->soc_dev) { + RTE_VERIFY(dev->pci_dev == NULL); + return dev->driver->soc_drv.driver.name; + } + RTE_VERIFY(0); return NULL; } @@ -3237,6 +3344,28 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de eth_dev->data->drv_name = pci_dev->driver->driver.name; } +void +rte_eth_copy_soc_info(struct rte_eth_dev *eth_dev, + struct rte_soc_device *soc_dev) +{ + if ((eth_dev == NULL) || (soc_dev == NULL)) { + RTE_PMD_DEBUG_TRACE("NULL pointer eth_dev=%p soc_dev=%p\n", + eth_dev, soc_dev); + return; + } + + RTE_VERIFY(eth_dev->soc_dev != NULL); + + eth_dev->data->dev_flags = 0; + if (soc_dev->driver->drv_flags & RTE_SOC_DRV_INTR_LSC) + eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC; + if (soc_dev->driver->drv_flags & RTE_SOC_DRV_DETACHABLE) + eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE; + + eth_dev->data->numa_node = soc_dev->device.numa_node; + eth_dev->data->drv_name = soc_dev->driver->driver.name; +} + int rte_eth_dev_l2_tunnel_eth_type_conf(uint8_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel) diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 8320dc4..4ae22e9 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -180,6 +180,7 @@ extern "C" { #include #include #include +#include #include #include #include "rte_ether.h" @@ -870,6 +871,7 @@ struct rte_eth_conf { */ struct rte_eth_dev_info { struct rte_pci_device *pci_dev; /**< Device PCI information. */ + struct rte_soc_device *soc_dev; /**< Device SoC information. */ const char *driver_name; /**< Device Driver name. */ unsigned int if_index; /**< Index to bound host interface, or 0 if none. Use if_indextoname() to translate into an interface name. */ @@ -1619,6 +1621,7 @@ struct rte_eth_dev { const struct eth_driver *driver;/**< Driver for this device */ const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */ + struct rte_soc_device *soc_dev; /**< SoC info. supplied by probing */ /** User application callbacks for NIC interrupts */ struct rte_eth_dev_cb_list link_intr_cbs; /** @@ -1852,6 +1855,7 @@ typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev); */ struct eth_driver { struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ + struct rte_soc_driver soc_drv; /**< The PMD is also a SoC driver. */ eth_dev_init_t eth_dev_init; /**< Device init function. */ eth_dev_uninit_t eth_dev_uninit; /**< Device uninit function. */ unsigned int dev_private_size; /**< Size of device private data. */ @@ -4244,6 +4248,20 @@ void rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev); /** + * Copy SoC device info to the Ethernet device data. + * + * @param eth_dev + * The *eth_dev* pointer is the address of the *rte_eth_dev* structure. + * @param soc_dev + * The *soc_dev* pointer is the address of the *rte_soc_device* structure. + * + * @return + * - 0 on success, negative on error + */ +void rte_eth_copy_soc_info(struct rte_eth_dev *eth_dev, + struct rte_soc_device *soc_dev); + +/** * Create memzone for HW rings. * malloc can't be used as the physical address is needed. * If the memzone is already created, then this function returns a ptr @@ -4356,6 +4374,19 @@ int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, */ int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev); +/** + * Wrapper for use by SoC drivers as a .devinit function to attach to a ethdev + * interface. + */ +int rte_eth_dev_soc_probe(struct rte_soc_driver *soc_drv, + struct rte_soc_device *soc_dev); + +/** + * Wrapper for use by SoC drivers as a .devuninit function to detach a ethdev + * interface. + */ +int rte_eth_dev_soc_remove(struct rte_soc_device *soc_dev); + #ifdef __cplusplus } #endif -- 2.7.4