From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00043.outbound.protection.outlook.com [40.107.0.43]) by dpdk.org (Postfix) with ESMTP id 3A1164C8E for ; Sun, 7 Oct 2018 09:38:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MySaOVrPXJv1fdlMr12YDLN59jvMh5036pUt9NnkhpY=; b=pahI3tubGELBCLEWC9FRmQRs9sfSSDrgW3UEQDlPl79f1NaR/tahJy/6AoSDN50YmN800g96HJNi/zZcelENFLZz7r66MtAFIrMJBuj8NAd/YnqprsCJ0+uKRVG55cps2B0yQaMjyNOvRQe957BkXtKWFKHLU42CriDqs9sxhhA= Received: from DB5PR05MB1254.eurprd05.prod.outlook.com (10.162.157.140) by DB5PR05MB1672.eurprd05.prod.outlook.com (10.165.6.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.27; Sun, 7 Oct 2018 07:38:11 +0000 Received: from DB5PR05MB1254.eurprd05.prod.outlook.com ([fe80::3516:b329:5c35:51a5]) by DB5PR05MB1254.eurprd05.prod.outlook.com ([fe80::3516:b329:5c35:51a5%2]) with mapi id 15.20.1185.029; Sun, 7 Oct 2018 07:38:11 +0000 From: Raslan Darawsheh To: "jingjing.wu@intel.com" CC: Thomas Monjalon , "dev@dpdk.org" , Shahaf Shuler , Raslan Darawsheh , "Xueming(Steven) Li" , Ori Kam , "jerin.jacob@caviumnetworks.com" , "david.marchand@6wind.com" , "bernard.iremonger@intel.com" Thread-Topic: [PATCH v4 3/3] app/testpmd: set packet dump based on verbosity level Thread-Index: AQHUXhCyni36MbSRZkisi9xJ6/r4vQ== Date: Sun, 7 Oct 2018 07:38:11 +0000 Message-ID: <1538897848-1693-3-git-send-email-rasland@mellanox.com> References: <1537793304-27883-1-git-send-email-rasland@mellanox.com> <1538897848-1693-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1538897848-1693-1-git-send-email-rasland@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HE1PR06CA0130.eurprd06.prod.outlook.com (2603:10a6:7:16::17) To DB5PR05MB1254.eurprd05.prod.outlook.com (2a01:111:e400:51cc::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR05MB1672; 6:DlXycTBF1YoY8L66EV8tH7wAM/I7z6FjhU/i3hygEGA+Yh8WS8/bPq4gskquAiz5pgEk8MByDIjKeqGv5Jex3dBREUkUBvaU8tvpfDfvSyfs4yGFUALx2DD6IgM7Os5znUkNzxVTojucPlPnrRxY4dZgyjNwXn6J7U3weAxivmzxTDwKDtwQvogP9GBdp541vfUUkSal0gKku3/cYSOxXeZBK84Ym/eJ7uSNDdOevPGVbfwxzSlIAM85HgvD3AhRTuZ112eRIuENPiZuLRwqjbIT8Pd0L4PrPmzJpHEplCAUOIGat9G7PQxwYNVrhyCuUpp/6sLB1gx4R8V7Nymi1rbS0x3RjUowuryCEr9YXnOoKbSHsSAcdQszxYONdkaMYFHrEnY4HmMK51+UbLqgc4sb5qlaJ1BQNRfioKlr18mwMhg+saE0SJ7cVxYqhCIxpySLBtBoLbRJFPAlSsa/Lg==; 5:UzDzu8H2mSsozbR/qj/5XLUfJUfwQ6j5ttpG8wtDhHptf/L95V2C9sxGSr5RfAM49E9hAhEhzsZYaqsxmjIQL3WFK+QwrBFm4MVPSX2odneAt4662eWLWCcGh6pZ+99CBD1h2Vx2djBKot3XG0P0Uqj3sgDd7cmOFbxDDaXZ5mE=; 7:fmMumImbIEB0esJozsHGCPxKfbTsiQXAEoy2Xd41xKZw8bA8j2VQxLvdRk/GtFDUYXPInKsadK2Qls2kFFUohADHAAAaB6dc7dVUJITA7ro9fxr54L1UyJQ44JcMgI9lY/E1209szeb6LGiqfR9Ht6Ef7UlQRVVJ3yEnw/+djA+kpubnfunEEIvY2eJMd6n3TH9TxlSnsN/dYIuaycrCMsrkqHh5P1hEQ38XF4DLQd6icvX77Cs65LBIRv2o3UXP x-ms-office365-filtering-correlation-id: e96c89bb-f067-45b7-77d4-08d62c27d515 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB5PR05MB1672; x-ms-traffictypediagnostic: DB5PR05MB1672: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB5PR05MB1672; BCL:0; PCL:0; RULEID:; SRVR:DB5PR05MB1672; x-forefront-prvs: 0818724663 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(366004)(346002)(396003)(376002)(189003)(199004)(86362001)(575784001)(478600001)(71190400001)(71200400001)(97736004)(305945005)(6436002)(5660300001)(7736002)(36756003)(53936002)(316002)(68736007)(2900100001)(14454004)(66066001)(256004)(102836004)(26005)(8936002)(2351001)(8676002)(486006)(5250100002)(5640700003)(25786009)(446003)(2501003)(54906003)(81166006)(6512007)(81156014)(476003)(2906002)(186003)(6916009)(11346002)(6506007)(386003)(99286004)(2616005)(50226002)(6116002)(4326008)(76176011)(3846002)(52116002)(6486002)(106356001)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1672; H:DB5PR05MB1254.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 1CFNJjoQmY/QDNdn+flJUOsjq90Rrn68lAp0nLv39bE5td6Wc5mo5rK8CYBs/4OGDHN2Fii633h+Z59LaQFPGDzhMFIpUqt3lsu/KC/acNdrRReGHv4bIdKw9+P0QN/n8f4g4b+oLh2fdoBveqlcVsf2Z0AsDZbm4e0hu8mZigEJFEuthWRTs94X8NLQKOZOthgqURWVFDs5cUryj2nBDsMwTO+NWybRoR2X9OlE3RNSkif2brWMzqKlivit4DtDn/mpJ8GZhdtrw/KbkhUR6FHb3aQwhwob2jlJH+LAGmUuvkVWO/04Jt6ZEffDLIiWyuvm9A3fCrErnDlDyoxi1imVzLdf1+0+H90wLjspwsE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e96c89bb-f067-45b7-77d4-08d62c27d515 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2018 07:38:11.4858 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1672 Subject: [dpdk-dev] [PATCH v4 3/3] app/testpmd: set packet dump based on verbosity level X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2018 07:38:14 -0000 when changing verbosity level it will configure rx/tx callbacks to dump packets based on the verbosity value as following: 1- dump only received packets: testpmd> set verbose 1 2- dump only sent packets: testpmd> set verbose 2 3- dump sent and received packets: testpmd> set verbose (any number > 2) 4- disable dump testpmd> set verbose 0 Signed-off-by: Raslan Darawsheh --- app/test-pmd/config.c | 25 +++++++++++++++++++++++++ app/test-pmd/testpmd.c | 4 ++-- app/test-pmd/testpmd.h | 1 + 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index fb45fea..f402e04 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -50,6 +50,7 @@ #endif #include #include +#include =20 #include "testpmd.h" =20 @@ -2963,11 +2964,35 @@ remove_tx_dump_callbacks(portid_t portid) } =20 void +configure_rxtx_dump_callbacks(uint16_t verbose) +{ + portid_t portid; + +#ifndef RTE_ETHDEV_RXTX_CALLBACKS + TESTPMD_LOG(ERR, "setting rxtx callbacks is not enabled\n"); + return; +#endif + + RTE_ETH_FOREACH_DEV(portid) + { + if (verbose =3D=3D 1 || verbose > 2) + add_rx_dump_callbacks(portid); + else + remove_rx_dump_callbacks(portid); + if (verbose >=3D 2) + add_tx_dump_callbacks(portid); + else + remove_tx_dump_callbacks(portid); + } +} + +void set_verbose_level(uint16_t vb_level) { printf("Change verbose level from %u to %u\n", (unsigned int) verbose_level, (unsigned int) vb_level); verbose_level =3D vb_level; + configure_rxtx_dump_callbacks(verbose_level); } =20 void diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 571ecb4..538723c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1665,7 +1665,7 @@ start_port(portid_t pid) return -1; } } - + configure_rxtx_dump_callbacks(0); printf("Configuring Port %d (socket %u)\n", pi, port->socket_id); /* configure port */ @@ -1764,7 +1764,7 @@ start_port(portid_t pid) return -1; } } - + configure_rxtx_dump_callbacks(verbose_level); /* start port */ if (rte_eth_dev_start(pi) < 0) { printf("Fail to start port %d\n", pi); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index c0d7656..e68710d 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -757,6 +757,7 @@ void add_rx_dump_callbacks(portid_t portid); void remove_rx_dump_callbacks(portid_t portid); void add_tx_dump_callbacks(portid_t portid); void remove_tx_dump_callbacks(portid_t portid); +void configure_rxtx_dump_callbacks(uint16_t verbose); =20 /* * Work-around of a compilation error with ICC on invocations of the --=20 2.7.4