mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-03-11 23:27:42 +07:00
xdp: Simplify __bpf_tx_xdp_map()
The explicit error checking is not needed. Simply return the error instead. Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/20191219061006.21980-9-bjorn.topel@gmail.com
This commit is contained in:
parent
332f22a60e
commit
1170beaa3f
@ -3510,35 +3510,16 @@ xdp_do_redirect_slow(struct net_device *dev, struct xdp_buff *xdp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int __bpf_tx_xdp_map(struct net_device *dev_rx, void *fwd,
|
static int __bpf_tx_xdp_map(struct net_device *dev_rx, void *fwd,
|
||||||
struct bpf_map *map,
|
struct bpf_map *map, struct xdp_buff *xdp)
|
||||||
struct xdp_buff *xdp)
|
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
|
|
||||||
switch (map->map_type) {
|
switch (map->map_type) {
|
||||||
case BPF_MAP_TYPE_DEVMAP:
|
case BPF_MAP_TYPE_DEVMAP:
|
||||||
case BPF_MAP_TYPE_DEVMAP_HASH: {
|
case BPF_MAP_TYPE_DEVMAP_HASH:
|
||||||
struct bpf_dtab_netdev *dst = fwd;
|
return dev_map_enqueue(fwd, xdp, dev_rx);
|
||||||
|
case BPF_MAP_TYPE_CPUMAP:
|
||||||
err = dev_map_enqueue(dst, xdp, dev_rx);
|
return cpu_map_enqueue(fwd, xdp, dev_rx);
|
||||||
if (unlikely(err))
|
case BPF_MAP_TYPE_XSKMAP:
|
||||||
return err;
|
return __xsk_map_redirect(fwd, xdp);
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BPF_MAP_TYPE_CPUMAP: {
|
|
||||||
struct bpf_cpu_map_entry *rcpu = fwd;
|
|
||||||
|
|
||||||
err = cpu_map_enqueue(rcpu, xdp, dev_rx);
|
|
||||||
if (unlikely(err))
|
|
||||||
return err;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BPF_MAP_TYPE_XSKMAP: {
|
|
||||||
struct xdp_sock *xs = fwd;
|
|
||||||
|
|
||||||
err = __xsk_map_redirect(xs, xdp);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user