Lines Matching full:token

2 /* Multipath TCP token management
48 static struct token_bucket *token_bucket(u32 token) in token_bucket() argument
50 return &token_hash[token & token_mask]; in token_bucket()
55 __token_lookup_req(struct token_bucket *t, u32 token) in __token_lookup_req() argument
61 if (req->token == token) in __token_lookup_req()
68 __token_lookup_msk(struct token_bucket *t, u32 token) in __token_lookup_msk() argument
74 if (mptcp_sk(sk)->token == token) in __token_lookup_msk()
79 static bool __token_bucket_busy(struct token_bucket *t, u32 token) in __token_bucket_busy() argument
81 return !token || t->chain_len >= TOKEN_MAX_CHAIN_LEN || in __token_bucket_busy()
82 __token_lookup_req(t, token) || __token_lookup_msk(t, token); in __token_bucket_busy()
85 static void mptcp_crypto_key_gen_sha(u64 *key, u32 *token, u64 *idsn) in mptcp_crypto_key_gen_sha() argument
94 mptcp_crypto_key_sha(*key, token, idsn); in mptcp_crypto_key_gen_sha()
98 * mptcp_token_new_request - create new key/idsn/token for subflow_request
103 * It creates a unique token to identify the new mptcp connection,
112 u32 token; in mptcp_token_new_request() local
115 &subflow_req->token, in mptcp_token_new_request()
117 pr_debug("req=%p local_key=%llu, token=%u, idsn=%llu\n", in mptcp_token_new_request()
118 req, subflow_req->local_key, subflow_req->token, in mptcp_token_new_request()
121 token = subflow_req->token; in mptcp_token_new_request()
122 bucket = token_bucket(token); in mptcp_token_new_request()
124 if (__token_bucket_busy(bucket, token)) { in mptcp_token_new_request()
136 * mptcp_token_new_connect - create new key/idsn/token for subflow
142 * It creates a unique token to identify the new mptcp connection,
146 * the computed token at a later time, this is needed to process
159 mptcp_crypto_key_gen_sha(&subflow->local_key, &subflow->token, in mptcp_token_new_connect()
162 bucket = token_bucket(subflow->token); in mptcp_token_new_connect()
164 if (__token_bucket_busy(bucket, subflow->token)) { in mptcp_token_new_connect()
171 pr_debug("ssk=%p, local_key=%llu, token=%u, idsn=%llu\n", in mptcp_token_new_connect()
172 sk, subflow->local_key, subflow->token, subflow->idsn); in mptcp_token_new_connect()
174 WRITE_ONCE(msk->token, subflow->token); in mptcp_token_new_connect()
182 * mptcp_token_accept - replace a req sk with full sock in token hash
195 bucket = token_bucket(req->token); in mptcp_token_accept()
198 /* pedantic lookup check for the moved token */ in mptcp_token_accept()
199 pos = __token_lookup_req(bucket, req->token); in mptcp_token_accept()
206 bool mptcp_token_exists(u32 token) in mptcp_token_exists() argument
214 bucket = token_bucket(token); in mptcp_token_exists()
219 if (READ_ONCE(msk->token) == token) in mptcp_token_exists()
222 if (get_nulls_value(pos) != (token & token_mask)) in mptcp_token_exists()
233 * mptcp_token_get_sock - retrieve mptcp connection sock using its token
235 * @token: token of the mptcp connection to retrieve
237 * This function returns the mptcp connection structure with the given token.
240 * returns NULL if no connection with the given token value exists.
242 struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) in mptcp_token_get_sock() argument
250 bucket = token_bucket(token); in mptcp_token_get_sock()
255 if (READ_ONCE(msk->token) != token || in mptcp_token_get_sock()
262 if (READ_ONCE(msk->token) != token || in mptcp_token_get_sock()
269 if (get_nulls_value(pos) != (token & token_mask)) in mptcp_token_get_sock()
282 * mptcp_token_iter_next - iterate over the token container from given pos
288 * token container starting from the specified position, or NULL.
341 * mptcp_token_destroy_request - remove mptcp connection/token
342 * @req: mptcp request socket dropping the token
344 * Remove the token associated to @req.
355 bucket = token_bucket(subflow_req->token); in mptcp_token_destroy_request()
357 pos = __token_lookup_req(bucket, subflow_req->token); in mptcp_token_destroy_request()
366 * mptcp_token_destroy - remove mptcp connection/token
367 * @msk: mptcp connection dropping the token
369 * Remove the token associated to @msk
379 bucket = token_bucket(msk->token); in mptcp_token_destroy()
381 pos = __token_lookup_msk(bucket, msk->token); in mptcp_token_destroy()
387 WRITE_ONCE(msk->token, 0); in mptcp_token_destroy()
394 token_hash = alloc_large_system_hash("MPTCP token", in mptcp_token_init()