Commit f6c2ef59 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

mptcp: optimize the input options processing

Most MPTCP packets carries a single MPTCP subption: the
DSS containing the mapping for the current packet.

Check explicitly for the above, so that is such scenario we
replace most conditional statements with a single likely() one.
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 74c7dfbe
...@@ -1111,13 +1111,15 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) ...@@ -1111,13 +1111,15 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) if (!check_fully_established(msk, sk, subflow, skb, &mp_opt))
return sk->sk_state != TCP_CLOSE; return sk->sk_state != TCP_CLOSE;
if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) {
if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) &&
msk->local_key == mp_opt.rcvr_key) { msk->local_key == mp_opt.rcvr_key) {
WRITE_ONCE(msk->rcv_fastclose, true); WRITE_ONCE(msk->rcv_fastclose, true);
mptcp_schedule_work((struct sock *)msk); mptcp_schedule_work((struct sock *)msk);
} }
if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) && add_addr_hmac_valid(msk, &mp_opt)) { if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) &&
add_addr_hmac_valid(msk, &mp_opt)) {
if (!mp_opt.echo) { if (!mp_opt.echo) {
mptcp_pm_add_addr_received(msk, &mp_opt.addr); mptcp_pm_add_addr_received(msk, &mp_opt.addr);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDR); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDR);
...@@ -1152,6 +1154,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) ...@@ -1152,6 +1154,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
if (!(mp_opt.suboptions & OPTION_MPTCP_DSS)) if (!(mp_opt.suboptions & OPTION_MPTCP_DSS))
return true; return true;
}
/* we can't wait for recvmsg() to update the ack_seq, otherwise /* we can't wait for recvmsg() to update the ack_seq, otherwise
* monodirectional flows will stuck * monodirectional flows will stuck
...@@ -1179,7 +1182,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) ...@@ -1179,7 +1182,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
memset(mpext, 0, sizeof(*mpext)); memset(mpext, 0, sizeof(*mpext));
if (mp_opt.use_map) { if (likely(mp_opt.use_map)) {
if (mp_opt.mpc_map) { if (mp_opt.mpc_map) {
/* this is an MP_CAPABLE carrying MPTCP data /* this is an MP_CAPABLE carrying MPTCP data
* we know this map the first chunk of data * we know this map the first chunk of data
......
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