Commit a748ee24 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: move address list functions to a separate file

+little renaming of unicast functions to be smooth with multicast ones
Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9fc4178b
...@@ -1491,7 +1491,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) ...@@ -1491,7 +1491,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
} }
/* Flush unicast and multicast addresses */ /* Flush unicast and multicast addresses */
dev_unicast_flush(bond_dev); dev_uc_flush(bond_dev);
dev_addr_discard(bond_dev); dev_addr_discard(bond_dev);
if (slave_dev->type != ARPHRD_ETHER) if (slave_dev->type != ARPHRD_ETHER)
......
...@@ -282,7 +282,7 @@ static int macvlan_open(struct net_device *dev) ...@@ -282,7 +282,7 @@ static int macvlan_open(struct net_device *dev)
if (macvlan_addr_busy(vlan->port, dev->dev_addr)) if (macvlan_addr_busy(vlan->port, dev->dev_addr))
goto out; goto out;
err = dev_unicast_add(lowerdev, dev->dev_addr); err = dev_uc_add(lowerdev, dev->dev_addr);
if (err < 0) if (err < 0)
goto out; goto out;
if (dev->flags & IFF_ALLMULTI) { if (dev->flags & IFF_ALLMULTI) {
...@@ -294,7 +294,7 @@ static int macvlan_open(struct net_device *dev) ...@@ -294,7 +294,7 @@ static int macvlan_open(struct net_device *dev)
return 0; return 0;
del_unicast: del_unicast:
dev_unicast_delete(lowerdev, dev->dev_addr); dev_uc_del(lowerdev, dev->dev_addr);
out: out:
return err; return err;
} }
...@@ -308,7 +308,7 @@ static int macvlan_stop(struct net_device *dev) ...@@ -308,7 +308,7 @@ static int macvlan_stop(struct net_device *dev)
if (dev->flags & IFF_ALLMULTI) if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(lowerdev, -1); dev_set_allmulti(lowerdev, -1);
dev_unicast_delete(lowerdev, dev->dev_addr); dev_uc_del(lowerdev, dev->dev_addr);
macvlan_hash_del(vlan); macvlan_hash_del(vlan);
return 0; return 0;
...@@ -332,11 +332,11 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p) ...@@ -332,11 +332,11 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p)
if (macvlan_addr_busy(vlan->port, addr->sa_data)) if (macvlan_addr_busy(vlan->port, addr->sa_data))
return -EBUSY; return -EBUSY;
err = dev_unicast_add(lowerdev, addr->sa_data); err = dev_uc_add(lowerdev, addr->sa_data);
if (err) if (err)
return err; return err;
dev_unicast_delete(lowerdev, dev->dev_addr); dev_uc_del(lowerdev, dev->dev_addr);
macvlan_hash_change_addr(vlan, addr->sa_data); macvlan_hash_change_addr(vlan, addr->sa_data);
} }
......
...@@ -308,9 +308,9 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe, ...@@ -308,9 +308,9 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
* for multiple unicast MACs. * for multiple unicast MACs.
*/ */
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
dev_unicast_add(netdev, flogi_maddr); dev_uc_add(netdev, flogi_maddr);
if (fip->spma) if (fip->spma)
dev_unicast_add(netdev, fip->ctl_src_addr); dev_uc_add(netdev, fip->ctl_src_addr);
dev_mc_add(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); dev_mc_add(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
/* /*
...@@ -394,9 +394,9 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe) ...@@ -394,9 +394,9 @@ void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
/* Delete secondary MAC addresses */ /* Delete secondary MAC addresses */
memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
dev_unicast_delete(netdev, flogi_maddr); dev_uc_del(netdev, flogi_maddr);
if (fip->spma) if (fip->spma)
dev_unicast_delete(netdev, fip->ctl_src_addr); dev_uc_del(netdev, fip->ctl_src_addr);
dev_mc_delete(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); dev_mc_delete(netdev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
/* Tell the LLD we are done w/ FCoE */ /* Tell the LLD we are done w/ FCoE */
...@@ -490,9 +490,9 @@ static void fcoe_update_src_mac(struct fc_lport *lport, u8 *addr) ...@@ -490,9 +490,9 @@ static void fcoe_update_src_mac(struct fc_lport *lport, u8 *addr)
rtnl_lock(); rtnl_lock();
if (!is_zero_ether_addr(port->data_src_addr)) if (!is_zero_ether_addr(port->data_src_addr))
dev_unicast_delete(fcoe->netdev, port->data_src_addr); dev_uc_del(fcoe->netdev, port->data_src_addr);
if (!is_zero_ether_addr(addr)) if (!is_zero_ether_addr(addr))
dev_unicast_add(fcoe->netdev, addr); dev_uc_add(fcoe->netdev, addr);
memcpy(port->data_src_addr, addr, ETH_ALEN); memcpy(port->data_src_addr, addr, ETH_ALEN);
rtnl_unlock(); rtnl_unlock();
} }
...@@ -819,7 +819,7 @@ static void fcoe_if_destroy(struct fc_lport *lport) ...@@ -819,7 +819,7 @@ static void fcoe_if_destroy(struct fc_lport *lport)
rtnl_lock(); rtnl_lock();
if (!is_zero_ether_addr(port->data_src_addr)) if (!is_zero_ether_addr(port->data_src_addr))
dev_unicast_delete(netdev, port->data_src_addr); dev_uc_del(netdev, port->data_src_addr);
rtnl_unlock(); rtnl_unlock();
/* receives may not be stopped until after this */ /* receives may not be stopped until after this */
......
...@@ -1991,15 +1991,20 @@ extern int dev_addr_add_multiple(struct net_device *to_dev, ...@@ -1991,15 +1991,20 @@ extern int dev_addr_add_multiple(struct net_device *to_dev,
extern int dev_addr_del_multiple(struct net_device *to_dev, extern int dev_addr_del_multiple(struct net_device *to_dev,
struct net_device *from_dev, struct net_device *from_dev,
unsigned char addr_type); unsigned char addr_type);
extern void dev_addr_flush(struct net_device *dev);
extern int dev_addr_init(struct net_device *dev);
/* Functions used for unicast addresses handling */
extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
extern int dev_uc_sync(struct net_device *to, struct net_device *from);
extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
extern void dev_uc_flush(struct net_device *dev);
extern void dev_uc_init(struct net_device *dev);
/* Functions used for secondary unicast and multicast support */ /* Functions used for secondary unicast and multicast support */
extern void dev_set_rx_mode(struct net_device *dev); extern void dev_set_rx_mode(struct net_device *dev);
extern void __dev_set_rx_mode(struct net_device *dev); extern void __dev_set_rx_mode(struct net_device *dev);
extern int dev_unicast_delete(struct net_device *dev, void *addr);
extern int dev_unicast_add(struct net_device *dev, void *addr);
extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
extern void dev_unicast_flush(struct net_device *dev);
extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
extern int dev_mc_sync(struct net_device *to, struct net_device *from); extern int dev_mc_sync(struct net_device *to, struct net_device *from);
......
...@@ -356,13 +356,13 @@ static void vlan_sync_address(struct net_device *dev, ...@@ -356,13 +356,13 @@ static void vlan_sync_address(struct net_device *dev,
* the new address */ * the new address */
if (compare_ether_addr(vlandev->dev_addr, vlan->real_dev_addr) && if (compare_ether_addr(vlandev->dev_addr, vlan->real_dev_addr) &&
!compare_ether_addr(vlandev->dev_addr, dev->dev_addr)) !compare_ether_addr(vlandev->dev_addr, dev->dev_addr))
dev_unicast_delete(dev, vlandev->dev_addr); dev_uc_del(dev, vlandev->dev_addr);
/* vlan address was equal to the old address and is different from /* vlan address was equal to the old address and is different from
* the new address */ * the new address */
if (!compare_ether_addr(vlandev->dev_addr, vlan->real_dev_addr) && if (!compare_ether_addr(vlandev->dev_addr, vlan->real_dev_addr) &&
compare_ether_addr(vlandev->dev_addr, dev->dev_addr)) compare_ether_addr(vlandev->dev_addr, dev->dev_addr))
dev_unicast_add(dev, vlandev->dev_addr); dev_uc_add(dev, vlandev->dev_addr);
memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN); memcpy(vlan->real_dev_addr, dev->dev_addr, ETH_ALEN);
} }
......
...@@ -461,7 +461,7 @@ static int vlan_dev_open(struct net_device *dev) ...@@ -461,7 +461,7 @@ static int vlan_dev_open(struct net_device *dev)
return -ENETDOWN; return -ENETDOWN;
if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) { if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) {
err = dev_unicast_add(real_dev, dev->dev_addr); err = dev_uc_add(real_dev, dev->dev_addr);
if (err < 0) if (err < 0)
goto out; goto out;
} }
...@@ -490,7 +490,7 @@ static int vlan_dev_open(struct net_device *dev) ...@@ -490,7 +490,7 @@ static int vlan_dev_open(struct net_device *dev)
dev_set_allmulti(real_dev, -1); dev_set_allmulti(real_dev, -1);
del_unicast: del_unicast:
if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr))
dev_unicast_delete(real_dev, dev->dev_addr); dev_uc_del(real_dev, dev->dev_addr);
out: out:
netif_carrier_off(dev); netif_carrier_off(dev);
return err; return err;
...@@ -505,14 +505,14 @@ static int vlan_dev_stop(struct net_device *dev) ...@@ -505,14 +505,14 @@ static int vlan_dev_stop(struct net_device *dev)
vlan_gvrp_request_leave(dev); vlan_gvrp_request_leave(dev);
dev_mc_unsync(real_dev, dev); dev_mc_unsync(real_dev, dev);
dev_unicast_unsync(real_dev, dev); dev_uc_unsync(real_dev, dev);
if (dev->flags & IFF_ALLMULTI) if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(real_dev, -1); dev_set_allmulti(real_dev, -1);
if (dev->flags & IFF_PROMISC) if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(real_dev, -1); dev_set_promiscuity(real_dev, -1);
if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr))
dev_unicast_delete(real_dev, dev->dev_addr); dev_uc_del(real_dev, dev->dev_addr);
netif_carrier_off(dev); netif_carrier_off(dev);
return 0; return 0;
...@@ -531,13 +531,13 @@ static int vlan_dev_set_mac_address(struct net_device *dev, void *p) ...@@ -531,13 +531,13 @@ static int vlan_dev_set_mac_address(struct net_device *dev, void *p)
goto out; goto out;
if (compare_ether_addr(addr->sa_data, real_dev->dev_addr)) { if (compare_ether_addr(addr->sa_data, real_dev->dev_addr)) {
err = dev_unicast_add(real_dev, addr->sa_data); err = dev_uc_add(real_dev, addr->sa_data);
if (err < 0) if (err < 0)
return err; return err;
} }
if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr)) if (compare_ether_addr(dev->dev_addr, real_dev->dev_addr))
dev_unicast_delete(real_dev, dev->dev_addr); dev_uc_del(real_dev, dev->dev_addr);
out: out:
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
...@@ -654,7 +654,7 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) ...@@ -654,7 +654,7 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
{ {
dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev); dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
dev_unicast_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev); dev_uc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
} }
/* /*
......
...@@ -8,7 +8,8 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \ ...@@ -8,7 +8,8 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
obj-y += dev.o ethtool.o dev_mcast.o dst.o netevent.o \ obj-y += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o neighbour.o rtnetlink.o utils.o link_watch.o filter.o \
dev_addr_lists.o
obj-$(CONFIG_XFRM) += flow.o obj-$(CONFIG_XFRM) += flow.o
obj-y += net-sysfs.o obj-y += net-sysfs.o
......
This diff is collapsed.
This diff is collapsed.
...@@ -67,7 +67,7 @@ static int dsa_slave_open(struct net_device *dev) ...@@ -67,7 +67,7 @@ static int dsa_slave_open(struct net_device *dev)
return -ENETDOWN; return -ENETDOWN;
if (compare_ether_addr(dev->dev_addr, master->dev_addr)) { if (compare_ether_addr(dev->dev_addr, master->dev_addr)) {
err = dev_unicast_add(master, dev->dev_addr); err = dev_uc_add(master, dev->dev_addr);
if (err < 0) if (err < 0)
goto out; goto out;
} }
...@@ -90,7 +90,7 @@ static int dsa_slave_open(struct net_device *dev) ...@@ -90,7 +90,7 @@ static int dsa_slave_open(struct net_device *dev)
dev_set_allmulti(master, -1); dev_set_allmulti(master, -1);
del_unicast: del_unicast:
if (compare_ether_addr(dev->dev_addr, master->dev_addr)) if (compare_ether_addr(dev->dev_addr, master->dev_addr))
dev_unicast_delete(master, dev->dev_addr); dev_uc_del(master, dev->dev_addr);
out: out:
return err; return err;
} }
...@@ -101,14 +101,14 @@ static int dsa_slave_close(struct net_device *dev) ...@@ -101,14 +101,14 @@ static int dsa_slave_close(struct net_device *dev)
struct net_device *master = p->parent->dst->master_netdev; struct net_device *master = p->parent->dst->master_netdev;
dev_mc_unsync(master, dev); dev_mc_unsync(master, dev);
dev_unicast_unsync(master, dev); dev_uc_unsync(master, dev);
if (dev->flags & IFF_ALLMULTI) if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(master, -1); dev_set_allmulti(master, -1);
if (dev->flags & IFF_PROMISC) if (dev->flags & IFF_PROMISC)
dev_set_promiscuity(master, -1); dev_set_promiscuity(master, -1);
if (compare_ether_addr(dev->dev_addr, master->dev_addr)) if (compare_ether_addr(dev->dev_addr, master->dev_addr))
dev_unicast_delete(master, dev->dev_addr); dev_uc_del(master, dev->dev_addr);
return 0; return 0;
} }
...@@ -130,7 +130,7 @@ static void dsa_slave_set_rx_mode(struct net_device *dev) ...@@ -130,7 +130,7 @@ static void dsa_slave_set_rx_mode(struct net_device *dev)
struct net_device *master = p->parent->dst->master_netdev; struct net_device *master = p->parent->dst->master_netdev;
dev_mc_sync(master, dev); dev_mc_sync(master, dev);
dev_unicast_sync(master, dev); dev_uc_sync(master, dev);
} }
static int dsa_slave_set_mac_address(struct net_device *dev, void *a) static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
...@@ -147,13 +147,13 @@ static int dsa_slave_set_mac_address(struct net_device *dev, void *a) ...@@ -147,13 +147,13 @@ static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
goto out; goto out;
if (compare_ether_addr(addr->sa_data, master->dev_addr)) { if (compare_ether_addr(addr->sa_data, master->dev_addr)) {
err = dev_unicast_add(master, addr->sa_data); err = dev_uc_add(master, addr->sa_data);
if (err < 0) if (err < 0)
return err; return err;
} }
if (compare_ether_addr(dev->dev_addr, master->dev_addr)) if (compare_ether_addr(dev->dev_addr, master->dev_addr))
dev_unicast_delete(master, dev->dev_addr); dev_uc_del(master, dev->dev_addr);
out: out:
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
......
...@@ -1705,9 +1705,9 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i, ...@@ -1705,9 +1705,9 @@ static int packet_dev_mc(struct net_device *dev, struct packet_mclist *i,
if (i->alen != dev->addr_len) if (i->alen != dev->addr_len)
return -EINVAL; return -EINVAL;
if (what > 0) if (what > 0)
return dev_unicast_add(dev, i->addr); return dev_uc_add(dev, i->addr);
else else
return dev_unicast_delete(dev, i->addr); return dev_uc_del(dev, i->addr);
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment