From patchwork Thu Aug 28 10:56:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 36184 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3F980202DD for ; Thu, 28 Aug 2014 10:57:11 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf16336649pac.3 for ; Thu, 28 Aug 2014 03:57:09 -0700 (PDT) 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:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=U9e1GOnAZbC8Dz+Cw5Aht/dUc8ptu2TNeULb6vtytPA=; b=VvImesOZsFEjyqISLAbI8Q3Sf6iTlnF96adoE4G4RC+YHPX6Fm7SfmF/Gu02LIIsKA K6UI0ooy/4v0LhD1rxxsp1Y8+LcVz1xEfWYWTf1HSb1UVS1hsqZsAuzXWYbERygy6SZL AKhZq3EY2Gf9TG89ylAODtQ6qvLwPi2+/QgA32ua1zSN67Jwi6hRBzHJeUbfd16huesB yR1G1+p+lE5jkNupE81VleWxmrLi2tQ0xeTSwvztzMAjCVFI3HAUknsBywba6kq+XHgV U58Pf3xyWLXx13ZRFPH4XUMFxKX0qVELnpsOEC/2bONwqZ5WXheiO9KLuJfBRs4bYMGW Nxpg== X-Gm-Message-State: ALoCoQnrtEyMJdgP8pNsywqwNYDMGdni8pzc67lFS9ydXcv92adOZSAitmlchnIiylJGJpHdnXud X-Received: by 10.68.69.98 with SMTP id d2mr1780016pbu.0.1409223429428; Thu, 28 Aug 2014 03:57:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.132 with SMTP id b4ls496881qgb.34.gmail; Thu, 28 Aug 2014 03:57:09 -0700 (PDT) X-Received: by 10.52.246.198 with SMTP id xy6mr2030493vdc.7.1409223429311; Thu, 28 Aug 2014 03:57:09 -0700 (PDT) Received: from mail-vc0-x230.google.com (mail-vc0-x230.google.com [2607:f8b0:400c:c03::230]) by mx.google.com with ESMTPS id jh10si3091024vdb.10.2014.08.28.03.57.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 03:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::230 as permitted sender) client-ip=2607:f8b0:400c:c03::230; Received: by mail-vc0-f176.google.com with SMTP id ik5so576054vcb.35 for ; Thu, 28 Aug 2014 03:57:09 -0700 (PDT) X-Received: by 10.220.159.204 with SMTP id k12mr2388736vcx.15.1409223429211; Thu, 28 Aug 2014 03:57:09 -0700 (PDT) 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.221.45.67 with SMTP id uj3csp216273vcb; Thu, 28 Aug 2014 03:57:08 -0700 (PDT) X-Received: by 10.224.36.130 with SMTP id t2mr5061190qad.45.1409223428305; Thu, 28 Aug 2014 03:57:08 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id u4si5080800qcb.38.2014.08.28.03.57.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Aug 2014 03:57:08 -0700 (PDT) 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-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XMxO6-0005sY-Qm; Thu, 28 Aug 2014 10:57:06 +0000 Received: from alln-iport-7.cisco.com ([173.37.142.94]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XMxNx-0005lF-1P for lng-odp@lists.linaro.org; Thu, 28 Aug 2014 10:56:57 +0000 X-IronPort-AV: E=Sophos;i="5.04,417,1406592000"; d="scan'208";a="73089052" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-7.cisco.com with ESMTP; 28 Aug 2014 10:56:52 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by rcdn-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id s7SAupTi001126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 28 Aug 2014 10:56:51 GMT Received: from cpp-rtpbld-55.cisco.com (localhost.localdomain [127.0.0.1]) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8) with ESMTP id s7SAupeA015518; Thu, 28 Aug 2014 06:56:51 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s7SAupTK015517; Thu, 28 Aug 2014 06:56:51 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Thu, 28 Aug 2014 06:56:46 -0400 Message-Id: <1409223409-15473-2-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1409223409-15473-1-git-send-email-robking@cisco.com> References: <1409223409-15473-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv5 1/4] Add user context to packet 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-Original-Sender: robking@cisco.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::230 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=fail header.i=@cisco.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Robbie King --- platform/linux-generic/include/api/odp_packet.h | 18 ++++++++++++++++++ .../linux-generic/include/odp_packet_internal.h | 2 ++ platform/linux-generic/odp_packet.c | 10 ++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-) diff --git a/platform/linux-generic/include/api/odp_packet.h b/platform/linux-generic/include/api/odp_packet.h index ef4be9e..4a089d1 100644 --- a/platform/linux-generic/include/api/odp_packet.h +++ b/platform/linux-generic/include/api/odp_packet.h @@ -98,6 +98,24 @@ void odp_packet_set_len(odp_packet_t pkt, size_t len); size_t odp_packet_get_len(odp_packet_t pkt); /** + * Set packet user context + * + * @param buf Packet handle + * @param ctx User context + * + */ +void odp_packet_set_ctx(odp_packet_t buf, const void *ctx); + +/** + * Get packet user context + * + * @param buf Packet handle + * + * @return User context + */ +void *odp_packet_get_ctx(odp_packet_t buf); + +/** * Get address to the start of the packet buffer * * The address of the packet buffer is not necessarily the same as the start diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 0ab3be2..49c59b2 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -112,6 +112,8 @@ typedef struct { uint32_t frame_len; + uint64_t user_ctx; /* user context */ + odp_pktio_t input; uint32_t pad; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 13e2471..22ce34a 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -386,3 +386,13 @@ int odp_packet_copy(odp_packet_t pkt_dst, odp_packet_t pkt_src) return 0; } + +void odp_packet_set_ctx(odp_packet_t pkt, const void *ctx) +{ + odp_packet_hdr(pkt)->user_ctx = (intptr_t)ctx; +} + +void *odp_packet_get_ctx(odp_packet_t pkt) +{ + return (void *)(intptr_t)odp_packet_hdr(pkt)->user_ctx; +}