Lines Matching refs:vtcam
750 struct prestera_acl_vtcam *vtcam; in __prestera_acl_vtcam_id_try_fit() local
753 list_for_each_entry(vtcam, &acl->vtcam_list, list) { in __prestera_acl_vtcam_id_try_fit()
754 if (lookup != vtcam->lookup) in __prestera_acl_vtcam_id_try_fit()
757 if (!keymask && !vtcam->is_keymask_set) in __prestera_acl_vtcam_id_try_fit()
760 if (!(keymask && vtcam->is_keymask_set)) in __prestera_acl_vtcam_id_try_fit()
771 if (__keymask & ~vtcam->keymask[i]) in __prestera_acl_vtcam_id_try_fit()
785 refcount_inc(&vtcam->refcount); in __prestera_acl_vtcam_id_try_fit()
786 *vtcam_id = vtcam->id; in __prestera_acl_vtcam_id_try_fit()
793 struct prestera_acl_vtcam *vtcam; in prestera_acl_vtcam_id_get() local
801 list_for_each_entry(vtcam, &acl->vtcam_list, list) { in prestera_acl_vtcam_id_get()
802 if (lookup != vtcam->lookup || in prestera_acl_vtcam_id_get()
803 dir != vtcam->direction) in prestera_acl_vtcam_id_get()
806 if (!keymask && !vtcam->is_keymask_set) { in prestera_acl_vtcam_id_get()
807 refcount_inc(&vtcam->refcount); in prestera_acl_vtcam_id_get()
811 if (keymask && vtcam->is_keymask_set && in prestera_acl_vtcam_id_get()
812 !memcmp(keymask, vtcam->keymask, sizeof(vtcam->keymask))) { in prestera_acl_vtcam_id_get()
813 refcount_inc(&vtcam->refcount); in prestera_acl_vtcam_id_get()
819 vtcam = kzalloc(sizeof(*vtcam), GFP_KERNEL); in prestera_acl_vtcam_id_get()
820 if (!vtcam) in prestera_acl_vtcam_id_get()
826 kfree(vtcam); in prestera_acl_vtcam_id_get()
837 vtcam->direction = dir; in prestera_acl_vtcam_id_get()
838 vtcam->id = new_vtcam_id; in prestera_acl_vtcam_id_get()
839 vtcam->lookup = lookup; in prestera_acl_vtcam_id_get()
841 memcpy(vtcam->keymask, keymask, sizeof(vtcam->keymask)); in prestera_acl_vtcam_id_get()
842 vtcam->is_keymask_set = true; in prestera_acl_vtcam_id_get()
844 refcount_set(&vtcam->refcount, 1); in prestera_acl_vtcam_id_get()
845 list_add_rcu(&vtcam->list, &acl->vtcam_list); in prestera_acl_vtcam_id_get()
848 *vtcam_id = vtcam->id; in prestera_acl_vtcam_id_get()
854 struct prestera_acl_vtcam *vtcam; in prestera_acl_vtcam_id_put() local
857 list_for_each_entry(vtcam, &acl->vtcam_list, list) { in prestera_acl_vtcam_id_put()
858 if (vtcam_id != vtcam->id) in prestera_acl_vtcam_id_put()
861 if (!refcount_dec_and_test(&vtcam->refcount)) in prestera_acl_vtcam_id_put()
864 err = prestera_hw_vtcam_destroy(acl->sw, vtcam->id); in prestera_acl_vtcam_id_put()
866 refcount_set(&vtcam->refcount, 1); in prestera_acl_vtcam_id_put()
870 list_del(&vtcam->list); in prestera_acl_vtcam_id_put()
871 kfree(vtcam); in prestera_acl_vtcam_id_put()