From patchwork Thu Aug 21 12:30:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 35752 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A79312055D for ; Thu, 21 Aug 2014 12:31:00 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf70586004pde.11 for ; Thu, 21 Aug 2014 05:31:00 -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=RDLIyn6+racC5/X6Di6sQ5IG+howMqUj7ubPIgXXpa7UBD/tKmmkg3D6mxxWsn/7WF kiSsVRq7Y4htLpLUkexumvHCjg7RRONXWHJg/BrfLNHkJSeKnRVAbG9LQXGqvSWAYWXd ogW6NhLTdLKw7OhFDPrM50hJK1eSq6XDy+bM2mDD+Z2LUsAs14YwAcvspYjErVPBeTvB VcZlUtreOKm+48e21XJyURYR31EAVaqPH86dilhdRx83sYMgmfxIHNIeuV9jW9KPGFAf q3/tdw4Cxd+jMO8qTBT+EWUXzumuoCN2mGKGZ7vNzCxbwDU1rbe9zOyorvP/XcKkPTI2 iHng== X-Gm-Message-State: ALoCoQngu0ORL0qphDOzdkX+PYT67Zw6bKWxlIvo2RXH18Ij7Sz7I0E8eLRJj4iCHLRX8kAAVH9U X-Received: by 10.66.218.162 with SMTP id ph2mr29837613pac.3.1408624260016; Thu, 21 Aug 2014 05:31:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.6 with SMTP id t6ls677077qge.32.gmail; Thu, 21 Aug 2014 05:30:59 -0700 (PDT) X-Received: by 10.52.128.8 with SMTP id nk8mr76027vdb.48.1408624259863; Thu, 21 Aug 2014 05:30:59 -0700 (PDT) Received: from mail-vc0-x22d.google.com (mail-vc0-x22d.google.com [2607:f8b0:400c:c03::22d]) by mx.google.com with ESMTPS id y20si12258864vcu.71.2014.08.21.05.30.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Aug 2014 05:30:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22d as permitted sender) client-ip=2607:f8b0:400c:c03::22d; Received: by mail-vc0-f173.google.com with SMTP id hy10so10674712vcb.18 for ; Thu, 21 Aug 2014 05:30:59 -0700 (PDT) X-Received: by 10.221.68.66 with SMTP id xx2mr41458420vcb.1.1408624259787; Thu, 21 Aug 2014 05:30:59 -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 uj3csp131467vcb; Thu, 21 Aug 2014 05:30:59 -0700 (PDT) X-Received: by 10.140.41.38 with SMTP id y35mr83299396qgy.69.1408624259185; Thu, 21 Aug 2014 05:30:59 -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 w8si38375933qcs.12.2014.08.21.05.30.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 21 Aug 2014 05:30:59 -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 1XKRW6-0004a0-5y; Thu, 21 Aug 2014 12:30:58 +0000 Received: from rcdn-iport-5.cisco.com ([173.37.86.76]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XKRVu-0004YW-58 for lng-odp@lists.linaro.org; Thu, 21 Aug 2014 12:30:46 +0000 X-IronPort-AV: E=Sophos;i="5.01,909,1400025600"; d="scan'208";a="349218570" Received: from rcdn-core-9.cisco.com ([173.37.93.145]) by rcdn-iport-5.cisco.com with ESMTP; 21 Aug 2014 12:30:40 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by rcdn-core-9.cisco.com (8.14.5/8.14.5) with ESMTP id s7LCUe4J028058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Aug 2014 12:30:40 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 s7LCUeiF012492; Thu, 21 Aug 2014 08:30:40 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s7LCUeaw012491; Thu, 21 Aug 2014 08:30:40 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Thu, 21 Aug 2014 08:30:26 -0400 Message-Id: <1408624238-12430-2-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1408624238-12430-1-git-send-email-robking@cisco.com> References: <1408624238-12430-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCH 01/13] 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::22d 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; +}