From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0085.outbound.protection.outlook.com [104.47.32.85]) by dpdk.org (Postfix) with ESMTP id 9E151377E for ; Wed, 7 Jun 2017 10:44:08 +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=KtK0vyOap9QKKDXJo91S7XBxJ4u9hwcic5iuFYykuuc=; b=Hpubpd79Xb24CKQoYUh825Lx+KkNc38YC7wavpdnRYGUVydxx/MXzI+b2VOPk3qXNyfcoSZZA+OmMZJ5wLBZXoW7lJb31MS9m5VsoVc33eaVxdkW61FRXbiqn5mYd1gORMGCtm5AEXj+DWRWyQp62OnvuB05Ugz2sWcz1k8kTB4= 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:03 +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:32 +0530 Message-Id: <20170607084333.6338-4-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: d98446a6-c0cb-40a7-d2d0-08d4ad815b8a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR0701MB1714; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 3:zkrALEgd+ULtRHQxabjioO5mZdDHyB0XnwEXpHWI74WR5xcddWG59SqmRwFxCzqBfc7xzqL1GVQJmeoYW+p1DtmY8VZtv4By8eXFme1zsA8pQ3f4WW7UXERh1oOjXfLShZqoUaCrVPJdbz5MRX1rmtB0WKh2WCBIiUI1gPx1Px1ECr6GsjPjoffNdWv36TENGm+0JUiJPbj1syXSkCoVTHPfDiR7weuACGkJU/jVVqghLG6zIqSBOZE25On51Ls4pR2D/KSiblH/XbZB9EypdFUnO2g1UH6NErA+VqISVd9Wox9A2l2ayBjhgzE8eR4VDd3KFJiiACONVK1VsWqUTw==; 25:zzitJPhsad6wiIrVnHDdSPe0U58MVZo191azNXbwDjVma8wRNK0LmKTO1GRoXSjV9102BPSmnRcfJliRKFkmcWPLDomy09lsi9frIYZRBLshBKM8EPQFpjY1kH0F67JnBZuwKBLitPmXaU9WuNUGPa4VK7oEXB7TyOhGuLTegJx1Cof3axdJ4COp2lzOZutc05kfXnt3McPTIfJFP7YIcBHrLGREKSkx0A/aYpHK/l+WsZSNlquLcri8VV2GI6UgDic9T8yO+KepxD39A5BMuXgaLHeUxzrRgBpqEaTYS25XR7DTsD/dFhtZpBuMjaWkJNTTO6jzwkcCe+HI/JJixvBpr1DxyyjYOoVV3KRzh7X6FcCOTwi4AKJXtPoYuYOOYoyzDBEQ2/2Tym3rwerm4vvWRqGoJbtR6Sc0r+YRkx/LdR+EGVzcaLSoFXbt7hlWPNIpAgFTgZWYnk0VBeFR0fPhZXYGk+0E/bM8/Addzl4= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 31:RhZna2OruyuDFrnMFCAr6zbBuOd7tfsvc/6MiDMPGRcl4ENgpkkg1VHlyPBAFA/nFniCC7k5wUjnfxWZU80FH/x5z1WVfLtyGm5sV7vCOqhJ2OA7x3QSSuObYBJvXXLh7dkSCuBBhBxuBqVfLQxy5630exiEOULBd/5gElRtFdH2+DB6ia0RDAvwKbvu913iW09ort5lq+fSyS48y5lLpJNc+6j3PTcA8qwINqJB/zI=; 20:X+sySVHB6gpM/mvJZ871DsCBgMMQ2aH/l21sg9jJyie8x33xK5h9pzmtmGEG2ik/FqACaR920+duyvfgXeXH1pcYuoaJiIpq6giatN6/zIH8s8rTtL5okwVSXNmysy8WShFA/9P6UPpUeeUPcZcodjtnobgAkksFuufmF8NyR+rkwEW6X+krxeN85gF9XU11RtmUh/RGrIinOkEI7vOBzrQeplremUAz9TJ7+/8mnLCynP11ESI3I5q86SgUCHYDPvNF0gmgCi1lFGN1KaDoSM/FMYiyuFVKUftvZ+D6gW9kVMAjsUhsSLGc1hr1uycvy0rdTEIqlig8WAAf+eN3NpRTdKeEz5quPhO7BKEBLjqmi+wZcUi1a4CXRhlPCpm8NtkvuvM4c2S1CFGpbdfwpKhJj2zjBFYdbUT7U7GQXulqm1Izx/iWfm86BttBiy9Hhgqhyq/f0thhRvo6twhXoVzCxxbUp2yUwhqQTOnbpeykDEM4lFCici/aiBZsqiExdQNcKf+2RCfGrWf8G/9fv3DaYtrzLeez1AUXV1ChMT8TGt75NUK2bIb+TlEei6iswu3F9ZdoOb3QC2GJ4NQJuO4ExVnkAMWFFNyWPLffv8c= 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:2lhqf3i3P+2ORWVMhwO9R4T/aA5yjNHZJ7pSHw9P?= =?us-ascii?Q?BI0jfYLpkp1P0GMx8h/y4m5PBYMh92rYBAIONv2dl2NYumzP/4JnTGkr2AKL?= =?us-ascii?Q?90sOYpQ+ojGUI9eLnf030A56PqdRJFlgmjKh9w384qnkb6hJ0PdEyAwmtR/l?= =?us-ascii?Q?vtKt7awbHORYUDQ6srSItjsMSiVF2XWoYrWxbloEmawyLxgMiz2LmLaY/rEn?= =?us-ascii?Q?0m4OmW7hHPYrEL/XmvESOlRUWnYS/noGNbumyZ9zkjZBYG4uzFIHFcdA5lHz?= =?us-ascii?Q?hePmHbpqqZFWqLstc3oFFrOM2HMsKSeFrcEzissa02h/O6v078ytzfp5Csar?= =?us-ascii?Q?2KiA84gGobnxU7vq5Slphk6YjZ6CT79XYhqK0Q8VGdzvozZiecsH402r3UJp?= =?us-ascii?Q?mtEMOseDHgRMQcwwp2c3qambrZtH+swhfNPen0e+cUsLuMHhVFAB7He0RwcN?= =?us-ascii?Q?T0TnmA1Hpec+W905TWhVxIKrPNz+oPlV9GgSbHhK+aViuToFGsJqkzSMr3+7?= =?us-ascii?Q?Ps9R2jOWGO6aY9cnqy2Lkio8x4K7iOgbRi2KqbOL52bgsWthw8eVFhiuJ+bL?= =?us-ascii?Q?skxDVH1mJLxMDwQ/CeD2Z+Stl/P799u1wmKoB88h0Gr+6aaVreW86X+WZDEA?= =?us-ascii?Q?5pOiVxWwsg/HEPRvb3jDq1FC7ioHb8U5nLI9Ifn3b8YCOzIXImrTkO+q981Y?= =?us-ascii?Q?b0jdRQg4rn5NAhNqMl26lw2bFRXHe+VeYw8Gy0C5dpqHMmkG7SLNFNhuWn98?= =?us-ascii?Q?apLCbGX3miidINM1yz7MZ0b7s4tEd7CVmvrmrrrRiBjITzTsKN8iWyMsenQv?= =?us-ascii?Q?R4GbLIgiBazk1KnqVsOepIpjgKtGzFtD9sOs2aRYKFuXHU81PNJaVkAyCMck?= =?us-ascii?Q?/Mb06V5jNI0UMs1umlrETPyabakRXL+CQ3v/jgHEkw0+qCpj7wd/rE2R3Mwg?= =?us-ascii?Q?QHUhJU7MKhwzeIFtfyDAc3x+rjdM2Z2NT+h9tvRGZSza3dmm3EugrDMESeO+?= =?us-ascii?Q?0tgYJH7Z0WIhYTfbOuT78YHejfFP0x9snQK89Ru9NQcPqhs/VmtTrUbFxhSP?= =?us-ascii?Q?varlrhA5kmH1JcmppgXHSWR0cblsl7ZeTX12hL6VyqMXTav5Dyvcu3RI/SYX?= =?us-ascii?Q?Rbctq5hYtJUQAba8qmQU0X6jT88exS9KXIJEZx4esjFIEWRBbRe8vw=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)(1076002)(53936002)(110136004)(50226002)(81166006)(8676002)(2906002)(36756003)(189998001)(6916009)(48376002)(72206003)(50466002)(33646002)(5890100001)(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:tp8fWYCnK2P4c44RuqId8RGK56Bh8tMQ6uEIQd9?= =?us-ascii?Q?J2qCQM2F9qy+UFODlhrUGJCdBP5lX0s5jgmS8XxnSxnHurztqCTcBXI16/zN?= =?us-ascii?Q?oncspv6vgPzeFmaGrgqJ7zQARNK5mSlxxf8UJqc7DmS6ZyCv7OjvUB2jdIRY?= =?us-ascii?Q?WhXFYnPqmMN4e2H7RUDy+BfDbK/fMyWxI1yRH+L0mWraOHB4YNndngTNd1Uz?= =?us-ascii?Q?opb2eY234ixFNF1f4huPGcD9yzCIdUyKMXzw4p4P2oAlflPO4tLFwpD7QWkE?= =?us-ascii?Q?2OEr7KyjzFtjcWVw+vNd3w6r6EXqp4KiRAdeNVVP5MwuvYpOINCAWNSDN/ZG?= =?us-ascii?Q?BxkOzojUPBv5wSyNJ7ZD3S4nwHSNAWKdtPD2fpRYrP5Jc8VOMWAPdTB539z1?= =?us-ascii?Q?+bjT8B/Z5HwVdxoNnDP/AoECh+ndhEJSA/0+f0UCO4hN5qyMk23Cf5OG6EDc?= =?us-ascii?Q?hfWVaxNqTk+2c7/JTOBddDTmTyTx49nQLNqGWCRcuDKroQx076lyCoxcWQRl?= =?us-ascii?Q?BYBVgafJ6KVTHQwc3T9ldyMl3Uy3+DsRFoMIA2OwTxAH7s/rMU8oQ038JbMI?= =?us-ascii?Q?7hGk0U9Ty37jhguPIiGho6Fx2Wxy/frsw4zttArNziPszdtCknU+XavFiAxf?= =?us-ascii?Q?dS42Iv6Qs+3QmfgnLzbzRd1Kc81krqW/FputiNvYUN/6jEjIsyBXRmz/lHE0?= =?us-ascii?Q?b6/YGos4WUD3+gHct5QlwRWy8bQs87XsaCIiTuEe1QBnGy1LEByji4CiO7gD?= =?us-ascii?Q?V5roSSNfh/rz7DFG/wAloVsXMHapTv5KUOwwO7XK48RiprTFg0k8RJtIdBGH?= =?us-ascii?Q?zLgtKSM9v81MAvpSQm7j280xG2wyrYWGu3XF935o1FPJUz4Zw/5RUTf3EqCT?= =?us-ascii?Q?dqXzWGJuI0p1NKZ6FBrgVJAiYgIQmylv+rd7fFwvDl6IlAnkPIdVlewAZuFf?= =?us-ascii?Q?FibA1vCHMn/Z9x01wgDWsmUCMyhSjUwJHKfZU62vN9vjqocwZsur3An+TnRp?= =?us-ascii?Q?Okh7dLjEbNwdJeyC9BoZAS2VdflP/tObgwgRC2LByRCM3WzGrdN7Y9SZiG8y?= =?us-ascii?Q?cW74vMMnkqmNV2waHrx0OafNXfJgb7J9+blWAnDT1CG+n7e4eMk4X1Ntf/2k?= =?us-ascii?Q?mcBRbk50FopdNuKFaZbFtRmN5L6TZfahWluO9ul/vy2o8f89kkQWPDinjxPL?= =?us-ascii?Q?IQMtvofF/246xAJsyeaojg5JrzZ5CrNshk9i2X4JJF2pS+vi8wjGvZqDk6A?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 6:S50P/9//M6uaLT0Mgwr1mp7LBpxEYCL++sUtIvinyRxnVQbaL04JoYTjNdpXCP4+uY5sCCJ2bW917fH7J/8yqOnziQd51Ss4Fs/M+QV8WUR9I2UlhMKjXIV8k/sR6bo202V1RaEWrqjPSq+8w2mVc8sHOwhjE5FgukgSfI92va+RV9Jmld+OTSxS89SK2bgx2VZwxuxqj9SC+qdkpn+crDY3F432cGrBSWwFo6CNCKYFsFOhdkoP0GFf39+RoFY2H9YC8A9YlO5yQzUceIi7FnnHH0LAWlEkUASbXEiQ4fAebK+CpQDQOXPg4JPiplfa4tmGWoQ4qTOfe6lxhTw8O2ANKEemwr+PpncsNL4rDebBec2DUsuYGpj3qGH3VQkhtqrQBuqO84nd59aJ8Zra0GNxChBX/QkapyWk+Yb+hi80X8HvSvPs0J1BE/qe2nDjm439WyIFSPxgUZpRCJlty1xSktMuOnldD5SDi6rI32On6oT0PdYwUEF/HlK77yU3meljflrBapd4mrcTkgfp+A== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 5:0Ej7LJ2EVUrkVqIMIF4WeXVCvd8pQr/3CNyYZQ6aJSula6GQexpTXfafv8Zp16p8h+jtFPPHvcoy5cW7TQLglhlAVOkJ4Vx4vEEhipwEAAFNJ/rr7GpsXg7FMNf+VoKNrVCLBx5iAT5Og29RaB9Mruy2qr0VYhpOIhBIOPmq9Zsc2jJlVCZwtxjU6wYA2srSxaxv++tO7mMQs69SWrv551gdg6rc9HKLfl33fTFugtp9DWp3j67F3o5508HPEQU/Skk+nmeN6nxFsvlQAVnwJN/C2qbaH+337y/569+iaWCKCvayGYv+qULej5STkVgeZNDxydBDJ0wp8F5suoWrDQlvB8JfGXdtfunlEI7sRle+9K/so6TqEhLdadDW296e9h6f543/W4SgbY/pFKDY96A5UdqJwvdyLw22ndI5rEvMhlk0o6bXDAsQFMtzGy39bNqCE5HDJYwNN1de0vUGLmBFoXnhPbOozD3hNE6iu2p9hnnVdJ7wthw3LRplyo68; 24:PQyPz4QfDsw6XU8cJsJ0azKHgLtoCo8rGh4/M8bpDPelgoPL9OrcDyOxJnEMyz5BdXWBh3J5i15Wm/ppRXZguRaWM9WWb36+EI+vOtBI5Ow= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1714; 7:GfTHrBVIjBYRzrP99tK6G0eb5FZtWw9008HH6oQEm3esu9H8w4zbbVzqnxYeQLqSdOUpDI6yBEu5YoYru4r+nGz1kYVUsxkW8jBMUZQPQdzC+YNXRMKwOJdQbhE5ytBB3YVEcq7G9xL6bJY0qW9xzLEqjAOMSYCp32BW2ELI9Y/sEnyUer0aU2nooFixPNlfW5S7YfgcB7w1OJqoEoyLVLGCtD60WepnQZ8CiaPWOFZymaAv2K/3OXw0S5HN4OqMf73FvSKaJK5DBtw0Qi3l2a4SVwzjkuMqKGr2YRlVb5ooPiSW8g6KcdHO9MfY68BK6ENRhSFxYTLiOMnS7UtlzA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2017 08:44:03.6006 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1714 Subject: [dpdk-dev] [PATCH v2 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: Wed, 07 Jun 2017 08:44:09 -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 300dfae83..50368ec32 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.0