Commit c68a0cd1 authored by Jianguo Wu's avatar Jianguo Wu Committed by Jakub Kicinski

mptcp: using TOKEN_MAX_RETRIES instead of magic number

We have macro TOKEN_MAX_RETRIES for the number of token generate retries,
so using TOKEN_MAX_RETRIES in subflow_check_req().

And rename TOKEN_MAX_RETRIES to MPTCP_TOKEN_MAX_RETRIES as it is now
exposed.

Fixes: 535fb815 ("mptcp: token: move retry to caller")
Reviewed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarJianguo Wu <wujianguo@chinatelecom.cn>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 2f1af441
...@@ -627,6 +627,8 @@ static inline void mptcp_write_space(struct sock *sk) ...@@ -627,6 +627,8 @@ static inline void mptcp_write_space(struct sock *sk)
void mptcp_destroy_common(struct mptcp_sock *msk); void mptcp_destroy_common(struct mptcp_sock *msk);
#define MPTCP_TOKEN_MAX_RETRIES 4
void __init mptcp_token_init(void); void __init mptcp_token_init(void);
static inline void mptcp_token_init_request(struct request_sock *req) static inline void mptcp_token_init_request(struct request_sock *req)
{ {
......
...@@ -162,7 +162,7 @@ static int subflow_check_req(struct request_sock *req, ...@@ -162,7 +162,7 @@ static int subflow_check_req(struct request_sock *req,
} }
if (mp_opt.mp_capable && listener->request_mptcp) { if (mp_opt.mp_capable && listener->request_mptcp) {
int err, retries = 4; int err, retries = MPTCP_TOKEN_MAX_RETRIES;
subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq; subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
again: again:
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <net/mptcp.h> #include <net/mptcp.h>
#include "protocol.h" #include "protocol.h"
#define TOKEN_MAX_RETRIES 4
#define TOKEN_MAX_CHAIN_LEN 4 #define TOKEN_MAX_CHAIN_LEN 4
struct token_bucket { struct token_bucket {
...@@ -153,7 +152,7 @@ int mptcp_token_new_connect(struct sock *sk) ...@@ -153,7 +152,7 @@ int mptcp_token_new_connect(struct sock *sk)
{ {
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn); struct mptcp_sock *msk = mptcp_sk(subflow->conn);
int retries = TOKEN_MAX_RETRIES; int retries = MPTCP_TOKEN_MAX_RETRIES;
struct token_bucket *bucket; struct token_bucket *bucket;
again: again:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment