Lines Matching full:req
67 static bool handshake_req_hash_add(struct handshake_req *req) in handshake_req_hash_add() argument
72 &req->hr_rhash, in handshake_req_hash_add()
77 static void handshake_req_destroy(struct handshake_req *req) in handshake_req_destroy() argument
79 if (req->hr_proto->hp_destroy) in handshake_req_destroy()
80 req->hr_proto->hp_destroy(req); in handshake_req_destroy()
81 rhashtable_remove_fast(&handshake_rhashtbl, &req->hr_rhash, in handshake_req_destroy()
83 kfree(req); in handshake_req_destroy()
89 struct handshake_req *req; in handshake_sk_destruct() local
91 req = handshake_req_hash_lookup(sk); in handshake_sk_destruct()
92 if (!req) in handshake_sk_destruct()
95 trace_handshake_destruct(sock_net(sk), req, sk); in handshake_sk_destruct()
96 sk_destruct = req->hr_odestruct; in handshake_sk_destruct()
97 handshake_req_destroy(req); in handshake_sk_destruct()
112 struct handshake_req *req; in handshake_req_alloc() local
123 req = kzalloc(struct_size(req, hr_priv, proto->hp_privsize), flags); in handshake_req_alloc()
124 if (!req) in handshake_req_alloc()
127 INIT_LIST_HEAD(&req->hr_list); in handshake_req_alloc()
128 req->hr_proto = proto; in handshake_req_alloc()
129 return req; in handshake_req_alloc()
135 * @req: handshake arguments
138 void *handshake_req_private(struct handshake_req *req) in handshake_req_private() argument
140 return (void *)&req->hr_priv; in handshake_req_private()
145 struct handshake_req *req) in __add_pending_locked() argument
147 if (WARN_ON_ONCE(!list_empty(&req->hr_list))) in __add_pending_locked()
150 list_add_tail(&req->hr_list, &hn->hn_requests); in __add_pending_locked()
155 struct handshake_req *req) in __remove_pending_locked() argument
158 list_del_init(&req->hr_list); in __remove_pending_locked()
165 * If @req was on a pending list, it has not yet been accepted.
167 static bool remove_pending(struct handshake_net *hn, struct handshake_req *req) in remove_pending() argument
172 if (!list_empty(&req->hr_list)) { in remove_pending()
173 __remove_pending_locked(hn, req); in remove_pending()
183 struct handshake_req *req, *pos; in handshake_req_next() local
185 req = NULL; in handshake_req_next()
191 req = pos; in handshake_req_next()
196 return req; in handshake_req_next()
203 * @req: handshake arguments
220 * no completion callback will be done and that @req has been
223 int handshake_req_submit(struct socket *sock, struct handshake_req *req, in handshake_req_submit() argument
230 if (!sock || !req || !sock->file) { in handshake_req_submit()
231 kfree(req); in handshake_req_submit()
235 req->hr_sk = sock->sk; in handshake_req_submit()
236 if (!req->hr_sk) { in handshake_req_submit()
237 kfree(req); in handshake_req_submit()
240 req->hr_odestruct = req->hr_sk->sk_destruct; in handshake_req_submit()
241 req->hr_sk->sk_destruct = handshake_sk_destruct; in handshake_req_submit()
244 net = sock_net(req->hr_sk); in handshake_req_submit()
258 if (!handshake_req_hash_add(req)) in handshake_req_submit()
260 if (!__add_pending_locked(hn, req)) in handshake_req_submit()
264 ret = handshake_genl_notify(net, req->hr_proto, flags); in handshake_req_submit()
266 trace_handshake_notify_err(net, req, req->hr_sk, ret); in handshake_req_submit()
267 if (remove_pending(hn, req)) in handshake_req_submit()
272 sock_hold(req->hr_sk); in handshake_req_submit()
274 trace_handshake_submit(net, req, req->hr_sk); in handshake_req_submit()
280 trace_handshake_submit_err(net, req, req->hr_sk, ret); in handshake_req_submit()
281 handshake_req_destroy(req); in handshake_req_submit()
286 void handshake_complete(struct handshake_req *req, unsigned int status, in handshake_complete() argument
289 struct sock *sk = req->hr_sk; in handshake_complete()
292 if (!test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED, &req->hr_flags)) { in handshake_complete()
293 trace_handshake_complete(net, req, sk, status); in handshake_complete()
294 req->hr_proto->hp_done(req, status, info); in handshake_complete()
315 struct handshake_req *req; in handshake_req_cancel() local
320 req = handshake_req_hash_lookup(sk); in handshake_req_cancel()
321 if (!req) { in handshake_req_cancel()
322 trace_handshake_cancel_none(net, req, sk); in handshake_req_cancel()
327 if (hn && remove_pending(hn, req)) { in handshake_req_cancel()
331 if (test_and_set_bit(HANDSHAKE_F_REQ_COMPLETED, &req->hr_flags)) { in handshake_req_cancel()
333 trace_handshake_cancel_busy(net, req, sk); in handshake_req_cancel()
338 trace_handshake_cancel(net, req, sk); in handshake_req_cancel()