From patchwork Sun Mar 12 12:30:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 95172 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp783983qgd; Sun, 12 Mar 2017 05:34:26 -0700 (PDT) X-Received: by 10.200.44.235 with SMTP id 40mr28070667qtx.178.1489322066925; Sun, 12 Mar 2017 05:34:26 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id m72si12330591qki.161.2017.03.12.05.34.26; Sun, 12 Mar 2017 05:34:26 -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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 98AA8609A4; Sun, 12 Mar 2017 12:34:26 +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 A523560945; Sun, 12 Mar 2017 12:31:36 +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 E19D160945; Sun, 12 Mar 2017 12:31:31 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) by lists.linaro.org (Postfix) with ESMTPS id B066663C8D for ; Sun, 12 Mar 2017 12:30:56 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id 126so68150404oig.3 for ; Sun, 12 Mar 2017 05:30:56 -0700 (PDT) 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=SeaVa3wAev1oE0//8+ahpG52SBajO9EDZ+8Yx3Uinio=; b=hshIfm4MRTuivJC5vZKosnwIMp0Ms6frce5bSPpA41y0SdbuqdJE0tdS6vfrxrJAyP eytUSbzl5O5sTcgApIBm7wv3lXRn0pKtW0M9QJ41ckTCGPFGiO3mE3QJRe82+ipqQbSm qsHG0GyVzhWnrDvnfOcWekuC3e9wIrRyYc4KlgEpwXvKXhaDJC80ICYRORp5QeZDZ/V3 DSHTsUmWLTAEPNQG5n7NPemHIHLRGEAnAeIOrO+qgz8p8zTc3+nvLyZQ8GqilPWT1pvW /BuAeJkKIPox+GDI+m5ErNfZ3+WOu5wU+oB60LCw8p2xbD7DabRgEzFy46MudeC/wmeZ x5LQ== X-Gm-Message-State: AMke39l2QE7UcB0HOMUk3UIW2aHIJARJXwDODzCpLPnrfwqwuLcvXWi3Po+U7guTsVRQ+8LB57o= X-Received: by 10.202.89.139 with SMTP id n133mr13606585oib.70.1489321856210; Sun, 12 Mar 2017 05:30:56 -0700 (PDT) Received: from localhost.localdomain (cpe-70-121-83-241.austin.res.rr.com. [70.121.83.241]) by smtp.gmail.com with ESMTPSA id 62sm6663155otq.34.2017.03.12.05.30.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2017 05:30:55 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Sun, 12 Mar 2017 07:30:40 -0500 Message-Id: <20170312123045.3852-7-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.12.0.rc1 In-Reply-To: <20170312123045.3852-1-bill.fischofer@linaro.org> References: <20170312123045.3852-1-bill.fischofer@linaro.org> Subject: [lng-odp] [PATCHv2 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.12.0.rc1 diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 4bbb6199..16b482d3 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;