From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0065.outbound.protection.outlook.com [104.47.1.65]) by dpdk.org (Postfix) with ESMTP id 200F78D28 for ; Wed, 10 Feb 2016 04:47:34 +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=rxwCXx+MeNMPY5lhoupMWBbxzIWZIKfV1wXtKJnqAoo=; b=TnSuWV9K/mQLTKLcACZ2I7lS6K78TGqGm+vlo3qVu/6ZdlUljPTKWpYmXxihqTiJE+ANZFaz4U9fRRcJKaBzIR1Du7Q2ZkvWYLnloGvoBtuQklRL97ROwmGPmTySqAbBlrhvhmlzZ9wqya00JOedfZ8nuFu/I0+PdzRC1jqB2D4= Received: from DB5PR02CA0029.eurprd02.prod.outlook.com (10.161.237.39) by VI1PR02MB1024.eurprd02.prod.outlook.com (10.163.163.22) with Microsoft SMTP Server (TLS) id 15.1.403.16; Wed, 10 Feb 2016 03:47:33 +0000 Received: from DB3FFO11FD051.protection.gbl (2a01:111:f400:7e04::108) by DB5PR02CA0029.outlook.office365.com (2a01:111:e400:5805::39) with Microsoft SMTP Server (TLS) id 15.1.403.16 via Frontend Transport; Wed, 10 Feb 2016 03:47:32 +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 DB3FFO11FD051.mail.protection.outlook.com (10.47.217.82) with Microsoft SMTP Server (TLS) id 15.1.409.7 via Frontend Transport; Wed, 10 Feb 2016 03:47:32 +0000 Received: (from lsun@localhost) by lab-14.internal.tilera.com (8.14.7/8.14.7/Submit) id u1A3lUqW005517; Tue, 9 Feb 2016 22:47:31 -0500 From: Liming Sun To: Date: Tue, 9 Feb 2016 22:47:00 -0500 Message-ID: <1455076020-5457-2-git-send-email-lsun@ezchip.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1455076020-5457-1-git-send-email-lsun@ezchip.com> References: <1452263948-22485-1-git-send-email-lsun@ezchip.com> <1455076020-5457-1-git-send-email-lsun@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD051; 1:NagzSXTyB8ozC341ImMhtZau3UDVn7IdmvdjJ7Z0gDsbD289As6BWryiS/nmTMZW/rhBFQAaGitZr5rfy14+fOBxW6PatqXtc+sc9II7uFhJ/bCZMznaS/Tk0WrgHdG0/i/7L6JOstqlzIbFuTRs3pvx03cxYAl+yheyyJF17jVa7Tx63e8XofKQ95AakK2pz1dM04kheCesMkwlMmNsS+FVoJAY9B+p94ljMbeAjn10l0Haw4LZtiMjE8YXFX8BRTYO+bUh3wu0P6I7EJ09KMY6TNlj+JvYUlpUcuVteUE6GnFEso1tP8Py7BWlJ88eYdubyuTUBlh+AhohLcIskD/ym7CqImeVnTu1xs8acDFA0GHp6D0EI0jI6pwGjWnjAXIhxAwddBWVKYBMvVt0ufrE1rgbhSsgQZjBi7Eb6C48kgoqXcXzS6Cm3wG4YlvZli3GTBICPRE728freccIM2dbRgco9lkgWBs2JHwIZ/I2eAGFkvhh3EgJt+ARj5WyPpL46z1rbOnmoQR0HEHCng== X-Forefront-Antispam-Report: CIP:12.216.194.146; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(33646002)(105606002)(36756003)(11100500001)(76176999)(5003940100001)(110136002)(107886002)(1220700001)(1096002)(229853001)(4326007)(106466001)(104016004)(2351001)(586003)(5008740100001)(50986999)(2906002)(2950100001)(47776003)(19580395003)(4001430100002)(6806005)(50226001)(85426001)(87936001)(189998001)(42186005)(5001970100001)(50466002)(86362001)(92566002)(48376002)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR02MB1024; H:lab-14.internal.tilera.com; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1024; 2:bVY45QW37EKU4RmpNPF0oCvGbjIYrSGv6Mgv3bc8ZOhYBXGO6Uma1u5UauCxFaIjc+sVNTmenDA3fLTxo71aNHdZ2vVPXCGX21/u++IYb+1bgu82ZlcJOtUS65cCLTKwmoB57WDnogBooHz/SSgdhQ==; 3:Ohvr3D817L+VsxK5CYnbE/PHRzDFdDSI1EtZ5OzVYW8Ya5e6LHpl/z/alaY9cSfU75fPXBsLobIQiWyhv+BCQBq5X7iAf3MMUY6SZdxqzo4ODB39NrKRZAO+vdiPvuNiWaw05/kUBLoCGGpivu5LAwbc8DkMdBP6+8cRLmYJ09UtyKXKEBpzLvKDs2KDLQ3KFVBpldazXFgc/nKG3fBTPODc0hTaothRqZYOwPbxAMQ=; 25:HW0RM3N03xzU3jv66vfzMlomZ1JetCXj5tNqBC9u4LliYopUXC3VR0PP7jQim/RenGL+t9Ovv/akrhvdJCGELLGjjCsYbzQZhWZ+6xbHYp8v4pClYND6gRaBg7Sbf2imSkY4OC6L3+NGzt81zWhUnocJwMEG0lugV4iR6bYWr13rDXZiQBz8sWeQrLKeH5EmtIjTf24LSPkpS2xKYgyDL/e02sSzPbxqoI6HNbVNMWK4d7t7m8c5DTRc5rIh97hFAghwYqxwLRmn9HDbqwSJ3BwCFh63rcmqWfr/5ubMbwwtGhnWZ2/ktcWW689FdYzR; 20:yZ9E78MIW8QhUhEexNeNbXC3NU5PXzxXi+FOi18NtnZrT7eXgXTQf2oP/r5oA3A3W7H1HmS5+/Eks+cVweZ+lwqJmQYS28o9NDGEX+yk6+jjY8nuVJW2HVr+pxFBGsP2j/RhpPSyi6i2zYjk+g3WERR1eqFMZczR4Ft2BMff8yU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1024; X-MS-Office365-Filtering-Correlation-Id: ea30fe10-cdb4-4a45-fa79-08d331cce7f0 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13023025)(8121501046)(5005006)(13024025)(13015025)(13017025)(10201501046)(3002001); SRVR:VI1PR02MB1024; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB1024; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1024; 4:S4pyM49qKiyJ2nEbtSyMszw3CgRQDl/3qCgW6SdoU6C/yVODMtPnVSyWp245p0bb6EE1Onm9GPu1mHQ+7SYOQsw9yA+J5kIcyQR54p/tHH+h+/0lQwmXSpmAAmktu/t8JYiRi4W7g/lqf8EseRnqnMRI9cER2Ek1Dp15yProxi/Dtyhv4zIXYsUOhO0Hb+mSrmA9IRPJbnqultCq8+9Q/n8FwhZ9uSUfg1Ytqjp5VxYaGgVUbcf/+lnEM/OSE5aFNNZkDU960fLPL2aQtFx6inBEZ8frDjYxfe1aF0obnPObmyV+U4pZZKFd3SaQXTjTRAKqMLaMxCPTNc/e1cMtrcfil40PxZ63Vo/7DKvppV0MqiiHJ8f+NCDjPRjkKAG0SPvyYj6JtekfQye4CtUohrC1WZV5OYX2hR2fWKg4QcSNXWWBSsEEcD9aitOb/hbn4K5qPCJC868gSMCq99dZWA== X-Forefront-PRVS: 0848C1A6AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR02MB1024; 23:1uk05CAvo8199ptQYNga8wrhj+YJZHJV4+lesloH+?= =?us-ascii?Q?nuejknFWSPlQkDxRRk4QSjrUrUyL3D6Qz1cN/V4xi8ofP0mxSmyjqS0GrjMw?= =?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KUnGdPl30I1Baop?= =?us-ascii?Q?yNv3ylXvvOYaTpJLaG5/ZPltqcXg+GyGa4cclQSjhZlcdvm8YAYup4TJJTK3?= =?us-ascii?Q?KGuZBQCB9raFkLchI6L0k9zt0N9he/SDQVZGkuc9LfFoOqGpg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB1024; 5:GKeTii9JA9WHxrZomd4vWduMUKwmguuBv3RARmwspXIwBZIa4wphP0KpUNPqeoFldCA93YgN2ftL7HH8OiBk476t9IIuiq9u8cM7O+zcYJYU/2+f3Wj7t1VJ8qQ0QKgVXHwzOTU2CMFJe0eJ1KhvrQ==; 24:A4qpnk6IeZR8O4fM47pZlWEJsFonH7UobtI7hOP0skrtk/F6NJfOjl8KPvBPC4Mtlc7a0aD8ZyFG08c1wGUoSHXJ5b2GQa+3qRVF8RcuarI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2016 03:47:32.0514 (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: VI1PR02MB1024 Subject: [dpdk-dev] [PATCH v3 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 03:47:34 -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. --- 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