From patchwork Sun Mar 12 12:30:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 95171 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp783723qgd; Sun, 12 Mar 2017 05:33:27 -0700 (PDT) X-Received: by 10.55.47.69 with SMTP id v66mr26726333qkh.222.1489322007502; Sun, 12 Mar 2017 05:33:27 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e49si12324938qta.160.2017.03.12.05.33.27; Sun, 12 Mar 2017 05:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 24BE6607FD; Sun, 12 Mar 2017 12:33:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 96F3563CA1; Sun, 12 Mar 2017 12:31:09 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C604363C97; Sun, 12 Mar 2017 12:31:03 +0000 (UTC) Received: from mail-oi0-f47.google.com (mail-oi0-f47.google.com [209.85.218.47]) by lists.linaro.org (Postfix) with ESMTPS id 231DF63C8B for ; Sun, 12 Mar 2017 12:30:55 +0000 (UTC) Received: by mail-oi0-f47.google.com with SMTP id 126so68150290oig.3 for ; Sun, 12 Mar 2017 05:30:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=M3ZVf3LUEvWMt6ZHLAebsC4/+VyV3y4YE4Fzs5aSLCY=; b=NuL6EVxXJKnXCSCLv9Ylz76+JVfIM6A335puRBV2lJqsn/zdnylXA0KZGgI5pbHgOP KYgw2P7iVFppOAlJpaO3KhCb356YBulVbS3UhMnjdceO3D7ra2wfJRkI/fJ9o8jF6k+5 kvknFddk8yVNsvTYTckiB9pFTcxzYoM47M9xZFk+CCO35DU0O2pQyaK/hJAct7Po71wg o2/bbtsd7UU3XeLa4MDYp1S9jNPfICAVRmCrWEtJmDTbzD3xoaO8LFA5zir0uToFFeL5 02jbrc8z1A9n8uHMhD/iN1SWNhacscnakIPpHYIfm+9HcV6PATp/7eOqQWCt51zmc6A4 mT/Q== X-Gm-Message-State: AMke39mNWTzSq6IRs7dhfn2AxZzPLlI5hcDPWtYQSrB0+S04vveXjV1kTINJ6nb51uAOgeXSUVI= X-Received: by 10.202.182.198 with SMTP id g189mr15398285oif.180.1489321854481; Sun, 12 Mar 2017 05:30:54 -0700 (PDT) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id 62sm6663155otq.34.2017.03.12.05.30.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2017 05:30:53 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 12 Mar 2017 07:30:38 -0500 Message-Id: <20170312123045.3852-5-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.12.0.rc1 In-Reply-To: <20170312123045.3852-1-bill.fischofer@linaro.org> References: <20170312123045.3852-1-bill.fischofer@linaro.org> Subject: [lng-odp] [PATCHv2 04/11] linux-generic: packet: add packet fields needed for references X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Add new fields to the odp_packet_hdr_t used for support of zero-copy references. Also added are the offsets needed to access them from inlined functions. Signed-off-by: Bill Fischofer --- platform/linux-generic/include/odp/api/plat/packet_types.h | 8 ++++++++ platform/linux-generic/include/odp_packet_internal.h | 9 ++++++++- platform/linux-generic/odp_packet.c | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) -- 2.12.0.rc1 diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index b8f665d2..16e4b467 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -70,6 +70,14 @@ typedef struct _odp_packet_inline_offset_t { /** @internal field offset */ size_t tailroom; /** @internal field offset */ + size_t unshared_len; + /** @internal field offset */ + size_t ref_hdr; + /** @internal field offset */ + size_t ref_offset; + /** *internal field offset */ + size_t ref_len; + /** @internal field offset */ size_t pool; /** @internal field offset */ size_t input; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 589e204a..31d46df4 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -119,7 +119,7 @@ typedef struct { * packet_init(). Because of this any new fields added must be reviewed for * initialization requirements. */ -typedef struct { +typedef struct odp_packet_hdr_t { /* common buffer header */ odp_buffer_hdr_t buf_hdr; @@ -135,6 +135,13 @@ typedef struct { uint32_t headroom; uint32_t tailroom; + /* Fields used to support packet references */ + uint32_t unshared_len; + struct odp_packet_hdr_t *ref_hdr; + uint32_t ref_offset; + uint32_t ref_len; + odp_atomic_u32_t ref_count; + /* * Members below are not initialized by packet_init() */ diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index d0f76332..067d0fcb 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -31,6 +31,10 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = { .frame_len = offsetof(odp_packet_hdr_t, frame_len), .headroom = offsetof(odp_packet_hdr_t, headroom), .tailroom = offsetof(odp_packet_hdr_t, tailroom), + .unshared_len = offsetof(odp_packet_hdr_t, unshared_len), + .ref_hdr = offsetof(odp_packet_hdr_t, ref_hdr), + .ref_offset = offsetof(odp_packet_hdr_t, ref_offset), + .ref_len = offsetof(odp_packet_hdr_t, ref_len), .pool = offsetof(odp_packet_hdr_t, buf_hdr.pool_hdl), .input = offsetof(odp_packet_hdr_t, input), .segcount = offsetof(odp_packet_hdr_t, buf_hdr.segcount),