Previously, the BPF_FIB_LOOKUP_{DIRECT,OUTPUT} flags in the BPF UAPI were defined with the help of BIT macro. This had the following issues: - In order to use any of the flags, a user was required to depend on <linux/bits.h>. - No other flag in bpf.h uses the macro, so it seems that an unwritten convention is to use (1 << (nr)) to define BPF-related flags.
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -3378,8 +3378,8 @@ struct bpf_raw_tracepoint_args { · 3377 unmodified lines | ||
| 3378 | 3378 | /* DIRECT: Skip the FIB rules and go to FIB table associated with device |
| 3379 | 3379 | * OUTPUT: Do lookup from egress perspective; default is ingress |
| 3380 | 3380 | */ |
| 3381 | −#define BPF_FIB_LOOKUP_DIRECT BIT(0) | |
| 3382 | −#define BPF_FIB_LOOKUP_OUTPUT BIT(1) | |
| 3381 | +#define BPF_FIB_LOOKUP_DIRECT (1U << 0) | |
| 3382 | +#define BPF_FIB_LOOKUP_OUTPUT (1U << 1) | |
| 3383 | 3383 | |
| 3384 | 3384 | enum { |
| 3385 | 3385 | BPF_FIB_LKUP_RET_SUCCESS, /* lookup successful */ |