On Thu, Mar 18, 2021 at 4:49 AM Federico Parola <[email protected]> wrote: > > Hi, > the virtual function you are looking for is perf_submit_skb(): > > https://github.com/iovisor/bcc/blob/c8de00e1746e242cdcd68b4673a083bb467cd35e/src/cc/export/helpers.h#L193 > > Strangely it is not documented in the reference guide.
Thanks, Federico and others. Maybe one of you can add it to the reference_guide.md? We do have events.perf_submit there. Thanks! > > Best regards, > Federico Parola > > On 18/03/21 10:29, [email protected] wrote: > > Hi! > > Is it possible to pass full ethernet packet from XDP to user-mode app > > using BCC? > > I wrote C code like this: > > BPF_PERF_OUTPUT(captured_data); > > capture(struct xdp_md *ctx) > > { > > events.perf_submit(ctx, ...); > > } > > But there is no flags argument in perf_submit function (but > > bpf_perf_event_output has such argument). > > Without BCC I can write such code to pass full packet to user-mode: > > struct packet_info > > { > > uint32_t packet_len; > > uint32_t iface_id; > > }; > > struct bpf_map_def SEC("maps") captured_data = > > { > > .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, > > .key_size = sizeof(u32), > > .value_size = sizeof(u32), > > .max_entries = MAX_CPUS > > }; > > SEC("xdp") > > int capture_kern(struct xdp_md *ctx) > > { > > u32 len = ctx->data_end - ctx->data; > > u64 flags = BPF_F_CURRENT_CPU; > > flags |= (u64)len << 32; > > struct packet_info info = {len, ctx->ingress_ifindex}; > > bpf_perf_event_output(ctx, &captured_data, flags, &info, sizeof(info)); > > return XDP_PASS; > > } > > How can I do the same when using BCC? > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#1978): https://lists.iovisor.org/g/iovisor-dev/message/1978 Mute This Topic: https://lists.iovisor.org/mt/81425283/21656 Mute #bcc:https://lists.iovisor.org/g/iovisor-dev/mutehashtag/bcc Group Owner: [email protected] Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
