Lines Matching refs:pgid
1800 struct ocelot_pgid *pgid; in ocelot_pgid_alloc() local
1802 pgid = kzalloc(sizeof(*pgid), GFP_KERNEL); in ocelot_pgid_alloc()
1803 if (!pgid) in ocelot_pgid_alloc()
1806 pgid->ports = ports; in ocelot_pgid_alloc()
1807 pgid->index = index; in ocelot_pgid_alloc()
1808 refcount_set(&pgid->refcount, 1); in ocelot_pgid_alloc()
1809 list_add_tail(&pgid->list, &ocelot->pgids); in ocelot_pgid_alloc()
1811 return pgid; in ocelot_pgid_alloc()
1814 static void ocelot_pgid_free(struct ocelot *ocelot, struct ocelot_pgid *pgid) in ocelot_pgid_free() argument
1816 if (!refcount_dec_and_test(&pgid->refcount)) in ocelot_pgid_free()
1819 list_del(&pgid->list); in ocelot_pgid_free()
1820 kfree(pgid); in ocelot_pgid_free()
1826 struct ocelot_pgid *pgid; in ocelot_mdb_get_pgid() local
1838 list_for_each_entry(pgid, &ocelot->pgids, list) { in ocelot_mdb_get_pgid()
1842 if (pgid->index && pgid->ports == mc->ports) { in ocelot_mdb_get_pgid()
1843 refcount_inc(&pgid->refcount); in ocelot_mdb_get_pgid()
1844 return pgid; in ocelot_mdb_get_pgid()
1852 list_for_each_entry(pgid, &ocelot->pgids, list) { in ocelot_mdb_get_pgid()
1853 if (pgid->index == index) { in ocelot_mdb_get_pgid()
1887 struct ocelot_pgid *pgid; in ocelot_port_mdb_add() local
1909 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_port_mdb_add()
1916 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_port_mdb_add()
1917 if (IS_ERR(pgid)) { in ocelot_port_mdb_add()
1922 return PTR_ERR(pgid); in ocelot_port_mdb_add()
1924 mc->pgid = pgid; in ocelot_port_mdb_add()
1930 ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, in ocelot_port_mdb_add()
1931 pgid->index); in ocelot_port_mdb_add()
1933 return ocelot_mact_learn(ocelot, pgid->index, addr, vid, in ocelot_port_mdb_add()
1944 struct ocelot_pgid *pgid; in ocelot_port_mdb_del() local
1957 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_port_mdb_del()
1966 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_port_mdb_del()
1967 if (IS_ERR(pgid)) in ocelot_port_mdb_del()
1968 return PTR_ERR(pgid); in ocelot_port_mdb_del()
1969 mc->pgid = pgid; in ocelot_port_mdb_del()
1975 ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, in ocelot_port_mdb_del()
1976 pgid->index); in ocelot_port_mdb_del()
1978 return ocelot_mact_learn(ocelot, pgid->index, addr, vid, in ocelot_port_mdb_del()
2149 struct ocelot_pgid *pgid; in ocelot_migrate_mc() local
2159 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_migrate_mc()
2166 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_migrate_mc()
2167 if (IS_ERR(pgid)) { in ocelot_migrate_mc()
2172 return PTR_ERR(pgid); in ocelot_migrate_mc()
2174 mc->pgid = pgid; in ocelot_migrate_mc()
2180 ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, in ocelot_migrate_mc()
2181 pgid->index); in ocelot_migrate_mc()
2183 return ocelot_mact_learn(ocelot, pgid->index, addr, vid, in ocelot_migrate_mc()