xsk | CMS and Web Server written in ShellScript
kandi X-RAY | xsk Summary
kandi X-RAY | xsk Summary
CMS and Web Server written in only ShellScript. It has RESTful interface and supports authentication mechanism using signature. This project supports rendering markdown and executing shell scripts.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xsk
xsk Key Features
xsk Examples and Code Snippets
Community Discussions
Trending Discussions on xsk
QUESTION
So I have a kernel ebpf program that attach xdp hook to interface eno1, and in it I have a map ip_map
that is of type BPF_MAP_TYPE_HASH that I am sharing with userspace. So in my userspace I am getting map's file descriptor, But now I like to get updated values of
struct share_me
which I am sharing with the help of BPF_MAP_TYPE_HASH type map in my userspace loader program.
Any anyone please help me explain a bit, as to how I can do this,
So I am assuming if my map_fd
is pointing to BPF_MAP_TYPE_HASH is pointing to my MAP then I can just do this int sizeof_share_me_read=read(map_fd,&share_me,sizeof(struct share_me));
so this way I can read current updated value of my map_fd(BPF_MAP_TYPE_HASH)
shared from kernel ebpf program and that will contain current packet's ip header in struct iphdr dest_ip
member of share_me object. Can any one please help me sort this out
user.c
...ANSWER
Answered 2022-Jan-16 at 12:10Now that you have the map fd, you need to use libbpf's bpf_map_lookup_elem
function to read the values:
QUESTION
I want to implement XDP_SHARED_UMEM: https://www.kernel.org/doc/html/latest/networking/af_xdp.html#xdp-shared-umem-bind-flag
The libbpf
library function xsk_socket__create
(https://github.com/libbpf/libbpf/blob/master/src/xsk.c) checks the xsk_umem->refcount
value. In case it is greater than 1, the XDP_SHARED_UMEM
option of a struct sockaddr_xdp
is set.
So as far as I understand correctly, I "just" need to pass the original umem struct of the socket I want to share the umem with and the rest is done by libbpf
.
The way I tried to do it was to let the first process copy its umem
-struct into a shared-memory area where the second process could load it from. But because struct xsk_umem
is defined in xsk.c
it is hidden from the user and I am not able to do something like this:
memcpy(shdm_ptr, umem, sizeof(struct xsk_umem))
I don't know how they expect someone to use the shared umem feature?
...ANSWER
Answered 2020-Mar-12 at 16:24So this was discussed on the xdp-newbies mailing list. Reporting here for the record.
It is not recommended to go with a multi-process setup as you are trying to do. Björn says:
Note that if you'd like to do a multi-process setup with shared umem, you: need to have a control process that manages the fill/completion rings, and synchronize between the processes, OR re-mmap the fill/completetion ring from the socket owning the umem in multiple processes and synchronize the access to them. Neither is pleasant.
Honestly, not a setup I'd recommend.
And he adds:
Just for completeness; To setup shared umem:
- create socket 0 and register the umem to this.
- mmap the fr/cr using socket 0
- create socket 1, 2, n and refer to socket 0 for the umem.
So, in a multiprocess solution step 3 would be done in separate processes, and step 2 depending on your application. You'd need to pass socket 0 to the other processes and share the umem memory from the process where socket 0 was created. This is pretty much a threaded solution, given all the shared state.
I advice not taking this path.
(Credits to Björn.)
QUESTION
Why is setting SO_TIMESTAMP
not supported for an AF_XDP
socket? The user manual of my driver (mlnx 5.0
) states that
Incoming packets are time-stamped before they are distributed on the PCI depending on the congestion in the PCI buffers.
To my knowledge, before distributed on the PCI
means that there is no Linux Kernel involved (yet) - right?
I tried setting it like this:
...ANSWER
Answered 2020-Mar-09 at 09:03There is no technical reason on why it is not implemented.
Indeed, it looks like it is on the To-Do list of the xdp development team.
Cite from here:
Important medium-term tasks...
Metadata from hardwareThere are various hardware metadata items that would be useful for XDP programs to access, to reduce the amount of processing that needs to happen in eBPF. These include:
- Checksum
- Hash value
- Flow designator
- Higher-level protocol header offsets
- Timestamps
It looks like this is on the To-Do since June 2019, so it probably doesn't have top priority, otherwise it would already be implemented.
QUESTION
I want to measure packet latency for my AF-XDP program. I was looking at this reference: https://github.com/xdp-project/xdp-project/blob/master/areas/arm64/xdp_for_tsn.org
and adapted it to this:
...ANSWER
Answered 2020-Mar-03 at 11:09The snippet you used is described in the tutorial as pseudo-code, it is not a complete and functional example. Let's have a look at the verifier log:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xsk
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page