Add luatc binding#571
Conversation
5947d2c to
a22dd18
Compare
| const char *key = luaL_checkstring(L, 2); | ||
| for (const luaL_Reg *f = luaskb_getters; f->name; f++) | ||
| if (strcmp(f->name, key) == 0) | ||
| return f->func(L); |
There was a problem hiding this comment.
I think we have discussed this on matrix.. we should have a table instead of comparing strings.. btw, I think a better approach would be to have a table as an field of skb (e.g., skb.attr) for using __index and __newindex so we can avoid the verification on the top and a second table stored in the lib table itself to access getters and setters CFunctions directly, instead of comparing strings like this. What do you think?
There was a problem hiding this comment.
perhaps, a better idea is to just expose getters and setters here and implement the table abstraction in Lua, e.g., skb/attr.lua
There was a problem hiding this comment.
perhaps, a better idea is to just expose getters and setters here and implement the table abstraction in Lua, e.g., skb/attr.lua
I agree, this way C side will be straight forward
There was a problem hiding this comment.
Added lib/skb/attr.lua to handle the table abstraction
|
|
||
| static char luatc_env_key; | ||
|
|
||
| static lunatik_object_t *luatc_runtimes = NULL; |
There was a problem hiding this comment.
I think we should move this to our common layer, having something like lunatik_ebpf_runtimes.. btw, I was taking a look at the integration branch.. I don't think the header belongs to lib/, lunatik_* should be placed at /, also.. I would rename it to lunatik_ebpf.h, bpf is misnomer IMHO
There was a problem hiding this comment.
Working on a fixup for this
There was a problem hiding this comment.
I have moved the following to the generic layer till now:
- runtime lookup
- BPF kfunc init and set macros
| * @see data | ||
| * @within tc | ||
| */ | ||
| static int luatc_attach(lua_State *L) |
There was a problem hiding this comment.
isn't there anything from attach on XDP and TC that we can generaliza to the lunatik_ebpf layer?
b68ad89 to
cb1a607
Compare
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
6a231c4 to
53fd9ee
Compare
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
This patch adds the following