Subject: Re: [PATCH v3 bpf-next 9/9] selftest: add tests for XDP programs in CPUMAP entries

From: Lorenzo Bianconi <[email-masked]>
Date: Wed, 24 Jun 2020 17:37:23 +0200

> On Tue, Jun 23, 2020 at 2:40 PM Lorenzo Bianconi <[email-masked]> wrote:
> >
> > Similar to what have been done for DEVMAP, introduce tests to verify

[...]

> > +SEC("xdp_cpumap/dummy_cm")
> > +int xdp_dummy_cm(struct xdp_md *ctx)
> > +{
> > +       char fmt[] = "devmap redirect: dev %u len %u\n";
> > +       void *data_end = (void *)(long)ctx->data_end;
> > +       void *data = (void *)(long)ctx->data;
> > +       unsigned int len = data_end - data;
> > +
> > +       ingress_ifindex = ctx->ingress_ifindex;
> 
> Have you checked the generated BPF assembly to verify
> ctx->ingress_ifindex is actually read? ingress_ifindex variable is
> declared static, so I'm guessing Clang just optimized it away. If you
> want to be sure this actually gets executed, make ingress_ifindex
> global var.

ack, thx for the review. I will fix it in v4.

Regards,
Lorenzo

> 
> > +
> > +       return XDP_PASS;
> > +}
> > +
> > +char _license[] SEC("license") = "GPL";
> > --
> > 2.26.2
> >