On 02/28/2017 06:01 AM, Tanja Ulmen wrote:
Hi Mauricio,

thank you for the example program, it works and I get both outputs.

Are you calling load_func() for the program in the .c file?
Yes I'm calling load_func() for the program. My program is similar to the endToEndTest.py of the P4 frontend (https://github.com/iovisor/bcc/blob/0c8c179fc1283600887efa46fe428022efc4151b/src/cc/frontends/p4/test/endToEndTest.py). Thus a small virtual network where each node has its own namespace.

I think the problem of my program is that the program with the tail-call is executed in a namespace, but I don't know exactly why this is a problem. I will keep on looking for the problem, but maybe you have some further ideas?
Unfortunately I don't have any idea for it.

As a comment, it is normal that "print prog_array.items()" prints [], the prog type array does not implement the lookup function.

Regards,
Mauricio

Regards,
Tanja


Am 23.02.2017 um 20:24 schrieb Mauricio Vasquez:
Hello Tanja,

On 02/20/2017 09:53 AM, Tanja Ulmen via iovisor-dev wrote:
Hi,

I'm new to eBPF and bcc and I hope this is the right platform for my question.
Welcome!
I have the following problem while working with a bpf program array map:

I have a C file that contains a program map like this:
BPF_TABLE("prog", int, int, prog_array, 2);

Later on it is called with
prog_array.call(ebpf_packet, 1);

The respective part of my python file looks like this:
b = BPF(src_file="./output.c")

prog = """
            int hello(struct __sk_buff* ebpf_packet) {
            bpf_trace_printk("Hello, World!\\n");
            return 0;
            }
            """

hw = BPF(text=prog)
hello_fn = hw.load_func("hello", BPF.SCHED_CLS)

prog_array = b["prog_array"]
prog_array[ctypes.c_int(1)] = ctypes.c_int(hello_fn.fd)

print prog_array.items()

The output of the last line is just an empty array [] and the subprogram "hello" is not called when I run the program. There is no error. I have also hash bpf tables where I can assign key and leaf without any problems and these tables are accessed correctly during the run.

Do you have any idea where my mistake could be?
Are you calling load_func() for the program in the .c file?
I modified one of the examples to add a tail call, you can see at [1].
Although print(prog_array.items()) shows an empty array, the second eBPF program is called. I tried to print the prog array in some other examples and I always get an empty one, I don't know why.

[1] https://gist.github.com/mvbpolito/6312896d2004efd189dff79e913df297

Regards,
Mauricio

Best regards,
Tanja


_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev



_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to