From patchwork Thu Aug 21 19:10:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 35783 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8264220540 for ; Thu, 21 Aug 2014 19:10:40 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf28769789qge.4 for ; Thu, 21 Aug 2014 12:10:40 -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=RO5b3DrUN2kPIiOlcwLSy6L8pdZYSBVrfrtZnXoNfI8=; b=DlTuQEyfxhOxWUNajdw+jMtkGmVK+/IoJGeIQAtiqrrGtT9A8lRC315n3XPgykX+uB VWft/t/3Dkem5Z6EuxGx4xpfsSxDGzY1dlatjqqQ09s2PdlH6cb0588iVslK2qBXZ+3+ /D1mEJjrCWytHHtQlVm+Qy55rSBoV+p5kbVVy1vFm9Dprhmwyt4QfnABAjrTorUnkXNt e8/pdxXUBO4ANISyydSsrvQ4Rxxk9e2ITNKdwYzO7KdZHy5RtM695LBrmuPny6wMW5va CzYSgqHfTyCB8Uagcq5BOhRkBo36kChHz+5hXe++awIlRKIB+gOZCXGSu75qF8XqsNxD ZLNg== X-Gm-Message-State: ALoCoQnoU4c80jBqcsPuem3BkPl6+3hZPFmWao+SZks+OLWy8nFWeryo3wsEd+oJYEETGePkdn9G X-Received: by 10.236.124.161 with SMTP id x21mr5739450yhh.48.1408648240352; Thu, 21 Aug 2014 12:10:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.119 with SMTP id e110ls822242qge.43.gmail; Thu, 21 Aug 2014 12:10:40 -0700 (PDT) X-Received: by 10.52.26.206 with SMTP id n14mr381936vdg.0.1408648240181; Thu, 21 Aug 2014 12:10:40 -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 b13si12674612vcj.102.2014.08.21.12.10.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Aug 2014 12:10:40 -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 id10so11075176vcb.7 for ; Thu, 21 Aug 2014 12:10:40 -0700 (PDT) X-Received: by 10.220.44.80 with SMTP id z16mr324624vce.7.1408648240105; Thu, 21 Aug 2014 12:10:40 -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 uj3csp160335vcb; Thu, 21 Aug 2014 12:10:39 -0700 (PDT) X-Received: by 10.140.43.70 with SMTP id d64mr907299qga.74.1408648239607; Thu, 21 Aug 2014 12:10:39 -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 m104si39714798qgd.52.2014.08.21.12.10.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 21 Aug 2014 12:10:39 -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 1XKXks-00011N-AX; Thu, 21 Aug 2014 19:10:38 +0000 Received: from rcdn-iport-6.cisco.com ([173.37.86.77]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XKXka-0000zO-LE for lng-odp@lists.linaro.org; Thu, 21 Aug 2014 19:10:20 +0000 X-IronPort-AV: E=Sophos;i="5.04,374,1406592000"; d="scan'208";a="349335799" Received: from alln-core-12.cisco.com ([173.36.13.134]) by rcdn-iport-6.cisco.com with ESMTP; 21 Aug 2014 19:10:15 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by alln-core-12.cisco.com (8.14.5/8.14.5) with ESMTP id s7LJAE3a028731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Aug 2014 19:10:15 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 s7LJAEoG017180; Thu, 21 Aug 2014 15:10:14 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s7LJAE1n017143; Thu, 21 Aug 2014 15:10:14 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Thu, 21 Aug 2014 15:10:08 -0400 Message-Id: <1408648211-9995-2-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1408648211-9995-1-git-send-email-robking@cisco.com> References: <1408648211-9995-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv2 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 --- include/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/include/odp_packet.h b/include/odp_packet.h index ef4be9e..28cabb8 100644 --- a/include/odp_packet.h +++ b/include/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, 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..07c6956 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, 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; +}