Lines Matching refs:vregion

238 	struct mlxsw_sp_acl_tcam_vregion *vregion;  member
276 list_next_entry(region, list)->vregion == region->vregion) in mlxsw_sp_acl_tcam_group_update()
399 mlxsw_sp_acl_tcam_vregion_prio(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_prio() argument
403 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vregion_prio()
406 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_prio()
412 mlxsw_sp_acl_tcam_vregion_max_prio(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_max_prio() argument
416 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vregion_max_prio()
418 vchunk = list_last_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_max_prio()
426 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vgroup_prio_update() local
430 vregion = list_first_entry(&vgroup->vregion_list, in mlxsw_sp_acl_tcam_vgroup_prio_update()
431 typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_prio_update()
432 *vgroup->p_min_prio = mlxsw_sp_acl_tcam_vregion_prio(vregion); in mlxsw_sp_acl_tcam_vgroup_prio_update()
433 vregion = list_last_entry(&vgroup->vregion_list, in mlxsw_sp_acl_tcam_vgroup_prio_update()
434 typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_prio_update()
435 *vgroup->p_max_prio = mlxsw_sp_acl_tcam_vregion_max_prio(vregion); in mlxsw_sp_acl_tcam_vgroup_prio_update()
464 if (mlxsw_sp_acl_tcam_vregion_prio(region2->vregion) > in mlxsw_sp_acl_tcam_group_region_attach()
503 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vgroup_vregion_attach() argument
516 list_add_tail(&vregion->list, pos); in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
519 vregion->region, in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
527 list_del(&vregion->list); in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
533 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vgroup_vregion_detach() argument
535 list_del(&vregion->list); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
536 if (vregion->region2) in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
538 vregion->region2); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
539 mlxsw_sp_acl_tcam_group_region_detach(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
548 struct mlxsw_sp_acl_tcam_vregion *vregion, *vregion2; in mlxsw_sp_acl_tcam_vgroup_vregion_find() local
553 vregion = list_entry(pos, typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_vregion_find()
566 issubset = mlxsw_afk_key_info_subset(vregion->key_info, in mlxsw_sp_acl_tcam_vgroup_vregion_find()
575 priority < mlxsw_sp_acl_tcam_vregion_prio(vregion)) in mlxsw_sp_acl_tcam_vgroup_vregion_find()
585 priority > mlxsw_sp_acl_tcam_vregion_max_prio(vregion)) in mlxsw_sp_acl_tcam_vgroup_vregion_find()
593 return vregion; in mlxsw_sp_acl_tcam_vgroup_vregion_find()
690 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_region_create() argument
701 region->vregion = vregion; in mlxsw_sp_acl_tcam_region_create()
702 region->key_info = vregion->key_info; in mlxsw_sp_acl_tcam_region_create()
755 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
757 unsigned long interval = vregion->tcam->vregion_rehash_intrvl; in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule()
761 mlxsw_core_schedule_dw(&vregion->rehash.dw, in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule()
767 struct mlxsw_sp_acl_tcam_vregion *vregion,
772 struct mlxsw_sp_acl_tcam_vregion *vregion = in mlxsw_sp_acl_tcam_vregion_rehash_work() local
777 mlxsw_sp_acl_tcam_vregion_rehash(vregion->mlxsw_sp, vregion, &credits); in mlxsw_sp_acl_tcam_vregion_rehash_work()
782 mlxsw_core_schedule_dw(&vregion->rehash.dw, 0); in mlxsw_sp_acl_tcam_vregion_rehash_work()
784 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion); in mlxsw_sp_acl_tcam_vregion_rehash_work()
790 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed() local
796 if (vregion->rehash.ctx.current_vchunk == vchunk) { in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
797 vregion->rehash.ctx.start_ventry = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
798 vregion->rehash.ctx.stop_ventry = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
803 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
809 vregion->rehash.ctx.current_vchunk = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed()
821 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_create() local
824 vregion = kzalloc(sizeof(*vregion), GFP_KERNEL); in mlxsw_sp_acl_tcam_vregion_create()
825 if (!vregion) in mlxsw_sp_acl_tcam_vregion_create()
827 INIT_LIST_HEAD(&vregion->vchunk_list); in mlxsw_sp_acl_tcam_vregion_create()
828 mutex_init(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_create()
829 vregion->tcam = tcam; in mlxsw_sp_acl_tcam_vregion_create()
830 vregion->mlxsw_sp = mlxsw_sp; in mlxsw_sp_acl_tcam_vregion_create()
831 vregion->vgroup = vgroup; in mlxsw_sp_acl_tcam_vregion_create()
832 vregion->ref_count = 1; in mlxsw_sp_acl_tcam_vregion_create()
834 vregion->key_info = mlxsw_afk_key_info_get(afk, elusage); in mlxsw_sp_acl_tcam_vregion_create()
835 if (IS_ERR(vregion->key_info)) { in mlxsw_sp_acl_tcam_vregion_create()
836 err = PTR_ERR(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_create()
840 vregion->region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, tcam, in mlxsw_sp_acl_tcam_vregion_create()
841 vregion, NULL); in mlxsw_sp_acl_tcam_vregion_create()
842 if (IS_ERR(vregion->region)) { in mlxsw_sp_acl_tcam_vregion_create()
843 err = PTR_ERR(vregion->region); in mlxsw_sp_acl_tcam_vregion_create()
847 err = mlxsw_sp_acl_tcam_vgroup_vregion_attach(mlxsw_sp, vgroup, vregion, in mlxsw_sp_acl_tcam_vregion_create()
854 INIT_DELAYED_WORK(&vregion->rehash.dw, in mlxsw_sp_acl_tcam_vregion_create()
856 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion); in mlxsw_sp_acl_tcam_vregion_create()
858 list_add_tail(&vregion->tlist, &tcam->vregion_list); in mlxsw_sp_acl_tcam_vregion_create()
862 return vregion; in mlxsw_sp_acl_tcam_vregion_create()
865 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vregion_create()
867 mlxsw_afk_key_info_put(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_create()
869 kfree(vregion); in mlxsw_sp_acl_tcam_vregion_create()
875 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_destroy() argument
878 struct mlxsw_sp_acl_tcam_vgroup *vgroup = vregion->vgroup; in mlxsw_sp_acl_tcam_vregion_destroy()
879 struct mlxsw_sp_acl_tcam *tcam = vregion->tcam; in mlxsw_sp_acl_tcam_vregion_destroy()
883 list_del(&vregion->tlist); in mlxsw_sp_acl_tcam_vregion_destroy()
885 cancel_delayed_work_sync(&vregion->rehash.dw); in mlxsw_sp_acl_tcam_vregion_destroy()
887 mlxsw_sp_acl_tcam_vgroup_vregion_detach(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_destroy()
888 if (vregion->region2) in mlxsw_sp_acl_tcam_vregion_destroy()
889 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region2); in mlxsw_sp_acl_tcam_vregion_destroy()
890 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vregion_destroy()
891 mlxsw_afk_key_info_put(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_destroy()
892 mutex_destroy(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_destroy()
893 kfree(vregion); in mlxsw_sp_acl_tcam_vregion_destroy()
913 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set() local
921 list_for_each_entry(vregion, &tcam->vregion_list, tlist) { in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set()
923 mlxsw_core_schedule_dw(&vregion->rehash.dw, 0); in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set()
925 cancel_delayed_work_sync(&vregion->rehash.dw); in mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set()
938 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_get() local
941 vregion = mlxsw_sp_acl_tcam_vgroup_vregion_find(vgroup, priority, in mlxsw_sp_acl_tcam_vregion_get()
943 if (vregion) { in mlxsw_sp_acl_tcam_vregion_get()
954 vregion->ref_count++; in mlxsw_sp_acl_tcam_vregion_get()
955 return vregion; in mlxsw_sp_acl_tcam_vregion_get()
967 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_put() argument
969 if (--vregion->ref_count) in mlxsw_sp_acl_tcam_vregion_put()
971 mlxsw_sp_acl_tcam_vregion_destroy(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_put()
1009 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vchunk_create() local
1024 vregion = mlxsw_sp_acl_tcam_vregion_get(mlxsw_sp, vgroup, in mlxsw_sp_acl_tcam_vchunk_create()
1026 if (IS_ERR(vregion)) { in mlxsw_sp_acl_tcam_vchunk_create()
1027 err = PTR_ERR(vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1031 vchunk->vregion = vregion; in mlxsw_sp_acl_tcam_vchunk_create()
1038 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
1040 vchunk->vregion->region); in mlxsw_sp_acl_tcam_vchunk_create()
1042 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
1047 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1050 list_for_each(pos, &vregion->vchunk_list) { in mlxsw_sp_acl_tcam_vchunk_create()
1056 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
1065 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1075 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_vchunk_destroy() local
1078 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_destroy()
1079 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
1084 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_destroy()
1087 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vchunk->vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
1103 if (WARN_ON(!mlxsw_afk_key_info_subset(vchunk->vregion->key_info, in mlxsw_sp_acl_tcam_vchunk_get()
1187 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_ventry_add() local
1198 vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_add()
1200 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1204 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1211 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1224 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_del() local
1226 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_del()
1230 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_del()
1242 vchunk->vregion->region, in mlxsw_sp_acl_tcam_ventry_action_replace()
1382 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vchunk_migrate_all() argument
1395 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1398 list_for_each_entry_from(vchunk, &vregion->vchunk_list, list) { in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1400 vregion->region, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1410 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_migrate() argument
1416 trace_mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1417 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_migrate()
1418 err = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_migrate()
1425 swap(vregion->region, vregion->region2); in mlxsw_sp_acl_tcam_vregion_migrate()
1428 err2 = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_migrate()
1432 vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1437 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_migrate()
1438 trace_mlxsw_sp_acl_tcam_vregion_migrate_end(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1450 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash_start() argument
1454 unsigned int priority = mlxsw_sp_acl_tcam_vregion_prio(vregion); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1459 trace_mlxsw_sp_acl_tcam_vregion_rehash(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1461 hints_priv = ops->region_rehash_hints_get(vregion->region->priv); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1465 new_region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, vregion->tcam, in mlxsw_sp_acl_tcam_vregion_rehash_start()
1466 vregion, hints_priv); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1475 vregion->region2 = vregion->region; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1476 vregion->region = new_region; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1478 vregion->region2->group, in mlxsw_sp_acl_tcam_vregion_rehash_start()
1480 vregion->region2); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1490 vregion->region = vregion->region2; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1491 vregion->region2 = NULL; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1500 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash_end() argument
1503 struct mlxsw_sp_acl_tcam_region *unused_region = vregion->region2; in mlxsw_sp_acl_tcam_vregion_rehash_end()
1506 vregion->region2 = NULL; in mlxsw_sp_acl_tcam_vregion_rehash_end()
1515 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash() argument
1518 struct mlxsw_sp_acl_tcam_rehash_ctx *ctx = &vregion->rehash.ctx; in mlxsw_sp_acl_tcam_vregion_rehash()
1527 vregion, ctx); in mlxsw_sp_acl_tcam_vregion_rehash()
1535 err = mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_rehash()
1542 mlxsw_sp_acl_tcam_vregion_rehash_end(mlxsw_sp, vregion, ctx); in mlxsw_sp_acl_tcam_vregion_rehash()