Skip to content

Commit

Permalink
bpf: include <lib/endian.h> where relevant, skip <lib/utils.h>
Browse files Browse the repository at this point in the history
Header files <lib/common.h> and <lib/static_data.h> use bpf_ntohs()
which is defined in <lib/endian.h>, non included in common.h. This
forces the other source files to include <lib/endian.h> through
<lib/utils.h>.

Let's include <lib/endian.h> from those headers so we do not have to
include <lib/utils.h> just for that definition.

We can then remove <lib/utils.h> from most source files, although it is
indirectly pulled from <node_config.h> for the majority of the files.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
  • Loading branch information
qmonnet authored and tklauser committed Aug 10, 2020
1 parent eb57338 commit 5195789
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 8 deletions.
1 change: 0 additions & 1 deletion bpf/bpf_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# undef ENABLE_HOST_FIREWALL
#endif

#include "lib/utils.h"
#include "lib/common.h"
#include "lib/arp.h"
#include "lib/maps.h"
Expand Down
1 change: 0 additions & 1 deletion bpf/bpf_lxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#define EVENT_SOURCE LXC_ID

#include "lib/tailcall.h"
#include "lib/utils.h"
#include "lib/common.h"
#include "lib/config.h"
#include "lib/maps.h"
Expand Down
1 change: 0 additions & 1 deletion bpf/bpf_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <node_config.h>
#include <netdev_config.h>

#include "lib/utils.h"
#include "lib/common.h"
#include "lib/maps.h"
#include "lib/ipv6.h"
Expand Down
1 change: 0 additions & 1 deletion bpf/bpf_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define IS_BPF_OVERLAY 1

#include "lib/tailcall.h"
#include "lib/utils.h"
#include "lib/common.h"
#include "lib/maps.h"
#include "lib/ipv6.h"
Expand Down
1 change: 0 additions & 1 deletion bpf/bpf_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define SKIP_POLICY_MAP 1
#define SKIP_CALLS_MAP 1

#include "lib/utils.h"
#include "lib/common.h"
#include "lib/lb.h"
#include "lib/eps.h"
Expand Down
1 change: 0 additions & 1 deletion bpf/bpf_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#define SKIP_POLICY_MAP 1

#include "lib/utils.h"
#include "lib/common.h"
#include "lib/maps.h"
#include "lib/eps.h"
Expand Down
1 change: 1 addition & 0 deletions bpf/lib/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/ipv6.h>
#include <linux/in.h>

#include "endian.h"
#include "mono.h"

/* FIXME: GH-3239 LRU logic is not handling timeouts gracefully enough
Expand Down
2 changes: 2 additions & 0 deletions bpf/lib/static_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <bpf/ctx/ctx.h>
#include <bpf/api.h>

#include "endian.h"

/* fetch_* macros assist in fetching variously sized static data */
#define fetch_u32(x) __fetch(x)
#define fetch_u32_i(x, i) __fetch(x ## _ ## i)
Expand Down
1 change: 0 additions & 1 deletion bpf/sockops/bpf_redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#define SOCKMAP 1

#include "../lib/utils.h"
#include "../lib/common.h"
#include "../lib/maps.h"
#include "../lib/lb.h"
Expand Down
1 change: 0 additions & 1 deletion bpf/sockops/bpf_sockops.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#define SOCKMAP 1

#include "../lib/utils.h"
#include "../lib/common.h"
#include "../lib/maps.h"
#include "../lib/lb.h"
Expand Down

0 comments on commit 5195789

Please sign in to comment.