From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0043.outbound.protection.outlook.com [104.47.32.43]) by dpdk.org (Postfix) with ESMTP id 888F93798 for ; Wed, 7 Jun 2017 10:44:11 +0200 (CEST) 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=LIZZicmpFRV+1N2dBapsslSvZa5RbeaIBt9Lmm5FDQw=; b=I6Y7HSg6isYpn18DFi+2OYh38ntNMG524wJ9krbQBb1fmjWfgR3S8SDItV8V2z39kjLGjA2cImegTS8gioNFa1quC14HsUTt9YKl41jwAJZVCSVcm3NLlgbBaOZtBp1cEStZAEawp9po7pjvBav71636qJs0Idr8z/78tVPNcZ0= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from jerin.caveonetworks.com (111.93.218.67) by BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Wed, 7 Jun 2017 08:44:07 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, narender.vangati@intel.com, nikhil.rao@intel.com, gaetan.rivet@6wind.com, Jerin Jacob Date: Wed, 7 Jun 2017 14:13:33 +0530 Message-Id: <20170607084333.6338-5-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170607084333.6338-1-jerin.jacob@caviumnetworks.com> References: <20170606141046.32103-1-jerin.jacob@caviumnetworks.com> <20170607084333.6338-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0076.INDPRD01.PROD.OUTLOOK.COM (10.174.208.144) To BLUPR0701MB1714.namprd07.prod.outlook.com (10.163.85.140) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR0701MB1714: X-MS-Office365-Filtering-Correlation-Id: 88c202ff-7f40-43c1-9dc0-08d4ad815dbd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:PKXw5LIA9CQTE6ZNYg06+6j5iD+MxF8tl7C5uK4Bzvlu8kVeChwc4dRit0gvCGCe1BILpvM7ciKdoeE2Mj0vzIUOuey9d1RultzWgYlyBN4NIRA9qPZePLFxiGFZTSFhIFX8SvLQcTrZDriiKN37QQvoogl1zFeMWY4NQhG3whaji3LYNcux+uoLmZC6mRiEcJn+112ktagXOI98TNOINKUo/1mpxriRqjO/npALkzAYzjNjgXRce73icJpRuyXVseojR1Kk/HZB6mjjR0vRI+1Ud29ooccC7rkx6EOUYtj8/GSGYiPrTv/o5pBnenKeMSOJoMJILf0pNiGimbU5yA==; 25:I1CGkndyb3I7Suif88wmKaXGWDxoKZ6cALmrFrDF6zw+oGxN6Mn/4nwLWK+dixQV8o/2X1+IdUvrDm9jJ+LAv8R274lSxo0tLmSSyPkMPbjI8pxwM/xvjlD9iergPM2B2a1OlP1JoxhImzJkcJDb4FPwBGVZAv1JS47lNmjMc3BCGgznxiuc+/4wRwTSJuwfM4K2Cu4+S8Mihl4Ayc96OLBhmkAIrTAkJvNHKTH797GMaYzpb+7RBouFTHqJuTVWd/ecWUk5ffXnGQaYjij/3pWwaX40IPybiTCNw+DFEXAhkJF5Na/nvn1QQZmz74dRRq8BctL5xPOgzHvYWSx+mO+muIJL3Fgk21GhImsQS7neKCzl2a26kgAuVbip3ReQkKwK/ASaXAxFt4D3KKaTGapablOU71vytj7EtOeY2GH/h6uXMXK2719+hxFMS2uj181gENRitH/kjtjmM4mPs9MK7tegpkbT2X49yQ7+6J0= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:iyElOC0hVFWHN1bTLdq6VMXvRFS94bJgiqap0zFnkojIggsKF0dHLBJYHtx0x/zhxgkbN9jpPqHW92RC58zYaTgiLmC6YuLSE3vWYtavysEOOCeBMl4V9+bj4+quigx2Rn6zGrR2P71IbKPNTuGQkJydj6aJ6M6T4b+iHCuO+FhKd0W6vHXJ5RCmc3Gg2YsrJaXaB1xpZwcbeFcwDXcbq+62NVldVfmMIdvdXO6hago=; 20:FLF8cPQEhNrNvPhl1vDcmXDHl9o7u61rRVG0wVwbeqVBjQQZnKJrbqJIoLXO6jZkG+iW2rEE+s6eeTwo+RM+VAqCR4AHdu65rBrR29bXngB1xr07i/PYTztzDqjM0cJAD8gbedmSI5unF1HUattiu5JxW2/9f1mSr6CgG1kU6EWYAaWxRfI+hyQldqLlAWgamdotha1ucB6grfGeCjyzhs/mnbkz9YJOoFsK0KLpE/saSCbgzz3H2fEjSMNsVqV6NWbVO1dJx4ZECRhtfLBs5vgD6fzNu6R0JS3PccaWx9CISpSuWc0ZWbzicJZv+xNJIlVvTvfVUyQc4Vez9mPYkWEksiVg4t4Dic2CEspS+Ttcot0oOpFkflRf2/R76Fkrq6qi9CvIMNLLGrMaRMsQGSqPaxcLmZ/7yqQTqxxwSbzKw5TTa9p3lsuQv+/sn5WDIj9e3iBAmjsN7FdKQXqSe70Gw0p1LX0SBrwtOnEqmN86kKgq4sHyVe2BhrRmoCfz74FeFG1Ve2HGicOOTzPup/efmxc8dqZ1cla8jBDCUSf4+cagyWLgI9IzTWtdzs3H3j/Xi15NDVkcTusEbWtAJDDTACgliDlrRIhKryKp0Gc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR0701MB1714; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 4:9wKReOBhHMgffMePoO7oSNjlTtvif4GfFnVyUpeE?= =?us-ascii?Q?BTH9I7JyS07T5HoLn8qSPt0pRVC8MYX5T/IOziDA9koVdyQ3P6i9zuQbDegy?= =?us-ascii?Q?KtgynwFx6ZESrxNLc4Jgf3bJu2E5N59AJ6wzBw6q/J57x/RZirJqpc7RzchT?= =?us-ascii?Q?cLkCNI+tNxMT/2ZeWRL5aDDR2LvAKnwkafyBY5eGT2Hf0LKkR3PjtYmUVLbX?= =?us-ascii?Q?RQtuf90znmnQEpdO04pbXcpVRC5PTTu3lYc+a8r2ee/mHepGbaSlHXfN5GQ1?= =?us-ascii?Q?iPjFFb4zGHuMjljJ6GHsZJoteWC5LO28XDSW8N+XLqYr2h+D8xM/VihTfkl0?= =?us-ascii?Q?mIilwepr+PPiTXT8kLRkDOs6b1hei6WoQgh7KpbKHuC5GyRhkMeNwwHEdPjT?= =?us-ascii?Q?clx/lk1SF9PScPqlvXmpEQDiiKs7S5hSHLYWToNukGnT3m5YFVilGlAiEIBg?= =?us-ascii?Q?ptH8z6lfLGuXDX48PTYAoxKZRMW0sZrtMyPMp12a1qYLh6HpeoMXD0no2c+l?= =?us-ascii?Q?q1RyowsL3OnsQ5oVTuBNPwcCHT4pA19K3U2qAEd6ai2Y24D3RnggT2TFQgBc?= =?us-ascii?Q?w2RavlM1FkJUOvR6iMBaULFNzvxqYDCSzKCvjSwmBcEWRTZDWvQ5q9d6DbzD?= =?us-ascii?Q?r8NE/0XbNDRPR+E65DpLrJU303NZRRpIf6yYkwwwsOI6hWI9gYw5fR7MB/uQ?= =?us-ascii?Q?pws2Petf4xGzYp/0PtjofVaQ8hABso/bZvji/Q6ftDP3wFlpgGWlz2xvWv00?= =?us-ascii?Q?9s6PkY9hqVLvub2wm64KzlHDK5NsZTgIg5VU/rqjR+1ytswH6NbKRtPSlgxs?= =?us-ascii?Q?WB4nxMvNH0EP6cDa3Go3D8iQYAOodWjk74O3Y3g4wA6oBXCnJaPwtVNrXbDT?= =?us-ascii?Q?JeQNA3oI/ou0OjjA6JSVmw3maeo+23C4vXc3McOnH58U58PWnm43LQlEwQAt?= =?us-ascii?Q?YDHhi2OwU1rPQ7unCcZ4Xy0Y2dPDrYOir4HZdtvabpXiB8+kn0/GlEuy+KBK?= =?us-ascii?Q?erAyGzE0T7E2pPkfW6uKjEqF7WpoG6rbVre/5FL8yiolm3S1fkOtp5qoWQys?= =?us-ascii?Q?D+fv54Ov4CtA58mO9gzXoaeiKh0EQbcZuQZLVmVzlGSPI31m782MfxuLjN4P?= =?us-ascii?Q?8FpPlWp7uJzoS9PHI3s8wC5N/Zx/suan+cXPCqsNeNI9nwqx/iqaHg=3D=3D?= X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39410400002)(39850400002)(39400400002)(39450400003)(6116002)(47776003)(42882006)(42186005)(575784001)(1076002)(53936002)(110136004)(50226002)(81166006)(8676002)(2906002)(36756003)(189998001)(6916009)(48376002)(72206003)(50466002)(33646002)(6666003)(2950100002)(6486002)(76176999)(4326008)(66066001)(3846002)(6512007)(478600001)(38730400002)(107886003)(25786009)(305945005)(5009440100003)(5660300001)(8656002)(2351001)(2361001)(7736002)(50986999)(53416004)(5003940100001)(6506006); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1714; H:jerin.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1714; 23:/vJ0I0Qvom5lh/tX3FvyYLuWIHaaTJap+NDge6l?= =?us-ascii?Q?b1f3yAiPCDgjouGHZHRf0XvWr/aquOiyz45mq/CBxXGZGrIa7wD9ha9FIe3/?= =?us-ascii?Q?nAY/KMqLzoQEP6V4eOAxGGGoXnNXpfokno4jaTAj6+KLpNVgCZfC2nlKOIa2?= =?us-ascii?Q?HEGzq9dAlnKBrq5mOk5cANpUvxSf7JeDLCCi65GL84EWzV/rGwLdg22Ld03w?= =?us-ascii?Q?kVTfNdIHmXaf9+djxIcs/0dCrn7K1RVeeM5JEBCY0M33ZcexkTvn/5kJcCd6?= =?us-ascii?Q?FLPt7IZEX3/mOgNI6V+nP7RYier043fAjl3nfi+ZaVtfOmpwVGkkm26rFyWM?= =?us-ascii?Q?lMInaGx+1kQquG9MEEIytp9EDX5jlxsO/T6a/qaUetSjdJ9w4cOnjmAUB4oz?= =?us-ascii?Q?2AwBH+oZc4RQEN5FLpsGxTRQBy7dONjv5ZpUrU5RIYNTKUi298N5FyPI+KOr?= =?us-ascii?Q?PVTsmfsr7gbMRmLaj02Crl/M9Hy1OLCmMaIWe0FW4502KZ4PJyWTlIa6LAc7?= =?us-ascii?Q?z6msSKlmpER89ONfd+63LImU1RPuDcXVGl3LJzeYvob+DzVjTf8yZ5HCBRGg?= =?us-ascii?Q?KL94CNv6vpHVhWzsDE5Zooy3njbG+ETzbFOV5im2z0zU4N3nAn9J722ccXfI?= =?us-ascii?Q?AJxG+zKOmH7rM5WAvvdkaXw+4/VzB9RT3eFi5tLsfzoHJoR3vK8vgr7LbbIe?= =?us-ascii?Q?tvEbTCWWMI9BHj2b3gS9sgQX/3IkyKJ3R17MfMDLcW7e4chCPxjREo8EFfgS?= =?us-ascii?Q?cwcVFx9Cyw2kFvzLXWTYkfLUDuiuVODE4UgFj02zKejqueGMt1EZwU+zZG8K?= =?us-ascii?Q?tYrRsfkqS3ebQV15cAAgBPc0uFwej8HN+01fWFM/Kcvq9+Mw9DHNWEI5Lduw?= =?us-ascii?Q?2BFL3zPPCcPcgroL1Ah2c6wXBI6ZoucJr6tyAbX3aQAsQ5FJBGx7JYd2VOkR?= =?us-ascii?Q?nf93oKlZOOUIYeZ/lvf/qCrcN9BNtilaH7NuQjWuxgW7DEVGGmpDeYI2s4ab?= =?us-ascii?Q?Jzx6HZBOmivQwQgvZquwH3D44p7mgT8whRkYocZyoErcRpGCh8v0QJiCf1Vy?= =?us-ascii?Q?sPDWHEsQIpo3w2QUuD9uxcFduXv+5QyO1uIv6/InPOEbhBcSeLITfdzc0fjE?= =?us-ascii?Q?m6ev1nOQd5qefL1R2phsnAX7qqZCadQC3AdceeFku+cDvPp9jev/I26UbpGF?= =?us-ascii?Q?6TTsGsnfUxqz2vqx1f6esr8OuQmmH7Mf9S+Oi0ItSEKP3GPReer+W/PPY0A?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 6:RrO0SERN2WFPr8rJZiG+ifC+TbFi+0ki9dFAjgR6a6Y87nyltOzh0zoHu/9fPjht4iQQusc9xiMeJIhiNSj4mQwWr7QkUjonmnFW8ko/VLhz16lJ+3J/B5CGvPYFNyE4O1uNk29jdOLxJLpP3HmalrWwGpSQqeHtBaBVOXpvF/ybYpi74hqbbwl8Oyco642j4j3FPDOmUR9j23CJPI70VnzL8TK4DHAJTjTOVYsMn8t5KV8nvL/1D/Pu8FsiL0vDQaDQug4WY8HSRNAXYRa/vZ02JXwfkDIS7GJWyBpd4c3msrZmeo8I1a4m+GygBd/h9mRxvakiy+as10XYVkr0Ig8sm3haDPAcT9rR6L68uzm3eAR6jcPD7BKa85PaBJ6Abrib1E8cxEKj3LcsfAstskpY9dZxXiy6cbwYiwRkZhVcLtkLKG6QC+d9E9i2UA35bFptddM94MNuL3Zm7rThmXOogiXhZocBMq05+NbAmXSRXhmJ/Az71UdYAneAEWPTTIiZxShRG048RKvAInkpMg== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 5:YIzxTtTFKETUrKr7/r5zR1n4dVkaPtMMscZ/zW6AbXi6pvkonltE9SIFkL5/qgdsV8Z2YxGanTi+YwuSI3OQZDj2RGLjp+fNCyZEtVsn0r4bxHI7RNIhyt/svC8paawnY40imltweVlaMa3S9cvCnx0aAnsoLCD59kn8DSC1aHeGysMF6YwIA6j6VVyZkWSykvvv0RA6p7Mq1AZvatvPXjFzmkDZIbi1WdoKeN599sL4EQ7uxWTbosBqWdutHbroDrFinsMVX3V/S6OZePm0Tjc+3YqYK5B9XA+91Uvs6UaOgq+W+7g4FnZaTFWW3CDWHlFlLx5iSJpkgC0Yr8pjlwjmJ4Tk/WxQuUuEdgWkgUTb01G8W7ZLzX4cNYbo0PMl05bdmPgdWyMCikXSDOzUBeP/OIfGSl7b8JntVvUvtv2mb9jC4Cw/CbrHJpb9JlXi4hGYVjrESLxR9MtTFOwfrA50QmZW0VOShYK+Qr0qQFTIU3O8bclmPYcT1EBDBWgc; 24:eBSFvZRP/iHrr6MJnWu/InFQ0YF6fqWTLIvRSXi9qf4bKTqJB99E6LCYhJ6K9KS/idL02saRn+qu1ZEVfN+RO+QW0wdStsbmaXg3SV1koYQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:aW6QtIW/NwrKJ4/zo9zCpJYMTKEArU+SI40PrCYOC3T0spL5nrDezHxVd73ra+pDa86smE0pkMuLLUVgD3hvS/aZWPuNt+CCPv8raVjJV7hhbc02mmK9dijj7JWTBYnEVXF6uSvvmbo4JoZhn9OJryE0RQjCpMkJQUw2/sAB/em9fMfrkGSMOBaGIBh/AQNzWoGOWeOpBk7ZymYgjC0bfGWs7gQpdesWgA7iKNXLMXy189vdJfZDKG09x7nr0YedtVNt/vXaRqUWScjwOFGZNn/rFNk/VjaNEDQngIuN+S0VWv7DHm5BFm9lRGVIcfbW5yzH82tHSAX+Bb/PtUqc6A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2017 08:44:07.1482 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v2 4/4] eventdev: make vdev init and uninit functions optional 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: Wed, 07 Jun 2017 08:44:13 -0000 Made libeventdev library independent of VDEV bus by moving vdev pmd specific function to rte_eventdev_pmd_vdev.h header file. Eventdev VDEV PMD can include that for generic eventdev VDEV init and uninit function enablement. Signed-off-by: Jerin Jacob --- drivers/event/octeontx/ssovf_evdev.h | 2 +- drivers/event/skeleton/skeleton_eventdev.h | 1 + drivers/event/sw/sw_evdev.h | 2 +- lib/librte_eventdev/Makefile | 1 + lib/librte_eventdev/rte_eventdev.c | 50 ----------- lib/librte_eventdev/rte_eventdev_pmd.h | 29 ------ lib/librte_eventdev/rte_eventdev_pmd_vdev.h | 133 ++++++++++++++++++++++++++++ 7 files changed, 137 insertions(+), 81 deletions(-) create mode 100644 lib/librte_eventdev/rte_eventdev_pmd_vdev.h diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 6e0a35219..03902e41a 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -34,7 +34,7 @@ #define __SSOVF_EVDEV_H__ #include -#include +#include #include #include "rte_pmd_octeontx_ssovf.h" diff --git a/drivers/event/skeleton/skeleton_eventdev.h b/drivers/event/skeleton/skeleton_eventdev.h index 5b59fcbc0..a321a273e 100644 --- a/drivers/event/skeleton/skeleton_eventdev.h +++ b/drivers/event/skeleton/skeleton_eventdev.h @@ -34,6 +34,7 @@ #define __SKELETON_EVENTDEV_H__ #include +#include #ifdef RTE_LIBRTE_PMD_SKELETON_EVENTDEV_DEBUG #define PMD_DRV_LOG(level, fmt, args...) \ diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h index 61c671d62..0929d0576 100644 --- a/drivers/event/sw/sw_evdev.h +++ b/drivers/event/sw/sw_evdev.h @@ -34,7 +34,7 @@ #define _SW_EVDEV_H_ #include -#include +#include #include #define SW_DEFAULT_CREDIT_QUANTA 32 diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile index 040556fc4..629069ad6 100644 --- a/lib/librte_eventdev/Makefile +++ b/lib/librte_eventdev/Makefile @@ -47,6 +47,7 @@ SRCS-y += rte_eventdev.c SYMLINK-y-include += rte_eventdev.h SYMLINK-y-include += rte_eventdev_pmd.h SYMLINK-y-include += rte_eventdev_pmd_pci.h +SYMLINK-y-include += rte_eventdev_pmd_vdev.h # versioning export map EXPORT_MAP := rte_eventdev_version.map diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 9328cda1b..a246965e6 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1195,53 +1195,3 @@ rte_event_pmd_release(struct rte_eventdev *eventdev) eventdev->data = NULL; return 0; } - -struct rte_eventdev * -rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, - int socket_id) -{ - struct rte_eventdev *eventdev; - - /* Allocate device structure */ - eventdev = rte_event_pmd_allocate(name, socket_id); - if (eventdev == NULL) - return NULL; - - /* Allocate private device structure */ - if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - eventdev->data->dev_private = - rte_zmalloc_socket("eventdev device private", - dev_private_size, - RTE_CACHE_LINE_SIZE, - socket_id); - - if (eventdev->data->dev_private == NULL) - rte_panic("Cannot allocate memzone for private device" - " data"); - } - - return eventdev; -} - -int -rte_event_pmd_vdev_uninit(const char *name) -{ - int ret; - struct rte_eventdev *eventdev; - - if (name == NULL) - return -EINVAL; - - eventdev = rte_event_pmd_get_named_dev(name); - if (eventdev == NULL) - return -ENODEV; - - ret = rte_event_dev_close(eventdev->data->dev_id); - if (ret < 0) - return ret; - - /* Free the event device */ - rte_event_pmd_release(eventdev); - - return 0; -} diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index 3686de549..ecefb94d6 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -495,35 +495,6 @@ rte_event_pmd_allocate(const char *name, int socket_id); int rte_event_pmd_release(struct rte_eventdev *eventdev); -/** - * Creates a new virtual event device and returns the pointer to that device. - * - * @param name - * PMD type name - * @param dev_private_size - * Size of event PMDs private data - * @param socket_id - * Socket to allocate resources on. - * - * @return - * - Eventdev pointer if device is successfully created. - * - NULL if device cannot be created. - */ -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); - #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev_pmd_vdev.h b/lib/librte_eventdev/rte_eventdev_pmd_vdev.h new file mode 100644 index 000000000..967605b80 --- /dev/null +++ b/lib/librte_eventdev/rte_eventdev_pmd_vdev.h @@ -0,0 +1,133 @@ +/* + * + * Copyright(c) 2016-2017 Cavium networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium networks nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTE_EVENTDEV_PMD_VDEV_H_ +#define _RTE_EVENTDEV_PMD_VDEV_H_ + +/** @file + * RTE Eventdev VDEV PMD APIs + * + * @note + * These API are from event VDEV PMD only and user applications should not call + * them directly. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include + +#include "rte_eventdev_pmd.h" + +/** + * @internal + * Creates a new virtual event device and returns the pointer to that device. + * + * @param name + * PMD type name + * @param dev_private_size + * Size of event PMDs private data + * @param socket_id + * Socket to allocate resources on. + * + * @return + * - Eventdev pointer if device is successfully created. + * - NULL if device cannot be created. + */ +static inline struct rte_eventdev * +rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, + int socket_id) +{ + + struct rte_eventdev *eventdev; + + /* Allocate device structure */ + eventdev = rte_event_pmd_allocate(name, socket_id); + if (eventdev == NULL) + return NULL; + + /* Allocate private device structure */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + eventdev->data->dev_private = + rte_zmalloc_socket("eventdev device private", + dev_private_size, + RTE_CACHE_LINE_SIZE, + socket_id); + + if (eventdev->data->dev_private == NULL) + rte_panic("Cannot allocate memzone for private device" + " data"); + } + + return eventdev; +} + +/** + * @internal + * Destroy the given virtual event device + * + * @param name + * PMD type name + * @return + * - 0 on success, negative on error + */ +static inline int +rte_event_pmd_vdev_uninit(const char *name) +{ + int ret; + struct rte_eventdev *eventdev; + + if (name == NULL) + return -EINVAL; + + eventdev = rte_event_pmd_get_named_dev(name); + if (eventdev == NULL) + return -ENODEV; + + ret = rte_event_dev_close(eventdev->data->dev_id); + if (ret < 0) + return ret; + + /* Free the event device */ + rte_event_pmd_release(eventdev); + + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_EVENTDEV_PMD_VDEV_H_ */ -- 2.13.0