From patchwork Wed Feb 21 17:59:59 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: 129121 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp898289ljc; Wed, 21 Feb 2018 10:04:29 -0800 (PST) X-Google-Smtp-Source: AH8x227DgxKaxhRzv8JCml4CmeaU4KyPl72F0JRkw+D5kHTg86ZN2ELgwdttExq0abaJgU8Gu87h X-Received: by 10.237.58.168 with SMTP id o37mr6925362qte.334.1519236269725; Wed, 21 Feb 2018 10:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236269; cv=none; d=google.com; s=arc-20160816; b=tB1xKBOM72clewnfAFaYgS1vmoS3BtZAUKwrqfv6SnqWGy0s7Y+kU1XBYVFLE5rnc1 UgLgg2V4G1+JWKlRl3xWbM29BrsbTuIN1xkfFTjLjYWDngW8Jh8YBPDVN4NbEjj6NeXC l5OjJrSfHNny5CrYHRMm0ckzJ4i85f2KaU4RfNjb0J4YW2G3q3OIbHbOcj8orK0b7YyR aotHPnXipBtD77MSzs/tx4RgmfXpgl2bwtnn5dLJk5JBAu/wDwpbFDqw/4qjvjsvDYUL wNYahHbX1YmIodG4kBvgixjV1jtuozGZ6CKCVuKUY0LClMLHExvh8t8dODCnC5/YCbwF 1kdw== 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=DQybxRurfULcS4m0Z+EkdCh8L4bQ1c8Fuos6jnnyvWQ=; b=FUkDHHqqcyC2cS22L+7nwuQ2btWoy6AGdeLNH9hsxzIyHqD6hvaq15gHJgVGGdaIdn 6/ucsoFqtGxdPN8LKKei21IH5HYbKNTDj78VlWgg2WBqrXdP4cN/DkQL26e3ANLiW6Ih zj6VzEtMDQ8rL/IwIWI7ftjJz60obXE/ZHgc7FSoGPq6ODQkvaXE8hPhUZ7gJ4584aEd 8PkKBfytYXKP94e0nvVg6bchls8AuMe7TRoobAE5aVRdDzVj1swC+vlcu4lVTftT/ZBd NOewToS6el94v+pon8/xYbKNwCl9eVdXtue7hywr2HbX+iwFD69v9dxsnc2LUkPvtFH5 jt9w== 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 n6si212559qtk.85.2018.02.21.10.04.27; Wed, 21 Feb 2018 10:04:29 -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 6B9A06180E; Wed, 21 Feb 2018 18:04: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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW 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 B31EE617B9; Wed, 21 Feb 2018 18:01:51 +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 3EE5D6107F; Wed, 21 Feb 2018 18:01:37 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 0B39B6175B for ; Wed, 21 Feb 2018 18:01:14 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 5A6F678258A for ; Wed, 21 Feb 2018 21:01:12 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rtlEqx74LV-1CMmhQjK; Wed, 21 Feb 2018 21:01:12 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-159uVWil; Wed, 21 Feb 2018 21:01:05 +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: Wed, 21 Feb 2018 20:59:59 +0300 Message-Id: <1519236011-14987-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 3/15] linux-gen; packet: allow offsets to be set after packet end 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: Dmitry Eremin-Solenikov Allow special case of setting offset just after packet end, as it simplifies handling of packets. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_packet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 6fc5f2206..187580085 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1286,7 +1286,7 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - if (offset >= pkt_hdr->frame_len) + if (offset > pkt_hdr->frame_len) return -1; packet_hdr_has_l2_set(pkt_hdr, 1); @@ -1298,7 +1298,7 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - if (offset >= pkt_hdr->frame_len) + if (offset > pkt_hdr->frame_len) return -1; pkt_hdr->p.l3_offset = offset; @@ -1309,7 +1309,7 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - if (offset >= pkt_hdr->frame_len) + if (offset > pkt_hdr->frame_len) return -1; pkt_hdr->p.l4_offset = offset;