History

bpf: simplify definition of BPF_FIB_LOOKUP related flags

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.

Martynas Pumputis committed 7 years ago

Commit b1d6c151 parent 01d76b51 file · +2 −2Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

include/uapi/linux/bpf.h+2−2
@@ -3378,8 +3378,8 @@ struct bpf_raw_tracepoint_args { · 3377 unmodified lines
3378/* DIRECT: Skip the FIB rules and go to FIB table associated with device3378/* DIRECT: Skip the FIB rules and go to FIB table associated with device
3379 * OUTPUT: Do lookup from egress perspective; default is ingress3379 * OUTPUT: Do lookup from egress perspective; default is ingress
3380 */3380 */
3381#define BPF_FIB_LOOKUP_DIRECT BIT(0)3381#define BPF_FIB_LOOKUP_DIRECT (1U << 0)
3382#define BPF_FIB_LOOKUP_OUTPUT BIT(1)3382#define BPF_FIB_LOOKUP_OUTPUT (1U << 1)
3383 3383
3384enum {3384enum {
3385 BPF_FIB_LKUP_RET_SUCCESS, /* lookup successful */3385 BPF_FIB_LKUP_RET_SUCCESS, /* lookup successful */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t