tun.c (8ae1aff0b331ab154c39910f2e0ed239bf942d56) tun.c (1a097910adda6b3328fc235575bba0e9ee408492)
1/*
2 * TUN - Universal TUN/TAP device driver.
3 * Copyright (C) 1999-2002 Maxim Krasnyansky <maxk@qualcomm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 1646 unchanged lines hidden (view full) ---

1655static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog,
1656 struct xdp_buff *xdp, u32 act)
1657{
1658 int err;
1659
1660 switch (act) {
1661 case XDP_REDIRECT:
1662 err = xdp_do_redirect(tun->dev, xdp, xdp_prog);
1/*
2 * TUN - Universal TUN/TAP device driver.
3 * Copyright (C) 1999-2002 Maxim Krasnyansky <maxk@qualcomm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 1646 unchanged lines hidden (view full) ---

1655static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog,
1656 struct xdp_buff *xdp, u32 act)
1657{
1658 int err;
1659
1660 switch (act) {
1661 case XDP_REDIRECT:
1662 err = xdp_do_redirect(tun->dev, xdp, xdp_prog);
1663 xdp_do_flush_map();
1664 if (err)
1665 return err;
1666 break;
1667 case XDP_TX:
1668 err = tun_xdp_tx(tun->dev, xdp);
1669 if (err < 0)
1670 return err;
1671 break;

--- 72 unchanged lines hidden (view full) ---

1744 act = bpf_prog_run_xdp(xdp_prog, &xdp);
1745 if (act == XDP_REDIRECT || act == XDP_TX) {
1746 get_page(alloc_frag->page);
1747 alloc_frag->offset += buflen;
1748 }
1749 err = tun_xdp_act(tun, xdp_prog, &xdp, act);
1750 if (err < 0)
1751 goto err_xdp;
1663 if (err)
1664 return err;
1665 break;
1666 case XDP_TX:
1667 err = tun_xdp_tx(tun->dev, xdp);
1668 if (err < 0)
1669 return err;
1670 break;

--- 72 unchanged lines hidden (view full) ---

1743 act = bpf_prog_run_xdp(xdp_prog, &xdp);
1744 if (act == XDP_REDIRECT || act == XDP_TX) {
1745 get_page(alloc_frag->page);
1746 alloc_frag->offset += buflen;
1747 }
1748 err = tun_xdp_act(tun, xdp_prog, &xdp, act);
1749 if (err < 0)
1750 goto err_xdp;
1751 if (err == XDP_REDIRECT)
1752 xdp_do_flush_map();
1752 if (err != XDP_PASS)
1753 goto out;
1754
1755 pad = xdp.data - xdp.data_hard_start;
1756 len = xdp.data_end - xdp.data;
1757 }
1758 rcu_read_unlock();
1759 local_bh_enable();

--- 1828 unchanged lines hidden ---
1753 if (err != XDP_PASS)
1754 goto out;
1755
1756 pad = xdp.data - xdp.data_hard_start;
1757 len = xdp.data_end - xdp.data;
1758 }
1759 rcu_read_unlock();
1760 local_bh_enable();

--- 1828 unchanged lines hidden ---