From patchwork Thu Feb 8 15:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 127672 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1569098ljc; Thu, 8 Feb 2018 07:02:47 -0800 (PST) X-Google-Smtp-Source: AH8x227YdKnk1fp+m0I0phPXgpA/PhIZgQL2vRIM8M+2VPBM5arUCwRuPHr7+9PzUtvMkOIJvCZ0 X-Received: by 10.200.8.15 with SMTP id u15mr1583064qth.315.1518102166847; Thu, 08 Feb 2018 07:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518102166; cv=none; d=google.com; s=arc-20160816; b=a/B4TOd3Dj45O/NEinlBvruPLYTsiQS8N1PM7V3HpdqOkhdFGVwPsbE4TN8GUFe6nM aAwZE63paNOE7W3vLg7BV5lkG1xoTV4wLTB2CmUp75bZEtL7m/fHV0r/ZRq0gf4QI9XL 8gbZMYfv4zdiUAySL9y9sKkbXGqrlT5udA3fHDu58eCF38X0m445LV7eZiZVOi0/OD7r Rv2bavaq55DvfJ6d3rHrKrLjf9Ui3JKAq0wcRq+YQTrcyLh4I5lskcTG8Lqlud3zIJbE LImWOpvM47qowPNLTAGfAeRv1+T/+0UNqtM0oo3q7MdUWrsbXIAz/hRkx3ozIHn79dyn gqGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Wco3Xg2hbNTcJX2+KuNYjqYFKFaOdXRQWIFFtO1IfyM=; b=R9VPCNKJDaxIoNZPbthJMAYMSurGC8CwhbGfpgkf6GvM7KqArvNcueF5Tu4EOJWNAw UWgPMWdPnrUsYt3YG6/Fo4ihWRP7TzgXhOWGxdauaVB07/Kxh1YJX+brGOqIe/5ktThC xc8eU7KP2Nc4F3bCLZEe15DIAcr4J2U4NR4ebX8J36/IU4PvEMwzR52yATgsj+4a9fbt LPHc3agIomq5QV0hv+f7y1JqPq3cYN4+ygFIORPFWqcE91fE3pFvIlnzYTJ1vRWP6WF/ HrXNr7If2lQgqAdrmEFh6g3N2Ir9W4L4fC+r6dpO+DB6b6yEuYcXkBQqBZVpxva4e9jd dEXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id y12si94693qkl.428.2018.02.08.07.02.38; Thu, 08 Feb 2018 07:02:46 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 676E0617ED; Thu, 8 Feb 2018 15:02:38 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 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 739AF61761; Thu, 8 Feb 2018 15:00:57 +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 16234608C3; Thu, 8 Feb 2018 15:00:40 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id E4E69617F5 for ; Thu, 8 Feb 2018 15:00:14 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 248E85D85CCA for ; Thu, 8 Feb 2018 18:00:13 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hhkloRyYwT-0CjWALjO; Thu, 08 Feb 2018 18:00:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id gewqgjGlTb-0CnekRBx; Thu, 08 Feb 2018 18:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 8 Feb 2018 18:00:08 +0300 Message-Id: <1518102010-6353-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518102010-6353-1-git-send-email-odpbot@yandex.ru> References: <1518102010-6353-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 461 Subject: [lng-odp] [PATCH v1 2/4] linux-gen: packet: optimize tcp parse X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Signed-off-by: Petri Savolainen --- /** Email created from pull request 461 (psavol:master-parse-optim) ** https://github.com/Linaro/odp/pull/461 ** Patch: https://github.com/Linaro/odp/pull/461.patch ** Base sha: 257b08b35ceea41bad5a7f1c626496cf111e657a ** Merge commit sha: e004cabc6971bf41b8674db708fd8eaa543f7dae **/ .../include/odp/api/plat/packet_inline_types.h | 1 - platform/linux-generic/odp_packet.c | 14 +++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 47ec821c9..984783d5d 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -101,7 +101,6 @@ typedef union { payload */ uint64_t udp:1; /**< UDP */ uint64_t tcp:1; /**< TCP */ - uint64_t tcpopt:1; /**< TCP options present */ uint64_t sctp:1; /**< SCTP */ uint64_t icmp:1; /**< ICMP */ diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 92a64801f..480cea194 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2091,19 +2091,15 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, /** * Parser helper function for TCP */ -static inline void parse_tcp(packet_parser_t *prs, - const uint8_t **parseptr, uint32_t *offset) +static inline void parse_tcp(packet_parser_t *prs, const uint8_t **parseptr) { const _odp_tcphdr_t *tcp = (const _odp_tcphdr_t *)*parseptr; + uint32_t len = tcp->hl * 4; - if (tcp->hl < sizeof(_odp_tcphdr_t) / sizeof(uint32_t)) + if (odp_unlikely(tcp->hl < sizeof(_odp_tcphdr_t) / sizeof(uint32_t))) prs->error_flags.tcp_err = 1; - else if ((uint32_t)tcp->hl * 4 > sizeof(_odp_tcphdr_t)) - prs->input_flags.tcpopt = 1; - if (offset) - *offset += (uint32_t)tcp->hl * 4; - *parseptr += (uint32_t)tcp->hl * 4; + *parseptr += len; } /** @@ -2195,7 +2191,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, if (odp_unlikely(offset + _ODP_TCPHDR_LEN > seg_len)) return -1; prs->input_flags.tcp = 1; - parse_tcp(prs, &parseptr, NULL); + parse_tcp(prs, &parseptr); break; case _ODP_IPPROTO_UDP: