From patchwork Wed Dec 17 13:41:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 42379 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EC14126C8B for ; Wed, 17 Dec 2014 13:41:59 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf6325887wid.7 for ; Wed, 17 Dec 2014 05:41:59 -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=WcnqT9SBayrVmZe4EiZ3rco4qutdGtTnQes7QUws2c8=; b=bVUiFm6OyV1AmoblIacXqWpyB6aEMxBrPn65TN+zvd5WJYgqeWSmPrHqovhoisnh0b qzKgcnQHdylMxxk4c30QxCOZX+1gl8xe92Ppq+rl9T0h7uBp0WcjhkT6/IyStBrT+A2l gv8MgkUxxAaFQ4n7Ug0NZhydhGcXHVaSt/+beeUU7STfQ0fiCKASRm9gPEz+7WcuGWgd Ql+ef648NH9WV+CujrIDM6HnvNs4VojA8rXDLB21qRJz2U92fNuiSwTTGOJMkuvCoAaf suoskPXLElcHsCjzWqA/ks5e9TTWYY+qDKwgYEzaX2dgy+yOuA16qtuX/zBWy4NocoUf 5GCA== X-Gm-Message-State: ALoCoQnpj/syuFfEKNZ9ZLRfiTT0o1n82WUr7sFukILBNSM+o3IfKcWqEKa9tciMQwQHXei7wH1y X-Received: by 10.180.99.227 with SMTP id et3mr1348389wib.3.1418823719073; Wed, 17 Dec 2014 05:41:59 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.37 with SMTP id 5ls1075995laz.81.gmail; Wed, 17 Dec 2014 05:41:58 -0800 (PST) X-Received: by 10.112.136.69 with SMTP id py5mr27227644lbb.56.1418823718808; Wed, 17 Dec 2014 05:41:58 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id oc10si3938436lbb.40.2014.12.17.05.41.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 05:41:58 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gd6so13299205lab.17 for ; Wed, 17 Dec 2014 05:41:58 -0800 (PST) X-Received: by 10.112.159.129 with SMTP id xc1mr41309226lbb.24.1418823718578; Wed, 17 Dec 2014 05:41:58 -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 ru5csp1366701lbb; Wed, 17 Dec 2014 05:41:57 -0800 (PST) X-Received: by 10.140.17.75 with SMTP id 69mr45425517qgc.29.1418823717174; Wed, 17 Dec 2014 05:41:57 -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 b4si4588459qcp.41.2014.12.17.05.41.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Dec 2014 05:41:57 -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 1Y1ErQ-0007l5-Pa; Wed, 17 Dec 2014 13:41:52 +0000 Received: from mail-qg0-f51.google.com ([209.85.192.51]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1ErJ-0007l0-Hs for lng-odp@lists.linaro.org; Wed, 17 Dec 2014 13:41:45 +0000 Received: by mail-qg0-f51.google.com with SMTP id e89so11554169qgf.38 for ; Wed, 17 Dec 2014 05:41:40 -0800 (PST) X-Received: by 10.224.14.133 with SMTP id g5mr12832728qaa.81.1418823700302; Wed, 17 Dec 2014 05:41:40 -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 c75sm3874859qge.20.2014.12.17.05.41.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 05:41:39 -0800 (PST) From: Petri Savolainen To: lng-odp@lists.linaro.org Date: Wed, 17 Dec 2014 15:41:04 +0200 Message-Id: <1418823664-23771-1-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.2.0 X-Topics: patch Subject: [lng-odp] [PATCH] 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.44 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 Application must check L2/L3/L4 pointer and offset validity with corresponding odp_packet_has_l2/l3/l4() call. Signed-off-by: Petri Savolainen --- platform/linux-generic/include/api/odp_packet.h | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index 97c2cb6..de4e9ba 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -445,15 +445,16 @@ void odp_packet_user_u64_set(odp_packet_t pkt, uint64_t ctx); * Layer 2 start pointer * * Returns pointer to the start of the layer 2 header. Optionally, outputs - * number of data bytes in the segment following the pointer. + * number of data bytes in the segment following the pointer. The return value + * is unspecified when odp_packet_has_l2() returns 0. * * @param pkt Packet handle * @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 * - * @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); @@ -461,7 +462,8 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len); * Layer 2 start offset * * Returns offset to the start of the layer 2 header. The offset is calculated - * from the current odp_packet_data() position in bytes. + * from the current odp_packet_data() position in bytes. The return value + * is unspecified when odp_packet_has_l2() returns 0. * * User is responsible to update the offset when modifying the packet data * pointer position. @@ -491,15 +493,16 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset); * Layer 3 start pointer * * Returns pointer to the start of the layer 3 header. Optionally, outputs - * number of data bytes in the segment following the pointer. + * number of data bytes in the segment following the pointer. The return value + * is unspecified when odp_packet_has_l3() returns 0. * * @param pkt Packet handle * @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 * - * @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); @@ -507,14 +510,15 @@ void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len); * Layer 3 start offset * * Returns offset to the start of the layer 3 header. The offset is calculated - * from the current odp_packet_data() position in bytes. + * from the current odp_packet_data() position in bytes. The return value + * is unspecified when odp_packet_has_l3() returns 0. * * User is responsible to update the offset when modifying the packet data * pointer position. * * @param pkt Packet handle * - * @return Layer 3 start offset or ODP_PACKET_OFFSET_INVALID if not found + * @return Layer 3 start offset */ uint32_t odp_packet_l3_offset(odp_packet_t pkt); @@ -537,7 +541,8 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset); * Layer 4 start pointer * * Returns pointer to the start of the layer 4 header. Optionally, outputs - * number of data bytes in the segment following the pointer. + * number of data bytes in the segment following the pointer. The return value + * is unspecified when odp_packet_has_l4() returns 0. * * @param pkt Packet handle * @param[out] len Number of data bytes remaining in the segment (output). @@ -545,7 +550,7 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset); * * @return Layer 4 start pointer, or NULL * - * @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); @@ -553,14 +558,15 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len); * Layer 4 start offset * * Returns offset to the start of the layer 4 header. The offset is calculated - * from the current odp_packet_data() position in bytes. + * from the current odp_packet_data() position in bytes. The return value + * is unspecified when odp_packet_has_l4() returns 0. * * User is responsible to update the offset when modifying the packet data * pointer position. * * @param pkt Packet handle * - * @return Layer 4 start offset or ODP_PACKET_OFFSET_INVALID if not found + * @return Layer 4 start offset */ uint32_t odp_packet_l4_offset(odp_packet_t pkt);