Commit 1291aca9 authored by Sagar Arora's avatar Sagar Arora

Merge branch 'chore_enable_disabling_of_bpf_logs' into 'develop'

feat(bpf): support enabling and disabling of BPF debug logging

See merge request oai/cn5g/oai-cn5g-upf!63
parents 2edad4d5 ec607f8b
......@@ -143,6 +143,11 @@ function main()
verbose=1
shift;
;;
--bpf-debug)
echo "BPF debug logs enabled"
cmake_args="$cmake_args -DBPF_DEBUG=ON"
shift;
;;
-V | --Verbose)
echo "CMake build process verbose"
verbose=1
......
......@@ -36,9 +36,11 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
ENV IS_DOCKERFILE=1
ARG ENABLE_LTTNG=false
ARG BPF_DEBUG=false
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
cmake \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
......@@ -66,6 +68,7 @@ FROM oai-upf-base AS oai-upf-builder
COPY . /openair-upf
# Building UPF
WORKDIR /openair-upf/build/scripts
ARG BUILD_ARGS=""
RUN if [ "$ENABLE_LTTNG" = "true" ]; then apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
libstdc++-12-dev \
......@@ -73,11 +76,12 @@ RUN if [ "$ENABLE_LTTNG" = "true" ]; then apt-get update && \
liblttng-ust-dev \
lttng-tools && \
ldconfig && \
./build_upf --clean --Verbose --build-type Release --jobs --lttng; \
BUILD_ARGS="--lttng"; \
else \
ldconfig && \
./build_upf --clean --Verbose --build-type Release --jobs --jobs; \
ldconfig; \
fi && \
if [ "$BPF_DEBUG" = "true" ]; then BUILD_ARGS="$BUILD_ARGS --bpf-debug"; fi && \
./build_upf --clean --Verbose --build-type Release --jobs ${BUILD_ARGS}; \
ldd /openair-upf/build/upf/build/upf && \
mv /openair-upf/build/upf/build/upf /openair-upf/build/upf/build/oai_upf && \
echo "end of UPF build"
......
......@@ -11,6 +11,11 @@ include_directories(${SRC_TOP_DIR}/${MOUNTED_COMMON}/utils)
add_definitions(-DKERNEL_SPACE)
if(DEFINED BPF_DEBUG)
if(BPF_DEBUG)
add_definitions(-DBPF_DEBUG)
endif()
endif()
add_custom_target(upf_xdp_all DEPENDS pfcp_session_lookup_xdp)
# add_custom_target(upf_tc_all DEPENDS qer_tc)
......
......@@ -6,8 +6,8 @@
#include <bpf_helpers.h>
#define DEBUG 1
#ifdef DEBUG
// #define DEBUG 0
#ifdef BPF_DEBUG
/* Only use this for debug output. Notice output from bpf_trace_printk()
* end-up in /sys/kernel/debug/tracing/trace_pipe
*/
......@@ -17,15 +17,7 @@
bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \
})
#else
#define bpf_debug(fmt, ...) \
{} \
while (0)
#define bpf_debug(fmt, ...)
#endif
#define bpf_debug2(fmt, ...) \
({ \
char ____fmt[] = fmt; \
bpf_trace_printk(____fmt, sizeof(____fmt), ##__VA_ARGS__); \
})
#else
#endif // __LOGGER_H__
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment