net/skbuff: add macros for VLAN_PRESENT bit
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Sat, 10 Nov 2018 18:58:34 +0000 (19:58 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Nov 2018 03:25:28 +0000 (19:25 -0800)
Wrap VLAN_PRESENT bit using macro like PKT_TYPE_* and CLONED_*,
as used by BPF code.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h

index 7dcfb5591dc33ae74ffc2fb5f88e2f141e982db6..99f38779332c955b022202920b1c5d6cc66b5d9c 100644 (file)
@@ -816,6 +816,12 @@ struct sk_buff {
        __u32                   priority;
        int                     skb_iif;
        __u32                   hash;
+#define PKT_VLAN_PRESENT_BIT   4       // CFI (12-th bit) in TCI
+#ifdef __BIG_ENDIAN
+#define PKT_VLAN_PRESENT_OFFSET()      offsetof(struct sk_buff, vlan_tci)
+#else
+#define PKT_VLAN_PRESENT_OFFSET()      (offsetof(struct sk_buff, vlan_tci) + 1)
+#endif
        __be16                  vlan_proto;
        __u16                   vlan_tci;
 #if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS)