Re: [PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-06 Thread Toke Høiland-Jørgensen
David Beckett writes: > On 04/06/18 17:33, Toke Høiland-Jørgensen wrote: >> + >> +#define SAMPLE_SIZE 64ul >> + > The program currently cannot sample minimum sized packets, as the 4 Byte > crc checksum isnt present in ctx, > may be better to use 60ul sample size to allow for these packets to be

Re: [PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-06 Thread David Beckett
On 04/06/18 17:33, Toke Høiland-Jørgensen wrote: + +#define SAMPLE_SIZE 64ul + The program currently cannot sample minimum sized packets, as the 4 Byte crc checksum isnt present in ctx, may be better to use 60ul sample size to allow for these packets to be processed? + if (data + SAMPLE_

Re: [PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-05 Thread Toke Høiland-Jørgensen
Daniel Borkmann writes: > On 06/05/2018 12:32 AM, Jakub Kicinski wrote: >> On Mon, 04 Jun 2018 18:33:56 +0200, Toke Høiland-Jørgensen wrote: >>> + if (load_bpf_file(filename)) { >> >> Would you mind using libbpf instead of bpf_load.o? I converted some >> samples in be5bca44aa6b ("samples: bpf

Re: [PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-04 Thread Daniel Borkmann
On 06/05/2018 12:32 AM, Jakub Kicinski wrote: > On Mon, 04 Jun 2018 18:33:56 +0200, Toke Høiland-Jørgensen wrote: >> +if (load_bpf_file(filename)) { > > Would you mind using libbpf instead of bpf_load.o? I converted some > samples in be5bca44aa6b ("samples: bpf: convert some XDP samples from

Re: [PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-04 Thread Jakub Kicinski
On Mon, 04 Jun 2018 18:33:56 +0200, Toke Høiland-Jørgensen wrote: > + if (load_bpf_file(filename)) { Would you mind using libbpf instead of bpf_load.o? I converted some samples in be5bca44aa6b ("samples: bpf: convert some XDP samples from bpf_load to libbpf"), it's pretty straight forward. M

[PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example

2018-06-04 Thread Toke Høiland-Jørgensen
This adds an example program showing how to sample packets from XDP using the perf event buffer. The example userspace program just prints the ethernet header for every packet sampled. The example sets up a perf file descriptor per CPU, allowing the XDP program to pass BPF_F_CURRENT_CPU and work n