This patch moves the member last_snd from struct mptcp_sock to
struct mptcp_sched_data to make it accessible to bpf schedulers.
With this change, msk->last_snd should be replaced by
msk->sched_data->last_snd.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
include/net/mptcp.h | 1 +
net/mptcp/protocol.c | 14 +++++++-------
net/mptcp/protocol.h | 1 -
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 4bba29c99172..d52aeb8b4485 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -100,6 +100,7 @@ struct mptcp_out_options {
#define MPTCP_SUBFLOWS_MAX 8
struct mptcp_sched_data {
+ struct sock *last_snd;
bool reinject;
struct mptcp_subflow_context *contexts[MPTCP_SUBFLOWS_MAX];
};
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 380b7335618c..42adc14a073e 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1619,7 +1619,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags)
continue;
}
do_check_data_fin = true;
- msk->last_snd = ssk;
+ msk->sched_data->last_snd = ssk;
}
}
}
@@ -1660,7 +1660,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool
if (ret <= 0)
break;
copied += ret;
- msk->last_snd = ssk;
+ msk->sched_data->last_snd = ssk;
continue;
}
@@ -1673,7 +1673,7 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool
if (ret <= 0)
keep_pushing = false;
copied += ret;
- msk->last_snd = ssk;
+ msk->sched_data->last_snd = ssk;
}
mptcp_for_each_subflow(msk, subflow) {
@@ -2466,8 +2466,8 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
WRITE_ONCE(msk->first, NULL);
out:
- if (ssk == msk->last_snd)
- msk->last_snd = NULL;
+ if (msk->sched_data && ssk == msk->sched_data->last_snd)
+ msk->sched_data->last_snd = NULL;
if (need_push)
__mptcp_push_pending(sk, 0);
@@ -2649,7 +2649,7 @@ static void __mptcp_retrans(struct sock *sk)
release_sock(ssk);
- msk->last_snd = ssk;
+ msk->sched_data->last_snd = ssk;
}
}
@@ -3160,7 +3160,7 @@ static int mptcp_disconnect(struct sock *sk, int flags)
* subflow
*/
mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
- msk->last_snd = NULL;
+ msk->sched_data->last_snd = NULL;
WRITE_ONCE(msk->flags, 0);
msk->cb_flags = 0;
msk->push_pending = 0;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index ac05fc317689..949f46d4c710 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -269,7 +269,6 @@ struct mptcp_sock {
u64 rcv_data_fin_seq;
u64 bytes_retrans;
int rmem_fwd_alloc;
- struct sock *last_snd;
int snd_burst;
int old_wspace;
u64 recovery_snd_nxt; /* in recovery mode accept up to this seq;
--
2.35.3