mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
mptcp: introduce the mptcp_init_skb helper
Factor out all the skb initialization step in a new helper and use it. Note that this change moves the MPTCP CB initialization earlier: we can do such step as soon as the skb leaves the subflow socket receive queues. Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Geliang Tang <geliang@kernel.org> Tested-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20250927-net-next-mptcp-rcv-path-imp-v1-4-5da266aa9c1a@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
e118cdc34d
commit
9a0afe0db4
|
|
@ -326,27 +326,11 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
|
|||
mptcp_rcvbuf_grow(sk);
|
||||
}
|
||||
|
||||
static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
|
||||
struct sk_buff *skb, unsigned int offset,
|
||||
size_t copy_len)
|
||||
static void mptcp_init_skb(struct sock *ssk, struct sk_buff *skb, int offset,
|
||||
int copy_len)
|
||||
{
|
||||
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
|
||||
struct sock *sk = (struct sock *)msk;
|
||||
struct sk_buff *tail;
|
||||
bool has_rxtstamp;
|
||||
|
||||
__skb_unlink(skb, &ssk->sk_receive_queue);
|
||||
|
||||
skb_ext_reset(skb);
|
||||
skb_orphan(skb);
|
||||
|
||||
/* try to fetch required memory from subflow */
|
||||
if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
|
||||
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp;
|
||||
const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
|
||||
bool has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp;
|
||||
|
||||
/* the skb map_seq accounts for the skb offset:
|
||||
* mptcp_subflow_get_mapped_dsn() is based on the current tp->copied_seq
|
||||
|
|
@ -358,6 +342,24 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk,
|
|||
MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp;
|
||||
MPTCP_SKB_CB(skb)->cant_coalesce = 0;
|
||||
|
||||
__skb_unlink(skb, &ssk->sk_receive_queue);
|
||||
|
||||
skb_ext_reset(skb);
|
||||
skb_dst_drop(skb);
|
||||
}
|
||||
|
||||
static bool __mptcp_move_skb(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
u64 copy_len = MPTCP_SKB_CB(skb)->end_seq - MPTCP_SKB_CB(skb)->map_seq;
|
||||
struct mptcp_sock *msk = mptcp_sk(sk);
|
||||
struct sk_buff *tail;
|
||||
|
||||
/* try to fetch required memory from subflow */
|
||||
if (!sk_rmem_schedule(sk, skb, skb->truesize)) {
|
||||
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) {
|
||||
/* in sequence */
|
||||
msk->bytes_received += copy_len;
|
||||
|
|
@ -678,7 +680,9 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
|
|||
if (offset < skb->len) {
|
||||
size_t len = skb->len - offset;
|
||||
|
||||
ret = __mptcp_move_skb(msk, ssk, skb, offset, len) || ret;
|
||||
mptcp_init_skb(ssk, skb, offset, len);
|
||||
skb_orphan(skb);
|
||||
ret = __mptcp_move_skb(sk, skb) || ret;
|
||||
seq += len;
|
||||
|
||||
if (unlikely(map_remaining < len)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user