Lines Matching refs:pgt_entry
99 mlxsw_sp_pgt_entry_port_lookup(struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_lookup() argument
104 list_for_each_entry(pgt_entry_port, &pgt_entry->ports_list, list) { in mlxsw_sp_pgt_entry_port_lookup()
115 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_create() local
119 pgt_entry = kzalloc(sizeof(*pgt_entry), GFP_KERNEL); in mlxsw_sp_pgt_entry_create()
120 if (!pgt_entry) in mlxsw_sp_pgt_entry_create()
123 ret = idr_replace(&pgt->pgt_idr, pgt_entry, mid); in mlxsw_sp_pgt_entry_create()
129 INIT_LIST_HEAD(&pgt_entry->ports_list); in mlxsw_sp_pgt_entry_create()
130 pgt_entry->index = mid; in mlxsw_sp_pgt_entry_create()
131 pgt_entry->smpe_index = smpe; in mlxsw_sp_pgt_entry_create()
132 return pgt_entry; in mlxsw_sp_pgt_entry_create()
135 kfree(pgt_entry); in mlxsw_sp_pgt_entry_create()
140 struct mlxsw_sp_pgt_entry *pgt_entry) in mlxsw_sp_pgt_entry_destroy() argument
142 WARN_ON(!list_empty(&pgt_entry->ports_list)); in mlxsw_sp_pgt_entry_destroy()
144 pgt_entry = idr_replace(&pgt->pgt_idr, NULL, pgt_entry->index); in mlxsw_sp_pgt_entry_destroy()
145 if (WARN_ON(IS_ERR(pgt_entry))) in mlxsw_sp_pgt_entry_destroy()
148 kfree(pgt_entry); in mlxsw_sp_pgt_entry_destroy()
154 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_get() local
156 pgt_entry = idr_find(&pgt->pgt_idr, mid); in mlxsw_sp_pgt_entry_get()
157 if (pgt_entry) in mlxsw_sp_pgt_entry_get()
158 return pgt_entry; in mlxsw_sp_pgt_entry_get()
165 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_put() local
167 pgt_entry = idr_find(&pgt->pgt_idr, mid); in mlxsw_sp_pgt_entry_put()
168 if (WARN_ON(!pgt_entry)) in mlxsw_sp_pgt_entry_put()
171 if (list_empty(&pgt_entry->ports_list)) in mlxsw_sp_pgt_entry_put()
172 mlxsw_sp_pgt_entry_destroy(pgt, pgt_entry); in mlxsw_sp_pgt_entry_put()
184 const struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_write() argument
194 mlxsw_reg_smid2_pack(smid2_pl, pgt_entry->index, 0, 0, in mlxsw_sp_pgt_entry_port_write()
196 pgt_entry->smpe_index); in mlxsw_sp_pgt_entry_port_write()
208 struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_create() argument
218 err = mlxsw_sp_pgt_entry_port_write(mlxsw_sp, pgt_entry, local_port, in mlxsw_sp_pgt_entry_port_create()
224 list_add(&pgt_entry_port->list, &pgt_entry->ports_list); in mlxsw_sp_pgt_entry_port_create()
235 struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_destroy() argument
240 mlxsw_sp_pgt_entry_port_write(mlxsw_sp, pgt_entry, in mlxsw_sp_pgt_entry_port_destroy()
249 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_port_add() local
254 pgt_entry = mlxsw_sp_pgt_entry_get(mlxsw_sp->pgt, mid, smpe); in mlxsw_sp_pgt_entry_port_add()
255 if (IS_ERR(pgt_entry)) { in mlxsw_sp_pgt_entry_port_add()
256 err = PTR_ERR(pgt_entry); in mlxsw_sp_pgt_entry_port_add()
260 pgt_entry_port = mlxsw_sp_pgt_entry_port_create(mlxsw_sp, pgt_entry, in mlxsw_sp_pgt_entry_port_add()
281 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_port_del() local
285 pgt_entry = idr_find(&mlxsw_sp->pgt->pgt_idr, mid); in mlxsw_sp_pgt_entry_port_del()
286 if (!pgt_entry) in mlxsw_sp_pgt_entry_port_del()
289 pgt_entry_port = mlxsw_sp_pgt_entry_port_lookup(pgt_entry, local_port); in mlxsw_sp_pgt_entry_port_del()
293 mlxsw_sp_pgt_entry_port_destroy(mlxsw_sp, pgt_entry, pgt_entry_port); in mlxsw_sp_pgt_entry_port_del()