From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BBFFA058F; Wed, 25 Mar 2020 01:17:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6B5C72BCE; Wed, 25 Mar 2020 01:17:06 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id E46E31E34; Wed, 25 Mar 2020 01:17:04 +0100 (CET) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02P0H2nu146515; Tue, 24 Mar 2020 20:17:04 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywbthaqk8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Mar 2020 20:17:03 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 02P0H3c3146557; Tue, 24 Mar 2020 20:17:03 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ywbthaqfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Mar 2020 20:17:03 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02P0E4BR024386; Wed, 25 Mar 2020 00:14:05 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma04wdc.us.ibm.com with ESMTP id 2ywaw8w6b0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Mar 2020 00:14:05 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02P0E4Xf14680620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 00:14:04 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0CF3E6E04E; Wed, 25 Mar 2020 00:14:04 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BDFE6E04C; Wed, 25 Mar 2020 00:14:03 +0000 (GMT) Received: from ltc17u1.stglabs.ibm.com (unknown [9.114.216.145]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 25 Mar 2020 00:14:03 +0000 (GMT) From: Thinh Tran To: dev@dpdk.org, stable@dpdk.org Cc: david.marchand@redhat.com, drc@linux.vnet.ibm.com, Thinh Tran Date: Tue, 24 Mar 2020 20:13:56 -0400 Message-Id: <20200325001356.147049-1-thinhtr@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-24_10:2020-03-23, 2020-03-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 phishscore=0 impostorscore=0 priorityscore=1501 spamscore=0 bulkscore=0 mlxlogscore=766 lowpriorityscore=0 clxscore=1015 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003240115 Subject: [dpdk-dev] [PATCH v3] eal/ppc64: improve rte_rdtsc() with __ppc_get_timebase() 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" __ppc_get_timebase() reads and returns the current value of the Time Base Register. It's more efficient as it uses the processor’s time base facility directly the DPDK on FreeBSD currently is not supported on Powerpc64, it should be safe to include the sys/platform/ppc.h Signed-off-by: Thinh Tran --- .../common/include/arch/ppc_64/rte_cycles.h | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h index 8f2e98642..871f9b6e4 100644 --- a/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h +++ b/lib/librte_eal/common/include/arch/ppc_64/rte_cycles.h @@ -14,6 +14,7 @@ extern "C" { #include #include +#include /** * Read the time base register. @@ -24,32 +25,7 @@ extern "C" { static inline uint64_t rte_rdtsc(void) { - union { - uint64_t tsc_64; - RTE_STD_C11 - struct { -#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN - uint32_t hi_32; - uint32_t lo_32; -#else - uint32_t lo_32; - uint32_t hi_32; -#endif - }; - } tsc; - uint32_t tmp; - - asm volatile( - "0:\n" - "mftbu %[hi32]\n" - "mftb %[lo32]\n" - "mftbu %[tmp]\n" - "cmpw %[tmp],%[hi32]\n" - "bne 0b\n" - : [hi32] "=r"(tsc.hi_32), [lo32] "=r"(tsc.lo_32), - [tmp] "=r"(tmp) - ); - return tsc.tsc_64; + return __ppc_get_timebase(); } static inline uint64_t -- 2.17.0