From patchwork Thu Dec 18 13:38:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 42452 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 63E5926C6B for ; Thu, 18 Dec 2014 13:39:22 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf879943eek.7 for ; Thu, 18 Dec 2014 05:39:21 -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=hBIYhr+L9hNQ+eM7CSDIx0THFGoRiJf+pYGCp5gNumg=; b=BzNkE4if/ZOwVFXCmF8NvZDgI7XifS7nmnjYRhbFbLzC/FlrwEjwdPItPbAnKF/Z+s Ij9/YAVozFgFKVhT85doQC1wMCH5cNOZQEkgGdffT9ItLZNGXs8P/NHzWgwUB1ze83Qb HctUbi6atji5//ZmugccGn9KoBmf2DmF2QxL36bogl6xo/flkwgGVWbTPZIlL/hU+w0w OsD+9eP4tA4kygCdtfcn5mp9Fey0t4Fp5UtBptdFExWVM1eVWQ+m5ly4DLdoiorSv3C+ 3gkeRafyBg6ozWLrwJHu3eqdXdQScMyDgBvGWMTVMLvBPJB22ae7we1P5hcEYXLu7y1c k7qQ== X-Gm-Message-State: ALoCoQkQtznn0skN7LbLRRFhJK5hnfewlLsa3idm1LcU+k3RLK0hc+vEA5MfjIafVJaxz9xk+HC5 X-Received: by 10.194.178.163 with SMTP id cz3mr344528wjc.1.1418909961422; Thu, 18 Dec 2014 05:39:21 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.202 with SMTP id e10ls1091946lae.86.gmail; Thu, 18 Dec 2014 05:39:21 -0800 (PST) X-Received: by 10.112.17.102 with SMTP id n6mr2242456lbd.39.1418909961144; Thu, 18 Dec 2014 05:39:21 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id q7si6880377lah.99.2014.12.18.05.39.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 05:39:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so955358lbv.21 for ; Thu, 18 Dec 2014 05:39:21 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr2272607lbc.23.1418909960981; Thu, 18 Dec 2014 05:39:20 -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 ru5csp1708603lbb; Thu, 18 Dec 2014 05:39:20 -0800 (PST) X-Received: by 10.140.17.203 with SMTP id 69mr3450490qgd.32.1418909959205; Thu, 18 Dec 2014 05:39:19 -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 t4si8248167qcq.0.2014.12.18.05.39.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 05:39:19 -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 1Y1bIS-0004TT-G6; Thu, 18 Dec 2014 13:39:16 +0000 Received: from mail-oi0-f50.google.com ([209.85.218.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y1bIL-0004RN-MV for lng-odp@lists.linaro.org; Thu, 18 Dec 2014 13:39:09 +0000 Received: by mail-oi0-f50.google.com with SMTP id x69so377619oia.23 for ; Thu, 18 Dec 2014 05:39:04 -0800 (PST) X-Received: by 10.202.44.16 with SMTP id s16mr1246821ois.98.1418909944282; Thu, 18 Dec 2014 05:39:04 -0800 (PST) Received: from localhost.localdomain (cpe-24-28-70-239.austin.res.rr.com. [24.28.70.239]) by mx.google.com with ESMTPSA id z205sm3179538oie.14.2014.12.18.05.39.03 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 05:39:03 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Thu, 18 Dec 2014 07:38:55 -0600 Message-Id: <1418909935-4935-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCH] linux-generic: packet: add ODP_PACKET_OFFSET_INVALID 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: bill.fischofer@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.217.176 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 Signed-off-by: Bill Fischofer --- platform/linux-generic/include/api/odp_platform_types.h | 3 +++ platform/linux-generic/include/odp_packet_internal.h | 6 ++++++ platform/linux-generic/odp_packet.c | 10 ++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/include/api/odp_platform_types.h b/platform/linux-generic/include/api/odp_platform_types.h index 2cfba87..8671b42 100644 --- a/platform/linux-generic/include/api/odp_platform_types.h +++ b/platform/linux-generic/include/api/odp_platform_types.h @@ -47,6 +47,9 @@ typedef odp_buffer_t odp_packet_t; /** Invalid packet */ #define ODP_PACKET_INVALID ODP_BUFFER_INVALID +/** Invalid packet offset */ +#define ODP_PACKET_OFFSET_INVALID (0x0fffffff) + /** ODP packet segment */ typedef odp_buffer_t odp_packet_seg_t; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index a0eff30..a36d1b6 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -169,6 +169,12 @@ static inline void packet_init(pool_entry_t *pool, len = sizeof(odp_packet_hdr_t) - start_offset; memset(start, 0, len); + /* Set metadata items that initialize to non-zero values */ + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->payload_offset = ODP_PACKET_OFFSET_INVALID; + /* * Packet headroom is set from the pool's headroom * Packet tailroom is rounded up to fill the last diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 0ab9866..65e6288 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -776,10 +776,10 @@ int _odp_packet_parse(odp_packet_t pkt) pkt_hdr->error_flags.all = 0; pkt_hdr->input_flags.all = 0; pkt_hdr->output_flags.all = 0; - pkt_hdr->l2_offset = 0; - pkt_hdr->l3_offset = 0; - pkt_hdr->l4_offset = 0; - pkt_hdr->payload_offset = 0; + pkt_hdr->l2_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; + pkt_hdr->payload_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->vlan_s_tag = 0; pkt_hdr->vlan_c_tag = 0; pkt_hdr->l3_protocol = 0; @@ -861,6 +861,7 @@ int _odp_packet_parse(odp_packet_t pkt) default: pkt_hdr->input_flags.l3 = 0; + pkt_hdr->l3_offset = ODP_PACKET_OFFSET_INVALID; ip_proto = 255; /* Reserved invalid by IANA */ } @@ -892,6 +893,7 @@ int _odp_packet_parse(odp_packet_t pkt) default: pkt_hdr->input_flags.l4 = 0; + pkt_hdr->l4_offset = ODP_PACKET_OFFSET_INVALID; break; }