From patchwork Sun Mar 5 12:21:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 94902 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp988865qgd; Sun, 5 Mar 2017 04:24:57 -0800 (PST) X-Received: by 10.55.164.208 with SMTP id n199mr11691347qke.163.1488716697769; Sun, 05 Mar 2017 04:24:57 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id o6si13385026qkc.70.2017.03.05.04.24.57; Sun, 05 Mar 2017 04:24:57 -0800 (PST) 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 6D9B663628; Sun, 5 Mar 2017 12:24:57 +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 055DD63D1F; Sun, 5 Mar 2017 12:22:10 +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 63DBA60AD1; Sun, 5 Mar 2017 12:22:01 +0000 (UTC) Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by lists.linaro.org (Postfix) with ESMTPS id CEE0460A16 for ; Sun, 5 Mar 2017 12:21:32 +0000 (UTC) Received: by mail-wr0-f179.google.com with SMTP id u48so99700991wrc.0 for ; Sun, 05 Mar 2017 04:21:32 -0800 (PST) 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=kEcTpHbQV76dvQ9cpm3QqFITrw6dU9a9B4WK8i4kf9s=; b=oA79g1dmqY2u/l7A3v9yYdIOiirIQ60YgVtjmCOcM2Xgj+BrgNBv/oz/30Y/qB1j4b Bec3v/ER/Q1JngomxSsn9EcolTFA682JpznS08urgTvKlicLx5ixIvzWUSjyOmhbTaqw p+5dc2+joDcDz55zdHzvuAaoafhP9P5BxNYvxTaKv5snDlv11FJh4q0E6TxT/bxjkL3X AYCo8iHUvXJDNfrjlTdi5DnUAfiXyQls93UPXXfpFVDnKNrK+OsneBJnQNkJtJGI0hmd OsvkYeHfWCjklO5bkg/6cc8UbUxYUQ2TGzwFfA7lgTHNZYyIllK75+fUqpjSCxFtgE2U 8IfQ== X-Gm-Message-State: AMke39k+zG8ykTRTJ0+GaJztmQVlNtfuBdBT2GbBy3ae23bv/VwLvMO0eiiWPcC1Cph9Id3DuOU= X-Received: by 10.223.172.77 with SMTP id v71mr11868751wrc.131.1488716491807; Sun, 05 Mar 2017 04:21:31 -0800 (PST) Received: from Ubuntu15.localdomain ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id 127sm10686971wmt.20.2017.03.05.04.21.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Mar 2017 04:21:31 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 5 Mar 2017 13:21:18 +0100 Message-Id: <1488716485-15002-5-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1488716485-15002-1-git-send-email-bill.fischofer@linaro.org> References: <1488716485-15002-1-git-send-email-bill.fischofer@linaro.org> Subject: [lng-odp] [PATCH 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.5.0 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 b8f665d..16e4b46 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 589e204..31d46df 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 d0f7633..067d0fc 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),