From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50075.outbound.protection.outlook.com [40.107.5.75]) by dpdk.org (Postfix) with ESMTP id 55E661B3C0 for ; Wed, 3 Oct 2018 17:16:27 +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=QD8Xxn7ArsD6rcmQpLPvzWS6riQNncxgZ+1je+WF2R45aKDxkdpf9d6JnAy+s8lY/ZdKWp8MtwwfmRHVHWwWCPb12gq2VRqkRwmSvXdh4b5QVKSZROybnpI1M7lK4jj5Z5y+6iUK4TInTWGaRnR3D3yGB42VNuOoCeYAd1TKcsQ= Received: from DB5PR05MB1254.eurprd05.prod.outlook.com (10.162.157.140) by DB5PR05MB1301.eurprd05.prod.outlook.com (10.162.157.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.22; Wed, 3 Oct 2018 15:16:25 +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.026; Wed, 3 Oct 2018 15:16:25 +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 v3 3/3] app/testpmd: set packet dump based on verbosity level Thread-Index: AQHUWywMT5rebpr9pE6jRSnUjbrxNw== Date: Wed, 3 Oct 2018 15:16:25 +0000 Message-ID: <1538579773-23054-3-git-send-email-rasland@mellanox.com> References: <1537793304-27883-1-git-send-email-rasland@mellanox.com> <1538579773-23054-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1538579773-23054-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: AM0PR01CA0028.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::41) 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; DB5PR05MB1301; 6:HXdj2fs6mgZOtM0/eMHwHlrAJhEhMCeULGnHSeJfoKA2MubpS2u4emXmKpxCtTG1CZrHnLLFlNWCJhjEO7tQYa0nDuWLULRNIgVr7c484vRALFtq2SC3xAk69iPjWI75npX7HReDFNJ5Bmy5enNPru4wFUJEwFmyCmT73FDQh8tQxuORpR++pY94ndaN0vw5lmwtHeDbmoxeOX6y1PJRa6+NrS9B3fnNHppvGisgwadoibqAYodcSFYUTfZeewmzdqWLODLYq1gsl5tS9ad5jVHKaLGZhRw+nNIqCI6nJ0tmesgpX2dFs/hN3PK86nltpcPoHfNLmCgre5s4qPnk0Z/7GDakgY2/pQJSR+rt/OFEhv+xxhH0DAFILd6M4LnorS9tTVoMPT/LVlPrFGgh26pJZbla/g4mg32ZVxGG7D/zv2S2+AMz+C2uj7TYJNroG7J6fD/8QnvRlY4aasOHgA==; 5:sQEHqtcmGxv2HLeyi8ksUQ1gHu/KVbbpcrKGr3n/UH8jJt0jNIcD7ifq6QbolH6LGLj6X60kvyXCEWTDa2Q85EAwc6MrzHAxckhPzMWR+UPH1SuUHdX5go21XRRYvWJuDq6Ik7drDPD3d6eGnlOWZKD7Y1LTyR4sVg48DQ7fIDA=; 7:HBkeyA82yL1qN48Qf8P/h0tEvEVv46umHsBV6c7t8f6quf0QEqYziJJ2ukeW1cDnGa8N4+eMlB6i7iwhTWsWmKCgxTaTBnhSMOIj8HdLfbqVH77JsdOgW+S8nRXF1HowefgoLlvO/iFbqKxzlHK4O9/5WnppuvqqD/7K+RTy9DkTEw936eDNQayP2UV0n4Rjmwr1TS/1h0S9Gi8cjz+Texsu2GuCWEWM/3kNMDAmQ3gFBbaqNljhMxDK0AFvc8PZ x-ms-office365-filtering-correlation-id: 2970f18d-f9ed-4f28-ae84-08d629432f18 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:DB5PR05MB1301; x-ms-traffictypediagnostic: DB5PR05MB1301: 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)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051); SRVR:DB5PR05MB1301; BCL:0; PCL:0; RULEID:; SRVR:DB5PR05MB1301; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(39860400002)(366004)(189003)(199004)(2906002)(2616005)(8936002)(6436002)(476003)(478600001)(106356001)(68736007)(6486002)(5250100002)(186003)(5660300001)(97736004)(2900100001)(7736002)(76176011)(52116002)(305945005)(53936002)(5640700003)(99286004)(50226002)(575784001)(71200400001)(54906003)(71190400001)(2501003)(8676002)(81156014)(81166006)(486006)(36756003)(25786009)(102836004)(86362001)(6512007)(4326008)(6916009)(256004)(14454004)(105586002)(66066001)(316002)(6506007)(6116002)(2351001)(386003)(3846002)(446003)(11346002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1301; 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: nzKlOuZ/2GZXJO56NFJJoSb0rQDSs98VpYfT9O22dhLkAa+vndAIMP/shFt2F4vv9RnLpP0qmVSbTPjjY83JhfOeeyZBoTTc1CDsz+Nkuf2Ok9rtwfIl2LFAC/On0gz65ga4Px6nguOPRO1Sd1ojlJvphTglhWoPS7ti+sONnvpKVKZoEQWUXnLHaCL5e0vhlZaXUBB1rXTYg2hhA5qkmk7+aAA24WUo7jvzWgHxwEI6rIRYkJBLA3Frzn476YHVvGvdDxgtpUjhfKAmSWY4+9W/9NvHKnVzmKosi9y3nXaAQ8pM3lVPN93SOirXViBC6AxF1LiVwc/NnhY2JFDQ66rmJxVHyexi7UFQsGHundA= 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: 2970f18d-f9ed-4f28-ae84-08d629432f18 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 15:16:25.4452 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1301 Subject: [dpdk-dev] [PATCH v3 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: Wed, 03 Oct 2018 15:16:27 -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