map_fd = bpf_map__fd(skel->maps.netcnt); if (!ASSERT_OK(bpf_map_get_next_key(map_fd, NULL, &key), "bpf_map_get_next_key")) goto err;
if (!ASSERT_OK(bpf_map_lookup_elem(map_fd, &key, &netcnt), "bpf_map_lookup_elem(netcnt)")) goto err;
percpu_map_fd = bpf_map__fd(skel->maps.percpu_netcnt); if (!ASSERT_OK(bpf_map_lookup_elem(percpu_map_fd, &key, &percpu_netcnt[0]), "bpf_map_lookup_elem(percpu_netcnt)")) goto err;
/* Some packets can be still in per-cpu cache, but not more than * MAX_PERCPU_PACKETS.
*/
packets = netcnt.packets;
bytes = netcnt.bytes; for (cpu = 0; cpu < nproc; cpu++) {
ASSERT_LE(percpu_netcnt[cpu].packets, MAX_PERCPU_PACKETS, "MAX_PERCPU_PACKETS");
/* No packets should be lost */
ASSERT_GE(packets, 10000, "packets");
/* Let's check that bytes counter matches the number of packets * multiplied by the size of ipv6 ICMP packet.
*/
ASSERT_GE(bytes, packets * 104, "bytes");
err: if (cg_fd != -1)
close(cg_fd);
free(percpu_netcnt);
netcnt_prog__destroy(skel);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.