From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0081.outbound.protection.outlook.com [207.46.100.81]) by dpdk.org (Postfix) with ESMTP id E08629AD2 for ; Tue, 14 Jun 2016 21:07:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rUUwR7pdZv/O7ZANA/ZJCYc4f64pLmuH2kgDL6DI4Ig=; b=V30+Hm7fsfLiHRmPLtOPRtYL9zrrXzPueXtROxHo6sIX8tgdb2Q+WfRLCYJXbrS8CAb+wYOrc3wVDCNrcgc90AHN7gaVP3mA2lzyforQiBsXd6TlIWYAhox0uGwDHTOjE9djezTHh82y9LcHOTVWfBEksCq/4spseeQh/c8MNg0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 14 Jun 2016 19:07:16 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Wed, 15 Jun 2016 00:36:18 +0530 Message-ID: <1465931200-23912-4-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0040.INDPRD01.PROD.OUTLOOK.COM (10.164.116.140) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: 7f284c40-d7e8-4e17-66cb-08d394871bb3 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 2:fOHNdGAWd9ToYxE8N/aGSZW/KHbXrGqvqhX1nrTqbCRhtszcnIVlGTqw55V76pXl1MZrNQ5u65Twbkba9I6ncZcI/gh3FtnGGccsJQ0YsWEz9eQafX8moxcnOkJNx4p8cr8FugKS1ucEx3RvN3iVLSMT4po6hglq8UdlYvgBcWb4DXJ8XfFrRlqs70sy/o3J; 3:A5wLDAP9GkeEiH2XF7C5SWdMoceB9v5V5GO/RK0KNd2R/bKRHKgOy1OwuBzc2LAC6Tct/8Sk1BoTdSTwKEFJi6qm82y0yTkTZOR72v1/vN25jbTI2QbNlKxDhKaQNGdC; 25:As/zQfUHKdCz/hE02KahGRsSEJlAA42QjniQoFReQUelGKN1oh0Iq/cqxHp5+lohg0vCd8jk8jk/AZmJqrQTVn0esCvmLdkTt4MBksFVPPF6GYQr9fKbKcVqUNU53EWUlEl5EOWQQwQIlBiQBHjtFn2N+ggz6Yu0Kb3qbj7TSb5SYA8Zn9Isb/MxQsMBL0oldfwZyeO1opSbV5HMRjsvPB0KMmup779Yr6POq5bRht91p8ylv+fz3JtI/DUoUmGRy5ffA//Ed+5ESSYbY0JLI50nXFocBx3uG6K/agu/g6wy4ABe3P9HbjXAiddDSM8dOfAhz1Xu+3ilRwAnfF5rc7lUL918LCwI2CKuvEeZuPjQV+XFJ+HiNeHkcyEVBetETauxsgidHteDnZ1N5ws87o6zInFKOfkf8MROdnvNUUo= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 20:y8aETTAfj4SggDhF32/h3syreMV0NJ8X+1ni8+ANa3Nig9rFOJJamjdWDMh0SHY6MW+BWsaLQ1eTZ1nSjFz90GSgn+YXllIL3PiLgTjekukCe6Uc/CYMe1Wp4tmueN4OaeIM80mKdX4uZqxfs5ljSzTNjpnS7ejjx/0FxQHYxTrqBvNRn26qdVkznDiDhIzPqu/LFseVgi3MMnvh5PjSb47eG2V89I3gXY/5cGssAs7LuX8yNiGptLUuT5rAvU6XQsZGnoSReRPv9EQF5LqpGQ4awQhKwULMfMLVD/LvaY9zz9krpXxsMXbL/Jzwklj+DATrpiK2yX+myG9ta8qDtQOlI5dfAqa0NzzeyCXjrcGV9obhFHg+fbzI3QXDwrmtlM5yuppmGmGe1onqwwgQ/S1FruvM0lC4PfkzixXtpKmet1bnn3DNbLvTr0SeIIfJAwyWvCOp0iyD3r9zA72+vHUw2+7ozYEjcXcVUcex4SqXbJiF2V71BgtUsvxqpLol1eo9I8GfvgMwsK3i5H/g8RQqRUBA+HQUbRyEoOwsVxDTG5ahIeQxvAcqk+VgN1TXgSL4CNamQ1LkzwhAjoz/uIf2yfDPQtYAaV0zxAYkj5I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:9ddBrL79miu/FwdBmdHqH2PdiGngAF9kGnE//LdHF/q6Ap4AiDfOfmpqS3x4/putjg5hrslomKRA6RCHp457uda1FzOn57ExX3x63WVb6kUNErYjFx2ckIVW7A/rPZLOLXxC63vIx7E2w9FHcUHomu5gmJUt8g5cXf2ZSlbFOy24u/D3YNpuAv1CZUO0PIMbJmjxftWW6KkGpOR6abZ3HDXceJa/SmyT34ZNsz0TKcq7zVMJRReZf7NjclOCuUSpM+/2SykLWMPf4/TzxKZ0A6Io59TarTv9ACxWQZ8/IsUhVhmTj1RAZTYtO/hOzuNj7T4mvyCjprnMxYDkFBHYVHrC05bDNBUbJBuvBgYELsGDXvNOXqO7m6B49mHh0Mic X-Forefront-PRVS: 09730BD177 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(69596002)(189998001)(2950100001)(48376002)(77096005)(36756003)(19580405001)(5004730100002)(19580395003)(76176999)(5009440100003)(50986999)(97736004)(5003940100001)(68736007)(110136002)(92566002)(101416001)(5008740100001)(81166006)(8676002)(229853001)(81156014)(66066001)(4326007)(50466002)(2906002)(105586002)(106356001)(2351001)(47776003)(53416004)(76506005)(42186005)(33646002)(586003)(3846002)(6116002)(50226002)(7099028)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:DICBp4BEVP8tJR2edsATcBNwfrhmgmL+t7csAtq?= =?us-ascii?Q?+B8FP4ArxeTmIGj1sQMP2wZloCHjSBbveP/Q5wSPut05iA5/TjCQJkrvQ5E5?= =?us-ascii?Q?cGBKl/RoTTDmLXE2qieit+oAqGV6ADLyJw3uqi/00ICbHBT08vFsdW5743EP?= =?us-ascii?Q?00TYpRZqHZ3vsj0W92KAxzxG0WRFNeaW1XgbTRdoE9iBFGJEu390V+4mBKm6?= =?us-ascii?Q?0d+pLpepZeKZVdWk2hbk7VAr4TZuahZD8LfdbqiQKoMrSGHJHgzS4NlNbUPg?= =?us-ascii?Q?pQyhZLF3CGEfG6UX4lzZ5RkgA0Lyp/wojv9fjZ/Rr8rRfTbW/s8zCCes/FL8?= =?us-ascii?Q?zsLlHwSIXc0/TweLsijIt66qKv3W+gK0jvfzzhKTpDigbsOWcodS2rlgv6bw?= =?us-ascii?Q?kN6EkLTeF+fbR9j3Unaburf9qfFhtugcIk/6V0sIF5ItLGUyHTQE+4stwYuR?= =?us-ascii?Q?WD1Qdp73RMourmmDefMgsnCprb1mCgunaafdLB0LtBec8y+eGoVuJNzl3flR?= =?us-ascii?Q?FibKxynefTlIZXL/o82/mkZiCZ/rrbFYiCs7jN9Ah/OLNemiv8BiGppx4TeC?= =?us-ascii?Q?myHashUpIdm3GDwFlqhqrhItVKdw+UB3whmRqpAerOSJPxY3lEg4aK9+u32E?= =?us-ascii?Q?mId0VpEF59ECw4dDdf4Ygo5Slyzrh538RpkKwXJ990yX9wxdcbFu46CllEy4?= =?us-ascii?Q?LS0N1q2Ji1WslhcGJSMe3QlJEcmdIcnQiQFXsFAMdmjRnIlugyPZ79YrGD9d?= =?us-ascii?Q?eybA3OKY84pmUEKCnem07Ji2zygSES8Hj9QD3pp6fySFxSPu1d8pHyPYBM+F?= =?us-ascii?Q?zTpEwyvyavwGVcQz6e53UQs4HILX7bhcrtw12H+2XdnFxUJr/ZxPue0d5fKn?= =?us-ascii?Q?dn/63GcSC7ggYmOU0SmLK5JOEtyHonmVumtHpfDlrjvO7ZVhmtbdNyCXI9y0?= =?us-ascii?Q?iIBoGo+ZaQxBis9V0CA/P09f+aZ+l7QiPjdhfRVS5bF2aD9gmIlWaABHCWBR?= =?us-ascii?Q?QIvgSO7JYXXdIGGgUdq2e5Vy2B7AoYDYCROKo11v3RDqeHyy9kbSbgm6VWGN?= =?us-ascii?Q?ObAwJ2aYY974OwWNhGnP/K8DE+KjkOhqve1Yrzl4QsmdIxMflhrOXqn6pmFs?= =?us-ascii?Q?+ZM5xEzh73pGt+nnos1U2bBOqxaBgDC3CgOKwVx8H5hpUFavUG9iewROJxkc?= =?us-ascii?Q?oym0Jvhu+K8/HOicgP9JJ0KkFOX467Kmy/PbX?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 5:PCR41kOsHqQazzRqZ8w0mPIP+UVR6ZTRTjlyfmU9G+nh1dIuR7HER28vlejp2LElXmS0ZGlV5O9ZfioG2xWZyKXeDy1pqxyI+29AbgZr+hcG5RFJk9cqOAJnv/CTO76LSMak0ltKUUcWFTmLxaqNpw==; 24:dZiCYie+nLDnYPz3v2VqUsoYKISew5q8iOYrhxsAC1K/r52flkOZbmAm2W7JIKJ2rOB09MTAVTUCGpdRSGEfnw3JGGwThtmr+V9aBLQfowI=; 7:vqOj5tlzSFINjcKpvXQDQGftSR4wHh+29LgDExAPnIC5pXqgGoLyn+HC1+xTLedIkIDsEqtt3wA9n5MbEtePGyg27GsnYcZ1dXHaEU942Hm+KiPc+s14gbDl53f/T80DSE4G9sDdWsP5M33rz07wkwaK72o0YAtc6n7K4+k9qBv6JRt0qrMxr+GHFDNYxnnCL138JqpIqa4FVTpLJY/vBQ== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2016 19:07:16.9514 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v5 03/25] net/thunderx/base: implement DPDK based platform abstraction for base code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2016 19:07:21 -0000 Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki --- drivers/net/thunderx/base/nicvf_plat.h | 129 +++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 drivers/net/thunderx/base/nicvf_plat.h diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h new file mode 100644 index 0000000..33fef08 --- /dev/null +++ b/drivers/net/thunderx/base/nicvf_plat.h @@ -0,0 +1,129 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium networks Ltd. 2016. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium networks nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _THUNDERX_NICVF_H +#define _THUNDERX_NICVF_H + +/* Platform/OS/arch specific abstractions */ + +/* log */ +#include +#include "../nicvf_logs.h" + +#define nicvf_log_error(s, ...) PMD_DRV_LOG(ERR, s, ##__VA_ARGS__) + +#define nicvf_log_debug(s, ...) PMD_DRV_LOG(DEBUG, s, ##__VA_ARGS__) + +#define nicvf_mbox_log(s, ...) PMD_MBOX_LOG(DEBUG, s, ##__VA_ARGS__) + +#define nicvf_log(s, ...) fprintf(stderr, s, ##__VA_ARGS__) + +/* delay */ +#include +#define nicvf_delay_us(x) rte_delay_us(x) + +/* barrier */ +#include +#define nicvf_smp_wmb() rte_smp_wmb() +#define nicvf_smp_rmb() rte_smp_rmb() + +/* utils */ +#include +#define nicvf_min(x, y) RTE_MIN(x, y) + +/* byte order */ +#include +#define nicvf_cpu_to_be_64(x) rte_cpu_to_be_64(x) +#define nicvf_be_to_cpu_64(x) rte_be_to_cpu_64(x) + +/* Constants */ +#include +#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN + +/* ARM64 specific functions */ +#if defined(RTE_ARCH_ARM64) +#define nicvf_prefetch_store_keep(_ptr) ({\ + asm volatile("prfm pstl1keep, %a0\n" : : "p" (_ptr)); }) + +static inline void __attribute__((always_inline)) +nicvf_addr_write(uintptr_t addr, uint64_t val) +{ + asm volatile( + "str %x[val], [%x[addr]]" + : + : [val] "r" (val), [addr] "r" (addr)); +} + +static inline uint64_t __attribute__((always_inline)) +nicvf_addr_read(uintptr_t addr) +{ + uint64_t val; + + asm volatile( + "ldr %x[val], [%x[addr]]" + : [val] "=r" (val) + : [addr] "r" (addr)); + return val; +} + +#define NICVF_LOAD_PAIR(reg1, reg2, addr) ({ \ + asm volatile( \ + "ldp %x[x1], %x[x0], [%x[p1]]" \ + : [x1]"=r"(reg1), [x0]"=r"(reg2)\ + : [p1]"r"(addr) \ + ); }) + +#else /* non optimized functions for building on non arm64 arch */ + +#define nicvf_prefetch_store_keep(_ptr) do {} while (0) + +static inline void __attribute__((always_inline)) +nicvf_addr_write(uintptr_t addr, uint64_t val) +{ + *(volatile uint64_t *)addr = val; +} + +static inline uint64_t __attribute__((always_inline)) +nicvf_addr_read(uintptr_t addr) +{ + return *(volatile uint64_t *)addr; +} + +#define NICVF_LOAD_PAIR(reg1, reg2, addr) \ +do { \ + reg1 = nicvf_addr_read((uintptr_t)addr); \ + reg2 = nicvf_addr_read((uintptr_t)addr + 8); \ +} while (0) + +#endif + +#endif /* _THUNDERX_NICVF_H */ -- 2.5.5