Commit bfae9dae authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

mptcp: remove mptcp_read_actor

Only used to discard stale data from the subflow, so move
it where needed.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 600911ff
...@@ -430,33 +430,6 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) ...@@ -430,33 +430,6 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
return ret; return ret;
} }
int mptcp_read_actor(read_descriptor_t *desc, struct sk_buff *skb,
unsigned int offset, size_t len)
{
struct mptcp_read_arg *arg = desc->arg.data;
size_t copy_len;
copy_len = min(desc->count, len);
if (likely(arg->msg)) {
int err;
err = skb_copy_datagram_msg(skb, offset, arg->msg, copy_len);
if (err) {
pr_debug("error path");
desc->error = err;
return err;
}
} else {
pr_debug("Flushing skb payload");
}
desc->count -= copy_len;
pr_debug("consumed %zu bytes, %zu left", copy_len, desc->count);
return copy_len;
}
static void mptcp_wait_data(struct sock *sk, long *timeo) static void mptcp_wait_data(struct sock *sk, long *timeo)
{ {
DEFINE_WAIT_FUNC(wait, woken_wake_function); DEFINE_WAIT_FUNC(wait, woken_wake_function);
......
...@@ -191,13 +191,6 @@ void mptcp_proto_init(void); ...@@ -191,13 +191,6 @@ void mptcp_proto_init(void);
int mptcp_proto_v6_init(void); int mptcp_proto_v6_init(void);
#endif #endif
struct mptcp_read_arg {
struct msghdr *msg;
};
int mptcp_read_actor(read_descriptor_t *desc, struct sk_buff *skb,
unsigned int offset, size_t len);
void mptcp_get_options(const struct sk_buff *skb, void mptcp_get_options(const struct sk_buff *skb,
struct tcp_options_received *opt_rx); struct tcp_options_received *opt_rx);
......
...@@ -408,6 +408,18 @@ static enum mapping_status get_mapping_status(struct sock *ssk) ...@@ -408,6 +408,18 @@ static enum mapping_status get_mapping_status(struct sock *ssk)
return MAPPING_OK; return MAPPING_OK;
} }
static int subflow_read_actor(read_descriptor_t *desc,
struct sk_buff *skb,
unsigned int offset, size_t len)
{
size_t copy_len = min(desc->count, len);
desc->count -= copy_len;
pr_debug("flushed %zu bytes, %zu left", copy_len, desc->count);
return copy_len;
}
static bool subflow_check_data_avail(struct sock *ssk) static bool subflow_check_data_avail(struct sock *ssk)
{ {
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
...@@ -482,16 +494,12 @@ static bool subflow_check_data_avail(struct sock *ssk) ...@@ -482,16 +494,12 @@ static bool subflow_check_data_avail(struct sock *ssk)
pr_debug("discarding %zu bytes, current map len=%d", delta, pr_debug("discarding %zu bytes, current map len=%d", delta,
map_remaining); map_remaining);
if (delta) { if (delta) {
struct mptcp_read_arg arg = {
.msg = NULL,
};
read_descriptor_t desc = { read_descriptor_t desc = {
.count = delta, .count = delta,
.arg.data = &arg,
}; };
int ret; int ret;
ret = tcp_read_sock(ssk, &desc, mptcp_read_actor); ret = tcp_read_sock(ssk, &desc, subflow_read_actor);
if (ret < 0) { if (ret < 0) {
ssk->sk_err = -ret; ssk->sk_err = -ret;
goto fatal; goto fatal;
......
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