From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0087.outbound.protection.outlook.com [104.47.37.87]) by dpdk.org (Postfix) with ESMTP id BCE0B7CD6 for ; Fri, 16 Jun 2017 07:32:55 +0200 (CEST) Received: from BN6PR03CA0012.namprd03.prod.outlook.com (10.168.230.150) by CO2PR03MB2392.namprd03.prod.outlook.com (10.166.93.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Fri, 16 Jun 2017 05:32:54 +0000 Received: from BY2FFO11FD008.protection.gbl (2a01:111:f400:7c0c::139) by BN6PR03CA0012.outlook.office365.com (2603:10b6:404:23::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14 via Frontend Transport; Fri, 16 Jun 2017 05:32:53 +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; 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 BY2FFO11FD008.mail.protection.outlook.com (10.1.14.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1157.12 via Frontend Transport; Fri, 16 Jun 2017 05:32:52 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v5G5WNFD001003; Thu, 15 Jun 2017 22:32:50 -0700 From: Shreyansh Jain To: CC: , Date: Fri, 16 Jun 2017 11:10:44 +0530 Message-ID: <1497591668-3320-15-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497591668-3320-1-git-send-email-shreyansh.jain@nxp.com> References: <1497591668-3320-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131420647729098273; (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)(336005)(39380400002)(39850400002)(39840400002)(39450400003)(39410400002)(39400400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(8656002)(110136004)(5003940100001)(86362001)(5660300001)(305945005)(104016004)(47776003)(498600001)(2906002)(50466002)(48376002)(38730400002)(33646002)(53936002)(81166006)(8676002)(2351001)(189998001)(6916009)(77096006)(8936002)(36756003)(356003)(4326008)(50986999)(106466001)(2950100002)(54906002)(6666003)(50226002)(105606002)(85426001)(76176999); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2392; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD008; 1:kvage7ixftZ8ck5N68lLmZrVY0jgl/5VHiy0acK9ESGe5HmbbjQfsJwwLC/Rz/LervzX2f0sy9VQHUPe/i2ZckdXGGtekLurvMxQe5cTVJtEr5i5Y+wKbjYZ+Pyjx4hNk+Yuwa280HjACI8t9ZFVmtDcvgZkN0GmPkRnxrNNERDrbHDx0Due2FJN/YOmCVWhF6CyoZ8BRPjC7R6RwimkJAasQkBSIuR2nvNa+rqDVXP94sfyb4bEfE4M25GYvcVdEXn+KGP/VbOoFOU9pCVcBf3DTlJpQbOh7H8MC7NNTkGk4VMhFRIPExLvhotQIpyvurhk6e6TK7zEdzMQC/GCdbTpb2jAhYW5+Dxg3dduPLQrCnAFWHSK42s2O1jnV6SaeQFvNqJPKtF8Vw0r9QW02XoAcpc0pT/R3gnb0qUvIsW+ArgNwtCng5dILVo/c+R+Tco+McNxdJalN1r7mh3PfyaS0AbMUAO3zlvXGo8s71FTp6Gv3ct/ab1f9guCl6esWwRMR0JBKcJ3a+MFIbc0GWs2wQkFHg5hUZM9sl31lvDUrFP5b85hd9gKnOh7iWEOU6PJpXPKkajWrt4a4Yjsf83HXwsObi7fNheG0ITGSszGYd5L48DBnIHCsKqKf4Vsz2ZUPpPbCQiy9F2o2yMuOkxzA8W5jlhL/wtQWtiomcvxfmwj6IqJ/4rFY+E9bPpki6+cJqeRptPvR8c4XzMCZaJO1r71GbPxRbc/w+amAmU= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO2PR03MB2392: X-MS-Office365-Filtering-Correlation-Id: 03fa0924-4a4f-42d5-0cc0-08d4b4792280 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:CO2PR03MB2392; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2392; 3:m3Y3JUnCWgK59VP45PtbkJH08YwYAnmzdpwX+ZhIPoOHW4+qzvKVx+vdr6WGvxspcWZbs2Ck8tz2gY6pX8grDeWnQxASY8pZdbttM0qqXjj6Z3Oq+o7GEV9J8tbVWtq60oruvYXt8c/+/jZGc2qgfPpznm5oaxWmuuvaleou1xdZHofrAbCVSHZOd+bPf0Vkcls4aRMq9OOJu2gaK9gwzJ8dG/qOw06gK3CW/C+8ggfpt8OQW+85fc0vzJ8xb3brtlDqHMduw2x86zc2qCgSfoq8/Q+LlPP4lWaKFzLHcO6kZjSa8406Qd7VBQVmqapDvr1Lx1gLMfisaCDUsWPps6AnM996Zrm+0eF32kFgiRrymuzoMheUBTyjZ4nOXgHVuKz8r8Gr0EeT0Fr/DPOdL6PBpd2ut6b+to5lO4t9FSGaBHsav6wVQUp5pDSOEYvi; 25:RlPIfLFanWH7njj8arw1nupdYng+H7uXuJyPJ6WAvK7yl4pFImnt9k6LN2z2KE9CXEUIWdLPY9s2PDJyneMLybQzr3YmsVb2wtIQEDUWxZt/D9ihEdIHce/s8F+ZmTAMKRgETvhdGw982fMQlRl8gvmiiKIhR67dzHhY3fa+8v4xDQ4QHDR98EnpS+GWL13zDILGhboY/q0sDi5X36jBpT1foxsWMpypWsHHEXXHe2ZZu5HMJy0T+lSv8fTAWd61dd5eoDju1bbbPJu4I3HAjkUR6UH3NAX3XMdfSoy8/yidiajVbLz6wc3dfHlDxhSuZZAx29lcdTO3ayjoLA6gkCbj/yH5csnQrEDVfBobTB4OPRjekZDoUaG9juLIv4hUw2+1N0bhqZ8XFMRFqyeG13JKUPEssO2WDfpX4RpBdskX24isvuBwc75zJvUpLLieuOXalICMhEgdxHI8i1sijUcAX9S1JlkeSuC109+Y/XM= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2392; 31:vpO+bBwun6xH8s+H/OVFGbCByXNU3ER8PAXA50DEJFUJQpZiwzDKRGa70kHUZzTGaSCrtGAaZBNSksY1xiDAczsfZH32ebElwig/4iPmiATMrg54nH+JfO+FNSSmFjGnqeThhM/Nb0LDONt1n1Bj/fsh91zCvhz/3oFShtoBnvtWusjAUOBEuBVEiOaDtDshF+nycc3wINdefJXtP/4qvEyfA3j2+zEiWWa1r/pxJ25DxSFV0fC6kONzjQWcKvMj4HxMMX4lC9l7q3iASm4D6Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13018025)(5005006)(13016025)(8121501046)(93006095)(93001095)(10201501046)(3002001)(100000703101)(100105400095)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123565025)(20161123556025)(20161123563025)(20161123561025)(20161123559100)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2392; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2392; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2392; 4:UvREA4YzcVraFhWCad1Drhi2pVoPb8MK8/+vTzH/yI?= =?us-ascii?Q?tg9Ja7bcv4a4YG+ZlsWwZCwdNnHw/4HwhEh79vtNyiDU7mGb81s+AY0B47OB?= =?us-ascii?Q?d1hveVeUSCUt5cICLoo23ELwS/dAKoG5uC1gO0nMd0v8QHew+E8Xfhs8/YlZ?= =?us-ascii?Q?Cht3ztpxa8o/S9rv+t4ALYnvbtd28I0IFbFAnxQPn2rIvWwVhXUrGC+VQ1DU?= =?us-ascii?Q?jrghASbiP8YGSsiJLixPeDsQI/4m+V0e7RrDrz6EmoOZvzTst/q5U5VCe6Vn?= =?us-ascii?Q?g8U25oscklt37YB79/E7pNFA9R8LW0kSKn6EIVmI46bBYAgOKlIQDIWG6VCx?= =?us-ascii?Q?18PwolVTGrhu+Vue3Tm1yFy0TOBav0z70UpYJLdYRjdol0Q6mvX71p2qc50a?= =?us-ascii?Q?l25GFvPXo9RmEdTZ1j5Qy/Z4Okg82EAEGG5dGdZhaT51vCszUkd+FePmOQi2?= =?us-ascii?Q?cbwbSSf9jRq7XuG1hs6YONXxpTWbYMwUuMRwZr6aa0u9MrOAzfkeLKsJv24h?= =?us-ascii?Q?44O2jeVDr/lThNFzFgwCnZD4vH4Ih7ZlO5tef4A4/7spPEaotQkYDFR95/MT?= =?us-ascii?Q?z8nbK3cc0QB8i3/KrMIYFDlcwByuECTVtxhHCPbTe0FBXTwLOHzRBNBPX8yI?= =?us-ascii?Q?bdYWp+B0s3hMJd2dJL2VxBkL6p4jVK95A0A0opyx1T8TwlQ7SQlx5mvyL+gT?= =?us-ascii?Q?AghIbc8ZQydaAvnz0mDf9Mo5WOKzaoa0WlXmkIL/CrMXaNYgYCqNTL2FiZdv?= =?us-ascii?Q?H6RtdU+xZZNZa8GKe3JjvToL4IXqtfj6Efzhekn54pGQVHCk2xTIJYQEMYho?= =?us-ascii?Q?85PfsJcT1+JWRfzdsmoJuQ6p/JmvFkOPmyqXKwlmhVBOfUSCZA77iVT5NlWJ?= =?us-ascii?Q?6/3sl1sv4jOWTRJdTJM2YoKgBIAKI0RN3E8ttg3SNaXkegpQ6eHfTyT3G1wb?= =?us-ascii?Q?eczGZJRbwhILhFzsiovaBgcDrHKZY+Qv1qYv5QpzODDUK5oTsxOHiiHhTZR3?= =?us-ascii?Q?ZByn9FXZA4d5+o6gz9IM/H4+5f9qKqWm5X4dA5LfT+ICyiOXzua0FashkvPA?= =?us-ascii?Q?+WuiLNU04b42zMVbMrV6q9GDD2vyGfGyooPVNGS90SXJwUPsKtR+stCX9WNN?= =?us-ascii?Q?I1S8JCsdFfFmk4c9fgT5UMvTQIIoLbloi4UVGU1n8onmHYwY8wmdduTHQfbh?= =?us-ascii?Q?bQ0NbWvmNTpSsqVGtuzFtmUHx43tUZdEOdXIoEwtC0p8jEb7Omg190980QN0?= =?us-ascii?Q?JoL6XTx5+Xi9SNRIUFGzhNOyTyqRKbTwPNZE+F2qRr6sArgzeSqrIe0RMbHQ?= =?us-ascii?Q?=3D=3D?= X-Forefront-PRVS: 0340850FCD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2392; 23:s7sSAkrHKPNhqgbFcS4WSOn4gDIMYwHKGQalL7eJJ?= =?us-ascii?Q?0bSzozTF1Aw2clMENzBTqKctx70za8zfpIxKD/OOxLZLDv5LQizdoFNIgMpd?= =?us-ascii?Q?ux7Vro8JUFGbGWIJk31U68vfm+t0H0Pu82eRcbW8eLJv66gxXUrETqTk8YPU?= =?us-ascii?Q?/IfA/JVp9LUpZg2MyYHh/ylU28EvCo/SzV/jezFt1+T7RLpbKSspP5z0h65m?= =?us-ascii?Q?Pbzjzosht6TrH6NwIRTBo9B1jMEvkAIOiewPymCWdGHQJt/CEPkH/AoKaPo0?= =?us-ascii?Q?Po0R0TfCAabjJKmipE6gXgOYMkkbkfqDRgjHsYZS4AkrkpsCdb2p6HZxTRgl?= =?us-ascii?Q?nNDXetDY13uxShYLswQs6+1nUtNH1izn9lrSogrkp8G0QbSRIZrIMZhKq3Xe?= =?us-ascii?Q?eLPDutTSmzPmD5HwvYQalLNHvlM5srW19+gjL3el5/UMZ25hwUiOdPVJldZA?= =?us-ascii?Q?YsHI3y9EH/tsmTssG4yiwM4HZ4JWgLe1SnGbz6HqeBJmDvcLTmsgu30JvLHf?= =?us-ascii?Q?OJmR8CWUcYf/wFOH+A+tDSo5ecCuoq+JAJ4BlAkxELfMCbWrYPlD2idkRi0Y?= =?us-ascii?Q?X4KokRD+NDWbuOhtipR+aF2C2DRFbZMARyS/arvhuA2XGrUmS4K5il6w/wzV?= =?us-ascii?Q?ltrrFab1GHYDhyzS/5bPPcaMc8R4yJEXq0vPV8ItTeJU3raSRT2MxniH4ot5?= =?us-ascii?Q?Cka0PPj0lQSp7cTlOvPqo55ST9EkvvyMPVFRcr4kmLtHwDIm0J86k/0P7GQr?= =?us-ascii?Q?3+S1BchP7pFWAwT8BScsNieNMd9tA+Q8+0dNjEo8VG0HzsdgJuwA/Pzw08Zf?= =?us-ascii?Q?rfJFSuAVLUCmMknBIQCmlhi+YVUhxlH11CDXWpN9MkQbpv/uRaHWRGkOvxQh?= =?us-ascii?Q?gWpQYegz33xBy4VKe8ufyCHxXJXi9zTj5vts4furzf/DZEIiJ3X506Mi+o0A?= =?us-ascii?Q?sMUqduh27KE/1PTjvQTS7MElCOh19B885ECpkn2b4sOX1YOROk+9XvSxOJlR?= =?us-ascii?Q?XgHXZjDNumRGCOTgRs6rQH2rFKJWkiVB5r2Lk1OAD7DbLlyw350EgTShWFuP?= =?us-ascii?Q?PzFxDWra0WCE/88t4834QLOlQFx4kXhaoVixMcyxP7NyVesQfLk7zIogY2+t?= =?us-ascii?Q?QTmR/6WU/yfb2W8isohyJ/Wz+8OiEYsizQFfy22CgiY/1cUQpIIaCt+JCqCp?= =?us-ascii?Q?eQlvsZZ1QnkNaU8QwNPNzGI8wmJFKMtY7ubFf5acs5xtbCTYa3BdjjL5+epz?= =?us-ascii?Q?GfVhBAEYnxhC3ooPxg=3D?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2392; 6:6QtbWhTrMP48HILaZNoQ93UzI4aO+E2TCAlmVPKsocjKOr1ZzP0cILkRwBxZTgvFqMamZ7Y/emIY07nvoDoOaAwCOhKYGlSQpTUudyzQT3PvoBGlpnEcUTTG6J+e0cmTlTaCSgyOK52E/0TND+5exJ+xUNJ8Wwavm6ybE3o8K+NMKjqpitqU3djD6O22sILWXsBroMtkFR4dvYEM2vZ4uAEoSpr381hPo2LcouxWLyZdooQtqTXcZsck29dQ54XfPmBA/HL9EZrJyZJdEQrf/naD8/Pflalfpxehm96qqt6BTgF3/9rebxSNBrZCcNUPLTleuNnSCLEe/FN6Q2T026nYbHSovMBSBUfah6ssCyYrHNSzUICXpb4HU3AgqRPWwfIgIJXPoSI/DAyvqA82jGsq980x6U2rQ/u3MVSVrEfGONVtjw7KeuxQ+0ld4WxcwiKb2QJ58v01hodrllub5COqbtnuTU7x0FP6dTiREmOkOewL1aawg79WM2ox852V X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2392; 5:NPKsPZ3VnDnFFKBtMNEAziajPDREugSLW4wToLOMKULvUZ10q93uwUPT+MFO2gHt4tdQgYr7tOmQ7mdXWI3tUxuX8frj6UW5fixMQEF0j2L9cXzFrODTr8p79qiACtx6sJJr/bAJhwApqHR0LxPiKjyofz/irs66vq63TrPZUc+Q/QB9u5hVbwB5Ex1QSJm63arVmNjKGEO1DIIdjhP73BG1r+kkjORrTvhoKKqzfnve+SL+nwtUnr68BnNdBwSgcwDB2BQFZpH0TtKVAn9sNEuYyoMgfSACd66Nh2c47VpcO+zwf5z9qCpOQHlZiBVPTcPVtjKSd1CSpD+rinsyP7m2u52mvrgVittCBzJLK7Hl+e6sAreZtYOSr7kIccG1ccC6z3Fq+OVNybTjCRQGbL1Q70ZV4g/+5jSBPWJoUE2pTs2b0430o04j9BPr9DPiNnIr4ODMdBLIfasw5N7nqHKWfxVHb3VeEOb3QcXg87z2O9UCDhFE6N5PF6Vz1c5E8u68R+Mcj127/xklxJ6+Xg==; 24:LncnZ9IaoQcSNfvcgMWYBzvL8IMn/RKhcaBdNyW8uqsHBI3M7Gl95lm0N7MQ24G8LN5+XZKmJ7FLtC9ufT6NeFhl5v0rqVl1RQrD+ODAG6Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2392; 7:qaAgmks4phQ4PxkKtPyJ33SkppvAfqnAIbCg+xCGCFeXCiiNloK+kDgpEMfKF48iFPUgHJ84F4HQuZ8fjb3IRTLIJhW/t+y5gY3GK7G/HxQYh3S5u4IsNyCw8/ntYZItCnGrJs2o3pfMMnkR0O94d2yTo3Gd9/H1/mnqf+N/4cBCGsEfQx7ybMOh/4loobQdk0dGBpov7Kvq/+fj5W8oraxOwmuj1tWHpvq6d2qu0KOPwaKY7oOwxXiD8XEikOtKSzOiQ7xvN4kjV0DZtJ5WcAnVnjIHZh/qXDQYJXzGoA1nvde1IrsVfwPiRkqeCaazrCpXp1r+Sp2sS6eZLNuEFA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 05:32:52.7070 (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: CO2PR03MB2392 Subject: [dpdk-dev] [PATCH 14/38] bus/dpaa: add support for FMAN frame queue lookup 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, 16 Jun 2017 05:32:57 -0000 Signed-off-by: Geoff Thorpe Signed-off-by: Roy Pledge Signed-off-by: Hemant Agrawal Signed-off-by: Shreyansh Jain --- drivers/bus/dpaa/base/qbman/qman.c | 99 ++++++++++++++++++++++++++++++- drivers/bus/dpaa/base/qbman/qman_driver.c | 7 ++- drivers/bus/dpaa/base/qbman/qman_priv.h | 11 ++++ drivers/bus/dpaa/include/fsl_qman.h | 12 ++++ 4 files changed, 126 insertions(+), 3 deletions(-) diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index d46e96a..2056842 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -176,6 +176,65 @@ static inline struct qman_fq *table_find_fq(struct qman_portal *p, u32 fqid) return fqtree_find(&p->retire_table, fqid); } +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP +static void **qman_fq_lookup_table; +static size_t qman_fq_lookup_table_size; + +int qman_setup_fq_lookup_table(size_t num_entries) +{ + num_entries++; + /* Allocate 1 more entry since the first entry is not used */ + qman_fq_lookup_table = vmalloc((num_entries * sizeof(void *))); + if (!qman_fq_lookup_table) { + pr_err("QMan: Could not allocate fq lookup table\n"); + return -ENOMEM; + } + memset(qman_fq_lookup_table, 0, num_entries * sizeof(void *)); + qman_fq_lookup_table_size = num_entries; + pr_info("QMan: Allocated lookup table at %p, entry count %lu\n", + qman_fq_lookup_table, + (unsigned long)qman_fq_lookup_table_size); + return 0; +} + +/* global structure that maintains fq object mapping */ +static DEFINE_SPINLOCK(fq_hash_table_lock); + +static int find_empty_fq_table_entry(u32 *entry, struct qman_fq *fq) +{ + u32 i; + + spin_lock(&fq_hash_table_lock); + /* Can't use index zero because this has special meaning + * in context_b field. + */ + for (i = 1; i < qman_fq_lookup_table_size; i++) { + if (qman_fq_lookup_table[i] == NULL) { + *entry = i; + qman_fq_lookup_table[i] = fq; + spin_unlock(&fq_hash_table_lock); + return 0; + } + } + spin_unlock(&fq_hash_table_lock); + return -ENOMEM; +} + +static void clear_fq_table_entry(u32 entry) +{ + spin_lock(&fq_hash_table_lock); + BUG_ON(entry >= qman_fq_lookup_table_size); + qman_fq_lookup_table[entry] = NULL; + spin_unlock(&fq_hash_table_lock); +} + +static inline struct qman_fq *get_fq_table_entry(u32 entry) +{ + BUG_ON(entry >= qman_fq_lookup_table_size); + return qman_fq_lookup_table[entry]; +} +#endif + static inline void cpu_to_hw_fqd(struct qm_fqd *fqd) { /* Byteswap the FQD to HW format */ @@ -766,8 +825,13 @@ static u32 __poll_portal_slow(struct qman_portal *p, u32 is) break; case QM_MR_VERB_FQPN: /* Parked */ +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + fq = get_fq_table_entry( + be32_to_cpu(msg->fq.contextB)); +#else fq = (void *)(uintptr_t) be32_to_cpu(msg->fq.contextB); +#endif fq_state_change(p, fq, msg, verb); if (fq->cb.fqs) fq->cb.fqs(p, fq, &swapped_msg); @@ -792,7 +856,11 @@ static u32 __poll_portal_slow(struct qman_portal *p, u32 is) } } else { /* Its a software ERN */ +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + fq = get_fq_table_entry(be32_to_cpu(msg->ern.tag)); +#else fq = (void *)(uintptr_t)be32_to_cpu(msg->ern.tag); +#endif fq->cb.ern(p, fq, &swapped_msg); } num++; @@ -907,7 +975,11 @@ static inline unsigned int __poll_portal_fast(struct qman_portal *p, clear_vdqcr(p, fq); } else { /* SDQCR: context_b points to the FQ */ +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + fq = get_fq_table_entry(dq->contextB); +#else fq = (void *)(uintptr_t)dq->contextB; +#endif /* Now let the callback do its stuff */ res = fq->cb.dqrr(p, fq, dq); /* @@ -1119,7 +1191,12 @@ int qman_create_fq(u32 fqid, u32 flags, struct qman_fq *fq) fq->flags = flags; fq->state = qman_fq_state_oos; fq->cgr_groupid = 0; - +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + if (unlikely(find_empty_fq_table_entry(&fq->key, fq))) { + pr_info("Find empty table entry failed\n"); + return -ENOMEM; + } +#endif if (!(flags & QMAN_FQ_FLAG_AS_IS) || (flags & QMAN_FQ_FLAG_NO_MODIFY)) return 0; /* Everything else is AS_IS support */ @@ -1193,7 +1270,9 @@ void qman_destroy_fq(struct qman_fq *fq, u32 flags __maybe_unused) case qman_fq_state_oos: if (fq_isset(fq, QMAN_FQ_FLAG_DYNAMIC_FQID)) qman_release_fqid(fq->fqid); - +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + clear_fq_table_entry(fq->key); +#endif return; default: break; @@ -1258,7 +1337,11 @@ int qman_init_fq(struct qman_fq *fq, u32 flags, struct qm_mcc_initfq *opts) dma_addr_t phys_fq; mcc->initfq.we_mask |= QM_INITFQ_WE_CONTEXTB; +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + mcc->initfq.fqd.context_b = fq->key; +#else mcc->initfq.fqd.context_b = (u32)(uintptr_t)fq; +#endif /* * and the physical address - NB, if the user wasn't trying to * set CONTEXTA, clear the stashing settings. @@ -1419,7 +1502,11 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags) msg.verb = QM_MR_VERB_FQRNI; msg.fq.fqs = mcr->alterfq.fqs; msg.fq.fqid = fq->fqid; +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + msg.fq.contextB = fq->key; +#else msg.fq.contextB = (u32)(uintptr_t)fq; +#endif fq->cb.fqs(p, fq, &msg); } } else if (res == QM_MCR_RESULT_PENDING) { @@ -1861,7 +1948,11 @@ static inline struct qm_eqcr_entry *try_p_eq_start(struct qman_portal *p, QM_EQCR_DCA_PARK : 0) | ((flags >> 8) & QM_EQCR_DCA_IDXMASK); eq->fqid = cpu_to_be32(fq->fqid); +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + eq->tag = cpu_to_be32(fq->key); +#else eq->tag = cpu_to_be32((u32)(uintptr_t)fq); +#endif eq->fd = *fd; cpu_to_hw_fd(&eq->fd); return eq; @@ -1907,7 +1998,11 @@ int qman_enqueue_multi(struct qman_fq *fq, /* try to send as many frames as possible */ while (eqcr->available && frames_to_send--) { eq->fqid = cpu_to_be32(fq->fqid); +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + eq->tag = cpu_to_be32(fq->key); +#else eq->tag = cpu_to_be32((u32)(uintptr_t)fq); +#endif eq->fd.opaque_addr = fd->opaque_addr; eq->fd.addr = cpu_to_be40(fd->addr); eq->fd.status = cpu_to_be32(fd->status); diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index a7faf17..5c535dd 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -279,5 +279,10 @@ int qman_global_init(void) else qman_clk = be32_to_cpu(*clk); - return ret; +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + ret = qman_setup_fq_lookup_table(CONFIG_FSL_QMAN_FQ_LOOKUP_MAX); + if (ret) + return ret; +#endif + return 0; } diff --git a/drivers/bus/dpaa/base/qbman/qman_priv.h b/drivers/bus/dpaa/base/qbman/qman_priv.h index 4ae2ea5..e9826c2 100644 --- a/drivers/bus/dpaa/base/qbman/qman_priv.h +++ b/drivers/bus/dpaa/base/qbman/qman_priv.h @@ -44,6 +44,10 @@ #include "dpaa_sys.h" #include +#if !defined(CONFIG_FSL_QMAN_FQ_LOOKUP) && defined(RTE_ARCH_ARM64) +#error "_ARM64 requires _FSL_QMAN_FQ_LOOKUP" +#endif + /* Congestion Groups */ /* * This wrapper represents a bit-array for the state of the 256 QMan congestion @@ -197,6 +201,13 @@ void qm_set_liodns(struct qm_portal_config *pcfg); int qman_testwrite_cgr(struct qman_cgr *cgr, u64 i_bcnt, struct qm_mcr_cgrtestwrite *result); +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP +/* If the fq object pointer is greater than the size of context_b field, + * than a lookup table is required. + */ +int qman_setup_fq_lookup_table(size_t num_entries); +#endif + /* QMan s/w corenet portal, low-level i/face */ /* diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h index 7d9ad00..1867a66 100644 --- a/drivers/bus/dpaa/include/fsl_qman.h +++ b/drivers/bus/dpaa/include/fsl_qman.h @@ -46,6 +46,15 @@ extern "C" { #include +/* FQ lookups (turn this on for 64bit user-space) */ +#if (__WORDSIZE == 64) +#define CONFIG_FSL_QMAN_FQ_LOOKUP +/* if FQ lookups are supported, this controls the number of initialised, + * s/w-consumed FQs that can be supported at any one time. + */ +#define CONFIG_FSL_QMAN_FQ_LOOKUP_MAX (32 * 1024) +#endif + /* Last updated for v00.800 of the BG */ /* Hardware constants */ @@ -1245,6 +1254,9 @@ struct qman_fq { enum qman_fq_state state; int cgr_groupid; struct rb_node node; +#ifdef CONFIG_FSL_QMAN_FQ_LOOKUP + u32 key; +#endif }; /* -- 2.7.4