From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0083.outbound.protection.outlook.com [104.47.1.83]) by dpdk.org (Postfix) with ESMTP id EEA6C9AD8 for ; Fri, 8 Jan 2016 08:41:49 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=zlu@ezchip.com; Received: from zhigangTHINK (58.135.92.20) by AM3PR02MB1140.eurprd02.prod.outlook.com (2a01:111:e400:c406::14) with Microsoft SMTP Server (TLS) id 15.1.365.19; Fri, 8 Jan 2016 07:41:46 +0000 From: Tony Lu To: 'Liming Sun' , References: <1450813790-11874-1-git-send-email-lsun@ezchip.com> <1450813790-11874-2-git-send-email-lsun@ezchip.com> In-Reply-To: <1450813790-11874-2-git-send-email-lsun@ezchip.com> Date: Fri, 8 Jan 2016 15:41:25 +0800 Message-ID: <004801d149e8$095f35d0$1c1da170$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdE88goeim6eNCmqT0+SEQ4PO5EUmwM9eUZA Content-Language: zh-cn X-Originating-IP: [58.135.92.20] X-ClientProxiedBy: PS1PR06CA0042.apcprd06.prod.outlook.com (2a01:111:e400:7829::52) To AM3PR02MB1140.eurprd02.prod.outlook.com (2a01:111:e400:c406::14) X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 2:yuazuOJ8bt/E5f3VpjMiCQmZHDoV6M4Y6IVqdXIMB3r8hKZxs/DEimc0T49qiMoNSM6B4mmbvemjZQ4vBRP+OftLwgZ2NDtZBStpW6RxNhzQZVl2zKBu+tndPpLC8CD4jTrl2/GOdr6IFOTujDFRYg==; 3:EA62akzChqE1FN6k43dp37f6xYCVH7ouBxudBiVxbSJ9HvdMY77vu4xoMzi5ORU9V9mvsbPUjndphcToDMHFHV2eYG1AJ/vRkYbf1VQRkmaKuRvM0hkZ7JJs3eb9Vv4j; 25:k0IYfe8g2HXLCdoCNNhpdu/An8E4H6327LQpocejID/4/eEivqeIShVlSQ8Rcy1JcrqoV7Y1uXA745o2fhybUcX4yYCZu7RWJ3R+ELhKA6N8nOudd4omAc5cst2tsmFVaLoUPD3PYywFMK0PRP/xrCAnpJmpk1nUz+VS3oyuzS8w0o0jhTSv6nNRN6mV6qJn1SVjUbbOEWLJSdsf46j0MGOJ3hJv0ir8jMaK6gXtZ7IAhT+0WCBPEu/hoJTlKcB2; 20:wDJP6XwZCB3/Y9sUXJffq6b0tKKRCpfp77t50h780zIz2v44vZUId3e6B0Lv289aidl1vvQmt83Cjum+dJnTFzEtSgV9MNo/NYYcQZSs0D9sIkw9UpgOLKqW8NMLTVCcy7Ih8S1YszPjyPxgb9bqg2PNna4mghEYBY1nC2p1caM= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM3PR02MB1140; X-MS-Office365-Filtering-Correlation-Id: 12f28ce5-3206-4141-7da9-08d317ff2a56 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001); SRVR:AM3PR02MB1140; BCL:0; PCL:0; RULEID:; SRVR:AM3PR02MB1140; X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 4:ws98TpYW7VUFxu/z666gFvWi7P8/gKUg/qRxhbQOcOJZi2K1AfyB9NWA+mWRDtOb6IVlaAf49plj98dVYVYu/dkg9KG+QN40/u/0D89ftsdKuYc7P2hF2K8a+HPryTpJSldbNFYldDpyu0Xup3hwCjCjRNhZ7wOzNRxtIoQDDh+n5KAimhGh1cq94zoTuI99Sd3PPk9HF7JEl97oC+NA70gZ6uDepEw3qMUp40JTTLh1eCBo9tM3I542yyqsVOKrdzyThvlLFryjpufWfaVU6vLfYK9y3ko5uN4qb6Lnd6J1j02QxT17pmM5Gg2ZyyFyP5PkvON+LKujP1e7f/gpzZDuw/IGVBL37jdjZGC2SOh8pUUqouBTRqDKd74S80eEKnDo4+YTj1/GN9o0qnnT42fZS90rRdVVUyD7QLPbzUp6GvVYcX987+b2R31ziKAI X-Forefront-PRVS: 0815F8251E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(377454003)(189002)(13464003)(199003)(19580405001)(66066001)(87976001)(46406003)(33716001)(101416001)(19580395003)(61296003)(2906002)(189998001)(97756001)(5001960100002)(92566002)(84116002)(107886002)(2950100001)(42186005)(96836002)(40100003)(50466002)(14726001)(86362001)(102836003)(3846002)(6116002)(586003)(33646002)(122386002)(1420700001)(76176999)(1096002)(59696002)(50986999)(23726003)(50226001)(106356001)(5004730100002)(81156007)(5001770100001)(97736004)(47776003)(450100001)(230700001)(105586002)(5008740100001)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR02MB1140; H:zhigangTHINK; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: ezchip.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR02MB1140; 23:a3700FjEuT/9ogl8va7/d18hRQjoyd9jKSlvaxIAU?= =?us-ascii?Q?vMZc866xukOtF/s3REs33fvcLIIwRDyl1H1sEIGL5QP+vAB4JwfpD27mnEsv?= =?us-ascii?Q?h7JavqXtCoYqWEjayz8BAr65e3HoKyBSQkxaO/bZMCqUdQdgfLXw8WLRDmda?= =?us-ascii?Q?2oRUQ9dFDmNhAsCG6ImX6IvdT9Fp7tCifXXnJlDk2+iFtCdvBhwyZV5wjfRn?= =?us-ascii?Q?bFaYPF6Er4PcbW2j1MUAaTQh4eFv1IwZGE3dnyn8YJ8oMQ9nMGxrWT9SZZuu?= =?us-ascii?Q?GZG1bqbOu0CJ6fHG5/l6b4NoYgKVTBN1DlmmibZW3BL/Yoq0IQpfiiIRFQf9?= =?us-ascii?Q?IB73iUB5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xkE4xUq?= =?us-ascii?Q?8sAkFbfvboz3b0ori8pkX2kbp0A8hLNib/QyZS3drZziGR6jlYmhB8HzH7fi?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; AM3PR02MB1140; 5:F9c/Gp88vErnIpCpImFgr0SeMLw8SPMqqD4mtyet2+cpfusjPgKJ2rCTjizeUKu714LLdTGOHJGFcVvSo8/tXOOf1VfEv6I5YR6H2jdEkIWw8zvHkWITEX+jVN/xwAkCA941JDJFAbKEmodwhO63kg==; 24:qVpAffJgYZXc+YbESvBL3cP3mSuZL/9FOhpoe3+sevCcqAHCRg+GlGJm3R4ovjpTQMZdBYL6nzuXE+iVhEj0RMzegLe9a1WicSeBzfUXOys= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2016 07:41:46.4719 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR02MB1140 Subject: Re: [dpdk-dev] [PATCH 1/2] driver/net/mpipe: add rte_vect.h and enable CONFIG_RTE_LIBRTE_LPM 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: Fri, 08 Jan 2016 07:41:50 -0000 >-----Original Message----- >From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liming Sun >Sent: Wednesday, December 23, 2015 3:50 AM >To: dev@dpdk.org >Subject: [dpdk-dev] [PATCH 1/2] driver/net/mpipe: add rte_vect.h and enable >CONFIG_RTE_LIBRTE_LPM > >rte_vect.h was missing earlier thus LPM was disabled and l3fwd is >not able to compile. This commit implements the vector api and >enable LPM in the tilegx configuration by default. It also includes >a minor optimization to use __insn_fetchadd4() instead of >rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the >unnecessary memory fence. > >Signed-off-by: Liming Sun >--- > config/defconfig_tile-tilegx-linuxapp-gcc | 2 +- > drivers/net/mpipe/mpipe_tilegx.c | 18 +++- > lib/librte_eal/common/include/arch/tile/rte_vect.h | 93 >++++++++++++++++++++ > 3 files changed, 107 insertions(+), 6 deletions(-) > create mode 100644 lib/librte_eal/common/include/arch/tile/rte_vect.h > >diff --git a/config/defconfig_tile-tilegx-linuxapp-gcc >b/config/defconfig_tile-tilegx-linuxapp-gcc >index fb61bcd..39794f6 100644 >--- a/config/defconfig_tile-tilegx-linuxapp-gcc >+++ b/config/defconfig_tile-tilegx-linuxapp-gcc >@@ -64,7 +64,7 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n > > # This following libraries are not available on the tile architecture. > # So they're turned off. >-CONFIG_RTE_LIBRTE_LPM=n >+CONFIG_RTE_LIBRTE_LPM=y > CONFIG_RTE_LIBRTE_ACL=n > CONFIG_RTE_LIBRTE_SCHED=n > CONFIG_RTE_LIBRTE_PORT=n >diff --git a/drivers/net/mpipe/mpipe_tilegx.c >b/drivers/net/mpipe/mpipe_tilegx.c >index 5845511..8d006fa 100644 >--- a/drivers/net/mpipe/mpipe_tilegx.c >+++ b/drivers/net/mpipe/mpipe_tilegx.c >@@ -451,13 +451,13 @@ static inline void > mpipe_dp_enter(struct mpipe_dev_priv *priv) > { > __insn_mtspr(SPR_DSTREAM_PF, 0); >- rte_atomic32_inc(&priv->dp_count); >+ __insn_fetchadd4(&priv->dp_count, 1); > } > > static inline void > mpipe_dp_exit(struct mpipe_dev_priv *priv) > { >- rte_atomic32_dec(&priv->dp_count); >+ __insn_fetchadd4(&priv->dp_count, -1); > } > > static inline void >@@ -484,12 +484,20 @@ mpipe_recv_mbuf(struct mpipe_dev_priv *priv, >gxio_mpipe_idesc_t *idesc, > uint16_t size = gxio_mpipe_idesc_get_xfer_size(idesc); > struct rte_mbuf *mbuf = RTE_PTR_SUB(va, priv->rx_offset); > >- rte_pktmbuf_reset(mbuf); > mbuf->data_off = (uintptr_t)va - (uintptr_t)mbuf->buf_addr; >- mbuf->port = in_port; >- mbuf->data_len = size; >+ mbuf->nb_segs = 1; >+ mbuf->port = in_port; >+ mbuf->ol_flags = 0; >+ if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv4) >+ mbuf->packet_type = RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L2_ETHER; >+ else if (gxio_mpipe_idesc_get_ethertype(idesc) == ETHER_TYPE_IPv6) >+ mbuf->packet_type = RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L2_ETHER; >+ else >+ mbuf->packet_type = RTE_PTYPE_UNKNOWN; > mbuf->pkt_len = size; >+ mbuf->data_len = size; > mbuf->hash.rss = gxio_mpipe_idesc_get_flow_hash(idesc); >+ mbuf->next = NULL; > > PMD_DEBUG_RX("%s: RX mbuf %p, buffer %p, buf_addr %p, size %d\n", > mpipe_name(priv), mbuf, va, mbuf->buf_addr, size); >diff --git a/lib/librte_eal/common/include/arch/tile/rte_vect.h >b/lib/librte_eal/common/include/arch/tile/rte_vect.h >new file mode 100644 >index 0000000..32d768a >--- /dev/null >+++ b/lib/librte_eal/common/include/arch/tile/rte_vect.h >@@ -0,0 +1,93 @@ >+/* >+ * BSD LICENSE >+ * >+ * Copyright (C) EZchip Semiconductor Ltd. 2015. >+ * >+ * 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 EZchip Semiconductor 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 _RTE_VECT_H_ >+#define _RTE_VECT_H_ >+ >+#ifdef __cplusplus >+extern "C" { >+#endif >+ >+typedef __int128 __m128i; >+ >+#define XMM_SIZE sizeof(__m128i) >+#define XMM_MASK (XMM_SIZE - 1) >+ >+typedef union rte_xmm { >+ __m128i x; >+ uint32_t u32[XMM_SIZE / sizeof(uint32_t)]; >+ uint64_t u64[XMM_SIZE / sizeof(uint64_t)]; >+} rte_xmm_t; >+ >+/* Extracts the low order 64-bit integer. */ >+#define _mm_cvtsi128_si64(a) ((rte_xmm_t*)&a)->u64[0] >+ >+/* Sets the 2 signed 64-bit integer values. */ >+#define _mm_set_epi64x(i1, i0) ({ \ >+ rte_xmm_t m; \ >+ m.u64[0] = i0; \ >+ m.u64[1] = i1; \ >+ (m.x); \ >+}) >+ >+/* Sets the 4 signed 32-bit integer values. */ >+#define _mm_set_epi32(i3, i2, i1, i0) ({ \ >+ rte_xmm_t m; \ >+ m.u32[0] = i0; \ >+ m.u32[1] = i1; \ >+ m.u32[2] = i2; \ >+ m.u32[3] = i3; \ >+ (m.x); \ >+}) >+ >+/* Shifts right the 4 32-bit integers by count bits with zeros. */ >+#define _mm_srli_epi32(v, cnt) ({ \ >+ rte_xmm_t m; \ >+ m.u64[0] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[0], cnt); \ >+ m.u64[1] = __insn_v4shru(((rte_xmm_t*)&(v))->u64[1], cnt); \ >+ (m.x); \ >+}) >+ >+/* Shifts the 128-bit value in a right by imm bytes. */ >+#define _mm_srli_si128(v, imm) ((v) >> (imm * sizeof(uint8_t))) >+ >+/* Bitwise AND of the 128-bit value in a and the 128-bit value in b. */ >+#define _mm_and_si128(a, b) ((a) & (b)) >+ >+/* Loads 128-bit value. */ >+#define _mm_loadu_si128(p) (*(p)) >+ >+#ifdef __cplusplus >+} >+#endif >+ >+#endif /* _RTE_VECT_H_ */ >-- >1.7.1 Acked-by: Zhigang Lu