From patchwork Tue Aug 1 15:00:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 109176 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp1609363qge; Tue, 1 Aug 2017 08:04:36 -0700 (PDT) X-Received: by 10.55.209.86 with SMTP id s83mr25004536qki.171.1501599876405; Tue, 01 Aug 2017 08:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501599876; cv=none; d=google.com; s=arc-20160816; b=RswSVA+ugm4A53wU9TIfWPkq+zcQzH8YnhIbNIee6uo8DiC1pf6qPJm+qXUPubkZf7 qo8ixUQZjFQQDsAMymjvZwtjoAMHsIGW2UqshLleWRXqinFsU98cl4jZvbEqEebnbzcN EOIhxBv+cJavBSFaxX8+X/3EHarakvj6yT3PIDap3DGBpDIzE2oujVGNDpf0n8YMf0NY ManSKSYgc4kaQKMguBW6CxtAjQ+igTVCpgntNiU1+T9X4Yq9fZN8QAubq7qRfkxWnou/ 7vSftWbLMzEhR0XRs/osnLSrZ5uG9iprPNflWeTXBPDe/C8z1Doq1gGioWiDKms9vxHD qcKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=WqE5NFljqd03xbBHMlraQAyX5owVsesV03QUHbv7i14=; b=BJakrA9b6G0Qnu+bFbQgQDt+OhF0hmkOH9KiWzsUz+iM8Bidi3ivZhOQ6oITWwGgXQ B64nLugeTPuylWQzJ+V9r5H3UcCIQfwq9yWHqZMQt5uBnU1XJONhseFsnlL4s4o4Qk9p fPU0bxJoRzcjFkCICFN4bKRgvxTEhjowfqLRPXjtglrRig7AahvdeEUKdF5hrMiEKlVI Hy9tEy2XU+zBBMIrFGu4kCNcCah9yCJrQP/HoqmW4V66ULz8+rrpb5QjxgPIQHBbYp9F QCBWQOgDMSOhx13YfAPzgPQRvSWLOpGHnw5db8zdONOx56fV1AGoTIL/FCe4GJ1mYdr+ jm/g== ARC-Authentication-Results: i=1; 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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 5si26401362qtu.311.2017.08.01.08.04.35; Tue, 01 Aug 2017 08:04:36 -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=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 3A39364A61; Tue, 1 Aug 2017 15:04:35 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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 CA89264FD5; Tue, 1 Aug 2017 15:01:23 +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 347146099C; Tue, 1 Aug 2017 15:01:10 +0000 (UTC) Received: from forward4m.cmail.yandex.net (forward4m.cmail.yandex.net [5.255.216.22]) by lists.linaro.org (Postfix) with ESMTPS id 0C7BC60B12 for ; Tue, 1 Aug 2017 15:00:31 +0000 (UTC) Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [IPv6:2a02:6b8:0:801::ac]) by forward4m.cmail.yandex.net (Yandex) with ESMTP id 2EAA52078E for ; Tue, 1 Aug 2017 18:00:29 +0300 (MSK) Received: from smtp2j.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2j.mail.yandex.net (Yandex) with ESMTP id 907593EC11C6 for ; Tue, 1 Aug 2017 18:00:25 +0300 (MSK) Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id tyzQTD0Qgu-0PbixV6q; Tue, 01 Aug 2017 18:00:25 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 1 Aug 2017 18:00:02 +0300 Message-Id: <1501599610-28388-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501599610-28388-1-git-send-email-odpbot@yandex.ru> References: <1501599610-28388-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 90 Subject: [lng-odp] [PATCH v3 2/10] 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" From: Bill Fischofer 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 --- /** Email created from pull request 90 (Bill-Fischofer-Linaro:pktrefs) ** https://github.com/Linaro/odp/pull/90 ** Patch: https://github.com/Linaro/odp/pull/90.patch ** Base sha: bb0ca193f8c28036fdf8b3d6c8aa5d4f11980e6c ** Merge commit sha: dfef320840f96825686124135a6e509db80b7b82 **/ .../linux-generic/include/odp/api/plat/packet_types.h | 8 ++++++++ platform/linux-generic/include/odp_packet_internal.h | 15 ++++++++++++++- platform/linux-generic/odp_packet.c | 4 ++++ 3 files changed, 26 insertions(+), 1 deletion(-) 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 41468bec..1554c3af 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -84,6 +84,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 f77987c8..0542dd10 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -106,7 +106,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; @@ -122,6 +122,19 @@ typedef struct { uint32_t headroom; uint32_t tailroom; + /* Fields used to support packet references */ + uint32_t unshared_len; + /* Next pkt_hdr in reference chain */ + struct odp_packet_hdr_t *ref_hdr; + /* Offset into next pkt_hdr that ref was created at */ + uint32_t ref_offset; + /* frame_len in next pkt_hdr at time ref was created. This + * allows original offset to be maintained when base pkt len + * is changed */ + uint32_t ref_len; + /* Incremented on refs, decremented on frees. */ + 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 dbde7280..af8c442e 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -33,6 +33,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),