Commit 59c97d1b authored by Maciej Fijalkowski's avatar Maciej Fijalkowski Committed by Tony Nguyen

ice: simplify ice_run_xdp

There's no need for 'result' variable, we can directly return the
internal status based on action returned by xdp prog.
Reviewed-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
Signed-off-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Tested-by: default avatarKiran Bhandare <kiranx.bhandare@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent d06e2f05
...@@ -537,22 +537,20 @@ static int ...@@ -537,22 +537,20 @@ static int
ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp,
struct bpf_prog *xdp_prog) struct bpf_prog *xdp_prog)
{ {
int err, result = ICE_XDP_PASS;
struct ice_ring *xdp_ring; struct ice_ring *xdp_ring;
int err;
u32 act; u32 act;
act = bpf_prog_run_xdp(xdp_prog, xdp); act = bpf_prog_run_xdp(xdp_prog, xdp);
switch (act) { switch (act) {
case XDP_PASS: case XDP_PASS:
break; return ICE_XDP_PASS;
case XDP_TX: case XDP_TX:
xdp_ring = rx_ring->vsi->xdp_rings[smp_processor_id()]; xdp_ring = rx_ring->vsi->xdp_rings[smp_processor_id()];
result = ice_xmit_xdp_buff(xdp, xdp_ring); return ice_xmit_xdp_buff(xdp, xdp_ring);
break;
case XDP_REDIRECT: case XDP_REDIRECT:
err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; return !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED;
break;
default: default:
bpf_warn_invalid_xdp_action(act); bpf_warn_invalid_xdp_action(act);
fallthrough; fallthrough;
...@@ -560,11 +558,8 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, ...@@ -560,11 +558,8 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp,
trace_xdp_exception(rx_ring->netdev, xdp_prog, act); trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
fallthrough; fallthrough;
case XDP_DROP: case XDP_DROP:
result = ICE_XDP_CONSUMED; return ICE_XDP_CONSUMED;
break;
} }
return result;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment