Skip to content

Commit 4796e9f

Browse files
committed
Update docs.
1 parent 64a1668 commit 4796e9f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ At the end of the execution program will display per-IP and per-protocol statist
1515

1616
Program consists of the [eBPF code in C](counter.c) and the pure-Go userland Golang program that parses and outputs final IP/port/protocol/bitrate statistics. Go part of the program uses wonderful [cillium/ebpf](https://github.com/cilium/ebpf) library to load and run eBPF program, interfacing with eBPF map.
1717

18-
By default eBPF component uses **TC** (Traffic Control) eBPF hooks with TCX attaching requiring at minimum Linux kernel **v6.6** for both ingress and egress traffic statistics for TCP, UDP, ICMPv4 and ICMPv6. It can also switch to even faster [XDP](https://github.com/xdp-project/xdp-tutorial) (eXpress Data Path) hook but with a consequence of **losing egress statistics** since **XDP** works only in ingress path. XDP mode due to XDP program to network interface attaching calls requires at minimum Linux kernel **v5.9**. Some distributions might have backported XDP/TC patches (notable example is Red Hat Enterprise Linux kernel) and eBPF program might work on older kernels too.
18+
By default eBPF component uses **TC** (Traffic Control) eBPF hooks with TCX attaching requiring at minimum Linux kernel **v6.6** for both ingress and egress traffic statistics for TCP, UDP, ICMPv4 and ICMPv6. It can also switch to even faster [XDP](https://github.com/xdp-project/xdp-tutorial) (eXpress Data Path) hook but with a consequence of **losing egress statistics** since **XDP** works only in ingress path. XDP mode due to XDP program to network interface attaching calls requires at minimum Linux kernel **v5.9**. Some distributions might have backported XDP/TC patches (notable example is Red Hat Enterprise Linux kernel) and eBPF program might work on older kernels too (see requirements for more info).
1919

2020
Alternatively it can use **KProbes** to monitor TCP, UDP, ICMPv4 and ICMPv6 communication throughout all containers, K8s pods, translations and forwards and display process ID as well as process name, if the traffic was being sent or delivered to userspace application. KProbes traditionally work the slowest, being closest to the userspace -- but they bring sometimes useful process information. KProbes work also with much older Linux kernels as well, but the hard-dependancy is a [BTF-enabled](https://docs.ebpf.io/concepts/btf/) kernel.
2121

22+
In case that you need to monitor just a specific **CGroup**, it is possible as well and monitoring both ingress and egress traffic is supported.
23+
2224
![Demo](demo.gif)
2325

2426
## Talk
@@ -47,8 +49,9 @@ The following table maps features, requirements and expected performance for des
4749
| --------------------------------------------------- | ------- | ------ | -------------- | ---------------- | --------------- | ----------------- |
4850
| Generic [PCAP](https://github.com/dkorunic/pktstat) | Yes | Yes | Low | No | Any | No |
4951
| [AF_PACKET](https://github.com/dkorunic/pktstat) | Yes | Yes | Medium | No | v2.2 | No |
50-
| KProbes | Yes | Yes | Medium+ | **Yes** | v2.6 | No |
51-
| TC | Yes | Yes | **High** | No | v6.6 | No |
52+
| KProbes | Yes | Yes | Medium+ | **Yes** | v4.1 | No |
53+
| CGroup (SKB) | Yes | Yes | Medium+ | No | v4.10 | No |
54+
| TC (SchedACT) | Yes | Yes | **High** | No | v6.6 | No |
5255
| XDP Generic | Yes | **No** | **High** | No | v5.9 | No |
5356
| XDP Native | Yes | **No** | **Very high** | No | v5.9 | No |
5457
| XDP Offloaded | Yes | **No** | **Wire speed** | No | v5.9 | **Yes** |
@@ -67,6 +70,7 @@ NAME
6770
FLAGS
6871
-?, --help display help
6972
-j, --json if true, output in JSON format
73+
-c, --cgroup STRING the path to a CGroup V2 to measure statistics on
7074
-x, --xdp if true, use XDP instead of TC (this disables egress statistics)
7175
-k, --kprobes if true, use KProbes for per-proces TCP/UDP statistics
7276
-g, --tui if true, enable TUI
@@ -91,6 +95,8 @@ Additionally it is possible to change XDP attach mode with `--xdp_mode` from `au
9195
9296
With `--kprobes` program will switch to Kprobe mode and track TCP and UDP traffic per process. Performance will be even more degraded compared to TC and XDP mode, but all per-PID traffic will be visible, inside of all Cgroups, containers, K8s pods etc.
9397
98+
With `--cgroup` parameter with path to the CGroup it is possible to measure ingress and egress traffic for a specific CGroup.
99+
94100
## Star History
95101
96102
[![Star History Chart](https://api.star-history.com/svg?repos=dkorunic/pktstat,dkorunic/pktstat-bpf&type=Date)](https://star-history.com/#dkorunic/pktstat&dkorunic/pktstat-bpf&Date)

0 commit comments

Comments
 (0)