mptcp: using TOKEN_MAX_RETRIES instead of magic number
Subsystems (2)
PATCH 1/1 mptcp: using TOKEN_MAX_RETRIES instead of magic number
From: Jianguo Wu <[email protected]>
We have macro TOKEN_MAX_RETRIES for the number of token generate retries, so using TOKEN_MAX_RETRIES in subflow_check_req().
--- net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 2 +- net/mptcp/token.c | 1 - 3 files changed, 3 insertions(+), 2 deletions(-)
net/mptcp/protocol.h +2 -0
@@ -14,6 +14,8 @@#define MPTCP_SUPPORTED_VERSION 1 +#define TOKEN_MAX_RETRIES 4 +/* MPTCP option bits */ #define OPTION_MPTCP_MPC_SYN BIT(0)#define OPTION_MPTCP_MPC_SYNACK BIT(1)
net/mptcp/subflow.c +1 -1
@@ -162,7 +162,7 @@ static int subflow_check_req(struct request_sock *req, }if (mp_opt.mp_capable && listener->request_mptcp) { -int err, retries =4 ; +int err, retries =TOKEN_MAX_RETRIES ; subflow_req->ssn_offset =TCP_SKB_CB (skb)->seq; again:
net/mptcp/token.c +0 -1
@@ -33,7 +33,6 @@#include <net/mptcp.h> #include "protocol.h" -#define TOKEN_MAX_RETRIES 4#define TOKEN_MAX_CHAIN_LEN 4struct token_bucket {
Signature · 1 line
1.8.3.1
Hi Jianguo,
Thank you for the patch!
Quoted 18 lines · Jianguo Wu
From: Jianguo Wu <[email protected]>
We have macro
TOKEN_MAX_RETRIESfor the number of token generate retries, so usingTOKEN_MAX_RETRIESinsubflow_check_req().Fixes 535fb8152f31 ("mptcp: token: move retry to caller")Signed-off-by Jianguo Wu <[email protected]>--- net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 2 +- net/mptcp/token.c | 1 - 3 files changed, 3 insertions(+), 2 deletions(-)net/mptcp/protocol.h +0
-0
net/mptcp/protocol.h line 17
Quoted 4 lines
net/mptcp/protocol.h +1
-0@@ -14,6 +14,8 @@#define MPTCP_SUPPORTED_VERSION 1 +#define TOKEN_MAX_RETRIES 4
Now that this is "exposed" in a header file, probably best to rename it to add "MPTCP_" suffix like (most of) the others here.
Also maybe best to declare it around where the token related functions are declared, no? In other words, just before mptcp_token_init().
Or after the other "#define" we have here but it looks strange to put this at before them.
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net
Quoted 31 lines · Matthieu Baerts
Hi Jianguo,
Thank you for the patch!
Quoted 18 lines · Jianguo Wu
From: Jianguo Wu <[email protected]>
We have macro
TOKEN_MAX_RETRIESfor the number of token generate retries, so usingTOKEN_MAX_RETRIESinsubflow_check_req().Fixes 535fb8152f31 ("mptcp: token: move retry to caller")Signed-off-by Jianguo Wu <[email protected]>--- net/mptcp/protocol.h | 2 ++ net/mptcp/subflow.c | 2 +- net/mptcp/token.c | 1 - 3 files changed, 3 insertions(+), 2 deletions(-)net/mptcp/protocol.h +0
-0net/mptcp/protocol.h line 17
Quoted 4 lines
net/mptcp/protocol.h +1
-0@@ -14,6 +14,8 @@#define MPTCP_SUPPORTED_VERSION 1 +#define TOKEN_MAX_RETRIES 4Now that this is "exposed" in a header file, probably best to rename it to add "
MPTCP_" suffix like (most of) the others here.
Quoted 6 lines
Also maybe best to declare it around where the token related functions are declared, no? In other words, just before
mptcp_token_init().Or after the other "#define" we have here but it looks strange to put this at before them.
Hi Matt, I will send v2 as your suggestion, Thanks!
Quoted 3 lines
Cheers,
Matt