From patchwork Tue Feb 3 04:44:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 44199 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9F2082034D for ; Tue, 3 Feb 2015 04:46:33 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id y19sf18717451wgg.2 for ; Mon, 02 Feb 2015 20:46:32 -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:in-reply-to :references: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=nKxBohcwbVZan+hUhjTZuor1QJT8/kZXbq05dznznSk=; b=hJzAKQD0D8GCavjGp73xWmiI7AOCh7t7jZcs3NHx6bdhHSsPrfIKmGOnXVVDCh2rNr ntTf1lb53Oo9WMqPMxNTeNQI5RH89s4MZYoZkycIaD4nvxnZPcmoUdOPuNBCuGZNx109 ZfnQaL2urNgvBz/ZNYxIemUzYFnQXHV8T+BrIgwRih04ZkeBEJUG1cwkF4gnFKQa6Off NPQ4iQQaUzgPZ+jSa6HZthXUQV8EgbDwW2REGpYt74F1GlmhyTJwZfO61tFSExJe2dHC L0PhQU6Wkiz4JdfrznHwzpEzG4vVg8xkHEOuoTa+Huv+XGfKxuMjS3Nz6RXLEuDr7yfx QSJw== X-Gm-Message-State: ALoCoQm5ceIcTLI1+VA/yXomVZkeBvsOOcJNA+RRN1XAbhcuj5VCQPNj5cvGqTumzaiW23K3ZBS9 X-Received: by 10.194.178.234 with SMTP id db10mr2803606wjc.2.1422938792975; Mon, 02 Feb 2015 20:46:32 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.162 with SMTP id dd2ls344990lad.81.gmail; Mon, 02 Feb 2015 20:46:32 -0800 (PST) X-Received: by 10.152.22.129 with SMTP id d1mr22879983laf.22.1422938792654; Mon, 02 Feb 2015 20:46:32 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id r14si18424728lal.15.2015.02.02.20.46.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 20:46:32 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so47836866lab.6 for ; Mon, 02 Feb 2015 20:46:32 -0800 (PST) X-Received: by 10.152.8.1 with SMTP id n1mr21867382laa.47.1422938792556; Mon, 02 Feb 2015 20:46:32 -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.35.133 with SMTP id h5csp1712582lbj; Mon, 2 Feb 2015 20:46:31 -0800 (PST) X-Received: by 10.140.106.100 with SMTP id d91mr45782921qgf.18.1422938791365; Mon, 02 Feb 2015 20:46:31 -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 k10si5818044qay.73.2015.02.02.20.46.30 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 20:46:31 -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 1YIVNc-0006CC-H2; Tue, 03 Feb 2015 04:46:28 +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 1YIVMr-00061Z-GO for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 04:45:41 +0000 Received: by mail-oi0-f50.google.com with SMTP id h136so47713188oig.9 for ; Mon, 02 Feb 2015 20:45:36 -0800 (PST) X-Received: by 10.60.130.135 with SMTP id oe7mr14128037oeb.5.1422938736287; Mon, 02 Feb 2015 20:45:36 -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 vs5sm10277537oeb.14.2015.02.02.20.45.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Feb 2015 20:45:35 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Mon, 2 Feb 2015 22:44:56 -0600 Message-Id: <1422938699-12877-17-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422938699-12877-1-git-send-email-bill.fischofer@linaro.org> References: <1422938699-12877-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 16/19] linux-generic: packets: add strong typing support 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.215.47 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 --- .../linux-generic/include/odp/plat/packet_types.h | 24 ++++++++++++++++------ platform/linux-generic/odp_packet.c | 8 ++++---- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/include/odp/plat/packet_types.h b/platform/linux-generic/include/odp/plat/packet_types.h index 60d6443..57e9662 100644 --- a/platform/linux-generic/include/odp/plat/packet_types.h +++ b/platform/linux-generic/include/odp/plat/packet_types.h @@ -18,23 +18,35 @@ extern "C" { #endif - -#include +#include +#include /** @addtogroup odp_packet ODP PACKET * Operations on a packet. * @{ */ -typedef odp_buffer_t odp_packet_t; +typedef odp_handle_t odp_packet_t; -#define ODP_PACKET_INVALID ODP_BUFFER_INVALID +#define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0xffffffff) #define ODP_PACKET_OFFSET_INVALID (0x0fffffff) -typedef odp_buffer_t odp_packet_seg_t; +typedef odp_handle_t odp_packet_seg_t; + +#define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t, 0xffffffff) -#define ODP_PACKET_SEG_INVALID ODP_BUFFER_INVALID +/** Get printable format of odp_packet_t */ +static inline uint64_t odp_packet_to_u64(odp_packet_t hdl) +{ + return _odp_pri(hdl); +} + +/** Get printable format of odp_packet_seg_t */ +static inline uint64_t odp_packet_seg_to_u64(odp_packet_seg_t hdl) +{ + return _odp_pri(hdl); +} /** * @} diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 599d768..c5a3f7d 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -193,10 +193,10 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len, if (addr != NULL && seg != NULL) { odp_buffer_bits_t seghandle; - seghandle.handle = pkt; + seghandle.handle = (odp_buffer_t)pkt; seghandle.seg = (pkt_hdr->headroom + offset) / pkt_hdr->buf_hdr.segsize; - *seg = seghandle.handle; + *seg = (odp_packet_seg_t)seghandle.handle; } return addr; @@ -325,9 +325,9 @@ odp_packet_seg_t odp_packet_last_seg(odp_packet_t pkt) odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); odp_buffer_bits_t seghandle; - seghandle.handle = pkt; + seghandle.handle = (odp_buffer_t)pkt; seghandle.seg = pkt_hdr->buf_hdr.segcount - 1; - return seghandle.handle; + return (odp_packet_seg_t)seghandle.handle; } odp_packet_seg_t odp_packet_next_seg(odp_packet_t pkt, odp_packet_seg_t seg)