Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add poc of XDPLua #2

Open
wants to merge 3 commits into
base: xdplua_poc_base
Choose a base branch
from
Open

Add poc of XDPLua #2

wants to merge 3 commits into from

Conversation

VictorNogueiraRio
Copy link
Owner

No description provided.

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')");
Copy link

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..

Copy link

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')"

Copy link
Owner Author

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"
Copy link

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;
Copy link

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n

Copy link

@lneto lneto left a 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);
Copy link

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

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.
*/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is spurious right?

Copy link
Owner Author

@VictorNogueiraRio VictorNogueiraRio Jun 5, 2019

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

@VictorNogueiraRio VictorNogueiraRio changed the base branch from master to xdplua_poc_base June 25, 2019 03:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants