Skip to content

Commit

Permalink
mptcp: using TOKEN_MAX_RETRIES instead of magic number
Browse files Browse the repository at this point in the history
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: 535fb81 ("mptcp: token: move retry to caller")
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
  • Loading branch information
Jianguo Wu authored and matttbe committed Apr 22, 2021
1 parent a0f3267 commit 0d6192a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions net/mptcp/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,8 @@ static inline void mptcp_write_space(struct sock *sk)

void mptcp_destroy_common(struct mptcp_sock *msk);

#define MPTCP_TOKEN_MAX_RETRIES 4

void __init mptcp_token_init(void);
static inline void mptcp_token_init_request(struct request_sock *req)
{
Expand Down
2 changes: 1 addition & 1 deletion net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = MPTCP_TOKEN_MAX_RETRIES;

subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
again:
Expand Down
3 changes: 1 addition & 2 deletions net/mptcp/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <net/mptcp.h>
#include "protocol.h"

#define TOKEN_MAX_RETRIES 4
#define TOKEN_MAX_CHAIN_LEN 4

struct token_bucket {
Expand Down Expand Up @@ -153,7 +152,7 @@ int mptcp_token_new_connect(struct sock *sk)
{
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
int retries = TOKEN_MAX_RETRIES;
int retries = MPTCP_TOKEN_MAX_RETRIES;
struct token_bucket *bucket;

again:
Expand Down

0 comments on commit 0d6192a

Please sign in to comment.