Lines Matching refs:vchunk
164 struct mlxsw_sp_acl_tcam_vchunk *vchunk; member
192 struct mlxsw_sp_acl_tcam_vchunk *vchunk; member
341 struct mlxsw_sp_acl_tcam_vchunk *vchunk; in mlxsw_sp_acl_tcam_vregion_prio() local
346 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_prio()
347 typeof(*vchunk), list); in mlxsw_sp_acl_tcam_vregion_prio()
348 return vchunk->priority; in mlxsw_sp_acl_tcam_vregion_prio()
354 struct mlxsw_sp_acl_tcam_vchunk *vchunk; in mlxsw_sp_acl_tcam_vregion_max_prio() local
358 vchunk = list_last_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_max_prio()
359 typeof(*vchunk), list); in mlxsw_sp_acl_tcam_vregion_max_prio()
360 return vchunk->priority; in mlxsw_sp_acl_tcam_vregion_max_prio()
728 mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed(struct mlxsw_sp_acl_tcam_vchunk *vchunk) in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed() argument
730 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
736 if (vregion->rehash.ctx.current_vchunk == vchunk) { in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
881 struct mlxsw_sp_acl_tcam_vchunk *vchunk, in mlxsw_sp_acl_tcam_chunk_create() argument
890 chunk->vchunk = vchunk; in mlxsw_sp_acl_tcam_chunk_create()
893 ops->chunk_init(region->priv, chunk->priv, vchunk->priority); in mlxsw_sp_acl_tcam_chunk_create()
913 struct mlxsw_sp_acl_tcam_vchunk *vchunk, *vchunk2; in mlxsw_sp_acl_tcam_vchunk_create() local
921 vchunk = kzalloc(sizeof(*vchunk), GFP_KERNEL); in mlxsw_sp_acl_tcam_vchunk_create()
922 if (!vchunk) in mlxsw_sp_acl_tcam_vchunk_create()
924 INIT_LIST_HEAD(&vchunk->ventry_list); in mlxsw_sp_acl_tcam_vchunk_create()
925 vchunk->priority = priority; in mlxsw_sp_acl_tcam_vchunk_create()
926 vchunk->vgroup = vgroup; in mlxsw_sp_acl_tcam_vchunk_create()
927 vchunk->ref_count = 1; in mlxsw_sp_acl_tcam_vchunk_create()
936 vchunk->vregion = vregion; in mlxsw_sp_acl_tcam_vchunk_create()
938 err = rhashtable_insert_fast(&vgroup->vchunk_ht, &vchunk->ht_node, in mlxsw_sp_acl_tcam_vchunk_create()
944 vchunk->chunk = mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, in mlxsw_sp_acl_tcam_vchunk_create()
945 vchunk->vregion->region); in mlxsw_sp_acl_tcam_vchunk_create()
946 if (IS_ERR(vchunk->chunk)) { in mlxsw_sp_acl_tcam_vchunk_create()
948 err = PTR_ERR(vchunk->chunk); in mlxsw_sp_acl_tcam_vchunk_create()
960 list_add_tail(&vchunk->list, pos); in mlxsw_sp_acl_tcam_vchunk_create()
964 return vchunk; in mlxsw_sp_acl_tcam_vchunk_create()
967 rhashtable_remove_fast(&vgroup->vchunk_ht, &vchunk->ht_node, in mlxsw_sp_acl_tcam_vchunk_create()
972 kfree(vchunk); in mlxsw_sp_acl_tcam_vchunk_create()
978 struct mlxsw_sp_acl_tcam_vchunk *vchunk) in mlxsw_sp_acl_tcam_vchunk_destroy() argument
980 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_vchunk_destroy()
981 struct mlxsw_sp_acl_tcam_vgroup *vgroup = vchunk->vgroup; in mlxsw_sp_acl_tcam_vchunk_destroy()
985 list_del(&vchunk->list); in mlxsw_sp_acl_tcam_vchunk_destroy()
986 if (vchunk->chunk2) in mlxsw_sp_acl_tcam_vchunk_destroy()
987 mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2); in mlxsw_sp_acl_tcam_vchunk_destroy()
988 mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk); in mlxsw_sp_acl_tcam_vchunk_destroy()
990 rhashtable_remove_fast(&vgroup->vchunk_ht, &vchunk->ht_node, in mlxsw_sp_acl_tcam_vchunk_destroy()
992 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vchunk->vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
993 kfree(vchunk); in mlxsw_sp_acl_tcam_vchunk_destroy()
1003 struct mlxsw_sp_acl_tcam_vchunk *vchunk; in mlxsw_sp_acl_tcam_vchunk_get() local
1005 vchunk = rhashtable_lookup_fast(&vgroup->vchunk_ht, &priority, in mlxsw_sp_acl_tcam_vchunk_get()
1007 if (vchunk) { in mlxsw_sp_acl_tcam_vchunk_get()
1008 if (WARN_ON(!mlxsw_afk_key_info_subset(vchunk->vregion->key_info, in mlxsw_sp_acl_tcam_vchunk_get()
1011 vchunk->ref_count++; in mlxsw_sp_acl_tcam_vchunk_get()
1012 return vchunk; in mlxsw_sp_acl_tcam_vchunk_get()
1020 struct mlxsw_sp_acl_tcam_vchunk *vchunk) in mlxsw_sp_acl_tcam_vchunk_put() argument
1022 if (--vchunk->ref_count) in mlxsw_sp_acl_tcam_vchunk_put()
1024 mlxsw_sp_acl_tcam_vchunk_destroy(mlxsw_sp, vchunk); in mlxsw_sp_acl_tcam_vchunk_put()
1093 struct mlxsw_sp_acl_tcam_vchunk *vchunk; in mlxsw_sp_acl_tcam_ventry_add() local
1096 vchunk = mlxsw_sp_acl_tcam_vchunk_get(mlxsw_sp, vgroup, rulei->priority, in mlxsw_sp_acl_tcam_ventry_add()
1098 if (IS_ERR(vchunk)) in mlxsw_sp_acl_tcam_ventry_add()
1099 return PTR_ERR(vchunk); in mlxsw_sp_acl_tcam_ventry_add()
1101 ventry->vchunk = vchunk; in mlxsw_sp_acl_tcam_ventry_add()
1103 vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_add()
1107 vchunk->chunk); in mlxsw_sp_acl_tcam_ventry_add()
1114 list_add_tail(&ventry->list, &vchunk->ventry_list); in mlxsw_sp_acl_tcam_ventry_add()
1115 mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed(vchunk); in mlxsw_sp_acl_tcam_ventry_add()
1121 mlxsw_sp_acl_tcam_vchunk_put(mlxsw_sp, vchunk); in mlxsw_sp_acl_tcam_ventry_add()
1128 struct mlxsw_sp_acl_tcam_vchunk *vchunk = ventry->vchunk; in mlxsw_sp_acl_tcam_ventry_del() local
1129 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_del()
1132 mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed(vchunk); in mlxsw_sp_acl_tcam_ventry_del()
1136 mlxsw_sp_acl_tcam_vchunk_put(mlxsw_sp, vchunk); in mlxsw_sp_acl_tcam_ventry_del()
1144 struct mlxsw_sp_acl_tcam_vchunk *vchunk = ventry->vchunk; in mlxsw_sp_acl_tcam_ventry_action_replace() local
1147 vchunk->vregion->region, in mlxsw_sp_acl_tcam_ventry_action_replace()
1185 struct mlxsw_sp_acl_tcam_vchunk *vchunk, in mlxsw_sp_acl_tcam_vchunk_migrate_start() argument
1191 new_chunk = mlxsw_sp_acl_tcam_chunk_create(mlxsw_sp, vchunk, region); in mlxsw_sp_acl_tcam_vchunk_migrate_start()
1194 vchunk->chunk2 = vchunk->chunk; in mlxsw_sp_acl_tcam_vchunk_migrate_start()
1195 vchunk->chunk = new_chunk; in mlxsw_sp_acl_tcam_vchunk_migrate_start()
1196 ctx->current_vchunk = vchunk; in mlxsw_sp_acl_tcam_vchunk_migrate_start()
1204 struct mlxsw_sp_acl_tcam_vchunk *vchunk, in mlxsw_sp_acl_tcam_vchunk_migrate_end() argument
1207 mlxsw_sp_acl_tcam_chunk_destroy(mlxsw_sp, vchunk->chunk2); in mlxsw_sp_acl_tcam_vchunk_migrate_end()
1208 vchunk->chunk2 = NULL; in mlxsw_sp_acl_tcam_vchunk_migrate_end()
1214 struct mlxsw_sp_acl_tcam_vchunk *vchunk, in mlxsw_sp_acl_tcam_vchunk_migrate_one() argument
1222 if (vchunk->chunk->region != region) { in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1223 err = mlxsw_sp_acl_tcam_vchunk_migrate_start(mlxsw_sp, vchunk, in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1227 } else if (!vchunk->chunk2) { in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1238 ventry = list_first_entry(&vchunk->ventry_list, in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1241 list_for_each_entry_from(ventry, &vchunk->ventry_list, list) { in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1249 vchunk->chunk, credits); in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1262 swap(vchunk->chunk, vchunk->chunk2); in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1281 mlxsw_sp_acl_tcam_vchunk_migrate_end(mlxsw_sp, vchunk, ctx); in mlxsw_sp_acl_tcam_vchunk_migrate_one()
1291 struct mlxsw_sp_acl_tcam_vchunk *vchunk; in mlxsw_sp_acl_tcam_vchunk_migrate_all() local
1298 vchunk = ctx->current_vchunk; in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1300 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1301 typeof(*vchunk), list); in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1303 list_for_each_entry_from(vchunk, &vregion->vchunk_list, list) { in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1304 err = mlxsw_sp_acl_tcam_vchunk_migrate_one(mlxsw_sp, vchunk, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1765 struct mlxsw_sp_acl_tcam_vchunk *vchunk; member
1798 ruleset->vchunk = mlxsw_sp_acl_tcam_vchunk_get(mlxsw_sp, in mlxsw_sp_acl_tcam_mr_ruleset_add()
1801 if (IS_ERR(ruleset->vchunk)) { in mlxsw_sp_acl_tcam_mr_ruleset_add()
1802 err = PTR_ERR(ruleset->vchunk); in mlxsw_sp_acl_tcam_mr_ruleset_add()
1818 mlxsw_sp_acl_tcam_vchunk_put(mlxsw_sp, ruleset->vchunk); in mlxsw_sp_acl_tcam_mr_ruleset_del()