Lines Matching refs:token

2 /* Multipath TCP token management
48 static struct token_bucket *token_bucket(u32 token)
50 return &token_hash[token & token_mask];
55 __token_lookup_req(struct token_bucket *t, u32 token)
61 if (req->token == token)
68 __token_lookup_msk(struct token_bucket *t, u32 token)
74 if (mptcp_sk(sk)->token == token)
79 static bool __token_bucket_busy(struct token_bucket *t, u32 token)
81 return !token || t->chain_len >= TOKEN_MAX_CHAIN_LEN ||
82 __token_lookup_req(t, token) || __token_lookup_msk(t, token);
85 static void mptcp_crypto_key_gen_sha(u64 *key, u32 *token, u64 *idsn)
94 mptcp_crypto_key_sha(*key, token, idsn);
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;
115 &subflow_req->token,
117 pr_debug("req=%p local_key=%llu, token=%u, idsn=%llu\n",
118 req, subflow_req->local_key, subflow_req->token,
121 token = subflow_req->token;
122 bucket = token_bucket(token);
124 if (__token_bucket_busy(bucket, token)) {
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
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 ssk, subflow->local_key, subflow->token, subflow->idsn);
175 WRITE_ONCE(msk->token, subflow->token);
184 * mptcp_token_accept - replace a req sk with full sock in token hash
199 bucket = token_bucket(req->token);
202 /* pedantic lookup check for the moved token */
203 pos = __token_lookup_req(bucket, req->token);
210 bool mptcp_token_exists(u32 token)
218 bucket = token_bucket(token);
223 if (READ_ONCE(msk->token) == token)
226 if (get_nulls_value(pos) != (token & token_mask))
237 * mptcp_token_get_sock - retrieve mptcp connection sock using its token
239 * @token: token of the mptcp connection to retrieve
241 * This function returns the mptcp connection structure with the given token.
244 * returns NULL if no connection with the given token value exists.
246 struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token)
254 bucket = token_bucket(token);
259 if (READ_ONCE(msk->token) != token ||
266 if (READ_ONCE(msk->token) != token ||
273 if (get_nulls_value(pos) != (token & token_mask))
286 * mptcp_token_iter_next - iterate over the token container from given pos
292 * token container starting from the specified position, or NULL.
345 * mptcp_token_destroy_request - remove mptcp connection/token
346 * @req: mptcp request socket dropping the token
348 * Remove the token associated to @req.
359 bucket = token_bucket(subflow_req->token);
361 pos = __token_lookup_req(bucket, subflow_req->token);
370 * mptcp_token_destroy - remove mptcp connection/token
371 * @msk: mptcp connection dropping the token
373 * Remove the token associated to @msk
385 bucket = token_bucket(msk->token);
387 pos = __token_lookup_msk(bucket, msk->token);
393 WRITE_ONCE(msk->token, 0);
400 token_hash = alloc_large_system_hash("MPTCP token",