From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0041.outbound.protection.outlook.com [104.47.1.41]) by dpdk.org (Postfix) with ESMTP id 2073A5F65 for ; Wed, 17 Oct 2018 09:27:45 +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=QrbrkqGo7G8iEqCbI1tCD6UIbllv+Dai+xjy479np1o=; b=a13Tbj/oy6+sAsLh0XJGe0RsguOyLge9dyvXEWKxAxcuEmaT6Y5UINv01x9F3pnDtj1ufN9l60PBk+dD1an7dN7qGQRNm0YE+6JmTb68lyY5OwFjuYt9w0dRsD8QkImSDJT8j3nssJpKRSSECwwOgdLg8wK6Y59Ka5mjiip7Fl8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; Received: from mellanox.com (37.142.13.130) by DB5PR05MB1253.eurprd05.prod.outlook.com (2a01:111:e400:51cb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Wed, 17 Oct 2018 07:27:42 +0000 From: Raslan Darawsheh To: jingjing.wu@intel.com Cc: thomas@monjalon.net, dev@dpdk.org, shahafs@mellanox.com, rasland@mellanox.com, xuemingl@mellanox.com, orika@mellanox.com, jerin.jacob@caviumnetworks.com, david.marchand@6wind.com, bernard.iremonger@intel.com, ferruh.yigit@intel.com Date: Wed, 17 Oct 2018 10:27:30 +0300 Message-Id: <1539761251-7677-2-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539761251-7677-1-git-send-email-rasland@mellanox.com> References: <1538897848-1693-1-git-send-email-rasland@mellanox.com> <1539761251-7677-1-git-send-email-rasland@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: CWLP265CA0322.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:57::22) To DB5PR05MB1253.eurprd05.prod.outlook.com (2a01:111:e400:51cb::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63707c58-7770-4cf2-3d98-08d634020729 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:DB5PR05MB1253; X-Microsoft-Exchange-Diagnostics: 1; DB5PR05MB1253; 3:nRPfb5IL7P0/wZOglVxaJcUAdw1+NmC46V8twsWEdDF2UYydnIHgG9xk2tqpEH7XDO/Vi7GROW3jCZCjCernH1PLoIMQeBvfwAGG77qR03bbwFPag21u1rNWYMJORyaQsbbeMgha9om2/FSYJSBWikdFPt6tdvrNyiSLWLVrUqPy8dkhwf3I/T8NYcFn6zSScHWqkrei0ZJWMBBfniug3+AuUFSKPeIE3esaJbbODW1Ngor9FgELPFENvFAT7qwM; 25:0TDsQz4+g9iJ2FjcLiAXPl1JVo2m/kxY1HXolh7b7Ie4Skp+MNLmFYNMCIvg3zMhB8S03y3Xkxs7oazfuZ0S5Fv4KK3SQSsPStno4nzgHWwDcMkMTAcBMkdRgQ0dYK7jhOHD7Hl+XsI4k8vzhBFV4FZIB8RjWe1KnxgQhg0EwpHGpTp160pIw+1q8KqawzRH4Dd6JJ4+YtRX0U91Q8lKWhawhOAmbr4gvz9UvqCFw8M9y8j1HhQc19V0PqOEcKA/buODbtac1VE5TvabFbaanzzlaRf3zqM+YXp+7nyYe0gYd+lfc4IU2o/5mn3UU71wypE53Uht9xd/buSaW8ut3eYPGJH7tEpjUH1xjjIN0zY=; 31:gfZSJnOtVQ+6Kv/D9rmUL0g+ncQP3p52LXOpy1s/t2EXAxKRMqAXnqhZJsm2/GhWRwJSKl5illQ5SyL54Eb4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ClCse8hDlxeT38iwUJakYR+KYqtZRwsk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); 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)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB5PR05MB1253; BCL:0; PCL:0; RULEID:; SRVR:DB5PR05MB1253; X-Forefront-PRVS: 08286A0BE2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(346002)(136003)(39860400002)(376002)(366004)(199004)(189003)(33026002)(476003)(97736004)(50466002)(48376002)(55016002)(50226002)(16586007)(11346002)(21086003)(105586002)(36756003)(3846002)(106356001)(6116002)(446003)(2616005)(956004)(68736007)(69596002)(316002)(4326008)(2361001)(2351001)(7736002)(6666004)(53936002)(47776003)(25786009)(305945005)(66066001)(486006)(186003)(7696005)(52116002)(16526019)(81156014)(2906002)(26005)(8886007)(8676002)(86362001)(5660300001)(575784001)(386003)(81166006)(478600001)(6916009)(76176011)(8936002)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1253; H:mellanox.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-Exchange-Diagnostics: =?us-ascii?Q?1; DB5PR05MB1253; 23:Kmy3MtYd9kdKk4s12XzjdxldI/rs71NypmFseFJm2?= =?us-ascii?Q?ntMLgPZs8XLmpa1v6ooIqKJpW2O2Kcz87knMSjpxZV/ocTpRK5K1shSiunTD?= =?us-ascii?Q?/kCjduuXwXaFRPuFMiQkxmUJ+YkASK9olAucS9NdsO8gu57HATzVpu/I3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lcaJ1vNqS1P5f7hdX1djYcM8sqTs8nkDijGta/6O2PgIEhEomK7IrV+EPJloqPC0i6yrvGYrG3icz62J3upApcNHUV+jJ9W7ngvNuQhxpvNftYt4bxo7sgYyRIeAhavdpJAfX9+wbUjrCwO50vurY8e+aLNCycVpaw==; 5:pnZHljrmC/9F7qH/TipuSKcW0QTWzyvBkKpfDGHGHfcN7gmsdSaXD5nXJvoQx/Dqx6mvmyvmn/lHyC9nsNOOMSUPAw3NpdfVT78JFliSCrsH6inQBic44xaOrbgu+kkTVLNGP2w3ErH58is9cWvG9Bc8OrpekeEMR6tWnpDTX1E=; 7:JhwVfF1jtqoV/dUXpAA+5z6+PoTcAn2oXnYu8BRvKxHdnw7AT4vZauUgJh6SnWEyupAp0pJwdI+pButmqYcTNtfPhgk8BFlPsOI42pq+Rg2PKnO0j3H5LVvIoWeMxL21bbKamsMIgYsz1oBYveO7lljSv0zJrfq1yqaPaip0szW7frFjRTSgECww/k0cfPbtM1uxbinKTt1FoON6PNfI3Bdd7a3n4JZAU6XPP0SQuzfboHZc5Uye0MRLUSfeeHmp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2018 07:27:42.3617 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63707c58-7770-4cf2-3d98-08d634020729 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1253 Subject: [dpdk-dev] [PATCH v5 2/3] app/testpmd: add packet dump callback functions 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, 17 Oct 2018 07:27:45 -0000 add new rx/tx callback functions to be used for dumping the packets. Signed-off-by: Raslan Darawsheh Acked-by: Bernard Iremonger --- app/test-pmd/config.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 15 +++++++++++ app/test-pmd/util.c | 17 +++++++++++++ 3 files changed, 99 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index bf3cd0a..431fa2a 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2706,6 +2706,73 @@ set_pkt_forwarding_mode(const char *fwd_mode_name) } void +add_rx_dump_callbacks(portid_t portid) +{ + struct rte_eth_dev_info dev_info; + uint16_t queue; + + if (port_id_is_invalid(portid, ENABLED_WARN)) + return; + + rte_eth_dev_info_get(portid, &dev_info); + for (queue = 0; queue < dev_info.nb_rx_queues; queue++) + if (!ports[portid].rx_dump_cb[queue]) + ports[portid].rx_dump_cb[queue] = + rte_eth_add_rx_callback(portid, queue, + dump_rx_pkts, NULL); +} + +void +add_tx_dump_callbacks(portid_t portid) +{ + struct rte_eth_dev_info dev_info; + uint16_t queue; + + if (port_id_is_invalid(portid, ENABLED_WARN)) + return; + rte_eth_dev_info_get(portid, &dev_info); + for (queue = 0; queue < dev_info.nb_tx_queues; queue++) + if (!ports[portid].tx_dump_cb[queue]) + ports[portid].tx_dump_cb[queue] = + rte_eth_add_tx_callback(portid, queue, + dump_tx_pkts, NULL); +} + +void +remove_rx_dump_callbacks(portid_t portid) +{ + struct rte_eth_dev_info dev_info; + uint16_t queue; + + if (port_id_is_invalid(portid, ENABLED_WARN)) + return; + rte_eth_dev_info_get(portid, &dev_info); + for (queue = 0; queue < dev_info.nb_rx_queues; queue++) + if (ports[portid].rx_dump_cb[queue]) { + rte_eth_remove_rx_callback(portid, queue, + ports[portid].rx_dump_cb[queue]); + ports[portid].rx_dump_cb[queue] = NULL; + } +} + +void +remove_tx_dump_callbacks(portid_t portid) +{ + struct rte_eth_dev_info dev_info; + uint16_t queue; + + if (port_id_is_invalid(portid, ENABLED_WARN)) + return; + rte_eth_dev_info_get(portid, &dev_info); + for (queue = 0; queue < dev_info.nb_tx_queues; queue++) + if (ports[portid].tx_dump_cb[queue]) { + rte_eth_remove_tx_callback(portid, queue, + ports[portid].tx_dump_cb[queue]); + ports[portid].tx_dump_cb[queue] = NULL; + } +} + +void set_verbose_level(uint16_t vb_level) { printf("Change verbose level from %u to %u\n", diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 121b756..0e923d7 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -191,6 +191,8 @@ struct rte_port { uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ struct port_flow *flow_list; /**< Associated flows. */ + const struct rte_eth_rxtx_callback *rx_dump_cb[MAX_QUEUE_ID+1]; + const struct rte_eth_rxtx_callback *tx_dump_cb[MAX_QUEUE_ID+1]; #ifdef SOFTNIC struct softnic_port softport; /**< softnic params */ #endif @@ -764,6 +766,19 @@ int check_nb_rxq(queueid_t rxq); queueid_t get_allowed_max_nb_txq(portid_t *pid); int check_nb_txq(queueid_t txq); + +uint16_t dump_rx_pkts(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], + uint16_t nb_pkts, __rte_unused uint16_t max_pkts, + __rte_unused void *user_param); + +uint16_t dump_tx_pkts(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], + uint16_t nb_pkts, __rte_unused void *user_param); + +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); + /* * Work-around of a compilation error with ICC on invocations of the * rte_be_to_cpu_16() function. diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 4fcb2f9..27908c6 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -149,3 +149,20 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], printf(" ol_flags: %s\n", buf); } } + +uint16_t +dump_rx_pkts(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], + uint16_t nb_pkts, __rte_unused uint16_t max_pkts, + __rte_unused void *user_param) +{ + dump_pkt_burst(port_id, queue, pkts, nb_pkts, 1); + return nb_pkts; +} + +uint16_t +dump_tx_pkts(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], + uint16_t nb_pkts, __rte_unused void *user_param) +{ + dump_pkt_burst(port_id, queue, pkts, nb_pkts, 0); + return nb_pkts; +} -- 2.7.4