From patchwork Wed Dec 17 16:12:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 42384 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A1D2B26C76 for ; Wed, 17 Dec 2014 16:13:56 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gd6sf10298825lab.0 for ; Wed, 17 Dec 2014 08:13:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=1+G+XpJ6bfr8y/PrBbq9yiVSsoYNOO2VdqVi6UQQv7I=; b=LLgx/Yd0ALGV0bVFiHgsmNn5vTkDR6q5799Y+GlksH6Dxd7YuV2xXPIMfj5Zh3L+yR u5KPqqBrQnWczKvpULrUnvS6HgLxy60yMdl/PvK7TmewIUjftHF/qWxv27GRCSj3kci6 MTVai7amxlZfVS65XNJfNhu/esoouKU+pydM88kytg3oldy+RY8pIiPn/UEKU0i4zkoB YcTEL8ly9wWx1PjdCNP38eb87f6qcLWrR92ZriHICHnp/6AC/UKUrWSg5LHARg5xk5TL sSpIogxueD+K5exDaSJWcdDWXumYB128ekp+6jpoopZrKu7KuxwTMbu2B+efrjKAtviT J0/A== X-Gm-Message-State: ALoCoQlU2HD3cn0NcrD6cZzE6WvRYk69QU6JJQXJbml6CQ5QJEe8bf49mRBKpt1o6FS13fbjlRlg X-Received: by 10.112.166.102 with SMTP id zf6mr436072lbb.12.1418832835624; Wed, 17 Dec 2014 08:13:55 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.133 with SMTP id o5ls431529lal.78.gmail; Wed, 17 Dec 2014 08:13:55 -0800 (PST) X-Received: by 10.152.19.7 with SMTP id a7mr29828416lae.16.1418832835276; Wed, 17 Dec 2014 08:13:55 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id wm7si4230635lbb.136.2014.12.17.08.13.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 08:13:55 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so13346470lab.27 for ; Wed, 17 Dec 2014 08:13:55 -0800 (PST) X-Received: by 10.112.98.99 with SMTP id eh3mr6410115lbb.32.1418832835145; Wed, 17 Dec 2014 08:13:55 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1412336lbb; Wed, 17 Dec 2014 08:13:54 -0800 (PST) X-Received: by 10.170.93.132 with SMTP id k126mr35236801yka.106.1418832833745; Wed, 17 Dec 2014 08:13:53 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 95si5011784qgk.104.2014.12.17.08.13.49 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Dec 2014 08:13:53 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1HEQ-0007hP-Uv; Wed, 17 Dec 2014 16:13:46 +0000 Received: from mail-qg0-f44.google.com ([209.85.192.44]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1HEK-0007fM-0Q for lng-odp@lists.linaro.org; Wed, 17 Dec 2014 16:13:40 +0000 Received: by mail-qg0-f44.google.com with SMTP id q107so9911050qgd.17 for ; Wed, 17 Dec 2014 08:13:34 -0800 (PST) X-Received: by 10.140.18.103 with SMTP id 94mr36202866qge.44.1418832814700; Wed, 17 Dec 2014 08:13:34 -0800 (PST) Received: from localhost.localdomain (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id a9sm4253420qgf.7.2014.12.17.08.13.32 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 08:13:33 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 17 Dec 2014 18:12:44 +0200 Message-Id: <1418832764-24662-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.0 X-Topics: patch Subject: [lng-odp] [PATCH v2] api: packet: Return values of L2 etc pointers and offsets X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: petri.savolainen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Improve documentation: Application can check L2/3/4 validity with odp_packet_has_l2/3/4() calls or by comparing against NULL/ODP_PACKET_OFFSET_INVALID. Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_packet.h | 30 +++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 97c2cb6..8a1d917 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -451,9 +451,10 @@ void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx); * @param[out] len Number of data bytes remaining in the segment (output). * Ignored when NULL. * - * @return Layer 2 start pointer, or offset 0 by default + * @return Layer 2 start pointer, or NULL when packet does not contain a valid + * L2 header. * - * @see odp_packet_l2_offset(), odp_packet_l2_offset_set() + * @see odp_packet_l2_offset(), odp_packet_l2_offset_set(), odp_packet_has_l2() */ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len); @@ -468,7 +469,10 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len); * * @param pkt Packet handle * - * @return Layer 2 start offset + * @return Layer 2 start offset, or ODP_PACKET_OFFSET_INVALID when packet does + * not contain a valid L2 header. + * + * @see odp_packet_l2_offset_set(), odp_packet_has_l2() */ uint32_t odp_packet_l2_offset(odp_packet_t pkt); @@ -497,9 +501,10 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset); * @param[out] len Number of data bytes remaining in the segment (output). * Ignored when NULL. * - * @return Layer 3 start pointer, or NULL + * @return Layer 3 start pointer, or NULL when packet does not contain a valid + * L3 header. * - * @see odp_packet_l3_offset(), odp_packet_l3_offset_set() + * @see odp_packet_l3_offset(), odp_packet_l3_offset_set(), odp_packet_has_l3() */ void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len); @@ -514,7 +519,10 @@ void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len); * * @param pkt Packet handle * - * @return Layer 3 start offset or ODP_PACKET_OFFSET_INVALID if not found + * @return Layer 3 start offset, or ODP_PACKET_OFFSET_INVALID when packet does + * not contain a valid L3 header. + * + * @see odp_packet_l3_offset_set(), odp_packet_has_l3() */ uint32_t odp_packet_l3_offset(odp_packet_t pkt); @@ -543,9 +551,10 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset); * @param[out] len Number of data bytes remaining in the segment (output). * Ignored when NULL. * - * @return Layer 4 start pointer, or NULL + * @return Layer 4 start pointer, or NULL when packet does not contain a valid + * L4 header. * - * @see odp_packet_l4_offset(), odp_packet_l4_offset_set() + * @see odp_packet_l4_offset(), odp_packet_l4_offset_set(), odp_packet_has_l4() */ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len); @@ -560,7 +569,10 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len); * * @param pkt Packet handle * - * @return Layer 4 start offset or ODP_PACKET_OFFSET_INVALID if not found + * @return Layer 4 start offset, or ODP_PACKET_OFFSET_INVALID when packet does + * not contain a valid L4 header. + * + * @see odp_packet_l4_offset_set(), odp_packet_has_l4() */ uint32_t odp_packet_l4_offset(odp_packet_t pkt);