/* this is a simple helper program that creates an XDP socket and does the *minimumnecessarytogetbind()tosucceed. * *thistestprogramisnotintendedtoactuallyprocesspackets,butcouldbe *extendedinthefutureifthatisactuallyneeded. * *itisusedbyqueues.pytoensurethexsknetlinuxattributeisset *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 *knowwith-1.Allothererrorpathsreturn1.
*/ if (errno == EAFNOSUPPORT) return -1; return1;
}
/* "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); return0;
}
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.