Dragos Stefan Falk
Dragos Stefan Falk

Reputation: 1

Is bpf_redirect between two network interfaces in combination with AF_XDP really zero copy?

I am trying to redirect using a bpf program with a simple bpf_redirect call from one interface to another.

Also want to mention that I also use xsk sockets on the interfaces and I am providing a shared umem to both sokets that atach to the interfaces. Tried to debug and I end up in :

static inline
struct xdp_frame *xdp_convert_buff_to_frame(struct xdp_buff *xdp)
{
    struct xdp_frame *xdp_frame;

    if (xdp->rxq->mem.type == MEM_TYPE_XSK_BUFF_POOL)
        return xdp_convert_zc_to_xdp_frame(xdp);

    /* Store info in top of packet */
    xdp_frame = xdp->data_hard_start;
    if (unlikely(xdp_update_frame_from_buff(xdp, xdp_frame) < 0))
        return NULL;

    /* rxq only valid until napi_schedule ends, convert to xdp_mem_info */
    xdp_frame->mem = xdp->rxq->mem;

    return xdp_frame;
}

It goes on xdp_convert_zc_to_xdp_frame where it seems to copy .

Upvotes: 0

Views: 89

Answers (0)

Related Questions