From patchwork Thu Sep 28 11:33:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 114411 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp616912qgf; Thu, 28 Sep 2017 04:23:28 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAIO09LWk1125XaebNdGJIFidSfZl3wErfHYl0pXs1qbZ9pH6kQFhysFoy+rCHTqh0/u9H1 X-Received: by 10.223.135.102 with SMTP id 35mr4263371wrz.160.1506597808577; Thu, 28 Sep 2017 04:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506597808; cv=none; d=google.com; s=arc-20160816; b=mUDOETNcsF7l63hSTsWh0EYFji8BURTjqOrJ1piZtk0Au2/HjaUbCBASQsK0PcJlEm 9AALrwfIK/pahRhH/8a7knE1rGFlhPNohjohBxsVXNGdpRgMQ0heD0JoGgAW4AjaXbE1 rPIqVzVtdX7r3PIwZeguTFOIRBjMQMzijrdHHJ9/sbe+drLUAbDQm2PsF3cqpO4kaATm yYAblhjX1blQ9qJeaXQ4SWwRgKSYcH8y3ryXxtGh8jGVF//Jrx3WUBdCX5CBPrySDaJ4 zUAA3Wo0Ii91PLzpzq2sibO4klEdi2xXxj4aFLZP0UTkPhflWhrEzM1Dc7AYEegpOIlU eosw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=gb/3svYjMXdJbXN8fyUkggZBkGKOCChfFioDjID/lc4=; b=Nen3SIrEH43RKCKsCoYZZygvAqhjQxpVqST5UThS7ipScPxtDgY1+kuKCmJIA30NVA dJngvSTNxfnFRiBX0dKtIpZO4P1Y7tptr73n6slDt2abEssw70LNTM+72LkVXHXMxQ19 hvfbxIuBZUAwSRIpasSqGlXJsjrk66gLltpfJ1pf5ero2X/mxbDei39rjdOgFb1zBc/8 8rZMIAkoe9Hw1BcoNycpPOrE4ApJpfyUum6jiNuFYwtscX2WEZ8Glfbj+hKg7mSzexpc TWYB/Qbp9VXf/cXu4+tG17m1luRU9ePWNxmGTk6EYEhtqf5WhaGtNYSvj5KBFh7s+QsW Dlag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id t14si1266981wrg.91.2017.09.28.04.23.28; Thu, 28 Sep 2017 04:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C10AE1B19B; Thu, 28 Sep 2017 13:23:12 +0200 (CEST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0082.outbound.protection.outlook.com [104.47.42.82]) by dpdk.org (Postfix) with ESMTP id C84513977 for ; Thu, 28 Sep 2017 13:23:03 +0200 (CEST) Received: from BLUPR0301CA0021.namprd03.prod.outlook.com (10.162.113.159) by CY1PR0301MB0729.namprd03.prod.outlook.com (10.160.159.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 11:23:01 +0000 Received: from BN1BFFO11FD034.protection.gbl (2a01:111:f400:7c10::1:184) by BLUPR0301CA0021.outlook.office365.com (2a01:111:e400:5259::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11 via Frontend Transport; Thu, 28 Sep 2017 11:23:00 +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 BN1BFFO11FD034.mail.protection.outlook.com (10.58.144.97) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.56.11 via Frontend Transport; Thu, 28 Sep 2017 11:23:00 +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 v8SBMpFd016035; Thu, 28 Sep 2017 04:22:58 -0700 From: Shreyansh Jain To: CC: , Date: Thu, 28 Sep 2017 17:03:07 +0530 Message-ID: <20170928113344.12248-4-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170928113344.12248-1-shreyansh.jain@nxp.com> References: <20170909112132.13936-1-shreyansh.jain@nxp.com> <20170928113344.12248-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131510713806465803; (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)(7966004)(376002)(39860400002)(346002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(81156014)(54906003)(8936002)(81166006)(85426001)(5660300001)(50466002)(68736007)(48376002)(4326008)(53936002)(104016004)(8676002)(16586007)(2906002)(47776003)(77096006)(33646002)(36756003)(305945005)(498600001)(97736004)(1076002)(8656003)(189998001)(105606002)(6666003)(106466001)(2950100002)(6916009)(356003)(50226002)(86362001)(50986999)(76176999)(2351001)(5003940100001)(316002)(2004002)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0729; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD034; 1:I7uDXb6xhSduqZaqjZTu2e2PqD7LWb7rIP6lFJMoS2/YPXlKBQ9QdFOZvBvZTq+frU0cVsuKDzVEx8jeqiT2tgtscnTfhPw+8UmZh5jwCQKHEdrlRjKsYXlIGYUSx0wb MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0cb9d19-964b-48de-49aa-08d50663470c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CY1PR0301MB0729; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0729; 3:wJ8cei9NkRr9G8sioYzfqYJabpdjEzGCVm9f7DgxGs5r2D1OS1QQwRSosiqx/rK7TykvPf2/uZpbYkQUD7SjxoG50fWTxdmSdgoNV02i1eVmtnWXbOLG0uQ2I58ysWc6nwHOqCASJdg8oYZkawA9/uYwvpI4uRpYbN7tikEWCCvsXR2nrk+TKMm/jSWvg/yh9uJnliBmA1a197cMNFE2yhpggkhZZg8VRqiqf0xM8/AVOJhIEgEAzAxGNLrGhTXoWiXgOhBdzBmZ0S62YwwfKu0CSyk/z89BpvWaFJMrnd3phmgtucQ8U6C5ckNPD910uyyJxEQI0RT7jU7xgfnC0Vx48PM65Vue9B6J1dJKn3Y=; 25:gwuhQ6TD8IdMKG8vZ2mMpmHs9cK2PwyOYpyKBHHDiEByvcnE7ukyB/e22w9qXBxUrKmumsiQvRn6Fhuhr9p78KKPiPX7M6b6oWyyLJHid+Mbh41i6oOxq2bLLzwPG4fShnXZHeChS8cbKc5ozI0dl+4rTuK3bC80nAM3UzDCkB0reHu//gY9yc2ru8CALkXc7OAXVcNckdfyyDRToWPwXYfQ/WfTVmSfrb2a35YZ1STb8XK9VbRMCivJnkDdSNNCxTHr5cgnkGHYmwsOgnp6WGc7XYZyLBJ50Ml3id4gaHYNf/DFNfmBlIBc8JK09XjX/BoCCFvQWFpSyxyrB/BBRw== X-MS-TrafficTypeDiagnostic: CY1PR0301MB0729: X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0729; 31:eq9yyq9pJrXTZb1SWVQMfJeDv1rAeWU467LVbzEtCHX7MF+kWGrhW8CIV3LkAu+PXYf1c5Nsw/GZVOZeekUE2YSYh68tgeMA/FVHbVrCwTrMfv+z+3/yVHwpRPGqYn7MxjP9ra800gMeGCgeSbpj6h4SVIiIhaXwTOGGH0wggwYJKnLuGnoX/iJ/hxph5+jgsHi7vIaFKWxje9pl7bPhyubUmidcfyCH3CaNNfkBB78=; 4:hty36AlTlwueBVXA5l+DYnvu5vrwbqWBc/wNGQIxwDj0QhkzwbwtqvFMOzfQ8BLoF7Yyjf7+sL77ofQK2d+oFUusNf3tf891BOH/dOmP2c+60yHqc6LNSM0RcHkOr+7mT2HFz03cEdiy/DbCeMTlLl3vOGWn6+P6rcq4fQWdEG61KESNVT0Q5lTPQ+tkI/9X/Xrw002fgKpNVu1q1iFCvUIJ5gx6GxB75KULbExb1KQHiJe9l2420u3FEssXZAUn/IkAUEnDwBUtO2wjOLBHUqAqSfuexH9VizRMFzyYof0= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123559100)(20161123565025)(20161123556025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR0301MB0729; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR0301MB0729; X-Forefront-PRVS: 0444EB1997 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0729; 23:U0aphWcAUdjsE1oyqPbNJTOArspFkgtqRnSRR8Y?= 5LWLut+IhVpUwwaxfPxVSocLG+sMdwfG5lWkxetSc8SZTRpINi/x8//UfKZJRUaVaeEpspUJRJ09HUNHi6qsqtsydc6P+lnIITnPPowKKKDw7wIjbUXcmjP6V2oyRsd8TDcTK9gRtYEzhoyXzQWw9NyavkcOgjlaP1LBIvuqXVLssN9+tXLQXb37M00F04cUS2v4d4dIAWTRN8gRd7jiWu3r/mp+nTkHMDVB866QXK4jjRZcBmlzmq6YEM2BEyShO6gCFPWPABjFTssBJ3X0G3n4QswFO/f5F97NWpHziE/r9fsrBl6AtDWYpax9WDVts1UObrGWTi0gMZRSKlhkGeWTTQ5fEaYWAc1ZjLL7XECb2r5FWnHXsQ3UPjR9Bm3FMiQ6IoVL7aTjSMFBWXMnWZw0lGEzjEpocQFljKLAdPKmNrSU+8xnNiVQaA8G0Tdof0kliWK3pVDmDpE8/opFtciWqL1RjEtEJTdCQQpEc+mr7q5JQZMpk3ZGnG5n1OkVippEhgrg9R0fzvmkDu6yXQcruHAD8HRjTzUHvBPg4Pc7BpvWb/e2QIdpcInzlHk9Z8KDNJC1AwJQQChHq6Hax1i4FznTYvb5ap1PQ5bkosuemXwe4U9jZhsdT8Esk8AYluUfnWQzpf+8NipHO5U2m5GQMxrdEBB9wT+rOMhSgzMelr1/4vRJCS3+wXqVF2LKxLzmdhSgOHhYpkwnpNw5WNn4bybi3Ad1uu0WA3DHa4GWDHEgE4Gi+VO/QR3ToiNeSFB9a9gTf51AFVODEDm3XMyfKtRa0rlwTuq+41eBXVxm00vZnn3yevXjzqxOK6IS8YE42DEdnY+p1m4upHWC5mnSjCCQ5Pmu34RrGq1mLiBVAfNnYG376cvkG/FskDxs8oCF9YNCchGv0UzPemtC7XD49hgP45yHDE3COs59e2zmwjlW9SH1P2e3I2wre7R1cIa5fY7AUj/TOIXpOPAfrOl48yjmC5evVPfNpDkpEg3kpvevh12y1s+nYmXIDCh5EOuvqMvVX+jNGglvtjY4iA2rWdlHNoNiX7LNjOniqayFyCLVf44K81Z8A2WkJglGPjqHPfS9xkU6RVNKO4J10n1asfJYjBTUt/LDrndisoifbhX8JEWIEJfyGIXpT54inQoYV7gYOpbnlujYVLw9deIcTpDVXvcYH0Jb0WLMUPdEYScXHbGtOAli74gnw80xgkNw= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0729; 6:A6ELGi7okkwhanJqowe+j4tjSFn22kq6o8mVSZatqxRAH8ABd0h3kCwd1qt53qiY9nhWkKQvqxeZ7DKQeawd0MIRoohdcWINQyCcgwOnKVxm8g3xulXPRFOCygakK9u2BItd9HTAyBUH6szyggryQbScebib41b3dF3nhRsXYZTSEdwlbBVgUm5bRBTWvUcascq+uq53cglg3ldTBjR0e2rnwbMABA0CKD+y1BIVqkKwJLTc/Bo+u6D86/GtjlTyPOu0c8DRtcHbSnR73A2mRtNCt1+rNurEdV1VNLjbqueKYFSdSqZh6e32625QNvqTH97TGmfxzXz7Et3XYemuKA==; 5:l6UO7wMwx8wtdE2+y80jibM3jGery/7G2deR75Nzqnj47PYxRO2ABVXg0bJYBOigoYmFpr1s/mmASuw/GpUTbd1jcKbavJUaK4OvWRlQN86QZKniZrMZ6nBXHvJyxOQLtwdrvnjuu7MGJJPT7j7phw==; 24:qK1IKeHZlEsfaZhoxhEQh68StiJi4h982a9tICAoWuH91AScfGiz9VwpTRMKykGeJmJvWn87YIYgRgBDlEHEVx9VZQHcyF7GPx9SmNKYzwU=; 7:UIvHzyTdvYhlZmc8wPiSvINO/xgNd/8RkXx2GuZTDGlpFjwFwKz+PCXEandPpInfncAG46uXl+5FjzcIS8KIfP6ja8ygxe9h75Rj5WcIh4xKvdOt7lQm/n2Yc6ctL4td+tE0c6Mb1cdlyXjJYzKXr+OWKhszIKs2dSRXSTgkv22iWx+HqXO9ocOzTAr9ecyoP3iwSDNpSlYPnwHd6yDj3ZZJdvmknjQ756Wfwo9IONc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 11:23:00.4593 (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: CY1PR0301MB0729 Subject: [dpdk-dev] [PATCH v5 03/40] bus/dpaa: add compatibility and helper macros 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hemant Agrawal Linked list, bit operations and compatibility macros. Signed-off-by: Geoff Thorpe Signed-off-by: Hemant Agrawal --- drivers/bus/dpaa/include/compat.h | 385 +++++++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/dpaa_bits.h | 65 ++++++ drivers/bus/dpaa/include/dpaa_list.h | 101 +++++++++ 3 files changed, 551 insertions(+) create mode 100644 drivers/bus/dpaa/include/compat.h create mode 100644 drivers/bus/dpaa/include/dpaa_bits.h create mode 100644 drivers/bus/dpaa/include/dpaa_list.h -- 2.9.3 diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h new file mode 100644 index 0000000..42733ae --- /dev/null +++ b/drivers/bus/dpaa/include/compat.h @@ -0,0 +1,385 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2011 Freescale Semiconductor, Inc. + * 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 the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * 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 HOLDERS 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 __COMPAT_H +#define __COMPAT_H + +#include + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* The following definitions are primarily to allow the single-source driver + * interfaces to be included by arbitrary program code. Ie. for interfaces that + * are also available in kernel-space, these definitions provide compatibility + * with certain attributes and types used in those interfaces. + */ + +/* Required compiler attributes */ +#define __maybe_unused __rte_unused +#define __always_unused __rte_unused +#define __packed __rte_packed +#define noinline __attribute__((noinline)) + +#define L1_CACHE_BYTES 64 +#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) +#define __stringify_1(x) #x +#define __stringify(x) __stringify_1(x) + +#ifdef ARRAY_SIZE +#undef ARRAY_SIZE +#endif +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +/* Debugging */ +#define prflush(fmt, args...) \ + do { \ + printf(fmt, ##args); \ + fflush(stdout); \ + } while (0) + +#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args) +#define pr_err(fmt, args...) prflush("ERR:" fmt, ##args) +#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args) +#define pr_info(fmt, args...) prflush(fmt, ##args) + +#ifdef RTE_LIBRTE_DPAA_DEBUG_BUS +#ifdef pr_debug +#undef pr_debug +#endif +#define pr_debug(fmt, args...) printf(fmt, ##args) +#else +#define pr_debug(fmt, args...) {} +#endif + +#define DPAA_BUG_ON(x) RTE_ASSERT(x) + +/* Required types */ +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef uint64_t dma_addr_t; +typedef cpu_set_t cpumask_t; +typedef uint32_t phandle; +typedef uint32_t gfp_t; +typedef uint32_t irqreturn_t; + +#define IRQ_HANDLED 0 +#define request_irq qbman_request_irq +#define free_irq qbman_free_irq + +#define __iomem +#define GFP_KERNEL 0 +#define __raw_readb(p) (*(const volatile unsigned char *)(p)) +#define __raw_readl(p) (*(const volatile unsigned int *)(p)) +#define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); } + +/* to be used as an upper-limit only */ +#define NR_CPUS 64 + +/* Waitqueue stuff */ +typedef struct { } wait_queue_head_t; +#define DECLARE_WAIT_QUEUE_HEAD(x) int dummy_##x __always_unused +#define wake_up(x) do { } while (0) + +/* I/O operations */ +static inline u32 in_be32(volatile void *__p) +{ + volatile u32 *p = __p; + return rte_be_to_cpu_32(*p); +} + +static inline void out_be32(volatile void *__p, u32 val) +{ + volatile u32 *p = __p; + *p = rte_cpu_to_be_32(val); +} + +#define dcbt_ro(p) __builtin_prefetch(p, 0) +#define dcbt_rw(p) __builtin_prefetch(p, 1) + +#define dcbz(p) { asm volatile("dc zva, %0" : : "r" (p) : "memory"); } +#define dcbz_64(p) dcbz(p) +#define hwsync() rte_rmb() +#define lwsync() rte_wmb() +#define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); } +#define dcbf_64(p) dcbf(p) +#define dccivac(p) { asm volatile("dc civac, %0" : : "r"(p) : "memory"); } + +#define dcbit_ro(p) \ + do { \ + dccivac(p); \ + asm volatile("prfm pldl1keep, [%0, #64]" : : "r" (p)); \ + } while (0) + +#define barrier() { asm volatile ("" : : : "memory"); } +#define cpu_relax barrier + +static inline uint64_t mfatb(void) +{ + uint64_t ret, ret_new, timeout = 200; + + asm volatile ("mrs %0, cntvct_el0" : "=r" (ret)); + asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new)); + while (ret != ret_new && timeout--) { + ret = ret_new; + asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new)); + } + DPAA_BUG_ON(!timeout && (ret != ret_new)); + return ret * 64; +} + +/* Spin for a few cycles without bothering the bus */ +static inline void cpu_spin(int cycles) +{ + uint64_t now = mfatb(); + + while (mfatb() < (now + cycles)) + ; +} + +/* Qman/Bman API inlines and macros; */ +#ifdef lower_32_bits +#undef lower_32_bits +#endif +#define lower_32_bits(x) ((u32)(x)) + +#ifdef upper_32_bits +#undef upper_32_bits +#endif +#define upper_32_bits(x) ((u32)(((x) >> 16) >> 16)) + +/* + * Swap bytes of a 48-bit value. + */ +static inline uint64_t +__bswap_48(uint64_t x) +{ + return ((x & 0x0000000000ffULL) << 40) | + ((x & 0x00000000ff00ULL) << 24) | + ((x & 0x000000ff0000ULL) << 8) | + ((x & 0x0000ff000000ULL) >> 8) | + ((x & 0x00ff00000000ULL) >> 24) | + ((x & 0xff0000000000ULL) >> 40); +} + +/* + * Swap bytes of a 40-bit value. + */ +static inline uint64_t +__bswap_40(uint64_t x) +{ + return ((x & 0x00000000ffULL) << 32) | + ((x & 0x000000ff00ULL) << 16) | + ((x & 0x0000ff0000ULL)) | + ((x & 0x00ff000000ULL) >> 16) | + ((x & 0xff00000000ULL) >> 32); +} + +/* + * Swap bytes of a 24-bit value. + */ +static inline uint32_t +__bswap_24(uint32_t x) +{ + return ((x & 0x0000ffULL) << 16) | + ((x & 0x00ff00ULL)) | + ((x & 0xff0000ULL) >> 16); +} + +#define be64_to_cpu(x) rte_be_to_cpu_64(x) +#define be32_to_cpu(x) rte_be_to_cpu_32(x) +#define be16_to_cpu(x) rte_be_to_cpu_16(x) + +#define cpu_to_be64(x) rte_cpu_to_be_64(x) +#define cpu_to_be32(x) rte_cpu_to_be_32(x) +#define cpu_to_be16(x) rte_cpu_to_be_16(x) + +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + +#define cpu_to_be48(x) __bswap_48(x) +#define be48_to_cpu(x) __bswap_48(x) + +#define cpu_to_be40(x) __bswap_40(x) +#define be40_to_cpu(x) __bswap_40(x) + +#define cpu_to_be24(x) __bswap_24(x) +#define be24_to_cpu(x) __bswap_24(x) + +#else /* RTE_BIG_ENDIAN */ + +#define cpu_to_be48(x) (x) +#define be48_to_cpu(x) (x) + +#define cpu_to_be40(x) (x) +#define be40_to_cpu(x) (x) + +#define cpu_to_be24(x) (x) +#define be24_to_cpu(x) (x) + +#endif /* RTE_BIG_ENDIAN */ + +/* When copying aligned words or shorts, try to avoid memcpy() */ +/* memcpy() stuff - when you know alignments in advance */ +#define CONFIG_TRY_BETTER_MEMCPY + +#ifdef CONFIG_TRY_BETTER_MEMCPY +static inline void copy_words(void *dest, const void *src, size_t sz) +{ + u32 *__dest = dest; + const u32 *__src = src; + size_t __sz = sz >> 2; + + DPAA_BUG_ON((unsigned long)dest & 0x3); + DPAA_BUG_ON((unsigned long)src & 0x3); + DPAA_BUG_ON(sz & 0x3); + while (__sz--) + *(__dest++) = *(__src++); +} + +static inline void copy_shorts(void *dest, const void *src, size_t sz) +{ + u16 *__dest = dest; + const u16 *__src = src; + size_t __sz = sz >> 1; + + DPAA_BUG_ON((unsigned long)dest & 0x1); + DPAA_BUG_ON((unsigned long)src & 0x1); + DPAA_BUG_ON(sz & 0x1); + while (__sz--) + *(__dest++) = *(__src++); +} + +static inline void copy_bytes(void *dest, const void *src, size_t sz) +{ + u8 *__dest = dest; + const u8 *__src = src; + + while (sz--) + *(__dest++) = *(__src++); +} +#else +#define copy_words memcpy +#define copy_shorts memcpy +#define copy_bytes memcpy +#endif + +/* Allocator stuff */ +#define kmalloc(sz, t) malloc(sz) +#define vmalloc(sz) malloc(sz) +#define kfree(p) { if (p) free(p); } +static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused) +{ + void *ptr = malloc(sz); + + if (ptr) + memset(ptr, 0, sz); + return ptr; +} + +static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused) +{ + void *p; + + if (posix_memalign(&p, 4096, 4096)) + return 0; + memset(p, 0, 4096); + return (unsigned long)p; +} + +/* Spinlock stuff */ +#define spinlock_t rte_spinlock_t +#define __SPIN_LOCK_UNLOCKED(x) RTE_SPINLOCK_INITIALIZER +#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) +#define spin_lock_init(x) rte_spinlock_init(x) +#define spin_lock_destroy(x) +#define spin_lock(x) rte_spinlock_lock(x) +#define spin_unlock(x) rte_spinlock_unlock(x) +#define spin_lock_irq(x) spin_lock(x) +#define spin_unlock_irq(x) spin_unlock(x) +#define spin_lock_irqsave(x, f) spin_lock_irq(x) +#define spin_unlock_irqrestore(x, f) spin_unlock_irq(x) + +#define atomic_t rte_atomic32_t +#define atomic_read(v) rte_atomic32_read(v) +#define atomic_set(v, i) rte_atomic32_set(v, i) + +#define atomic_inc(v) rte_atomic32_add(v, 1) +#define atomic_dec(v) rte_atomic32_sub(v, 1) + +#define atomic_inc_and_test(v) rte_atomic32_inc_and_test(v) +#define atomic_dec_and_test(v) rte_atomic32_dec_and_test(v) + +#define atomic_inc_return(v) rte_atomic32_add_return(v, 1) +#define atomic_dec_return(v) rte_atomic32_sub_return(v, 1) +#define atomic_sub_and_test(i, v) (rte_atomic32_sub_return(v, i) == 0) + +#include +#include + +#endif /* __COMPAT_H */ diff --git a/drivers/bus/dpaa/include/dpaa_bits.h b/drivers/bus/dpaa/include/dpaa_bits.h new file mode 100644 index 0000000..71f2d80 --- /dev/null +++ b/drivers/bus/dpaa/include/dpaa_bits.h @@ -0,0 +1,65 @@ +/*- + * BSD LICENSE + * + * Copyright 2017 NXP. + * + * 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 NXP 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 __DPAA_BITS_H +#define __DPAA_BITS_H + +/* Bitfield stuff. */ +#define BITS_PER_ULONG (sizeof(unsigned long) << 3) +#define SHIFT_PER_ULONG (((1 << 5) == BITS_PER_ULONG) ? 5 : 6) +#define BITS_MASK(idx) (1UL << ((idx) & (BITS_PER_ULONG - 1))) +#define BITS_IDX(idx) ((idx) >> SHIFT_PER_ULONG) + +static inline void dpaa_set_bits(unsigned long mask, + volatile unsigned long *p) +{ + *p |= mask; +} + +static inline void dpaa_set_bit(int idx, volatile unsigned long *bits) +{ + dpaa_set_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); +} + +static inline void dpaa_clear_bits(unsigned long mask, + volatile unsigned long *p) +{ + *p &= ~mask; +} + +static inline void dpaa_clear_bit(int idx, + volatile unsigned long *bits) +{ + dpaa_clear_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); +} + +#endif /* __DPAA_BITS_H */ diff --git a/drivers/bus/dpaa/include/dpaa_list.h b/drivers/bus/dpaa/include/dpaa_list.h new file mode 100644 index 0000000..871e612 --- /dev/null +++ b/drivers/bus/dpaa/include/dpaa_list.h @@ -0,0 +1,101 @@ +/*- + * BSD LICENSE + * + * Copyright 2017 NXP. + * + * 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 NXP 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 __DPAA_LIST_H +#define __DPAA_LIST_H + +/****************/ +/* Linked-lists */ +/****************/ + +struct list_head { + struct list_head *prev; + struct list_head *next; +}; + +#define COMPAT_LIST_HEAD(n) \ +struct list_head n = { \ + .prev = &n, \ + .next = &n \ +} + +#define INIT_LIST_HEAD(p) \ +do { \ + struct list_head *__p298 = (p); \ + __p298->next = __p298; \ + __p298->prev = __p298->next; \ +} while (0) +#define list_entry(node, type, member) \ + (type *)((void *)node - offsetof(type, member)) +#define list_empty(p) \ +({ \ + const struct list_head *__p298 = (p); \ + ((__p298->next == __p298) && (__p298->prev == __p298)); \ +}) +#define list_add(p, l) \ +do { \ + struct list_head *__p298 = (p); \ + struct list_head *__l298 = (l); \ + __p298->next = __l298->next; \ + __p298->prev = __l298; \ + __l298->next->prev = __p298; \ + __l298->next = __p298; \ +} while (0) +#define list_add_tail(p, l) \ +do { \ + struct list_head *__p298 = (p); \ + struct list_head *__l298 = (l); \ + __p298->prev = __l298->prev; \ + __p298->next = __l298; \ + __l298->prev->next = __p298; \ + __l298->prev = __p298; \ +} while (0) +#define list_for_each(i, l) \ + for (i = (l)->next; i != (l); i = i->next) +#define list_for_each_safe(i, j, l) \ + for (i = (l)->next, j = i->next; i != (l); \ + i = j, j = i->next) +#define list_for_each_entry(i, l, name) \ + for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \ + i = list_entry(i->name.next, typeof(*i), name)) +#define list_for_each_entry_safe(i, j, l, name) \ + for (i = list_entry((l)->next, typeof(*i), name), \ + j = list_entry(i->name.next, typeof(*j), name); \ + &i->name != (l); \ + i = j, j = list_entry(j->name.next, typeof(*j), name)) +#define list_del(i) \ +do { \ + (i)->next->prev = (i)->prev; \ + (i)->prev->next = (i)->next; \ +} while (0) + +#endif /* __DPAA_LIST_H */ From patchwork Thu Sep 28 11:33:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 114414 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp624826qgf; Thu, 28 Sep 2017 04:31:57 -0700 (PDT) X-Google-Smtp-Source: AOwi7QD0a5rAovYXA3Vetq2bAdMHg/YKHvyywWJpALE99am5ihwDxAqoKjhAVJ6Z6qFWjm3VbdKD X-Received: by 10.28.151.198 with SMTP id z189mr780552wmd.133.1506598317734; Thu, 28 Sep 2017 04:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506598317; cv=none; d=google.com; s=arc-20160816; b=xrT/jOAA7U0VatD4Jjnoem0EEFKfWFdA05fpGCtLHrbb21bcek7phOzyKjKO6yhRKn F6c12jWH5A0IaSisBJG7emmve/NSA7ONVnCcfFpyftaG4eAg9sAl/i+H0tXlIW1A87/w kqz2uaTN3Op9qjiVuf/hqXrjsOCOAbq9gq7xgwaXedQkey4B9quyDVrfB4uCiI2AcKDA bUT/Rwd7EY6EbMqLS1VgN1CMA3A8Po6STyKFYVdfhJkLZ7jIgBMeOtEY9dTagHXe9EWg oX5xtE46by6P42N+1UvMwQeMhW7zmidMKgabtgukaTRZTYQS9pbD3qcSYqa0ta8TcY6/ mkHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=D+XOb33iKU1qCmtg0kdqjtjce7QmrOnQmpAkkJOuN7U=; b=roBQtVB//0UWj72LiDnq13huxfMFEy+yLasnjd5P9nQ3MGaDVON02QXf5YZJidCtDy JbbacySwWQCJiUu//3nprCa+G75LdPKKTD2jao5PeQhOXWL+yPYN324ox+4+0HGyrbb1 xHkBJVm1Zj3u/d+AVcX4WtbLnNvY983jYpNdpPNnFI91TqNrEQsZD/Vvq2OjkpnfKP+r TSqMH47VWpHXe5XPlE5w0FIEp0IObIPB7aokzucTD3Rxi3Zj6wjQc4uRrTF60Yjr2QHl vY75+Y68bDQKtMTN47++hvgsvRn0PRWDpJMaQiVtZjwizhtq9I4BwEbQCMZ6nswiVLyT B3jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id g2si1241640wrc.106.2017.09.28.04.31.57; Thu, 28 Sep 2017 04:31:57 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 612CA1B28B; Thu, 28 Sep 2017 13:26:17 +0200 (CEST) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0072.outbound.protection.outlook.com [104.47.32.72]) by dpdk.org (Postfix) with ESMTP id 355281B218 for ; Thu, 28 Sep 2017 13:24:23 +0200 (CEST) Received: from BN3PR03CA0088.namprd03.prod.outlook.com (10.167.1.176) by MWHPR03MB2704.namprd03.prod.outlook.com (10.168.207.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 11:24:22 +0000 Received: from BY2FFO11OLC003.protection.gbl (2a01:111:f400:7c0c::130) by BN3PR03CA0088.outlook.office365.com (2a01:111:e400:7a4d::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10 via Frontend Transport; Thu, 28 Sep 2017 11:24:22 +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 BY2FFO11OLC003.mail.protection.outlook.com (10.1.15.183) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.56.11 via Frontend Transport; Thu, 28 Sep 2017 11:24:22 +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 v8SBMpGF016035; Thu, 28 Sep 2017 04:24:19 -0700 From: Shreyansh Jain To: CC: , Date: Thu, 28 Sep 2017 17:03:43 +0530 Message-ID: <20170928113344.12248-40-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170928113344.12248-1-shreyansh.jain@nxp.com> References: <20170909112132.13936-1-shreyansh.jain@nxp.com> <20170928113344.12248-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131510714627838469; (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)(7966004)(336005)(39860400002)(346002)(376002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(8936002)(1076002)(81166006)(305945005)(8676002)(50226002)(81156014)(53936002)(5660300001)(356003)(6916009)(2950100002)(316002)(8656003)(36756003)(86362001)(47776003)(5003940100001)(104016004)(2351001)(85426001)(50986999)(68736007)(106466001)(97736004)(105606002)(76176999)(498600001)(48376002)(33646002)(50466002)(54906003)(4326008)(16586007)(189998001)(2906002)(6666003)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2704; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC003; 1:lu7ouVRbKHSO/vOl3MUOAfZwsBTS2QwQ/6rUNoMjz8lhs4r0Q/rohjM8Cr2evAAvLiOY7wgjgIfkZUloO7yhXF6c29RDMYxCalZJf2D1aRmY0YraFXPfy1jA09Kql42p MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df85570b-b679-44ea-65c0-08d5066377ee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:MWHPR03MB2704; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 3:MLiArVjL1/aHouJ6hD1uuEpmUecxUYOTrKVZYCeC7aZW6fP6Be0eJsmkO4aHBV2wDESyJKrK2T9T6mcLF1eihgsXF8UjYnunWuM9QF/xfPFgD/pyncHmmiAqA1QLm1TDg9eszUwPISLge7It1fGZF/tsc5OR6FGUMgaF8Z2q8oTEWKTk0JOnYsDiz2CEzm7p7lwU4YiiOZ8rQyHCYYbOP7Ouo0PdoTn7DWtqgQC2Xi1ZYM+QbPuAa6mQxAxqt3/jcHCDTjQ+zOBGQ6hBhuBzL5GmdZCiU6cj5KcNH7wRDykkxWwQ6SdiQ5AmOEcGw/th+0liRe3jAfg0M3Q1ZRdmjBg7koCwDQOvAEmLHevHZUA=; 25:FF1lBJe07XfJp59PtEKhxJ9md3ze3qY7vXpmk3RlRuUC0HPXYmKErdLFxnW7h1wLm3NXU76ku688Z8yFGedBoLuVoADN9lRsAaSz9TxHwVzEbBKOnqHwSaJzM7tpDVg0aXM14bBNn+Go7VERoRpm10A/P2b/wAqoj5yYB76LUmnwmRA+E6IIMdrBbgvPe36PKc3xQzo8purN4uaZbziyjwS5AAMG8YShtGshU77q5vvU5Haeu6uct+6GLYxcF0IyQiK4O7oDNe1be2vQdfOF3zP/6aarnJg/pB4AEO4FJy6Y7vNEB1HnMvPC3TqV3nkw8ELFd0n5YQ+8Eknt88djdw== X-MS-TrafficTypeDiagnostic: MWHPR03MB2704: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 31:x4MPhRxdwRW5WMvrDtbdFkye+fL08ZLIgEgtcd6a2851dCOb5JyZYf30Hj3p7GLe9gPrQUhQZZnlXMikaZ0TCroEiERKto98sIZbe7de2WMnNdD3vrLSm+b8WOuD+c9BewUAKF1ot6p6dQTHt1Gwdl/SYgWhS13o5HWYa59X1Au/EYNxv4vkHZAtaRCRDEjE6D8RHid5+mAq0oZl5T+jhZhz8WLA2HcV4m021P6K2pc=; 4:pQ8F7g5oz3DkbAz3CJDHOWcFRD4mfcJrOJv0YM4LWcQslGAx+8299dGfPJu2RmgG2kTiYcLlvoIhpd/0qJyZacZrsJjGbsAJZxo99AhB1sSYl5zu032E7yzu+q/c2DpiG0FHUpurQnA/CZWvfFvsr0HXF9WSZU4rXGFEB+0F59dBQDULHPrEKY8621XchgHHuvCjwervkXwsFUo4uNNsA9hSOPxTyI1eiJtflaAa75jwQo1HnVafzekd1tNkibSZk82cZ6SkoFcZumNX+bt/AOvrbYfvF2mGRPQTQSmZV2A= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6096035)(20161123556025)(20161123565025)(20161123559100)(20161123561025)(20161123563025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB2704; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB2704; X-Forefront-PRVS: 0444EB1997 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2704; 23:wLuaAxQmWJczpxCGAMLz/caFvpZ6wfoL4rKYcDAbw?= A3c9vMbaNhz/z/f+QYMydXcf63+uS5O+0wOQel/clDGsnp6qbdzw+G5TAJvaUI9EK3XcPW6a5GMLK7gakRAVVXyo6nj+2gEfy0sD/TC0QVxb+GbfDUJPxf3vChTfrXFcUW8T7EH8hskEIFXgtTpAXGFZasBYYIHyQ2b6CTZozQnbP+0yBZntzVx7IieNU7rtoQH3CAHVUCxgub5eZqANLAJo4uagLpJyNVM6y8q9FWqROs8SyJimahY7QgBK0Nt5EDi8LC+6WBHeVdyHFEEuHWwlcJU+puVpCccbHmaMdwLzzggTOXzkgkj9W8bn3f0ta84I26wuFraZYPGV9aqw6iJpnYc8lFPK147WnsgcdRHvyeuk0RaR+RpIiwiyLSCAisG02NTYwOgBvakQjTCTRajktQiIdlNm+z1kVDoZH+RYXXCW8sUz1JuNa8c565eJUY9e+hTeVXZGRCuyFeBRDo0sF0fMgfNTY73b1BrWzxUAmmxUcFam6wanXevDp1/iZZSwCmWfNXc+bzCjBOJqIPwwff1QRR71ARzEka2k6qfu7q9aouhTlqGVb7GBz6vG9spmpZtKJdO7CAsRcwtjthj+1BPT9JnmmKD0eEzUBKXZ+thgyGnJQohjcJrTazg88EsL1FZRIQZYTwIPqQb4wpCprrkR24jMfoUfOaaJueJcBdJBW4U22o98z7fuZkSE2fRhxkISm6pj6UeFModSyPBZH+AUd3tBDZoDxiUCm6MTBtUgQqapolRGv8f8PRj1gFEfZ9IOevJZehvffEZIPsy02xcRMiExY+SqPm3aS5DlKlKVsBOSBjuppSKk41cdyBSaKbIzsZSn4oz8GtqrXy2C2dXz2xuI+uWHoFjkW+YPPdrzayQ7z+9vNTZ+9RKvKdZKZ6W1La6q7ShRzwHhOBP7oJ7eLLA/3Owj29PwXDPPF9nqskUrTk8xRgsyKnEUvaU5LvoHAfDxjFVh1mvsYSkkkgboQgQJ4G+pEc1C3gLvftAVpcCc5jdFz8q51b9K5mi178z0TdhFSNRRghoKvwyVK1pmT+jXSmwxksI+Sxu+c3lAUc4y8veWRP9FQhpZFVuIhVKYhmSvqErxxVVHn+WZIFCIMETqYMrzbQ//IAkBmo9bXDLfTnOdmGm+MBJ7hHJLhmNtbIS1rb2CdR5akwp X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 6:GQvUVOYHT3ItmsaV8l4YI8LUTVJQtNWWKyFQ4BL+tKUPSiXMOrvFvE3ugYiFccXgh3ltv6N58zfC6bRyZUXcBmeEPXNCQQjvGSOiuDIF8kxVzAvjORUfrZQ0CRAZD4T9w7Z/7R4wYU23HdOZpk+i+3bClA4VkyYL1DIUAF5iDA9IsgSdC2LQdxn/XGlsxH465rQ+icnhzmfLY0t9G5AZ24MAZeZdLKQybaxrCu6AhkRcCp08nCBS8ANvwHiTPvyS5ESYorYvoSAAUndcN7ol88DOxX01QOoQ+hlguZr0S63nvh95wDfjAeGshYZilo81CFRYZIClK9wBT4GEBpRYvw==; 5:GQT0vi0A6YlDoRLPnjVDR3i47XhC88pUlDtZTq/IQRYEJIPYpzfJaOoEbmkdTGGPSHwgpv3yQuuEVkKWJORXemxN1tJd+77Mn9X7iAH+ZbSke+NarkDf+Wmh4mqrZLclaS8covGCKrWGOfJC+40WcA==; 24:Vsy3xdGiDSEy//JB/g9R/rPS+Z6uCK2/17R1lM3TM3bsJWHpoRnQqsCI8zyPLUnQl6c/GccMg2LV2wFqs3OQBtsAmczP/ewZSa6FuRDPDTA=; 7:e3RIjQUYa/uCCLF/tLq1S+ScTReYu08UcDoF9SSozdBIUlNV/EEimTLRfVp9Wg2J2WthWm0eSKeJ0kxPyzwYC1bnjQ0iUuFP4uvi97yJlyv+NNk1GC0sapJwrQM3s9A0jg/OeOewR725MuYTu7vb0YiDoaHB2FXn1ClS8vEhhUG1DHAM4Qk2d06HXExVtRy4Tpv8nMbg8+jT0xXftczBxZ9b2fvF76ORNUZ+2zNKddE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 11:24:22.4562 (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: MWHPR03MB2704 Subject: [dpdk-dev] [PATCH v5 39/40] net/dpaa: support firmware version get API 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hemant Agrawal Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa.ini | 1 + drivers/net/dpaa/dpaa_ethdev.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/net/dpaa/dpaa_ethdev.h | 5 +++++ 3 files changed, 42 insertions(+) -- 2.9.3 diff --git a/doc/guides/nics/features/dpaa.ini b/doc/guides/nics/features/dpaa.ini index 0e7956c..09b9bd9 100644 --- a/doc/guides/nics/features/dpaa.ini +++ b/doc/guides/nics/features/dpaa.ini @@ -18,5 +18,6 @@ L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y Basic stats = Y +FW version = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index ad9fea8..0002324 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -164,6 +164,41 @@ static void dpaa_eth_dev_close(struct rte_eth_dev *dev) dpaa_eth_dev_stop(dev); } +static int +dpaa_fw_version_get(struct rte_eth_dev *dev __rte_unused, + char *fw_version, + size_t fw_size) +{ + int ret; + FILE *svr_file = NULL; + unsigned int svr_ver = 0; + + PMD_INIT_FUNC_TRACE(); + + svr_file = fopen(DPAA_SOC_ID_FILE, "r"); + if (!svr_file) { + DPAA_PMD_ERR("Unable to open SoC device"); + return -ENOTSUP; /* Not supported on this infra */ + } + + ret = fscanf(svr_file, "svr:%x", &svr_ver); + if (ret <= 0) { + DPAA_PMD_ERR("Unable to read SoC device"); + return -ENOTSUP; /* Not supported on this infra */ + } + + ret = snprintf(fw_version, fw_size, + "svr:%x-fman-v%x", + svr_ver, + fman_ip_rev); + + ret += 1; /* add the size of '\0' */ + if (fw_size < (uint32_t)ret) + return ret; + else + return 0; +} + static void dpaa_eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -512,6 +547,7 @@ static struct eth_dev_ops dpaa_devops = { .mac_addr_remove = dpaa_dev_remove_mac_addr, .mac_addr_set = dpaa_dev_set_mac_addr, + .fw_version_get = dpaa_fw_version_get, }; static int dpaa_fc_set_default(struct dpaa_if *dpaa_intf) diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index e1e062e..a980262 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -43,6 +43,11 @@ #include #include +/* DPAA SoC identifier; If this is not available, it can be concluded + * that board is non-DPAA. Single slot is currently supported. + */ +#define DPAA_SOC_ID_FILE "sys/devices/soc0/soc_id" + #define DPAA_MBUF_HW_ANNOTATION 64 #define DPAA_FD_PTA_SIZE 64 From patchwork Thu Sep 28 11:33:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 114413 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp624271qgf; Thu, 28 Sep 2017 04:31:24 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBZ84/Ya8RQ2AEcuh1x/Dov2aY/tlA57zONn5+nqSHjcKNsiZcfziznE5hkhieuE1vd9v+o X-Received: by 10.28.57.197 with SMTP id g188mr723262wma.92.1506598284207; Thu, 28 Sep 2017 04:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506598284; cv=none; d=google.com; s=arc-20160816; b=p7w+xfaOFnSnQAbpY36CFWSTjrYVNvewcBfTSU2C5qeoco2PSxM9dXviYMHMQ9ACLX awrlTapd3s8L2MCrWtMsgMVoAsNrjjLmBbD0dojkxvK10gor9FCwS8n8zFm+LZ3JlyG+ 5lKhyBcryOgsaPwgoJJphad/cZ8so8UduXV7SLfrSddQbKPHJHwQD5ExA7dtVGqpADjr UEi8u/kW5LhzA7tbOMfma29+D9BkYNEwwPqHYI9oKQ8BM/XftNyzB8rxgzXFuWXRmx08 3mt5V3bhWxskf+gI64OPiFUKEGeAk0xtUlK5n40khHCU/RC/qvQvbFH/JZrDmp0sqnUg Qq1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=Ejx3hHNQv5aOXO1We0mPBXAMZFQcspT4BFD2zQjRkqg=; b=G+duRyvBOa4rG489USnowxAcUTZ2/9L8W6YwCf6sWyYhl+w4xYh9GewEhbeOFNYOzR +w4jiGtv182dxyCqDDwjMvlmIjDpWJ8q2U3O2HHJMiC4r2zsYojabRvj1SjFZo0B+2VP rUs3CtnemgqXqeVb2+rJ+HONaiKO8av1BFAvxS9CJqTDDChq2y/GpMceIoWQyAJqOpK/ vqCGjm99H4DQkuwCwYVTajGV+FkH4slrZRoBqu3b60Z7yjn0LofKvGC7541zmnPOhWub gc2wG4Ce33TebQtWYSZffG0/KmZiOF6BWS6msx89ezoiL3bOJuJjI1SoQutII9RaAbte ejOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id l16si527589wma.170.2017.09.28.04.31.23; Thu, 28 Sep 2017 04:31:24 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A2811B216; Thu, 28 Sep 2017 13:26:01 +0200 (CEST) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0082.outbound.protection.outlook.com [104.47.41.82]) by dpdk.org (Postfix) with ESMTP id 6CEED1B21B for ; Thu, 28 Sep 2017 13:24:26 +0200 (CEST) Received: from CY1PR03CA0010.namprd03.prod.outlook.com (10.174.128.20) by MWHPR03MB2703.namprd03.prod.outlook.com (10.168.207.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 28 Sep 2017 11:24:25 +0000 Received: from BN1AFFO11FD035.protection.gbl (2a01:111:f400:7c10::136) by CY1PR03CA0010.outlook.office365.com (2603:10b6:600::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.8 via Frontend Transport; Thu, 28 Sep 2017 11:24:24 +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 BN1AFFO11FD035.mail.protection.outlook.com (10.58.52.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.56.11 via Frontend Transport; Thu, 28 Sep 2017 11:24:23 +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 v8SBMpGG016035; Thu, 28 Sep 2017 04:24:21 -0700 From: Shreyansh Jain To: CC: , Date: Thu, 28 Sep 2017 17:03:44 +0530 Message-ID: <20170928113344.12248-41-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170928113344.12248-1-shreyansh.jain@nxp.com> References: <20170909112132.13936-1-shreyansh.jain@nxp.com> <20170928113344.12248-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131510714642514313; (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)(7966004)(336005)(346002)(376002)(39860400002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(1076002)(498600001)(54906003)(50226002)(68736007)(2351001)(2906002)(106466001)(305945005)(36756003)(5003940100001)(33646002)(316002)(8656003)(5660300001)(85426001)(8936002)(16586007)(86362001)(48376002)(76176999)(50986999)(6666003)(104016004)(81166006)(50466002)(81156014)(77096006)(47776003)(53936002)(6916009)(2950100002)(105606002)(189998001)(97736004)(8676002)(356003)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2703; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD035; 1:qOhN7OSo2xZQm1DEImrDZrUFe9JmSKmbVC9k/y56qmKXd5wmVsFMEAqAFW1MsuwlhfTZa6YC08GNFjfVVng1vhc2On78ZScHVicj9qTq2JBbXKmO9W0k4Hw0B9G/ycX/ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6ac8cd9-91e2-480e-b689-08d5066378d0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:MWHPR03MB2703; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 3:+AB7ea8pxoYytGAbbHXZ2ymx0SzD+RwzeVuZAW1XqC52R1bM45+3aItmqRNxGpMpKa9cc7PtIbO34ozZgKg9z/afHnUotJTP6/sle+ZxsdDG/CyNxFWK9Gte7sy4m04OJCan95Wn6xa+YziYwAXNC0aLRfomteTxgD6iiK8HZ9eDo/JC5RngzD87pz6hc/LaVoDRx4txT13ISZqHrI4cPHJshYPjjY6OWcrVkStElzXcHy2QT48NqKheS+sq20leCZyeivSfCyFdPMa3e5ojWIV+2QnY1ksDBZlnEgRwDP+9g749Q/yhPIqz+bNYDvBHkEkDav8cPrSU6HA+v20eyKmvv4iarE4cpWrfTT3XGB8=; 25:bCVCorQuFNTu5otg4/RiZQDF9HrjmvImpKD6T9IQx1JEaGybJ7fwoqZDrlswgOUPiI45Fu8lt8GLAOFvNvekN7xYDXCOb4g7xS/nY/jyq1WvJJ6UilWg4Y0ZSG59IGs0wQUvkXBIAsXvSRVsX8qVhkzvfzRSQnuPAFVSemsjYUm2fzGWPnAXM0mpDTFaHCcWluF/6sZlSE6R8EvVB1eMmq/FRySg5MxqOqDbvn1MD9+VtLJ+tyNQ0nfYF6o+T4YbyftY8E4iS4SyxRaRWL2E62+VeKPBgvZ6mi55raJl04iCn4hHKa8RwlLQrRHwwODA4HfDCyOHv9MKCrNfsQNSpg== X-MS-TrafficTypeDiagnostic: MWHPR03MB2703: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 31:I0TE5/eypp6BsmePEgXIP0dZP5SuyZ1KpK7Fcej7Y1FSJzSpNkAk6dQC5ca3DsseidFXWqjnRoMFWCTinZKgtHJFRpJ1tuBlzvQuRfADlggOCtnM7BxxfC47JxIBQbbuYhym5WKpI5YLMoFQBLgzgiuaEQtzf/n6kr9Oa7PkYPLsUGeFji0CWCTMbBVyIWlgXKzdXUqrbhqln1o+UcWZKJQSOa9FJKRYvYXDrInOkwk=; 4:FIDqL+M+MHtiC1FhkMieU7XOBOWdHiUtRn9jKrL6TOlPHbE+uKGQ6pgRO5JVFtn17mpVoMiyDbzBbfq0YlGxHyArJ3+5If7g9zdHYoCHuaz2ht1Q47uDPOj9x4w1lSrIzQv7CXOVn4YLeDDEi8SURdyW71WKo2FuJZlDPR9h02dF29cyvPwGJ48idsFB60zVthZP0+cPzYPQ0qhvhqX8B8AHQyqcK2qlTAaMz2mgjUWQDnl9qj0kkk5kOyIaPXc4nTdQPOQDoUfZdc6pzmtGUkI4zjvXwPY8ydze6rIabDU= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123563025)(20161123559100)(20161123565025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR03MB2703; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR03MB2703; X-Forefront-PRVS: 0444EB1997 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2703; 23:9ZovL2VkpF9Rf3dKYUMF9qLncy+l5TUHRFNWbdkvj?= l0RudvyJlliZJumlhgADt6wIdLBuagCX+QDyyzYrn8nPlr3Qx4xubBNVLM7jMa0ydM4jyV1ioL1FjvI+DMCnxHbK8FLcTv8oqb3VhsNxeSAWNZeDYoyqXLAX7AeHIUzFzF1++nqBPl4WeZ53/ejQx6wRAPw5GxyZgEpa3q4PfovXOL1eFAD1WpvBeawcewghPuQcd4q0ntHEQ/QsF8o1Gg0n6Ek0T+MqKgEVbwp8T/XlneopNwypXjKr6FothfeARCMio1ev4pjpn3uJ5RDXmu3MLazKv6N8e5VZP7TiKqKj6a+ZCSVrz3O4ID53frc45fCYeP9GGqryUN9LmiEpOuJMdj03VSb2IEwWlOC1962uyk6CJ+ZrVByATg1HHsvMONCrmCAELaCDqNq+vWemEF4UM97xrdPbjiFJLXsMybxnIXvH57x/DxHuFwrUr+kAm1Wv7yY43sho51WsxIO5IKz6q1XN5WqwirmwXQqmWriYsoVcvWjJNk3K39d9hVPMxB6JHqlzGy9JfAamhrCTfrBE61uoWfLoqp/XBdpcInUUGXHNiT57LLQiigus4+68CURZbp4zypTPQP+h4vH6iRV4Mwu+Q1Wns6hkap4R2i+Qktm7V7olCEqpu0YMJxkA9eQ7qzKLM7DD8Oh3WFjDGoMW1Bal0ewgesIxKr3xsFCGbMM/YmAQsBTV+6JRan9KY4mDeu6UWEybLaIki0JE1HgQ6Tex/wSvdP5udFqrIlbLsmlWKknD6SEW0Ii18m/1IW8P34umwhKnu2VTmYIMT4y4saYUO6x2UmZWcLnVFHcjcgNOLkrjJt/kXkAq8pOcUTs5pbDSRQYeqkgI4rIlGZO4Lg2IMzZYEjhdE2osvO/iO4nh8bmQ35yibt/pS/xYRJVdpr28fmfFbAZSRAgHViIvh3DW7CNRu2/ajBnegLvU3W3sRuHsH3C/dhJtPbPEbsp7gxeCzFSuPkBIVVEMGC+4i3AaNH8pTdAzQtEsA8zMXyMBMcg8hIAukmOLv8bmcuCxLBTTIPki8W7lcHgwD4vYtZn0qZSamyq/31bhcvKGEQzrVuTwfJHJCUWaurAo+NJMyEsv1bVjYA/ZUySmgGIDuPOPT+hxrGcwsNywRm5JEnQGAmAlCTd34N6bZqaBD0+B4R8QgGodsEta/n96k7O X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 6:LIAnmpao4STiz4c7BwvRuE5ckqM1Qg7Awmxdq2r0HL/HU4V2uYVFCzCIFYMe5ZHTSbEdL7vEhpveGiFLWynzUowF8cICwOguhVl5G7iXc4gXuZDwY8RsoHnymPPZHPhsrZbRqKp+Pq4aANySn8QAJPCy4qD/K31ub3KONEvVUF2rgf3Ls18wu2Rz+zVW8MS9TcrWYDqncFKbfF5ddzsmJTJfKWp5t2ZjRp8NxaBeCWhh1tQY/zEMX6sqgB4IzHk7TgjwMesdp2wPOShKTyN2ukvCxgZmN92uuiaO2XPrb7rFHOVp+OrSUntXfY7/SQEHA7hNJCY1tdfLaMCM2ILh6A==; 5:0RlkQ0soBpHfYGSA/m2RU6w8C3zAvwclyv7W1vyNq1tbrgzncHysQoC2ZGDkLsdqD807mwxX0QqYVTJ9v9K67nLNef5vFHJqjQHVAFCf8jEYdjh8IcSRK0DdgHh/k44iqbp4byalNkKQ3OvPxNHAKQ==; 24:debEHMh+wiLcMDnwtniAzNC4U9CNoDcI95W5OthdNwCNrcT9GzTWHsbmtsREgmqpUCCD7ZSyiHPszAWt+uks6MrN/va7ZLr5yEug7DuCj8o=; 7:ztm86IsZUPF5veEg4BDsk33eABvJfOU1ekq5BtrCAfsUwuUko6LjtO7ZsZbOjjPFmzaC3n1M0Ljew4sPIJ0GUQfh4bWi6AjoXZgExNuSD6FLmzFnp8PD3hQPWG1VE41CUxTUmSdLE8WKawxHwP8IPYKZpjbcvs2Gx1xzx4VP8KloV4LsKQPgPkwJwfgR0rR8q7dbQJnYW4m4ogFV9gzH9Vh4mGaa26iPSJtPvnElE3U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2017 11:24:23.9394 (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: MWHPR03MB2703 Subject: [dpdk-dev] [PATCH v5 40/40] net/dpaa: support extended statistics 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hemant Agrawal Signed-off-by: Hemant Agrawal --- doc/guides/nics/features/dpaa.ini | 1 + drivers/net/dpaa/dpaa_ethdev.c | 143 ++++++++++++++++++++++++++++++++++++++ drivers/net/dpaa/dpaa_ethdev.h | 40 +++++++++++ 3 files changed, 184 insertions(+) -- 2.9.3 diff --git a/doc/guides/nics/features/dpaa.ini b/doc/guides/nics/features/dpaa.ini index 09b9bd9..24cfd85 100644 --- a/doc/guides/nics/features/dpaa.ini +++ b/doc/guides/nics/features/dpaa.ini @@ -18,6 +18,7 @@ L3 checksum offload = Y L4 checksum offload = Y Packet type parsing = Y Basic stats = Y +Extended stats = Y FW version = Y ARMv8 = Y Usage doc = Y diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 0002324..db4921f 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -75,6 +75,40 @@ /* Keep track of whether QMAN and BMAN have been globally initialized */ static int is_global_init; +struct rte_dpaa_xstats_name_off { + char name[RTE_ETH_XSTATS_NAME_SIZE]; + uint32_t offset; +}; + +static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { + {"rx_align_err", + offsetof(struct dpaa_if_stats, raln)}, + {"rx_valid_pause", + offsetof(struct dpaa_if_stats, rxpf)}, + {"rx_fcs_err", + offsetof(struct dpaa_if_stats, rfcs)}, + {"rx_vlan_frame", + offsetof(struct dpaa_if_stats, rvlan)}, + {"rx_frame_err", + offsetof(struct dpaa_if_stats, rerr)}, + {"rx_drop_err", + offsetof(struct dpaa_if_stats, rdrp)}, + {"rx_undersized", + offsetof(struct dpaa_if_stats, rund)}, + {"rx_oversize_err", + offsetof(struct dpaa_if_stats, rovr)}, + {"rx_fragment_pkt", + offsetof(struct dpaa_if_stats, rfrg)}, + {"tx_valid_pause", + offsetof(struct dpaa_if_stats, txpf)}, + {"tx_fcs_err", + offsetof(struct dpaa_if_stats, terr)}, + {"tx_vlan_frame", + offsetof(struct dpaa_if_stats, tvlan)}, + {"rx_undersized", + offsetof(struct dpaa_if_stats, tund)}, +}; + static int dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { @@ -268,6 +302,110 @@ static void dpaa_eth_stats_reset(struct rte_eth_dev *dev) fman_if_stats_reset(dpaa_intf->fif); } +static int +dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + unsigned int n) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + unsigned int i = 0, num = RTE_DIM(dpaa_xstats_strings); + uint64_t values[sizeof(struct dpaa_if_stats) / 8]; + + if (xstats == NULL) + return 0; + + if (n < num) + return num; + + fman_if_stats_get_all(dpaa_intf->fif, values, + sizeof(struct dpaa_if_stats) / 8); + + for (i = 0; i < num; i++) { + xstats[i].id = i; + xstats[i].value = values[dpaa_xstats_strings[i].offset / 8]; + } + return i; +} + +static int +dpaa_xstats_get_names(__rte_unused struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int limit) +{ + unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings); + + if (xstats_names != NULL) + for (i = 0; i < stat_cnt; i++) + snprintf(xstats_names[i].name, + sizeof(xstats_names[i].name), + "%s", + dpaa_xstats_strings[i].name); + + return stat_cnt; +} + +static int +dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, + uint64_t *values, unsigned int n) +{ + unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings); + uint64_t values_copy[sizeof(struct dpaa_if_stats) / 8]; + + if (!ids) { + struct dpaa_if *dpaa_intf = dev->data->dev_private; + + if (n < stat_cnt) + return stat_cnt; + + if (!values) + return 0; + + fman_if_stats_get_all(dpaa_intf->fif, values_copy, + sizeof(struct dpaa_if_stats)); + + for (i = 0; i < stat_cnt; i++) + values[i] = + values_copy[dpaa_xstats_strings[i].offset / 8]; + + return stat_cnt; + } + + dpaa_xstats_get_by_id(dev, NULL, values_copy, stat_cnt); + + for (i = 0; i < n; i++) { + if (ids[i] >= stat_cnt) { + DPAA_PMD_ERR("id value isn't valid"); + return -1; + } + values[i] = values_copy[ids[i]]; + } + return n; +} + +static int +dpaa_xstats_get_names_by_id( + struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + const uint64_t *ids, + unsigned int limit) +{ + unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings); + struct rte_eth_xstat_name xstats_names_copy[stat_cnt]; + + if (!ids) + return dpaa_xstats_get_names(dev, xstats_names, limit); + + dpaa_xstats_get_names(dev, xstats_names_copy, limit); + + for (i = 0; i < limit; i++) { + if (ids[i] >= stat_cnt) { + DPAA_PMD_ERR("id value isn't valid"); + return -1; + } + strcpy(xstats_names[i].name, xstats_names_copy[ids[i]].name); + } + return limit; +} + static void dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev) { struct dpaa_if *dpaa_intf = dev->data->dev_private; @@ -535,6 +673,11 @@ static struct eth_dev_ops dpaa_devops = { .link_update = dpaa_eth_link_update, .stats_get = dpaa_eth_stats_get, + .xstats_get = dpaa_dev_xstats_get, + .xstats_get_by_id = dpaa_xstats_get_by_id, + .xstats_get_names_by_id = dpaa_xstats_get_names_by_id, + .xstats_get_names = dpaa_xstats_get_names, + .xstats_reset = dpaa_eth_stats_reset, .stats_reset = dpaa_eth_stats_reset, .promiscuous_enable = dpaa_eth_promiscuous_enable, .promiscuous_disable = dpaa_eth_promiscuous_disable, diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index a980262..5457d61 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -139,4 +139,44 @@ struct dpaa_if { struct rte_eth_fc_conf *fc_conf; }; +struct dpaa_if_stats { + /* Rx Statistics Counter */ + uint64_t reoct; /**