aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mscc/ocelot.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-05-31 10:49:43 -0700
committerDavid S. Miller <davem@davemloft.net>2019-05-31 10:49:43 -0700
commitb4b12b0d2f02613101a7a667ef7b7cc8d388e597 (patch)
treeae2d52198929797821961fd0b5923b5ea1a89fe1 /drivers/net/ethernet/mscc/ocelot.c
parentnetfilter: nf_conntrack_bridge: fix CONFIG_IPV6=y (diff)
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (diff)
downloadlinux-dev-b4b12b0d2f02613101a7a667ef7b7cc8d388e597.tar.xz
linux-dev-b4b12b0d2f02613101a7a667ef7b7cc8d388e597.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
The phylink conflict was between a bug fix by Russell King to make sure we have a consistent PHY interface mode, and a change in net-next to pull some code in phylink_resolve() into the helper functions phylink_mac_link_{up,down}() On the dp83867 side it's mostly overlapping changes, with the 'net' side removing a condition that was supposed to trigger for RGMII but because of how it was coded never actually could trigger. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mscc/ocelot.c')
-rw-r--r--drivers/net/ethernet/mscc/ocelot.c43
1 files changed, 8 insertions, 35 deletions
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index ab7d9eba6a32..3e692755c02f 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -593,45 +593,25 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
-static void ocelot_mact_mc_reset(struct ocelot_port *port)
+static int ocelot_mc_unsync(struct net_device *dev, const unsigned char *addr)
{
- struct ocelot *ocelot = port->ocelot;
- struct netdev_hw_addr *ha, *n;
+ struct ocelot_port *port = netdev_priv(dev);
- /* Free and forget all the MAC addresses stored in the port private mc
- * list. These are mc addresses that were previously added by calling
- * ocelot_mact_mc_add().
- */
- list_for_each_entry_safe(ha, n, &port->mc, list) {
- ocelot_mact_forget(ocelot, ha->addr, port->pvid);
- list_del(&ha->list);
- kfree(ha);
- }
+ return ocelot_mact_forget(port->ocelot, addr, port->pvid);
}
-static int ocelot_mact_mc_add(struct ocelot_port *port,
- struct netdev_hw_addr *hw_addr)
+static int ocelot_mc_sync(struct net_device *dev, const unsigned char *addr)
{
- struct ocelot *ocelot = port->ocelot;
- struct netdev_hw_addr *ha = kzalloc(sizeof(*ha), GFP_ATOMIC);
-
- if (!ha)
- return -ENOMEM;
-
- memcpy(ha, hw_addr, sizeof(*ha));
- list_add_tail(&ha->list, &port->mc);
-
- ocelot_mact_learn(ocelot, PGID_CPU, ha->addr, port->pvid,
- ENTRYTYPE_LOCKED);
+ struct ocelot_port *port = netdev_priv(dev);
- return 0;
+ return ocelot_mact_learn(port->ocelot, PGID_CPU, addr, port->pvid,
+ ENTRYTYPE_LOCKED);
}
static void ocelot_set_rx_mode(struct net_device *dev)
{
struct ocelot_port *port = netdev_priv(dev);
struct ocelot *ocelot = port->ocelot;
- struct netdev_hw_addr *ha;
int i;
u32 val;
@@ -643,13 +623,7 @@ static void ocelot_set_rx_mode(struct net_device *dev)
for (i = ocelot->num_phys_ports + 1; i < PGID_CPU; i++)
ocelot_write_rix(ocelot, val, ANA_PGID_PGID, i);
- /* Handle the device multicast addresses. First remove all the
- * previously installed addresses and then add the latest ones to the
- * mac table.
- */
- ocelot_mact_mc_reset(port);
- netdev_for_each_mc_addr(ha, dev)
- ocelot_mact_mc_add(port, ha);
+ __dev_mc_sync(dev, ocelot_mc_sync, ocelot_mc_unsync);
}
static int ocelot_port_get_phys_port_name(struct net_device *dev,
@@ -1665,7 +1639,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
ocelot_port->regs = regs;
ocelot_port->chip_port = port;
ocelot_port->phy = phy;
- INIT_LIST_HEAD(&ocelot_port->mc);
ocelot->ports[port] = ocelot_port;
dev->netdev_ops = &ocelot_port_netdev_ops;