if (unlikely(nb_rx == 0))
return;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
fs->rx_packets += nb_rx;
txp = &ports[fs->tx_port];
}
}
fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
do {
"set record-core-cycles on|off\n"
" Set the option to enable measurement of CPU cycles.\n"
+ "set record-burst-stats on|off\n"
+ " Set the option to enable display of RX and TX bursts.\n"
+
"set port (port_id) vf (vf_id) rx|tx on|off\n"
" Enable/Disable a VF receive/tranmit from a port\n\n"
},
};
+/* *** SET OPTION TO ENABLE DISPLAY OF RX AND TX BURSTS *** */
+struct cmd_set_record_burst_stats_result {
+ cmdline_fixed_string_t keyword;
+ cmdline_fixed_string_t name;
+ cmdline_fixed_string_t on_off;
+};
+
+static void
+cmd_set_record_burst_stats_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_set_record_burst_stats_result *res;
+ uint16_t on_off = 0;
+
+ res = parsed_result;
+ on_off = !strcmp(res->on_off, "on") ? 1 : 0;
+ set_record_burst_stats(on_off);
+}
+
+cmdline_parse_token_string_t cmd_set_record_burst_stats_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_record_burst_stats_result,
+ keyword, "set");
+cmdline_parse_token_string_t cmd_set_record_burst_stats_name =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_record_burst_stats_result,
+ name, "record-burst-stats");
+cmdline_parse_token_string_t cmd_set_record_burst_stats_on_off =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_record_burst_stats_result,
+ on_off, "on#off");
+
+cmdline_parse_inst_t cmd_set_record_burst_stats = {
+ .f = cmd_set_record_burst_stats_parsed,
+ .data = NULL,
+ .help_str = "set record-burst-stats on|off",
+ .tokens = {
+ (void *)&cmd_set_record_burst_stats_keyword,
+ (void *)&cmd_set_record_burst_stats_name,
+ (void *)&cmd_set_record_burst_stats_on_off,
+ NULL,
+ },
+};
+
/* *** CONFIGURE UNICAST HASH TABLE *** */
struct cmd_set_uc_hash_table {
cmdline_fixed_string_t set;
(cmdline_parse_inst_t *)&cmd_set_qmap,
(cmdline_parse_inst_t *)&cmd_set_xstats_hide_zero,
(cmdline_parse_inst_t *)&cmd_set_record_core_cycles,
+ (cmdline_parse_inst_t *)&cmd_set_record_burst_stats,
(cmdline_parse_inst_t *)&cmd_operate_port,
(cmdline_parse_inst_t *)&cmd_operate_specific_port,
(cmdline_parse_inst_t *)&cmd_operate_attach_port,
record_core_cycles = on_off;
}
+void
+set_record_burst_stats(uint8_t on_off)
+{
+ record_burst_stats = on_off;
+}
+
static inline void
print_fdir_mask(struct rte_eth_fdir_masks *mask)
{
/* receive a burst of packet */
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
if (unlikely(nb_rx == 0))
return;
fs->rx_bad_l4_csum += rx_bad_l4_csum;
fs->rx_bad_outer_l4_csum += rx_bad_outer_l4_csum;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
do {
}
fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_pkt)) {
/* Back out the flow counter. */
next_flow -= (nb_pkt - nb_tx);
*/
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
if (unlikely(nb_rx == 0))
return;
}
}
fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_replies)) {
fs->fwd_dropped += (nb_replies - nb_tx);
do {
*/
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue,
pkts_burst, nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
if (unlikely(nb_rx == 0))
return;
fs->rx_packets += nb_rx;
}
}
fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
do {
*/
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
if (unlikely(nb_rx == 0))
return;
}
fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
do {
*/
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
if (unlikely(nb_rx == 0))
return;
}
}
fs->tx_packets += nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_rx)) {
fs->fwd_dropped += (nb_rx - nb_tx);
do {
"--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
"--txpt= | --txht= | --txwt= | --txfreet= | "
"--txrst= | --tx-offloads= | | --rx-offloads= | "
- "--vxlan-gpe-port= | --record-core-cycles]\n",
+ "--vxlan-gpe-port= | --record-core-cycles | "
+ "--record-burst-stats]\n",
progname);
#ifdef RTE_LIBRTE_CMDLINE
printf(" --interactive: run in interactive mode.\n");
printf(" --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be "
"enabled\n");
printf(" --record-core-cycles: enable measurement of CPU cycles.\n");
+ printf(" --record-burst-stats: enable display of RX and TX bursts.\n");
}
#ifdef RTE_LIBRTE_CMDLINE
{ "no-iova-contig", 0, 0, 0 },
{ "rx-mq-mode", 1, 0, 0 },
{ "record-core-cycles", 0, 0, 0 },
+ { "record-burst-stats", 0, 0, 0 },
{ 0, 0, 0, 0 },
};
}
if (!strcmp(lgopts[opt_idx].name, "record-core-cycles"))
record_core_cycles = 1;
+ if (!strcmp(lgopts[opt_idx].name, "record-burst-stats"))
+ record_burst_stats = 1;
break;
case 'h':
usage(argv[0]);
*/
nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst,
nb_pkt_per_burst);
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
-#endif
+ inc_rx_burst_stats(fs, nb_rx);
if (unlikely(nb_rx == 0))
return;
*/
uint8_t record_core_cycles;
+/*
+ * Display of RX and TX bursts disabled by default
+ */
+uint8_t record_burst_stats;
+
unsigned int num_sockets = 0;
unsigned int socket_ids[RTE_MAX_NUMA_NODES];
return 0;
}
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
static void
pkt_burst_stats_display(const char *rx_tx, struct pkt_burst_stats *pbs)
{
sburstp += burst_percent[i];
}
}
-#endif /* RTE_TEST_PMD_RECORD_BURST_STATS */
static void
fwd_stream_stats_display(streamid_t stream_id)
printf("\n");
}
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- pkt_burst_stats_display("RX", &fs->rx_burst_stats);
- pkt_burst_stats_display("TX", &fs->tx_burst_stats);
-#endif
+ if (record_burst_stats) {
+ pkt_burst_stats_display("RX", &fs->rx_burst_stats);
+ pkt_burst_stats_display("TX", &fs->tx_burst_stats);
+ }
}
void
stats.opackets + ports_stats[pt_id].tx_dropped);
}
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- if (ports_stats[pt_id].rx_stream)
- pkt_burst_stats_display("RX",
- &ports_stats[pt_id].rx_stream->rx_burst_stats);
- if (ports_stats[pt_id].tx_stream)
- pkt_burst_stats_display("TX",
- &ports_stats[pt_id].tx_stream->tx_burst_stats);
-#endif
+ if (record_burst_stats) {
+ if (ports_stats[pt_id].rx_stream)
+ pkt_burst_stats_display("RX",
+ &ports_stats[pt_id].rx_stream->rx_burst_stats);
+ if (ports_stats[pt_id].tx_stream)
+ pkt_burst_stats_display("TX",
+ &ports_stats[pt_id].tx_stream->tx_burst_stats);
+ }
if (port->rx_queue_stats_mapping_enabled) {
printf("\n");
fs->rx_bad_l4_csum = 0;
fs->rx_bad_outer_l4_csum = 0;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats));
memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats));
-#endif
fs->core_cycles = 0;
}
}
/**< allocate mempool natively, use rte_pktmbuf_pool_create_extbuf */
};
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
/**
* The data structure associated with RX and TX packet burst statistics
* that are recorded for each forwarding stream.
struct pkt_burst_stats {
unsigned int pkt_burst_spread[MAX_PKT_BURST];
};
-#endif
/** Information for a given RSS type. */
struct rss_type_info {
/**< received packets has bad outer l4 checksum */
unsigned int gro_times; /**< GRO operation times */
uint64_t core_cycles; /**< used for RX and TX processing */
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
struct pkt_burst_stats rx_burst_stats;
struct pkt_burst_stats tx_burst_stats;
-#endif
};
/** Descriptor for a single flow. */
/* globals used for configuration */
extern uint8_t record_core_cycles; /**< Enables measurement of CPU cycles */
+extern uint8_t record_burst_stats; /**< Enables display of RX and TX bursts */
extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
extern int testpmd_logtype; /**< Log type for testpmd logs */
extern uint8_t interactive;
fs->core_cycles += rte_rdtsc() - start_tsc;
}
+static inline void
+inc_rx_burst_stats(struct fwd_stream *fs, uint16_t nb_rx)
+{
+ if (record_burst_stats)
+ fs->rx_burst_stats.pkt_burst_spread[nb_rx]++;
+}
+
+static inline void
+inc_tx_burst_stats(struct fwd_stream *fs, uint16_t nb_tx)
+{
+ if (record_burst_stats)
+ fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
+}
+
/* Prototypes */
unsigned int parse_item_list(char* str, const char* item_name,
unsigned int max_items,
void set_xstats_hide_zero(uint8_t on_off);
void set_record_core_cycles(uint8_t on_off);
+void set_record_burst_stats(uint8_t on_off);
void set_verbose_level(uint16_t vb_level);
void set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs);
void show_tx_pkt_segments(void);
if (txonly_multi_flow)
RTE_PER_LCORE(_ip_var) -= nb_pkt - nb_tx;
-#ifdef RTE_TEST_PMD_RECORD_BURST_STATS
- fs->tx_burst_stats.pkt_burst_spread[nb_tx]++;
-#endif
+ inc_tx_burst_stats(fs, nb_tx);
if (unlikely(nb_tx < nb_pkt)) {
if (verbose_level > 0 && fs->fwd_dropped == 0)
printf("port %d tx_queue %d - drop "
* ``--record-core-cycles``
Enable measurement of CPU cycles per packet.
+
+* ``--record-burst-stats``
+
+ Enable display of RX and TX burst stats.
This is equivalent to the ``--record-core-cycles command-line`` option.
+set record-burst-stats
+~~~~~~~~~~~~~~~~~~~~~~
+
+Set the displaying of RX and TX bursts::
+
+ testpmd> set record-burst-stats (on|off)
+
+Where:
+
+* ``on`` enables display of RX and TX bursts.
+
+* ``off`` disables display of RX and TX bursts.
+
+This is equivalent to the ``--record-burst-stats command-line`` option.
+
set burst
~~~~~~~~~