Lines Matching refs:pgid

1695 	struct ocelot_pgid *pgid;  in ocelot_pgid_alloc()  local
1697 pgid = kzalloc(sizeof(*pgid), GFP_KERNEL); in ocelot_pgid_alloc()
1698 if (!pgid) in ocelot_pgid_alloc()
1701 pgid->ports = ports; in ocelot_pgid_alloc()
1702 pgid->index = index; in ocelot_pgid_alloc()
1703 refcount_set(&pgid->refcount, 1); in ocelot_pgid_alloc()
1704 list_add_tail(&pgid->list, &ocelot->pgids); in ocelot_pgid_alloc()
1706 return pgid; in ocelot_pgid_alloc()
1709 static void ocelot_pgid_free(struct ocelot *ocelot, struct ocelot_pgid *pgid) in ocelot_pgid_free() argument
1711 if (!refcount_dec_and_test(&pgid->refcount)) in ocelot_pgid_free()
1714 list_del(&pgid->list); in ocelot_pgid_free()
1715 kfree(pgid); in ocelot_pgid_free()
1721 struct ocelot_pgid *pgid; in ocelot_mdb_get_pgid() local
1733 list_for_each_entry(pgid, &ocelot->pgids, list) { in ocelot_mdb_get_pgid()
1737 if (pgid->index && pgid->ports == mc->ports) { in ocelot_mdb_get_pgid()
1738 refcount_inc(&pgid->refcount); in ocelot_mdb_get_pgid()
1739 return pgid; in ocelot_mdb_get_pgid()
1747 list_for_each_entry(pgid, &ocelot->pgids, list) { in ocelot_mdb_get_pgid()
1748 if (pgid->index == index) { in ocelot_mdb_get_pgid()
1782 struct ocelot_pgid *pgid; in ocelot_port_mdb_add() local
1804 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_port_mdb_add()
1811 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_port_mdb_add()
1812 if (IS_ERR(pgid)) { in ocelot_port_mdb_add()
1817 return PTR_ERR(pgid); in ocelot_port_mdb_add()
1819 mc->pgid = pgid; in ocelot_port_mdb_add()
1825 ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, in ocelot_port_mdb_add()
1826 pgid->index); in ocelot_port_mdb_add()
1828 return ocelot_mact_learn(ocelot, pgid->index, addr, vid, in ocelot_port_mdb_add()
1839 struct ocelot_pgid *pgid; in ocelot_port_mdb_del() local
1852 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_port_mdb_del()
1861 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_port_mdb_del()
1862 if (IS_ERR(pgid)) in ocelot_port_mdb_del()
1863 return PTR_ERR(pgid); in ocelot_port_mdb_del()
1864 mc->pgid = pgid; in ocelot_port_mdb_del()
1870 ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, in ocelot_port_mdb_del()
1871 pgid->index); in ocelot_port_mdb_del()
1873 return ocelot_mact_learn(ocelot, pgid->index, addr, vid, in ocelot_port_mdb_del()
2044 struct ocelot_pgid *pgid; in ocelot_migrate_mc() local
2054 ocelot_pgid_free(ocelot, mc->pgid); in ocelot_migrate_mc()
2061 pgid = ocelot_mdb_get_pgid(ocelot, mc); in ocelot_migrate_mc()
2062 if (IS_ERR(pgid)) { in ocelot_migrate_mc()
2067 return PTR_ERR(pgid); in ocelot_migrate_mc()
2069 mc->pgid = pgid; in ocelot_migrate_mc()
2075 ocelot_write_rix(ocelot, pgid->ports, ANA_PGID_PGID, in ocelot_migrate_mc()
2076 pgid->index); in ocelot_migrate_mc()
2078 return ocelot_mact_learn(ocelot, pgid->index, addr, vid, in ocelot_migrate_mc()