Skip to content

Commit

Permalink
samples/bpf: xdpsock: order memory on AArch64
Browse files Browse the repository at this point in the history
Define u_smp_rmb() and u_smp_wmb() to respective barrier instructions.
This ensures the processor will order accesses to queue indices against
accesses to queue ring entries.

Signed-off-by: Brian Brooks <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
brbrooks authored and borkmann committed Jul 27, 2018
1 parent 08a8525 commit 598135e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/bpf/xdpsock_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,13 @@ static void dump_stats(void);
} while (0)

#define barrier() __asm__ __volatile__("": : :"memory")
#ifdef __aarch64__
#define u_smp_rmb() __asm__ __volatile__("dmb ishld": : :"memory")
#define u_smp_wmb() __asm__ __volatile__("dmb ishst": : :"memory")
#else
#define u_smp_rmb() barrier()
#define u_smp_wmb() barrier()
#endif
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)

Expand Down

0 comments on commit 598135e

Please sign in to comment.