From 89e70ca96303a931abf8a3dbcdd70b3e20e5142e Mon Sep 17 00:00:00 2001 From: Victor Nogueira Date: Tue, 30 Jul 2019 19:34:55 -0300 Subject: [PATCH] fixup! Add core version of XDPLua --- net/core/dev.c | 5 +++-- net/core/rtnetlink.c | 2 +- tools/lib/bpf/netlink.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 4666b96eb5e7e4..58143e44305760 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4425,9 +4425,10 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, rxqueue = netif_get_rxqueue(skb); xdp->rxq = &rxqueue->xdp_rxq; - if (xdp_prog) { + if (xdp_prog) act = bpf_prog_run_xdp(xdp_prog, xdp); - } else { + + if (act == XDP_PASS || !xdp_prog) { cpu = smp_processor_id(); list_for_each_entry(sc, &lua_state_cpu_list, list) { if (sc->cpu == cpu) { diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 814d88d2d4cb22..6f8197e6c7241f 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1799,7 +1799,7 @@ static const struct nla_policy ifla_xdp_policy[IFLA_XDP_MAX + 1] = { [IFLA_XDP_ATTACHED] = { .type = NLA_U8 }, [IFLA_XDP_FLAGS] = { .type = NLA_U32 }, [IFLA_XDP_PROG_ID] = { .type = NLA_U32 }, - [IFLA_XDP_LUA_PROG] = { .type = NLA_STRING, .len = 4096 }, + [IFLA_XDP_LUA_PROG] = { .type = NLA_STRING, .len = 8192 }, [IFLA_XDP_LUA_FUNC] = { .type = NLA_STRING, .len = 256 }, }; diff --git a/tools/lib/bpf/netlink.c b/tools/lib/bpf/netlink.c index 95799b2082100f..8e49a1b036126f 100644 --- a/tools/lib/bpf/netlink.c +++ b/tools/lib/bpf/netlink.c @@ -193,7 +193,7 @@ int bpf_set_link_xdp_lua_prog(int ifindex, char *lua_prog) { struct { struct nlmsghdr nh; struct ifinfomsg ifinfo; - char attrbuf[4096 + 256]; + char attrbuf[8192]; } req; __u32 nl_pid; @@ -248,7 +248,7 @@ int bpf_set_link_xdp_lua_func(int ifindex, char *lua_funcname) struct { struct nlmsghdr nh; struct ifinfomsg ifinfo; - char attrbuf[4096 + 256]; + char attrbuf[256]; } req; __u32 nl_pid;