Topics

add prog id to prog map

Иван Иванов
 

I created prog_map in my kern.o and call bpf_tail_call to it. Loaded with ip link set... Loaded another prog with bpftool. So tried to update map with bpftool woth id of my second progbut it does not work. Can i use tail calls only like in sockx3, where all progs are in the same file? If not, can you give some examples?
And can i use tail_calls not with sock_buff but with xdp_md context?

Jakub Kicinski
 

On Wed, 20 Feb 2019 08:45:21 -0800, Иван Иванов wrote:
I created prog_map in my kern.o and call bpf_tail_call to it. Loaded with ip link set... Loaded another prog with bpftool. So tried to update map with bpftool woth id of my second progbut it does not work. Can i use tail calls only like in sockx3, where all progs are in the same file? If not, can you give some examples?
And can i use tail_calls not with sock_buff but with xdp_md context?
Do you pin the tail call map? If tail call map is not kept open or
pinned it will get flushed by the kernel (latest bpftool will print a
warning about it). sockex3 keeps the fd open, that's why it works.
When using bpftool you probably want to pin the map in bpffs.

Иван Иванов
 

I loaded tail call prog with map via ip util, i do not know, if it pin map. But i can see it in list of maps via bpftool map with id

0:31, 21 февраля 2019 г., Jakub Kicinski <jakub.kicinski@...>:

On Wed, 20 Feb 2019 08:45:21 -0800, Иван Иванов wrote:

 I created prog_map in my kern.o and call bpf_tail_call to it. Loaded with ip link set... Loaded another prog with bpftool. So tried to update map with bpftool woth id of my second progbut it does not work. Can i use tail calls only like in sockx3, where all progs are in the same file? If not, can you give some examples?
 And can i use tail_calls not with sock_buff but with xdp_md context?


Do you pin the tail call map? If tail call map is not kept open or
pinned it will get flushed by the kernel (latest bpftool will print a
warning about it). sockex3 keeps the fd open, that's why it works.
When using bpftool you probably want to pin the map in bpffs.



--
Отправлено из мобильного приложения Яндекс.Почты

Jakub Kicinski
 

On Thu, 21 Feb 2019 07:33:57 +0300, Иван Иванов wrote:
I loaded tail call prog with map via ip util, i do not know, if it
pin map. But i can see it in list of maps via bpftool map with id
Try:

bpftool map pin id $YOUR_ID /sys/fs/bpf/my_map

and see if the prog array updates stick after that.

Иван Иванов
 

map updates, but next xdp prog do not work, so i think i make something wrong or does not understand something

7:48, 21 февраля 2019 г., Jakub Kicinski <jakub.kicinski@...>:

On Thu, 21 Feb 2019 07:33:57 +0300, Иван Иванов wrote:

 I loaded tail call prog with map via ip util, i do not know, if it
 pin map. But i can see it in list of maps via bpftool map with id


Try:

bpftool map pin id $YOUR_ID /sys/fs/bpf/my_map

and see if the prog array updates stick after that.



--
Отправлено из мобильного приложения Яндекс.Почты