Lines Matching refs:vregion

239 	struct mlxsw_sp_acl_tcam_vregion *vregion;  member
277 list_next_entry(region, list)->vregion == region->vregion) in mlxsw_sp_acl_tcam_group_update()
395 mlxsw_sp_acl_tcam_vregion_prio(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_prio() argument
399 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vregion_prio()
402 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_prio()
408 mlxsw_sp_acl_tcam_vregion_max_prio(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_max_prio() argument
412 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vregion_max_prio()
414 vchunk = list_last_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_max_prio()
445 if (mlxsw_sp_acl_tcam_vregion_prio(region2->vregion) > in mlxsw_sp_acl_tcam_group_region_attach()
484 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vgroup_vregion_attach() argument
497 list_add_tail(&vregion->list, pos); in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
500 vregion->region, in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
508 list_del(&vregion->list); in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
514 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vgroup_vregion_detach() argument
516 list_del(&vregion->list); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
517 if (vregion->region2) in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
519 vregion->region2); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
520 mlxsw_sp_acl_tcam_group_region_detach(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
529 struct mlxsw_sp_acl_tcam_vregion *vregion, *vregion2; in mlxsw_sp_acl_tcam_vgroup_vregion_find() local
534 vregion = list_entry(pos, typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_vregion_find()
547 issubset = mlxsw_afk_key_info_subset(vregion->key_info, in mlxsw_sp_acl_tcam_vgroup_vregion_find()
556 priority < mlxsw_sp_acl_tcam_vregion_prio(vregion)) in mlxsw_sp_acl_tcam_vgroup_vregion_find()
566 priority > mlxsw_sp_acl_tcam_vregion_max_prio(vregion)) in mlxsw_sp_acl_tcam_vgroup_vregion_find()
574 return vregion; in mlxsw_sp_acl_tcam_vgroup_vregion_find()
671 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_region_create() argument
682 region->vregion = vregion; in mlxsw_sp_acl_tcam_region_create()
683 region->key_info = vregion->key_info; in mlxsw_sp_acl_tcam_region_create()
736 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule() argument
738 unsigned long interval = vregion->tcam->vregion_rehash_intrvl; in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule()
742 mlxsw_core_schedule_dw(&vregion->rehash.dw, in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule()
748 struct mlxsw_sp_acl_tcam_vregion *vregion,
753 struct mlxsw_sp_acl_tcam_vregion *vregion = in mlxsw_sp_acl_tcam_vregion_rehash_work() local
758 mlxsw_sp_acl_tcam_vregion_rehash(vregion->mlxsw_sp, vregion, &credits); in mlxsw_sp_acl_tcam_vregion_rehash_work()
763 mlxsw_core_schedule_dw(&vregion->rehash.dw, 0); in mlxsw_sp_acl_tcam_vregion_rehash_work()
765 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion); in mlxsw_sp_acl_tcam_vregion_rehash_work()
771 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed() local
777 if (vregion->rehash.ctx.current_vchunk == vchunk) { in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
778 vregion->rehash.ctx.start_ventry = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
779 vregion->rehash.ctx.stop_ventry = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
784 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed() argument
790 vregion->rehash.ctx.current_vchunk = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed()
802 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_create() local
805 vregion = kzalloc(sizeof(*vregion), GFP_KERNEL); in mlxsw_sp_acl_tcam_vregion_create()
806 if (!vregion) in mlxsw_sp_acl_tcam_vregion_create()
808 INIT_LIST_HEAD(&vregion->vchunk_list); in mlxsw_sp_acl_tcam_vregion_create()
809 mutex_init(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_create()
810 vregion->tcam = tcam; in mlxsw_sp_acl_tcam_vregion_create()
811 vregion->mlxsw_sp = mlxsw_sp; in mlxsw_sp_acl_tcam_vregion_create()
812 vregion->vgroup = vgroup; in mlxsw_sp_acl_tcam_vregion_create()
813 vregion->ref_count = 1; in mlxsw_sp_acl_tcam_vregion_create()
815 vregion->key_info = mlxsw_afk_key_info_get(afk, elusage); in mlxsw_sp_acl_tcam_vregion_create()
816 if (IS_ERR(vregion->key_info)) { in mlxsw_sp_acl_tcam_vregion_create()
817 err = PTR_ERR(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_create()
821 vregion->region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, tcam, in mlxsw_sp_acl_tcam_vregion_create()
822 vregion, NULL); in mlxsw_sp_acl_tcam_vregion_create()
823 if (IS_ERR(vregion->region)) { in mlxsw_sp_acl_tcam_vregion_create()
824 err = PTR_ERR(vregion->region); in mlxsw_sp_acl_tcam_vregion_create()
828 err = mlxsw_sp_acl_tcam_vgroup_vregion_attach(mlxsw_sp, vgroup, vregion, in mlxsw_sp_acl_tcam_vregion_create()
835 INIT_DELAYED_WORK(&vregion->rehash.dw, in mlxsw_sp_acl_tcam_vregion_create()
837 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion); in mlxsw_sp_acl_tcam_vregion_create()
839 list_add_tail(&vregion->tlist, &tcam->vregion_list); in mlxsw_sp_acl_tcam_vregion_create()
843 return vregion; in mlxsw_sp_acl_tcam_vregion_create()
846 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vregion_create()
848 mlxsw_afk_key_info_put(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_create()
850 kfree(vregion); in mlxsw_sp_acl_tcam_vregion_create()
856 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_destroy() argument
859 struct mlxsw_sp_acl_tcam_vgroup *vgroup = vregion->vgroup; in mlxsw_sp_acl_tcam_vregion_destroy()
860 struct mlxsw_sp_acl_tcam *tcam = vregion->tcam; in mlxsw_sp_acl_tcam_vregion_destroy()
864 list_del(&vregion->tlist); in mlxsw_sp_acl_tcam_vregion_destroy()
866 cancel_delayed_work_sync(&vregion->rehash.dw); in mlxsw_sp_acl_tcam_vregion_destroy()
868 mlxsw_sp_acl_tcam_vgroup_vregion_detach(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_destroy()
869 if (vregion->region2) in mlxsw_sp_acl_tcam_vregion_destroy()
870 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region2); in mlxsw_sp_acl_tcam_vregion_destroy()
871 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vregion_destroy()
872 mlxsw_afk_key_info_put(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_destroy()
873 mutex_destroy(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_destroy()
874 kfree(vregion); in mlxsw_sp_acl_tcam_vregion_destroy()
894 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set() local
902 list_for_each_entry(vregion, &tcam->vregion_list, tlist) { in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set()
904 mlxsw_core_schedule_dw(&vregion->rehash.dw, 0); in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set()
906 cancel_delayed_work_sync(&vregion->rehash.dw); in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set()
919 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_get() local
922 vregion = mlxsw_sp_acl_tcam_vgroup_vregion_find(vgroup, priority, in mlxsw_sp_acl_tcam_vregion_get()
924 if (vregion) { in mlxsw_sp_acl_tcam_vregion_get()
935 vregion->ref_count++; in mlxsw_sp_acl_tcam_vregion_get()
936 return vregion; in mlxsw_sp_acl_tcam_vregion_get()
948 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_put() argument
950 if (--vregion->ref_count) in mlxsw_sp_acl_tcam_vregion_put()
952 mlxsw_sp_acl_tcam_vregion_destroy(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_put()
989 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vchunk_create() local
1004 vregion = mlxsw_sp_acl_tcam_vregion_get(mlxsw_sp, vgroup, in mlxsw_sp_acl_tcam_vchunk_create()
1006 if (IS_ERR(vregion)) { in mlxsw_sp_acl_tcam_vchunk_create()
1007 err = PTR_ERR(vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1011 vchunk->vregion = vregion; in mlxsw_sp_acl_tcam_vchunk_create()
1018 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
1020 vchunk->vregion->region); in mlxsw_sp_acl_tcam_vchunk_create()
1022 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
1027 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1028 list_add_tail(&vchunk->list, &vregion->vchunk_list); in mlxsw_sp_acl_tcam_vchunk_create()
1029 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
1037 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1047 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_vchunk_destroy() local
1050 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_destroy()
1051 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
1056 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_destroy()
1059 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vchunk->vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
1074 if (WARN_ON(!mlxsw_afk_key_info_subset(vchunk->vregion->key_info, in mlxsw_sp_acl_tcam_vchunk_get()
1158 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_ventry_add() local
1169 vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_add()
1171 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1175 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1182 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1195 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_del() local
1197 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_del()
1201 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_del()
1213 vchunk->vregion->region, in mlxsw_sp_acl_tcam_ventry_action_replace()
1353 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vchunk_migrate_all() argument
1366 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1369 list_for_each_entry_from(vchunk, &vregion->vchunk_list, list) { in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1371 vregion->region, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1381 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_migrate() argument
1387 trace_mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1388 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_migrate()
1389 err = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_migrate()
1396 swap(vregion->region, vregion->region2); in mlxsw_sp_acl_tcam_vregion_migrate()
1399 err2 = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_migrate()
1403 vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1408 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_migrate()
1409 trace_mlxsw_sp_acl_tcam_vregion_migrate_end(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1421 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash_start() argument
1425 unsigned int priority = mlxsw_sp_acl_tcam_vregion_prio(vregion); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1430 trace_mlxsw_sp_acl_tcam_vregion_rehash(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1432 hints_priv = ops->region_rehash_hints_get(vregion->region->priv); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1436 new_region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, vregion->tcam, in mlxsw_sp_acl_tcam_vregion_rehash_start()
1437 vregion, hints_priv); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1446 vregion->region2 = vregion->region; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1447 vregion->region = new_region; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1449 vregion->region2->group, in mlxsw_sp_acl_tcam_vregion_rehash_start()
1451 vregion->region2); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1461 vregion->region = vregion->region2; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1462 vregion->region2 = NULL; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1471 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash_end() argument
1474 struct mlxsw_sp_acl_tcam_region *unused_region = vregion->region2; in mlxsw_sp_acl_tcam_vregion_rehash_end()
1477 vregion->region2 = NULL; in mlxsw_sp_acl_tcam_vregion_rehash_end()
1486 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash() argument
1489 struct mlxsw_sp_acl_tcam_rehash_ctx *ctx = &vregion->rehash.ctx; in mlxsw_sp_acl_tcam_vregion_rehash()
1498 vregion, ctx); in mlxsw_sp_acl_tcam_vregion_rehash()
1506 err = mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_rehash()
1513 mlxsw_sp_acl_tcam_vregion_rehash_end(mlxsw_sp, vregion, ctx); in mlxsw_sp_acl_tcam_vregion_rehash()