When offloaded program returns XDP_TX, we need to inject the packet in
Rx path of tun. This patch injects such packets in Rx path using
tun_xdp_one.

Signed-off-by: Prashant Bhole <prashantbhole.li...@gmail.com>
---
 drivers/net/tun.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 8d6cdd3e5139..084ca95358fe 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2249,7 +2249,13 @@ static u32 tun_do_xdp_offload(struct tun_struct *tun, 
struct tun_file *tfile,
                case XDP_PASS:
                        break;
                case XDP_TX:
-                       /* fall through */
+                       tpage.page = NULL;
+                       tpage.count = 0;
+                       tun_xdp_one(tun, tfile, &xdp, &flush, &tpage, false);
+                       tun_put_page(&tpage);
+                       if (flush)
+                               xdp_do_flush_map();
+                       break;
                case XDP_REDIRECT:
                        /* fall through */
                default:
-- 
2.20.1


Reply via email to