From patchwork Thu Jul 20 12:59:59 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: 108331 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2099411qge; Thu, 20 Jul 2017 06:01:13 -0700 (PDT) X-Received: by 10.55.15.22 with SMTP id z22mr4405247qkg.195.1500555673581; Thu, 20 Jul 2017 06:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500555673; cv=none; d=google.com; s=arc-20160816; b=MsGTwnXcR1cDaeVOxTFOqVxkBA6OpmU2/syHBIqR3hFyJciILExn9lWohtVSdWYZQJ bBzgfUnKanXt+In7JcqpsP0Y+AcBgFUQdZMwWjLN0d0yueYDvBY/S84e3J4HNFcfF1AZ t/oWZwv8MYyw+1+Q+Qi7WPVGSTqUnIYDi62JYJcDILNiEZdlQvZUerc6UXpiMx4TbQL7 gOpcKQ2BRjcCj3jjhF+bKTPotVNESJMJw6Ak6wNyrGW9C895cWO8rnzuKF7nLSbQ2khJ KP9L2ISCAK9EZ+ZHyhc5vcrh4BSfzFmuTGVD3Yo/EaFg3cP0PXrs05PPYzbPtEuHG5NG pH5g== 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=gDghyUEuNdA+dSuxUaNMRXDqVDCk36bmHkkbuqInt/E=; b=s2yIDTMD1IzUy0PkmbGwjCRVIPXMM3zJBYI3J8M+pp0J82CDhzhaurI/t8QThp2uEA fOvOroeM3jsPLF2VQWdqifxK46U48kIAFL/+IM5C5IRwvk+J5IqbfXH2Yu2w4sPxBFo4 ecVyyDbFx5UlOOV6JJHVPUIqxGvo3FdaCsIE0e0YixtabpvF5LFm2MK93TkoDwnkbhGM syYfnlZqv5DuSfESr68JTuKyaX0oqNJQbkSelkQ7E/ls1KKd4h+TJN+mYHSTaOxdTUy+ JovLxcu90d2wB6BrWKICGPSK0TzekRMykjHt8ZSaCcllyF1rNlTPbruxcs32d+oc39AB lHng== 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 g124si1879637qkd.141.2017.07.20.06.01.13; Thu, 20 Jul 2017 06:01:13 -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 3E283644DC; Thu, 20 Jul 2017 13:01:13 +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 C091E60805; Thu, 20 Jul 2017 13:00:29 +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 0EB63609EF; Thu, 20 Jul 2017 13:00:23 +0000 (UTC) Received: from forward3h.cmail.yandex.net (forward3h.cmail.yandex.net [87.250.230.18]) by lists.linaro.org (Postfix) with ESMTPS id C81C2609E1 for ; Thu, 20 Jul 2017 13:00:20 +0000 (UTC) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [95.108.252.166]) by forward3h.cmail.yandex.net (Yandex) with ESMTP id 96CC1212C0 for ; Thu, 20 Jul 2017 16:00:19 +0300 (MSK) Received: from smtp4p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp4p.mail.yandex.net (Yandex) with ESMTP id 6B79C65010ED for ; Thu, 20 Jul 2017 16:00:19 +0300 (MSK) Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id MKAkCojSAY-0Iamr5CI; Thu, 20 Jul 2017 16:00:18 +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: Thu, 20 Jul 2017 15:59:59 +0300 Message-Id: <1500555606-5503-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500555606-5503-1-git-send-email-odpbot@yandex.ru> References: <1500555606-5503-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 82 Subject: [lng-odp] [PATCH v1 2/9] 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 82 (Bill-Fischofer-Linaro:pktrefs) ** https://github.com/Linaro/odp/pull/82 ** Patch: https://github.com/Linaro/odp/pull/82.patch ** Base sha: 95ba4b394009d92c29c2e22f0776e90bb4c6edec ** Merge commit sha: 73cef9023221f7c5bc93e67cb57a9d07e8f1a113 **/ 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(-) 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 a209c759..dd0d94b7 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -80,6 +80,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..9c013d8f 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,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 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),