BCC and passing packet from XDP to user-mode app #bcc


Is it possible to pass full ethernet packet from XDP to user-mode app using BCC?
I wrote C code like this:
int capture(struct xdp_md *ctx)
    captured_data.perf_submit(ctx, ...);
    return XDP_PASS;
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
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?

Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.