Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net-next: treewide use is_vlan_dev() helper function.

This patch makes use of is_vlan_dev() function instead of flag
comparison which is exactly done by is_vlan_dev() helper function.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jon Maxwell <jmaxwell37@gmail.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Parav Pandit and committed by
David S. Miller
d0d7b10b 73cfb2a2

+31 -35
+2 -4
drivers/infiniband/core/cma.c
··· 2467 2467 struct net_device *dev; 2468 2468 2469 2469 prio = rt_tos2priority(tos); 2470 - dev = ndev->priv_flags & IFF_802_1Q_VLAN ? 2471 - vlan_dev_real_dev(ndev) : ndev; 2472 - 2470 + dev = is_vlan_dev(ndev) ? vlan_dev_real_dev(ndev) : ndev; 2473 2471 if (dev->num_tc) 2474 2472 return netdev_get_prio_tc_map(dev, prio); 2475 2473 2476 2474 #if IS_ENABLED(CONFIG_VLAN_8021Q) 2477 - if (ndev->priv_flags & IFF_802_1Q_VLAN) 2475 + if (is_vlan_dev(ndev)) 2478 2476 return (vlan_dev_get_egress_qos_mask(ndev, prio) & 2479 2477 VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; 2480 2478 #endif
+1 -1
drivers/infiniband/sw/rxe/rxe_net.c
··· 118 118 119 119 ndev = rxe->ndev; 120 120 121 - if (ndev->priv_flags & IFF_802_1Q_VLAN) 121 + if (is_vlan_dev(ndev)) 122 122 ndev = vlan_dev_real_dev(ndev); 123 123 124 124 return ndev->dev.parent;
+1 -1
drivers/net/ethernet/broadcom/cnic.c
··· 3665 3665 static inline u16 cnic_get_vlan(struct net_device *dev, 3666 3666 struct net_device **vlan_dev) 3667 3667 { 3668 - if (dev->priv_flags & IFF_802_1Q_VLAN) { 3668 + if (is_vlan_dev(dev)) { 3669 3669 *vlan_dev = vlan_dev_real_dev(dev); 3670 3670 return vlan_dev_vlan_id(dev); 3671 3671 }
+1 -1
drivers/net/ethernet/chelsio/cxgb3/l2t.c
··· 351 351 e->smt_idx = smt_idx; 352 352 atomic_set(&e->refcnt, 1); 353 353 neigh_replace(e, neigh); 354 - if (neigh->dev->priv_flags & IFF_802_1Q_VLAN) 354 + if (is_vlan_dev(neigh->dev)) 355 355 e->vlan = vlan_dev_vlan_id(neigh->dev); 356 356 else 357 357 e->vlan = VLAN_NONE;
+2 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
··· 1805 1805 const struct device *parent; 1806 1806 const struct net_device *netdev = neigh->dev; 1807 1807 1808 - if (netdev->priv_flags & IFF_802_1Q_VLAN) 1808 + if (is_vlan_dev(netdev)) 1809 1809 netdev = vlan_dev_real_dev(netdev); 1810 1810 parent = netdev->dev.parent; 1811 1811 if (parent && parent->driver == &cxgb4_driver.driver) ··· 2111 2111 #if IS_ENABLED(CONFIG_BONDING) 2112 2112 struct adapter *adap; 2113 2113 #endif 2114 - if (event_dev->priv_flags & IFF_802_1Q_VLAN) 2114 + if (is_vlan_dev(event_dev)) 2115 2115 event_dev = vlan_dev_real_dev(event_dev); 2116 2116 #if IS_ENABLED(CONFIG_BONDING) 2117 2117 if (event_dev->flags & IFF_MASTER) {
+1 -1
drivers/net/ethernet/chelsio/cxgb4/l2t.c
··· 432 432 else 433 433 lport = netdev2pinfo(physdev)->lport; 434 434 435 - if (neigh->dev->priv_flags & IFF_802_1Q_VLAN) 435 + if (is_vlan_dev(neigh->dev)) 436 436 vlan = vlan_dev_vlan_id(neigh->dev); 437 437 else 438 438 vlan = VLAN_NONE;
+4 -4
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
··· 3264 3264 cur = kzalloc(sizeof(struct nx_ip_list), GFP_ATOMIC); 3265 3265 if (cur == NULL) 3266 3266 goto out; 3267 - if (dev->priv_flags & IFF_802_1Q_VLAN) 3267 + if (is_vlan_dev(dev)) 3268 3268 dev = vlan_dev_real_dev(dev); 3269 3269 cur->master = !!netif_is_bond_master(dev); 3270 3270 cur->ip_addr = ifa->ifa_address; ··· 3374 3374 !netif_is_bond_slave(dev)) { 3375 3375 netxen_config_indev_addr(adapter, master, event); 3376 3376 for_each_netdev_rcu(&init_net, slave) 3377 - if (slave->priv_flags & IFF_802_1Q_VLAN && 3377 + if (is_vlan_dev(slave) && 3378 3378 vlan_dev_real_dev(slave) == master) 3379 3379 netxen_config_indev_addr(adapter, slave, event); 3380 3380 } ··· 3400 3400 if (dev == NULL) 3401 3401 goto done; 3402 3402 3403 - if (dev->priv_flags & IFF_802_1Q_VLAN) { 3403 + if (is_vlan_dev(dev)) { 3404 3404 dev = vlan_dev_real_dev(dev); 3405 3405 goto recheck; 3406 3406 } ··· 3445 3445 if (dev == NULL) 3446 3446 goto done; 3447 3447 3448 - if (dev->priv_flags & IFF_802_1Q_VLAN) { 3448 + if (is_vlan_dev(dev)) { 3449 3449 dev = vlan_dev_real_dev(dev); 3450 3450 goto recheck; 3451 3451 }
+2 -2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 4220 4220 if (dev == NULL) 4221 4221 goto done; 4222 4222 4223 - if (dev->priv_flags & IFF_802_1Q_VLAN) { 4223 + if (is_vlan_dev(dev)) { 4224 4224 dev = vlan_dev_real_dev(dev); 4225 4225 goto recheck; 4226 4226 } ··· 4256 4256 if (dev == NULL) 4257 4257 goto done; 4258 4258 4259 - if (dev->priv_flags & IFF_802_1Q_VLAN) { 4259 + if (is_vlan_dev(dev)) { 4260 4260 dev = vlan_dev_real_dev(dev); 4261 4261 goto recheck; 4262 4262 }
+1 -1
drivers/net/hyperv/netvsc_drv.c
··· 1605 1605 return NOTIFY_DONE; 1606 1606 1607 1607 /* Avoid Vlan dev with same MAC registering as VF */ 1608 - if (event_dev->priv_flags & IFF_802_1Q_VLAN) 1608 + if (is_vlan_dev(event_dev)) 1609 1609 return NOTIFY_DONE; 1610 1610 1611 1611 /* Avoid Bonding master dev with same MAC registering as VF */
+3 -3
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
··· 2282 2282 } 2283 2283 2284 2284 /* obtain physical netdev */ 2285 - if (netdev->priv_flags & IFF_802_1Q_VLAN) 2285 + if (is_vlan_dev(netdev)) 2286 2286 phys_dev = vlan_dev_real_dev(netdev); 2287 2287 2288 2288 /* verify if the physical device is a netxtreme2 device */ ··· 2320 2320 goto ifput_err; 2321 2321 } 2322 2322 2323 - if (netdev->priv_flags & IFF_802_1Q_VLAN) { 2323 + if (is_vlan_dev(netdev)) { 2324 2324 vlan_id = vlan_dev_vlan_id(netdev); 2325 2325 interface->vlan_enabled = 1; 2326 2326 } ··· 2538 2538 struct net_device *phys_dev = netdev; 2539 2539 2540 2540 mutex_lock(&bnx2fc_dev_lock); 2541 - if (netdev->priv_flags & IFF_802_1Q_VLAN) 2541 + if (is_vlan_dev(netdev)) 2542 2542 phys_dev = vlan_dev_real_dev(netdev); 2543 2543 2544 2544 if (bnx2fc_hba_lookup(phys_dev)) {
+3 -3
drivers/scsi/cxgbi/libcxgbi.c
··· 223 223 struct cxgbi_device *cdev, *tmp; 224 224 int i; 225 225 226 - if (ndev->priv_flags & IFF_802_1Q_VLAN) { 226 + if (is_vlan_dev(ndev)) { 227 227 vdev = ndev; 228 228 ndev = vlan_dev_real_dev(ndev); 229 229 log_debug(1 << CXGBI_DBG_DEV, ··· 256 256 struct cxgbi_device *cdev; 257 257 int i; 258 258 259 - if (ndev->priv_flags & IFF_802_1Q_VLAN) { 259 + if (is_vlan_dev(ndev)) { 260 260 vdev = ndev; 261 261 ndev = vlan_dev_real_dev(ndev); 262 262 pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name); ··· 290 290 struct cxgbi_device *cdev, *tmp; 291 291 int i; 292 292 293 - if (ndev->priv_flags & IFF_802_1Q_VLAN) { 293 + if (is_vlan_dev(ndev)) { 294 294 vdev = ndev; 295 295 ndev = vlan_dev_real_dev(ndev); 296 296 pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name);
+6 -7
drivers/scsi/fcoe/fcoe.c
··· 326 326 327 327 /* look for SAN MAC address, if multiple SAN MACs exist, only 328 328 * use the first one for SPMA */ 329 - real_dev = (netdev->priv_flags & IFF_802_1Q_VLAN) ? 330 - vlan_dev_real_dev(netdev) : netdev; 329 + real_dev = is_vlan_dev(netdev) ? vlan_dev_real_dev(netdev) : netdev; 331 330 fcoe->realdev = real_dev; 332 331 rcu_read_lock(); 333 332 for_each_dev_addr(real_dev, ha) { ··· 729 730 ctlr = fcoe_to_ctlr(fcoe); 730 731 731 732 /* Figure out the VLAN ID, if any */ 732 - if (netdev->priv_flags & IFF_802_1Q_VLAN) 733 + if (is_vlan_dev(netdev)) 733 734 lport->vlan = vlan_dev_vlan_id(netdev); 734 735 else 735 736 lport->vlan = 0; ··· 958 959 * Reuse existing offload em instance in case 959 960 * it is already allocated on real eth device 960 961 */ 961 - if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN) 962 + if (is_vlan_dev(fcoe->netdev)) 962 963 cur_real_dev = vlan_dev_real_dev(fcoe->netdev); 963 964 else 964 965 cur_real_dev = fcoe->netdev; 965 966 966 967 list_for_each_entry(oldfcoe, &fcoe_hostlist, list) { 967 - if (oldfcoe->netdev->priv_flags & IFF_802_1Q_VLAN) 968 + if (is_vlan_dev(oldfcoe->netdev)) 968 969 old_real_dev = vlan_dev_real_dev(oldfcoe->netdev); 969 970 else 970 971 old_real_dev = oldfcoe->netdev; ··· 1562 1563 skb->protocol = htons(ETH_P_FCOE); 1563 1564 skb->priority = fcoe->priority; 1564 1565 1565 - if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN && 1566 + if (is_vlan_dev(fcoe->netdev) && 1566 1567 fcoe->realdev->features & NETIF_F_HW_VLAN_CTAG_TX) { 1567 1568 /* must set skb->dev before calling vlan_put_tag */ 1568 1569 skb->dev = fcoe->realdev; ··· 1793 1794 struct net_device *real_dev; 1794 1795 1795 1796 list_for_each_entry(fcoe, &fcoe_hostlist, list) { 1796 - if (fcoe->netdev->priv_flags & IFF_802_1Q_VLAN) 1797 + if (is_vlan_dev(fcoe->netdev)) 1797 1798 real_dev = vlan_dev_real_dev(fcoe->netdev); 1798 1799 else 1799 1800 real_dev = fcoe->netdev;
+2 -4
include/rdma/ib_addr.h
··· 160 160 161 161 static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev) 162 162 { 163 - return dev->priv_flags & IFF_802_1Q_VLAN ? 164 - vlan_dev_vlan_id(dev) : 0xffff; 163 + return is_vlan_dev(dev) ? vlan_dev_vlan_id(dev) : 0xffff; 165 164 } 166 165 167 166 static inline int rdma_ip2gid(struct sockaddr *addr, union ib_gid *gid) ··· 325 326 326 327 static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev) 327 328 { 328 - return dev->priv_flags & IFF_802_1Q_VLAN ? 329 - vlan_dev_real_dev(dev) : NULL; 329 + return is_vlan_dev(dev) ? vlan_dev_real_dev(dev) : NULL; 330 330 } 331 331 332 332 #endif /* IB_ADDR_H */
+2 -1
net/hsr/hsr_slave.c
··· 12 12 #include "hsr_slave.h" 13 13 #include <linux/etherdevice.h> 14 14 #include <linux/if_arp.h> 15 + #include <linux/if_vlan.h> 15 16 #include "hsr_main.h" 16 17 #include "hsr_device.h" 17 18 #include "hsr_forward.h" ··· 82 81 return -EINVAL; 83 82 } 84 83 85 - if (dev->priv_flags & IFF_802_1Q_VLAN) { 84 + if (is_vlan_dev(dev)) { 86 85 netdev_info(dev, "HSR on top of VLAN is not yet supported in this driver.\n"); 87 86 return -EINVAL; 88 87 }