From patchwork Thu Sep 14 21:00:05 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: 112657 Delivered-To: patch@linaro.org Received: by 10.80.163.150 with SMTP id s22csp1047830edb; Thu, 14 Sep 2017 14:14:11 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAHhQjy61vPAROZxBB4Kam6sVkRwVZ1ZPV/poLhN8we8l5PCCtG0Lvb6ZCWZoLTj0fGUyin X-Received: by 10.55.97.198 with SMTP id v189mr4829237qkb.79.1505423650898; Thu, 14 Sep 2017 14:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505423650; cv=none; d=google.com; s=arc-20160816; b=KIurVbyk4rL//7E+xc8CidWl55B2tZb4tc9d8ipOA4iFxMjZ7X3cbsCqFT7apFN63/ azByZzEFzYrVXbebvow7ljQ1rskoG5Zb0bst4kL+ekESf2yYK4kLDRTreEeXMWtUzd4O GsCkmaKhjJQOZbIT0EV0Lvk5Ey3YjtkAEpsImcIY8CV3a9xz/v4e+6CExCI8C5a4Q1/z BbpyLUwHSli4TXtXpAEAKoUEbGD5YL7T1RvRXJyyFYfCFjKWKpuWjGOj8riyq51Ca9w9 mrVckf4Nj4KSvqdWg4rIDd1ylZqm3kn7TLZHwJ/0BKLTLfhoZux3iczbOVcPVXq7tGgo 5r1g== 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=jqs1jWodQszhSuIHcIz+Wy9OgTBSCbq6iZDGd82/1og=; b=pf/ww9kjrLGbPj7PsS1RM20TzEcSudmG/ns9Gv5BwjWKUyc1xv/ZRVcUDNHjwgAR+6 Wcb3wb2XkptiufXlHI7C7qXKCiX/JuKNR7fNawh8JBc8TmnpJa69tY2k1kYHNLY1Aqlz LskpeCvlLGlB0o69ypRBNSWWK3ScEyJpWjaQE9SlhLLfqOMt6T7hE40humRcMLS4cRFJ RntlyeUDGf5JHYIcQziNzgGhvQuin/eM/ZcwU0VUrZuxyfJCpEH9BERCjaUe4++Kc7X2 A/5SJgtdPFe/sMKbp0cB3cjcT1DXHzMVi77Zu4eEY4xHahjrJ80UmlQUbmiPOfNqd+gD wyVQ== 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 q2si18477639qkl.258.2017.09.14.14.14.10; Thu, 14 Sep 2017 14:14:10 -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 7C4EA608E3; Thu, 14 Sep 2017 21:14:10 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 0836D60C48; Thu, 14 Sep 2017 21:02:49 +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 4957760943; Thu, 14 Sep 2017 21:02:37 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 0931060965 for ; Thu, 14 Sep 2017 21:00:31 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 04DA52182967 for ; Fri, 15 Sep 2017 00:00:30 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id IEcBwtP9MI-0T6q14kg; Fri, 15 Sep 2017 00:00:30 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id wNwc7KZcGv-0Tm0AQxL; Fri, 15 Sep 2017 00:00:29 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Fri, 15 Sep 2017 00:00:05 +0300 Message-Id: <1505422809-5632-16-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1505422809-5632-1-git-send-email-odpbot@yandex.ru> References: <1505422809-5632-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 179 Subject: [lng-odp] [PATCH API-NEXT v1 15/19] linux-gen: packet: enhance segment prints 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: Petri Savolainen Print segment addresses and reference counts in addition to segment lengths. Signed-off-by: Petri Savolainen Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 179 (muvarov:api-next) ** https://github.com/Linaro/odp/pull/179 ** Patch: https://github.com/Linaro/odp/pull/179.patch ** Base sha: 6b6253c30f88c80bf632436ff06c1b000860a2f1 ** Merge commit sha: ada61f5ba5f940d03a95893940c21028d4c75d19 **/ platform/linux-generic/odp_packet.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 1a21ab0c6..5990f878d 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1579,11 +1579,13 @@ int _odp_packet_cmp_data(odp_packet_t pkt, uint32_t offset, * ******************************************************** * */ - void odp_packet_print(odp_packet_t pkt) { odp_packet_seg_t seg; - int max_len = 512; + seg_entry_t *seg_entry; + odp_packet_hdr_t *seg_hdr; + uint8_t idx; + int max_len = 1024; char str[max_len]; int len = 0; int n = max_len - 1; @@ -1619,12 +1621,22 @@ void odp_packet_print(odp_packet_t pkt) len += snprintf(&str[len], n - len, " num_segs %i\n", odp_packet_num_segs(pkt)); + seg_hdr = hdr; + idx = 0; seg = odp_packet_first_seg(pkt); while (seg != ODP_PACKET_SEG_INVALID) { + odp_buffer_hdr_t *buf_hdr; + + seg_entry = seg_entry_next(&seg_hdr, &idx); + buf_hdr = seg_entry->hdr; + len += snprintf(&str[len], n - len, - " seg_len %" PRIu32 "\n", - odp_packet_seg_data_len(pkt, seg)); + " seg_len %-4" PRIu32 " seg_data %p ", + odp_packet_seg_data_len(pkt, seg), + odp_packet_seg_data(pkt, seg)); + len += snprintf(&str[len], n - len, "ref_cnt %u\n", + buffer_ref(buf_hdr)); seg = odp_packet_next_seg(pkt, seg); }