From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30064.outbound.protection.outlook.com [40.107.3.64]) by dpdk.org (Postfix) with ESMTP id 4F9C04C93 for ; Mon, 24 Sep 2018 14:49:10 +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=jrBPhu8IkjY9FTW7cseebeqYb/y9Kq2u5s+nzU+IFq5i1BhiPJmNcKNCLhPrls9KI23OhEMkd2olfn3J+taFb7qgxYTYKTgPcHNPTGPDwgGIeZQpo9dd4swpcUhkKyUutLd0ttEalViXTj2a6TIRGRpoUJ2UZo6t95LyiMS50As= Received: from DB5PR05MB1254.eurprd05.prod.outlook.com (10.162.157.140) by DB5PR05MB1205.eurprd05.prod.outlook.com (10.161.244.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Mon, 24 Sep 2018 12:49:07 +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.1164.017; Mon, 24 Sep 2018 12:49:07 +0000 From: Raslan Darawsheh To: "jingjing.wu@intel.com" CC: Thomas Monjalon , "dev@dpdk.org" , Shahaf Shuler , Raslan Darawsheh , "Xueming(Steven) Li" , Ori Katz , "jerin.jacob@caviumnetworks.com" , "david.marchand@6wind.com" Thread-Topic: [PATCH v2 3/3] app/testpmd: set packet dump based on verbosity level Thread-Index: AQHUVAT7TjQEldJBVEesMXwNIiJCdw== Date: Mon, 24 Sep 2018 12:49:07 +0000 Message-ID: <1537793304-27883-3-git-send-email-rasland@mellanox.com> References: <1536739583-29166-2-git-send-email-rasland@mellanox.com> <1537793304-27883-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1537793304-27883-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: VI1PR04CA0105.eurprd04.prod.outlook.com (2603:10a6:803:64::40) 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; DB5PR05MB1205; 6:OTJEUY+UjXOR0u37zXM9lOwRxQ/EIF9rPIbpV3SlybEbkEYVeS2uL6Wj70sGz7rxgY00xBn2vlzJQFFuF6ad/4NQzCFzYEWGept6AYBSukpkcA1U0XvkonfzwrxZcn1D/vS/4ixApesOQ66V9EMi5DSSIrH2Lu7ZUdo5cz5X3bARjGL9RjWt5PQ7Qvfw4OsoE+eMhnK5smcDDO7SOiGEgkE7yHcFtRe7KyANou5DU9yBygOhNy+/pvfTkqqxCELuAlbD6/ZWMwm8h6UvQBpoIChna1xOMH7915SlWkabwaFmEXGX5ShmPMwpV9L4I3BvRzEkCMaX24/n3kO98OIvknzMUWFBYVs2on2ReTp1Yjbl5HdH8kovrnwxbQZaR20kh6bfmlbBP1rjX5Qgm2SU9QW63AiJ0vEF7p+uOUWgZKzeuVICjsRNxDWmD78lusCHpaVaK48b9nM87sm4MdxaJQ==; 5:2+4uMiiGo8LYKSJh6gTn/S1l0ojzYbVKWwrkQPMyxqiX3lr5tD+RpVMEbesNY/VXlej/J/ajNUmjwfj0xEb2m3zXWeR4psPjXU2u7TxiZpp3YQDjvTeyAXBrICdAhphmw7RydiX3Wn7w8R4BkOOoXCS1Dj//p/DZqc/0i+fx5+8=; 7:QovLUY5TNIolkrHb6Qqr0ChWGSaUP7fn1GNrEBmcFoUPJIuK7X7xmHsh1P+woGU6SFThZYR59XQV+HUDeMXQE6vCW57diEOFhGsBl6S6ux5MtWPj+x8JO4jTgzj+cMjrZemtzmifYDdOaCMw5e0YloyQDgYhWSVIrEIPv+3aroaaToH+ddBZ50zEbHh+4ueW7GJJYpsAFrKn7msJQyPaL4o6B72bCDyHx2QZLaAmnyUllbDaKSZVFal/wrurNMC7 x-ms-office365-filtering-correlation-id: 5575ae32-9ff2-489c-9d8c-08d6221c1dc4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB5PR05MB1205; x-ms-traffictypediagnostic: DB5PR05MB1205: 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)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699051); SRVR:DB5PR05MB1205; BCL:0; PCL:0; RULEID:; SRVR:DB5PR05MB1205; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(2900100001)(71190400001)(386003)(6506007)(2351001)(102836004)(8936002)(36756003)(6486002)(478600001)(68736007)(6116002)(3846002)(5250100002)(2906002)(81166006)(81156014)(8676002)(25786009)(106356001)(53936002)(26005)(316002)(186003)(5640700003)(99286004)(86362001)(4326008)(52116002)(14454004)(105586002)(305945005)(6436002)(54906003)(11346002)(575784001)(476003)(7736002)(97736004)(446003)(256004)(2616005)(486006)(6512007)(71200400001)(50226002)(6916009)(66066001)(5660300001)(2501003)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1205; H:DB5PR05MB1254.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 6s+BC30RNi754O8MwUQOMAF4lfVYshnUtSgP+2GdI4sbuTZp6y/5FBEB4C6OUUGEFothfvphzus9CBNntEXtge2ZXdpqGZqOXEIKJH7qMOPvnuy1Cac0MsUwPKL7s2lanNYaJfBzssD5p3SwF15eWHuil77FM7dldsZXZevwAoJA6AALXzq5FO8L/4POO78UHLWqHrC5zhRF5rlJbtyXR4PAGuL4KfeeYjMTKWfpU+GOyoX7k+pNKwR6053rmq9xAb/RBs2nRDWYlsuAf/07OywdW2zBOvrfqaUeezo4QZo4mwtqS0Xnl4rUCTiG/DM7F8dJU8SBRSPwTXfU+cDbKA4bETi+NQPhkOX/bqCk++c= 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: 5575ae32-9ff2-489c-9d8c-08d6221c1dc4 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 12:49:07.8201 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1205 Subject: [dpdk-dev] [PATCH v2 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: Mon, 24 Sep 2018 12:49:10 -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