From patchwork Sun Mar 5 12:21:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 94901 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp988752qgd; Sun, 5 Mar 2017 04:24:29 -0800 (PST) X-Received: by 10.200.35.135 with SMTP id q7mr11335980qtq.206.1488716669861; Sun, 05 Mar 2017 04:24:29 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 64si13394857qks.68.2017.03.05.04.24.29; Sun, 05 Mar 2017 04:24:29 -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 89EC260A57; Sun, 5 Mar 2017 12:24:29 +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_H3, RCVD_IN_MSPIKE_WL, 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 B87DC63D1B; Sun, 5 Mar 2017 12:22:07 +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 6FBB460A57; Sun, 5 Mar 2017 12:22:01 +0000 (UTC) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by lists.linaro.org (Postfix) with ESMTPS id D990D60A45 for ; Sun, 5 Mar 2017 12:21:34 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id v186so44962113wmd.0 for ; Sun, 05 Mar 2017 04:21:34 -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=uakt5KqPptpQck27JfVJZMfQFMeDSufaRtpKkhB+47Y=; b=qBagl4Mz9JbZGckXBvoWjBvzWgrW645bonRCzb84x7biv7AGlFdQAKwyL92ygbXpe2 7Q+km2wHvBiolFgFV2QXBrd1BZA5/2v4wN0HrTG0aLGvU8S/awXZTmKdxIAbdon6tg3H 7vGtRsQzSB8FimvyEXUTAPk1O5ZLREir8I7+npN/ZNdjQO+YX3FpgFT1HQNfR3jUhvZb +v8v7OvsHhZVX1QqJwpjl9lxpxJMqxLYnGb+5/5XLp7EGqPkv20rA1nnKPyiZa7GqBGj 4UmRZEmtLhLXFyBcpU4GC6ZFBQwl4cs4A2/Fa9iiGv5D2dk0PjUPPJfHEQ4ak3eesqDa VSAg== X-Gm-Message-State: AMke39nsrQYJi/JJxA7PFnvDvWD13xtYfMHooEuRPi89rawi4ZmHO/EEcFsMMjvAH2ek8YxJjGA= X-Received: by 10.28.127.149 with SMTP id a143mr937303wmd.87.1488716493923; Sun, 05 Mar 2017 04:21:33 -0800 (PST) Received: from Ubuntu15.localdomain ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id 127sm10686971wmt.20.2017.03.05.04.21.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Mar 2017 04:21:33 -0800 (PST) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 5 Mar 2017 13:21:20 +0100 Message-Id: <1488716485-15002-7-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 06/11] 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" Add initializations for new packet hdr fields needed to support packet references. Signed-off-by: Bill Fischofer --- platform/linux-generic/odp_packet.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.5.0 diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 4bbb619..16b482d 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -255,6 +255,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; } /** @@ -300,6 +303,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 init_segments(odp_packet_hdr_t *pkt_hdr[], int num) @@ -312,6 +319,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) { @@ -321,6 +329,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;