Let's take this opportunity to have a look at the NIC's side of BPF offload.
Note I don't know much about microcode and MicroC, but hopefully, if I make a mistake, someone from @Netronome can correct me.https://twitter.com/qeole/status/1162277443882766336 …
-
Prikaži ovu nit
-
BPF offload starts in the nfp driver. It does a number of checks and sets up DMA mapping before actually reconfiguring the NIC. https://github.com/torvalds/linux/blob/80f232121b69cc69a31ccb2b38c1665d770b0710/drivers/net/ethernet/netronome/nfp/bpf/offload.c#L522 …pic.twitter.com/mMiFfBRyZx
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit -
The BPF program is received by the NIC's control plane (the README is worth a read, to get a grasp of the overall architecture). https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/apps/nic/app_control_lib.c#L376-L378 …pic.twitter.com/2j53sUxBLb
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit -
The MicroC function update_bpf_prog() writes the BPF program to the NIC's code store. Most of the code is there to ensure the write is atomic (since there are multiple threads per Flow Processing Core). https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/lib/nic_basic/_c/nic_internal.c#L491 …pic.twitter.com/GJpX9Earar
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit -
That's it! Loading BPF programs is pretty simple since most of the heavy lifting is performed in the kernel, thanks to the Netronome-specific JIT compiler: https://github.com/torvalds/linux/blob/a2d79c7174aeb43b13020dd53d85a7aefdd9f3e5/drivers/net/ethernet/netronome/nfp/bpf/jit.c …
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit -
We haven't seen how the BPF program is actually executed though. That happens in the microcode macro ebpf_call() in the NIC's datapath. It computes the jump offset, prepares the BPF stack, and jumps to the loaded program. https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/apps/nic/ebpf.uc#L173 …pic.twitter.com/kMpBTSD4xH
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit -
Looks like the ebpf_reentry() macro above ebpf_call() handles the return from BPF programs. It updates the statistics and applies the action (drop, pass to continue, or transmit on wire). https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/apps/nic/ebpf.uc#L137 …
1 reply 0 proslijeđenih tweetova 1 korisnik označava da mu se sviđaPrikaži ovu nit -
One missing piece of the BPF offload are the helpers. Most of them are inlined to microcode by the JIT compiler, except... the map helpers! The htab_map_lookup_subr_func() macro, for example, implements the hashmap lookups. https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/apps/nic/maps/hashmap.uc#L917 …
1 reply 0 proslijeđenih tweetova 1 korisnik označava da mu se sviđaPrikaži ovu nit -
htab_map_lookup_subr_func() defines a few return cases, but most of the code is in hashmap_ops(), a single macro for lots of different hashmap operations. https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/apps/nic/maps/hashmap.uc#L726 …
1 reply 0 proslijeđenih tweetova 1 korisnik označava da mu se sviđaPrikaži ovu nit -
hashmap_ops() first looks up the map (with hashmap_get_fd()) and the entry matching the key, then applies the hashmap operation. For example, in case of a lookup, it reads the hashmap entry in out_ent_addr with macro __hashmap_read_field(). https://github.com/Netronome/nic-firmware/blob/092d992f10fc8b4447baf352812f733de516b8b9/firmware/apps/nic/maps/hashmap.uc#L777-L784 …pic.twitter.com/stZ5Kn7TeO
1 reply 0 proslijeđenih tweetova 2 korisnika označavaju da im se sviđaPrikaži ovu nit
That's all I have for today (and until I get my hands on a microcode manual)!
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.