Skip to content
Snippets Groups Projects
Commit 5f7aad0b authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman
Browse files

xdp: more proper building of bpf-kernel.o

parent 9a3f7fdb
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,10 @@ version.h
# zscanner
/src/libzscanner/scanner.c
# xdp
/src/libknot/xdp/bpf-kernel.ll
!/src/libknot/xdp/Makefile
# Binaries
/src/kdig
/src/khost
......
......@@ -3,9 +3,6 @@ src/contrib/base32hex.c
src/contrib/base32hex.h
src/contrib/base64.c
src/contrib/base64.h
src/contrib/bpf/bpf_endian.h
src/contrib/bpf/bpf_helpers.h
src/contrib/bpf/parsing_helpers.h
src/contrib/ctype.h
src/contrib/dnstap/convert.c
src/contrib/dnstap/convert.h
......@@ -370,6 +367,9 @@ src/libknot/xdp/af_xdp.h
src/libknot/xdp/bpf-kernel.c
src/libknot/xdp/bpf-user.c
src/libknot/xdp/bpf-user.h
src/libknot/xdp/bpf/bpf_endian.h
src/libknot/xdp/bpf/bpf_helpers.h
src/libknot/xdp/bpf/parsing_helpers.h
src/libknot/yparser/yparser.c
src/libknot/yparser/yparser.h
src/libknot/yparser/ypbody.c
......
......@@ -208,6 +208,11 @@ AS_CASE([$enable_xdp],
)
AS_IF([test "$enable_xdp" = "yes"],[
AC_CHECK_PROG([have_clang],[clang],[yes],[no])
AS_IF([test "$have_clang" != "yes"],[AC_MSG_ERROR([clang not available])])
AC_CHECK_PROG([have_llc],[llc],[yes],[no])
AS_IF([test "$have_llc" != "yes"],[AC_MSG_ERROR([llc not available])])
save_CFLAGS=$CFLAGS
save_LIBS=$LIBS
CFLAGS="$CFLAGS $libbpf_CFLAGS"
......
......@@ -19,3 +19,7 @@ include $(srcdir)/libknot/Makefile.inc
include $(srcdir)/libzscanner/Makefile.inc
include $(srcdir)/knot/Makefile.inc
include $(srcdir)/utils/Makefile.inc
if ENABLE_XDP
SUBDIRS = libknot/xdp
endif ENABLE_XDP
......@@ -27,9 +27,6 @@ libcontrib_la_SOURCES = \
contrib/base32hex.h \
contrib/base64.c \
contrib/base64.h \
contrib/bpf/bpf_endian.h \
contrib/bpf/bpf_helpers.h \
contrib/bpf/parsing_helpers.h \
contrib/ctype.h \
contrib/dynarray.h \
contrib/files.c \
......
......@@ -81,6 +81,5 @@ libknot_la_SOURCES = \
if ENABLE_XDP
libknot_la_SOURCES += \
libknot/xdp/af_xdp.c \
libknot/xdp/bpf-kernel.c \
libknot/xdp/bpf-user.c
endif ENABLE_XDP
all: bpf-kernel.o
bpf-kernel.ll: bpf-kernel.c
clang -S -target bpf -Wall -O2 -emit-llvm -c -g -DNDEBUG -o bpf-kernel.ll bpf-kernel.c
bpf-kernel.o: bpf-kernel.ll
llc -march=bpf -filetype=obj -o bpf-kernel.o bpf-kernel.ll
clean:
rm -f bpf-kernel.ll bpf-kernel.o
......@@ -3,9 +3,10 @@
#include <linux/if_ether.h>
#include <linux/ipv6.h>
#include <linux/udp.h>
#include "contrib/bpf/bpf_helpers.h"
#include "contrib/bpf/bpf_endian.h"
#include "contrib/bpf/parsing_helpers.h"
#include "bpf/bpf_helpers.h"
#include "bpf/bpf_endian.h"
#include "bpf/parsing_helpers.h"
/** Assume netdev has no more than 64 queues
* LATER: it might be better to detect this on startup time (per-device). */
......
......@@ -14,9 +14,10 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "contrib/bpf/bpf_endian.h"
#include "libknot/xdp/bpf-user.h"
#include "libknot/endian.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
......@@ -146,7 +147,7 @@ int kxsk_socket_start(const struct kxsk_iface *iface, int queue_id,
if (err)
return err;
int qid = bpf_htons(listen_port);
int qid = htobe16(listen_port);
err = bpf_map_update_elem(iface->qidconf_map_fd, &queue_id, &qid, 0);
if (err)
bpf_map_delete_elem(iface->xsks_map_fd, &queue_id);
......
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment