From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3on0082.outbound.protection.outlook.com [157.55.234.82]) by dpdk.org (Postfix) with ESMTP id DE7905A57 for ; Tue, 22 Dec 2015 20:50:31 +0100 (CET) Received: from AM3PR02CA0062.eurprd02.prod.outlook.com (10.163.180.30) by HE1PR02MB1019.eurprd02.prod.outlook.com (10.163.172.149) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 22 Dec 2015 19:50:30 +0000 Received: from DB3FFO11FD038.protection.gbl (2a01:111:f400:7e04::139) by AM3PR02CA0062.outlook.office365.com (2a01:111:e400:5365::30) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 22 Dec 2015 19:50:30 +0000 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none;ezchip.com; dmarc=none action=none header.from=ezchip.com; Received-SPF: Fail (protection.outlook.com: domain of ezchip.com does not designate 12.216.194.146 as permitted sender) receiver=protection.outlook.com; client-ip=12.216.194.146; helo=lab-43.internal.tilera.com; Received: from lab-43.internal.tilera.com (12.216.194.146) by DB3FFO11FD038.mail.protection.outlook.com (10.47.217.69) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Tue, 22 Dec 2015 19:50:29 +0000 Received: (from lsun@localhost) by lab-43.internal.tilera.com (8.14.4/8.14.4/Submit) id tBMJoSD9012021; Tue, 22 Dec 2015 14:50:28 -0500 From: Liming Sun To: Date: Tue, 22 Dec 2015 14:49:49 -0500 Message-ID: <1450813790-11874-2-git-send-email-lsun@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1450813790-11874-1-git-send-email-lsun@ezchip.com> References: <1450813790-11874-1-git-send-email-lsun@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD038; 1:g2ol16yKnz2B+Xx6DIvLW6UPFddo3W48O5O9qh3FOA2MlMo35DlH8oWIyW8WY6DPrpRz9Aqa3w8JVcJ0y+Obvn9wY7um3KD8XuhRwyKLtpg1bsMBMv996fO9VFFw7OwWZg5qdtDoiIyXmMcJg6hksZAaJfiOF3Ev7dVZ2R2lnAdfnYcH7XvwhbI4KgBUP+U0As2BCxfEVQg5s0PhhBqzWljt2+Pj2U8qrSYBUWBIbrUr0V1hUmndB6HiFH89XJky1HtSifgl1L/wXnUhOFBmzvjOubrBwlXi1fPlNf5p5KCV0HMTK56DN4AqqPIJ03niZgc/D+qxWRfENKrhIQV0rtEntvBqc3S2G8eU0VxUD5JtTul7WekhMNRVl/SBi7ipU/4fm1ABfkBZYpUChW6+Sw== X-Forefront-Antispam-Report: CIP:12.216.194.146; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(110136002)(19580405001)(4001430100002)(50466002)(189998001)(33646002)(105606002)(48376002)(50986999)(36756003)(106466001)(11100500001)(50226001)(5001970100001)(86362001)(107886002)(87936001)(104016004)(19580395003)(5008740100001)(5003940100001)(2351001)(6806005)(450100001)(47776003)(229853001)(76176999)(2950100001)(42186005)(586003)(1220700001)(92566002)(1096002)(85426001)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR02MB1019; H:lab-43.internal.tilera.com; FPR:; SPF:Fail; PTR:wb-fw1.tilera.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1019; 2:j4yOL3KCs5rr93jTPzjVrNeRo71AFH3GLW+xteJuc/G//zeTQtBWSni2ICbZ+RrKPMFRvofspvWEpuy60FQtHJE7ko5XLSxOw1se1hAdqCPF0GGdsabXGQ2HBBvZ8ITDjQYGOva+R1bVhp46r8Qr2A==; 3:3OSrt0L1fWD4YIBIG8DkwTijQkIWl4xgZW7V+2vPlH+XlRiNUJtFvzLAkmz22wRalR2GCBJmn80/5oEfp+dE/SipojEsmG/hiGTOIqXgoDW3t40kQuruCyN9QO3SsP4n9IFy5j60ec5hYHo02dfnS0+oOJCkD4+dzuChdfo2Yc6w+pFlVGNycXawo5Cekit5LqLQcjrq7wiFhLWIWeW+Y8XBC8S5WdAunEHEsTWtq8k=; 25:wdli2Ljp1dnpkLkaNoeOib4oVCjrWvQrJxPLJ3nBPnO/P4oZ3YA240W53BmbGYVVt0O1x6JxJo25wkloxrXPhvFDvTE14pYdsEjl4QcEzxlgBzTGyDmsQ4pjMF1zblZJVRgZavuSgxoRteuTy6TQkinrJcr6nA5w+IgcRGEK9wB5AYTJvO5dYMdS+gzDsr77+LFL34hLTVd6bNHGeAGsACPRrAZ6hVO7L90UKhPjtTrpikvM67orTuYscAeLcTyTqxbFMqBw6sXxUnygG0fNiQ==; 20:1Ai6S6FRh8XvtycKQGERABsbZb9J1AaHdSEkZb0RkVipcnc6G9GZzOuq4Fz2+rTdCAN/xlVuBdrsE509bXvlcCNJ3SG4JoRSLQb7pRoV3TNxpoVkxVLBw2kP/UTKfFQhsI8CPpA23/c1ROSfaCmNpXMrwvP0jP3S9Zy+YLOqkJc= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB1019; 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)(3002001)(10201501046); SRVR:HE1PR02MB1019; BCL:0; PCL:0; RULEID:; SRVR:HE1PR02MB1019; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1019; 4:vhkG3k6R+fXIxG4yipwSAxicZ371VPVU13G9jREPDvNLJgak217AbqsSjZc5qAvI6UxbFWHoa6YL5elKmWUJVYGit+GzsbXXLfROHqqKz3pPKDMCrEdUJUuqLOSM7puCrq5AgJkRT8YZqNE0gFVVhShDUL6W76gFXw1ed3vnrYaNNljk5jxPGc9PlL7pGPTGRI+or79bjWtk8DYcJSw7YqR07f7N6ZJCrWzV19YwrnGO3gNEYi+X/RkSwaCT75vNMNEGa0l4qUQ/1NDtQYGVmroU37jh9NsVsRif30bZNin0sWR9OfmG0OQ9tfimTf7C2o3V/skJX9n3mjkYzTwMiEwNCssqmJaHxe0AUfpbHDPp9TToq7jBcJYGmglmXcwhTZ0CLdr02Aw0vdteX/SyNqtApjSnW60scQhDhu5ikT5FuA2vMpceTgXK1maB5r9g X-Forefront-PRVS: 0798146F16 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR02MB1019; 23:rGHCOqBdEeGHwp9ad91LMossMiHff9VB3mm5A3KYd?= =?us-ascii?Q?O+AOga4GI544YSuC5uUacQL271KStTXhwbjNAM1B+nCi9Qljo1OVihdWVyFr?= =?us-ascii?Q?YNXCPvcHO6KtpSxNX+SOMNQ3SjxwOAO6IpjOvOA/DXS18ahRVAxb/6Y6C6OE?= =?us-ascii?Q?QimAVAGb/IbFSNtNH8Mu8zG3KOvZeoaQOWJc2itobH8KX5eo8L9oxEEyFfVh?= =?us-ascii?Q?DmLNGYDqux7Mz+ZNhcxgvEDI8TBtE+mi/PVUn9ErDs+0csmvICr0OsMBcAGV?= =?us-ascii?Q?oLFMNJVDvh3dfBzPZoNMy9ObFbpQb750LvUswniUoP48MrpHKyR1rmjOQ47O?= =?us-ascii?Q?6MG/EHcdt/nMHTJ43MPWazd79XVgoTbGVPWhvbAjy9DuPHkwL/H/LTm/5ut6?= =?us-ascii?Q?LWORNaw2R2Dhwu2ZMfNaZSc1L/G0fQWHWKovytlZ21ooBTXjwwsXtMdEVw3f?= =?us-ascii?Q?27rJEahOebNxF9ONoOVgKfhcCYx6q8Ix7ITbK6GNqHZ5tHPiWUXN0ZHiOifm?= =?us-ascii?Q?ZmIz+LzHvCHsZdppzUMUd1BMpe5kM35puP1o1GnLtqofMzdJgUEOgdIHsb7p?= =?us-ascii?Q?8bls9t+Ei9hYrK+TVD+ff9pAVAnAaniyIjblo4VkCp6ZG4xL/tHGAe1ewR9V?= =?us-ascii?Q?Ed1rXzoLorjZJvBZBTtvEfDvlmZCPR/qd4a57GkbbnvUI0ZkXECdkYEqBv5b?= =?us-ascii?Q?DY/x3ZyyAaDhsgKBSlm/id8V4QSC58BeMHQkvXRiSBGTheicCaDAGW6629lA?= =?us-ascii?Q?HVayDLt+89S9MAU8vZvGfH6V0B9slZhE2iI3NlR2n2wIVjVIiMnHad6hR33g?= =?us-ascii?Q?Vo9WDbCU+oQZlfLWV5aOLnzVg9NiyYTfGfpFZZxsi8/ZHAXLyWywE6XH2NtQ?= =?us-ascii?Q?A7t6LawGrQHRml+dmfr4cgWrvM3lib/cFpn9IQNtEV/vIyAWDf0s8wvBTaKD?= =?us-ascii?Q?AyDEJEUF7ugLbaB2G7UbQWIel8+fYSGUqRYdJMKTo0G9Mx/FG14QKCDL3TvR?= =?us-ascii?Q?D6TvdL2UBh7Nh+gGKGccAqj3TrSCxWmHC627Bd3/6Q/LBh1O4zL8Zm8P7iWl?= =?us-ascii?Q?Qb3ji2QuykAlr7uXkeJf7mxVjbtSAJelavyXVrxS4OYA3Y7hArKyjsD9gRG5?= =?us-ascii?Q?fddSgxHGdY=3D?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1019; 5:ElkmDuU75othXv8EcdOgTgF+JQRLWhKx8h257hb5UasFIQ5ye7t9akddTqlotYKWDVxBJsTLEdE8hZKkQpkifxkaPJKmul5Odbc21rr2NUZ9zIUnvGYkGnyxkeRmtEGXs+R/xY2XBjq+iosAER7xeA==; 24:VUJvY7UyE7fFKY5zBU/AZen2qXA75RjW+LmujToxAPLaLPBRntT3PqiWSoOBqS9zvHmtF27dIZMWmmfm0L2sHqgxJPLb4a151RxDYPk7jj4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2015 19:50:29.5249 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3; Ip=[12.216.194.146]; Helo=[lab-43.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB1019 Subject: [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: Tue, 22 Dec 2015 19:50:32 -0000 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