From f5edfd9d2d2842d5764ce75cff5031647bb91069 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Mon, 27 May 2024 17:36:32 -0400 Subject: [PATCH] dpif-netdev: Log packets. Signed-off-by: David Marchand --- lib/dpif-netdev.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index eb6aa1d22c5..a88b84bb306 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -5381,6 +5381,21 @@ dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd, if (cycles >= tx_cycles_warn_threshold) { VLOG_WARN("Tx on %s queue %u took %"PRIu64" cycles", netdev_get_name(p->port->netdev), i, cycles); +#if 0 + if (VLOG_IS_DBG_ENABLED()) { + struct dp_packet *pkt; + + DP_PACKET_BATCH_FOR_EACH(i, pkt, &p->output_pkts) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_hex_dump(&ds, dp_packet_data(pkt), + dp_packet_size(pkt), 0, false); + VLOG_DBG("Tx batch->packets[%"PRIuSIZE"]=%s", i, + ds_cstr(&ds)); + ds_destroy(&ds); + } + } +#endif } dp_packet_batch_init(&p->txq_pkts[i]); } @@ -5403,6 +5418,21 @@ dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd, if (cycles >= tx_cycles_warn_threshold) { VLOG_WARN("Tx on %s queue %u took %"PRIu64" cycles", netdev_get_name(p->port->netdev), tx_qid, cycles); +#if 0 + if (VLOG_IS_DBG_ENABLED()) { + struct dp_packet *pkt; + + DP_PACKET_BATCH_FOR_EACH(i, pkt, &p->output_pkts) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_hex_dump(&ds, dp_packet_data(pkt), + dp_packet_size(pkt), 0, false); + VLOG_DBG("Tx batch->packets[%"PRIuSIZE"]=%s", i, + ds_cstr(&ds)); + ds_destroy(&ds); + } + } +#endif } } dp_packet_batch_init(&p->output_pkts); @@ -5488,6 +5518,18 @@ dp_netdev_process_rxq_port(struct dp_netdev_pmd_thread *pmd, if (cycles >= rx_cycles_warn_threshold) { VLOG_WARN("Rx on %s queue %u took %"PRIu64" cycles", netdev_get_name(rxq->rx->netdev), rxq->rx->queue_id, cycles); + if (VLOG_IS_DBG_ENABLED() && !error) { + struct dp_packet *pkt; + + DP_PACKET_BATCH_FOR_EACH(i, pkt, &batch) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_hex_dump(&ds, dp_packet_data(pkt), dp_packet_size(pkt), + 0, false); + VLOG_DBG("Rx batch->packets[%"PRIuSIZE"]=%s", i, ds_cstr(&ds)); + ds_destroy(&ds); + } + } } if (!error) { /* At least one packet received. */ @@ -8540,6 +8582,14 @@ handle_packet_upcall(struct dp_netdev_pmd_thread *pmd, if (cycles >= upcall_cycles_warn_threshold) { VLOG_WARN("Upcall on port %u took %"PRIu64" cycles", orig_in_port, cycles); + if (VLOG_IS_DBG_ENABLED()) { + struct ds ds = DS_EMPTY_INITIALIZER; + + ds_put_hex_dump(&ds, dp_packet_data(packet), + dp_packet_size(packet), 0, false); + VLOG_DBG("Upcall packet=%s", ds_cstr(&ds)); + ds_destroy(&ds); + } } return error; }