mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
mptcp: drop unneeded checks
After the previous patch subflow->conn is always != NULL and
is never changed. We can drop a bunch of now unneeded checks.
v1 -> v2:
- rebased on top of commit 2398e3991b
("mptcp: always
include dack if possible.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
58b0991962
commit
dc093db5cc
2 changed files with 9 additions and 23 deletions
|
@ -336,7 +336,6 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
|
||||||
unsigned int ack_size;
|
unsigned int ack_size;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
bool can_ack;
|
bool can_ack;
|
||||||
u64 ack_seq;
|
|
||||||
u8 tcp_fin;
|
u8 tcp_fin;
|
||||||
|
|
||||||
if (skb) {
|
if (skb) {
|
||||||
|
@ -368,16 +367,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
|
||||||
can_ack = true;
|
can_ack = true;
|
||||||
opts->ext_copy.use_ack = 0;
|
opts->ext_copy.use_ack = 0;
|
||||||
msk = mptcp_sk(subflow->conn);
|
msk = mptcp_sk(subflow->conn);
|
||||||
if (likely(msk && READ_ONCE(msk->can_ack))) {
|
if (!READ_ONCE(msk->can_ack)) {
|
||||||
ack_seq = msk->ack_seq;
|
|
||||||
} else if (subflow->can_ack) {
|
|
||||||
mptcp_crypto_key_sha(subflow->remote_key, NULL, &ack_seq);
|
|
||||||
ack_seq++;
|
|
||||||
} else {
|
|
||||||
can_ack = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unlikely(!can_ack)) {
|
|
||||||
*size = ALIGN(dss_size, 4);
|
*size = ALIGN(dss_size, 4);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +380,7 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
|
||||||
|
|
||||||
dss_size += ack_size;
|
dss_size += ack_size;
|
||||||
|
|
||||||
opts->ext_copy.data_ack = ack_seq;
|
opts->ext_copy.data_ack = msk->ack_seq;
|
||||||
opts->ext_copy.ack64 = 1;
|
opts->ext_copy.ack64 = 1;
|
||||||
opts->ext_copy.use_ack = 1;
|
opts->ext_copy.use_ack = 1;
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
|
||||||
|
|
||||||
subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
|
subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);
|
||||||
|
|
||||||
if (subflow->conn && !subflow->conn_finished) {
|
if (!subflow->conn_finished) {
|
||||||
pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
|
pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
|
||||||
subflow->remote_key);
|
subflow->remote_key);
|
||||||
mptcp_finish_connect(sk);
|
mptcp_finish_connect(sk);
|
||||||
|
@ -439,9 +439,6 @@ static bool subflow_check_data_avail(struct sock *ssk)
|
||||||
if (subflow->data_avail)
|
if (subflow->data_avail)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!subflow->conn)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
msk = mptcp_sk(subflow->conn);
|
msk = mptcp_sk(subflow->conn);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
u32 map_remaining;
|
u32 map_remaining;
|
||||||
|
@ -561,11 +558,10 @@ static void subflow_data_ready(struct sock *sk)
|
||||||
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
|
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
|
||||||
struct sock *parent = subflow->conn;
|
struct sock *parent = subflow->conn;
|
||||||
|
|
||||||
if (!parent || !subflow->mp_capable) {
|
if (!subflow->mp_capable) {
|
||||||
subflow->tcp_data_ready(sk);
|
subflow->tcp_data_ready(sk);
|
||||||
|
|
||||||
if (parent)
|
parent->sk_data_ready(parent);
|
||||||
parent->sk_data_ready(parent);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +575,7 @@ static void subflow_write_space(struct sock *sk)
|
||||||
struct sock *parent = subflow->conn;
|
struct sock *parent = subflow->conn;
|
||||||
|
|
||||||
sk_stream_write_space(sk);
|
sk_stream_write_space(sk);
|
||||||
if (parent && sk_stream_is_writeable(sk)) {
|
if (sk_stream_is_writeable(sk)) {
|
||||||
set_bit(MPTCP_SEND_SPACE, &mptcp_sk(parent)->flags);
|
set_bit(MPTCP_SEND_SPACE, &mptcp_sk(parent)->flags);
|
||||||
smp_mb__after_atomic();
|
smp_mb__after_atomic();
|
||||||
/* set SEND_SPACE before sk_stream_write_space clears NOSPACE */
|
/* set SEND_SPACE before sk_stream_write_space clears NOSPACE */
|
||||||
|
@ -694,7 +690,7 @@ static bool subflow_is_done(const struct sock *sk)
|
||||||
static void subflow_state_change(struct sock *sk)
|
static void subflow_state_change(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
|
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
|
||||||
struct sock *parent = READ_ONCE(subflow->conn);
|
struct sock *parent = subflow->conn;
|
||||||
|
|
||||||
__subflow_state_change(sk);
|
__subflow_state_change(sk);
|
||||||
|
|
||||||
|
@ -702,10 +698,10 @@ static void subflow_state_change(struct sock *sk)
|
||||||
* a fin packet carrying a DSS can be unnoticed if we don't trigger
|
* a fin packet carrying a DSS can be unnoticed if we don't trigger
|
||||||
* the data available machinery here.
|
* the data available machinery here.
|
||||||
*/
|
*/
|
||||||
if (parent && subflow->mp_capable && mptcp_subflow_data_available(sk))
|
if (subflow->mp_capable && mptcp_subflow_data_available(sk))
|
||||||
mptcp_data_ready(parent, sk);
|
mptcp_data_ready(parent, sk);
|
||||||
|
|
||||||
if (parent && !(parent->sk_shutdown & RCV_SHUTDOWN) &&
|
if (!(parent->sk_shutdown & RCV_SHUTDOWN) &&
|
||||||
!subflow->rx_eof && subflow_is_done(sk)) {
|
!subflow->rx_eof && subflow_is_done(sk)) {
|
||||||
subflow->rx_eof = 1;
|
subflow->rx_eof = 1;
|
||||||
parent->sk_shutdown |= RCV_SHUTDOWN;
|
parent->sk_shutdown |= RCV_SHUTDOWN;
|
||||||
|
|
Loading…
Reference in a new issue