From patchwork Thu Jul 20 18:00:01 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: 108428 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2445667qge; Thu, 20 Jul 2017 11:03:07 -0700 (PDT) X-Received: by 10.55.19.29 with SMTP id d29mr6123375qkh.296.1500573787695; Thu, 20 Jul 2017 11:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500573787; cv=none; d=google.com; s=arc-20160816; b=ABg8jTIflM4YP6xYB5FkvhJV8BAXG4TqImV4ipeWzOfEn8bX97saiqvMvdAjpzmjLn JfYNgl+7XU84Tfs468z5fCeCOjzlx68spCS0WBGuWcTBws6usC4ns34tag0UUjVvJw11 fUWHyT3yEcKxRjf/SqKTr6OMJgXNn4bCYAiwDuO/3ydD1Ae9wAkCfg7WLHy+p2gyB+8+ YzTZsBdCNxi2m4E9RmCbOBCI9cOmIhioHflppdhpWsGgDos98Z4MALlMzbyV63vG/Ef+ ExWkGRc/MPLyuC01Nf7K7tMgEB7z1fSe8LClZTWP3OntQCb31S4r+srxpUyxZXarMllb +q2g== 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=VkFFlEpDGeg2kH0SikVeVdZNnPeHWds/uO9DJTodVhc=; b=sT32SxG03C7mKDDz513PD7m2MtowQrP5RavRN9Gib1bDgRll1yYMSBFXXxKDd+JQwJ XuGWjnjKXx1s60j2C0/pPgsWorQ0PfcmWmdb2x8Hdu0A3lF3GpYp4bx7wz52ohZw/obP FwjRO18Fx1HBTOo4MzSZlD/duEJl2y7iU7N+I02u//0cQ3Knl6B8gBQtysXrC15DiOgi bdqeV94jqOZYoSJCwswul+QUHSo2TN8cesC6NlvQOeqSjj5pJWxv6gsCDj5LGHTbcxPG EWRLT8/svGktjHH8Xo/As6wkv2ol9PUMl3xUdf7A4EQg0F89HD/tRSYCzDToOW9a8q0s bUlg== 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 o62si2338760qka.244.2017.07.20.11.03.07; Thu, 20 Jul 2017 11:03:07 -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 5CB02636AA; Thu, 20 Jul 2017 18:03:07 +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 56D7860804; Thu, 20 Jul 2017 18:00:35 +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 4A71F63505; Thu, 20 Jul 2017 18:00:22 +0000 (UTC) Received: from forward3o.cmail.yandex.net (forward3o.cmail.yandex.net [37.9.109.247]) by lists.linaro.org (Postfix) with ESMTPS id D5D8760CE0 for ; Thu, 20 Jul 2017 18:00:16 +0000 (UTC) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [95.108.252.166]) by forward3o.cmail.yandex.net (Yandex) with ESMTP id 62F63203BD for ; Thu, 20 Jul 2017 21:00:15 +0300 (MSK) Received: from smtp4p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp4p.mail.yandex.net (Yandex) with ESMTP id 1C6C66500E80 for ; Thu, 20 Jul 2017 21:00:14 +0300 (MSK) Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id a46hdQ3693-0EaGqxxJ; Thu, 20 Jul 2017 21:00:14 +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 21:00:01 +0300 Message-Id: <1500573607-18783-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500573607-18783-1-git-send-email-odpbot@yandex.ru> References: <1500573607-18783-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 82 Subject: [lng-odp] [PATCH v3 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 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: 01d093d362af5a52e079c622a99ae3495f68b64c **/ 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;