I apologize because I was wrong. I have identified how my program behaves and in the next few days I will (with pleasure) remove the structure declared "volatile static" by modifying the parts of code that make use of it... Thanks anyway Il giorno sab 30 mar 2024 alle ore 15:08 Marco <ctxspi@xxxxxxxxx> ha scritto: > > Helo > > I tried to use a secondary variable fib_params_test as a global > variable at the beginning of my XDP program like this: > > static volatile struct bpf_fib_lookup fib_params_test; > . > . > static __always_inline int function_process_packet(struct xdp_md *ctx, > u32 flags) > { > const __u32 ifingress = ctx->ingress_ifindex; > void *data_end = (void *)(long)ctx->data_end; > void *data = (void *)(long)ctx->data; > void *l3hdr = NULL; > struct bpf_fib_lookup fib_params; > > bpf_printk("Ingress interface %d", fib_params_test.ifindex); /* > the value displayed is always right */ > . > . > } > > > Once "fib_params_test" was initialized with the first packet received, > upon subsequent packets coming from different incoming vlan > interfaces, "fib_params_test.ifindex" always returned the interface I > expected. > Obviously I have always done tests with little traffic so I have the > doubt that in a real situation there may be unexpected values for the > fib_params_test.ifindex variable. This is possible? > > Thank you. > > Marco