protocol.c (b609c783c535493aa3fca22c7e40a120370b1ca5) protocol.c (877a72e3b66c331cc76410d70255f65ca4e51122)
1// SPDX-License-Identifier: GPL-2.0
2/* Multipath TCP
3 *
4 * Copyright (c) 2017 - 2019, Intel Corporation.
5 */
6
7#define pr_fmt(fmt) "MPTCP: " fmt
8

--- 1508 unchanged lines hidden (view full) ---

1517 if (likely(after64(snd_nxt_new, msk->snd_nxt))) {
1518 msk->bytes_sent += snd_nxt_new - msk->snd_nxt;
1519 msk->snd_nxt = snd_nxt_new;
1520 }
1521}
1522
1523void mptcp_check_and_set_pending(struct sock *sk)
1524{
1// SPDX-License-Identifier: GPL-2.0
2/* Multipath TCP
3 *
4 * Copyright (c) 2017 - 2019, Intel Corporation.
5 */
6
7#define pr_fmt(fmt) "MPTCP: " fmt
8

--- 1508 unchanged lines hidden (view full) ---

1517 if (likely(after64(snd_nxt_new, msk->snd_nxt))) {
1518 msk->bytes_sent += snd_nxt_new - msk->snd_nxt;
1519 msk->snd_nxt = snd_nxt_new;
1520 }
1521}
1522
1523void mptcp_check_and_set_pending(struct sock *sk)
1524{
1525 if (mptcp_send_head(sk))
1526 mptcp_sk(sk)->push_pending |= BIT(MPTCP_PUSH_PENDING);
1525 if (mptcp_send_head(sk)) {
1526 mptcp_data_lock(sk);
1527 mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING);
1528 mptcp_data_unlock(sk);
1529 }
1527}
1528
1529static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
1530 struct mptcp_sendmsg_info *info)
1531{
1532 struct mptcp_sock *msk = mptcp_sk(sk);
1533 struct mptcp_data_frag *dfrag;
1534 int len, copied = 0, err = 0;

--- 1594 unchanged lines hidden (view full) ---

3129 mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL);
3130
3131 /* msk->subflow is still intact, the following will not free the first
3132 * subflow
3133 */
3134 mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
3135 WRITE_ONCE(msk->flags, 0);
3136 msk->cb_flags = 0;
1530}
1531
1532static int __subflow_push_pending(struct sock *sk, struct sock *ssk,
1533 struct mptcp_sendmsg_info *info)
1534{
1535 struct mptcp_sock *msk = mptcp_sk(sk);
1536 struct mptcp_data_frag *dfrag;
1537 int len, copied = 0, err = 0;

--- 1594 unchanged lines hidden (view full) ---

3132 mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL);
3133
3134 /* msk->subflow is still intact, the following will not free the first
3135 * subflow
3136 */
3137 mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE);
3138 WRITE_ONCE(msk->flags, 0);
3139 msk->cb_flags = 0;
3137 msk->push_pending = 0;
3138 msk->recovery = false;
3139 msk->can_ack = false;
3140 msk->fully_established = false;
3141 msk->rcv_data_fin = false;
3142 msk->snd_data_fin_enable = false;
3143 msk->rcv_fastclose = false;
3144 msk->use_64bit_ack = false;
3145 WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));

--- 208 unchanged lines hidden (view full) ---

3354
3355/* processes deferred events and flush wmem */
3356static void mptcp_release_cb(struct sock *sk)
3357 __must_hold(&sk->sk_lock.slock)
3358{
3359 struct mptcp_sock *msk = mptcp_sk(sk);
3360
3361 for (;;) {
3140 msk->recovery = false;
3141 msk->can_ack = false;
3142 msk->fully_established = false;
3143 msk->rcv_data_fin = false;
3144 msk->snd_data_fin_enable = false;
3145 msk->rcv_fastclose = false;
3146 msk->use_64bit_ack = false;
3147 WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));

--- 208 unchanged lines hidden (view full) ---

3356
3357/* processes deferred events and flush wmem */
3358static void mptcp_release_cb(struct sock *sk)
3359 __must_hold(&sk->sk_lock.slock)
3360{
3361 struct mptcp_sock *msk = mptcp_sk(sk);
3362
3363 for (;;) {
3362 unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED) |
3363 msk->push_pending;
3364 unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED);
3364 struct list_head join_list;
3365
3366 if (!flags)
3367 break;
3368
3369 INIT_LIST_HEAD(&join_list);
3370 list_splice_init(&msk->join_list, &join_list);
3371
3372 /* the following actions acquire the subflow socket lock
3373 *
3374 * 1) can't be invoked in atomic scope
3375 * 2) must avoid ABBA deadlock with msk socket spinlock: the RX
3376 * datapath acquires the msk socket spinlock while helding
3377 * the subflow socket lock
3378 */
3365 struct list_head join_list;
3366
3367 if (!flags)
3368 break;
3369
3370 INIT_LIST_HEAD(&join_list);
3371 list_splice_init(&msk->join_list, &join_list);
3372
3373 /* the following actions acquire the subflow socket lock
3374 *
3375 * 1) can't be invoked in atomic scope
3376 * 2) must avoid ABBA deadlock with msk socket spinlock: the RX
3377 * datapath acquires the msk socket spinlock while helding
3378 * the subflow socket lock
3379 */
3379 msk->push_pending = 0;
3380 msk->cb_flags &= ~flags;
3381 spin_unlock_bh(&sk->sk_lock.slock);
3382
3383 if (flags & BIT(MPTCP_FLUSH_JOIN_LIST))
3384 __mptcp_flush_join_list(sk, &join_list);
3385 if (flags & BIT(MPTCP_PUSH_PENDING))
3386 __mptcp_push_pending(sk, 0);
3387 if (flags & BIT(MPTCP_RETRANSMIT))

--- 712 unchanged lines hidden ---
3380 msk->cb_flags &= ~flags;
3381 spin_unlock_bh(&sk->sk_lock.slock);
3382
3383 if (flags & BIT(MPTCP_FLUSH_JOIN_LIST))
3384 __mptcp_flush_join_list(sk, &join_list);
3385 if (flags & BIT(MPTCP_PUSH_PENDING))
3386 __mptcp_push_pending(sk, 0);
3387 if (flags & BIT(MPTCP_RETRANSMIT))

--- 712 unchanged lines hidden ---