Open e493956170 opened 1 year ago
e493956170 @.***> writes:
Can i use sock_create_kern to create AF_XDP in kernel?
Erm, no? Whaddyamean, "in kernel"?
emm... I mean I want to create an AF_XDP socket in a kernel thread. Is this usage feasiable?
azureglow @.***> writes:
emm... I mean I want to create an AF_XDP socket in a kernel thread. Is this usage feasiable?
Don't believe that's possible, no. What's the use case, exactly?
azureglow @.***> writes: emm... I mean I want to create an AF_XDP socket in a kernel thread. Is this usage feasiable? Don't believe that's possible, no. What's the use case, exactly?
Some ideas for bypassing protocol stack
azureglow @.***> writes:
Some ideas for bypassing protocol stack
Well, if you're inside the kernel AF_XDP doesn't really make sense; that is there specifically for getting packets to userspace without the syscall overhead. An in-kernel consumer can just operate on xdp_frames directly.
Having such an in-kernel consumer of XDP frames may be interesting, but you're going to have to be a bit more specific to know for sure... :)
azureglow @.***> writes: Some ideas for bypassing protocol stack Well, if you're inside the kernel AF_XDP doesn't really make sense; that is there specifically for getting packets to userspace without the syscall overhead. An in-kernel consumer can just operate on xdp_frames directly. Having such an in-kernel consumer of XDP frames may be interesting, but you're going to have to be a bit more specific to know for sure... :)
In fact, I am new to kernel. I want to how to operate xdp_frames directly? After serveral tries, PF_XDP is ok to init in kernel with sock_create_kern(), but the operation of UMEM_REG will always failed due to bad address. I have to know more about this area, thanks.
azureglow @.***> writes:
azureglow @.***> writes: Some ideas for bypassing protocol stack Well, if you're inside the kernel AF_XDP doesn't really make sense; that is there specifically for getting packets to userspace without the syscall overhead. An in-kernel consumer can just operate on xdp_frames directly. Having such an in-kernel consumer of XDP frames may be interesting, but you're going to have to be a bit more specific to know for sure... :)
In fact, I am new to kernel. I want to how to operate xdp_frames directly?
Well, there's no existing interface for doing this; you'd probably need to create a new map type and use that as a target for bpf_redirect_map(). You can look at the existing devmap or cpumap code for an example.
After serveral tries, PF_XDP is ok to init in kernel with sock_create_kern(), but the operation of UMEM_REG will always failed due to bad address. I have to know more about this area, thanks.
Well, as the name implies UMEM is userspace memory, so the kernel won't let you register kernel memory. And, again, you really don't need to from an in-kernel consumer.
Can i use sock_create_kern to create AF_XDP in kernel?