From patchwork Sat Sep 9 11:20:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 112147 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1461920qgf; Sat, 9 Sep 2017 04:11:09 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4Hby9IZDjkV6TyQM/IbJMJgiePbwzVUaw47hazvGw21g7tpZS9RvtUv8mNy/cQHJhboOpG X-Received: by 10.223.170.202 with SMTP id i10mr4404964wrc.232.1504955469819; Sat, 09 Sep 2017 04:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504955469; cv=none; d=google.com; s=arc-20160816; b=0EQ5Ar9Gf7bjpO2f1xf6oSAXRT5jFKAl1axbCEY/zP07G/B917/jCTzqJARidah2XH bMzXCpWMbsSFqLdkDThLnbWbq5tonOp0GOapQlXkXzNvJHHWhydO6kpVeBK0XKN0Yjx5 w9xu2k2m+QDPzW2qGRlC9YzbLygzzR/3kdLKwc4EPUXapwtcGvbzsNRx95DM2U74oTeP DK1Fk2S+dvsa7RZYEL37BMIvEw6+3IntOWcp6FOmg/HwYd0NswNXVYg+GSx2iwfRdX3c 3xRBwBcb8SiLj7Y4vc3PzVZtU+9xXRn7eT4lVJSjALnauhKp3qpZ9rqg2+raAq4Zhj9z I6mg== 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=gUmEZ8qQN3X80yEvLqjxd4BXXZ4udKgaUpFl1qogNgI=; b=vJNjn0R/MoOh7LRk55vb944qFfuXnNYgQ2jhlKj9zEUC27iHMTxwtmng270m8Drexk ER6MFoJ5HOIbL6x3f3w0Mdltfxk3gmsOxvZoO8Z3WL3PRh09Y2VKPxOh4mdW0s4VXRj4 1+ozci2nMq9mJ2pXtZMIRh2fYxbYG3BG+9sHAiopdjzoRNgx5kJOVAp75eQoczEGulRO h7qgYUPv1EIWnP6f7GCqcap31lRzJP6AKjyRaw1y16YXEGEBhlXFeEUXvwcIXmLm3DEO PQupeXchBO20pfN/bk3bJXLdzBEeyPPFXNKpO3aXPAh73qgmxnjo6DhL1qRPSjkBIoxK FQ0Q== 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 k4si3282132wre.3.2017.09.09.04.11.09; Sat, 09 Sep 2017 04:11:09 -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 B4CBB1B18F; Sat, 9 Sep 2017 13:10:44 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0049.outbound.protection.outlook.com [104.47.36.49]) by dpdk.org (Postfix) with ESMTP id A8F8F1B18C for ; Sat, 9 Sep 2017 13:10:42 +0200 (CEST) Received: from MWHPR03CA0032.namprd03.prod.outlook.com (10.174.173.149) by CO2PR03MB2261.namprd03.prod.outlook.com (10.166.92.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Sat, 9 Sep 2017 11:10:41 +0000 Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:143) by MWHPR03CA0032.outlook.office365.com (2603:10b6:301:3b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12 via Frontend Transport; Sat, 9 Sep 2017 11:10:40 +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 BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1385.11 via Frontend Transport; Sat, 9 Sep 2017 11:10:39 +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 v89BAUh3026326; Sat, 9 Sep 2017 04:10:36 -0700 From: Shreyansh Jain To: CC: , Date: Sat, 9 Sep 2017 16:50:54 +0530 Message-ID: <20170909112132.13936-4-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170909112132.13936-1-shreyansh.jain@nxp.com> References: <20170823141213.25476-1-shreyansh.jain@nxp.com> <20170909112132.13936-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131494290406824002; (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)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(36756003)(47776003)(68736007)(81156014)(110136004)(1076002)(54906002)(50466002)(8936002)(48376002)(81166006)(85426001)(86362001)(50226002)(8676002)(53936002)(97736004)(5003940100001)(356003)(104016004)(6666003)(50986999)(76176999)(498600001)(189998001)(106466001)(77096006)(2906002)(5660300001)(6916009)(2950100002)(305945005)(2351001)(105606002)(8656003)(33646002)(4326008)(2004002)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2261; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046; 1:NGd0p5bsRTCMkrxEHLpeTQ5VNiBXL+TwsYj++05nJRTDhQ/mCgPjb9FYIycetrxEBqtSNs/yLRflQLHXgUDrn5UV6B69x+hCiINuWMLLNOdotmLnUeKIWJg7c8VRUprr MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4e4a2b1-0386-4497-76e3-08d4f7736825 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CO2PR03MB2261; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2261; 3:hJFEO/JPaFAStMKe0RgZ5d73xoODz7ad4Y7xmjN2H2YmihdLGX61cCwU86DoB2jObw4a3phZXbQX45fv8uS0rH1u61ve5n1tJQWTXxUlsVqiBXLQTUpmZ0pTKKBrce2b8NSxRIbSUTQj79pPut3AG0V1MctWXr82VxRM7gT7Yp8Pf0WhY0Zx16DAWMiq0J0c0IbfBKZ0F4MXY0RVbtXNczIObQq0sa/eNREudW7l2ac8WXbhKuS3VBFtLFVxJ6F5VWjc/ntdQEEpe9i3sMZ40QWCxmpAXnjEOV6Inq9WOq5Oto/7Pul8oQbLfp4Lwq/obIYMMZ4zejcfBOH1Xkrpr8nJYoL60WA2CuPD0n+m7IY=; 25:MkZSiGziofLKupVmufG0LTXee/a9CMH/uTsedXDcd0DzW1/Ldo8erOE+zcFfybwQw2cEGJqy/onFtYccr/PnXcw8SV7nwDe89ulBIUcSkZl74R5GqUq4//8fhk2K0FPg8IrniVRCGAxYNCKcFQlLqnbSF2yW+pPk8MqmyZzQNZhTKeKNo4eA9vIfQWYMNbkB66G9enFNl6oPvidIi7r9GU2J/x7LgvSTSvSCMIZwm3hcAVdfx1D21PDYpiOyyjkk0twHqdfeKUhqAu505RA6MYS17Kt+aiurTWhsQPWg2e7dBmoWDGlvmTwHJkqgv9cKiBzdZFP5f6FiZV7gh8Qtww== X-MS-TrafficTypeDiagnostic: CO2PR03MB2261: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2261; 31:O9+BGv9ZyU0F1ZFcV1y5yre2UtbkBXJ9R8jVyzCC7tUbNm+ZBYou2UJaFAncFd92ywX9PN/bSIcDPQMMbZqubLukXxDDMKeyRq/VODGcjIMHHAbRSLaIwl4pm2Za+kZBW51Vb2OkjY0E2voezrXvbejYzHLZLKXL6JJk4u86xey1jypwzcfnZxH8xamDsv2w04lQNk9IHOzebvHJjsiikLMF8K8xLpTSiqStR462BwE=; 4:WNb/1mvExaSq6WHWKqmTkE50bSc9UCDTHZKmkt+g1fvh63wqcF1CIyu4HTbfBiKFKx/YloC/dAcmwNua8bA28iqsukxgp25laMnE6rqdMRS1vSf/gPux/uUEESQnpwF38iahbvg7MF8/Q4cvAfCEKgXkCc6Q/b129a0kEtvBTFo9aW+kmCv8DUuMoRWHgiMPVcVfH2L8h74zOfsbIAh26Aj9YLwTcJGSbKVeaTMpC7x2pm8L5XzKhzF6A+SKTy2dRHD+6CDy0r4TBHW61nrn8ahde/O4GfXnr/OXEQ7qcTY= 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)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123556025)(20161123563025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CO2PR03MB2261; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CO2PR03MB2261; X-Forefront-PRVS: 0425A67DEF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2261; 23:3KOLba523ZnGkKxCSxur2dLpLGEEnsRWwubMLovig?= UVfisuJxZMMPTBVMStJLixO+e6gNtmkPn4JfrNQrwHsqeggJESxSVNRfu16CUVc60t1CQR1GaJtv+Ttq7X6xf6cdCuAbn8KhENs/bBjXR1DWXFIYoE9V8MMNEY7+jUOzjTio4Zc/hShpsQb4n1LT+ZZGTQjn+UZ3/Cmh+jmzIc1Ht4CXVljzAgRRQb4TdM4qSIMSR6W3AIVEHJ3K/VoIuAm4okC3fBN7K3rAiPKVA7onzeRxMFtaDUMkGZfAWLsp47oaT7yi6sJOewhWtbRrRXp2EWKZKTF9eBKtCAfcmVrPSFHbZs4heSEWKJ7UalCSbp7hsD/6o3a3DAQyspgiYQcmzsV1coPqT2PYDi4acll+izNAXayxrjt9YPUb1OdhCZAbv3pNEJPcxy9QZU0gIdZjDNbOojsJzPgZjr/dHzgF5PMZbQPdfgPcl9sLveSRP/+leQUO7lugGtM14YgyalHM1CHMBduhe32NO58kbp+kXUNM1W5EbdqO0KJ3OngotkuwpCIblLnqn9aSO/D7ZaVcmMZ/wese3CxIF2jm2dR3tOBtFir5v6AZWrpFl7VKhOKSyFEpGiNLGct7FDjMsGR3DJhhQIgSlUiak8nZfkrp238zs/2WvbQ5bvMxDiYyPgE0r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uwg+95jNryjud98fEWqmsNj2lNn7FFPhvei3Qnq7oZj7r8/th2ld4W2T8TKLlMv6uRgi7J8ZtXMQzfB1Hg=; 7:GmdZ6wZxuVff6Y2Bf74aneL1IlBMigvu1elrF5RauIwInRL/yolIKuEMZykpKW5MmZnnCTDIhBdL5Lw6o9UJn5cWtKXeblGYkJgdvyNYwP4MA+HOJia2qOICB5Op4KRws36pDG8dsqWXryabfeVd024RADKmoVFnJbBCqxfAOaAANBAbEpavnj4wsqdOa5B0+zaMN4OvhmzgUYCQPh4Nvo/cs5XP27ESEQvEhkUUwQY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2017 11:10:39.4656 (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: CO2PR03MB2261 Subject: [dpdk-dev] [PATCH v4 03/41] 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 --- v3: - Removed checkpatch warning and duplicate PER_CPU macro --- drivers/bus/dpaa/include/compat.h | 389 +++++++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/dpaa_bits.h | 65 ++++++ drivers/bus/dpaa/include/dpaa_list.h | 101 +++++++++ 3 files changed, 555 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..a1fd53e --- /dev/null +++ b/drivers/bus/dpaa/include/compat.h @@ -0,0 +1,389 @@ +/*- + * 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 ASSERT(x) do {\ + if (!(x)) \ + rte_panic("DPAA: x"); \ +} while (0) +#define DPAA_BUG_ON(x) 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 Sat Sep 9 11:21:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 112148 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1470049qgf; Sat, 9 Sep 2017 04:19:03 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4D08fpqWaBthdvYHmn4nEeWZRtIDzcKlPysiSlWDo/2q9216lF2Kz9kcDMURUJkgkN62c6 X-Received: by 10.223.159.77 with SMTP id f13mr4108928wrg.154.1504955943074; Sat, 09 Sep 2017 04:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504955943; cv=none; d=google.com; s=arc-20160816; b=zTMRRuBTwCIjlWGew693QIOO8FXXroYd/iPmAgrviG72ZFzEFNkrikMmckCWR1hbTV mCDjErTNBvHRUh4T/B3zOsRlrzm4LtlzmBugd+Q4PDhD8d3/EIASnu4ijHqtHD9MojOx t16Qc8EjJYwJAquZdurrxSUXwDne5+PARYckML28f78dubMrBE1CfnCllwN6LXGQ98gd 2V8ntJAJHmKxh+QPiEIYK+cA9U09rsn0j1M7OA3bZVcStiyXRVx+s/oRGrTSSVv7tr14 3m8PVsQvSZzwhUeNaQXrvSeBmv46LrGhOtvaNdDBLMHWkAKjlbHslxQmHzwW8bpuDuNq eIxA== 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=X6DVb9Vi4eNjsUr+UUy3hW3BlSWnaB6gUMo4JX8KbMY=; b=vaxFknvlKxUjG0ghLTuRolHuZ0yLXuPBNrXg8XTP7m/sS/cWPDxj4DZuriOq4mqgvI 2cKrDYx0O+YTRLKlLtqrACt2FclqBbRnDRpIdQgRs9tPK8g+LsiLwYBh2hDM8ocopxyc m30Q94E60wtT3fREjHydJbFiEMPJ2SC3o0f8aB4vfpW/UTChqYdbPm2puimH7DBpy+/P Bk72vL/NU+HjPJX9Bn5/+2zo/N2ZUbIjzRnWUesJUBYqyyPpzhCwyM8Yy7oMyXyMH9FK Or1HprRMrcoEQZCiGC0UJvMQqb7fpKw2yopc3OBx+G8YC1VrO+clMAomkq8z6QVp+7a5 Lmpw== 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 k23si3202741wre.256.2017.09.09.04.19.02; Sat, 09 Sep 2017 04:19:03 -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 9388C1B1F1; Sat, 9 Sep 2017 13:12:00 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0042.outbound.protection.outlook.com [104.47.37.42]) by dpdk.org (Postfix) with ESMTP id 6CD8B1B2B1 for ; Sat, 9 Sep 2017 13:11:48 +0200 (CEST) Received: from BN6PR03CA0092.namprd03.prod.outlook.com (10.164.122.158) by BN3PR03MB2259.namprd03.prod.outlook.com (10.166.74.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Sat, 9 Sep 2017 11:11:47 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::104) by BN6PR03CA0092.outlook.office365.com (2603:10b6:405:6f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12 via Frontend Transport; Sat, 9 Sep 2017 11:11:47 +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 BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1385.11 via Frontend Transport; Sat, 9 Sep 2017 11:11:46 +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 v89BAUhe026326; Sat, 9 Sep 2017 04:11:44 -0700 From: Shreyansh Jain To: CC: , Date: Sat, 9 Sep 2017 16:51:31 +0530 Message-ID: <20170909112132.13936-41-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170909112132.13936-1-shreyansh.jain@nxp.com> References: <20170823141213.25476-1-shreyansh.jain@nxp.com> <20170909112132.13936-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131494291067916706; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(8936002)(8656003)(86362001)(50226002)(36756003)(1076002)(104016004)(356003)(305945005)(110136004)(50986999)(77096006)(76176999)(50466002)(8676002)(68736007)(48376002)(85426001)(5660300001)(5003940100001)(54906002)(105606002)(97736004)(4326008)(33646002)(2950100002)(47776003)(189998001)(106466001)(6666003)(2906002)(2351001)(53936002)(498600001)(81156014)(6916009)(81166006)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2259; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:SJTw3Xi9FqwBi4o1zkIO1gYPju0DZp1J1pEQC3zJaXQ7aPauflVrMJZQNtDav3uRQX3/5Cy6/9Lgmhy01j6J0D1nRK79Ty1RWN7HHMifxjqwUX7N21jNYJPRl7n1hrD+ MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d8ef5bf-58c4-4f59-e539-08d4f7738f79 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN3PR03MB2259; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2259; 3:rJrpmjnByzL+QQe1AmDYwOEg8T34iFbtr0e5RFhzrNlxG/iZ9NUST7oFgLY5FmKb59qq6BRpkVImtWv16EOydYYwoB4PP804vwSnRbxtzfMkXF3wAuRWc5u0mIozOhgWw6OxR2nJxZxSejGVBowvKzL52XbSgwCW1e2j/td9W39lR+rSUdQmABRHE0izRS+Tlr0vtqJNC3EIzxYj2RviQQj1pC2GyG5NOSAPTAzEVzkyw6bJcM3A8TS02x4H48e//7s5OeAl4Ra4h4HVNE96X+RhJqsID2k/NGQ2pmqmHV8mTM4VwaWSK665SvSQpXexnR+JCqEJ1H3G7esMR5HDPlj3/XNnTLJ/3JrwX5oALsA=; 25:/MboSyexF0Fqp3A+HsHk9eMDI6Chl8HrkNFnA8f+NJgvs/+7Krn/Vii+exnTENHXoMR0WvOfVb9Dl3SEGhzABTNLNCUpT1dn7f2qIJHzRDYO0aira1m1RpFPyITrgrxhlWZFBqJXMrtWhQsFNQ2LpQZdqrFysQBbR4ozHtxgR6F1rhdrzA3nEdz2DRFd3rexT/XwBCfZWFDdiZS4bmcCPTjBcW7J8ly5ftYrtT4aSRj905lvQ6EsL3gTrBR/gv87ZjGod04yZBk4d6V6f+1SskHq4LmpfxGJz854UJL9iydroI2gwzAkwfd+pb+RhJZ0lxEEnWTX/kaWHI4uNsxUVQ== X-MS-TrafficTypeDiagnostic: BN3PR03MB2259: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2259; 31:UOwfJe2jcQgVMq6JAXn/Ppxlub0b8B5FhaA1IABvpgD4u4yuohSP3f9Y+FZsqbE1QyeMHC+gmJTzyLxFDoaDiMdyjgHytaOWUuWJVf1gmABFh3Qn1l4Hq2DMuSrXGzrobFQscZz0cRUF+JS7WKo8ivq0v1OliQMhFFxWCFyHotaP8IdPzpHc/VIaFpaYIeP/UahJGI4Jof0a/C6X4EK6tRGd2WfAq9ge9zAZggwvkY8=; 4:Rh8z3lXOBP9JkGWtUUKdbmRffx79e3SHfhmtrWPeU+gxIn6/+Hxm/TynZq4QbnVqs4JB/LYkLbZHRwNm1KYdNcRqQ/HWCAc4zCIjGYGV867GKKTIFtCMc9+rAqyRNKF19JSAZkN/SiF4gTtYoxuoaflOcsgSH1wHfKshiimW4AeXe1v1ZKEB2ODiXzu/XhESfJM5aXUQOBby+0nRCiBBAG3hWkBud4zhRDOvHR91AU/4bGhJQmElndO6J+wFi+LeSEIZQA0eKaWmjJC1kLZM2zQHsGj8KuPBbdOBYi2TwiU= 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)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6096035)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123561025)(20161123565025)(20161123559100)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2259; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2259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Ahr13bBEoYxNR49eY0gBMxVAMEd3g4BcGaXrx0BrHMST99gshqDo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2017 11:11:46.4484 (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: BN3PR03MB2259 Subject: [dpdk-dev] [PATCH v4 40/41] net/dpaa: support for 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 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 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 3e3e091..22f56a4 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("/sys/devices/soc0/soc_id", "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) From patchwork Sat Sep 9 11:21:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreyansh Jain X-Patchwork-Id: 112149 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp1470199qgf; Sat, 9 Sep 2017 04:19:13 -0700 (PDT) X-Google-Smtp-Source: ADKCNb7tpWMeAl3NlPNp1bOucoQEV5yLWbv6VKtepHnxCV6eohRJIl7SQiDkHx2vn1S1kOeSwzQQ X-Received: by 10.223.195.108 with SMTP id e41mr4268542wrg.51.1504955953290; Sat, 09 Sep 2017 04:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504955953; cv=none; d=google.com; s=arc-20160816; b=eb0DXZri/itdeMi0bsd5lvW/lZvXb/ARefwy1dLChleVYeTkWMF0O/o+I27Rt0VJvk kGH8+rpo5+HMS7gn+7f8BMBfuLReqGpS/NqntcL5n59H2aq3+EnFTPL67JCqXiesCG9O w8LlvJlOYDWfi0d6B29PKiklAeVBnBbQZepr3dAm+/usp8QSiEnyN9GmJKRxTjXrVNek /3Clg6l70EPxStt2HqqO4/9rSa2LDAEANW9t2rS0GO4fut9Sh5jjQZgEyNTxHCKE7B+k ywxO4Xos/5xJBS9DYeORRfKHdUdo46ULj1GLzCmOZPYzUkJUNdrAtZTlZONbYEYsrHPA DK2Q== 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=kPqcYdc8YzhcxHd254VtlICGP8p9mXEuqdy9iGUGNI4=; b=I4IUg6JI2VOkjGGjt1FpMwgZTAlvt5Q62HZzquGM/b7eztcPjje1TfQt93VvoBlGUg t1rgLyKCwM4LiKwd+buGdYuGryDUBbS3RtwPyUWl/G3TnrcgMCkwJmAKURIbF+vu8BKP Tel+J5fma/DLRhTxkHqQH/ODQ9KbkMVhl3Z1Vg91f7ouvajjDIDl6qkxEHIKSxtcS4od GZZ/I0CjiOaX9linAuXZG5nFxB3nAC6F+8u3d0iYlF1XmKlhkikZpPYo6xhaQzx0Bu/t Bcz5i2HjEx2vnnMsfm6pUuxsgOlsV4/OmA1AMUd3nc4ricSzASJ/0fZW6wlV16Xq9+7p yguw== 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 q13si3130194wre.6.2017.09.09.04.19.13; Sat, 09 Sep 2017 04:19:13 -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 09FC11B29C; Sat, 9 Sep 2017 13:12:02 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0083.outbound.protection.outlook.com [104.47.33.83]) by dpdk.org (Postfix) with ESMTP id 031C1567C for ; Sat, 9 Sep 2017 13:11:50 +0200 (CEST) Received: from BLUPR0301CA0004.namprd03.prod.outlook.com (10.162.113.142) by BY2PR03MB556.namprd03.prod.outlook.com (10.141.142.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Sat, 9 Sep 2017 11:11:49 +0000 Received: from BY2FFO11FD047.protection.gbl (2a01:111:f400:7c0c::118) by BLUPR0301CA0004.outlook.office365.com (2a01:111:e400:5259::14) 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; Sat, 9 Sep 2017 11:11:49 +0000 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 BY2FFO11FD047.mail.protection.outlook.com (10.1.15.175) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1385.11 via Frontend Transport; Sat, 9 Sep 2017 11:11:48 +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 v89BAUhf026326; Sat, 9 Sep 2017 04:11:46 -0700 From: Shreyansh Jain To: CC: , Date: Sat, 9 Sep 2017 16:51:32 +0530 Message-ID: <20170909112132.13936-42-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170909112132.13936-1-shreyansh.jain@nxp.com> References: <20170823141213.25476-1-shreyansh.jain@nxp.com> <20170909112132.13936-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131494291085208505; (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)(39860400002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(77096006)(5003940100001)(189998001)(104016004)(47776003)(498600001)(36756003)(8676002)(50466002)(48376002)(97736004)(8936002)(356003)(6666003)(81166006)(81156014)(2906002)(4326008)(54906002)(1076002)(33646002)(86362001)(305945005)(5660300001)(50226002)(2950100002)(6916009)(110136004)(8656003)(2351001)(106466001)(68736007)(53936002)(76176999)(50986999)(105606002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB556; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD047; 1:qzIqrMjHrFg62n9T5wmThqh973xqpBXpuMSnKtVqGw6B85VEHVwJxrKFEzQNJTcnEQlbVZLUBPg+R8UOlxP9SJcMBrQt7KG8vFHq/F1+GzMv3hDoSjubDjRWmIkDUXML MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 08fad05d-5303-4405-2bb9-08d4f7739097 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BY2PR03MB556; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB556; 3:0eOMqWilMH4GeGREFga7us5/2hGRHxXTNGysCBTEirzITbDlAsKZjFzTBzp+mNMtUt/AgegLwnLevYsfdegEJ9ZqczMdwr2oUmdPGxKPfUYYkX5OLB4up/TbwTVbLlk2MH92aoKbq/IE9tiI8Q0QVWTYgjvHssPOP5EDu6EJolChOXAEJyNLJMzVL5XMh4BUcmV1vrvuVyvNZsR+yTY+3bP02TquFqBQHDHgIuPOfGfstGx8qhxx2VHUiNF/c7DxP5yg9dNDBSoccfmb3Q7+lJrQYH08wTGXdV+mBIT5QxRuBrSLkAWWihx1tgmHd2hfv9tu/o2VGHQXbrjLmZ4BF3Y0di1F6KQB/RfBHM7cfGo=; 25:GrLiV/B6E2nMZSygS0v+V0xBASNTjzXqB6mXqXsnONDjqJPcrJ+CTsXiYn8u0N2F70RGlm5iyN5clz+yHiPpjwOU0udtT5jl5IGNelf5hh5sOHinEeoS8o9XGqfzZGKULASXEJkalTOW6ChVx5GdjLQY9aCmQjVKktO2i1y9bxLgmjeJXDf0uTdoXEZwxBrZ1WDxIaehI8CMpTP+94Wjzq02Z/Ze1W9bIjzWKK7aZhZ0d/q3A+74IOegkWyi8X2SPL7RcK7aNFhyM2rAnMkdWvQgyccaznWnUs2Q3SWwSyWmJYz08KMVt/vHNTWicIWL53HCSDNkL7OB/myJoIImHA== X-MS-TrafficTypeDiagnostic: BY2PR03MB556: X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB556; 31:D/Qm872rsRl6RJgQnSiHvyx6cI3SB3aS6wCt8bGkt8t8Qn5xoNETTa5A1PlEGvxpWrRjUkLLOouYQCNjzLeje86J3gwfhfBbsFngSlyxh6kjxtdVgLDQ9E4GkIQdVOUtMIRDHl2r4rsxcgzbb2Gg6N75BCnPJpkHrVI78tILwWoM92T6Y6B8WIkLZE5P+S95KoCrLq3i1jzaQassHlvC4vmx5KtIGygDhgPNRoad+dA=; 4:7aEbQoGYBUjYKwn2wdQSgk9kILXcMc/aqN9mxbzzHRfAKmzbH0hwfLui3fhgUKypFrYuyq8wrnWlkOMUOlXssuc7khvNsefdeQw/dw+GLhSkXtclgwiTvPclw5RoCQN/6G0xHcyJ+VRTuHjQoxpmAPqD5CCTdmf5H1K+TC2nBlH/ofj9m7kUfVwKuazS9M9ova1pe4DqaYEtyGx6GIcIZIu93IHiN1SypWcmNOAE8rehOKc7hM9PpY+8iqjlNeXJ18XoDFdUwGPBmDwx2rnY6OBi/J0dvTToK2p3Jx7MQyU= 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)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6055026)(6096035)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123563025)(20161123561025)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR03MB556; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR03MB556; X-Forefront-PRVS: 0425A67DEF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR03MB556; 23:QK2J5uRx27OEV67tsHki4+EMctdOmse1Y7CqsM3So3?= 3kpaLro8iMcNVhmOe4QquCJoiEUzgxkMPLSlqyfv+rOCdPtkrwj/8lUzBNL/3a3qFaFDiQn0MAOglJOxyr5uY8op+PuvRR+J6e/TbG9UazDpSvtBpwQwHu8ZQ4ELxzQ85xrBJfqlNJStzoj+SWjaht5ZjxcLmgPey6WYJsM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euwR+W8OkT1vK8ZcSfxek0GOagw7GXTM9J6cnCeK8rR8pE8FMI8kmb/wVnoMnYDJvXrs8vt4kaD8YkeapOB1jn12MCkhkDSsF+WSVQg/ArFAouzRcsJMhCWpLfkaVMAB2bC72UHXmOYGm7FruKEWCHo0uBveaQIvp0v5NkgsFZ/mHTOnkHI44OvPADQk3n7fVW3DytMGhD0Kv1EnPmgPW9o4nXIUhjA==; 5:YWijWC1oIXl8VQlZ8m9u0TDIIWYXn2j+rESdls5BrjxE3KX/pGPQ6IZKpm7K4/6bZK2vN1dDc6EHwSYhsHa6GzeiYO4POZBK1++tPuwx4UJjIc3ZFHxYDFgk0jpw4arEWP588ELKZDFCw+5TFbnzRw==; 24:0lyK/Q0zdFx8jfF70vVd+PVquGHjbfGP3Nvo5EHTT5ViNhMHpQOFuod1BmanQ66uUyJv1ODAV3pO2hT1ltfSpm2xiJCEqENE6z1SjGxBIeI=; 7:WWxkM7q0MKcyCwkg9uLj1mdDZdPTlilBBOFfGtpuzlVKkSGoNdUW5ngqOJo8Da6LFeQ50BhhSCzNBRXqjeEUm23Ycj5u653qp7bDYwkkll9ebChW/B0hXrxjF9Mr8J78V8Atkm97yegd7K2vaW9ibj4iFehc+xVJW01gwdKydU8aK6c1FK6byZ43nFPmsdDZmjKfbJjqcyPTdZkF+tP7MNdPPEDc0dcExuAE2M05I3E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2017 11:11:48.3336 (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: BY2PR03MB556 Subject: [dpdk-dev] [PATCH v4 41/41] net/dpaa: support for 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 22f56a4..5b5ec9c 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 e1e062e..3f06d63 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -134,4 +134,44 @@ struct dpaa_if { struct rte_eth_fc_conf *fc_conf; }; +struct dpaa_if_stats { + /* Rx Statistics Counter */ + uint64_t reoct; /**