From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0059.outbound.protection.outlook.com [104.47.36.59]) by dpdk.org (Postfix) with ESMTP id 72B4B7F14 for ; Fri, 9 Sep 2016 10:45:15 +0200 (CEST) Received: from BN3PR0301CA0040.namprd03.prod.outlook.com (10.160.180.178) by DM5PR03MB2444.namprd03.prod.outlook.com (10.168.233.14) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.10; Fri, 9 Sep 2016 08:45:12 +0000 Received: from BL2FFO11FD043.protection.gbl (2a01:111:f400:7c09::184) by BN3PR0301CA0040.outlook.office365.com (2a01:111:e400:4000::50) 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; Fri, 9 Sep 2016 08:45:13 +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 BL2FFO11FD043.mail.protection.outlook.com (10.173.161.139) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 9 Sep 2016 08:45:12 +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 u898hoZ8018305; Fri, 9 Sep 2016 01:45:10 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Fri, 9 Sep 2016 14:13:58 +0530 Message-ID: <1473410639-10367-15-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131178843124720574; (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)(5660300001)(68736007)(47776003)(2950100001)(85426001)(626004)(87936001)(7846002)(189998001)(50986999)(76176999)(19580405001)(356003)(50226002)(19580395003)(8666005)(5003940100001)(36756003)(8676002)(81166006)(81156014)(305945005)(8936002)(92566002)(77096005)(2351001)(586003)(229853001)(86362001)(110136002)(105606002)(50466002)(97736004)(5890100001)(106466001)(104016004)(2906002)(33646002)(4326007)(48376002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2444; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD043; 1:04AoDwrOZKQ9ZAZN7J0n3slC8NftMIE3BdIgeKS8GiHqranihEjv9QaRcL+7KzLgjbwka1CBc6tYu7ONqzmETsMewYIp9NaBOkwPgHqcGdbqmSTxuLxSprxk1GJzGBvtDMY5+ROv10wWfCY5OKSwT30QqiTphktFqM1QUx+uG9o1Kl0aAUO7DL7zYWD+ya3MExw1bwhUjKoYX3CCnO7m/fbDU3xeWSnuYVfFsDtyi6EAi26+M7KGhcD2pTC2bWNNhV7jw3vyTVaq+p5smCFrNCK0/mRuFqhYWLJDFw5Bm0pR+++zR4DuEAC72/TZG6umuMv3ZSitbMIT5F5ZZayt8JlM7bZz3NGcvrrMemhaLhuYJNzc3Pv2EpdBzXztR+8bEzWV9VrwmphWTa6Mqg4l2hoc8O8qsV6FYE9raz4rnkmAEevCxQAqJLOFE6cRMMe5cB4MQ3r23WNJK5odsw0jrqq8HdxumdAYd/94F6UZp5hIsp1idFP658YAA1nf5FfaZt/emm8s6BH90p7FvS/kdJ/eNUXuvTC297PVEgKK6wdYSBTEAsmoT3P9KKEWA4lEMJPFigkQHCVpciVZXPXLPf6rYPQSfyAaa/WgQjfDAXlVKy/CwRF0+PF7fA0w3X7+EMjcfA0+08ZkABiCtqtHykLx1NJ9eoRmyhMNeCRq8otHXIm9CKG3Jz//bFQCF+sgf+NxqwDO5b8xcSfwHP5yZVOibLPoZCmIbWTcOibt5m8= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2cbf9fe8-aff4-481f-825d-08d3d88d9cf3 X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2444; 2:JBBMNi0bIlgersVgRmqc9lBH4aXalnmWxY2ZR5KVcLFnZa9r2GiiSYhXFEgs0+xrBU8uPHL3OGxOUKVYBG33FDCjcaJCcv6pvZsJ6gOlOWz/1DsVaPIVXOpiYmQi91eYz18SNqzEeZ00Njv+k8iLVRtQ+siNPWiHAxa+OGaw7gJvaYVygnBdcpkbbJg/OnDo; 3:Cp9MSt8pq88qUoK1jkOe6EZIMc8Xke4yP5G5sIzK6osUsZMJR2s5iDhrn/J6iIogUXEVyX/wsW1tajgD1PxzgcnCepwNaXjtaZA/WcuoAQWKdu/LOeJBpScRRZXO8gIc/l6pxIqeSjkZ8xG6a7GCvkmj/zp3kojRqvHpWe3Hd5sTCu97I6ip2qmWRuLj22xe6syYjKaLlIT/qzGKX3E2H2NR64ddmHB513mfFTiKVys=; 25:EvP33olFk+Cawj7voGFuu08RYbcUYyIxLECK5kJybsmuCAeMj5QR5+/p5YYZfC+UYOsbJ+wvywlid6v7kXJ2YZs+wwwQtdrHm96ZRkBXZoody2+HVZ4uyfkYISKcAEIaHlfYoJm1y5cZ05TH6Qs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+EmUplZhjQImElJsDQNJ/CA05Xb1BW+RjzCzrC5Vhp24GAlDCbgWXX06qWoax/BYh1q17xQFQBIdAkJcOftFh7soGVL8= 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)(13017025)(13018025)(13015025)(13024025)(13023025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DM5PR03MB2444; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2444; X-Forefront-PRVS: 00603B7EEF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2444; 23:ym4W7YqQIPNRc04wb1WiVA1zZv/kK7Tuo0Am3l0VP?= =?us-ascii?Q?nLLjpsZ/32j9jcOIYuZ0CJifPuXlU5jVeiFLAbRYVOoJE/1S1ewNth8raDHl?= =?us-ascii?Q?N8fcGLT3QCcUhd+jW8+spDcQIGcL3RQByAr3eR3iWeOCRmNqUNaojdgQBony?= =?us-ascii?Q?S/GUqLpcRuVztnuHoafYozTXOipi0onw0QGnAPhii3E4pwIi62PqQGDAVQK7?= =?us-ascii?Q?CFglrWGoSxCoyysbEhE6lrN4F17TpqXvy7A9nqpUyTZ97dJDbrqudYPOIBh/?= =?us-ascii?Q?2gZrY1SyO8Pe8Cw7A9V0KCCVcTCOa7Mp0hF49kK8g5pIgvMy+BUj0yoR5ygT?= =?us-ascii?Q?H23UNUYJJFkxxS4iO3qKn9WFJQV0NHQ+NyhsuWL5Ue/virFM/A8ksL1Txk/b?= =?us-ascii?Q?ugFOIh1aL6Nxh6CcmQ4wRl+yR4odzdibc+gOkZqCgbxcxF0cUNRKtHVuBMKZ?= =?us-ascii?Q?Uvv9llep21NL6tjsPtGxrtHaKEpjdDu25JOsaKi4Yg49lexjm7WG3i5wSdyU?= =?us-ascii?Q?uQ5Wx/GkMjd+XwUv22VfIA+9x1+jU5bjGl7pgQkeu1tX4U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SeW4iAzr3BnzHPD+J1S88bFP1cTcAPGZRBL4Kz00hnSjg4IBZI=; 5:dYd5MfRLk1FzyEcOCiSHmaCI0YwG0MR2pKsJEbYx0uhHN8NaKI9Bf2RlnVB3gTByJ3X8oI0WusAkXKlcXhaS7rCWZdW5bMudjzxAxI6a7mGv6HA4c9cSzcdEaNo6monscLbFvQdp9nKCcv2DgUenMSHV6JymyTrpTSbudo+QycY=; 24:0mmpDoMoSorOuTwrN2jqcnY6hmoWoeWByi4+Ij/vPlG/A50W/3roOBimzQJBvomHbRQN/7O+mWOWRXSy4Ilqqecz4yfhAl1HDalc7Y7sQTA=; 7:YrsPvXNKuTvQ6F26ssisQ6acu6HhiSVlGgX6E29qkM2Z2Uft+p66Jf3D96gYoiwJzZWkcwjTomArF8gVnH+3vqSDZD4GQGDUMcan2z5wiGMX2xCI/8A9+C1NEitdykrQhy+N29DEIVT7cEhu7dI9uJs6q3QoQXZ0J9dlhbvXoZ2LnUxIivCQ2CLQcrpKRr5uX0iuv8NtUGyLl6jNpv2foV+paQxnvpvtuTH4RRx7lRLDIHGsKw9T0NqsPIeWZ4DR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2016 08:45:12.2848 (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: DM5PR03MB2444 Subject: [dpdk-dev] [PATCH v3 14/15] 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: Fri, 09 Sep 2016 08:45:16 -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