Lines Matching refs:mc

1853 	struct ocelot_multicast *mc;  in ocelot_multicast_get()  local
1855 list_for_each_entry(mc, &ocelot->multicast, list) { in ocelot_multicast_get()
1856 if (ether_addr_equal(mc->addr, addr) && mc->vid == vid) in ocelot_multicast_get()
1857 return mc; in ocelot_multicast_get()
1899 const struct ocelot_multicast *mc) in ocelot_mdb_get_pgid() argument
1909 if (mc->entry_type == ENTRYTYPE_MACv4 || in ocelot_mdb_get_pgid()
1910 mc->entry_type == ENTRYTYPE_MACv6) in ocelot_mdb_get_pgid()
1911 return ocelot_pgid_alloc(ocelot, 0, mc->ports); in ocelot_mdb_get_pgid()
1917 if (pgid->index && pgid->ports == mc->ports) { in ocelot_mdb_get_pgid()
1935 return ocelot_pgid_alloc(ocelot, index, mc->ports); in ocelot_mdb_get_pgid()
1942 struct ocelot_multicast *mc) in ocelot_encode_ports_to_mdb() argument
1944 ether_addr_copy(addr, mc->addr); in ocelot_encode_ports_to_mdb()
1946 if (mc->entry_type == ENTRYTYPE_MACv4) { in ocelot_encode_ports_to_mdb()
1948 addr[1] = mc->ports >> 8; in ocelot_encode_ports_to_mdb()
1949 addr[2] = mc->ports & 0xff; in ocelot_encode_ports_to_mdb()
1950 } else if (mc->entry_type == ENTRYTYPE_MACv6) { in ocelot_encode_ports_to_mdb()
1951 addr[0] = mc->ports >> 8; in ocelot_encode_ports_to_mdb()
1952 addr[1] = mc->ports & 0xff; in ocelot_encode_ports_to_mdb()
1961 struct ocelot_multicast *mc; in ocelot_port_mdb_add() local
1968 mc = ocelot_multicast_get(ocelot, mdb->addr, vid); in ocelot_port_mdb_add()
1969 if (!mc) { in ocelot_port_mdb_add()
1971 mc = devm_kzalloc(ocelot->dev, sizeof(*mc), GFP_KERNEL); in ocelot_port_mdb_add()
1972 if (!mc) in ocelot_port_mdb_add()
1975 mc->entry_type = ocelot_classify_mdb(mdb->addr); in ocelot_port_mdb_add()
1976 ether_addr_copy(mc->addr, mdb->addr); in ocelot_port_mdb_add()
1977 mc->vid = vid; in ocelot_port_mdb_add()
1979 list_add_tail(&mc->list, &ocelot->multicast); in ocelot_port_mdb_add()
1984 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_port_mdb_add()
1985 ocelot_encode_ports_to_mdb(addr, mc); in ocelot_port_mdb_add()
1989 mc->ports |= BIT(port); in ocelot_port_mdb_add()
1991 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_port_mdb_add()
1995 mc->addr, mc->vid); in ocelot_port_mdb_add()
1996 devm_kfree(ocelot->dev, mc); in ocelot_port_mdb_add()
1999 mc->pgid = pgid; in ocelot_port_mdb_add()
2001 ocelot_encode_ports_to_mdb(addr, mc); in ocelot_port_mdb_add()
2003 if (mc->entry_type != ENTRYTYPE_MACv4 && in ocelot_port_mdb_add()
2004 mc->entry_type != ENTRYTYPE_MACv6) in ocelot_port_mdb_add()
2009 mc->entry_type); in ocelot_port_mdb_add()
2018 struct ocelot_multicast *mc; in ocelot_port_mdb_del() local
2025 mc = ocelot_multicast_get(ocelot, mdb->addr, vid); in ocelot_port_mdb_del()
2026 if (!mc) in ocelot_port_mdb_del()
2029 ocelot_encode_ports_to_mdb(addr, mc); in ocelot_port_mdb_del()
2032 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_port_mdb_del()
2033 mc->ports &= ~BIT(port); in ocelot_port_mdb_del()
2034 if (!mc->ports) { in ocelot_port_mdb_del()
2035 list_del(&mc->list); in ocelot_port_mdb_del()
2036 devm_kfree(ocelot->dev, mc); in ocelot_port_mdb_del()
2041 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_port_mdb_del()
2044 mc->pgid = pgid; in ocelot_port_mdb_del()
2046 ocelot_encode_ports_to_mdb(addr, mc); in ocelot_port_mdb_del()
2048 if (mc->entry_type != ENTRYTYPE_MACv4 && in ocelot_port_mdb_del()
2049 mc->entry_type != ENTRYTYPE_MACv6) in ocelot_port_mdb_del()
2054 mc->entry_type); in ocelot_port_mdb_del()
2220 static int ocelot_migrate_mc(struct ocelot *ocelot, struct ocelot_multicast *mc, in ocelot_migrate_mc() argument
2225 u16 vid = mc->vid; in ocelot_migrate_mc()
2229 mc->addr, mc->vid, from_mask, to_mask); in ocelot_migrate_mc()
2234 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_migrate_mc()
2235 ocelot_encode_ports_to_mdb(addr, mc); in ocelot_migrate_mc()
2238 mc->ports &= ~from_mask; in ocelot_migrate_mc()
2239 mc->ports |= to_mask; in ocelot_migrate_mc()
2241 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_migrate_mc()
2245 mc->addr, mc->vid); in ocelot_migrate_mc()
2246 devm_kfree(ocelot->dev, mc); in ocelot_migrate_mc()
2249 mc->pgid = pgid; in ocelot_migrate_mc()
2251 ocelot_encode_ports_to_mdb(addr, mc); in ocelot_migrate_mc()
2253 if (mc->entry_type != ENTRYTYPE_MACv4 && in ocelot_migrate_mc()
2254 mc->entry_type != ENTRYTYPE_MACv6) in ocelot_migrate_mc()
2259 mc->entry_type); in ocelot_migrate_mc()
2265 struct ocelot_multicast *mc; in ocelot_migrate_mdbs() local
2268 list_for_each_entry(mc, &ocelot->multicast, list) { in ocelot_migrate_mdbs()
2269 if (!(mc->ports & from_mask)) in ocelot_migrate_mdbs()
2272 err = ocelot_migrate_mc(ocelot, mc, from_mask, to_mask); in ocelot_migrate_mdbs()