[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191030115009.6168b50f@cakuba.netronome.com>
Date: Wed, 30 Oct 2019 11:50:09 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Cc: davem@...emloft.net,
Krzysztof Kazimierczak <krzysztof.kazimierczak@...el.com>,
netdev@...r.kernel.org, nhorman@...hat.com, sassmann@...hat.com,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>,
Andrew Bowers <andrewx.bowers@...el.com>
Subject: Re: [net-next 5/9] ice: Add support for AF_XDP
On Tue, 29 Oct 2019 20:29:06 -0700, Jeff Kirsher wrote:
> +/**
> + * ice_run_xdp_zc - Executes an XDP program in zero-copy path
> + * @rx_ring: Rx ring
> + * @xdp: xdp_buff used as input to the XDP program
> + *
> + * Returns any of ICE_XDP_{PASS, CONSUMED, TX, REDIR}
> + */
> +static int
> +ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp)
> +{
> + int err, result = ICE_XDP_PASS;
> + struct bpf_prog *xdp_prog;
> + struct ice_ring *xdp_ring;
> + u32 act;
> +
> + rcu_read_lock();
> + xdp_prog = READ_ONCE(rx_ring->xdp_prog);
> + if (!xdp_prog) {
> + rcu_read_unlock();
> + return ICE_XDP_PASS;
> + }
> +
> + act = bpf_prog_run_xdp(xdp_prog, xdp);
> + xdp->handle += xdp->data - xdp->data_hard_start;
> + switch (act) {
> + case XDP_PASS:
> + break;
> + case XDP_TX:
> + xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index];
> + result = ice_xmit_xdp_buff(xdp, xdp_ring);
> + break;
From the quick look at the code it wasn't clear to me how you deal with
XDP_TX on ZC frames. Could you describe the flow of such frames a
little bit?
> + case XDP_REDIRECT:
> + err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
> + result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED;
> + break;
> + default:
> + bpf_warn_invalid_xdp_action(act);
> + /* fallthrough -- not supported action */
> + case XDP_ABORTED:
> + trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
> + /* fallthrough -- handle aborts by dropping frame */
> + case XDP_DROP:
> + result = ICE_XDP_CONSUMED;
> + break;
> + }
> +
> + rcu_read_unlock();
> + return result;
> +}
Powered by blists - more mailing lists