From patchwork Sat Jul 29 14:04:20 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: 108940 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp1635255obm; Sat, 29 Jul 2017 07:06:37 -0700 (PDT) X-Received: by 10.55.75.8 with SMTP id y8mr15099714qka.247.1501337197020; Sat, 29 Jul 2017 07:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501337197; cv=none; d=google.com; s=arc-20160816; b=iAVb5CnJAKzSh3CkO3iZQyRfrYdwB9Ek4YqZPFE1Pfs3Y53C5oS8/phVxg4xpK0Dcm 4stjQ5j5RWghGVhfFj1wzgho4c6y7jH7Domv+QdYJIB8vSZTKQeUEwMABYt7m4GxIz8T T8LKQEAIV/aBM7KTQQcOWB0TJ2KyZFK1EAc5gHmRoCpk1tZEs1FWhiPubVvxme/7d5a9 +aH7hVvikkbyxxidfve3N+wqvBkds+p3vM+XCEWf1BL/qmf9iA+BhZeNtcc0cmqxeGEr vb2j9lIEXj9S0IrMeixWP9/A9BQnA83pbiXqQFmZ5dED3PUZFKvSvxc09iPoA0m3P8fM 7Oew== 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=aBxvzoULUBj5RndUquQjRc3TY2B3vHs5WMjnWzPn1W4=; b=sN6ZHPRk+HTaMAPMNYB3BTGDGMU4q/sPeUotamR9FzenR0yG1cUDgocJa9UO76F9M9 EbeVoS5g7RoaVmQTpoTRLYeP4MIeqoClxb7AknwA+lDxzo/o8YkTNMacAyJ4cg8jgaby cXXK87r0qLKy6sjYbuHyTNXSDqKdblXNH+vfSis+TUeuDcX5h8O1CcMuPzvLJZ9J3+Fw 4Ns9dSHd8l1uGYpE52DU4Q6IS9lpVe23zpZZBIwoUhc1gGDPWNlR4eIgDZI9dd/dQ49R 95s2+TcDBULCLHEodrYbhPTri8jDZ8q7LA1671uXxRtfvfr051CfNIuKbiw1+xc3TADl bF6A== 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 e125si19650047qkc.352.2017.07.29.07.06.36; Sat, 29 Jul 2017 07:06:37 -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 AD67464478; Sat, 29 Jul 2017 14:06:36 +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 87E3462C6C; Sat, 29 Jul 2017 14:05:14 +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 806A9622F0; Sat, 29 Jul 2017 14:05:06 +0000 (UTC) Received: from forward4j.cmail.yandex.net (forward4j.cmail.yandex.net [5.255.227.22]) by lists.linaro.org (Postfix) with ESMTPS id 36A6362AEA for ; Sat, 29 Jul 2017 14:04:35 +0000 (UTC) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [77.88.29.85]) by forward4j.cmail.yandex.net (Yandex) with ESMTP id AAB7E20859 for ; Sat, 29 Jul 2017 17:04:33 +0300 (MSK) Received: from smtp2p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2p.mail.yandex.net (Yandex) with ESMTP id 570841A8009D for ; Sat, 29 Jul 2017 17:04:32 +0300 (MSK) Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id jNuvJAvdk4-4WdGqmRm; Sat, 29 Jul 2017 17:04:32 +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: Sat, 29 Jul 2017 17:04:20 +0300 Message-Id: <1501337066-32268-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1501337066-32268-1-git-send-email-odpbot@yandex.ru> References: <1501337066-32268-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 90 Subject: [lng-odp] [PATCH v1 4/10] linux-generic: packet: add initializations for new hdr fields 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 initializations for new packet hdr fields needed to support packet references. 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: 79336f5eaee25168a5e4ad7fc0aee07395d4ca1f ** Merge commit sha: 7572a3f8658171fac22a3770b32be6795a1861a8 **/ platform/linux-generic/include/odp_packet_internal.h | 4 ++++ platform/linux-generic/odp_packet.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 396d8cb5..e5887c9b 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -216,6 +216,10 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len) CONFIG_PACKET_TAILROOM; pkt_hdr->input = ODP_PKTIO_INVALID; + + /* By default packet has no references */ + pkt_hdr->unshared_len = len; + pkt_hdr->ref_hdr = NULL; } static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr, diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 38879a7f..8806be8a 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -253,6 +253,9 @@ void packet_parse_reset(odp_packet_hdr_t *pkt_hdr) pkt_hdr->p.l2_offset = 0; pkt_hdr->p.l3_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->p.l4_offset = ODP_PACKET_OFFSET_INVALID; + + /* Ensure dummy pkt hdrs used in I/O recv classification are valid */ + pkt_hdr->ref_hdr = NULL; } static inline void init_segments(odp_packet_hdr_t *pkt_hdr[], int num) @@ -265,6 +268,7 @@ static inline void init_segments(odp_packet_hdr_t *pkt_hdr[], int num) hdr->buf_hdr.seg[0].data = hdr->buf_hdr.base_data; hdr->buf_hdr.seg[0].len = BASE_LEN; + packet_ref_count_set(hdr, 1); /* Link segments */ if (CONFIG_PACKET_MAX_SEGS != 1) { @@ -274,6 +278,7 @@ static inline void init_segments(odp_packet_hdr_t *pkt_hdr[], int num) for (i = 1; i < num; i++) { odp_buffer_hdr_t *buf_hdr; + packet_ref_count_set(pkt_hdr[i], 1); buf_hdr = &pkt_hdr[i]->buf_hdr; hdr->buf_hdr.seg[i].hdr = buf_hdr; hdr->buf_hdr.seg[i].data = buf_hdr->base_data;