Message ID | 1474010009-7435-2-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 d66csp347128qgf; Fri, 16 Sep 2016 00:15:12 -0700 (PDT) X-Received: by 10.55.15.18 with SMTP id z18mr14385132qkg.131.1474010112699; Fri, 16 Sep 2016 00:15:12 -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 16si2309274qkd.160.2016.09.16.00.15.12; Fri, 16 Sep 2016 00:15:12 -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 55F0E60C9B; Fri, 16 Sep 2016 07:15:12 +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_H3, RCVD_IN_MSPIKE_WL, 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 A54E560CFC; Fri, 16 Sep 2016 07:14:38 +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 7F4D760C8E; Fri, 16 Sep 2016 07:14:28 +0000 (UTC) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20115.outbound.protection.outlook.com [40.107.2.115]) by lists.linaro.org (Postfix) with ESMTPS id 7C52A60C9B for <lng-odp@lists.linaro.org>; Fri, 16 Sep 2016 07:13:56 +0000 (UTC) Received: from HE1PR0701CA0030.eurprd07.prod.outlook.com (10.165.214.168) by VI1PR07MB1085.eurprd07.prod.outlook.com (10.163.168.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.609.9; Fri, 16 Sep 2016 07:13:54 +0000 Received: from AM1FFO11FD053.protection.gbl (2a01:111:f400:7e00::106) by HE1PR0701CA0030.outlook.office365.com (2603:10a6:3:5::40) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.8 via Frontend Transport; Fri, 16 Sep 2016 07:13:54 +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 AM1FFO11FD053.mail.protection.outlook.com (10.174.65.72) 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; Fri, 16 Sep 2016 07:13:53 +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 u8G7DXlH017479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <lng-odp@lists.linaro.org>; Fri, 16 Sep 2016 10:13:33 +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 u8G7DXpn017473 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for <lng-odp@lists.linaro.org>; Fri, 16 Sep 2016 10:13:33 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo <matias.elo@nokia.com> To: <lng-odp@lists.linaro.org> Date: Fri, 16 Sep 2016 10:13:26 +0300 Message-ID: <1474010009-7435-2-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474010009-7435-1-git-send-email-matias.elo@nokia.com> References: <1474010009-7435-1-git-send-email-matias.elo@nokia.com> 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)(199003)(189002)(5003940100001)(106466001)(586003)(2351001)(92566002)(50466002)(48376002)(33646002)(19580405001)(229853001)(19580395003)(81156014)(356003)(81166006)(77096005)(107886002)(68736007)(2950100001)(36756003)(87936001)(11100500001)(50986999)(450100001)(5660300001)(305945005)(2906002)(8936002)(16796002)(7846002)(189998001)(50226002)(97736004)(76176999)(110136003)(8676002)(626004)(47776003)(15650500001)(32563001)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR07MB1085; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD053; 1:L1jG40KLCnMUAWQIwyAj8p44vBB/4GyR4yyfhk2LeqWG2Zn1H3an0jU6kCZ5u+9C5S4sGwCel40DbOV7ypPkQV/6XzbgXNrnHjKibZFWOnevQNDqpRZqTJhTyCPHnNtndjzGCE3iTIftrrAuldP1yWwKrzVm+C2t0VvhP2F8d2sZxKHub8dvrH/SPCo3gyIL68TFPMDpegOogmJbsN0g+c+BI9BbHrEBkWChKBy35PO0KJ3lREO/tZCRzG9VUbd3Gs/Og0F/aPr3VXN/u9eCrbID2LyvY/yxmLG2d8iNvUFh+v4rTR/9SOoHebS7zopiH18ujuQyYOuYk2lxB8cUPP5x5cmvdj0Qd7hyERv5f2b7ih2Or9fNIKUGURKdI22/G1/wzJPWiIbLngcFLyyDLX/jWuPep1mr3K/WjFz8wk4E9Y4CoiRBlItPJzsGOvRXu8qirYW5aVW2cjd6+PXAFUuiMkWAr/vJjBqxTYO6NX8= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: acfe82a7-78bd-4f7b-1b2b-08d3de010458 X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1085; 2:6WNqNvNisKn7MlMl4klvYs0R+d8k817SrB1cEtLNC7JBYvr6icq/Fcv7FeiC2PDzXQDpf28i8JrsNK/xDe3qg2hdM7O4KvaqjdGZ/eNh0mAGHlkyT+VNUbGZaH6xZUca1pvnrjkHpr7MjSST/87GyIrrZub/M84NnAd1ppTNt1KdLtcMBQT93dX2kKO7rEp4; 3:W9n8t8iHXrxdU9l4fZZ6D++YN1anCkJKVIRGtF71Y0/DXVc966QcHkWC08pxiphZgijjAZtggEI9BCrG3SGIBKzTAmWnSbO62OcV5Tvye9BkAn49T7t25eJe8f58h/3nOv+IVlJ0d9cUUFobosHfWttDgvlzCgwDJyZJwOjNW//PXA9IdLfCrytfLGVmPLuBCCfbs8g/6LXWcvrRKIg6z0gAOsE7F3qFQmSMn0DO5Z/8eE8w6KsfVALIv6e/YvDCweh8ad8rrRpuL4Wr01EFFA== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:VI1PR07MB1085; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1085; 25:E5EBLyF86gLQa9h5xazAiyaw6J+vh0324wVNJuxJHGefH3EOiysqpizqU4s0uPrsqAZogHpSbD0Y8udPTSW+x8r1WhgWJNesO0ai3rVPYNmUcvAukIqsW5TxlgO5jw3fAVAO7vOJlraiU40bI/oOVK7futNSzb8Gpw7gF65SI7VRrtUi4x1Z0+1g0YxMmBzeaXDjKk8zApP7EOPgqjXNgv45QfKET0FPFTfH8z2lT/1CaEp/H6kYvYrFutvt0VNUQfCT4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6TcTCmHN+Tm2UtMupQxekhxIUqah4JMnL7CtEdDhYA3ZbgEb6/fhTsBWmPYwAk+agCbJnaIGUS9Ok5c0xsfHNYgqC8KJmPAj4H0whIMhsTyC9O4onKbulzOMQYEwoBgXd6tqLqQt4ebZimBuCNWU1xaw72oXxGjhTYtT6+Z0QO0uO8aD3L5QIXk3qHlf/gYmQ3CyDUXTYoG0JJNhX1Rgt9DgKz5UlBINFRh/NOiDtOW+eYO1NP5Wa7EKEtEQWpVis4zl0q7G96mVdxIGUtvieevfS1jzX/QW+g24ozT54HHzW5IVcAuzjnzglQ9YuOps5W506G8HH12a1oT3k= X-Microsoft-Antispam-PRVS: <VI1PR07MB1085C2CCFA95C2A773308D6F87F30@VI1PR07MB1085.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)(8121501046)(5005006)(13016025)(13018025)(3002001)(10201501046)(6055026); SRVR:VI1PR07MB1085; BCL:0; PCL:0; RULEID:; SRVR:VI1PR07MB1085; X-Microsoft-Exchange-Diagnostics: 1; VI1PR07MB1085; 4:mVlVlz5UMgKGEPxROiYO0/59e7lpxEApUNpE1M7LDNxOLgeh8XVs3h3ek1DoYY7nAIKi/U2393XtK2dJt+jkn9AqjJ2pikGLoH9Q2/wRh0kqIBYQstTFdE/oML8V/0FpiuSnJbwOrwMg44G4j/BtqK9tWE1cFqZDy1toIQwGuHweIy4qFuvHEsKU0ZbwbLIHr2LNA9iUrRcmlLAdr98fy540nlCpkwCOrOlOcYaN+WT5OsJqVG1lHRQ8vScDzgdJqxKNL1e8esGOAZzrMi/VAX4p5HFTXn1dMCzgSMAXKHHbSXIsxaR3CvXjn5ptco58979f7vI5jJzLqyK00a5fhXQq45Fx+kraUb8CgYEZw3p0lOxcHrs9wQvWMYHaUr7cmQ9KwiOIFAeuaMfN2gLFjGmbxh3n+6EtXNELcHO99zeU9+TSGhspKVeuRfdbMwZApwEz9q5I5ZtGVcxv5jFM7UFLXsNWZxWejSobhTpKITA= X-Forefront-PRVS: 0067A8BA2A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR07MB1085; 23:9+9u8O5Z/UbBLFaUi2hOPtSXUmmCRxgBu4mnJD7ie?= =?us-ascii?Q?/VUyS5yKfRTiotRDWzz3J6xx9hd1LQj2JHSsl0/DbsA0l1I0CT1GyhaezyRS?= =?us-ascii?Q?dRQIdrn2qyoBe5xiaSF+lmuoccbzWyIasgVDNTgj4gtBMVIOH1WGrEueBSBn?= =?us-ascii?Q?NgOE3vRymmcbVHcHPyXZp1jAiWbdV/BAnMG8rZ4MUQ3nUytneyGrUSWyEzeO?= =?us-ascii?Q?BXODtvLJ6AeHLHK7rKRXCzpNK6iDY8dSnSYJ0bXe2P1yVKy5HAsCv80YapD8?= =?us-ascii?Q?N71a763ZyB2tjyBfveYwLRlop67CcWJ/fU1lq/046b9NOxruOvtcjdgjwLZ3?= =?us-ascii?Q?9Q4sZ3vObUgF3LOJU74Yu914FCOslEYIdXo3lD4rcVSxSFiHvOEOIf/OzHXe?= =?us-ascii?Q?mBhalrW5SLeU1OVpdLfjLKrqSuMdYFHqfYP8tEJKG/OUa8qB+Cx0SBtqFePU?= =?us-ascii?Q?DH/8932us5FUVxdBTwyrtGleiyaDBG5as5AjXlsZALwbdNDbDIsxXHtUM44a?= =?us-ascii?Q?WOXPJJinqwpY0m/TiCHdYIyv05alSJNQq/rcf+Un3Vw+j78flgpxlxp2PGsu?= =?us-ascii?Q?iqFKvVcDP1sRT0Ya4l21mHcCZn/tW91XoFwV0bK5S7nG954ia6JsdEcRFZpB?= =?us-ascii?Q?UtzDAr1K4p5OHkcmgWHtIRvWXdJgfXMWNmkVq2VUEZhINP4k7gJQlJK5E6Ki?= =?us-ascii?Q?LcrE2TnnWg1cBtwX4tz3iWEkqPlFwToXf1eyuCvpo0836oXdyyxbFNi41/mi?= =?us-ascii?Q?TdTXbAboR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VgjtMkzR14W+f1lTjjQoBsr7DsFnsGOsyJpgrLTac+vr1bZfWO/6wBG+m7vZiHRs0ttSGDU=; 7:xMW3bdBFVgNiOWk5dQySxuzD1VvRM5tsXIgPyJXbjYl9cAC8KUbP77ZlvMggI2XNuMk5Es0h6tE2kNUNGJX2hYfWia9NKJeqYj1fHmFstPIao3bU4rjOGU0qiGLEPcaJeLaP4PvUsJTyvGqyO6br5x/i/P/847uFn7G15U1LXX7lnhIx1h6xMPhdHduJUWRZu3cshviklLwu8dRXZw06ZfmrELAePqrqraIZY3ok7e45vnRX1W8lSb5E3z26TCr/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2016 07:13:53.6872 (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: VI1PR07MB1085 X-Topics: patch Subject: [lng-odp] [PATCH v2 2/5] 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