From patchwork Mon Dec 11 12:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 121380 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2703534qgn; Mon, 11 Dec 2017 04:05:50 -0800 (PST) X-Google-Smtp-Source: ACJfBosbaYUgEqrE/PINXl3L8JlPjPqVPAyUaFT+ZNlvUrVX06U/TeOC7BixccQwiuekyZzbtwxG X-Received: by 10.237.57.202 with SMTP id m68mr173642qte.185.1512993950467; Mon, 11 Dec 2017 04:05:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512993950; cv=none; d=google.com; s=arc-20160816; b=RD16CFhJFLYoKeDN92tkiy+2ChlVpvTS9xAbXYc4r2awRXY0OrHF89t20t+TVuoOAP zQjBaTtzyuUQFTC4FcYji6kVoGB+qHzEaQXyriOGliNjQGyp+1o4gIEceubOHH4115EI +Ptu8O5a111OAYVOHttHyzvlU6LL5/8D00xjSXuQ02wHxrskjKmDdunPXLFVj/twOAjq t0wZKEif10Bw3kqPr6jpFqpqWIbnx8FcuNoe7G4IJwtE6F4g1DetAPi3aF3aOONcrp5B ENOwjkbF4qBJ9Q8TH4eEaemuYWVjwEqroEWBoKBe7wUnYW+QK/zhKi8S5VRxSatM1vxe g1kw== 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=GrpW6AKRJhFMq1DNcxQUzsdQgm0ZIxMyBlCpJRpv+qE=; b=bzF4Tpw9uTVbNCBn9w/n2FEop7O5hLWjMqQLA+FgProNzYPbzlODxdYfuAc4B/na0b QmgCXyIAlmAIPj2M1tzOOSD1UGhuRIHLqjRloa3YXR9LBLyuENR0cyvagRzG0M8Gpti7 jrP/Tk1iFGD54Zu4FLSmt0oa5Ip7CQN8MVa3PK5yRs7Um3VnwtKr1hltVQs4sRAdC7oL 2OrNuJoWwEws7jgZSK38N/h1aU7HQGIlkimefaPv9Rxk0+9jyVZXZ9RpoV+oDZ3qCUWI LXLiRTQxrOcdQzpuJ3imD+YwKdI98514hTWmHionCg6GGpsEPn6xZlt/gEE2xy5Pv1V+ g2Yg== 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 z130si4410639qka.432.2017.12.11.04.05.50; Mon, 11 Dec 2017 04:05:50 -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 0C892608FF; Mon, 11 Dec 2017 12:05:50 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 305D960902; Mon, 11 Dec 2017 12:02:13 +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 D0DFC608F2; Mon, 11 Dec 2017 12:01:45 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id AA54360840 for ; Mon, 11 Dec 2017 12:00:16 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 04E334441B76 for ; Mon, 11 Dec 2017 15:00:14 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id FLz0vMaTAS-0DQelPMl; Mon, 11 Dec 2017 15:00:13 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 05zxW8uoau-0DkSMKvE; Mon, 11 Dec 2017 15:00:13 +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: Mon, 11 Dec 2017 15:00:08 +0300 Message-Id: <1512993608-19038-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512993608-19038-1-git-send-email-odpbot@yandex.ru> References: <1512993608-19038-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 332 Subject: [lng-odp] [PATCH API-NEXT v2 5/5] linux-gen: packet: set next layer offsets allways 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 Update implementation to follow API change of layer offsets. Set L3 offset always after successful L2 parse. Set L4 offset always after successful L3 parse. Signed-off-by: Petri Savolainen --- /** Email created from pull request 332 (psavol:next-l4-offset) ** https://github.com/Linaro/odp/pull/332 ** Patch: https://github.com/Linaro/odp/pull/332.patch ** Base sha: 0980001e33b4190133d478a0aa2e718fd1e3c164 ** Merge commit sha: 821e53e2ab0847f73ddb171a65e3e4fc5d28e64f **/ platform/linux-generic/odp_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 55f59178b..14d0ab63e 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2154,11 +2154,12 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, { uint8_t ip_proto; + prs->l3_offset = offset; + if (layer <= ODP_PKTIO_PARSER_LAYER_L2) return prs->error_flags.all != 0; - /* Set l3_offset+flag only for known ethtypes */ - prs->l3_offset = offset; + /* Set l3 flag only for known ethtypes */ prs->input_flags.l3 = 1; /* Parse Layer 3 headers */ @@ -2166,12 +2167,14 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, case _ODP_ETHTYPE_IPV4: prs->input_flags.ipv4 = 1; ip_proto = parse_ipv4(prs, &parseptr, &offset, frame_len); + prs->l4_offset = offset; break; case _ODP_ETHTYPE_IPV6: prs->input_flags.ipv6 = 1; ip_proto = parse_ipv6(prs, &parseptr, &offset, frame_len, seg_len); + prs->l4_offset = offset; break; case _ODP_ETHTYPE_ARP: @@ -2181,15 +2184,13 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, default: prs->input_flags.l3 = 0; - prs->l3_offset = ODP_PACKET_OFFSET_INVALID; ip_proto = 255; /* Reserved invalid by IANA */ } if (layer == ODP_PKTIO_PARSER_LAYER_L3) return prs->error_flags.all != 0; - /* Set l4_offset+flag only for known ip_proto */ - prs->l4_offset = offset; + /* Set l4 flag only for known ip_proto */ prs->input_flags.l4 = 1; /* Parse Layer 4 headers */ @@ -2235,7 +2236,6 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, default: prs->input_flags.l4 = 0; - prs->l4_offset = ODP_PACKET_OFFSET_INVALID; break; }