From patchwork Tue Sep 9 13:49:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 37105 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3ECA120491 for ; Tue, 9 Sep 2014 13:50:13 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id rd3sf24180649pab.10 for ; Tue, 09 Sep 2014 06:50:12 -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=0NH4iCS5itNSlQ9jxviufPDx6/Fd8fMu5Puyl1wGK4g=; b=kSnH1NMhm322wgc72ybn4u4xupQU5blFUezUuDUTB2R6WM3hcMQ/OLcrPZcHE5Ybhh 1NGovL7O/RqkIey8L5dsM9tjEarfM/KKIQ1k8DOH2DXxGEt2fwH2kuB7gn+77YHipF5x 8XvEON53aq7vG+x0jqoFLKz6eVPKur4HUfpwe1iHGOLLq7/djXx5MUV6Kw3TwCt5lev5 RoSVscW2T0hX93dMiTyxBOYQeJncEQPL3uGceOYoTI1324x4bR5gj9kyB6+K/rhonLoB GCxh1uGrpOAB4ODbF6ltifFG7E8hDPqBCtFENqHZ5xGTxJkVOqV+GM4YQoMrZzrepGAT LzPA== X-Gm-Message-State: ALoCoQnn+QBZFQ/W/aN8/GUNE8xgMmsGDa44O1w5+vmZKMh+LCM3/+imUz7HoTIwyx3W2KlVGhcx X-Received: by 10.66.66.196 with SMTP id h4mr21044643pat.18.1410270612369; Tue, 09 Sep 2014 06:50:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.180 with SMTP id 49ls282652qgl.81.gmail; Tue, 09 Sep 2014 06:50:12 -0700 (PDT) X-Received: by 10.52.121.74 with SMTP id li10mr25560077vdb.19.1410270612132; Tue, 09 Sep 2014 06:50:12 -0700 (PDT) Received: from mail-vc0-x231.google.com (mail-vc0-x231.google.com [2607:f8b0:400c:c03::231]) by mx.google.com with ESMTPS id bz3si5165719vcb.23.2014.09.09.06.50.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 06:50:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::231 as permitted sender) client-ip=2607:f8b0:400c:c03::231; Received: by mail-vc0-f177.google.com with SMTP id la4so466420vcb.8 for ; Tue, 09 Sep 2014 06:50:12 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr24675126vdb.25.1410270612060; Tue, 09 Sep 2014 06:50:12 -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 uj3csp287127vcb; Tue, 9 Sep 2014 06:50:11 -0700 (PDT) X-Received: by 10.229.211.132 with SMTP id go4mr23008060qcb.0.1410270611038; Tue, 09 Sep 2014 06:50:11 -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 m41si15173487qga.92.2014.09.09.06.50.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Sep 2014 06:50:10 -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 1XRLo7-00066N-Nt; Tue, 09 Sep 2014 13:50:07 +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 1XRLo1-00065L-8J for lng-odp@lists.linaro.org; Tue, 09 Sep 2014 13:50:01 +0000 X-IronPort-AV: E=Sophos;i="5.04,491,1406592000"; d="scan'208";a="76288788" Received: from rcdn-core-4.cisco.com ([173.37.93.155]) by alln-iport-7.cisco.com with ESMTP; 09 Sep 2014 13:49:57 +0000 Received: from cpp-rtpbld-55.cisco.com (cpp-rtpbld-55.cisco.com [172.18.5.199]) by rcdn-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id s89DntmY015529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Sep 2014 13:49:55 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 s89Dntu8001294; Tue, 9 Sep 2014 09:49:55 -0400 Received: (from robking@localhost) by cpp-rtpbld-55.cisco.com (8.13.8/8.13.8/Submit) id s89Dntba001293; Tue, 9 Sep 2014 09:49:55 -0400 From: Robbie King To: lng-odp@lists.linaro.org Date: Tue, 9 Sep 2014 09:49:50 -0400 Message-Id: <1410270593-1230-2-git-send-email-robking@cisco.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1410270593-1230-1-git-send-email-robking@cisco.com> References: <1410270593-1230-1-git-send-email-robking@cisco.com> X-Topics: patch Subject: [lng-odp] [PATCHv7 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::231 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 20137d0..64fd0f8 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; +}