Lines Matching defs:mh
58 struct mlx5e_mod_hdr_handle *mh, *found = NULL;
60 hash_for_each_possible(tbl->hlist, mh, mod_hdr_hlist, hash_key) {
61 if (!cmp_mod_hdr_info(&mh->key, key)) {
62 refcount_inc(&mh->refcnt);
63 found = mh;
78 struct mlx5e_mod_hdr_handle *mh;
91 mh = mod_hdr_get(tbl, &key, hash_key);
92 if (mh) {
94 wait_for_completion(&mh->res_ready);
96 if (mh->compl_result < 0) {
103 mh = kzalloc(sizeof(*mh) + actions_size, GFP_KERNEL);
104 if (!mh) {
109 mh->key.actions = (void *)mh + sizeof(*mh);
110 memcpy(mh->key.actions, key.actions, actions_size);
111 mh->key.num_actions = num_actions;
112 refcount_set(&mh->refcnt, 1);
113 init_completion(&mh->res_ready);
115 hash_add(tbl->hlist, &mh->mod_hdr_hlist, hash_key);
118 mh->modify_hdr = mlx5_modify_header_alloc(mdev, namespace,
119 mh->key.num_actions,
120 mh->key.actions);
121 if (IS_ERR(mh->modify_hdr)) {
122 err = PTR_ERR(mh->modify_hdr);
123 mh->compl_result = err;
126 mh->compl_result = 1;
127 complete_all(&mh->res_ready);
130 return mh;
133 complete_all(&mh->res_ready);
135 mlx5e_mod_hdr_detach(mdev, tbl, mh);
141 struct mlx5e_mod_hdr_handle *mh)
143 if (!refcount_dec_and_mutex_lock(&mh->refcnt, &tbl->lock))
145 hash_del(&mh->mod_hdr_hlist);
148 if (mh->compl_result > 0)
149 mlx5_modify_header_dealloc(mdev, mh->modify_hdr);
151 kfree(mh);
154 struct mlx5_modify_hdr *mlx5e_mod_hdr_get(struct mlx5e_mod_hdr_handle *mh)
156 return mh->modify_hdr;