From patchwork Wed Feb 21 16:59:56 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: 129105 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp839255ljc; Wed, 21 Feb 2018 09:02:41 -0800 (PST) X-Google-Smtp-Source: AH8x2248170wAYN09nKu3/j6U/ks0p21MVpa9NsVppnAbc9+5CYL1xFa3nONCRd1HwtnFa33B+Fj X-Received: by 2002:a25:248c:: with SMTP id k134-v6mr2790974ybk.23.1519232561444; Wed, 21 Feb 2018 09:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232561; cv=none; d=google.com; s=arc-20160816; b=VndUcsPV+9Tvv+CpkVb/5PaWCpekhaZHkZlPis0mO8A6+J4JvQH7e1ROOUJ2MZ1YeA i8R2kpklDS3rXvqKMJlNLfN2fqTug0+hL6NZvCMVReDd16N5oLQtVSJU3PcwZI7waPsO Qj56eiMqcXT/0Tgn43Sa5KaqXVdw+uPdgHfpk7gKOBX+ZnoLrTXpFzG5+DBWVeqQ743h SJWeDBpHgeqA345LSEk9OJrds1KAV7DdQPHDl7cELt+nRpJpujdVK9MSX3ydxQo/50tf hcrHkvWoreznxK+V+mwS2LGChX0MmEAokiPtSimzELCp7e47f0JFyN8qfB6FUeU62cn5 w5vg== 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=+Uze0THQFrHWXBexFx0Ayd8cT0jWwf7ZoEFoV6+VqwQ=; b=N5y1wqFSLji+SLZmXZK8+dFI079Mo4YdAtMlb7gAMoRgTk53/K/1MmtI6aGncYWz4N 4+smVsH9qES28lI/ggWFY4VELYS1IZ6qV644aBbgy9o7hzVE/cGFKc8vZuNQ5+z4JDdO CRmRa9tITh091l7MV/YsG4SmI270y+spTY4N80hmzmUzL/yL2XsHIUP2ovS+bm3Zwjah QpNgZlVOPRewidynjIEMSu0V924iS5nmbJcCYbBKdbiV/CW+RqQwme74RlWqYLg9XdWX RIr2bf8Q6aL5nDa7Lu/rvdbYy5fkjy1ZzPAQASY0A5Vw6nSEDdL3LtAqoY/PgiZ6R5Vy +F0w== 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 s187si436486yws.669.2018.02.21.09.02.36; Wed, 21 Feb 2018 09:02:41 -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 81E236180B; Wed, 21 Feb 2018 17:02:36 +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 21D15603C1; Wed, 21 Feb 2018 17:00:28 +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 3D543617AC; Wed, 21 Feb 2018 17:00:18 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id B89B86179A for ; Wed, 21 Feb 2018 17:00:14 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward100j.mail.yandex.net (Yandex) with ESMTP id B0FDD5D839FE for ; Wed, 21 Feb 2018 20:00:13 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9dwtBqsJRW-0D4W81K7; Wed, 21 Feb 2018 20:00:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0Cuq0fHL; Wed, 21 Feb 2018 20: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: Wed, 21 Feb 2018 19:59:56 +0300 Message-Id: <1519232408-28445-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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;