struct net_device *dev;
 
        prio = rt_tos2priority(tos);
-       dev = ndev->priv_flags & IFF_802_1Q_VLAN ?
-               vlan_dev_real_dev(ndev) : ndev;
-
+       dev = is_vlan_dev(ndev) ? vlan_dev_real_dev(ndev) : ndev;
        if (dev->num_tc)
                return netdev_get_prio_tc_map(dev, prio);
 
 #if IS_ENABLED(CONFIG_VLAN_8021Q)
-       if (ndev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(ndev))
                return (vlan_dev_get_egress_qos_mask(ndev, prio) &
                        VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
 #endif
 
 
        ndev = rxe->ndev;
 
-       if (ndev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(ndev))
                ndev = vlan_dev_real_dev(ndev);
 
        return ndev->dev.parent;
 
 static inline u16 cnic_get_vlan(struct net_device *dev,
                                struct net_device **vlan_dev)
 {
-       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(dev)) {
                *vlan_dev = vlan_dev_real_dev(dev);
                return vlan_dev_vlan_id(dev);
        }
 
                e->smt_idx = smt_idx;
                atomic_set(&e->refcnt, 1);
                neigh_replace(e, neigh);
-               if (neigh->dev->priv_flags & IFF_802_1Q_VLAN)
+               if (is_vlan_dev(neigh->dev))
                        e->vlan = vlan_dev_vlan_id(neigh->dev);
                else
                        e->vlan = VLAN_NONE;
 
        const struct device *parent;
        const struct net_device *netdev = neigh->dev;
 
-       if (netdev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(netdev))
                netdev = vlan_dev_real_dev(netdev);
        parent = netdev->dev.parent;
        if (parent && parent->driver == &cxgb4_driver.driver)
 #if IS_ENABLED(CONFIG_BONDING)
        struct adapter *adap;
 #endif
-       if (event_dev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(event_dev))
                event_dev = vlan_dev_real_dev(event_dev);
 #if IS_ENABLED(CONFIG_BONDING)
        if (event_dev->flags & IFF_MASTER) {
 
        else
                lport = netdev2pinfo(physdev)->lport;
 
-       if (neigh->dev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(neigh->dev))
                vlan = vlan_dev_vlan_id(neigh->dev);
        else
                vlan = VLAN_NONE;
 
                cur = kzalloc(sizeof(struct nx_ip_list), GFP_ATOMIC);
                if (cur == NULL)
                        goto out;
-               if (dev->priv_flags & IFF_802_1Q_VLAN)
+               if (is_vlan_dev(dev))
                        dev = vlan_dev_real_dev(dev);
                cur->master = !!netif_is_bond_master(dev);
                cur->ip_addr = ifa->ifa_address;
            !netif_is_bond_slave(dev)) {
                netxen_config_indev_addr(adapter, master, event);
                for_each_netdev_rcu(&init_net, slave)
-                       if (slave->priv_flags & IFF_802_1Q_VLAN &&
+                       if (is_vlan_dev(slave) &&
                            vlan_dev_real_dev(slave) == master)
                                netxen_config_indev_addr(adapter, slave, event);
        }
        if (dev == NULL)
                goto done;
 
-       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(dev)) {
                dev = vlan_dev_real_dev(dev);
                goto recheck;
        }
        if (dev == NULL)
                goto done;
 
-       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(dev)) {
                dev = vlan_dev_real_dev(dev);
                goto recheck;
        }
 
        if (dev == NULL)
                goto done;
 
-       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(dev)) {
                dev = vlan_dev_real_dev(dev);
                goto recheck;
        }
        if (dev == NULL)
                goto done;
 
-       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(dev)) {
                dev = vlan_dev_real_dev(dev);
                goto recheck;
        }
 
                return NOTIFY_DONE;
 
        /* Avoid Vlan dev with same MAC registering as VF */
-       if (event_dev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(event_dev))
                return NOTIFY_DONE;
 
        /* Avoid Bonding master dev with same MAC registering as VF */
 
        }
 
        /* obtain physical netdev */
-       if (netdev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(netdev))
                phys_dev = vlan_dev_real_dev(netdev);
 
        /* verify if the physical device is a netxtreme2 device */
                goto ifput_err;
        }
 
-       if (netdev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(netdev)) {
                vlan_id = vlan_dev_vlan_id(netdev);
                interface->vlan_enabled = 1;
        }
        struct net_device *phys_dev = netdev;
 
        mutex_lock(&bnx2fc_dev_lock);
-       if (netdev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(netdev))
                phys_dev = vlan_dev_real_dev(netdev);
 
        if (bnx2fc_hba_lookup(phys_dev)) {
 
        struct cxgbi_device *cdev, *tmp;
        int i;
 
-       if (ndev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(ndev)) {
                vdev = ndev;
                ndev = vlan_dev_real_dev(ndev);
                log_debug(1 << CXGBI_DBG_DEV,
        struct cxgbi_device *cdev;
        int i;
 
-       if (ndev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(ndev)) {
                vdev = ndev;
                ndev = vlan_dev_real_dev(ndev);
                pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name);
        struct cxgbi_device *cdev, *tmp;
        int i;
 
-       if (ndev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(ndev)) {
                vdev = ndev;
                ndev = vlan_dev_real_dev(ndev);
                pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name);
 
 
        /* look for SAN MAC address, if multiple SAN MACs exist, only
         * use the first one for SPMA */
-       real_dev = (netdev->priv_flags & IFF_802_1Q_VLAN) ?
-               vlan_dev_real_dev(netdev) : netdev;
+       real_dev = is_vlan_dev(netdev) ? vlan_dev_real_dev(netdev) : netdev;
        fcoe->realdev = real_dev;
        rcu_read_lock();
        for_each_dev_addr(real_dev, ha) {
        ctlr = fcoe_to_ctlr(fcoe);
 
        /* Figure out the VLAN ID, if any */
-       if (netdev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(netdev))
                lport->vlan = vlan_dev_vlan_id(netdev);
        else
                lport->vlan = 0;
         * Reuse existing offload em instance in case
         * it is already allocated on real eth device
         */
-       if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN)
+       if (is_vlan_dev(fcoe->netdev))
                cur_real_dev = vlan_dev_real_dev(fcoe->netdev);
        else
                cur_real_dev = fcoe->netdev;
 
        list_for_each_entry(oldfcoe, &fcoe_hostlist, list) {
-               if (oldfcoe->netdev->priv_flags & IFF_802_1Q_VLAN)
+               if (is_vlan_dev(oldfcoe->netdev))
                        old_real_dev = vlan_dev_real_dev(oldfcoe->netdev);
                else
                        old_real_dev = oldfcoe->netdev;
        skb->protocol = htons(ETH_P_FCOE);
        skb->priority = fcoe->priority;
 
-       if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN &&
+       if (is_vlan_dev(fcoe->netdev) &&
            fcoe->realdev->features & NETIF_F_HW_VLAN_CTAG_TX) {
                /* must set skb->dev before calling vlan_put_tag */
                skb->dev = fcoe->realdev;
        struct net_device *real_dev;
 
        list_for_each_entry(fcoe, &fcoe_hostlist, list) {
-               if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN)
+               if (is_vlan_dev(fcoe->netdev))
                        real_dev = vlan_dev_real_dev(fcoe->netdev);
                else
                        real_dev = fcoe->netdev;
 
 
 static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev)
 {
-       return dev->priv_flags & IFF_802_1Q_VLAN ?
-               vlan_dev_vlan_id(dev) : 0xffff;
+       return is_vlan_dev(dev) ? vlan_dev_vlan_id(dev) : 0xffff;
 }
 
 static inline int rdma_ip2gid(struct sockaddr *addr, union ib_gid *gid)
 
 static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev)
 {
-       return dev->priv_flags & IFF_802_1Q_VLAN ?
-               vlan_dev_real_dev(dev) : NULL;
+       return is_vlan_dev(dev) ? vlan_dev_real_dev(dev) : NULL;
 }
 
 #endif /* IB_ADDR_H */
 
 #include "hsr_slave.h"
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <linux/if_vlan.h>
 #include "hsr_main.h"
 #include "hsr_device.h"
 #include "hsr_forward.h"
                return -EINVAL;
        }
 
-       if (dev->priv_flags & IFF_802_1Q_VLAN) {
+       if (is_vlan_dev(dev)) {
                netdev_info(dev, "HSR on top of VLAN is not yet supported in this driver.\n");
                return -EINVAL;
        }