問題タブ [xdp-bpf]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c - ユーザー空間の XDP フックの PID を取得する
XDPフックからのeBPFマップからの受信データを処理するために、ユーザー側でマルチプロデューサーシングルコンシューマー実装を使用しています。
ただし、これを行うには、XDP フックがユーザー空間に情報を送信するために使用できるコアの数を 1 つずつ制限する必要があります。私が理解していることから、これを行う唯一の方法は、次のようにアフィニティを設定することです。
ただし、これを行うためにフックの PID を取得する方法がわかりません。
を使用しており、 および を介してBPF_MAP_TYPE_PERF_EVENT_ARRAY
カーニング コードをフックします。bpf_prog_load_xattr
bpf_set_link_xdp_fd
フックをロードする関数は次のとおりです。
そして、ここでそれが使用されます。
c - How to properly utilize masks to send index information to perf event output?
According to the documentation for bpf_perf_event_output found here: http://man7.org/linux/man-pages/man7/bpf-helpers.7.html
"The flags are used to indicate the index in map for which the value must be put, masked with BPF_F_INDEX_MASK."
In the following code:
It works as you would expect and stores the information for the given CPU number. However, suppose I want all packets to be sent to index 1.
I swap
for
The code compiles correctly and throws no errors, however no packets get saved at all anymore. What am I doing wrong if I want all of the packets to be sent to index 1?