From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0040.outbound.protection.outlook.com [104.47.37.40]) by dpdk.org (Postfix) with ESMTP id 6F83E37AC for ; Fri, 9 Jun 2017 10:38:04 +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=T9WLJD58x5NpnhqS6+5mSsTkay466kHtE63SY1mIS+E=; b=SxIOBY/lnmhGN5nhycBcFt+YfLiOmi83yfgitaKVJQcLRcFSw/5bVvGspClGHj1XYCWMzhNsY60MpDrH+Vhqmkfp8sFXDKsgFv1G/Q0nNUJJS0wek7F7nLCFNip+nKSClYMFuYx01H+t2t0RiMbYvjF9Im6gzvoxRSabuSpE4eE= 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 BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Fri, 9 Jun 2017 08:38:00 +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, gaetan.rivet@6wind.com, Jerin Jacob Date: Fri, 9 Jun 2017 14:07:28 +0530 Message-Id: <20170609083729.10586-4-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170609083729.10586-1-jerin.jacob@caviumnetworks.com> References: <20170607084333.6338-2-jerin.jacob@caviumnetworks.com> <20170609083729.10586-1-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0113.INDPRD01.PROD.OUTLOOK.COM (10.174.144.29) To BLUPR0701MB1713.namprd07.prod.outlook.com (10.163.85.14) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR0701MB1713: X-MS-Office365-Filtering-Correlation-Id: 674b981e-0f24-413c-a8c5-08d4af12d7e1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 3:MRH+umi2xYdfwJch2ZubwsO0EaxrQgNO/cX424B/V2ml1+quG+kbEy8b47I1gtYofYMATEyiJecVQnsYVECiw6LuXub3GRBwPp9Y/oXtJfxa9nIORUySNvNy/L4NKwwvoMCAlICE7h8OfopxpY0QOZZpaF5PmSQpgmDLTS71i7LS26oGU/ir1ppngC+jfB2hsvO8v+wqX/KW0KlEsazgv/1EGxyTQyLOAWGq6qB85uubRVPf2b1IE34+ieujI6TJAoHKhyrfch88A0uP56a2k6lLOeRfo41bZalrsCiEptckcjGF1FBKdJDMtumz7sqh2XoM4Q9RUFdeDMyvJjgFTw==; 25:T1AiDStMDHawFcfyIiWKz2Avyo8we5TI6Cj3a2MyFg4H0qtkzPY8tk54cWm198KV8MKJ6LBhFVndMf+2qzp1i2UtwmETLlkgozbabBDYBQNPnjtJd0Qaf18HHnRSTFIibufSGpWVjt68u6qDHbmYzhsivfEHAKywUEaloXCMNpVnxu9sNiwFHmCXDhaYmsaIayeYzxKLpX6N07uY77SULTWIfKF1ybx47E/w4e0UxnqIwzftrrrD6NRna5Be47/Uoi+/YviSTDt3wI3KxpbqWswwPisXuVfAjLirY4DyZREg8yf0pQKPKMBr6OjhBCwTToUK1g2N7uxz0R4fHoheUaHeOVDSjk9DHbon8L5UkoRlyeHXid0wNoO78wKZhgcRnnSn70ff5MYO83CpTF19XqN4N1w2KNIZQAHCnwCpgsyBok4cf1opDlD5f0qxGsIePEriMo3009nPshkhwngiPsjts7caZQJBIB+61L4Pfbw= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 31:YoHs5j5OyPXdkbqmGLADQ9hqeodBw1OmSnbzyWITVB632Zqg/exOJ/3mslMEfaDheEh9FFHfPPoCQz/eIBb5BJujYKE7tE4kqpcg8dOTLD+9CI2fAw8ajSWQeCy0F7Elf7Nuf3bNnkAhNSD4vyCiQNdwqwnuXlEFIdEdEtRdA/tFlZOjVoefBEqzBqMZMvqnmGmloL8y8zjmsWdrUqKqXJkLRNnrD/jZLGRS1+M91lI=; 20:RfKLMpXt9P8CAmy2f8af75PbJqpXAF32djdF6MRsfYv6lNa3uvrb6lxFbatg9pRagW8oq/WqouJZLE1PzyqlPrIdajKbd7pN5iSTnMVIUb+4BbRA2okqg/5BSaynMDhnBTRO2negMi7yKDTk7ccIuu/+sb5FSVuB27RrMYe517SX6I85hUyGWGeDGy4pTjB42ZcFSxvnNmqWjPrY3rUD97wdZfnIFega3+7LI0BrH+LW3iXaqj9iPcPACsRrm1xCiMzJW0hPiTo1h3f8XhhCWWp9Pto4G//mhz/Oftt5CfCLt4G2S47nAcibZ3vmPrmXO4ma8bsEcqv9d5RfscypWPKbHXn1ccyL6vxGSTA31WQb3BDk1UeSf4KogCVP7tjGhssO3TrbzhDSvY+sCsYfhePtvLLkip4EthH9gPfzCv3iW7w3AhWQbie0R5hqRoNR2AQJAInA7JPOuD61YmWznyYXYnrpjrgr9uEBp4Klh86zyTrmkc6NQW3ZEgdgje5rco2zwrYRVVkjykjvkMLi3fwkfeESSq0+CQ+2398NC9eio7JsxQj5pd4vktWBtiCXns8B7lOtRDNeHWj6To8cgOyKdMENoSwfI3q+5FjGuvY= 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)(93006095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(20161123555025)(20161123558100)(20161123562025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR0701MB1713; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR0701MB1713; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1713; 4:44q25iXfax8K67hp08M4IcRFJnibG9XqYZadPU+A?= =?us-ascii?Q?zBpkhzWrkKOVPEg3MNsQ+fivUudBaEH+SNIFs8507Qv86zADoQ+pFT1UJ1ZO?= =?us-ascii?Q?OJWSW+QCfJ3vH8KwF8T93LMQoci7HKt277cd861ScW3PoOeFkHraIFRLqQZe?= =?us-ascii?Q?+hSRUUBi9TRtQMg2S4ugNVt93xJ6YElF2mdDKTO4u9jzbNqd2xCK4RwiNY3u?= =?us-ascii?Q?M6k2U+V5TBrSCStRQpMMgigwZkw8DlzzDjCx6jxqlJ9i54i3epc3YjQ0S2mQ?= =?us-ascii?Q?zUNGsYSxHfytUqkCQ6iBXaOBXvjBwdnqso+mxNKDRa0lEdxQIU9otpEBxIl1?= =?us-ascii?Q?QcNvAM+WbEr+IAl54frXNeooQw1g3Yah6SGUqC0p+S/t/FRwzr9XuLho4P0a?= =?us-ascii?Q?bDYK2hRrAPJwwWrGZeSBWOM6cq20eM9dYMq6oJ/8XoN8k4ODwJjki2Iu8ffC?= =?us-ascii?Q?HcCiyLHEYXXN8RQnXQMJYJS+iqXJRvR4PNpxd5I7o6vhaDaDV5SiNRIFRPhY?= =?us-ascii?Q?lNNQWdDknhXXsqUpzMZqGe7MptZi69qdwxs7OUqkA74gQNMlHAnU5q+b25+C?= =?us-ascii?Q?sdx/SLxV2UG87aPQpnbjUI2+hBvYMXZ2ZZ4r2lP0z2LIAj5HQq+0KUXgPT7D?= =?us-ascii?Q?va33ySHtK5yDWtkjX4N04pC0Ao9fZ3dtPjqr+rKIe2JmdhO5TpZ6ctyDRBjK?= =?us-ascii?Q?Uhr5cjIRK++6P+vzdGsTHJYBnlfoay2yGVbukLASmQs/zEoJruqwsc3evkXM?= =?us-ascii?Q?GXZMExzB6pKTRuRgGR4e4VeZmDCFlRhUL8FN73EtT2t+aLbnetIHlrw0O7F8?= =?us-ascii?Q?8kCvc8itTd6Yp0mOFIaXlmzEJsPLmoJIg8S/VUAYuvO/aNrci5lwPia0Ue1V?= =?us-ascii?Q?eJugA1o67klfRnnQb4UIn55Qnqag2wFETIIERvvKvPwgMaaCh+kdC7DhIITC?= =?us-ascii?Q?q1xfcVIFmTlzBcaAZxGaZ5rRcw6CCG4q2cZpRgbj8WynscUW3uj3Am9c64o/?= =?us-ascii?Q?6UWFVHZgRMjesknBSYgzAJ4LVz5z/1RgB0WlvlKEyNHxmzuO07nI1kFzI2Cl?= =?us-ascii?Q?usOpWCd0sLMfO6hMjUokm+AYcMmZbHGewVWUf2rULbsI+x5iCNOtjnO7++pa?= =?us-ascii?Q?BrN88amh8hWPip831DX8y0/1+xb8HLui3YL3TJAIC5GtQtsRi9r9TA=3D=3D?= X-Forefront-PRVS: 03333C607F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39400400002)(39450400003)(39850400002)(39840400002)(39410400002)(48376002)(47776003)(76176999)(8656002)(66066001)(6512007)(5890100001)(2950100002)(25786009)(4326008)(53936002)(6916009)(5009440100003)(3846002)(1076002)(6666003)(478600001)(42882006)(6506006)(36756003)(6486002)(50986999)(110136004)(2906002)(33646002)(305945005)(2361001)(50226002)(81166006)(7736002)(8676002)(53416004)(107886003)(42186005)(38730400002)(72206003)(5003940100001)(2351001)(5660300001)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1713; H:jerin.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1713; 23:FknawxojeGQBkQMBJ3ZPBqFcmSSI8wq0ESvSWDO?= =?us-ascii?Q?f2XgnMrEqefberjkXis097kjqrdDfTA0bPXe46ACEQLYTpxm0ZSXapbQqZ2E?= =?us-ascii?Q?5qGqoa7+fivwxVe+b6u8mNGY8TRqvZ+bIUnDsks9C/i577yYJWi3FgGvOR+t?= =?us-ascii?Q?kbcz0paIzYFXvLoHRc6oL4IAdD4yoI7JGBevfeNA6c693pDEHUaH4guAxVeT?= =?us-ascii?Q?BAnaN7Mt0qP7ekWYi+IAEyIMfdmfVDS+M0ktB9WUiD36ndE7eyXcSP6y3YrE?= =?us-ascii?Q?oYg3Azgi1Za0YE3nmTYojLzegxOmBoT3E86ONm9XZlt9huuAoMCIu466A7yN?= =?us-ascii?Q?lJ6znmO8pX9gQgjlgQ+5PF3yORT4UFu/ZdXR0kc8UVLY5ceutmcdkcK3tjR8?= =?us-ascii?Q?WquhiRmTOcrXBwh+ZuePNTUiS0Sb4jwb2/FdFzSkL05zzYI6pua2O6Op4I4G?= =?us-ascii?Q?hn/7qjbuJuTzUEEURfi2ceOuYT44Lq6m+aE5W+7N/jISJEe+6PlaoHsuhvPG?= =?us-ascii?Q?MGHb/2MZeAerVMmPoGZv0Spf3W8xZXAjeZPEJzm9vEEowCmmTbeCq4w9YZpA?= =?us-ascii?Q?0fTiDTsQwinmtmsvGq1u/lrGFqW432zSUUA0sYz1rEY/F+vVXfBg7YCOWH5G?= =?us-ascii?Q?C7J3rzV6x80ITePZGE36xAm1EqVeqOWEMfH7YpY4f+c/rsVOT8zttJifMAty?= =?us-ascii?Q?tiing4jWF9805b112pW4e0N7j6HuVnSqhCUlKM5yo7AZm32BVj4rd/oq4PqY?= =?us-ascii?Q?HbhJwwB1TwUOrcni0xpKzKdfao/YfKvUAitSdvwyKtqBqdFYew0f2cTy7ICV?= =?us-ascii?Q?iEmiwdOsb7CpDzJp4TY2tuWyWqEsYHR+1sdpa4oVRp+oPl4UOUW6Y5meBi9f?= =?us-ascii?Q?C8xus7XAoZevL8fmTj0oC2Ior8OUheoN7Z6ucASIMjPem8ZuyFfXZ4ZY+lQn?= =?us-ascii?Q?IYMdbO/znZ0o3x09eVfoK1HPmG4j+xELUj2JK/0jIXwTGgvGKVIJvpYegRQ4?= =?us-ascii?Q?YcAo2djSJhCr8+NqqjTnXnixEm6tnI9sVbPX+O9r7bS2ArBfq7MpMm8HRrwF?= =?us-ascii?Q?V7BJ5PjWchxtwPPSyiZm+vxkHrYDd8qUaW8H9YUWWkeCtggSvG0ccOCwfvGz?= =?us-ascii?Q?frvTJPPCZWX0EE3yQe08Z7TfPAZpJYlwoMALRop5r6IwIl+661eHboOb8xSR?= =?us-ascii?Q?poAW9ZX2J+FXHFaM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 6:SGSrUcWKwwzhSz1jaOzCRmVkph7WHeSXOn/Cz0PR6ccTLhF6vzI5XhDn6IvFxQ1rRRjTGsVabm0hvjIhmre11fJer84gIIfaSaaQXARQHjHTHHJQ+fQ0qMD+rODWSv9DQcIBhpOoqfQW09CQPE4vdgzKXvZRpEqQeg6hx1kDIfFq55r01IQdJMIKFf7ZPnVKILpBRZMGJANYsHbMgc2HGJ5z/2/rArdS63fTg2zn0TmotMnRpAyPu5sMxsjPpjVLwgpocsdknkP1vALyCq/J2W/8PJvvxz9qZLnMRmDUr+2NJPPihlFA9Vz7UwWoiLHNoxse6qy2ek0LVfqIyThlQtojh95W1APT+OQu21FOHWCBextXGB41vHNXdC9asT3mDAxbqE6KZxQhDrcPjWpl1Fn8ZV5pXdL8/lW9SdNkw74DjyprBomt+urq/VfIHk6kc47Q6pVbuAgZ6xJ1fBQrA/aIdTh/u2jJccHumydZMF3UjYjXxHlyD03Q9L4ymVq1cxq6I32pwu9y43ItRO7z9A== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 5:eB3dN1+JpwGx36gDISrLzEDcccbpUESpaVGytiBRuZqvLgkH4DWwuAasNQhFlT3G/W0P8g451wS4CwR9MqvjsaNOeYixa2yUlFuMkVWHhdxhQEQaIcBAfl1ld4l5rYpEy7RJVz900LGVHY+cUF78d5AxX3rlvPik8XCaNjNnh9rzj337IcLZWxcgvfI/v/jGovAWpEncGXOEM/DgFV54bljSz8L0q2DXVJzV5gDPMWgPimSqghJ2wsGz6CEDvVIG9poFbv/cwUPrm+ZXNEtaZDq/cPje8WRso53sEhydX5cxgxam3+n43VRiW4Rztn3CvnTEJnFiiz6Wt90ohxBFj7UI9FzPfhp8mtLxmZs4r+cSN7OlirMq4oeginYIhtHg+OjlAxcYtQ4N6mXp3dHVrCcJ+AVb8zXB3yKeyOH5SiS9sjXsY+pakVe9kA7fJI3fwU//gtEIHU/TiZXXKr6UZBcVJezBF1+2c9QkQmj/uTJNORRpxvCtx3RdSISq13hp; 24:WmJuNc34A+ytMDIYHSb/Hn//WPzOUx7rxty/v0O/ZcdksbhVmGd8CF5vL+3wGIUk8Z8WOllYOWrBwhCZDeWFO+PQox4hOBcXuZKRRb5Jprw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1713; 7:7kKkX5z+uPA1qIEBBMzeRsZwqAGbBcWYRW3aoD3KUnVIKiLGY3pTNKcAuJN40uVdVSTa3/DOxtY9QuYDH37vDgoqSpR44UjlXlZ7e2o0O9JVtI3ILDIXxiQ3XPf1lXRhM7PXyQF1/wEsqzBVuQZwHa3+R4+4yNnfI/ya51KHysPglvwhU2ryF2V4CA6hTNfH7gp/aQTdE9abC3yOV60nPbK0jstdacS0gAaxEKh6Y8RpkOerjwBymU/3T8crs2ZrJ9S853jcOGMFojqw5rOUavYYdRAH9GkvdZPtBuQ1uuAYhM34tGa85vVjWnSC340gucII8b+XbRefuXd6F0asYQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2017 08:38:00.9894 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1713 Subject: [dpdk-dev] [PATCH v4 3/4] eventdev: make PCI probe and remove 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: Fri, 09 Jun 2017 08:38:05 -0000 Made libeventdev library independent of PCI bus by moving pci pmd specific function to rte_eventdev_pmd_pci.h header file. Eventdev PCI PMD can include that for generic eventdev PCI probe and remove function enablement. Signed-off-by: Jerin Jacob --- drivers/event/octeontx/ssovf_worker.h | 1 + drivers/event/skeleton/skeleton_eventdev.c | 3 +- drivers/event/skeleton/skeleton_eventdev.h | 2 +- lib/librte_eventdev/Makefile | 1 + lib/librte_eventdev/rte_eventdev.c | 89 ---------------- lib/librte_eventdev/rte_eventdev_pmd.h | 23 +---- lib/librte_eventdev/rte_eventdev_pmd_pci.h | 160 +++++++++++++++++++++++++++++ 7 files changed, 166 insertions(+), 113 deletions(-) create mode 100644 lib/librte_eventdev/rte_eventdev_pmd_pci.h diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h index 40c5c5531..b76a19925 100644 --- a/drivers/event/octeontx/ssovf_worker.h +++ b/drivers/event/octeontx/ssovf_worker.h @@ -32,6 +32,7 @@ #include +#include #include "ssovf_evdev.h" diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c index 34684aba0..c69c2168e 100644 --- a/drivers/event/skeleton/skeleton_eventdev.c +++ b/drivers/event/skeleton/skeleton_eventdev.c @@ -43,10 +43,9 @@ #include #include #include +#include #include #include -#include -#include #include #include diff --git a/drivers/event/skeleton/skeleton_eventdev.h b/drivers/event/skeleton/skeleton_eventdev.h index 1ce62da7d..5b59fcbc0 100644 --- a/drivers/event/skeleton/skeleton_eventdev.h +++ b/drivers/event/skeleton/skeleton_eventdev.h @@ -33,7 +33,7 @@ #ifndef __SKELETON_EVENTDEV_H__ #define __SKELETON_EVENTDEV_H__ -#include +#include #ifdef RTE_LIBRTE_PMD_SKELETON_EVENTDEV_DEBUG #define PMD_DRV_LOG(level, fmt, args...) \ diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile index e06346a66..040556fc4 100644 --- a/lib/librte_eventdev/Makefile +++ b/lib/librte_eventdev/Makefile @@ -46,6 +46,7 @@ SRCS-y += rte_eventdev.c # export include files SYMLINK-y-include += rte_eventdev.h SYMLINK-y-include += rte_eventdev_pmd.h +SYMLINK-y-include += rte_eventdev_pmd_pci.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 74a2614c4..9328cda1b 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1245,92 +1245,3 @@ rte_event_pmd_vdev_uninit(const char *name) return 0; } - -int -rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev, - size_t private_data_size, - eventdev_pmd_pci_callback_t devinit) -{ - struct rte_eventdev *eventdev; - - char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; - - int retval; - - if (devinit == NULL) - return -EINVAL; - - rte_pci_device_name(&pci_dev->addr, eventdev_name, - sizeof(eventdev_name)); - - eventdev = rte_event_pmd_allocate(eventdev_name, - pci_dev->device.numa_node); - if (eventdev == NULL) - return -ENOMEM; - - if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - eventdev->data->dev_private = - rte_zmalloc_socket( - "eventdev private structure", - private_data_size, - RTE_CACHE_LINE_SIZE, - rte_socket_id()); - - if (eventdev->data->dev_private == NULL) - rte_panic("Cannot allocate memzone for private " - "device data"); - } - - eventdev->dev = &pci_dev->device; - - /* Invoke PMD device initialization function */ - retval = devinit(eventdev); - if (retval == 0) - return 0; - - RTE_EDEV_LOG_ERR("driver %s: (vendor_id=0x%x device_id=0x%x)" - " failed", pci_drv->driver.name, - (unsigned int) pci_dev->id.vendor_id, - (unsigned int) pci_dev->id.device_id); - - rte_event_pmd_release(eventdev); - - return -ENXIO; -} - -int -rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, - eventdev_pmd_pci_callback_t devuninit) -{ - struct rte_eventdev *eventdev; - char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; - int ret = 0; - - if (pci_dev == NULL) - return -EINVAL; - - rte_pci_device_name(&pci_dev->addr, eventdev_name, - sizeof(eventdev_name)); - - eventdev = rte_event_pmd_get_named_dev(eventdev_name); - if (eventdev == NULL) - return -ENODEV; - - ret = rte_event_dev_close(eventdev->data->dev_id); - if (ret < 0) - return ret; - - /* Invoke PMD device un-init function */ - if (devuninit) - ret = devuninit(eventdev); - if (ret) - return ret; - - /* Free event device */ - rte_event_pmd_release(eventdev); - - eventdev->dev = NULL; - - return 0; -} diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index faa6989b4..3686de549 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -46,11 +46,10 @@ extern "C" { #include +#include #include -#include -#include #include -#include +#include #include "rte_eventdev.h" @@ -525,24 +524,6 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, int rte_event_pmd_vdev_uninit(const char *name); -typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev); - -/** - * Wrapper for use by pci drivers as a .probe function to attach to a event - * interface. - */ -int rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev, - size_t private_data_size, - eventdev_pmd_pci_callback_t devinit); - -/** - * Wrapper for use by pci drivers as a .remove function to detach a event - * interface. - */ -int rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, - eventdev_pmd_pci_callback_t devuninit); - #ifdef __cplusplus } #endif diff --git a/lib/librte_eventdev/rte_eventdev_pmd_pci.h b/lib/librte_eventdev/rte_eventdev_pmd_pci.h new file mode 100644 index 000000000..18028e36d --- /dev/null +++ b/lib/librte_eventdev/rte_eventdev_pmd_pci.h @@ -0,0 +1,160 @@ +/* + * + * 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_PCI_H_ +#define _RTE_EVENTDEV_PMD_PCI_H_ + +/** @file + * RTE Eventdev PCI PMD APIs + * + * @note + * These API are from event PCI PMD only and user applications should not call + * them directly. + */ + + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#include "rte_eventdev_pmd.h" + +typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev); + +/** + * @internal + * Wrapper for use by pci drivers as a .probe function to attach to a event + * interface. + */ +static int +rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev, + size_t private_data_size, + eventdev_pmd_pci_callback_t devinit) +{ + struct rte_eventdev *eventdev; + + char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; + + int retval; + + if (devinit == NULL) + return -EINVAL; + + rte_pci_device_name(&pci_dev->addr, eventdev_name, + sizeof(eventdev_name)); + + eventdev = rte_event_pmd_allocate(eventdev_name, + pci_dev->device.numa_node); + if (eventdev == NULL) + return -ENOMEM; + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + eventdev->data->dev_private = + rte_zmalloc_socket( + "eventdev private structure", + private_data_size, + RTE_CACHE_LINE_SIZE, + rte_socket_id()); + + if (eventdev->data->dev_private == NULL) + rte_panic("Cannot allocate memzone for private " + "device data"); + } + + eventdev->dev = &pci_dev->device; + + /* Invoke PMD device initialization function */ + retval = devinit(eventdev); + if (retval == 0) + return 0; + + RTE_EDEV_LOG_ERR("driver %s: (vendor_id=0x%x device_id=0x%x)" + " failed", pci_drv->driver.name, + (unsigned int) pci_dev->id.vendor_id, + (unsigned int) pci_dev->id.device_id); + + rte_event_pmd_release(eventdev); + + return -ENXIO; +} + + +/** + * @internal + * Wrapper for use by pci drivers as a .remove function to detach a event + * interface. + */ +static inline int +rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, + eventdev_pmd_pci_callback_t devuninit) +{ + struct rte_eventdev *eventdev; + char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; + int ret = 0; + + if (pci_dev == NULL) + return -EINVAL; + + rte_pci_device_name(&pci_dev->addr, eventdev_name, + sizeof(eventdev_name)); + + eventdev = rte_event_pmd_get_named_dev(eventdev_name); + if (eventdev == NULL) + return -ENODEV; + + ret = rte_event_dev_close(eventdev->data->dev_id); + if (ret < 0) + return ret; + + /* Invoke PMD device un-init function */ + if (devuninit) + ret = devuninit(eventdev); + if (ret) + return ret; + + /* Free event device */ + rte_event_pmd_release(eventdev); + + eventdev->dev = NULL; + + return 0; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_EVENTDEV_PMD_PCI_H_ */ -- 2.13.1