From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0065.outbound.protection.outlook.com [104.47.34.65]) by dpdk.org (Postfix) with ESMTP id A1034FFA for ; Mon, 6 Feb 2017 06:24:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hT1bb27eO2l8SBd+/xhB5MblfDmjMs+oDDrkS4nv9So=; b=CWNuJoW9YJKs81B+jX6/KDRgEM+KrQlELQ4tZppj05vsH6pg/AgZf/9YNZk4i9l4PKqJ7E05xDguZeafo6ZcdgBiRwb/sYtofPGBSacCttPBjt4cBIXNj0fw1Juog0+k1f3BcuLM/1+6m7Wa8WFTg0yqy71Czdh5uzVoOhXiblA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.localdomain (122.171.53.66) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Mon, 6 Feb 2017 05:24:21 +0000 From: Jerin Jacob To: CC: , , , , Jerin Jacob Date: Mon, 6 Feb 2017 10:53:38 +0530 Message-ID: <1486358620-4075-3-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1486358620-4075-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1486358620-4075-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.171.53.66] X-ClientProxiedBy: PN1PR01CA0029.INDPRD01.PROD.OUTLOOK.COM (10.164.137.36) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-Office365-Filtering-Correlation-Id: e461c935-44b5-4c2c-9749-08d44e50696b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:vx+YoLJKNQDWQNporO1VrzT8n6sTXGVwvl2jHwbMqT40ZIoVzD+fwvBLeuHEVuyec6wf8iO4FNR+FjbG4j/xwiclhWWzv4uThIhXLzI0z7vzfAe1QvGzO51ZSWg7tbwgThuQrD4gv1lOHxyFx4IrXe6AkDU2eUokqEpcJdSbx1lFnrc2Q5E/Aet0MYLCiMlr9ocJJipGPC5LVZq3v6j23XcIVsMg91M2yYoB5DHs3ljYIKdoape9mf7KE6zmGysZ+Ror9JPOlVkkxrGLIRPq/w==; 25:PWDFcZax50H3mHQvj172lLnib42onHd4U57/5Tq3AHoBQGiCXcAaUAznz6iJFlyJtoFpQx66ELAoZKi8ZHiY7k7XKLz2J8BD443QiRe1gHfS8rVCqaIhnHd4pKzX4uRYfc3/8dnZkjAT5H/URoo9Zk8UQmW+s7PKRG9u7sMP0nxRRaFo5TJTIGBbwTasFYO4CFjBJ7blJcr78m/HJECVGeFTL2qLGuAtRRa+KpPJTvp/3QdGxmAGiD0NN30677KP/okSH4u6aKE8OHwMtdG21OOhBtxJwwyfje810WjQC2/TkIVPyNcGlY7p/G81r6/t8x2BujbtyAyi7U8wVVKt3/+7Bo4gHjECfOs0TRZjCDgfbLGOqKrHBarXY8Bg5pNdGyn4dvX5TAdgVANd0SBiQii+URKhSmsLwVXGgEU6qJgtizcT7D/70EHC0PxhSdMigvS12m84Mpw7SOTbXlGnPA== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:QhOYiCQyLdrX06DAwGdY5ZSSia2STmfJB5BgzI66JXsrlJu561AEnS/Z9nB0/7LY1gkyE5bAS18/BboZvtTZJJwF5mZCCmZG23Q4XU3oAS0o8lHMdFQX3U/6OP8yL6WER43bK0oZrjLS37pPR803g00fXvKCNAd2Jon4DDPu2KeWzQsNcJxFvbH9dzM0Axzfg792V7KtsKJw+gk/yrKNDgs2qWfmHxYU4uvtljP7yPPDpFYnJoU3/MigCZf9ytC8; 20:irFRGhgZc01df4NaIYF4Mv9NOglih16ZIblEEqyF75StQM9q7Zie0lEl3E2QMc3Nh3AHR+mB6m2MBX85JU/LzxP3tGaOmCJKulg9dFg+N4KMLTTZQCvbLX6BzZlPQwtpY0iH8k5peJDQm/klc2MtNMTojubMk4lKAyLupaqE3aQmSMlMgAhKW96+kdj1RjuGGccj4gOIeF0p1hFQ0lDp8nTRcA42a2DNiowZlKx6uvGS1036N/y8R+m2E3fmgep8apDGUUTRNqMAIkTWcPQKQK5OjTDe3pwlJabVnB7YcgromNVyCzKeZN8zUjk51vlW76Hnp0gdhIUTnb3JutKXGm7agrAeZmPOPm8kMH7ZEzjQkwXOB4JGa6zF+52PYlcpr1VDSCcs8io8SEostH5k2g3EkZzTgOQLAp5vea5IKa3nFX51wfX7xIQf9gZCKtH3nOOctMCiAeeygYvlefuH1yntU/12GZXjSgR1VDN/y/f/Jc50zOhIX4A1/G4vhQlxLud6BIbJxQdSvfIt62zQRNghmcOJoUMX7yEpz1XSEnyrNuM8LIv2TLrI/8X82bja2fWFkCjR6qqg0F4ugvTi7ctG7pHnVfR1fUtDyi/ICFI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(20170203043)(5005006)(3002001)(10201501046)(6041248)(20161123555025)(20161123558025)(20161123564025)(20161123560025)(20161123562025)(6072148); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 4:BnFIK40gQMTi9i8LWHqNc60n6lWCTI+aXsN1rq3L2KcsE+RZVOGJbPR97s40vRGWda9RW9lTxQ/ZHiGBnlfh9FQ66fmyPbN76CGT/pFuXjqTF0OPGBljWDbRdGvbImZz1jgLI3f+TVzxFBJC+YrZnk6M23JgOQo4Xk5cqiUnRDM/AV+sM27gIcaqgo7FFaFP5DHh+dTF9yu480uh4YQaiP6xItyNotT29ErsBmv8cNYVGFzZXi7vNRgGdCP9piay4kCG/47ztYljcfBHa/9wBiSATa1QXBymgTF2imIiraQnHD8Xh69M4QSq0rPRtIHY79FyAqa7yW+Ja6+3Wb4dCbzQT5aGZqg8pTwCIx3suJ58bVf36BFKUc2FP6ykLuSA2W7Bt0Btn5yJqDJoqkXR7K48ALJJus3bf6tEZWwsPIhQUkWgp3960bUbIA7W/oaICQKPM2QyWwsyR/egLmkPHiK80v6tO+drl0P16+NfvDfQsjZ0jSY1+UJsBxna5qrQteni63jWWUVzxmiXjbouxpKWpDqBmSFxCNGCHVYugbtWBtKrPOIhhEBnKi71vaZnBe7bYLYEVr54WxWQrk80205SpT3qX7DswhTaEyvpk64VTrRrHx0P61dXL+gy78oM X-Forefront-PRVS: 0210479ED8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(189002)(199003)(42186005)(97736004)(50986999)(5003940100001)(76176999)(6666003)(53936002)(47776003)(38730400001)(107886002)(6916009)(2950100002)(42882006)(2351001)(4326007)(36756003)(6486002)(66066001)(110136003)(101416001)(6506006)(3846002)(6116002)(81156014)(2906002)(305945005)(6512007)(50226002)(189998001)(25786008)(54906002)(81166006)(7736002)(5890100001)(8676002)(4001430100002)(92566002)(48376002)(106356001)(105586002)(68736007)(50466002)(33646002)(8656002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:localhost.localdomain.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:81pVKaCxMbm4auMb6PVW/jNNnbWxsD+3huoabJn?= =?us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xkRfPbRAGw1Cu0+n37N58ROyrQCxRsMpAG8Dek0D02mOPtAJMjWdBrW/UuIQe6ASUqh0YnAZOz4L1/ZM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:kz0wn2pRs4B937iR0nWCDfyNAqKf1aTI1Bull2ch6CSTuxcGqiVhJm94yTDWn//thJloQVTAPuI9dmuyv9Vi7HpQUXm2j3J+Kcs+dKprBr9VtZndE1X3DDYXNuw8s3Er40D/GaBc8YCDzoMU6hVC3zEpPJH3C7HSlXcRLzsOwOUZKVF6O8z2cdApjnHZkw7ZLd/fq8Pr9VVlHgh96KyYEDzVqOdhO6ky9MYG2uw6zC2JTXWdO+npilAciGe3BntEXzDJrG8aA92NJdGSGZeTUA0lCdrBzjQj+c8Z2gcdbaTQ+er+KFtdYK07Jy0KD+/26EfRqQcpuOwjuKfvwZLfePxNZPelJlqETViQccUe2LWM9InHi6ZJ2IeOuOAavv4tgfM/0R1kv2EOd1T2FK0Jc+HB1XUSYI2H3gJeih7nnDYjybqQ185jHTGoKnntLmH25uV+UomPkuW8K9ItcKatqNAvvjj6/tkRbUNJ24SbhLTkeAXtwB1JSZJ8V8c3J75jg5xgf0xV1Rz9xcrD88g68Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2017 05:24:21.4859 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support 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, 06 Feb 2017 05:24:26 -0000 Added eventdev vdev uninit support to release the resources allocated in eventdev vdev init. Signed-off-by: Jerin Jacob --- lib/librte_eventdev/rte_eventdev.c | 43 +++++++++++++++++++++++++--- lib/librte_eventdev/rte_eventdev_pmd.h | 12 +++++++- lib/librte_eventdev/rte_eventdev_version.map | 1 + 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 2b39fb2..09fc274 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1143,6 +1143,8 @@ int rte_event_pmd_release(struct rte_eventdev *eventdev) { int ret; + char mz_name[RTE_EVENTDEV_NAME_MAX_LEN]; + const struct rte_memzone *mz; if (eventdev == NULL) return -EINVAL; @@ -1153,8 +1155,26 @@ rte_event_pmd_release(struct rte_eventdev *eventdev) eventdev->attached = RTE_EVENTDEV_DETACHED; eventdev_globals.nb_devs--; + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + rte_free(eventdev->data->dev_private); + + /* Generate memzone name */ + ret = snprintf(mz_name, sizeof(mz_name), "rte_eventdev_data_%u", + eventdev->data->dev_id); + if (ret >= (int)sizeof(mz_name)) + return -EINVAL; + + mz = rte_memzone_lookup(mz_name); + if (mz == NULL) + return -ENOMEM; + + ret = rte_memzone_free(mz); + if (ret) + return ret; + } + eventdev->data = NULL; - return 0; } @@ -1186,6 +1206,24 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, } int +rte_event_pmd_vdev_uninit(const char *name) +{ + struct rte_eventdev *eventdev; + + if (name == NULL) + return -EINVAL; + + eventdev = rte_event_pmd_get_named_dev(name); + if (eventdev == NULL) + return -ENODEV; + + /* Free the event device */ + rte_event_pmd_release(eventdev); + + return 0; +} + +int rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) { @@ -1275,9 +1313,6 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev) /* Free event device */ rte_event_pmd_release(eventdev); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - rte_free(eventdev->data->dev_private); - eventdev->pci_dev = NULL; eventdev->driver = NULL; diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 4eea618..be5c784 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -198,7 +198,7 @@ rte_event_pmd_is_valid_dev(uint8_t dev_id) { struct rte_eventdev *dev; - if (dev_id >= rte_eventdev_globals->nb_devs) + if (dev_id >= RTE_EVENT_MAX_DEVS) return 0; dev = &rte_eventdevs[dev_id]; @@ -552,6 +552,16 @@ struct rte_eventdev * rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, int socket_id); +/** + * Destroy the given virtual event device + * + * @param name + * PMD type name + * @return + * - 0 on success, negative on error + */ +int +rte_event_pmd_vdev_uninit(const char *name); /** * Wrapper for use by pci drivers as a .probe function to attach to a event diff --git a/lib/librte_eventdev/rte_eventdev_version.map b/lib/librte_eventdev/rte_eventdev_version.map index b138eb3..c572c4d 100644 --- a/lib/librte_eventdev/rte_eventdev_version.map +++ b/lib/librte_eventdev/rte_eventdev_version.map @@ -35,6 +35,7 @@ DPDK_17.02 { rte_event_pmd_allocate; rte_event_pmd_release; rte_event_pmd_vdev_init; + rte_event_pmd_vdev_uninit; rte_event_pmd_pci_probe; rte_event_pmd_pci_remove; -- 2.5.5