Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: Cleanup
Browse files Browse the repository at this point in the history
Just some basic cleanup, fixing some comments, renaming sk to
meta_sk, and moving mptcp_finish_handshake out of mptcp_ipv4.c to
mptcp_ctrl.c

Signed-off-by: Christoph Paasch <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
cpaasch authored and matttbe committed May 2, 2018
1 parent 1b6a791 commit 1b95146
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 40 deletions.
8 changes: 4 additions & 4 deletions include/net/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,10 @@ extern int sysctl_mptcp_syn_retries;

extern struct workqueue_struct *mptcp_wq;

#define mptcp_debug(fmt, args...) \
do { \
if (unlikely(sysctl_mptcp_debug)) \
pr_err(fmt, ##args); \
#define mptcp_debug(fmt, args...) \
do { \
if (unlikely(sysctl_mptcp_debug)) \
pr_err(fmt, ##args); \
} while (0)

/* Iterates over all subflows */
Expand Down
25 changes: 21 additions & 4 deletions net/mptcp/mptcp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@ void mptcp_fallback_meta_sk(struct sock *meta_sk)
int mptcp_add_sock(struct sock *meta_sk, struct sock *sk, u8 loc_id, u8 rem_id,
gfp_t flags)
{
struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb;
struct tcp_sock *tp = tcp_sk(sk);
struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb;
struct tcp_sock *tp = tcp_sk(sk);

tp->mptcp = kmem_cache_zalloc(mptcp_sock_cache, flags);
if (!tp->mptcp)
Expand Down Expand Up @@ -2122,9 +2122,9 @@ struct sock *mptcp_check_req_child(struct sock *meta_sk,
struct sk_buff *skb,
const struct mptcp_options_received *mopt)
{
struct tcp_sock *child_tp = tcp_sk(child);
const struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb;
struct mptcp_request_sock *mtreq = mptcp_rsk(req);
struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb;
struct tcp_sock *child_tp = tcp_sk(child);
u8 hash_mac_check[20];

child_tp->inside_tk_table = 0;
Expand Down Expand Up @@ -2490,6 +2490,23 @@ int mptcp_conn_request(struct sock *sk, struct sk_buff *skb)
return 0;
}

int mptcp_finish_handshake(struct sock *child, struct sk_buff *skb)
__releases(&child->sk_lock.slock)
{
int ret;

/* We don't call tcp_child_process here, because we hold
* already the meta-sk-lock and are sure that it is not owned
* by the user.
*/
tcp_sk(child)->segs_in += max_t(u16, 1, skb_shinfo(skb)->gso_segs);
ret = tcp_rcv_state_process(child, skb);
bh_unlock_sock(child);
sock_put(child);

return ret;
}

static void __mptcp_get_info(const struct sock *meta_sk,
struct mptcp_meta_info *info)
{
Expand Down
2 changes: 1 addition & 1 deletion net/mptcp/mptcp_fullmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct fullmesh_priv {
u8 rem4_bits;
u8 rem6_bits;

/* Are we established the additional subflows for primary pair? */
/* Have we established the additional subflows for primary pair? */
u8 first_pair:1;
};

Expand Down
7 changes: 2 additions & 5 deletions net/mptcp/mptcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ static inline int mptcp_tso_acked_reinject(const struct sock *meta_sk,
return packets_acked;
}

/**
* Cleans the meta-socket retransmission queue and the reinject-queue.
* @sk must be the metasocket.
*/
/* Cleans the meta-socket retransmission queue and the reinject-queue. */
static void mptcp_clean_rtx_queue(struct sock *meta_sk, u32 prior_snd_una)
{
struct sk_buff *skb, *tmp, *next;
Expand Down Expand Up @@ -350,7 +347,7 @@ static int mptcp_verif_dss_csum(struct sock *sk)

/* Now, checksum must be 0 */
if (unlikely(csum_fold(csum_tcp))) {
pr_err("%s csum is wrong: %#x data_seq %u dss_csum_added %d overflowed %d iterations %d\n",
pr_err("%s csum is wrong: %#x tcp-seq %u dss_csum_added %d overflowed %d iterations %d\n",
__func__, csum_fold(csum_tcp), TCP_SKB_CB(last)->seq,
dss_csum_added, overflowed, iter);

Expand Down
26 changes: 4 additions & 22 deletions net/mptcp/mptcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ static u32 mptcp_v4_cookie_init_seq(struct request_sock *req, const struct sock
}
#endif

static int mptcp_v4_join_init_req(struct request_sock *req, const struct sock *sk,
static int mptcp_v4_join_init_req(struct request_sock *req, const struct sock *meta_sk,
struct sk_buff *skb, bool want_cookie)
{
struct mptcp_request_sock *mtreq = mptcp_rsk(req);
const struct mptcp_cb *mpcb = tcp_sk(sk)->mpcb;
const struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb;
union inet_addr addr;
int loc_id;
bool low_prio = false;
Expand All @@ -112,14 +112,14 @@ static int mptcp_v4_join_init_req(struct request_sock *req, const struct sock *s
*/
mtreq->hash_entry.pprev = NULL;

tcp_request_sock_ipv4_ops.init_req(req, sk, skb, want_cookie);
tcp_request_sock_ipv4_ops.init_req(req, meta_sk, skb, want_cookie);

mtreq->mptcp_loc_nonce = mptcp_v4_get_nonce(ip_hdr(skb)->saddr,
ip_hdr(skb)->daddr,
tcp_hdr(skb)->source,
tcp_hdr(skb)->dest);
addr.ip = inet_rsk(req)->ir_loc_addr;
loc_id = mpcb->pm_ops->get_local_id(AF_INET, &addr, sock_net(sk), &low_prio);
loc_id = mpcb->pm_ops->get_local_id(AF_INET, &addr, sock_net(meta_sk), &low_prio);
if (loc_id == -1)
return -1;
mtreq->loc_id = loc_id;
Expand Down Expand Up @@ -149,24 +149,6 @@ static int mptcp_v4_join_request(struct sock *meta_sk, struct sk_buff *skb)
meta_sk, skb);
}

int mptcp_finish_handshake(struct sock *child, struct sk_buff *skb)
__releases(&child->sk_lock.slock)
{
int ret;

/* We don't call tcp_child_process here, because we hold
* already the meta-sk-lock and are sure that it is not owned
* by the user.
*/
tcp_sk(child)->segs_in += max_t(u16, 1, skb_shinfo(skb)->gso_segs);
ret = tcp_rcv_state_process(child, skb);
bh_unlock_sock(child);
sock_put(child);

return ret;
}


/* Similar to: tcp_v4_do_rcv
* We only process join requests here. (either the SYN or the final ACK)
*/
Expand Down
8 changes: 4 additions & 4 deletions net/mptcp/mptcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ static u32 mptcp_v6_cookie_init_seq(struct request_sock *req, const struct sock
}
#endif

static int mptcp_v6_join_init_req(struct request_sock *req, const struct sock *sk,
static int mptcp_v6_join_init_req(struct request_sock *req, const struct sock *meta_sk,
struct sk_buff *skb, bool want_cookie)
{
struct mptcp_request_sock *mtreq = mptcp_rsk(req);
const struct mptcp_cb *mpcb = tcp_sk(sk)->mpcb;
const struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb;
union inet_addr addr;
int loc_id;
bool low_prio = false;
Expand All @@ -141,14 +141,14 @@ static int mptcp_v6_join_init_req(struct request_sock *req, const struct sock *s
*/
mtreq->hash_entry.pprev = NULL;

tcp_request_sock_ipv6_ops.init_req(req, sk, skb, want_cookie);
tcp_request_sock_ipv6_ops.init_req(req, meta_sk, skb, want_cookie);

mtreq->mptcp_loc_nonce = mptcp_v6_get_nonce(ipv6_hdr(skb)->saddr.s6_addr32,
ipv6_hdr(skb)->daddr.s6_addr32,
tcp_hdr(skb)->source,
tcp_hdr(skb)->dest);
addr.in6 = inet_rsk(req)->ir_v6_loc_addr;
loc_id = mpcb->pm_ops->get_local_id(AF_INET6, &addr, sock_net(sk), &low_prio);
loc_id = mpcb->pm_ops->get_local_id(AF_INET6, &addr, sock_net(meta_sk), &low_prio);
if (loc_id == -1)
return -1;
mtreq->loc_id = loc_id;
Expand Down

0 comments on commit 1b95146

Please sign in to comment.