Skip to content

Commit f0e6a4c

Browse files
Paolo Abenikuba-moo
authored andcommitted
mptcp: add accounting for pending data
Preparation patch to track the data pending in the msk write queue. No functional change introduced here Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent caf971d commit f0e6a4c

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

net/mptcp/protocol.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,6 +1859,7 @@ static int __mptcp_init_sock(struct sock *sk)
18591859
__set_bit(MPTCP_SEND_SPACE, &msk->flags);
18601860
INIT_WORK(&msk->work, mptcp_worker);
18611861
msk->out_of_order_queue = RB_ROOT;
1862+
msk->first_pending = NULL;
18621863

18631864
msk->first = NULL;
18641865
inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;

net/mptcp/protocol.h

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,10 @@ struct mptcp_pm_data {
187187
struct mptcp_data_frag {
188188
struct list_head list;
189189
u64 data_seq;
190-
int data_len;
191-
int offset;
192-
int overhead;
190+
u16 data_len;
191+
u16 offset;
192+
u16 overhead;
193+
u16 already_sent;
193194
struct page *page;
194195
};
195196

@@ -219,6 +220,7 @@ struct mptcp_sock {
219220
struct rb_root out_of_order_queue;
220221
struct list_head conn_list;
221222
struct list_head rtx_queue;
223+
struct mptcp_data_frag *first_pending;
222224
struct list_head join_list;
223225
struct skb_ext *cached_ext; /* for the next sendmsg */
224226
struct socket *subflow; /* outgoing connect/listener/!mp_capable */
@@ -240,6 +242,36 @@ static inline struct mptcp_sock *mptcp_sk(const struct sock *sk)
240242
return (struct mptcp_sock *)sk;
241243
}
242244

245+
static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk)
246+
{
247+
const struct mptcp_sock *msk = mptcp_sk(sk);
248+
249+
return READ_ONCE(msk->first_pending);
250+
}
251+
252+
static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk)
253+
{
254+
struct mptcp_sock *msk = mptcp_sk(sk);
255+
struct mptcp_data_frag *cur;
256+
257+
cur = msk->first_pending;
258+
return list_is_last(&cur->list, &msk->rtx_queue) ? NULL :
259+
list_next_entry(cur, list);
260+
}
261+
262+
static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk)
263+
{
264+
struct mptcp_sock *msk = mptcp_sk(sk);
265+
266+
if (!msk->first_pending)
267+
return NULL;
268+
269+
if (WARN_ON_ONCE(list_empty(&msk->rtx_queue)))
270+
return NULL;
271+
272+
return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
273+
}
274+
243275
static inline struct mptcp_data_frag *mptcp_rtx_tail(const struct sock *sk)
244276
{
245277
struct mptcp_sock *msk = mptcp_sk(sk);

0 commit comments

Comments
 (0)