Lines Matching full:vlan
58 struct macvlan_dev *vlan; member
123 struct macvlan_dev *vlan; in macvlan_hash_lookup() local
126 hlist_for_each_entry_rcu(vlan, &port->vlan_hash[idx], hlist, in macvlan_hash_lookup()
128 if (ether_addr_equal_64bits(vlan->dev->dev_addr, addr)) in macvlan_hash_lookup()
129 return vlan; in macvlan_hash_lookup()
135 const struct macvlan_dev *vlan, in macvlan_hash_lookup_source() argument
140 struct hlist_head *h = &vlan->port->vlan_source_hash[idx]; in macvlan_hash_lookup_source()
144 entry->vlan == vlan) in macvlan_hash_lookup_source()
150 static int macvlan_hash_add_source(struct macvlan_dev *vlan, in macvlan_hash_add_source() argument
153 struct macvlan_port *port = vlan->port; in macvlan_hash_add_source()
157 entry = macvlan_hash_lookup_source(vlan, addr); in macvlan_hash_add_source()
166 entry->vlan = vlan; in macvlan_hash_add_source()
169 vlan->macaddr_count++; in macvlan_hash_add_source()
174 static void macvlan_hash_add(struct macvlan_dev *vlan) in macvlan_hash_add() argument
176 struct macvlan_port *port = vlan->port; in macvlan_hash_add()
177 const unsigned char *addr = vlan->dev->dev_addr; in macvlan_hash_add()
180 hlist_add_head_rcu(&vlan->hlist, &port->vlan_hash[idx]); in macvlan_hash_add()
189 static void macvlan_hash_del(struct macvlan_dev *vlan, bool sync) in macvlan_hash_del() argument
191 hlist_del_rcu(&vlan->hlist); in macvlan_hash_del()
196 static void macvlan_hash_change_addr(struct macvlan_dev *vlan, in macvlan_hash_change_addr() argument
199 macvlan_hash_del(vlan, true); in macvlan_hash_change_addr()
203 memcpy(vlan->dev->dev_addr, addr, ETH_ALEN); in macvlan_hash_change_addr()
204 macvlan_hash_add(vlan); in macvlan_hash_change_addr()
226 const struct macvlan_dev *vlan, in macvlan_broadcast_one() argument
229 struct net_device *dev = vlan->dev; in macvlan_broadcast_one()
243 static u32 macvlan_hash_mix(const struct macvlan_dev *vlan) in macvlan_hash_mix() argument
245 return (u32)(((unsigned long)vlan) >> L1_CACHE_SHIFT); in macvlan_hash_mix()
249 static unsigned int mc_hash(const struct macvlan_dev *vlan, in mc_hash() argument
254 val ^= macvlan_hash_mix(vlan); in mc_hash()
264 const struct macvlan_dev *vlan; in macvlan_broadcast() local
274 hlist_for_each_entry_rcu(vlan, &port->vlan_hash[i], hlist) { in macvlan_broadcast()
275 if (vlan->dev == src || !(vlan->mode & mode)) in macvlan_broadcast()
278 hash = mc_hash(vlan, eth->h_dest); in macvlan_broadcast()
279 if (!test_bit(hash, vlan->mc_filter)) in macvlan_broadcast()
286 nskb, vlan, eth, in macvlan_broadcast()
289 macvlan_count_rx(vlan, skb->len + ETH_HLEN, in macvlan_broadcast()
379 struct macvlan_dev *vlan) in macvlan_flush_sources() argument
391 if (entry->vlan == vlan) in macvlan_flush_sources()
395 vlan->macaddr_count = 0; in macvlan_flush_sources()
399 struct macvlan_dev *vlan) in macvlan_forward_source_one() argument
406 dev = vlan->dev; in macvlan_forward_source_one()
421 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, false); in macvlan_forward_source_one()
434 macvlan_forward_source_one(skb, entry->vlan); in macvlan_forward_source()
444 const struct macvlan_dev *vlan; in macvlan_handle_frame() local
469 vlan = src; in macvlan_handle_frame()
470 ret = macvlan_broadcast_one(skb, vlan, eth, 0) ?: in macvlan_handle_frame()
485 vlan = list_first_or_null_rcu(&port->vlans, in macvlan_handle_frame()
488 vlan = macvlan_hash_lookup(port, eth->h_dest); in macvlan_handle_frame()
489 if (!vlan || vlan->mode == MACVLAN_MODE_SOURCE) in macvlan_handle_frame()
492 dev = vlan->dev; in macvlan_handle_frame()
512 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, false); in macvlan_handle_frame()
518 const struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_queue_xmit() local
519 const struct macvlan_port *port = vlan->port; in macvlan_queue_xmit()
522 if (vlan->mode == MACVLAN_MODE_BRIDGE) { in macvlan_queue_xmit()
535 dev_forward_skb(vlan->lowerdev, skb); in macvlan_queue_xmit()
541 skb->dev = vlan->lowerdev; in macvlan_queue_xmit()
546 static inline netdev_tx_t macvlan_netpoll_send_skb(struct macvlan_dev *vlan, struct sk_buff *skb) in macvlan_netpoll_send_skb() argument
549 return netpoll_send_skb(vlan->netpoll, skb); in macvlan_netpoll_send_skb()
559 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_start_xmit() local
564 return macvlan_netpoll_send_skb(vlan, skb); in macvlan_start_xmit()
571 pcpu_stats = this_cpu_ptr(vlan->pcpu_stats); in macvlan_start_xmit()
577 this_cpu_inc(vlan->pcpu_stats->tx_dropped); in macvlan_start_xmit()
586 const struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_hard_header() local
587 struct net_device *lowerdev = vlan->lowerdev; in macvlan_hard_header()
602 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_open() local
603 struct net_device *lowerdev = vlan->lowerdev; in macvlan_open()
606 if (macvlan_passthru(vlan->port)) { in macvlan_open()
607 if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) { in macvlan_open()
616 if (macvlan_addr_busy(vlan->port, dev->dev_addr)) in macvlan_open()
623 vlan->accel_priv = in macvlan_open()
629 if (IS_ERR_OR_NULL(vlan->accel_priv)) { in macvlan_open()
630 vlan->accel_priv = NULL; in macvlan_open()
649 macvlan_hash_add(vlan); in macvlan_open()
656 if (vlan->accel_priv) { in macvlan_open()
658 vlan->accel_priv); in macvlan_open()
659 vlan->accel_priv = NULL; in macvlan_open()
669 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_stop() local
670 struct net_device *lowerdev = vlan->lowerdev; in macvlan_stop()
672 if (vlan->accel_priv) { in macvlan_stop()
674 vlan->accel_priv); in macvlan_stop()
675 vlan->accel_priv = NULL; in macvlan_stop()
681 if (macvlan_passthru(vlan->port)) { in macvlan_stop()
682 if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) in macvlan_stop()
696 macvlan_hash_del(vlan, !dev->dismantle); in macvlan_stop()
702 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_sync_address() local
703 struct net_device *lowerdev = vlan->lowerdev; in macvlan_sync_address()
704 struct macvlan_port *port = vlan->port; in macvlan_sync_address()
712 if (macvlan_addr_busy(vlan->port, addr)) in macvlan_sync_address()
723 macvlan_hash_change_addr(vlan, addr); in macvlan_sync_address()
730 ether_addr_copy(vlan->port->perm_addr, in macvlan_sync_address()
739 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_set_mac_address() local
749 if (vlan->mode == MACVLAN_MODE_PASSTHRU) { in macvlan_set_mac_address()
750 macvlan_set_addr_change(vlan->port); in macvlan_set_mac_address()
751 return dev_set_mac_address(vlan->lowerdev, addr, NULL); in macvlan_set_mac_address()
754 if (macvlan_addr_busy(vlan->port, addr->sa_data)) in macvlan_set_mac_address()
762 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_change_rx_flags() local
763 struct net_device *lowerdev = vlan->lowerdev; in macvlan_change_rx_flags()
777 struct macvlan_dev *vlan) in macvlan_compute_filter() argument
787 __set_bit(mc_hash(vlan, ha->addr), filter); in macvlan_compute_filter()
790 __set_bit(mc_hash(vlan, dev->broadcast), filter); in macvlan_compute_filter()
798 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_set_mac_lists() local
800 macvlan_compute_filter(vlan->mc_filter, dev, vlan); in macvlan_set_mac_lists()
802 dev_uc_sync(vlan->lowerdev, dev); in macvlan_set_mac_lists()
803 dev_mc_sync(vlan->lowerdev, dev); in macvlan_set_mac_lists()
806 * list of vlan->lowerdev too. in macvlan_set_mac_lists()
818 macvlan_compute_filter(vlan->port->mc_filter, vlan->lowerdev, NULL); in macvlan_set_mac_lists()
823 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_change_mtu() local
825 if (vlan->lowerdev->mtu < new_mtu) in macvlan_change_mtu()
889 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_init() local
890 const struct net_device *lowerdev = vlan->lowerdev; in macvlan_init()
891 struct macvlan_port *port = vlan->port; in macvlan_init()
906 vlan->pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats); in macvlan_init()
907 if (!vlan->pcpu_stats) in macvlan_init()
917 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_uninit() local
918 struct macvlan_port *port = vlan->port; in macvlan_uninit()
920 free_percpu(vlan->pcpu_stats); in macvlan_uninit()
922 macvlan_flush_sources(port, vlan); in macvlan_uninit()
931 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_dev_get_stats64() local
933 if (vlan->pcpu_stats) { in macvlan_dev_get_stats64()
941 p = per_cpu_ptr(vlan->pcpu_stats, i); in macvlan_dev_get_stats64()
971 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_vlan_rx_add_vid() local
972 struct net_device *lowerdev = vlan->lowerdev; in macvlan_vlan_rx_add_vid()
980 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_vlan_rx_kill_vid() local
981 struct net_device *lowerdev = vlan->lowerdev; in macvlan_vlan_rx_kill_vid()
993 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_fdb_add() local
999 if (!macvlan_passthru(vlan->port) && is_unicast_ether_addr(addr)) in macvlan_fdb_add()
1017 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_fdb_del() local
1023 if (!macvlan_passthru(vlan->port) && is_unicast_ether_addr(addr)) in macvlan_fdb_del()
1044 const struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_ethtool_get_link_ksettings() local
1046 return __ethtool_get_link_ksettings(vlan->lowerdev, cmd); in macvlan_ethtool_get_link_ksettings()
1072 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_fix_features() local
1073 netdev_features_t lowerdev_features = vlan->lowerdev->features; in macvlan_fix_features()
1077 features &= (vlan->set_features | ~MACVLAN_FEATURES); in macvlan_fix_features()
1096 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_dev_netpoll_setup() local
1097 struct net_device *real_dev = vlan->lowerdev; in macvlan_dev_netpoll_setup()
1112 vlan->netpoll = netpoll; in macvlan_dev_netpoll_setup()
1120 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_dev_netpoll_cleanup() local
1121 struct netpoll *netpoll = vlan->netpoll; in macvlan_dev_netpoll_cleanup()
1126 vlan->netpoll = NULL; in macvlan_dev_netpoll_cleanup()
1134 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_dev_get_iflink() local
1136 return vlan->lowerdev->ifindex; in macvlan_dev_get_iflink()
1348 static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode, in macvlan_changelink_sources() argument
1363 return macvlan_hash_add_source(vlan, addr); in macvlan_changelink_sources()
1369 entry = macvlan_hash_lookup_source(vlan, addr); in macvlan_changelink_sources()
1372 vlan->macaddr_count--; in macvlan_changelink_sources()
1375 macvlan_flush_sources(vlan->port, vlan); in macvlan_changelink_sources()
1377 macvlan_flush_sources(vlan->port, vlan); in macvlan_changelink_sources()
1380 ret = macvlan_hash_add_source(vlan, addr); in macvlan_changelink_sources()
1393 ret = macvlan_hash_add_source(vlan, addr); in macvlan_changelink_sources()
1408 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_common_newlink() local
1457 vlan->lowerdev = lowerdev; in macvlan_common_newlink()
1458 vlan->dev = dev; in macvlan_common_newlink()
1459 vlan->port = port; in macvlan_common_newlink()
1460 vlan->set_features = MACVLAN_FEATURES; in macvlan_common_newlink()
1462 vlan->mode = MACVLAN_MODE_VEPA; in macvlan_common_newlink()
1464 vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); in macvlan_common_newlink()
1467 vlan->flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); in macvlan_common_newlink()
1469 if (vlan->mode == MACVLAN_MODE_PASSTHRU) { in macvlan_common_newlink()
1479 if (vlan->mode != MACVLAN_MODE_SOURCE) { in macvlan_common_newlink()
1484 err = macvlan_changelink_sources(vlan, macmode, data); in macvlan_common_newlink()
1498 list_add_tail_rcu(&vlan->list, &port->vlans); in macvlan_common_newlink()
1527 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_dellink() local
1529 if (vlan->mode == MACVLAN_MODE_SOURCE) in macvlan_dellink()
1530 macvlan_flush_sources(vlan->port, vlan); in macvlan_dellink()
1531 list_del_rcu(&vlan->list); in macvlan_dellink()
1533 netdev_upper_dev_unlink(vlan->lowerdev, dev); in macvlan_dellink()
1541 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_changelink() local
1553 (vlan->mode == MACVLAN_MODE_PASSTHRU)) in macvlan_changelink()
1555 if (vlan->mode == MACVLAN_MODE_SOURCE && in macvlan_changelink()
1556 vlan->mode != mode) in macvlan_changelink()
1557 macvlan_flush_sources(vlan->port, vlan); in macvlan_changelink()
1562 bool promisc = (flags ^ vlan->flags) & MACVLAN_FLAG_NOPROMISC; in macvlan_changelink()
1563 if (macvlan_passthru(vlan->port) && promisc) { in macvlan_changelink()
1567 err = dev_set_promiscuity(vlan->lowerdev, -1); in macvlan_changelink()
1569 err = dev_set_promiscuity(vlan->lowerdev, 1); in macvlan_changelink()
1573 vlan->flags = flags; in macvlan_changelink()
1576 vlan->mode = mode; in macvlan_changelink()
1578 if (vlan->mode != MACVLAN_MODE_SOURCE) in macvlan_changelink()
1581 ret = macvlan_changelink_sources(vlan, macmode, data); in macvlan_changelink()
1588 static size_t macvlan_get_size_mac(const struct macvlan_dev *vlan) in macvlan_get_size_mac() argument
1590 if (vlan->macaddr_count == 0) in macvlan_get_size_mac()
1593 + vlan->macaddr_count * nla_total_size(sizeof(u8) * ETH_ALEN); in macvlan_get_size_mac()
1598 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_get_size() local
1604 + macvlan_get_size_mac(vlan) /* IFLA_MACVLAN_MACADDR */ in macvlan_get_size()
1609 const struct macvlan_dev *vlan, in macvlan_fill_info_macaddr() argument
1612 struct hlist_head *h = &vlan->port->vlan_source_hash[i]; in macvlan_fill_info_macaddr()
1616 if (entry->vlan != vlan) in macvlan_fill_info_macaddr()
1627 struct macvlan_dev *vlan = netdev_priv(dev); in macvlan_fill_info() local
1631 if (nla_put_u32(skb, IFLA_MACVLAN_MODE, vlan->mode)) in macvlan_fill_info()
1633 if (nla_put_u16(skb, IFLA_MACVLAN_FLAGS, vlan->flags)) in macvlan_fill_info()
1635 if (nla_put_u32(skb, IFLA_MACVLAN_MACADDR_COUNT, vlan->macaddr_count)) in macvlan_fill_info()
1637 if (vlan->macaddr_count > 0) { in macvlan_fill_info()
1643 if (macvlan_fill_info_macaddr(skb, vlan, i)) in macvlan_fill_info()
1695 struct macvlan_dev *vlan, *next; in macvlan_device_event() local
1708 list_for_each_entry(vlan, &port->vlans, list) in macvlan_device_event()
1709 netif_stacked_transfer_operstate(vlan->lowerdev, in macvlan_device_event()
1710 vlan->dev); in macvlan_device_event()
1713 list_for_each_entry(vlan, &port->vlans, list) { in macvlan_device_event()
1714 vlan->dev->gso_max_size = dev->gso_max_size; in macvlan_device_event()
1715 vlan->dev->gso_max_segs = dev->gso_max_segs; in macvlan_device_event()
1716 netdev_update_features(vlan->dev); in macvlan_device_event()
1720 list_for_each_entry(vlan, &port->vlans, list) { in macvlan_device_event()
1721 if (vlan->dev->mtu <= dev->mtu) in macvlan_device_event()
1723 dev_set_mtu(vlan->dev, dev->mtu); in macvlan_device_event()
1730 vlan = list_first_entry_or_null(&port->vlans, in macvlan_device_event()
1734 if (vlan && macvlan_sync_address(vlan->dev, dev->dev_addr)) in macvlan_device_event()
1743 list_for_each_entry_safe(vlan, next, &port->vlans, list) in macvlan_device_event()
1744 vlan->dev->rtnl_link_ops->dellink(vlan->dev, &list_kill); in macvlan_device_event()
1755 list_for_each_entry(vlan, &port->vlans, list) in macvlan_device_event()
1756 call_netdevice_notifiers(event, vlan->dev); in macvlan_device_event()