From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0060.outbound.protection.outlook.com [104.47.1.60]) by dpdk.org (Postfix) with ESMTP id 8001A95D7 for ; Wed, 10 Feb 2016 05:04:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ezchip.onmicrosoft.com; s=selector1-ezchip-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BFuY8XJQN1CGY3Gn1LNsxAbvz/HE2zexCthRCs7/liU=; b=Jk3WF7ECuNCzq6BOiUjMNVUiVuH9jIXvqxM3wgd2FWHCFojTrW5DY4oDnlYfn+Q+ZbxYGHC7A/XjGMa6YdS2h1+VF51WR3uyskfaNY1TCca0Nubfy0713UZHzk+a+ZWSs345zqtUkZr0ZpMaAryVdTEhowc6zmr/OautnoY7fcc= Received: from AM3PR02CA0067.eurprd02.prod.outlook.com (10.163.180.35) by HE1PR02MB1019.eurprd02.prod.outlook.com (10.163.172.149) with Microsoft SMTP Server (TLS) id 15.1.403.16; Wed, 10 Feb 2016 04:04:39 +0000 Received: from DB3FFO11FD038.protection.gbl (2a01:111:f400:7e04::158) by AM3PR02CA0067.outlook.office365.com (2a01:111:e400:5365::35) with Microsoft SMTP Server (TLS) id 15.1.403.16 via Frontend Transport; Wed, 10 Feb 2016 04:04:39 +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-14.internal.tilera.com; Received: from lab-14.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.409.7 via Frontend Transport; Wed, 10 Feb 2016 04:04:38 +0000 Received: (from lsun@localhost) by lab-14.internal.tilera.com (8.14.7/8.14.7/Submit) id u1A44bPI006713; Tue, 9 Feb 2016 23:04:37 -0500 From: Liming Sun To: Date: Tue, 9 Feb 2016 23:04:30 -0500 Message-ID: <1455077070-6666-2-git-send-email-lsun@ezchip.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1455077070-6666-1-git-send-email-lsun@ezchip.com> References: <1452263948-22485-1-git-send-email-lsun@ezchip.com> <1455077070-6666-1-git-send-email-lsun@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD038; 1:CdL203I1etBOUhweEd5TE9Key47Y8z+S7r8/XF9fL9f7ILCyOQAilC6IJY8DuVr+WEshF2Y6WH+SsQpaJ/PvL2xfnbTSH6t1OyPwbZ3Z45qTZKIIsnzyInGrk1JKppw2g9vB3J5S/U06AM/iUgwsuP6wWYnTnRc9rxm02Q+G0VccgMY9E0cMiO8t9jpmEx/onPresBI6gkqj26V2QhpiFGpcbMNxAsauO747V3GZhfTSzKLe6GCHdIbdKaFFFqJ1ffcFULFNuqaSnUuc9IIpZCetquo6RDTq0qiaujBSB6cOsUvOvLy8ZT0rSzgLbvDtW81gPMhxy24+af1ewBTBN4LAf/U7+EQMxgexoVNiME/xQOWp9k3GKUjXKBsw2YmsfnNjnX1bZaIYaQ5aqAh9Bin8CARdruSEUiR0xDvTU+ozRSnGytM2f9pEd1+jDEFlmoQc0zmfcaAGMG7OK08vAkTZE+dxOgfX/+F7UUxg+gYGOaoezQNrcwupwwrjqOBmbYloJo7TFLMFUkXsgUUtvA== X-Forefront-Antispam-Report: CIP:12.216.194.146; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(92566002)(2351001)(42186005)(50226001)(85426001)(76176999)(50986999)(87936001)(586003)(86362001)(6806005)(1096002)(104016004)(106466001)(33646002)(5008740100001)(11100500001)(189998001)(105606002)(47776003)(110136002)(4001430100002)(107886002)(50466002)(229853001)(5001970100001)(48376002)(2950100001)(5003940100001)(19580405001)(36756003)(19580395003)(1220700001)(4326007)(2906002)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR02MB1019; H:lab-14.internal.tilera.com; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1019; 2:qysIZF5uCaE/ACkkX0iHTVLdrFa35uNc7Pu9cEzhFRlOCUdV0PnZXpNjAqpmWP8XNd2V64yDOICBNsNpncoRg6w+bSg2Z8XAlOqd5GimTNI+R24Q1jA66ZBj1cT+oIHZoD+batipvbiYCZCCPFnkIQ==; 3:El7JUleOl1fTTr9BxEQu0gp8R5Jhklm6+sh1ShH6Wng9hllZZIlQRr4LKsXF4dk62upKGF9q+ZbJ1ht0KtE5aPQxVPDa6HPOVM32+vFhTSyae7wwsQ/B1VSFn+LovZjCqXz843CGHfHGa87gZJnPXX8hWP4v6miiJXBQR2dCOx7r76wxQC+yq5+r/RMF4M4E/ifnz9vQYJj1fPP9uRowkdKBqJ4OZRCUXfWP/M2F/Po=; 25:IpQCJ81OFNUCHQIcDrTu6BQr3eeHHVprfLuA13BH0Z7USusqSJWdMHY/ZsrRMEQQaaBQvcWneYsv2oVwKo+Ddmf6JIx8aWqcW1uJakdqWlV2qg/FshNkjvmFaTy9atW3IU5miQZnMTkQsS8W8ugg9h+t68ZP3d9F44+KRSCOM0KBWbQz3nIx8yeeBHLYlOs806PXDww+RQ2GPlHw9RKOP4A/fCQ2f2dmfML6ycoKndc4PFaMh7V+DhjmEg5BmOowgtzEWIRLuOgOUOSRLOXdOwPNo6hgNY7ZLdIfjUBIMlGyYx3++wFC5C15wNSYN/pU; 20:ARIa7+n/bvql2NC54pC8FwFr9YNMMNkdQFE3Jzy++BejpzVFkksFJ0Oaz9XC4SmyQ65678SooHnn8ei9LZsd3o8HgDClRtGsGuvZ3U4GI3qJBGmquNFIrJl9cxMME84dwtoVnA/Bjsoyj8wP8HBFf57O7em3hyiTmFxEeEedVpg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB1019; X-MS-Office365-Filtering-Correlation-Id: cf0a5067-4eb9-480c-d229-08d331cf4bc1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13023025)(13024025)(8121501046)(13018025)(13015025)(5005006)(3002001)(10201501046); SRVR:HE1PR02MB1019; BCL:0; PCL:0; RULEID:; SRVR:HE1PR02MB1019; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1019; 4:+q6z3XzbDQAXTNXcm9ywCp8/9vGOOsY0Y/ZdLOoJnsf6bmo+KUbx859IPBN8LMkXu7PFESYFhIvejXfj5XN7PdaakTJRq9T6siU9L/SMM/Lm6UUlJLfYfJZw+Vsv7/hmM0yXdsUKngdV/b2fScac86HdoC2n09k+Vmj/tbnNwOhZzUclWgz0TACPvz75vGfPjo5tpES23JOAoGYyzd7FbGEcvy0Ksilg4yOAcHgfRD7emlGCaOn7YHwT7Z4V4oba+wU7v1NP8+05wtz99PuXzqrAvwB89oblNNRXEtOTpqdNF+wJPPJ4EpuWBWnFpV+j+AIy1yjQIpQ2o1E2rzHomB7b6dsWFGQKB5fPDyUep+qsnSe2wqqsVrTAVnjhb3Sj1A0A3QU1/zAac2Seu/Y3HjOD3hEkOi5H6usJBnrTVwmoQVN4GzjZ6NpRsNeljiOVIGXFMYVerDKEuGOo7wEdog== X-Forefront-PRVS: 0848C1A6AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR02MB1019; 23:mTgfQICefZpUGWBa6UTyMN3rvpSecWnLY9zLYnSTc?= =?us-ascii?Q?6J14NIacz0NkZDDXHxq98EUp0/DQUequQ73QCWh5NNdYClFB5uJxZcZq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J7sTda3AzGGAjFusSb?= =?us-ascii?Q?JXDySHGI5kax3Aq46DSJDbK5XK7otbpSMFte1gzxxtrHB5V43RWGLxONNBQq?= =?us-ascii?Q?oJCo1FOEUA5pexz4cpHlWbXjrXRCeWm2Z5IEm0P+Z/6XpTQHTepn/IYQ1Xb3?= =?us-ascii?Q?kmaSGs5lRtmsO37oLQMMMnTRkjVngjM?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1019; 5:1XJkRbXYGwo1Ie9D2lF+hgQj++/WWeRuFkSMr0OKV2shDlmvbXeusojXgN/dXIFrBuaq+RIBXnfDzak0A97NDtRgQEwaFbiG9ncryQ6USzTGn8fz7N3v8XODru+67e8UWFTW32hb8DC80Qt8x9kvFA==; 24:8CRGVfD8XHmPFmXVys6jKQrDsXDqcmg34dyNOoQUpLGEouxd7OcYItGeveLDmiMgQbH0r7rxjfrZuxQD7Zu2MSNTuP/eYpYBzF4ff5I8rVw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2016 04:04:38.5080 (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-14.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB1019 Subject: [dpdk-dev] [PATCH v4 2/2] driver/net/mpipe: some code optimization 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: Wed, 10 Feb 2016 04:04:41 -0000 This commit includes two small code optimization. 1. use __insn_fetchadd4() instead of rte_atomic32_xxx() in mpipe_dp_enter/mpipe_dp_exit to avoid the nnecessary memory fence. 2. replace the calling of rte_pktmbuf_reset() in mpipe_recv_mbuf() with specific code to avoid some duplicated initializations. Signed-off-by: Liming Sun Acked-by: Zhigang Lu --- drivers/net/mpipe/mpipe_tilegx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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); -- 1.8.3.1