From patchwork Tue Aug 19 14:07:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robbie King X-Patchwork-Id: 35601 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 11F1D201EF for ; Tue, 19 Aug 2014 14:07:52 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j7sf18813924qaq.1 for ; Tue, 19 Aug 2014 07:07:51 -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:thread-topic:thread-index :date:message-id:references:in-reply-to:accept-language:mime-version :cc:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-language:content-type; bh=QgIOxjP6eMLChW35mLIYpVzJIcoeOuJ1yfY7Tu8qGH8=; b=J24r+/iVL1J+0Olurm8fFgLwADYK8vplHcFmau3UpZVYpy92sFor5C0fhMUPkiS1q0 6afS4lywWcctaKyGOToA8auszSaY4ZhdlUfzaQ25Vkvb1gQ1r8Dn0cuanm/WAKDa50Om vWEVmhNuZbS9yUiZWshA2w7dAsje97u+QiQ9aNbkSnIcc52H6WYJhWM/bwqvIaeCzmWV QJcrYuLvmExi4WnyxtdUfJTFy6B+mE5c2ExCvOE9AgTSGSD2y9dzceF9AZAI35I0oR+F aUkjJtqlwqwSMvJ+rhxtR6Zu/pq8CRrrbLRDQkQu5EANEr/l2WuHAlQvf6YoD6+kcQW2 gh0Q== X-Gm-Message-State: ALoCoQnjuzkH1M3oWiLUIPByQCCJyvO+dFuN8ZBpVHJo4E4hpf0/rfQKGOqcxBDVcuqsa6CMhVVp X-Received: by 10.236.150.110 with SMTP id y74mr20692149yhj.7.1408457271427; Tue, 19 Aug 2014 07:07:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.72 with SMTP id q66ls2842407qgq.49.gmail; Tue, 19 Aug 2014 07:07:51 -0700 (PDT) X-Received: by 10.52.15.36 with SMTP id u4mr318980vdc.91.1408457270988; Tue, 19 Aug 2014 07:07:50 -0700 (PDT) Received: from mail-vc0-x235.google.com (mail-vc0-x235.google.com [2607:f8b0:400c:c03::235]) by mx.google.com with ESMTPS id re13si8755536vcb.8.2014.08.19.07.07.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::235 as permitted sender) client-ip=2607:f8b0:400c:c03::235; Received: by mail-vc0-f181.google.com with SMTP id lf12so7518035vcb.12 for ; Tue, 19 Aug 2014 07:07:50 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr395336vcb.71.1408457270840; Tue, 19 Aug 2014 07:07:50 -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.37.5 with SMTP id tc5csp241683vcb; Tue, 19 Aug 2014 07:07:50 -0700 (PDT) X-Received: by 10.140.86.6 with SMTP id o6mr33449252qgd.71.1408457270137; Tue, 19 Aug 2014 07:07:50 -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 k3si27762429qay.45.2014.08.19.07.07.49 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Aug 2014 07:07:50 -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 1XJk4i-0002tS-EQ; Tue, 19 Aug 2014 14:07:48 +0000 Received: from rcdn-iport-3.cisco.com ([173.37.86.74]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XJk4b-0002tN-O7 for lng-odp@lists.linaro.org; Tue, 19 Aug 2014 14:07:41 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj4FAOJY81OtJA2J/2dsb2JhbABZgkcjI1NXBIJ4yAuBWQEJh1gBGXEWd4QDAQEBBAEBASAEBkELEAIBCBEEAQELHQMCAgIlAQoUCQgCBA4FCIg6AQysUpUxF48bFhsGAYJ5NoEdBZElhCaDdYRZkyyDXWyBSIEHAQEB X-IronPort-AV: E=Sophos;i="5.01,894,1400025600"; d="scan'208,217";a="348654607" Received: from alln-core-4.cisco.com ([173.36.13.137]) by rcdn-iport-3.cisco.com with ESMTP; 19 Aug 2014 14:07:36 +0000 Received: from xhc-rcd-x11.cisco.com (xhc-rcd-x11.cisco.com [173.37.183.85]) by alln-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id s7JE7ZRO022193 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 19 Aug 2014 14:07:35 GMT Received: from xmb-aln-x01.cisco.com ([fe80::747b:83e1:9755:d453]) by xhc-rcd-x11.cisco.com ([173.37.183.85]) with mapi id 14.03.0195.001; Tue, 19 Aug 2014 09:07:35 -0500 From: "Robbie King (robking)" To: Ola Liljedahl Thread-Topic: [lng-odp] [PATCH] Add 64 bit context to packet Thread-Index: AQHPu6uM8/gpInF+Z0CwL7eHwDLF7pvYM4+AgAADPYD//6yngIAAYQIA//+xfHA= Date: Tue, 19 Aug 2014 14:07:34 +0000 Message-ID: References: <1408452365-8436-1-git-send-email-robking@cisco.com> <1408452365-8436-2-git-send-email-robking@cisco.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.82.209.70] MIME-Version: 1.0 X-Topics: patch Cc: lng-odp-forward Subject: Re: [lng-odp] [PATCH] Add 64 bit 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: , 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::235 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Content-Language: en-US Actually that is what I originally had (“ctx” as a void *). For some reason I had it in my head that there were folks that didn’t like that and would prefer the 64 bit opaque value that the app was free to use as it saw fit. I will submit the original. From: Ola Liljedahl [mailto:ola.liljedahl@linaro.org] Sent: Tuesday, August 19, 2014 9:47 AM To: Robbie King (robking) Cc: Bill Fischofer; lng-odp-forward Subject: Re: [lng-odp] [PATCH] Add 64 bit context to packet Better use a pointer than a 64 bit integer. On a 32 bit system, someone may use this to store both a pointer and a 32-bit value of some type. This won't port to a 64-bit system as the pointer alone will consume all reserved space. As Bill writes, use intptr_t or why not just a "void *" if a pointer is what you want? On 19 August 2014 15:01, Robbie King (robking) > wrote: Pointer is really all I’m looking for. Just wanted to get as many ‘tidbits’ out of the way before the IPsec application patch. From: Bill Fischofer [mailto:bill.fischofer@linaro.org] Sent: Tuesday, August 19, 2014 8:58 AM To: Robbie King (robking) Cc: lng-odp-forward Subject: Re: [lng-odp] [PATCH] Add 64 bit context to packet Are you really wanting to define a 64-bit integer or are you looking for a pointer? uint64_t is not portable to 32-bit systems, however intptr_t is guaranteed to be a native pointer type of appropriate size. Bill On Tue, Aug 19, 2014 at 7:46 AM, Robbie King > wrote: 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(-) -- 1.7.7.6 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp diff --git a/include/odp_packet.h b/include/odp_packet.h index ef4be9e..db75540 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, uint64_t ctx); + +/** + * Get packet user context + * + * @param buf Packet handle + * + * @return User context + */ +uint64_t 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..bbfef49 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, uint64_t ctx) +{ + odp_packet_hdr(pkt)->user_ctx = ctx; +} + +uint64_t odp_packet_get_ctx(odp_packet_t pkt) +{ + return odp_packet_hdr(pkt)->user_ctx; +}