From patchwork Wed Oct 25 12:00:04 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: 117108 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp763142qgn; Wed, 25 Oct 2017 05:04:25 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Ri3tLVvSv4Y0T58SzZA8UKzk15TCBXiSDLpYl2OiT1ya8OHJ1RRaRl/7INvuI33ISkG8KD X-Received: by 10.55.22.132 with SMTP id 4mr2672929qkw.39.1508933064898; Wed, 25 Oct 2017 05:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508933064; cv=none; d=google.com; s=arc-20160816; b=Vfi5K3JOZrbHfCQr6SOUJQp3HeHD4t0ARxuChDtN5UPShUDMgRKIDAAj9JoSgjcf9e umReHHe0VuIDTC4DxJ9iJ11RqW8gc3U7gx18GsguQpCAv9bX10L9+K1NeAwpHRmoWuZa WWHeKTx4yvm6r7fP7GpG/v75+/jlsIQzCQ/pORQb9WaagnP1m+Dxjm54TBLwb4mbbDn1 DbosmZECYrNv7dx+rlGaQ51HZuV4HJiqr6jbtgTjM64/ckchHIe0NiHyYpBhBHlkikqb 9Ks82y7c4gfggF917RKz42WsX2kGxEkQRy5rA7WIaO36mWP5Nhrd5nxq2FUN92KHXa6u pYsw== 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=PY8ORdJ366ovdEmA5V3eR5QwevGR7agoN6dR//7JSZM=; b=G/nR5PkAB62D0nJT61qQJh2ha8wkrg9pZRQd2Ssx4x2ylTlAxJif+QaVOPvICyjJzX WRqgaU1M6YrT+9W+5UO4I9SDy0/3/DMF3wIewVghniAvpNFsd2jaYpy5IGVZEKeCfMMD kUovufe6OD/BOQln7ADlxf962eJHYCBZfvUJTQsc6ERbOX86kxcaIhzBqIrDs6Qsfhwk /0PtIsUFpY3Ab6XjfoDilju4jX9EH3Wa00KXsWUbYjGNZiPGWbrg0IytRUxSqj2HlmTi FcBecU2WCHgzeSKxWp7J1ZO+2bzYNzNsLHNH4nqr6HCJSmq8LC1T9FZalTKAeZW4qr+i qfrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id r15si2267796qtk.70.2017.10.25.05.04.24; Wed, 25 Oct 2017 05:04:24 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 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 8252260B56; Wed, 25 Oct 2017 12:04:24 +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 C90C660B2A; Wed, 25 Oct 2017 12:02:27 +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 9ED92608E6; Wed, 25 Oct 2017 12:01:53 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id A966560810 for ; Wed, 25 Oct 2017 12:00:35 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 224B42D8687C for ; Wed, 25 Oct 2017 15:00:34 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xcQVLgMy2T-0YS06a2c; Wed, 25 Oct 2017 15:00:34 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7HeNqY4tnt-0X8exRU4; Wed, 25 Oct 2017 15:00:33 +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: Wed, 25 Oct 2017 15:00:04 +0300 Message-Id: <1508932806-2089-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508932806-2089-1-git-send-email-odpbot@yandex.ru> References: <1508932806-2089-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 258 Subject: [lng-odp] [PATCH API-NEXT v1 1/3] api: packet: print packet data 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 Added debug print function which includes packet payload bytes. Printing starts from offset, so it's easy to e.g. limit print to IPv4 header bytes only: odp_packet_print_data(pkt, l3_offset(pkt), 20) Signed-off-by: Petri Savolainen --- /** Email created from pull request 258 (psavol:next-packet-dump) ** https://github.com/Linaro/odp/pull/258 ** Patch: https://github.com/Linaro/odp/pull/258.patch ** Base sha: 63d92eb289261d1534b5b9e1e04291faa5e45d30 ** Merge commit sha: 08d635e94f01265704fddd47cd98b0ccbdc669d4 **/ include/odp/api/spec/packet.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 62ecf70e1..3fc460641 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1561,15 +1561,28 @@ void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj); */ /** - * Print packet to the console + * Print packet debug information * - * Print all packet debug information to the console. + * Print all packet debug information to the ODP log. * * @param pkt Packet handle */ void odp_packet_print(odp_packet_t pkt); /** + * Print packet data + * + * Print packet debug information with packet data to the ODP log. Operation + * prints 'len' bytes of packet data starting from 'offset' byte. Offset plus + * length must not exceed packet length (odp_packet_len()). + * + * @param pkt Packet handle + * @param offset Byte offset into the packet + * @param len Number of bytes to print + */ +void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, uint32_t len); + +/** * Perform full packet validity check * * The operation may consume considerable number of cpu cycles depending on