Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/xsk: print per packet info in verbose mode

Print info about every packet in verbose mode, both for Tx and
Rx. This is useful to have when a test fails or to validate that a
test is really doing what it was designed to do. Info on what is
supposed to be received and sent is also printed for the custom packet
streams since they differ from the base line. Here is an example:

Tx addr: 37e0 len: 64 options: 0 pkt_nb: 8
Tx addr: 4000 len: 64 options: 0 pkt_nb: 9
Rx: addr: 100 len: 64 options: 0 pkt_nb: 0 valid: 1
Rx: addr: 1100 len: 64 options: 0 pkt_nb: 1 valid: 1
Rx: addr: 2100 len: 64 options: 0 pkt_nb: 4 valid: 1
Rx: addr: 3100 len: 64 options: 0 pkt_nb: 8 valid: 1
Rx: addr: 4100 len: 64 options: 0 pkt_nb: 9 valid: 1

One pointless verbose print statement is also deleted and another one
is made clearer.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/r/20230914084900.492-2-magnus.karlsson@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Magnus Karlsson and committed by
Alexei Starovoitov
2d2712ca 558c50cc

+10 -3
+10 -3
tools/testing/selftests/bpf/xskxceiver.c
··· 747 747 len = 0; 748 748 } 749 749 750 + print_verbose("offset: %d len: %u valid: %u options: %u pkt_nb: %u\n", 751 + pkt->offset, pkt->len, pkt->valid, pkt->options, pkt->pkt_nb); 752 + 750 753 if (pkt->valid && pkt->len > pkt_stream->max_pkt_len) 751 754 pkt_stream->max_pkt_len = pkt->len; 752 755 pkt_nb++; ··· 1045 1042 return TEST_FAILURE; 1046 1043 } 1047 1044 1045 + print_verbose("Rx: addr: %lx len: %u options: %u pkt_nb: %u valid: %u\n", 1046 + addr, desc->len, desc->options, pkt->pkt_nb, pkt->valid); 1047 + 1048 1048 if (!is_frag_valid(umem, addr, desc->len, pkt->pkt_nb, pkt_len) || 1049 1049 !is_offset_correct(umem, pkt, addr) || 1050 1050 (ifobj->use_metadata && !is_metadata_correct(pkt, umem->buffer, addr))) ··· 1170 1164 pkt_generate(ifobject, tx_desc->addr, tx_desc->len, pkt->pkt_nb, 1171 1165 bytes_written); 1172 1166 bytes_written += tx_desc->len; 1167 + 1168 + print_verbose("Tx addr: %llx len: %u options: %u pkt_nb: %u\n", 1169 + tx_desc->addr, tx_desc->len, tx_desc->options, pkt->pkt_nb); 1173 1170 1174 1171 if (nb_frags_left) { 1175 1172 i++; ··· 1484 1475 thread_common_ops_tx(test, ifobject); 1485 1476 } 1486 1477 1487 - print_verbose("Sending %d packets on interface %s\n", ifobject->pkt_stream->nb_pkts, 1488 - ifobject->ifname); 1489 1478 err = send_pkts(test, ifobject); 1490 1479 1491 1480 if (!err && ifobject->validation_func) ··· 1722 1715 if (testapp_validate_traffic(test)) 1723 1716 return TEST_FAILURE; 1724 1717 1725 - print_verbose("Switching Tx/Rx vectors\n"); 1718 + print_verbose("Switching Tx/Rx direction\n"); 1726 1719 swap_directions(&test->ifobj_rx, &test->ifobj_tx); 1727 1720 res = __testapp_validate_traffic(test, test->ifobj_rx, test->ifobj_tx); 1728 1721