Lines Matching refs:vregion

182 	struct mlxsw_sp_acl_tcam_vregion *vregion;  member
220 list_next_entry(region, list)->vregion == region->vregion) in mlxsw_sp_acl_tcam_group_update()
343 mlxsw_sp_acl_tcam_vregion_prio(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_prio() argument
347 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vregion_prio()
350 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_prio()
356 mlxsw_sp_acl_tcam_vregion_max_prio(struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_max_prio() argument
360 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vregion_max_prio()
362 vchunk = list_last_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vregion_max_prio()
370 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vgroup_prio_update() local
374 vregion = list_first_entry(&vgroup->vregion_list, in mlxsw_sp_acl_tcam_vgroup_prio_update()
375 typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_prio_update()
376 *vgroup->p_min_prio = mlxsw_sp_acl_tcam_vregion_prio(vregion); in mlxsw_sp_acl_tcam_vgroup_prio_update()
377 vregion = list_last_entry(&vgroup->vregion_list, in mlxsw_sp_acl_tcam_vgroup_prio_update()
378 typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_prio_update()
379 *vgroup->p_max_prio = mlxsw_sp_acl_tcam_vregion_max_prio(vregion); in mlxsw_sp_acl_tcam_vgroup_prio_update()
408 if (mlxsw_sp_acl_tcam_vregion_prio(region2->vregion) > in mlxsw_sp_acl_tcam_group_region_attach()
447 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vgroup_vregion_attach() argument
460 list_add_tail(&vregion->list, pos); in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
463 vregion->region, in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
471 list_del(&vregion->list); in mlxsw_sp_acl_tcam_vgroup_vregion_attach()
477 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vgroup_vregion_detach() argument
479 list_del(&vregion->list); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
480 if (vregion->region2) in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
482 vregion->region2); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
483 mlxsw_sp_acl_tcam_group_region_detach(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vgroup_vregion_detach()
492 struct mlxsw_sp_acl_tcam_vregion *vregion, *vregion2; in mlxsw_sp_acl_tcam_vgroup_vregion_find() local
497 vregion = list_entry(pos, typeof(*vregion), list); in mlxsw_sp_acl_tcam_vgroup_vregion_find()
510 issubset = mlxsw_afk_key_info_subset(vregion->key_info, in mlxsw_sp_acl_tcam_vgroup_vregion_find()
519 priority < mlxsw_sp_acl_tcam_vregion_prio(vregion)) in mlxsw_sp_acl_tcam_vgroup_vregion_find()
529 priority > mlxsw_sp_acl_tcam_vregion_max_prio(vregion)) in mlxsw_sp_acl_tcam_vgroup_vregion_find()
537 return vregion; in mlxsw_sp_acl_tcam_vgroup_vregion_find()
634 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_region_create() argument
645 region->vregion = vregion; in mlxsw_sp_acl_tcam_region_create()
646 region->key_info = vregion->key_info; in mlxsw_sp_acl_tcam_region_create()
699 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
701 unsigned long interval = vregion->tcam->vregion_rehash_intrvl; in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule()
705 mlxsw_core_schedule_dw(&vregion->rehash.dw, in mlxsw_sp_acl_tcam_vregion_rehash_work_schedule()
711 struct mlxsw_sp_acl_tcam_vregion *vregion,
716 struct mlxsw_sp_acl_tcam_vregion *vregion = in mlxsw_sp_acl_tcam_vregion_rehash_work() local
721 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_rehash_work()
722 mlxsw_sp_acl_tcam_vregion_rehash(vregion->mlxsw_sp, vregion, &credits); in mlxsw_sp_acl_tcam_vregion_rehash_work()
723 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_rehash_work()
728 mlxsw_core_schedule_dw(&vregion->rehash.dw, 0); in mlxsw_sp_acl_tcam_vregion_rehash_work()
730 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion); in mlxsw_sp_acl_tcam_vregion_rehash_work()
747 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed() local
753 if (vregion->rehash.ctx.current_vchunk == vchunk) { in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
754 vregion->rehash.ctx.start_ventry = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
755 vregion->rehash.ctx.stop_ventry = NULL; in mlxsw_sp_acl_tcam_rehash_ctx_vchunk_changed()
760 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
766 mlxsw_sp_acl_tcam_rehash_ctx_vchunk_reset(&vregion->rehash.ctx); in mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed()
778 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_create() local
781 vregion = kzalloc(sizeof(*vregion), GFP_KERNEL); in mlxsw_sp_acl_tcam_vregion_create()
782 if (!vregion) in mlxsw_sp_acl_tcam_vregion_create()
784 INIT_LIST_HEAD(&vregion->vchunk_list); in mlxsw_sp_acl_tcam_vregion_create()
785 mutex_init(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_create()
786 vregion->tcam = tcam; in mlxsw_sp_acl_tcam_vregion_create()
787 vregion->mlxsw_sp = mlxsw_sp; in mlxsw_sp_acl_tcam_vregion_create()
788 vregion->vgroup = vgroup; in mlxsw_sp_acl_tcam_vregion_create()
789 refcount_set(&vregion->ref_count, 1); in mlxsw_sp_acl_tcam_vregion_create()
791 vregion->key_info = mlxsw_afk_key_info_get(afk, elusage); in mlxsw_sp_acl_tcam_vregion_create()
792 if (IS_ERR(vregion->key_info)) { in mlxsw_sp_acl_tcam_vregion_create()
793 err = PTR_ERR(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_create()
797 vregion->region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, tcam, in mlxsw_sp_acl_tcam_vregion_create()
798 vregion, NULL); in mlxsw_sp_acl_tcam_vregion_create()
799 if (IS_ERR(vregion->region)) { in mlxsw_sp_acl_tcam_vregion_create()
800 err = PTR_ERR(vregion->region); in mlxsw_sp_acl_tcam_vregion_create()
804 err = mlxsw_sp_acl_tcam_vgroup_vregion_attach(mlxsw_sp, vgroup, vregion, in mlxsw_sp_acl_tcam_vregion_create()
811 INIT_DELAYED_WORK(&vregion->rehash.dw, in mlxsw_sp_acl_tcam_vregion_create()
813 mlxsw_sp_acl_tcam_vregion_rehash_work_schedule(vregion); in mlxsw_sp_acl_tcam_vregion_create()
815 list_add_tail(&vregion->tlist, &tcam->vregion_list); in mlxsw_sp_acl_tcam_vregion_create()
819 return vregion; in mlxsw_sp_acl_tcam_vregion_create()
822 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vregion_create()
824 mlxsw_afk_key_info_put(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_create()
826 kfree(vregion); in mlxsw_sp_acl_tcam_vregion_create()
832 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_destroy() argument
835 struct mlxsw_sp_acl_tcam_vgroup *vgroup = vregion->vgroup; in mlxsw_sp_acl_tcam_vregion_destroy()
836 struct mlxsw_sp_acl_tcam *tcam = vregion->tcam; in mlxsw_sp_acl_tcam_vregion_destroy()
839 struct mlxsw_sp_acl_tcam_rehash_ctx *ctx = &vregion->rehash.ctx; in mlxsw_sp_acl_tcam_vregion_destroy()
842 list_del(&vregion->tlist); in mlxsw_sp_acl_tcam_vregion_destroy()
844 if (cancel_delayed_work_sync(&vregion->rehash.dw) && in mlxsw_sp_acl_tcam_vregion_destroy()
848 mlxsw_sp_acl_tcam_vgroup_vregion_detach(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_destroy()
849 if (vregion->region2) in mlxsw_sp_acl_tcam_vregion_destroy()
850 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region2); in mlxsw_sp_acl_tcam_vregion_destroy()
851 mlxsw_sp_acl_tcam_region_destroy(mlxsw_sp, vregion->region); in mlxsw_sp_acl_tcam_vregion_destroy()
852 mlxsw_afk_key_info_put(vregion->key_info); in mlxsw_sp_acl_tcam_vregion_destroy()
853 mutex_destroy(&vregion->lock); in mlxsw_sp_acl_tcam_vregion_destroy()
854 kfree(vregion); in mlxsw_sp_acl_tcam_vregion_destroy()
864 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vregion_get() local
867 vregion = mlxsw_sp_acl_tcam_vgroup_vregion_find(vgroup, priority, in mlxsw_sp_acl_tcam_vregion_get()
869 if (vregion) { in mlxsw_sp_acl_tcam_vregion_get()
880 refcount_inc(&vregion->ref_count); in mlxsw_sp_acl_tcam_vregion_get()
881 return vregion; in mlxsw_sp_acl_tcam_vregion_get()
893 struct mlxsw_sp_acl_tcam_vregion *vregion) in mlxsw_sp_acl_tcam_vregion_put() argument
895 if (!refcount_dec_and_test(&vregion->ref_count)) in mlxsw_sp_acl_tcam_vregion_put()
897 mlxsw_sp_acl_tcam_vregion_destroy(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_put()
935 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_vchunk_create() local
950 vregion = mlxsw_sp_acl_tcam_vregion_get(mlxsw_sp, vgroup, in mlxsw_sp_acl_tcam_vchunk_create()
952 if (IS_ERR(vregion)) { in mlxsw_sp_acl_tcam_vchunk_create()
953 err = PTR_ERR(vregion); in mlxsw_sp_acl_tcam_vchunk_create()
957 vchunk->vregion = vregion; in mlxsw_sp_acl_tcam_vchunk_create()
964 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
966 vchunk->vregion->region); in mlxsw_sp_acl_tcam_vchunk_create()
968 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
973 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion); in mlxsw_sp_acl_tcam_vchunk_create()
976 list_for_each(pos, &vregion->vchunk_list) { in mlxsw_sp_acl_tcam_vchunk_create()
982 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_create()
991 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vchunk_create()
1001 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_vchunk_destroy() local
1004 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_destroy()
1005 mlxsw_sp_acl_tcam_rehash_ctx_vregion_changed(vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
1010 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_vchunk_destroy()
1013 mlxsw_sp_acl_tcam_vregion_put(mlxsw_sp, vchunk->vregion); in mlxsw_sp_acl_tcam_vchunk_destroy()
1029 if (WARN_ON(!mlxsw_afk_key_info_subset(vchunk->vregion->key_info, in mlxsw_sp_acl_tcam_vchunk_get()
1113 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_ventry_add() local
1124 vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_add()
1126 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1130 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1137 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_add()
1150 struct mlxsw_sp_acl_tcam_vregion *vregion = vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_del() local
1152 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_del()
1156 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_del()
1168 vchunk->vregion->region, in mlxsw_sp_acl_tcam_ventry_action_replace()
1177 struct mlxsw_sp_acl_tcam_vregion *vregion = ventry->vchunk->vregion; in mlxsw_sp_acl_tcam_ventry_activity_get() local
1180 mutex_lock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_activity_get()
1183 mutex_unlock(&vregion->lock); in mlxsw_sp_acl_tcam_ventry_activity_get()
1322 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vchunk_migrate_all() argument
1329 if (list_empty(&vregion->vchunk_list)) in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1338 vchunk = list_first_entry(&vregion->vchunk_list, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1341 list_for_each_entry_from(vchunk, &vregion->vchunk_list, list) { in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1343 vregion->region, in mlxsw_sp_acl_tcam_vchunk_migrate_all()
1353 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_migrate() argument
1359 trace_mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1360 err = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_migrate()
1369 swap(vregion->region, vregion->region2); in mlxsw_sp_acl_tcam_vregion_migrate()
1372 err2 = mlxsw_sp_acl_tcam_vchunk_migrate_all(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_migrate()
1376 vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1381 trace_mlxsw_sp_acl_tcam_vregion_migrate_end(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_migrate()
1393 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash_start() argument
1397 unsigned int priority = mlxsw_sp_acl_tcam_vregion_prio(vregion); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1402 trace_mlxsw_sp_acl_tcam_vregion_rehash(mlxsw_sp, vregion); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1404 hints_priv = ops->region_rehash_hints_get(vregion->region->priv); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1408 new_region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, vregion->tcam, in mlxsw_sp_acl_tcam_vregion_rehash_start()
1409 vregion, hints_priv); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1418 vregion->region2 = vregion->region; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1419 vregion->region = new_region; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1421 vregion->region2->group, in mlxsw_sp_acl_tcam_vregion_rehash_start()
1423 vregion->region2); in mlxsw_sp_acl_tcam_vregion_rehash_start()
1434 vregion->region = vregion->region2; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1435 vregion->region2 = NULL; in mlxsw_sp_acl_tcam_vregion_rehash_start()
1444 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash_end() argument
1447 struct mlxsw_sp_acl_tcam_region *unused_region = vregion->region2; in mlxsw_sp_acl_tcam_vregion_rehash_end()
1450 vregion->region2 = NULL; in mlxsw_sp_acl_tcam_vregion_rehash_end()
1459 struct mlxsw_sp_acl_tcam_vregion *vregion, in mlxsw_sp_acl_tcam_vregion_rehash() argument
1462 struct mlxsw_sp_acl_tcam_rehash_ctx *ctx = &vregion->rehash.ctx; in mlxsw_sp_acl_tcam_vregion_rehash()
1471 vregion, ctx); in mlxsw_sp_acl_tcam_vregion_rehash()
1479 err = mlxsw_sp_acl_tcam_vregion_migrate(mlxsw_sp, vregion, in mlxsw_sp_acl_tcam_vregion_rehash()
1487 mlxsw_sp_acl_tcam_vregion_rehash_end(mlxsw_sp, vregion, ctx); in mlxsw_sp_acl_tcam_vregion_rehash()
1511 struct mlxsw_sp_acl_tcam_vregion *vregion; in mlxsw_sp_acl_tcam_region_rehash_intrvl_set() local
1523 list_for_each_entry(vregion, &tcam->vregion_list, tlist) { in mlxsw_sp_acl_tcam_region_rehash_intrvl_set()
1525 mlxsw_core_schedule_dw(&vregion->rehash.dw, 0); in mlxsw_sp_acl_tcam_region_rehash_intrvl_set()
1527 cancel_delayed_work_sync(&vregion->rehash.dw); in mlxsw_sp_acl_tcam_region_rehash_intrvl_set()