On 20/09/2016 2:33 PM, Jesper Dangaard Brouer wrote:
Resending, email didn't reach the list (used wrong sender email)

On Tue, 20 Sep 2016 10:29:43 +0200 Jesper Dangaard Brouer <net...@brouer.com> 

On Mon, 19 Sep 2016 16:58:58 +0300 Tariq Toukan <tar...@mellanox.com> wrote:

+       act = bpf_prog_run_xdp(prog, &xdp);
+       switch (act) {
+       case XDP_PASS:
+               return false;
+       case XDP_TX:
+               consumed = mlx5e_xmit_xdp_frame(&rq->channel->xdp_sq, di,
+                                               MLX5_RX_HEADROOM,
+                                               len);
+               rq->stats.xdp_tx += consumed;
+               return consumed;
+       default:
+               bpf_warn_invalid_xdp_action(act);
+               return false;
This looks wrong.  According to the specification[1] and comment in the
code /include/uapi/linux/bpf.h: "Unknown return codes will result in
packet drop"
I'll fix this.
+       case XDP_ABORTED:
It is not clearly defined, but I believe XDP_ABORTED should also result
in a warning (calling bpf_warn_invalid_xdp_action(act)).
I'll add this.

+       case XDP_DROP:
+               rq->stats.xdp_drop++;
+               mlx5e_page_release(rq, di, true);
+               return true;
+       }

I've started documenting XDP[2], as this patch clearly shows there is a
need to have a specification, given already the second driver
supporting XDP gets these details wrong.
Indeed. Thanks for doing this.

[2] https://prototype-kernel.readthedocs.io/en/latest/networking/XDP/index.html


Reply via email to