Message ID | 1473755111-26746-1-git-send-email-matias.elo@nokia.com |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1247037qgf; Tue, 13 Sep 2016 01:26:29 -0700 (PDT) X-Received: by 10.55.215.207 with SMTP id t76mr23660930qkt.152.1473755189890; Tue, 13 Sep 2016 01:26:29 -0700 (PDT) Return-Path: <lng-odp-bounces@lists.linaro.org> Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 191si14540441qki.210.2016.09.13.01.26.27; Tue, 13 Sep 2016 01:26:29 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 1634661645; Tue, 13 Sep 2016 08:26:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5971761648; Tue, 13 Sep 2016 08:25:53 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D25AF61644; Tue, 13 Sep 2016 08:25:49 +0000 (UTC) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0109.outbound.protection.outlook.com [104.47.0.109]) by lists.linaro.org (Postfix) with ESMTPS id 5CBCC61643 for <lng-odp@lists.linaro.org>; Tue, 13 Sep 2016 08:25:48 +0000 (UTC) Received: from DB5PR07CA0018.eurprd07.prod.outlook.com (10.167.223.28) by VI1PR0701MB2000.eurprd07.prod.outlook.com (10.167.209.146) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.10; Tue, 13 Sep 2016 08:25:43 +0000 Received: from DB3FFO11FD053.protection.gbl (2a01:111:f400:7e04::198) by DB5PR07CA0018.outlook.office365.com (2603:10a6:0:2d::28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Tue, 13 Sep 2016 08:25:43 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.240 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.240; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.240) by DB3FFO11FD053.mail.protection.outlook.com (10.47.217.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.619.6 via Frontend Transport; Tue, 13 Sep 2016 08:25:43 +0000 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u8D8PBU1012635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <lng-odp@lists.linaro.org>; Tue, 13 Sep 2016 11:25:11 +0300 Received: from 10.144.19.15 ([10.144.104.92]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u8D8PBXk012632 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for <lng-odp@lists.linaro.org>; Tue, 13 Sep 2016 11:25:11 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo <matias.elo@nokia.com> To: <lng-odp@lists.linaro.org> Date: Tue, 13 Sep 2016 11:25:10 +0300 Message-ID: <1473755111-26746-1-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.240; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(450100001)(36756003)(2906002)(11100500001)(586003)(50226002)(8936002)(97736004)(189998001)(110136003)(7846002)(68736007)(48376002)(92566002)(16796002)(356003)(305945005)(33646002)(19580395003)(19580405001)(87936001)(106466001)(77096005)(2351001)(81166006)(8676002)(626004)(5660300001)(81156014)(229853001)(5003940100001)(47776003)(50986999)(50466002)(107886002)(15650500001)(32563001)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB2000; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD053; 1:93aNVEqPBKBFl+Ivzu3FHYZYlFFccl7af84pyDA8dhFSWkzdcrL34Vn4IXN3mPGN5TarQjDPwLMt2XMjHvxuOj0wVfbYdCxk+4MQti2L2ktAzUKVB4I4FzWk46KiEgiywPU4W35MAzN6wJPdX0gKVhH80SCNdOeR0YvJLdYzCh1dxdUBbNpaf2Ewl7gw7HE42SCA7ISv0QlHeBr3v+vNTxkq7oxiy17H/ZkCXN0QcOt6e+H3U0CgvRzf69c5fzme3V914t2l9Wng0DhAxvYovRbYnrRlF9Tt64Yih5OBQwN2PYMIT9VYL8yZuw1V5uElSdKpVAAjW4w/M4LUIQ19XEUK6K85q75dRYO4oE1xMU1nf7dJPkBbi1j05EyPAmHmdlABxBJPafPdQ1zJ4zVb5vVrT2bXVSAA9W2weWX83fTKQvnJerpXUTBSLrgxoWKyWNSQp2HYtlluNiuxDtVb75jnzXngR7pNdfJCw1FuQyw= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c48c6032-43d0-4501-2291-08d3dbaf8de3 X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2000; 2:zVO8KpL3cQLX56zU6+kfjoaPu6kiak63duq7f+oIUn7nTEHes8wE3SppkbCadtzVnJvEvFHQP0sDrXTRXQKTkCaz1o8giVc4aoeH1AxKm8FYyOjeHRPKt6alcG/1DyifuTdtvdoic4JlUAA4trnaOqhRMsrpatFSnj1oNWGXlwvfISoxbeL65bQaKXv8368U; 3:+fLlpR15s8YgJa/IFImL0T0C6GQUMaSToE2eYn4N1ZunF5Oa2FNKigKeNPffr77wArmpPmFh6ZMQM0PqM1Oo8bFXJi4P/r3Ul58xXWsITzMVdykacPt0HEylTpj3Tcsif/xVjRe+MRJRejO+fo9ae7XyyneLLoa6K4Ms6AUmciQsRptXf6GiBZWFm7GBySxttrNWgokwxsNX5oSCCidxkL+1fkrkFsOGsaAGE78FQNKDAtB4k/LODOXQso1vrpSAGA6SVqu6n4cajaaicSHIJw== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:VI1PR0701MB2000; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2000; 25:XRQXQSTK8LmLKtk/Hd8M0Ejlr9VEBJ2PQ0YlB2XRapJBW7naPUtSeNvNQ56EAVC+lm0DANj1ukwRisP741nzfVQhWtAAamQaryMMQ9C84567eV1+om0uq54YywPMTOw0TjWKyeZFQtdAkvWC5PFEeLwCJZDniR0fCDbMdmni4Di+szpIo7haPXa4RPjkqLJXRIHMhWspQE+U60lXsqXE6ZW9CIabIQzcXPaVlhoUsuSSTiApzDn3W1ihVRM2375Js+GQjaHb0y4tbnrA/IAhk7K4cFA8xEO0VFWTtExego0Mnf/Ndw26EHr0yMf7l6XaPjdZDwjtLU5XVSYJM/GDdKm2xOm81NHPobXiNKppe4sCu4A9kg4Ivx6hgBeDJ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95ud3Fx1NBgYNli5raSpqUIai9SIlP3SSr0GqjF79Jwo1+O7h8Do6X426ZTSRH/L41oPt88+OxHemYHiolFu3A4lirzEg6ZilXVXQD4x7vk0j65WgqKIw7ZuUKvHuxvzD+3lBWvrjJ3TsP++37snYqWJezLqL8AeJrRDYRf/jDEwoYpEXJwYNWTzG8ib4Fm3IwA= X-Microsoft-Antispam-PRVS: <VI1PR0701MB2000F63F5DBE4C0CF679903387FE0@VI1PR0701MB2000.eurprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:VI1PR0701MB2000; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0701MB2000; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB2000; 4:RacOKWT+Xle3o8hstsO6QlrceaQr3BEoGZm0GD72U+QYiLIm/XQ5ivJd9rfeehtID/w4aYW14OQJv7/U+ZsdPH2W8/s2N3vCqeJkr85kWU79wLPiIaw41osSohXm6IzmVFv4V4edvalbXY1zTJiZ4H18lSWl+8ZOtBcJMJOrtsW8qKpnpmNiYl1AcJRRHIYHtIxmc2ECj/Emw9IoMEfQCO2/L3nkBZzfaqGvvDqrP5DvgpaPeoRSx2tYuYOki2jwOXafLYABuXs2iflqD2C4hF6RNo1Rj/vijF6l1ho3pl/ITssYcTdIbd7H1ekUNm86m+wCohFvb75uP6KI1n5adwJODdjw0PjOI1AYgf5qTQI1t87mu6rIsflvrzWnBQNwOsLXoLreDxr6FHmth5TWXtCN6huacjyDlYy2v3P8CKSwxyGRsysKx9JVXkIA3gobtR3FhGjUgUk8k6Y3SsJEi4OixFH80h4Vuf4Y4idxnuI= X-Forefront-PRVS: 0064B3273C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0701MB2000; 23:Blr8i7rqCS7otX5Y0WYi957qWxfhP6U/D2HTykC?= =?us-ascii?Q?PkKUFx9kStADT/qNP+yRk5cCEEVsXQ7p9YTbNXx32suaVBg7aaUi/n7bUUE1?= =?us-ascii?Q?fsWGGRinElE/2LKAsUVx/vRxTcyQlsTpDI4qX+M7ht382GhcMs80pamuG8A4?= =?us-ascii?Q?f6Sc8yyQlPpI4Pv37xamK05E0QPBJGjS7b7KIIficFLXaa1uUfL9eiWxooaf?= =?us-ascii?Q?ENODST63I7mK3/keIm+2vysKAtPy56OpR25tyMWTB3DCsqFxpb70k8vPUwX/?= =?us-ascii?Q?cGn97SMnAJgxkwt847P65hUmX0JAX+byNCPMDbCIHzRWxgoOWvHIupQh+lFm?= =?us-ascii?Q?zXp64CUAi/0EAoxTrvJBsIEXllyg94sGLV/PYCWeiWs/k6WQ1zSxOyOGZ0jr?= =?us-ascii?Q?JjNUDisr7udfkUc1LpJzw9qSNi4uxB7fqDavRjlxijABuSYl4jLvAa8yO03z?= =?us-ascii?Q?O9ySfp4wC8zLjuC13JYbqYLW4Pe5o4+Tu/00iogmlN4qyREVpeYTolDgvnOm?= =?us-ascii?Q?n2/4cFPlN3+LNjIBvvr0Zl+wfSBt0xq2Paa+JNFle++SFm+HgZkCWzZThHHz?= =?us-ascii?Q?b1xWQd0+0Kt0HG3vYdT69tj1c6CvF1U+tKfZ316dpfey7DyqEWy9TW1HGI/v?= =?us-ascii?Q?WeNr+XDIRcumFcsTOuNFbVpg6mpI4y7a07UuNMQy27yRI1PTQxwWEPJgSelq?= =?us-ascii?Q?131lQ5VXDAl+87z4ozJnssJeTHA90RVZRP85rcTTinZGTWxuBKc7TDrZE1ta?= =?us-ascii?Q?OIRyw/xCRNPLmfgZKZKqzxSBE8zBJZSC47X5rB1DU3oP0b8D3e1tqVLRW1DA?= =?us-ascii?Q?uGtlNPOgzEiw/yVjsoWmGBq8V2Vh9aBTgPtTmIFrykdW0WOSykQd3EuNYc1M?= =?us-ascii?Q?BPin9QzVnvm6R+DsI++67sza0m3gJH4H7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c/GFCDbV9Gx8/CdEhf/q6+9F88pCQ9HLKUwpjout/o+h1118QFschit4MQscNjqXYFDcuTnJdrzbjLU1C6nIpxpmpwnK08CoY6zj6MMdS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2016 08:25:43.3732 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240]; Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB2000 X-Topics: patch Subject: [lng-odp] [PATCH 1/2] example: l3fwd: optimize ip checksum update X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" <lng-odp.lists.linaro.org> List-Unsubscribe: <https://lists.linaro.org/mailman/options/lng-odp>, <mailto:lng-odp-request@lists.linaro.org?subject=unsubscribe> List-Archive: <http://lists.linaro.org/pipermail/lng-odp/> List-Post: <mailto:lng-odp@lists.linaro.org> List-Help: <mailto:lng-odp-request@lists.linaro.org?subject=help> List-Subscribe: <https://lists.linaro.org/mailman/listinfo/lng-odp>, <mailto:lng-odp-request@lists.linaro.org?subject=subscribe> Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" <lng-odp-bounces@lists.linaro.org> |
diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index 44778b0..95c3d85 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -158,6 +158,22 @@ static void setup_fwd_db(void) } } +/** + * Decrement TTL and incrementally update checksum + * + * @param ip IPv4 header + */ +static inline void ipv4_dec_ttl_csum_update(odph_ipv4hdr_t *ip) +{ + uint16_t a = ~odp_cpu_to_be_16(1 << 8); + + ip->ttl--; + if (ip->chksum >= a) + ip->chksum -= a; + else + ip->chksum += odp_cpu_to_be_16(1 << 8); +} + static int l3fwd_pkt_hash(odp_packet_t pkt, int sif) { fwd_db_entry_t *entry; @@ -186,8 +202,7 @@ static int l3fwd_pkt_hash(odp_packet_t pkt, int sif) key.dst_port = 0; } entry = find_fwd_db_entry(&key); - ip->ttl--; - ip->chksum = odph_ipv4_csum_update(pkt); + ipv4_dec_ttl_csum_update(ip); eth = odp_packet_l2_ptr(pkt, NULL); if (entry) { eth->src = entry->src_mac; @@ -211,8 +226,7 @@ static int l3fwd_pkt_lpm(odp_packet_t pkt, int sif) int ret; ip = odp_packet_l3_ptr(pkt, &len); - ip->ttl--; - ip->chksum = odph_ipv4_csum_update(pkt); + ipv4_dec_ttl_csum_update(ip); eth = odp_packet_l2_ptr(pkt, NULL); /* network byte order maybe different from host */
When decrementing TTL the IPv4 checksum can be incrementally updated. Signed-off-by: Matias Elo <matias.elo@nokia.com> --- example/l3fwd/odp_l3fwd.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) -- 2.7.4