Lines Matching refs:cookie

144 	return jhash2((u32 *) fa_cookie->cookie,
157 const struct mlxsw_afa_cookie *cookie = data;
159 return mlxsw_afa_cookie_hash(&cookie->fa_cookie, seed);
166 const struct mlxsw_afa_cookie *cookie = obj;
168 if (cookie->fa_cookie.cookie_len == fa_cookie->cookie_len)
169 return memcmp(cookie->fa_cookie.cookie, fa_cookie->cookie,
732 struct mlxsw_afa_cookie *cookie;
736 cookie = kzalloc(sizeof(*cookie) + fa_cookie->cookie_len, GFP_KERNEL);
737 if (!cookie)
739 refcount_set(&cookie->ref_count, 1);
740 cookie->fa_cookie = *fa_cookie;
741 memcpy(cookie->fa_cookie.cookie, fa_cookie->cookie,
744 err = rhashtable_insert_fast(&mlxsw_afa->cookie_ht, &cookie->ht_node,
749 /* Start cookie indexes with 1. Leave the 0 index unused. Packets
750 * that come from the HW which are not dropped by drop-with-cookie
754 err = idr_alloc_u32(&mlxsw_afa->cookie_idr, cookie, &cookie_index,
758 cookie->cookie_index = cookie_index;
759 return cookie;
762 rhashtable_remove_fast(&mlxsw_afa->cookie_ht, &cookie->ht_node,
765 kfree(cookie);
770 struct mlxsw_afa_cookie *cookie)
772 idr_remove(&mlxsw_afa->cookie_idr, cookie->cookie_index);
773 rhashtable_remove_fast(&mlxsw_afa->cookie_ht, &cookie->ht_node,
775 kfree_rcu(cookie, rcu);
782 struct mlxsw_afa_cookie *cookie;
784 cookie = rhashtable_lookup_fast(&mlxsw_afa->cookie_ht, fa_cookie,
786 if (cookie) {
787 refcount_inc(&cookie->ref_count);
788 return cookie;
794 struct mlxsw_afa_cookie *cookie)
796 if (!refcount_dec_and_test(&cookie->ref_count))
798 mlxsw_afa_cookie_destroy(mlxsw_afa, cookie);
805 struct mlxsw_afa_cookie *cookie;
807 /* 0 index means no cookie */
810 cookie = idr_find(&mlxsw_afa->cookie_idr, cookie_index);
811 if (!cookie)
813 return &cookie->fa_cookie;
819 struct mlxsw_afa_cookie *cookie;
827 mlxsw_afa_cookie_put(block->afa, cookie_ref->cookie);
847 struct mlxsw_afa_cookie *cookie;
853 cookie = mlxsw_afa_cookie_get(block->afa, fa_cookie);
854 if (IS_ERR(cookie)) {
855 err = PTR_ERR(cookie);
858 cookie_ref->cookie = cookie;
1289 NL_SET_ERR_MSG_MOD(extack, "Cannot create cookie for drop action");
1292 cookie_index = cookie_ref->cookie->cookie_index;
1297 NL_SET_ERR_MSG_MOD(extack, "Cannot append drop with cookie action");