Lines Matching refs:pgt_entry
109 mlxsw_sp_pgt_entry_port_lookup(struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_lookup() argument
114 list_for_each_entry(pgt_entry_port, &pgt_entry->ports_list, list) { in mlxsw_sp_pgt_entry_port_lookup()
125 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_create() local
129 pgt_entry = kzalloc(sizeof(*pgt_entry), GFP_KERNEL); in mlxsw_sp_pgt_entry_create()
130 if (!pgt_entry) in mlxsw_sp_pgt_entry_create()
133 ret = idr_replace(&pgt->pgt_idr, pgt_entry, mid); in mlxsw_sp_pgt_entry_create()
139 INIT_LIST_HEAD(&pgt_entry->ports_list); in mlxsw_sp_pgt_entry_create()
140 pgt_entry->index = mid; in mlxsw_sp_pgt_entry_create()
141 pgt_entry->smpe_index = smpe; in mlxsw_sp_pgt_entry_create()
142 return pgt_entry; in mlxsw_sp_pgt_entry_create()
145 kfree(pgt_entry); in mlxsw_sp_pgt_entry_create()
150 struct mlxsw_sp_pgt_entry *pgt_entry) in mlxsw_sp_pgt_entry_destroy() argument
152 WARN_ON(!list_empty(&pgt_entry->ports_list)); in mlxsw_sp_pgt_entry_destroy()
154 pgt_entry = idr_replace(&pgt->pgt_idr, NULL, pgt_entry->index); in mlxsw_sp_pgt_entry_destroy()
155 if (WARN_ON(IS_ERR(pgt_entry))) in mlxsw_sp_pgt_entry_destroy()
158 kfree(pgt_entry); in mlxsw_sp_pgt_entry_destroy()
164 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_get() local
166 pgt_entry = idr_find(&pgt->pgt_idr, mid); in mlxsw_sp_pgt_entry_get()
167 if (pgt_entry) in mlxsw_sp_pgt_entry_get()
168 return pgt_entry; in mlxsw_sp_pgt_entry_get()
175 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_put() local
177 pgt_entry = idr_find(&pgt->pgt_idr, mid); in mlxsw_sp_pgt_entry_put()
178 if (WARN_ON(!pgt_entry)) in mlxsw_sp_pgt_entry_put()
181 if (list_empty(&pgt_entry->ports_list)) in mlxsw_sp_pgt_entry_put()
182 mlxsw_sp_pgt_entry_destroy(pgt, pgt_entry); in mlxsw_sp_pgt_entry_put()
194 const struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_write() argument
204 mlxsw_reg_smid2_pack(smid2_pl, pgt_entry->index, 0, 0, in mlxsw_sp_pgt_entry_port_write()
206 pgt_entry->smpe_index); in mlxsw_sp_pgt_entry_port_write()
218 struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_create() argument
228 err = mlxsw_sp_pgt_entry_port_write(mlxsw_sp, pgt_entry, local_port, in mlxsw_sp_pgt_entry_port_create()
234 list_add(&pgt_entry_port->list, &pgt_entry->ports_list); in mlxsw_sp_pgt_entry_port_create()
245 struct mlxsw_sp_pgt_entry *pgt_entry, in mlxsw_sp_pgt_entry_port_destroy() argument
250 mlxsw_sp_pgt_entry_port_write(mlxsw_sp, pgt_entry, in mlxsw_sp_pgt_entry_port_destroy()
259 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_port_add() local
264 pgt_entry = mlxsw_sp_pgt_entry_get(mlxsw_sp->pgt, mid, smpe); in mlxsw_sp_pgt_entry_port_add()
265 if (IS_ERR(pgt_entry)) { in mlxsw_sp_pgt_entry_port_add()
266 err = PTR_ERR(pgt_entry); in mlxsw_sp_pgt_entry_port_add()
270 pgt_entry_port = mlxsw_sp_pgt_entry_port_create(mlxsw_sp, pgt_entry, in mlxsw_sp_pgt_entry_port_add()
291 struct mlxsw_sp_pgt_entry *pgt_entry; in mlxsw_sp_pgt_entry_port_del() local
295 pgt_entry = idr_find(&mlxsw_sp->pgt->pgt_idr, mid); in mlxsw_sp_pgt_entry_port_del()
296 if (!pgt_entry) in mlxsw_sp_pgt_entry_port_del()
299 pgt_entry_port = mlxsw_sp_pgt_entry_port_lookup(pgt_entry, local_port); in mlxsw_sp_pgt_entry_port_del()
303 mlxsw_sp_pgt_entry_port_destroy(mlxsw_sp, pgt_entry, pgt_entry_port); in mlxsw_sp_pgt_entry_port_del()