-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add poc of XDPLua #2
base: xdplua_poc_base
Are you sure you want to change the base?
Conversation
net/core/dev.c
Outdated
@@ -4385,6 +4390,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, | |||
xdp->rxq = &rxqueue->xdp_rxq; | |||
|
|||
act = bpf_prog_run_xdp(xdp_prog, xdp); | |||
luaL_dostring(L, "print('hello wolrd')"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we think on a way to include a lua file statically here? perhaps using the C preprocessor.. btw, there's a typo above..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least, `#define LUA_SCRIPT "print('hello world')"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was previously using a macro for that, will change back
#include "lua.h" | ||
#include "lauxlib.h" | ||
#include "lualib.h" | ||
#include "luadata.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
@@ -154,6 +158,7 @@ | |||
/* This should be increased if a protocol with a bigger head is added. */ | |||
#define GRO_MAX_HEAD (MAX_HEADER + 128) | |||
|
|||
static lua_State *L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
net/core/dev.c
Outdated
@@ -9816,6 +9824,9 @@ static int __init net_dev_init(void) | |||
|
|||
BUG_ON(!dev_boot_phase); | |||
|
|||
L = luaL_newstate(); | |||
luaL_openlibs(L); | |||
luaL_requiref(L, "data", luaopen_data, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think on creating xdp hooks.. not exactly implementing it right promptly on this PR, but creating a task for that..
net/core/dev.c
Outdated
@@ -9816,6 +9827,10 @@ static int __init net_dev_init(void) | |||
|
|||
BUG_ON(!dev_boot_phase); | |||
|
|||
L = luaL_newstate(); | |||
luaL_openlibs(L); | |||
luaL_requiref(L, "data", luaopen_data, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, you may use require()
from the Lua scripts
e2a1b80
to
0834040
Compare
net/core/dev.c
Outdated
@@ -9781,6 +9790,7 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list) | |||
* will run in the rtnl_unlock() at the end of | |||
* default_device_exit_batch. | |||
*/ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is spurious right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry about that. Will remove this in the next fix up
d0c1f8b
to
b7e38c2
Compare
No description provided.