Skip to content

Commit

Permalink
dpif-netdev: Log packets.
Browse files Browse the repository at this point in the history
Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed May 28, 2024
1 parent 8fba656 commit f5edfd9
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit f5edfd9

Please sign in to comment.