These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / include / linux / netdevice.h
index 7a289e8..c0e12f7 100644 (file)
@@ -507,6 +507,7 @@ static inline void napi_enable(struct napi_struct *n)
        BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
        smp_mb__before_atomic();
        clear_bit(NAPI_STATE_SCHED, &n->state);
+       clear_bit(NAPI_STATE_NPSVC, &n->state);
 }
 
 #ifdef CONFIG_SMP
@@ -717,8 +718,8 @@ struct xps_map {
        u16 queues[0];
 };
 #define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + ((_num) * sizeof(u16)))
-#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map))   \
-    / sizeof(u16))
+#define XPS_MIN_MAP_ALLOC ((L1_CACHE_ALIGN(offsetof(struct xps_map, queues[1])) \
+       - sizeof(struct xps_map)) / sizeof(u16))
 
 /*
  * This structure holds all XPS maps for device.  Maps are indexed by CPU.
@@ -766,6 +767,13 @@ struct netdev_phys_item_id {
        unsigned char id_len;
 };
 
+static inline bool netdev_phys_item_id_same(struct netdev_phys_item_id *a,
+                                           struct netdev_phys_item_id *b)
+{
+       return a->id_len == b->id_len &&
+              memcmp(a->id, b->id, a->id_len) == 0;
+}
+
 typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
                                       struct sk_buff *skb);
 
@@ -873,6 +881,7 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  * int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
  *                       int max_tx_rate);
  * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
+ * int (*ndo_set_vf_trust)(struct net_device *dev, int vf, bool setting);
  * int (*ndo_get_vf_config)(struct net_device *dev,
  *                         int vf, struct ifla_vf_info *ivf);
  * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
@@ -1041,6 +1050,16 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  *     TX queue.
  * int (*ndo_get_iflink)(const struct net_device *dev);
  *     Called to get the iflink value of this device.
+ * void (*ndo_change_proto_down)(struct net_device *dev,
+ *                               bool proto_down);
+ *     This function is used to pass protocol port error state information
+ *     to the switch driver. The switch driver can react to the proto_down
+ *      by doing a phys down on the associated switch port.
+ * int (*ndo_fill_metadata_dst)(struct net_device *dev, struct sk_buff *skb);
+ *     This function is used to get egress tunnel information for given skb.
+ *     This is useful for retrieving outer tunnel header parameters while
+ *     sampling packet.
+ *
  */
 struct net_device_ops {
        int                     (*ndo_init)(struct net_device *dev);
@@ -1095,11 +1114,17 @@ struct net_device_ops {
                                                   int max_tx_rate);
        int                     (*ndo_set_vf_spoofchk)(struct net_device *dev,
                                                       int vf, bool setting);
+       int                     (*ndo_set_vf_trust)(struct net_device *dev,
+                                                   int vf, bool setting);
        int                     (*ndo_get_vf_config)(struct net_device *dev,
                                                     int vf,
                                                     struct ifla_vf_info *ivf);
        int                     (*ndo_set_vf_link_state)(struct net_device *dev,
                                                         int vf, int link_state);
+       int                     (*ndo_get_vf_stats)(struct net_device *dev,
+                                                   int vf,
+                                                   struct ifla_vf_stats
+                                                   *vf_stats);
        int                     (*ndo_set_vf_port)(struct net_device *dev,
                                                   int vf,
                                                   struct nlattr *port[]);
@@ -1207,6 +1232,10 @@ struct net_device_ops {
                                                      int queue_index,
                                                      u32 maxrate);
        int                     (*ndo_get_iflink)(const struct net_device *dev);
+       int                     (*ndo_change_proto_down)(struct net_device *dev,
+                                                        bool proto_down);
+       int                     (*ndo_fill_metadata_dst)(struct net_device *dev,
+                                                      struct sk_buff *skb);
 };
 
 /**
@@ -1221,13 +1250,8 @@ struct net_device_ops {
  *
  * @IFF_802_1Q_VLAN: 802.1Q VLAN device
  * @IFF_EBRIDGE: Ethernet bridging device
- * @IFF_SLAVE_INACTIVE: bonding slave not the curr. active
- * @IFF_MASTER_8023AD: bonding master, 802.3ad
- * @IFF_MASTER_ALB: bonding master, balance-alb
  * @IFF_BONDING: bonding master or slave
- * @IFF_SLAVE_NEEDARP: need ARPs for validation
  * @IFF_ISATAP: ISATAP interface (RFC4214)
- * @IFF_MASTER_ARPMON: bonding master, ARP mon in use
  * @IFF_WAN_HDLC: WAN HDLC device
  * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
  *     release skb->dst
@@ -1243,44 +1267,42 @@ struct net_device_ops {
  * @IFF_LIVE_ADDR_CHANGE: device supports hardware address
  *     change when it's running
  * @IFF_MACVLAN: Macvlan device
+ * @IFF_L3MDEV_MASTER: device is an L3 master device
+ * @IFF_NO_QUEUE: device can run without qdisc attached
+ * @IFF_OPENVSWITCH: device is a Open vSwitch master
+ * @IFF_L3MDEV_SLAVE: device is enslaved to an L3 master device
  */
 enum netdev_priv_flags {
        IFF_802_1Q_VLAN                 = 1<<0,
        IFF_EBRIDGE                     = 1<<1,
-       IFF_SLAVE_INACTIVE              = 1<<2,
-       IFF_MASTER_8023AD               = 1<<3,
-       IFF_MASTER_ALB                  = 1<<4,
-       IFF_BONDING                     = 1<<5,
-       IFF_SLAVE_NEEDARP               = 1<<6,
-       IFF_ISATAP                      = 1<<7,
-       IFF_MASTER_ARPMON               = 1<<8,
-       IFF_WAN_HDLC                    = 1<<9,
-       IFF_XMIT_DST_RELEASE            = 1<<10,
-       IFF_DONT_BRIDGE                 = 1<<11,
-       IFF_DISABLE_NETPOLL             = 1<<12,
-       IFF_MACVLAN_PORT                = 1<<13,
-       IFF_BRIDGE_PORT                 = 1<<14,
-       IFF_OVS_DATAPATH                = 1<<15,
-       IFF_TX_SKB_SHARING              = 1<<16,
-       IFF_UNICAST_FLT                 = 1<<17,
-       IFF_TEAM_PORT                   = 1<<18,
-       IFF_SUPP_NOFCS                  = 1<<19,
-       IFF_LIVE_ADDR_CHANGE            = 1<<20,
-       IFF_MACVLAN                     = 1<<21,
-       IFF_XMIT_DST_RELEASE_PERM       = 1<<22,
-       IFF_IPVLAN_MASTER               = 1<<23,
-       IFF_IPVLAN_SLAVE                = 1<<24,
+       IFF_BONDING                     = 1<<2,
+       IFF_ISATAP                      = 1<<3,
+       IFF_WAN_HDLC                    = 1<<4,
+       IFF_XMIT_DST_RELEASE            = 1<<5,
+       IFF_DONT_BRIDGE                 = 1<<6,
+       IFF_DISABLE_NETPOLL             = 1<<7,
+       IFF_MACVLAN_PORT                = 1<<8,
+       IFF_BRIDGE_PORT                 = 1<<9,
+       IFF_OVS_DATAPATH                = 1<<10,
+       IFF_TX_SKB_SHARING              = 1<<11,
+       IFF_UNICAST_FLT                 = 1<<12,
+       IFF_TEAM_PORT                   = 1<<13,
+       IFF_SUPP_NOFCS                  = 1<<14,
+       IFF_LIVE_ADDR_CHANGE            = 1<<15,
+       IFF_MACVLAN                     = 1<<16,
+       IFF_XMIT_DST_RELEASE_PERM       = 1<<17,
+       IFF_IPVLAN_MASTER               = 1<<18,
+       IFF_IPVLAN_SLAVE                = 1<<19,
+       IFF_L3MDEV_MASTER               = 1<<20,
+       IFF_NO_QUEUE                    = 1<<21,
+       IFF_OPENVSWITCH                 = 1<<22,
+       IFF_L3MDEV_SLAVE                = 1<<23,
 };
 
 #define IFF_802_1Q_VLAN                        IFF_802_1Q_VLAN
 #define IFF_EBRIDGE                    IFF_EBRIDGE
-#define IFF_SLAVE_INACTIVE             IFF_SLAVE_INACTIVE
-#define IFF_MASTER_8023AD              IFF_MASTER_8023AD
-#define IFF_MASTER_ALB                 IFF_MASTER_ALB
 #define IFF_BONDING                    IFF_BONDING
-#define IFF_SLAVE_NEEDARP              IFF_SLAVE_NEEDARP
 #define IFF_ISATAP                     IFF_ISATAP
-#define IFF_MASTER_ARPMON              IFF_MASTER_ARPMON
 #define IFF_WAN_HDLC                   IFF_WAN_HDLC
 #define IFF_XMIT_DST_RELEASE           IFF_XMIT_DST_RELEASE
 #define IFF_DONT_BRIDGE                        IFF_DONT_BRIDGE
@@ -1297,6 +1319,10 @@ enum netdev_priv_flags {
 #define IFF_XMIT_DST_RELEASE_PERM      IFF_XMIT_DST_RELEASE_PERM
 #define IFF_IPVLAN_MASTER              IFF_IPVLAN_MASTER
 #define IFF_IPVLAN_SLAVE               IFF_IPVLAN_SLAVE
+#define IFF_L3MDEV_MASTER              IFF_L3MDEV_MASTER
+#define IFF_NO_QUEUE                   IFF_NO_QUEUE
+#define IFF_OPENVSWITCH                        IFF_OPENVSWITCH
+#define IFF_L3MDEV_SLAVE               IFF_L3MDEV_SLAVE
 
 /**
  *     struct net_device - The DEVICE structure.
@@ -1372,7 +1398,8 @@ enum netdev_priv_flags {
  *     @dma:           DMA channel
  *     @mtu:           Interface MTU value
  *     @type:          Interface hardware type
- *     @hard_header_len: Hardware header length
+ *     @hard_header_len: Hardware header length, which means that this is the
+ *                       minimum size of a packet.
  *
  *     @needed_headroom: Extra headroom the hardware may need, but not in all
  *                       cases can this be guaranteed
@@ -1444,6 +1471,8 @@ enum netdev_priv_flags {
  *
  *     @xps_maps:      XXX: need comments on this one
  *
+ *     @offload_fwd_mark:      Offload device fwding mark
+ *
  *     @trans_start:           Time (in jiffies) of last Tx
  *     @watchdog_timeo:        Represents the timeout that is used by
  *                             the watchdog ( see dev_watchdog() )
@@ -1498,6 +1527,10 @@ enum netdev_priv_flags {
  *
  *     @qdisc_tx_busylock:     XXX: need comments on this one
  *
+ *     @proto_down:    protocol port state information can be sent to the
+ *                     switch driver and used to set the phys state of the
+ *                     switch port.
+ *
  *     FIXME: cleanup struct net_device such that network protocol info
  *     moves out.
  */
@@ -1564,7 +1597,10 @@ struct net_device {
        const struct net_device_ops *netdev_ops;
        const struct ethtool_ops *ethtool_ops;
 #ifdef CONFIG_NET_SWITCHDEV
-       const struct swdev_ops *swdev_ops;
+       const struct switchdev_ops *switchdev_ops;
+#endif
+#ifdef CONFIG_NET_L3_MASTER_DEV
+       const struct l3mdev_ops *l3mdev_ops;
 #endif
 
        const struct header_ops *header_ops;
@@ -1652,7 +1688,14 @@ struct net_device {
        rx_handler_func_t __rcu *rx_handler;
        void __rcu              *rx_handler_data;
 
+#ifdef CONFIG_NET_CLS_ACT
+       struct tcf_proto __rcu  *ingress_cl_list;
+#endif
        struct netdev_queue __rcu *ingress_queue;
+#ifdef CONFIG_NETFILTER_INGRESS
+       struct list_head        nf_hooks_ingress;
+#endif
+
        unsigned char           broadcast[MAX_ADDR_LEN];
 #ifdef CONFIG_RFS_ACCEL
        struct cpu_rmap         *rx_cpu_rmap;
@@ -1674,6 +1717,10 @@ struct net_device {
        struct xps_dev_maps __rcu *xps_maps;
 #endif
 
+#ifdef CONFIG_NET_SWITCHDEV
+       u32                     offload_fwd_mark;
+#endif
+
        /* These may be needed for future network-power-down code. */
 
        /*
@@ -1751,6 +1798,7 @@ struct net_device {
 #endif
        struct phy_device *phydev;
        struct lock_class_key *qdisc_tx_busylock;
+       bool proto_down;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
 
@@ -1990,6 +2038,7 @@ struct offload_callbacks {
 
 struct packet_offload {
        __be16                   type;  /* This is really htons(ether_type). */
+       u16                      priority;
        struct offload_callbacks callbacks;
        struct list_head         list;
 };
@@ -2020,20 +2069,23 @@ struct pcpu_sw_netstats {
        struct u64_stats_sync   syncp;
 };
 
-#define netdev_alloc_pcpu_stats(type)                          \
-({                                                             \
-       typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
-       if (pcpu_stats) {                                       \
-               int __cpu;                                      \
-               for_each_possible_cpu(__cpu) {                  \
-                       typeof(type) *stat;                     \
-                       stat = per_cpu_ptr(pcpu_stats, __cpu);  \
-                       u64_stats_init(&stat->syncp);           \
-               }                                               \
-       }                                                       \
-       pcpu_stats;                                             \
+#define __netdev_alloc_pcpu_stats(type, gfp)                           \
+({                                                                     \
+       typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
+       if (pcpu_stats) {                                               \
+               int __cpu;                                              \
+               for_each_possible_cpu(__cpu) {                          \
+                       typeof(type) *stat;                             \
+                       stat = per_cpu_ptr(pcpu_stats, __cpu);          \
+                       u64_stats_init(&stat->syncp);                   \
+               }                                                       \
+       }                                                               \
+       pcpu_stats;                                                     \
 })
 
+#define netdev_alloc_pcpu_stats(type)                                  \
+       __netdev_alloc_pcpu_stats(type, GFP_KERNEL)
+
 #include <linux/notifier.h>
 
 /* netdevice notifier chain. Please remember to update the rtnetlink
@@ -2068,6 +2120,7 @@ struct pcpu_sw_netstats {
 #define NETDEV_PRECHANGEMTU    0x0017 /* notify before mtu change happened */
 #define NETDEV_CHANGEINFODATA  0x0018
 #define NETDEV_BONDING_INFO    0x0019
+#define NETDEV_PRECHANGEUPPER  0x001A
 
 int register_netdevice_notifier(struct notifier_block *nb);
 int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2081,6 +2134,13 @@ struct netdev_notifier_change_info {
        unsigned int flags_changed;
 };
 
+struct netdev_notifier_changeupper_info {
+       struct netdev_notifier_info info; /* must be first */
+       struct net_device *upper_dev; /* new upper dev */
+       bool master; /* is upper dev master */
+       bool linking; /* is the nofication for link or unlink */
+};
+
 static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
                                             struct net_device *dev)
 {
@@ -2161,6 +2221,7 @@ void dev_add_offload(struct packet_offload *po);
 void dev_remove_offload(struct packet_offload *po);
 
 int dev_get_iflink(const struct net_device *dev);
+int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
 struct net_device *__dev_get_by_flags(struct net *net, unsigned short flags,
                                      unsigned short mask);
 struct net_device *dev_get_by_name(struct net *net, const char *name);
@@ -2171,12 +2232,8 @@ int dev_open(struct net_device *dev);
 int dev_close(struct net_device *dev);
 int dev_close_many(struct list_head *head, bool unlink);
 void dev_disable_lro(struct net_device *dev);
-int dev_loopback_xmit(struct sock *sk, struct sk_buff *newskb);
-int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb);
-static inline int dev_queue_xmit(struct sk_buff *skb)
-{
-       return dev_queue_xmit_sk(skb->sk, skb);
-}
+int dev_loopback_xmit(struct net *net, struct sock *sk, struct sk_buff *newskb);
+int dev_queue_xmit(struct sk_buff *skb);
 int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
 int register_netdevice(struct net_device *dev);
 void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
@@ -2192,11 +2249,20 @@ void netdev_freemem(struct net_device *dev);
 void synchronize_net(void);
 int init_dummy_netdev(struct net_device *dev);
 
+#ifdef CONFIG_PREEMPT_RT_FULL
+static inline int dev_recursion_level(void)
+{
+       return current->xmit_recursion;
+}
+
+#else
+
 DECLARE_PER_CPU(int, xmit_recursion);
 static inline int dev_recursion_level(void)
 {
        return this_cpu_read(xmit_recursion);
 }
+#endif
 
 struct net_device *dev_get_by_index(struct net *net, int ifindex);
 struct net_device *__dev_get_by_index(struct net *net, int ifindex);
@@ -2265,8 +2331,7 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb);
 
 static inline bool skb_at_gro_remcsum_start(struct sk_buff *skb)
 {
-       return (NAPI_GRO_CB(skb)->gro_remcsum_start - skb_headroom(skb) ==
-               skb_gro_offset(skb));
+       return (NAPI_GRO_CB(skb)->gro_remcsum_start == skb_gro_offset(skb));
 }
 
 static inline bool __skb_gro_checksum_validate_needed(struct sk_buff *skb,
@@ -2362,37 +2427,58 @@ static inline void skb_gro_remcsum_init(struct gro_remcsum *grc)
        grc->delta = 0;
 }
 
-static inline void skb_gro_remcsum_process(struct sk_buff *skb, void *ptr,
-                                          int start, int offset,
-                                          struct gro_remcsum *grc,
-                                          bool nopartial)
+static inline void *skb_gro_remcsum_process(struct sk_buff *skb, void *ptr,
+                                           unsigned int off, size_t hdrlen,
+                                           int start, int offset,
+                                           struct gro_remcsum *grc,
+                                           bool nopartial)
 {
        __wsum delta;
+       size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start);
 
        BUG_ON(!NAPI_GRO_CB(skb)->csum_valid);
 
        if (!nopartial) {
-               NAPI_GRO_CB(skb)->gro_remcsum_start =
-                   ((unsigned char *)ptr + start) - skb->head;
-               return;
+               NAPI_GRO_CB(skb)->gro_remcsum_start = off + hdrlen + start;
+               return ptr;
+       }
+
+       ptr = skb_gro_header_fast(skb, off);
+       if (skb_gro_header_hard(skb, off + plen)) {
+               ptr = skb_gro_header_slow(skb, off + plen, off);
+               if (!ptr)
+                       return NULL;
        }
 
-       delta = remcsum_adjust(ptr, NAPI_GRO_CB(skb)->csum, start, offset);
+       delta = remcsum_adjust(ptr + hdrlen, NAPI_GRO_CB(skb)->csum,
+                              start, offset);
 
        /* Adjust skb->csum since we changed the packet */
        NAPI_GRO_CB(skb)->csum = csum_add(NAPI_GRO_CB(skb)->csum, delta);
 
-       grc->offset = (ptr + offset) - (void *)skb->head;
+       grc->offset = off + hdrlen + offset;
        grc->delta = delta;
+
+       return ptr;
 }
 
 static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
                                           struct gro_remcsum *grc)
 {
+       void *ptr;
+       size_t plen = grc->offset + sizeof(u16);
+
        if (!grc->delta)
                return;
 
-       remcsum_unadjust((__sum16 *)(skb->head + grc->offset), grc->delta);
+       ptr = skb_gro_header_fast(skb, grc->offset);
+       if (skb_gro_header_hard(skb, grc->offset + sizeof(u16))) {
+               ptr = skb_gro_header_slow(skb, plen, grc->offset);
+               if (!ptr)
+                       return;
+       }
+
+       remcsum_unadjust((__sum16 *)ptr, grc->delta);
 }
 
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
@@ -2553,10 +2639,6 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
 
 static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
 {
-       if (WARN_ON(!dev_queue)) {
-               pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
-               return;
-       }
        set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
 }
 
@@ -2572,15 +2654,7 @@ static inline void netif_stop_queue(struct net_device *dev)
        netif_tx_stop_queue(netdev_get_tx_queue(dev, 0));
 }
 
-static inline void netif_tx_stop_all_queues(struct net_device *dev)
-{
-       unsigned int i;
-
-       for (i = 0; i < dev->num_tx_queues; i++) {
-               struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
-               netif_tx_stop_queue(txq);
-       }
-}
+void netif_tx_stop_all_queues(struct net_device *dev);
 
 static inline bool netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
 {
@@ -2841,6 +2915,9 @@ static inline int netif_set_xps_queue(struct net_device *dev,
 }
 #endif
 
+u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
+                 unsigned int num_tx_queues);
+
 /*
  * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
  * as a distribution range limit for the returned value.
@@ -2938,11 +3015,7 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
 
 int netif_rx(struct sk_buff *skb);
 int netif_rx_ni(struct sk_buff *skb);
-int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb);
-static inline int netif_receive_skb(struct sk_buff *skb)
-{
-       return netif_receive_skb_sk(skb->sk, skb);
-}
+int netif_receive_skb(struct sk_buff *skb);
 gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
 void napi_gro_flush(struct napi_struct *napi, bool flush_old);
 struct sk_buff *napi_get_frags(struct napi_struct *napi);
@@ -2980,6 +3053,7 @@ int dev_get_phys_port_id(struct net_device *dev,
                         struct netdev_phys_item_id *ppid);
 int dev_get_phys_port_name(struct net_device *dev,
                           char *name, size_t len);
+int dev_change_proto_down(struct net_device *dev, bool proto_down);
 struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
 struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
                                    struct netdev_queue *txq, int *ret);
@@ -3779,6 +3853,31 @@ static inline bool netif_supports_nofcs(struct net_device *dev)
        return dev->priv_flags & IFF_SUPP_NOFCS;
 }
 
+static inline bool netif_is_l3_master(const struct net_device *dev)
+{
+       return dev->priv_flags & IFF_L3MDEV_MASTER;
+}
+
+static inline bool netif_is_l3_slave(const struct net_device *dev)
+{
+       return dev->priv_flags & IFF_L3MDEV_SLAVE;
+}
+
+static inline bool netif_is_bridge_master(const struct net_device *dev)
+{
+       return dev->priv_flags & IFF_EBRIDGE;
+}
+
+static inline bool netif_is_bridge_port(const struct net_device *dev)
+{
+       return dev->priv_flags & IFF_BRIDGE_PORT;
+}
+
+static inline bool netif_is_ovs_master(const struct net_device *dev)
+{
+       return dev->priv_flags & IFF_OPENVSWITCH;
+}
+
 /* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
 static inline void netif_keep_dst(struct net_device *dev)
 {