Lines Matching refs:token

2 /* Multipath TCP token management
49 static struct token_bucket *token_bucket(u32 token)
51 return &token_hash[token & token_mask];
56 __token_lookup_req(struct token_bucket *t, u32 token)
62 if (req->token == token)
69 __token_lookup_msk(struct token_bucket *t, u32 token)
75 if (mptcp_sk(sk)->token == token)
80 static bool __token_bucket_busy(struct token_bucket *t, u32 token)
82 return !token || t->chain_len >= TOKEN_MAX_CHAIN_LEN ||
83 __token_lookup_req(t, token) || __token_lookup_msk(t, token);
86 static void mptcp_crypto_key_gen_sha(u64 *key, u32 *token, u64 *idsn)
95 mptcp_crypto_key_sha(*key, token, idsn);
99 * mptcp_token_new_request - create new key/idsn/token for subflow_request
104 * It creates a unique token to identify the new mptcp connection,
113 u32 token;
116 &subflow_req->token,
118 pr_debug("req=%p local_key=%llu, token=%u, idsn=%llu\n",
119 req, subflow_req->local_key, subflow_req->token,
122 token = subflow_req->token;
123 bucket = token_bucket(token);
125 if (__token_bucket_busy(bucket, token)) {
137 * mptcp_token_new_connect - create new key/idsn/token for subflow
143 * It creates a unique token to identify the new mptcp connection,
147 * the computed token at a later time, this is needed to process
160 mptcp_crypto_key_gen_sha(&subflow->local_key, &subflow->token,
163 bucket = token_bucket(subflow->token);
165 if (__token_bucket_busy(bucket, subflow->token)) {
172 pr_debug("ssk=%p, local_key=%llu, token=%u, idsn=%llu\n",
173 sk, subflow->local_key, subflow->token, subflow->idsn);
175 WRITE_ONCE(msk->token, subflow->token);
183 * mptcp_token_accept - replace a req sk with full sock in token hash
196 bucket = token_bucket(req->token);
199 /* pedantic lookup check for the moved token */
200 pos = __token_lookup_req(bucket, req->token);
207 bool mptcp_token_exists(u32 token)
215 bucket = token_bucket(token);
220 if (READ_ONCE(msk->token) == token)
223 if (get_nulls_value(pos) != (token & token_mask))
234 * mptcp_token_get_sock - retrieve mptcp connection sock using its token
236 * @token: token of the mptcp connection to retrieve
238 * This function returns the mptcp connection structure with the given token.
241 * returns NULL if no connection with the given token value exists.
243 struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token)
251 bucket = token_bucket(token);
256 if (READ_ONCE(msk->token) != token ||
263 if (READ_ONCE(msk->token) != token ||
270 if (get_nulls_value(pos) != (token & token_mask))
283 * mptcp_token_iter_next - iterate over the token container from given pos
289 * token container starting from the specified position, or NULL.
342 * mptcp_token_destroy_request - remove mptcp connection/token
343 * @req: mptcp request socket dropping the token
345 * Remove the token associated to @req.
356 bucket = token_bucket(subflow_req->token);
358 pos = __token_lookup_req(bucket, subflow_req->token);
367 * mptcp_token_destroy - remove mptcp connection/token
368 * @msk: mptcp connection dropping the token
370 * Remove the token associated to @msk
380 bucket = token_bucket(msk->token);
382 pos = __token_lookup_msk(bucket, msk->token);
394 token_hash = alloc_large_system_hash("MPTCP token",