/* this is a simple helper program that creates an XDP socket and does the * minimum necessary to get bind() to succeed. * * this test program is not intended to actually process packets, but could be * extended in the future if that is actually needed. * * it is used by queues.py to ensure the xsk netlinux attribute is set * correctly.
*/ int main(int argc, char **argv)
{ struct xdp_umem_reg umem_reg = { 0 }; struct sockaddr_xdp sxdp = { 0 }; int num_desc = NUM_DESC; void *umem_area; int retry = 0; int ifindex; int sock_fd; int queue;
sock_fd = socket(AF_XDP, SOCK_RAW, 0); if (sock_fd < 0) {
perror("socket creation failed"); /* if the kernel doesn't support AF_XDP, let the test program * know with -1. All other error paths return 1.
*/ if (errno == EAFNOSUPPORT) return -1; return 1;
}
/* "Probing mode", just checking if AF_XDP sockets are supported */ if (!strcmp(argv[1], "-") && !strcmp(argv[2], "-")) {
printf("AF_XDP support detected\n");
close(sock_fd); return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.