diff --git a/html/lcov/export/index-sort-b.html b/html/lcov/export/index-sort-b.html index 2f2ba438..83dfca4c 100644 --- a/html/lcov/export/index-sort-b.html +++ b/html/lcov/export/index-sort-b.html @@ -33,11 +33,11 @@ Lines: 88.9 % 8234 - 7319 + 7321 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.8 % @@ -53,9 +53,9 @@ Branches: - 64.6 % - 6473 - 4179 + 64.8 % + 6551 + 4243 @@ -122,9 +122,9 @@ 84.6 % 13 11 - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 100.0 % 1 1 @@ -192,14 +192,14 @@ mptcp/token.c -
88.7%88.7%
+
88.1%88.1%
- 88.7 % + 88.1 % 177 - 157 - 58.3 % + 156 + 57.4 % 108 - 63 + 62 100.0 % 12 12 @@ -257,28 +257,13 @@ 90.3 % 1135 1025 - 63.1 % + 63.3 % 854 - 539 + 541 95.5 % 67 64 - - mptcp/mptcp_diag.c - -
72.9%72.9%
- - 72.9 % - 133 - 97 - 64.3 % - 70 - 45 - 71.4 % - 7 - 5 - mptcp/ctrl.c @@ -294,17 +279,32 @@ 24 24 + + mptcp/mptcp_diag.c + +
73.7%73.7%
+ + 73.7 % + 133 + 98 + 65.7 % + 70 + 46 + 71.4 % + 7 + 5 + mptcp/protocol.c -
91.0%91.0%
+
91.2%91.2%
- 91.0 % + 91.2 % 2158 - 1964 - 69.0 % + 1968 + 69.3 % 1623 - 1120 + 1124 95.5 % 133 127 @@ -332,9 +332,9 @@ 94.5 % 235 222 - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 100.0 % 34 34 @@ -372,11 +372,11 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 + 859 77.6 % 689 535 diff --git a/html/lcov/export/index-sort-f.html b/html/lcov/export/index-sort-f.html index 0065e909..1479128d 100644 --- a/html/lcov/export/index-sort-f.html +++ b/html/lcov/export/index-sort-f.html @@ -33,11 +33,11 @@ Lines: 88.9 % 8234 - 7319 + 7321 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.8 % @@ -53,9 +53,9 @@ Branches: - 64.6 % - 6473 - 4179 + 64.8 % + 6551 + 4243 @@ -117,14 +117,14 @@ mptcp/mptcp_diag.c -
72.9%72.9%
+
73.7%73.7%
- 72.9 % + 73.7 % 133 - 97 - 64.3 % + 98 + 65.7 % 70 - 45 + 46 71.4 % 7 5 @@ -177,14 +177,14 @@ mptcp/protocol.c -
91.0%91.0%
+
91.2%91.2%
- 91.0 % + 91.2 % 2158 - 1964 - 69.0 % + 1968 + 69.3 % 1623 - 1120 + 1124 95.5 % 133 127 @@ -197,9 +197,9 @@ 90.3 % 1135 1025 - 63.1 % + 63.3 % 854 - 539 + 541 95.5 % 67 64 @@ -242,9 +242,9 @@ 84.6 % 13 11 - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 100.0 % 1 1 @@ -312,14 +312,14 @@ mptcp/token.c -
88.7%88.7%
+
88.1%88.1%
- 88.7 % + 88.1 % 177 - 157 - 58.3 % + 156 + 57.4 % 108 - 63 + 62 100.0 % 12 12 @@ -357,11 +357,11 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 + 859 77.6 % 689 535 @@ -392,9 +392,9 @@ 94.5 % 235 222 - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 100.0 % 34 34 diff --git a/html/lcov/export/index-sort-l.html b/html/lcov/export/index-sort-l.html index f2d7c803..31c27c75 100644 --- a/html/lcov/export/index-sort-l.html +++ b/html/lcov/export/index-sort-l.html @@ -33,11 +33,11 @@ Lines: 88.9 % 8234 - 7319 + 7321 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.8 % @@ -53,9 +53,9 @@ Branches: - 64.6 % - 6473 - 4179 + 64.8 % + 6551 + 4243 @@ -117,14 +117,14 @@ mptcp/mptcp_diag.c -
72.9%72.9%
+
73.7%73.7%
- 72.9 % + 73.7 % 133 - 97 - 64.3 % + 98 + 65.7 % 70 - 45 + 46 71.4 % 7 5 @@ -182,9 +182,9 @@ 84.6 % 13 11 - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 100.0 % 1 1 @@ -207,14 +207,14 @@ mptcp/token.c -
88.7%88.7%
+
88.1%88.1%
- 88.7 % + 88.1 % 177 - 157 - 58.3 % + 156 + 57.4 % 108 - 63 + 62 100.0 % 12 12 @@ -242,9 +242,9 @@ 90.3 % 1135 1025 - 63.1 % + 63.3 % 854 - 539 + 541 95.5 % 67 64 @@ -267,14 +267,14 @@ mptcp/protocol.c -
91.0%91.0%
+
91.2%91.2%
- 91.0 % + 91.2 % 2158 - 1964 - 69.0 % + 1968 + 69.3 % 1623 - 1120 + 1124 95.5 % 133 127 @@ -317,9 +317,9 @@ 94.5 % 235 222 - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 100.0 % 34 34 @@ -372,11 +372,11 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 + 859 77.6 % 689 535 diff --git a/html/lcov/export/index.html b/html/lcov/export/index.html index a5b44a68..6fb0c4da 100644 --- a/html/lcov/export/index.html +++ b/html/lcov/export/index.html @@ -33,11 +33,11 @@ Lines: 88.9 % 8234 - 7319 + 7321 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.8 % @@ -53,9 +53,9 @@ Branches: - 64.6 % - 6473 - 4179 + 64.8 % + 6551 + 4243 @@ -212,9 +212,9 @@ 84.6 % 13 11 - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 100.0 % 1 1 @@ -222,14 +222,14 @@ mptcp/mptcp_diag.c -
72.9%72.9%
+
73.7%73.7%
- 72.9 % + 73.7 % 133 - 97 - 64.3 % + 98 + 65.7 % 70 - 45 + 46 71.4 % 7 5 @@ -237,11 +237,11 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 + 859 77.6 % 689 535 @@ -297,14 +297,14 @@ mptcp/protocol.c -
91.0%91.0%
+
91.2%91.2%
- 91.0 % + 91.2 % 2158 - 1964 - 69.0 % + 1968 + 69.3 % 1623 - 1120 + 1124 95.5 % 133 127 @@ -317,9 +317,9 @@ 94.5 % 235 222 - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 100.0 % 34 34 @@ -362,9 +362,9 @@ 90.3 % 1135 1025 - 63.1 % + 63.3 % 854 - 539 + 541 95.5 % 67 64 @@ -387,14 +387,14 @@ mptcp/token.c -
88.7%88.7%
+
88.1%88.1%
- 88.7 % + 88.1 % 177 - 157 - 58.3 % + 156 + 57.4 % 108 - 63 + 62 100.0 % 12 12 diff --git a/html/lcov/export/mptcp/bpf.c.func-c.html b/html/lcov/export/mptcp/bpf.c.func-c.html index fc0c444c..611a5900 100644 --- a/html/lcov/export/mptcp/bpf.c.func-c.html +++ b/html/lcov/export/mptcp/bpf.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 81.0 % @@ -158,7 +158,7 @@ bpf_mptcp_subflow_queues_empty - 6 + 12 @@ -221,7 +221,7 @@ bpf_mptcp_subflow_ctx_by_pos - 542225 + 543532 diff --git a/html/lcov/export/mptcp/bpf.c.func.html b/html/lcov/export/mptcp/bpf.c.func.html index de309bc4..e2a9906b 100644 --- a/html/lcov/export/mptcp/bpf.c.func.html +++ b/html/lcov/export/mptcp/bpf.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 81.0 % @@ -214,14 +214,14 @@ bpf_mptcp_subflow_ctx_by_pos - 542225 + 543532 bpf_mptcp_subflow_queues_empty - 6 + 12 diff --git a/html/lcov/export/mptcp/bpf.c.gcov.html b/html/lcov/export/mptcp/bpf.c.gcov.html index ec54ed62..0325bbdd 100644 --- a/html/lcov/export/mptcp/bpf.c.gcov.html +++ b/html/lcov/export/mptcp/bpf.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 81.0 % @@ -377,16 +377,16 @@ 298 : 6 : } 299 : : 300 : : __bpf_kfunc struct mptcp_subflow_context * - 301 : 542225 : bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) + 301 : 543532 : bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) 302 : : { - 303 [ + - ]: 542225 : if (pos >= MPTCP_SUBFLOWS_MAX) + 303 [ + - ]: 543532 : if (pos >= MPTCP_SUBFLOWS_MAX) 304 : : return NULL; - 305 : 542225 : return data->contexts[pos]; + 305 : 543532 : return data->contexts[pos]; 306 : : } 307 : : - 308 : 6 : __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk) + 308 : 12 : __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk) 309 : : { - 310 : 6 : return tcp_rtx_queue_empty(sk); + 310 : 12 : return tcp_rtx_queue_empty(sk); 311 : : } 312 : : 313 : : __bpf_kfunc_end_defs(); diff --git a/html/lcov/export/mptcp/crypto.c.func-c.html b/html/lcov/export/mptcp/crypto.c.func-c.html index 41f1e6ec..868e4146 100644 --- a/html/lcov/export/mptcp/crypto.c.func-c.html +++ b/html/lcov/export/mptcp/crypto.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -81,14 +81,14 @@ mptcp_crypto_hmac_sha - 2776 + 2772 mptcp_crypto_key_sha - 5964 + 5965 diff --git a/html/lcov/export/mptcp/crypto.c.func.html b/html/lcov/export/mptcp/crypto.c.func.html index 4ccee3e6..26ebecff 100644 --- a/html/lcov/export/mptcp/crypto.c.func.html +++ b/html/lcov/export/mptcp/crypto.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -81,14 +81,14 @@ mptcp_crypto_hmac_sha - 2776 + 2772 mptcp_crypto_key_sha - 5964 + 5965 diff --git a/html/lcov/export/mptcp/crypto.c.gcov.html b/html/lcov/export/mptcp/crypto.c.gcov.html index 605dc9f7..4544288f 100644 --- a/html/lcov/export/mptcp/crypto.c.gcov.html +++ b/html/lcov/export/mptcp/crypto.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -106,55 +106,55 @@ 28 : : 29 : : #define SHA256_DIGEST_WORDS (SHA256_DIGEST_SIZE / 4) 30 : : - 31 : 5964 : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) + 31 : 5965 : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) 32 : : { - 33 : 5964 : __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS]; - 34 : 5964 : __be64 input = cpu_to_be64(key); + 33 : 5965 : __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS]; + 34 : 5965 : __be64 input = cpu_to_be64(key); 35 : : - 36 : 5964 : sha256((__force u8 *)&input, sizeof(input), (u8 *)mptcp_hashed_key); + 36 : 5965 : sha256((__force u8 *)&input, sizeof(input), (u8 *)mptcp_hashed_key); 37 : : - 38 [ + + ]: 5964 : if (token) - 39 : 3059 : *token = be32_to_cpu(mptcp_hashed_key[0]); - 40 [ + + ]: 5964 : if (idsn) + 38 [ + + ]: 5965 : if (token) + 39 : 3060 : *token = be32_to_cpu(mptcp_hashed_key[0]); + 40 [ + + ]: 5965 : if (idsn) 41 : 5403 : *idsn = be64_to_cpu(*((__be64 *)&mptcp_hashed_key[6])); - 42 : 5964 : } + 42 : 5965 : } 43 : : - 44 : 2776 : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) + 44 : 2772 : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) 45 : : { - 46 : 2776 : u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE]; - 47 : 2776 : u8 key1be[8]; - 48 : 2776 : u8 key2be[8]; - 49 : 2776 : int i; + 46 : 2772 : u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE]; + 47 : 2772 : u8 key1be[8]; + 48 : 2772 : u8 key2be[8]; + 49 : 2772 : int i; 50 : : - 51 [ - + ]: 2776 : if (WARN_ON_ONCE(len > SHA256_DIGEST_SIZE)) + 51 [ - + ]: 2772 : if (WARN_ON_ONCE(len > SHA256_DIGEST_SIZE)) 52 : 0 : len = SHA256_DIGEST_SIZE; 53 : : - 54 : 2776 : put_unaligned_be64(key1, key1be); - 55 : 2776 : put_unaligned_be64(key2, key2be); + 54 : 2772 : put_unaligned_be64(key1, key1be); + 55 : 2772 : put_unaligned_be64(key2, key2be); 56 : : 57 : : /* Generate key xored with ipad */ - 58 : 2776 : memset(input, 0x36, SHA256_BLOCK_SIZE); - 59 [ + + ]: 24984 : for (i = 0; i < 8; i++) - 60 : 22208 : input[i] ^= key1be[i]; - 61 [ + + ]: 24984 : for (i = 0; i < 8; i++) - 62 : 22208 : input[i + 8] ^= key2be[i]; + 58 : 2772 : memset(input, 0x36, SHA256_BLOCK_SIZE); + 59 [ + + ]: 24948 : for (i = 0; i < 8; i++) + 60 : 22176 : input[i] ^= key1be[i]; + 61 [ + + ]: 24948 : for (i = 0; i < 8; i++) + 62 : 22176 : input[i + 8] ^= key2be[i]; 63 : : - 64 : 2776 : memcpy(&input[SHA256_BLOCK_SIZE], msg, len); + 64 : 2772 : memcpy(&input[SHA256_BLOCK_SIZE], msg, len); 65 : : 66 : : /* emit sha256(K1 || msg) on the second input block, so we can 67 : : * reuse 'input' for the last hashing 68 : : */ - 69 : 2776 : sha256(input, SHA256_BLOCK_SIZE + len, &input[SHA256_BLOCK_SIZE]); + 69 : 2772 : sha256(input, SHA256_BLOCK_SIZE + len, &input[SHA256_BLOCK_SIZE]); 70 : : 71 : : /* Prepare second part of hmac */ - 72 : 2776 : memset(input, 0x5C, SHA256_BLOCK_SIZE); - 73 [ + + ]: 24984 : for (i = 0; i < 8; i++) - 74 : 22208 : input[i] ^= key1be[i]; - 75 [ + + ]: 24984 : for (i = 0; i < 8; i++) - 76 : 22208 : input[i + 8] ^= key2be[i]; + 72 : 2772 : memset(input, 0x5C, SHA256_BLOCK_SIZE); + 73 [ + + ]: 24948 : for (i = 0; i < 8; i++) + 74 : 22176 : input[i] ^= key1be[i]; + 75 [ + + ]: 24948 : for (i = 0; i < 8; i++) + 76 : 22176 : input[i + 8] ^= key2be[i]; 77 : : - 78 : 2776 : sha256(input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE, hmac); - 79 : 2776 : } + 78 : 2772 : sha256(input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE, hmac); + 79 : 2772 : } 80 : : 81 : : #if IS_MODULE(CONFIG_MPTCP_KUNIT_TEST) 82 : : EXPORT_SYMBOL_GPL(mptcp_crypto_hmac_sha); diff --git a/html/lcov/export/mptcp/crypto_test.c.func-c.html b/html/lcov/export/mptcp/crypto_test.c.func-c.html index 7cd7d48b..31a5d350 100644 --- a/html/lcov/export/mptcp/crypto_test.c.func-c.html +++ b/html/lcov/export/mptcp/crypto_test.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/crypto_test.c.func.html b/html/lcov/export/mptcp/crypto_test.c.func.html index 7fc3be46..15e0a63a 100644 --- a/html/lcov/export/mptcp/crypto_test.c.func.html +++ b/html/lcov/export/mptcp/crypto_test.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/crypto_test.c.gcov.html b/html/lcov/export/mptcp/crypto_test.c.gcov.html index cdb2bab2..f99b6534 100644 --- a/html/lcov/export/mptcp/crypto_test.c.gcov.html +++ b/html/lcov/export/mptcp/crypto_test.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/ctrl.c.func-c.html b/html/lcov/export/mptcp/ctrl.c.func-c.html index 6d4ce658..de9ce92c 100644 --- a/html/lcov/export/mptcp/ctrl.c.func-c.html +++ b/html/lcov/export/mptcp/ctrl.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -128,23 +128,23 @@ - mptcp_get_add_addr_timeout + mptcp_stale_loss_cnt - 392 + 329 - mptcp_stale_loss_cnt + mptcp_get_add_addr_timeout - 536 + 392 mptcp_active_detect_blackhole - 828 + 815 @@ -214,7 +214,7 @@ mptcp_close_timeout - 3733 + 2885 @@ -228,7 +228,7 @@ mptcp_allow_join_id0 - 4839 + 4851 @@ -242,7 +242,7 @@ mptcp_get_pernet - 13179 + 12966 diff --git a/html/lcov/export/mptcp/ctrl.c.func.html b/html/lcov/export/mptcp/ctrl.c.func.html index 2e85bb11..ad220b1b 100644 --- a/html/lcov/export/mptcp/ctrl.c.func.html +++ b/html/lcov/export/mptcp/ctrl.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -81,7 +81,7 @@ mptcp_active_detect_blackhole - 828 + 815 @@ -109,14 +109,14 @@ mptcp_allow_join_id0 - 4839 + 4851 mptcp_close_timeout - 3733 + 2885 @@ -130,7 +130,7 @@ mptcp_get_pernet - 13179 + 12966 @@ -214,7 +214,7 @@ mptcp_stale_loss_cnt - 536 + 329 diff --git a/html/lcov/export/mptcp/ctrl.c.gcov.html b/html/lcov/export/mptcp/ctrl.c.gcov.html index 584170d8..3731b37d 100644 --- a/html/lcov/export/mptcp/ctrl.c.gcov.html +++ b/html/lcov/export/mptcp/ctrl.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -119,9 +119,9 @@ 41 : : char scheduler[MPTCP_SCHED_NAME_MAX]; 42 : : }; 43 : : - 44 : 13179 : static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) + 44 : 12966 : static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) 45 : : { - 46 : 13749 : return net_generic(net, mptcp_pernet_id); + 46 : 13536 : return net_generic(net, mptcp_pernet_id); 47 : : } 48 : : 49 : 2534 : int mptcp_is_enabled(const struct net *net) @@ -139,21 +139,21 @@ 61 : 6876 : return mptcp_get_pernet(net)->checksum_enabled; 62 : : } 63 : : - 64 : 4839 : int mptcp_allow_join_id0(const struct net *net) + 64 : 4851 : int mptcp_allow_join_id0(const struct net *net) 65 : : { - 66 : 4839 : return mptcp_get_pernet(net)->allow_join_initial_addr_port; + 66 : 4851 : return mptcp_get_pernet(net)->allow_join_initial_addr_port; 67 : : } 68 : : - 69 : 536 : unsigned int mptcp_stale_loss_cnt(const struct net *net) + 69 : 329 : unsigned int mptcp_stale_loss_cnt(const struct net *net) 70 : : { - 71 : 536 : return mptcp_get_pernet(net)->stale_loss_cnt; + 71 : 329 : return mptcp_get_pernet(net)->stale_loss_cnt; 72 : : } 73 : : - 74 : 3733 : unsigned int mptcp_close_timeout(const struct sock *sk) + 74 : 2885 : unsigned int mptcp_close_timeout(const struct sock *sk) 75 : : { - 76 [ + + ]: 3733 : if (sock_flag(sk, SOCK_DEAD)) + 76 [ + + ]: 2885 : if (sock_flag(sk, SOCK_DEAD)) 77 : : return TCP_TIMEWAIT_LEN; - 78 : 114 : return mptcp_get_pernet(sock_net(sk))->close_timeout; + 78 : 112 : return mptcp_get_pernet(sock_net(sk))->close_timeout; 79 : : } 80 : : 81 : 3754 : int mptcp_get_pm_type(const struct net *net) @@ -477,31 +477,31 @@ 398 : 1124 : } 399 : : 400 : : /* Check the number of retransmissions, and fallback to TCP if needed */ - 401 : 828 : void mptcp_active_detect_blackhole(struct sock *ssk, bool expired) + 401 : 815 : void mptcp_active_detect_blackhole(struct sock *ssk, bool expired) 402 : : { - 403 : 828 : struct mptcp_subflow_context *subflow; - 404 : 828 : u8 timeouts, to_max; - 405 : 828 : struct net *net; + 403 : 815 : struct mptcp_subflow_context *subflow; + 404 : 815 : u8 timeouts, to_max; + 405 : 815 : struct net *net; 406 : : 407 : : /* Only check MPTCP SYN ... */ - 408 [ + + + + : 828 : if (likely(!sk_is_mptcp(ssk) || ssk->sk_state != TCP_SYN_SENT)) - + + ] + 408 [ + + + + : 815 : if (likely(!sk_is_mptcp(ssk) || ssk->sk_state != TCP_SYN_SENT)) + + + ] 409 : : return; 410 : : - 411 [ + + ]: 78 : subflow = mptcp_subflow_ctx(ssk); + 411 [ + + ]: 79 : subflow = mptcp_subflow_ctx(ssk); 412 : : 413 : : /* ... + MP_CAPABLE */ - 414 [ + + ]: 78 : if (!subflow->request_mptcp) { + 414 [ + + ]: 79 : if (!subflow->request_mptcp) { 415 : : /* Mark as blackhole iif the 1st non-MPTCP SYN is accepted */ 416 : 42 : subflow->mpc_drop = 0; 417 : 42 : return; 418 : : } 419 : : - 420 : 36 : net = sock_net(ssk); - 421 : 36 : timeouts = inet_csk(ssk)->icsk_retransmits; - 422 : 36 : to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback; + 420 : 37 : net = sock_net(ssk); + 421 : 37 : timeouts = inet_csk(ssk)->icsk_retransmits; + 422 : 37 : to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback; 423 : : - 424 [ + + + + ]: 36 : if (timeouts == to_max || (timeouts < to_max && expired)) { + 424 [ + + + + ]: 37 : if (timeouts == to_max || (timeouts < to_max && expired)) { 425 [ + - ]: 18 : MPTCP_INC_STATS(net, MPTCP_MIB_MPCAPABLEACTIVEDROP); 426 : 18 : subflow->mpc_drop = 1; 427 [ - + ]: 18 : mptcp_subflow_early_fallback(mptcp_sk(subflow->conn), subflow); diff --git a/html/lcov/export/mptcp/diag.c.func-c.html b/html/lcov/export/mptcp/diag.c.func-c.html index 220f9bb7..c39d8a47 100644 --- a/html/lcov/export/mptcp/diag.c.func-c.html +++ b/html/lcov/export/mptcp/diag.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 66.7 % @@ -95,7 +95,7 @@ subflow_get_info - 242 + 240 diff --git a/html/lcov/export/mptcp/diag.c.func.html b/html/lcov/export/mptcp/diag.c.func.html index f469d5b2..a63cddf8 100644 --- a/html/lcov/export/mptcp/diag.c.func.html +++ b/html/lcov/export/mptcp/diag.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 66.7 % @@ -88,7 +88,7 @@ subflow_get_info - 242 + 240 diff --git a/html/lcov/export/mptcp/diag.c.gcov.html b/html/lcov/export/mptcp/diag.c.gcov.html index d6e45276..187a1c1c 100644 --- a/html/lcov/export/mptcp/diag.c.gcov.html +++ b/html/lcov/export/mptcp/diag.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 66.7 % @@ -90,72 +90,72 @@ 12 : : #include <net/netlink.h> 13 : : #include "protocol.h" 14 : : - 15 : 242 : static int subflow_get_info(struct sock *sk, struct sk_buff *skb) + 15 : 240 : static int subflow_get_info(struct sock *sk, struct sk_buff *skb) 16 : : { - 17 : 242 : struct mptcp_subflow_context *sf; - 18 : 242 : struct nlattr *start; - 19 : 242 : u32 flags = 0; - 20 : 242 : bool slow; - 21 : 242 : int err; + 17 : 240 : struct mptcp_subflow_context *sf; + 18 : 240 : struct nlattr *start; + 19 : 240 : u32 flags = 0; + 20 : 240 : bool slow; + 21 : 240 : int err; 22 : : - 23 [ - + ]: 242 : if (inet_sk_state_load(sk) == TCP_LISTEN) + 23 [ - + ]: 240 : if (inet_sk_state_load(sk) == TCP_LISTEN) 24 : : return 0; 25 : : - 26 : 242 : start = nla_nest_start_noflag(skb, INET_ULP_INFO_MPTCP); - 27 [ + - ]: 242 : if (!start) + 26 : 240 : start = nla_nest_start_noflag(skb, INET_ULP_INFO_MPTCP); + 27 [ + - ]: 240 : if (!start) 28 : : return -EMSGSIZE; 29 : : - 30 : 242 : slow = lock_sock_fast(sk); - 31 : 242 : rcu_read_lock(); - 32 [ + - - + : 242 : sf = rcu_dereference(inet_csk(sk)->icsk_ulp_data); + 30 : 240 : slow = lock_sock_fast(sk); + 31 : 240 : rcu_read_lock(); + 32 [ + - - + : 240 : sf = rcu_dereference(inet_csk(sk)->icsk_ulp_data); - - - - - - ] - 33 [ - + ]: 242 : if (!sf) { + 33 [ - + ]: 240 : if (!sf) { 34 : 0 : err = 0; 35 : 0 : goto nla_failure; 36 : : } 37 : : - 38 [ + + ]: 242 : if (sf->mp_capable) - 39 : 74 : flags |= MPTCP_SUBFLOW_FLAG_MCAP_REM; - 40 [ + + ]: 242 : if (sf->request_mptcp) - 41 : 19 : flags |= MPTCP_SUBFLOW_FLAG_MCAP_LOC; - 42 [ + + ]: 242 : if (sf->mp_join) + 38 [ + + ]: 240 : if (sf->mp_capable) + 39 : 72 : flags |= MPTCP_SUBFLOW_FLAG_MCAP_REM; + 40 [ + + ]: 240 : if (sf->request_mptcp) + 41 : 18 : flags |= MPTCP_SUBFLOW_FLAG_MCAP_LOC; + 42 [ + + ]: 240 : if (sf->mp_join) 43 : 168 : flags |= MPTCP_SUBFLOW_FLAG_JOIN_REM; - 44 [ + + ]: 242 : if (sf->request_join) + 44 [ + + ]: 240 : if (sf->request_join) 45 : 66 : flags |= MPTCP_SUBFLOW_FLAG_JOIN_LOC; - 46 [ - + ]: 242 : if (sf->backup) + 46 [ - + ]: 240 : if (sf->backup) 47 : 0 : flags |= MPTCP_SUBFLOW_FLAG_BKUP_REM; - 48 [ - + ]: 242 : if (sf->request_bkup) + 48 [ - + ]: 240 : if (sf->request_bkup) 49 : 0 : flags |= MPTCP_SUBFLOW_FLAG_BKUP_LOC; - 50 [ + + + - ]: 242 : if (READ_ONCE(sf->fully_established)) - 51 : 242 : flags |= MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED; - 52 [ + - ]: 242 : if (sf->conn_finished) - 53 : 242 : flags |= MPTCP_SUBFLOW_FLAG_CONNECTED; - 54 [ - + ]: 242 : if (sf->map_valid) + 50 [ + + + - ]: 240 : if (READ_ONCE(sf->fully_established)) + 51 : 240 : flags |= MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED; + 52 [ + - ]: 240 : if (sf->conn_finished) + 53 : 240 : flags |= MPTCP_SUBFLOW_FLAG_CONNECTED; + 54 [ - + ]: 240 : if (sf->map_valid) 55 : 0 : flags |= MPTCP_SUBFLOW_FLAG_MAPVALID; 56 : : - 57 [ + - + - ]: 412 : if (nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_TOKEN_REM, sf->remote_token) || - 58 [ + - ]: 412 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_TOKEN_LOC, sf->token) || - 59 [ + - ]: 242 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ, - 60 [ + - ]: 242 : sf->rel_write_seq) || - 61 [ + - ]: 242 : nla_put_u64_64bit(skb, MPTCP_SUBFLOW_ATTR_MAP_SEQ, sf->map_seq, - 62 [ + - ]: 242 : MPTCP_SUBFLOW_ATTR_PAD) || - 63 [ + - ]: 242 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_MAP_SFSEQ, - 64 [ + - ]: 242 : sf->map_subflow_seq) || - 65 [ + - ]: 412 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_SSN_OFFSET, sf->ssn_offset) || - 66 [ + - ]: 242 : nla_put_u16(skb, MPTCP_SUBFLOW_ATTR_MAP_DATALEN, - 67 [ + - ]: 412 : sf->map_data_len) || - 68 [ + - ]: 242 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_FLAGS, flags) || - 69 [ + + ]: 412 : nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_REM, sf->remote_id) || + 57 [ + - + - ]: 408 : if (nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_TOKEN_REM, sf->remote_token) || + 58 [ + - ]: 408 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_TOKEN_LOC, sf->token) || + 59 [ + - ]: 240 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ, + 60 [ + - ]: 240 : sf->rel_write_seq) || + 61 [ + - ]: 240 : nla_put_u64_64bit(skb, MPTCP_SUBFLOW_ATTR_MAP_SEQ, sf->map_seq, + 62 [ + - ]: 240 : MPTCP_SUBFLOW_ATTR_PAD) || + 63 [ + - ]: 240 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_MAP_SFSEQ, + 64 [ + - ]: 240 : sf->map_subflow_seq) || + 65 [ + - ]: 408 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_SSN_OFFSET, sf->ssn_offset) || + 66 [ + - ]: 240 : nla_put_u16(skb, MPTCP_SUBFLOW_ATTR_MAP_DATALEN, + 67 [ + - ]: 408 : sf->map_data_len) || + 68 [ + - ]: 240 : nla_put_u32(skb, MPTCP_SUBFLOW_ATTR_FLAGS, flags) || + 69 [ + + ]: 408 : nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_REM, sf->remote_id) || 70 [ - + ]: 72 : nla_put_u8(skb, MPTCP_SUBFLOW_ATTR_ID_LOC, subflow_get_local_id(sf))) { 71 : 0 : err = -EMSGSIZE; 72 : 0 : goto nla_failure; 73 : : } 74 : : - 75 : 242 : rcu_read_unlock(); - 76 : 242 : unlock_sock_fast(sk, slow); - 77 : 242 : nla_nest_end(skb, start); - 78 : 242 : return 0; + 75 : 240 : rcu_read_unlock(); + 76 : 240 : unlock_sock_fast(sk, slow); + 77 : 240 : nla_nest_end(skb, start); + 78 : 240 : return 0; 79 : : 80 : 0 : nla_failure: 81 : 0 : rcu_read_unlock(); diff --git a/html/lcov/export/mptcp/fastopen.c.func-c.html b/html/lcov/export/mptcp/fastopen.c.func-c.html index 80622ee2..221b0e49 100644 --- a/html/lcov/export/mptcp/fastopen.c.func-c.html +++ b/html/lcov/export/mptcp/fastopen.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/fastopen.c.func.html b/html/lcov/export/mptcp/fastopen.c.func.html index 131ed238..acbf0f0b 100644 --- a/html/lcov/export/mptcp/fastopen.c.func.html +++ b/html/lcov/export/mptcp/fastopen.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/fastopen.c.gcov.html b/html/lcov/export/mptcp/fastopen.c.gcov.html index 40907546..72f310d5 100644 --- a/html/lcov/export/mptcp/fastopen.c.gcov.html +++ b/html/lcov/export/mptcp/fastopen.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/mib.c.func-c.html b/html/lcov/export/mptcp/mib.c.func-c.html index c8365cdd..e71f1201 100644 --- a/html/lcov/export/mptcp/mib.c.func-c.html +++ b/html/lcov/export/mptcp/mib.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/mib.c.func.html b/html/lcov/export/mptcp/mib.c.func.html index 35b20dc3..aa74e390 100644 --- a/html/lcov/export/mptcp/mib.c.func.html +++ b/html/lcov/export/mptcp/mib.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/mib.c.gcov.html b/html/lcov/export/mptcp/mib.c.gcov.html index 1b3649ee..2953c1de 100644 --- a/html/lcov/export/mptcp/mib.c.gcov.html +++ b/html/lcov/export/mptcp/mib.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/mib.h.func-c.html b/html/lcov/export/mptcp/mib.h.func-c.html index 29f54e7c..df8b659c 100644 --- a/html/lcov/export/mptcp/mib.h.func-c.html +++ b/html/lcov/export/mptcp/mib.h.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 diff --git a/html/lcov/export/mptcp/mib.h.func.html b/html/lcov/export/mptcp/mib.h.func.html index 05cdb622..5bb9011b 100644 --- a/html/lcov/export/mptcp/mib.h.func.html +++ b/html/lcov/export/mptcp/mib.h.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 diff --git a/html/lcov/export/mptcp/mib.h.gcov.html b/html/lcov/export/mptcp/mib.h.gcov.html index 5c59155f..f65688fd 100644 --- a/html/lcov/export/mptcp/mib.h.gcov.html +++ b/html/lcov/export/mptcp/mib.h.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 45.2 % - 252 - 114 + 44.6 % + 278 + 124 @@ -178,9 +178,9 @@ 99 : 0 : static inline void MPTCP_INC_STATS(struct net *net, 100 : : enum linux_mptcp_mib_field field) 101 : : { - 102 [ + - ][ + - : 347774 : if (likely(net->mib.mptcp_statistics)) - + - + - + - - + - + - + 102 [ + - ][ + - : 350633 : if (likely(net->mib.mptcp_statistics)) + + - + - + + - + - + - - - - - + - - + - - + - + - + @@ -190,50 +190,55 @@ + - + - - - - - - - + - + - + - - ][ + - + - - + - + - - + - + - - - - + - + - - + + - - + - - + - + - - + - + - + - - + - + - - + - + - + - - + - - - + - ][ + - + + - - - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - - - + - - - - - + - - - - + - ][ + - + + - + - + - + + - + - - + - - - + - + - + - - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - - - - - - - + - + - + - - ][ + - + - - - - + - - + - + - - - - + - + - - + - - - - - - - - + - - - - + - + - - + - + - - + - + - + - - + - ][ + - - + - - + - + - + - + - - + - + - - + - + - + - - + - + - - + - + - + - - ] - 103 [ - + - + : 283245 : SNMP_INC_STATS(net->mib.mptcp_statistics, field); - - + - + + + - ][ + - + + - - + + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - ] + 103 [ - + - + : 254840 : SNMP_INC_STATS(net->mib.mptcp_statistics, field); + - + - + + + - + + + ][ - + - - + + + - + - + + + + + - + ][ - + + - + + + ] + + + + - + + + + + + + + + ][ - + + + + + + ] 104 : : } 105 : : 106 : 0 : static inline void __MPTCP_INC_STATS(struct net *net, 107 : : enum linux_mptcp_mib_field field) 108 : : { - 109 [ - - + - : 212 : if (likely(net->mib.mptcp_statistics)) - + - ] + 109 [ - - + - : 213 : if (likely(net->mib.mptcp_statistics)) + + - ] [ - + + - ] 110 : 204 : __SNMP_INC_STATS(net->mib.mptcp_statistics, field); 111 : : } diff --git a/html/lcov/export/mptcp/mptcp_diag.c.func-c.html b/html/lcov/export/mptcp/mptcp_diag.c.func-c.html index 18878165..0ae5a4be 100644 --- a/html/lcov/export/mptcp/mptcp_diag.c.func-c.html +++ b/html/lcov/export/mptcp/mptcp_diag.c.func-c.html @@ -31,13 +31,13 @@ export Lines: - 72.9 % + 73.7 % 133 - 97 + 98 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 71.4 % @@ -56,9 +56,9 @@ Branches: - 64.3 % + 65.7 % 70 - 45 + 46 @@ -102,28 +102,28 @@ mptcp_diag_dump_listeners - 74 + 67 mptcp_diag_dump - 867 + 881 mptcp_diag_get_info - 1276 + 1302 sk_diag_dump - 1308 + 1334 diff --git a/html/lcov/export/mptcp/mptcp_diag.c.func.html b/html/lcov/export/mptcp/mptcp_diag.c.func.html index d457ab2c..469306b3 100644 --- a/html/lcov/export/mptcp/mptcp_diag.c.func.html +++ b/html/lcov/export/mptcp/mptcp_diag.c.func.html @@ -31,13 +31,13 @@ export Lines: - 72.9 % + 73.7 % 133 - 97 + 98 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 71.4 % @@ -56,9 +56,9 @@ Branches: - 64.3 % + 65.7 % 70 - 45 + 46 @@ -81,14 +81,14 @@ mptcp_diag_dump - 867 + 881 mptcp_diag_dump_listeners - 74 + 67 @@ -109,7 +109,7 @@ mptcp_diag_get_info - 1276 + 1302 @@ -123,7 +123,7 @@ sk_diag_dump - 1308 + 1334 diff --git a/html/lcov/export/mptcp/mptcp_diag.c.gcov.html b/html/lcov/export/mptcp/mptcp_diag.c.gcov.html index a3edfc1b..1ef3ee18 100644 --- a/html/lcov/export/mptcp/mptcp_diag.c.gcov.html +++ b/html/lcov/export/mptcp/mptcp_diag.c.gcov.html @@ -31,13 +31,13 @@ export Lines: - 72.9 % + 73.7 % 133 - 97 + 98 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 71.4 % @@ -56,9 +56,9 @@ Branches: - 64.3 % + 65.7 % 70 - 45 + 46 @@ -90,15 +90,15 @@ 12 : : #include <net/netlink.h> 13 : : #include "protocol.h" 14 : : - 15 : 1308 : static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, + 15 : 1334 : static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, 16 : : struct netlink_callback *cb, 17 : : const struct inet_diag_req_v2 *req, 18 : : struct nlattr *bc, bool net_admin) 19 : : { - 20 [ + + ]: 1308 : if (!inet_diag_bc_sk(bc, sk)) + 20 [ + + ]: 1334 : if (!inet_diag_bc_sk(bc, sk)) 21 : : return 0; 22 : : - 23 : 1294 : return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, req, NLM_F_MULTI, + 23 : 1320 : return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, req, NLM_F_MULTI, 24 : : net_admin); 25 : : } 26 : : @@ -150,155 +150,155 @@ 72 : : unsigned int l_num; 73 : : }; 74 : : - 75 : 74 : static void mptcp_diag_dump_listeners(struct sk_buff *skb, struct netlink_callback *cb, + 75 : 67 : static void mptcp_diag_dump_listeners(struct sk_buff *skb, struct netlink_callback *cb, 76 : : const struct inet_diag_req_v2 *r, 77 : : bool net_admin) 78 : : { - 79 : 74 : struct inet_diag_dump_data *cb_data = cb->data; - 80 : 74 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; - 81 : 74 : struct nlattr *bc = cb_data->inet_diag_nla_bc; - 82 : 74 : struct net *net = sock_net(skb->sk); - 83 : 74 : struct inet_hashinfo *hinfo; - 84 : 74 : int i; + 79 : 67 : struct inet_diag_dump_data *cb_data = cb->data; + 80 : 67 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + 81 : 67 : struct nlattr *bc = cb_data->inet_diag_nla_bc; + 82 : 67 : struct net *net = sock_net(skb->sk); + 83 : 67 : struct inet_hashinfo *hinfo; + 84 : 67 : int i; 85 : : - 86 : 74 : hinfo = net->ipv4.tcp_death_row.hashinfo; + 86 : 67 : hinfo = net->ipv4.tcp_death_row.hashinfo; 87 : : - 88 [ + + ]: 110666 : for (i = diag_ctx->l_slot; i <= hinfo->lhash2_mask; i++) { - 89 : 110598 : struct inet_listen_hashbucket *ilb; - 90 : 110598 : struct hlist_nulls_node *node; - 91 : 110598 : struct sock *sk; - 92 : 110598 : int num = 0; + 88 [ + + ]: 102467 : for (i = diag_ctx->l_slot; i <= hinfo->lhash2_mask; i++) { + 89 : 102406 : struct inet_listen_hashbucket *ilb; + 90 : 102406 : struct hlist_nulls_node *node; + 91 : 102406 : struct sock *sk; + 92 : 102406 : int num = 0; 93 : : - 94 : 110598 : ilb = &hinfo->lhash2[i]; + 94 : 102406 : ilb = &hinfo->lhash2[i]; 95 : : - 96 : 110598 : rcu_read_lock(); - 97 : 110598 : spin_lock(&ilb->lock); - 98 [ + + ]: 111260 : sk_nulls_for_each(sk, node, &ilb->nulls_head) { - 99 [ - + ]: 668 : const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); - 100 : 668 : struct inet_sock *inet = inet_sk(sk); - 101 : 668 : int ret; + 96 : 102406 : rcu_read_lock(); + 97 : 102406 : spin_lock(&ilb->lock); + 98 [ + + ]: 103016 : sk_nulls_for_each(sk, node, &ilb->nulls_head) { + 99 [ - + ]: 616 : const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); + 100 : 616 : struct inet_sock *inet = inet_sk(sk); + 101 : 616 : int ret; 102 : : - 103 [ - + ]: 668 : if (num < diag_ctx->l_num) + 103 [ - + ]: 616 : if (num < diag_ctx->l_num) 104 : 0 : goto next_listen; 105 : : - 106 [ + - - + ]: 668 : if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) - 107 : 0 : goto next_listen; + 106 [ + + - + ]: 616 : if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) + 107 : 4 : goto next_listen; 108 : : - 109 : 668 : sk = ctx->conn; - 110 [ + - + + ]: 984 : if (!sk || !net_eq(sock_net(sk), net)) - 111 : 36 : goto next_listen; + 109 : 612 : sk = ctx->conn; + 110 [ + - + + ]: 912 : if (!sk || !net_eq(sock_net(sk), net)) + 111 : 4 : goto next_listen; 112 : : - 113 [ + - ]: 632 : if (r->sdiag_family != AF_UNSPEC && - 114 [ + + ]: 632 : sk->sk_family != r->sdiag_family) - 115 : 312 : goto next_listen; + 113 [ + - ]: 608 : if (r->sdiag_family != AF_UNSPEC && + 114 [ + + ]: 608 : sk->sk_family != r->sdiag_family) + 115 : 300 : goto next_listen; 116 : : - 117 [ + - - + ]: 320 : if (r->id.idiag_sport != inet->inet_sport && + 117 [ + - - + ]: 308 : if (r->id.idiag_sport != inet->inet_sport && 118 : : r->id.idiag_sport) 119 : 0 : goto next_listen; 120 : : - 121 [ - + ]: 320 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 121 [ - + ]: 308 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 122 : 0 : goto next_listen; 123 : : - 124 : 320 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + 124 : 308 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); 125 : : - 126 : 320 : sock_put(sk); + 126 : 308 : sock_put(sk); 127 : : - 128 [ + + ]: 320 : if (ret < 0) { + 128 [ + + ]: 308 : if (ret < 0) { 129 : 6 : spin_unlock(&ilb->lock); 130 : 6 : rcu_read_unlock(); 131 : 6 : diag_ctx->l_slot = i; 132 : 6 : diag_ctx->l_num = num; 133 : 6 : return; 134 : : } - 135 : 314 : diag_ctx->l_num = num + 1; - 136 : 314 : num = 0; - 137 : 662 : next_listen: - 138 : 662 : ++num; + 135 : 302 : diag_ctx->l_num = num + 1; + 136 : 302 : num = 0; + 137 : 610 : next_listen: + 138 : 610 : ++num; 139 : : } - 140 : 110592 : spin_unlock(&ilb->lock); - 141 : 110592 : rcu_read_unlock(); + 140 : 102400 : spin_unlock(&ilb->lock); + 141 : 102400 : rcu_read_unlock(); 142 : : - 143 : 110592 : cond_resched(); - 144 : 110592 : diag_ctx->l_num = 0; + 143 : 102400 : cond_resched(); + 144 : 102400 : diag_ctx->l_num = 0; 145 : : } 146 : : - 147 : 68 : diag_ctx->l_num = 0; - 148 : 68 : diag_ctx->l_slot = i; + 147 : 61 : diag_ctx->l_num = 0; + 148 : 61 : diag_ctx->l_slot = i; 149 : : } 150 : : - 151 : 867 : static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, + 151 : 881 : static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 152 : : const struct inet_diag_req_v2 *r) 153 : : { - 154 : 867 : bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); - 155 : 867 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; - 156 : 867 : struct net *net = sock_net(skb->sk); - 157 : 867 : struct inet_diag_dump_data *cb_data; - 158 : 867 : struct mptcp_sock *msk; - 159 : 867 : struct nlattr *bc; + 154 : 881 : bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); + 155 : 881 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + 156 : 881 : struct net *net = sock_net(skb->sk); + 157 : 881 : struct inet_diag_dump_data *cb_data; + 158 : 881 : struct mptcp_sock *msk; + 159 : 881 : struct nlattr *bc; 160 : : - 161 : 867 : BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); + 161 : 881 : BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); 162 : : - 163 : 867 : cb_data = cb->data; - 164 : 867 : bc = cb_data->inet_diag_nla_bc; + 163 : 881 : cb_data = cb->data; + 164 : 881 : bc = cb_data->inet_diag_nla_bc; 165 : : - 166 : 867 : while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, - 167 [ + + ]: 3695 : &diag_ctx->s_num)) != NULL) { - 168 : 2840 : struct inet_sock *inet = (struct inet_sock *)msk; - 169 : 2840 : struct sock *sk = (struct sock *)msk; - 170 : 2840 : int ret = 0; + 166 : 881 : while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, + 167 [ + + ]: 3786 : &diag_ctx->s_num)) != NULL) { + 168 : 2917 : struct inet_sock *inet = (struct inet_sock *)msk; + 169 : 2917 : struct sock *sk = (struct sock *)msk; + 170 : 2917 : int ret = 0; 171 : : - 172 [ + + + + ]: 2840 : if (!(r->idiag_states & (1 << sk->sk_state))) - 173 : 876 : goto next; - 174 [ + - ]: 1964 : if (r->sdiag_family != AF_UNSPEC && - 175 [ + + ]: 1964 : sk->sk_family != r->sdiag_family) - 176 : 976 : goto next; - 177 [ + - - + ]: 988 : if (r->id.idiag_sport != inet->inet_sport && + 172 [ + + + + ]: 2917 : if (!(r->idiag_states & (1 << sk->sk_state))) + 173 : 879 : goto next; + 174 [ + - ]: 2038 : if (r->sdiag_family != AF_UNSPEC && + 175 [ + + ]: 2038 : sk->sk_family != r->sdiag_family) + 176 : 1012 : goto next; + 177 [ + - - + ]: 1026 : if (r->id.idiag_sport != inet->inet_sport && 178 : : r->id.idiag_sport) 179 : 0 : goto next; - 180 [ + - - + ]: 988 : if (r->id.idiag_dport != inet->inet_dport && + 180 [ + - - + ]: 1026 : if (r->id.idiag_dport != inet->inet_dport && 181 : : r->id.idiag_dport) 182 : 0 : goto next; 183 : : - 184 : 988 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); - 185 : 2840 : next: - 186 : 2840 : sock_put(sk); - 187 [ + + ]: 2840 : if (ret < 0) { + 184 : 1026 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + 185 : 2917 : next: + 186 : 2917 : sock_put(sk); + 187 [ + + ]: 2917 : if (ret < 0) { 188 : : /* will retry on the same position */ 189 : 12 : diag_ctx->s_num--; 190 : 12 : break; 191 : : } - 192 : 2828 : cond_resched(); + 192 : 2905 : cond_resched(); 193 : : } 194 : : - 195 [ + + + - ]: 867 : if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) - 196 : 74 : mptcp_diag_dump_listeners(skb, cb, r, net_admin); - 197 : 867 : } + 195 [ + + + - ]: 881 : if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) + 196 : 67 : mptcp_diag_dump_listeners(skb, cb, r, net_admin); + 197 : 881 : } 198 : : - 199 : 1276 : static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, + 199 : 1302 : static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, 200 : : void *_info) 201 : : { - 202 [ - + ]: 1276 : struct mptcp_sock *msk = mptcp_sk(sk); - 203 : 1276 : struct mptcp_info *info = _info; + 202 [ - + ]: 1302 : struct mptcp_sock *msk = mptcp_sk(sk); + 203 : 1302 : struct mptcp_info *info = _info; 204 : : - 205 : 1276 : r->idiag_rqueue = sk_rmem_alloc_get(sk); - 206 : 1276 : r->idiag_wqueue = sk_wmem_alloc_get(sk); + 205 : 1302 : r->idiag_rqueue = sk_rmem_alloc_get(sk); + 206 : 1302 : r->idiag_wqueue = sk_wmem_alloc_get(sk); 207 : : - 208 [ + + ]: 1276 : if (inet_sk_state_load(sk) == TCP_LISTEN) { - 209 : 312 : struct sock *lsk = READ_ONCE(msk->first); + 208 [ + + ]: 1302 : if (inet_sk_state_load(sk) == TCP_LISTEN) { + 209 : 300 : struct sock *lsk = READ_ONCE(msk->first); 210 : : - 211 [ + - ]: 312 : if (lsk) { + 211 [ + - ]: 300 : if (lsk) { 212 : : /* override with settings from tcp listener, 213 : : * so Send-Q will show accept queue. 214 : : */ - 215 : 312 : r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); - 216 : 312 : r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); + 215 : 300 : r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); + 216 : 300 : r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); 217 : : } 218 : : } 219 : : - 220 [ + + ]: 1276 : if (!info) + 220 [ + + ]: 1302 : if (!info) 221 : : return; 222 : : - 223 : 942 : mptcp_diag_fill_info(msk, info); + 223 : 966 : mptcp_diag_fill_info(msk, info); 224 : : } 225 : : 226 : : static const struct inet_diag_handler mptcp_diag_handler = { diff --git a/html/lcov/export/mptcp/options.c.func-c.html b/html/lcov/export/mptcp/options.c.func-c.html index 4fd1a3c1..17e0dc97 100644 --- a/html/lcov/export/mptcp/options.c.func-c.html +++ b/html/lcov/export/mptcp/options.c.func-c.html @@ -31,13 +31,13 @@ export Lines: - 98.3 % + 98.1 % 876 - 861 + 859 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -88,21 +88,21 @@ mptcp_established_options_fastclose - 437 + 459 mptcp_established_options_rst - 437 + 459 add_addr_hmac_valid - 692 + 691 @@ -116,154 +116,154 @@ clear_3rdack_retransmission - 986 + 984 mptcp_synack_options - 1780 + 1781 mptcp_syn_options - 1883 + 1885 mptcp_make_csum - 1965 + 1889 __mptcp_make_csum - 2105 + 2019 mptcp_update_rcv_data_fin - 14591 + 10033 mptcp_write_data_fin - 32198 + 25626 __mptcp_expand_seq - 134029 + 189599 mptcp_set_rwin - 866018 + 878361 mptcp_write_options - 868163 + 880529 ack_update_msk - 1038676 + 1082269 check_fully_established - 1042136 + 1085741 mptcp_get_options - 1047366 + 1090968 mptcp_parse_option - 1047417 + 1091052 mptcp_incoming_options - 1052718 + 1099162 mptcp_established_options_dss - 2003724 + 2104251 mptcp_established_options_mp_fail - 2003783 + 2104309 mptcp_established_options_rm_addr - 2005183 + 2105722 mptcp_established_options_add_addr - 2005939 + 2106477 mptcp_established_options_mp_prio - 2005939 + 2106477 mptcp_established_options_mp - 2005943 + 2106481 mptcp_established_options - 2055639 + 2163456 diff --git a/html/lcov/export/mptcp/options.c.func.html b/html/lcov/export/mptcp/options.c.func.html index e5ea3784..8f4cca05 100644 --- a/html/lcov/export/mptcp/options.c.func.html +++ b/html/lcov/export/mptcp/options.c.func.html @@ -31,13 +31,13 @@ export Lines: - 98.3 % + 98.1 % 876 - 861 + 859 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -81,21 +81,21 @@ __mptcp_expand_seq - 134029 + 189599 __mptcp_make_csum - 2105 + 2019 ack_update_msk - 1038676 + 1082269 @@ -109,91 +109,91 @@ add_addr_hmac_valid - 692 + 691 check_fully_established - 1042136 + 1085741 clear_3rdack_retransmission - 986 + 984 mptcp_established_options - 2055639 + 2163456 mptcp_established_options_add_addr - 2005939 + 2106477 mptcp_established_options_dss - 2003724 + 2104251 mptcp_established_options_fastclose - 437 + 459 mptcp_established_options_mp - 2005943 + 2106481 mptcp_established_options_mp_fail - 2003783 + 2104309 mptcp_established_options_mp_prio - 2005939 + 2106477 mptcp_established_options_rm_addr - 2005183 + 2105722 mptcp_established_options_rst - 437 + 459 mptcp_get_options - 1047366 + 1090968 @@ -207,63 +207,63 @@ mptcp_incoming_options - 1052718 + 1099162 mptcp_make_csum - 1965 + 1889 mptcp_parse_option - 1047417 + 1091052 mptcp_set_rwin - 866018 + 878361 mptcp_syn_options - 1883 + 1885 mptcp_synack_options - 1780 + 1781 mptcp_update_rcv_data_fin - 14591 + 10033 mptcp_write_data_fin - 32198 + 25626 mptcp_write_options - 868163 + 880529 diff --git a/html/lcov/export/mptcp/options.c.gcov.html b/html/lcov/export/mptcp/options.c.gcov.html index 55d99fb6..18177c7c 100644 --- a/html/lcov/export/mptcp/options.c.gcov.html +++ b/html/lcov/export/mptcp/options.c.gcov.html @@ -31,13 +31,13 @@ export Lines: - 98.3 % + 98.1 % 876 - 861 + 859 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -98,27 +98,27 @@ 20 : : return (flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA256; 21 : : } 22 : : - 23 : 1047417 : static void mptcp_parse_option(const struct sk_buff *skb, + 23 : 1091052 : static void mptcp_parse_option(const struct sk_buff *skb, 24 : : const unsigned char *ptr, int opsize, 25 : : struct mptcp_options_received *mp_opt) 26 : : { - 27 : 1047417 : u8 subtype = *ptr >> 4; - 28 : 1047417 : int expected_opsize; - 29 : 1047417 : u16 subopt; - 30 : 1047417 : u8 version; - 31 : 1047417 : u8 flags; - 32 : 1047417 : u8 i; + 27 : 1091052 : u8 subtype = *ptr >> 4; + 28 : 1091052 : int expected_opsize; + 29 : 1091052 : u16 subopt; + 30 : 1091052 : u8 version; + 31 : 1091052 : u8 flags; + 32 : 1091052 : u8 i; 33 : : - 34 [ + + + + : 1047417 : switch (subtype) { - + + + + + + 34 [ + + + + : 1091052 : switch (subtype) { + + + + + + - ] - 35 : 5331 : case MPTCPOPT_MP_CAPABLE: + 35 : 5332 : case MPTCPOPT_MP_CAPABLE: 36 : : /* strict size checking */ - 37 [ + + ]: 5331 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) { - 38 [ + + ]: 2945 : if (skb->len > tcp_hdr(skb)->doff << 2) + 37 [ + + ]: 5332 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) { + 38 [ + + ]: 2946 : if (skb->len > tcp_hdr(skb)->doff << 2) 39 : : expected_opsize = TCPOLEN_MPTCP_MPC_ACK_DATA; 40 : : else - 41 : 2308 : expected_opsize = TCPOLEN_MPTCP_MPC_ACK; + 41 : 2309 : expected_opsize = TCPOLEN_MPTCP_MPC_ACK; 42 : : subopt = OPTION_MPTCP_MPC_ACK; 43 : : } else { 44 [ + + ]: 2386 : if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_ACK) { @@ -140,22 +140,22 @@ 60 : : * We parse even option with mismatching csum presence, so that 61 : : * later in subflow_data_ready we can trigger the reset. 62 : : */ - 63 [ + + ]: 5331 : if (opsize != expected_opsize && + 63 [ + + ]: 5332 : if (opsize != expected_opsize && 64 : 16 : (expected_opsize != TCPOLEN_MPTCP_MPC_ACK_DATA || 65 [ + + ]: 16 : opsize != TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM)) 66 : : break; 67 : : 68 : : /* try to be gentle vs future versions on the initial syn */ - 69 : 5319 : version = *ptr++ & MPTCP_VERSION_MASK; - 70 [ + + ]: 5319 : if (opsize != TCPOLEN_MPTCP_MPC_SYN) { - 71 [ + + ]: 4081 : if (version != MPTCP_SUPPORTED_VERSION) + 69 : 5320 : version = *ptr++ & MPTCP_VERSION_MASK; + 70 [ + + ]: 5320 : if (opsize != TCPOLEN_MPTCP_MPC_SYN) { + 71 [ + + ]: 4082 : if (version != MPTCP_SUPPORTED_VERSION) 72 : : break; 73 [ + - ]: 1238 : } else if (version < MPTCP_SUPPORTED_VERSION) { 74 : : break; 75 : : } 76 : : - 77 : 5313 : flags = *ptr++; - 78 [ + + + + ]: 5313 : if (!mptcp_cap_flag_sha256(flags) || + 77 : 5314 : flags = *ptr++; + 78 [ + + + + ]: 5314 : if (!mptcp_cap_flag_sha256(flags) || 79 : : (flags & MPTCP_CAP_EXTENSIBILITY)) 80 : : break; 81 : : @@ -165,21 +165,21 @@ 85 : : * In other words, the only way for checksums not to be used 86 : : * is if both hosts in their SYNs set A=0." 87 : : */ - 88 [ + + ]: 5277 : if (flags & MPTCP_CAP_CHECKSUM_REQD) + 88 [ + + ]: 5278 : if (flags & MPTCP_CAP_CHECKSUM_REQD) 89 : 40 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; 90 : : - 91 : 5277 : mp_opt->deny_join_id0 = !!(flags & MPTCP_CAP_DENY_JOIN_ID0); + 91 : 5278 : mp_opt->deny_join_id0 = !!(flags & MPTCP_CAP_DENY_JOIN_ID0); 92 : : - 93 : 5277 : mp_opt->suboptions |= subopt; - 94 [ + + ]: 5277 : if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) { - 95 [ + + ]: 4051 : mp_opt->sndr_key = get_unaligned_be64(ptr); - 96 : 4051 : ptr += 8; + 93 : 5278 : mp_opt->suboptions |= subopt; + 94 [ + + ]: 5278 : if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) { + 95 [ + + ]: 4052 : mp_opt->sndr_key = get_unaligned_be64(ptr); + 96 : 4052 : ptr += 8; 97 : : } - 98 [ + + ]: 4051 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK) { - 99 : 2927 : mp_opt->rcvr_key = get_unaligned_be64(ptr); - 100 : 2927 : ptr += 8; + 98 [ + + ]: 4052 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK) { + 99 : 2928 : mp_opt->rcvr_key = get_unaligned_be64(ptr); + 100 : 2928 : ptr += 8; 101 : : } - 102 [ + + ]: 4153 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK_DATA) { + 102 [ + + ]: 4154 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK_DATA) { 103 : : /* Section 3.1.: 104 : : * "the data parameters in a MP_CAPABLE are semantically 105 : : * equivalent to those in a DSS option and can be used @@ -196,70 +196,70 @@ 116 : 4 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; 117 : 4 : ptr += 2; 118 : : } - 119 [ - + ]: 5277 : pr_debug("MP_CAPABLE version=%x, flags=%x, optlen=%d sndr=%llu, rcvr=%llu len=%d csum=%u\n", + 119 [ - + ]: 5278 : pr_debug("MP_CAPABLE version=%x, flags=%x, optlen=%d sndr=%llu, rcvr=%llu len=%d csum=%u\n", 120 : : version, flags, opsize, mp_opt->sndr_key, 121 : : mp_opt->rcvr_key, mp_opt->data_len, mp_opt->csum); 122 : : break; 123 : : - 124 : 2052 : case MPTCPOPT_MP_JOIN: - 125 [ + + ]: 2052 : if (opsize == TCPOLEN_MPTCP_MPJ_SYN) { - 126 : 522 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYN; - 127 : 522 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; - 128 : 522 : mp_opt->join_id = *ptr++; - 129 [ - + ]: 522 : mp_opt->token = get_unaligned_be32(ptr); - 130 : 522 : ptr += 4; - 131 : 522 : mp_opt->nonce = get_unaligned_be32(ptr); - 132 : 522 : ptr += 4; - 133 [ - + ]: 522 : pr_debug("MP_JOIN bkup=%u, id=%u, token=%u, nonce=%u\n", + 124 : 2048 : case MPTCPOPT_MP_JOIN: + 125 [ + + ]: 2048 : if (opsize == TCPOLEN_MPTCP_MPJ_SYN) { + 126 : 521 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYN; + 127 : 521 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; + 128 : 521 : mp_opt->join_id = *ptr++; + 129 [ - + ]: 521 : mp_opt->token = get_unaligned_be32(ptr); + 130 : 521 : ptr += 4; + 131 : 521 : mp_opt->nonce = get_unaligned_be32(ptr); + 132 : 521 : ptr += 4; + 133 [ - + ]: 521 : pr_debug("MP_JOIN bkup=%u, id=%u, token=%u, nonce=%u\n", 134 : : mp_opt->backup, mp_opt->join_id, 135 : : mp_opt->token, mp_opt->nonce); - 136 [ + + ]: 1530 : } else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) { - 137 : 488 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYNACK; - 138 : 488 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; - 139 : 488 : mp_opt->join_id = *ptr++; - 140 [ - + ]: 488 : mp_opt->thmac = get_unaligned_be64(ptr); - 141 : 488 : ptr += 8; - 142 [ - + ]: 488 : mp_opt->nonce = get_unaligned_be32(ptr); - 143 : 488 : ptr += 4; - 144 [ - + ]: 488 : pr_debug("MP_JOIN bkup=%u, id=%u, thmac=%llu, nonce=%u\n", + 136 [ + + ]: 1527 : } else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) { + 137 : 487 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYNACK; + 138 : 487 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; + 139 : 487 : mp_opt->join_id = *ptr++; + 140 [ - + ]: 487 : mp_opt->thmac = get_unaligned_be64(ptr); + 141 : 487 : ptr += 8; + 142 [ - + ]: 487 : mp_opt->nonce = get_unaligned_be32(ptr); + 143 : 487 : ptr += 4; + 144 [ - + ]: 487 : pr_debug("MP_JOIN bkup=%u, id=%u, thmac=%llu, nonce=%u\n", 145 : : mp_opt->backup, mp_opt->join_id, 146 : : mp_opt->thmac, mp_opt->nonce); - 147 [ + - ]: 1042 : } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { - 148 : 1042 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; - 149 : 1042 : ptr += 2; - 150 : 1042 : memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); - 151 [ - + ]: 1042 : pr_debug("MP_JOIN hmac\n"); + 147 [ + - ]: 1040 : } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { + 148 : 1040 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; + 149 : 1040 : ptr += 2; + 150 : 1040 : memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); + 151 [ - + ]: 1040 : pr_debug("MP_JOIN hmac\n"); 152 : : } 153 : : break; 154 : : 155 : : case MPTCPOPT_DSS: - 156 [ - + ]: 1038676 : pr_debug("DSS\n"); - 157 : 1038676 : ptr++; + 156 [ - + ]: 1082269 : pr_debug("DSS\n"); + 157 : 1082269 : ptr++; 158 : : - 159 : 1038676 : flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; - 160 : 1038676 : mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; - 161 : 1038676 : mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; - 162 : 1038676 : mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; - 163 : 1038676 : mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; - 164 : 1038676 : mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); + 159 : 1082269 : flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; + 160 : 1082269 : mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; + 161 : 1082269 : mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; + 162 : 1082269 : mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; + 163 : 1082269 : mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; + 164 : 1082269 : mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); 165 : : - 166 [ - + ]: 1038676 : pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n", + 166 [ - + ]: 1082269 : pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n", 167 : : mp_opt->data_fin, mp_opt->dsn64, 168 : : mp_opt->use_map, mp_opt->ack64, 169 : : mp_opt->use_ack); 170 : : - 171 : 1038676 : expected_opsize = TCPOLEN_MPTCP_DSS_BASE; + 171 : 1082269 : expected_opsize = TCPOLEN_MPTCP_DSS_BASE; 172 : : - 173 [ + - ]: 1038676 : if (mp_opt->use_ack) { - 174 [ + + ]: 1038676 : if (mp_opt->ack64) + 173 [ + - ]: 1082269 : if (mp_opt->use_ack) { + 174 [ + + ]: 1082269 : if (mp_opt->ack64) 175 : : expected_opsize += TCPOLEN_MPTCP_DSS_ACK64; 176 : : else - 177 : 133987 : expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + 177 : 189557 : expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; 178 : : } 179 : : - 180 [ + + ]: 1038676 : if (mp_opt->use_map) { - 181 [ + + ]: 675395 : if (mp_opt->dsn64) - 182 : 675353 : expected_opsize += TCPOLEN_MPTCP_DSS_MAP64; + 180 [ + + ]: 1082269 : if (mp_opt->use_map) { + 181 [ + + ]: 705147 : if (mp_opt->dsn64) + 182 : 705105 : expected_opsize += TCPOLEN_MPTCP_DSS_MAP64; 183 : : else 184 : 42 : expected_opsize += TCPOLEN_MPTCP_DSS_MAP32; 185 : : } @@ -267,45 +267,45 @@ 187 : : /* Always parse any csum presence combination, we will enforce 188 : : * RFC 8684 Section 3.3.0 checks later in subflow_data_ready 189 : : */ - 190 [ + + ]: 1038676 : if (opsize != expected_opsize && - 191 [ + - ]: 1926 : opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) + 190 [ + + ]: 1082269 : if (opsize != expected_opsize && + 191 [ + - ]: 1890 : opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) 192 : : break; 193 : : - 194 : 1038676 : mp_opt->suboptions |= OPTION_MPTCP_DSS; - 195 [ + - ]: 1038676 : if (mp_opt->use_ack) { - 196 [ + + ]: 1038676 : if (mp_opt->ack64) { - 197 : 904689 : mp_opt->data_ack = get_unaligned_be64(ptr); - 198 : 904689 : ptr += 8; + 194 : 1082269 : mp_opt->suboptions |= OPTION_MPTCP_DSS; + 195 [ + - ]: 1082269 : if (mp_opt->use_ack) { + 196 [ + + ]: 1082269 : if (mp_opt->ack64) { + 197 : 892712 : mp_opt->data_ack = get_unaligned_be64(ptr); + 198 : 892712 : ptr += 8; 199 : : } else { - 200 : 133987 : mp_opt->data_ack = get_unaligned_be32(ptr); - 201 : 133987 : ptr += 4; + 200 : 189557 : mp_opt->data_ack = get_unaligned_be32(ptr); + 201 : 189557 : ptr += 4; 202 : : } 203 : : - 204 [ - + ]: 1038676 : pr_debug("data_ack=%llu\n", mp_opt->data_ack); + 204 [ - + ]: 1082269 : pr_debug("data_ack=%llu\n", mp_opt->data_ack); 205 : : } 206 : : - 207 [ + + ]: 1038676 : if (mp_opt->use_map) { - 208 [ + + ]: 675395 : if (mp_opt->dsn64) { - 209 : 675353 : mp_opt->data_seq = get_unaligned_be64(ptr); - 210 : 675353 : ptr += 8; + 207 [ + + ]: 1082269 : if (mp_opt->use_map) { + 208 [ + + ]: 705147 : if (mp_opt->dsn64) { + 209 : 705105 : mp_opt->data_seq = get_unaligned_be64(ptr); + 210 : 705105 : ptr += 8; 211 : : } else { 212 : 42 : mp_opt->data_seq = get_unaligned_be32(ptr); 213 : 42 : ptr += 4; 214 : : } 215 : : - 216 [ + + ]: 675395 : mp_opt->subflow_seq = get_unaligned_be32(ptr); - 217 : 675395 : ptr += 4; + 216 [ + + ]: 705147 : mp_opt->subflow_seq = get_unaligned_be32(ptr); + 217 : 705147 : ptr += 4; 218 : : - 219 [ + + ]: 675395 : mp_opt->data_len = get_unaligned_be16(ptr); - 220 : 675395 : ptr += 2; + 219 [ + + ]: 705147 : mp_opt->data_len = get_unaligned_be16(ptr); + 220 : 705147 : ptr += 2; 221 : : - 222 [ + + ]: 675395 : if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) { - 223 : 1926 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; - 224 : 1926 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); - 225 : 1926 : ptr += 2; + 222 [ + + ]: 705147 : if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) { + 223 : 1890 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; + 224 : 1890 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); + 225 : 1890 : ptr += 2; 226 : : } 227 : : - 228 [ - + ]: 675395 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", + 228 [ - + ]: 705147 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", 229 : : mp_opt->data_seq, mp_opt->subflow_seq, 230 : : mp_opt->data_len, !!(mp_opt->suboptions & OPTION_MPTCP_CSUMREQD), 231 : : mp_opt->csum); @@ -313,9 +313,9 @@ 233 : : 234 : : break; 235 : : - 236 : 692 : case MPTCPOPT_ADD_ADDR: - 237 : 692 : mp_opt->echo = (*ptr++) & MPTCP_ADDR_ECHO; - 238 [ + + ]: 692 : if (!mp_opt->echo) { + 236 : 691 : case MPTCPOPT_ADD_ADDR: + 237 : 691 : mp_opt->echo = (*ptr++) & MPTCP_ADDR_ECHO; + 238 [ + + ]: 691 : if (!mp_opt->echo) { 239 : 360 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR || 240 [ + + ]: 360 : opsize == TCPOLEN_MPTCP_ADD_ADDR_PORT) 241 : 280 : mp_opt->addr.family = AF_INET; @@ -327,23 +327,23 @@ 247 : : else 248 : : break; 249 : : } else { - 250 : 332 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE || - 251 [ + + ]: 332 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) + 250 : 331 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE || + 251 [ + + ]: 331 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) 252 : 258 : mp_opt->addr.family = AF_INET; 253 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 254 : 74 : else if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE || - 255 [ + - ]: 74 : opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) - 256 : 74 : mp_opt->addr.family = AF_INET6; + 254 : 73 : else if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE || + 255 [ + - ]: 73 : opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) + 256 : 73 : mp_opt->addr.family = AF_INET6; 257 : : #endif 258 : : else 259 : : break; 260 : : } 261 : : - 262 : 692 : mp_opt->suboptions |= OPTION_MPTCP_ADD_ADDR; - 263 : 692 : mp_opt->addr.id = *ptr++; - 264 : 692 : mp_opt->addr.port = 0; - 265 : 692 : mp_opt->ahmac = 0; - 266 [ + + ]: 692 : if (mp_opt->addr.family == AF_INET) { + 262 : 691 : mp_opt->suboptions |= OPTION_MPTCP_ADD_ADDR; + 263 : 691 : mp_opt->addr.id = *ptr++; + 264 : 691 : mp_opt->addr.port = 0; + 265 : 691 : mp_opt->ahmac = 0; + 266 [ + + ]: 691 : if (mp_opt->addr.family == AF_INET) { 267 : 538 : memcpy((u8 *)&mp_opt->addr.addr.s_addr, (u8 *)ptr, 4); 268 : 538 : ptr += 4; 269 : 538 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_PORT || @@ -354,20 +354,20 @@ 274 : : } 275 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 276 : : else { - 277 : 154 : memcpy(mp_opt->addr.addr6.s6_addr, (u8 *)ptr, 16); - 278 : 154 : ptr += 16; - 279 : 154 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_PORT || - 280 [ + + ]: 154 : opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) { + 277 : 153 : memcpy(mp_opt->addr.addr6.s6_addr, (u8 *)ptr, 16); + 278 : 153 : ptr += 16; + 279 : 153 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR6_PORT || + 280 [ + + ]: 153 : opsize == TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT) { 281 : 6 : mp_opt->addr.port = htons(get_unaligned_be16(ptr)); 282 : 6 : ptr += 2; 283 : : } 284 : : } 285 : : #endif - 286 [ + + ]: 692 : if (!mp_opt->echo) { + 286 [ + + ]: 691 : if (!mp_opt->echo) { 287 : 360 : mp_opt->ahmac = get_unaligned_be64(ptr); 288 : 360 : ptr += 8; 289 : : } - 290 [ - + - - ]: 692 : pr_debug("ADD_ADDR%s: id=%d, ahmac=%llu, echo=%d, port=%d\n", + 290 [ - + - - ]: 691 : pr_debug("ADD_ADDR%s: id=%d, ahmac=%llu, echo=%d, port=%d\n", 291 : : (mp_opt->addr.family == AF_INET6) ? "6" : "", 292 : : mp_opt->addr.id, mp_opt->ahmac, mp_opt->echo, ntohs(mp_opt->addr.port)); 293 : : break; @@ -395,29 +395,29 @@ 315 [ - + ]: 40 : pr_debug("MP_PRIO: prio=%d\n", mp_opt->backup); 316 : : break; 317 : : - 318 : 245 : case MPTCPOPT_MP_FASTCLOSE: - 319 [ + - ]: 245 : if (opsize != TCPOLEN_MPTCP_FASTCLOSE) + 318 : 269 : case MPTCPOPT_MP_FASTCLOSE: + 319 [ + - ]: 269 : if (opsize != TCPOLEN_MPTCP_FASTCLOSE) 320 : : break; 321 : : - 322 : 245 : ptr += 2; - 323 [ - + ]: 245 : mp_opt->rcvr_key = get_unaligned_be64(ptr); - 324 : 245 : ptr += 8; - 325 : 245 : mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE; - 326 [ - + ]: 245 : pr_debug("MP_FASTCLOSE: recv_key=%llu\n", mp_opt->rcvr_key); + 322 : 269 : ptr += 2; + 323 [ - + ]: 269 : mp_opt->rcvr_key = get_unaligned_be64(ptr); + 324 : 269 : ptr += 8; + 325 : 269 : mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE; + 326 [ - + ]: 269 : pr_debug("MP_FASTCLOSE: recv_key=%llu\n", mp_opt->rcvr_key); 327 : : break; 328 : : - 329 : 263 : case MPTCPOPT_RST: - 330 [ + - ]: 263 : if (opsize != TCPOLEN_MPTCP_RST) + 329 : 285 : case MPTCPOPT_RST: + 330 [ + - ]: 285 : if (opsize != TCPOLEN_MPTCP_RST) 331 : : break; 332 : : - 333 [ + + ]: 263 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) + 333 [ + + ]: 285 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) 334 : : break; 335 : : - 336 : 251 : mp_opt->suboptions |= OPTION_MPTCP_RST; - 337 : 251 : flags = *ptr++; - 338 : 251 : mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; - 339 : 251 : mp_opt->reset_reason = *ptr; - 340 [ - + ]: 251 : pr_debug("MP_RST: transient=%u reason=%u\n", + 336 : 273 : mp_opt->suboptions |= OPTION_MPTCP_RST; + 337 : 273 : flags = *ptr++; + 338 : 273 : mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; + 339 : 273 : mp_opt->reset_reason = *ptr; + 340 [ - + ]: 273 : pr_debug("MP_RST: transient=%u reason=%u\n", 341 : : mp_opt->reset_transient, mp_opt->reset_reason); 342 : : break; 343 : : @@ -434,99 +434,99 @@ 354 : : default: 355 : : break; 356 : : } - 357 : 1047417 : } + 357 : 1091052 : } 358 : : - 359 : 1047366 : void mptcp_get_options(const struct sk_buff *skb, + 359 : 1090968 : void mptcp_get_options(const struct sk_buff *skb, 360 : : struct mptcp_options_received *mp_opt) 361 : : { - 362 : 1047366 : const struct tcphdr *th = tcp_hdr(skb); - 363 : 1047366 : const unsigned char *ptr; - 364 : 1047366 : int length; + 362 : 1090968 : const struct tcphdr *th = tcp_hdr(skb); + 363 : 1090968 : const unsigned char *ptr; + 364 : 1090968 : int length; 365 : : 366 : : /* Ensure that casting the whole status to u32 is efficient and safe */ - 367 : 1047366 : BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); - 368 : 1047366 : BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status), + 367 : 1090968 : BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); + 368 : 1090968 : BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status), 369 : : sizeof(u32))); - 370 : 1047366 : *(u32 *)&mp_opt->status = 0; + 370 : 1090968 : *(u32 *)&mp_opt->status = 0; 371 : : - 372 : 1047366 : length = (th->doff * 4) - sizeof(struct tcphdr); - 373 : 1047366 : ptr = (const unsigned char *)(th + 1); + 372 : 1090968 : length = (th->doff * 4) - sizeof(struct tcphdr); + 373 : 1090968 : ptr = (const unsigned char *)(th + 1); 374 : : - 375 [ + + ]: 6586244 : while (length > 0) { - 376 : 5538878 : int opcode = *ptr++; - 377 : 5538878 : int opsize; + 375 [ + + ]: 6855132 : while (length > 0) { + 376 : 5764164 : int opcode = *ptr++; + 377 : 5764164 : int opsize; 378 : : - 379 [ + + - ]: 5538878 : switch (opcode) { + 379 [ + + - ]: 5764164 : switch (opcode) { 380 : : case TCPOPT_EOL: 381 : : return; - 382 : 3435794 : case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */ - 383 : 3435794 : length--; - 384 : 3435794 : continue; - 385 : 2103084 : default: - 386 [ + - ]: 2103084 : if (length < 2) + 382 : 3576758 : case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */ + 383 : 3576758 : length--; + 384 : 3576758 : continue; + 385 : 2187406 : default: + 386 [ + - ]: 2187406 : if (length < 2) 387 : : return; - 388 : 2103084 : opsize = *ptr++; - 389 [ + - ]: 2103084 : if (opsize < 2) /* "silly options" */ + 388 : 2187406 : opsize = *ptr++; + 389 [ + - ]: 2187406 : if (opsize < 2) /* "silly options" */ 390 : : return; - 391 [ + - ]: 2103084 : if (opsize > length) + 391 [ + - ]: 2187406 : if (opsize > length) 392 : : return; /* don't parse partial options */ - 393 [ + + ]: 2103084 : if (opcode == TCPOPT_MPTCP) - 394 : 1047417 : mptcp_parse_option(skb, ptr, opsize, mp_opt); - 395 : 2103084 : ptr += opsize - 2; - 396 : 2103084 : length -= opsize; + 393 [ + + ]: 2187406 : if (opcode == TCPOPT_MPTCP) + 394 : 1091052 : mptcp_parse_option(skb, ptr, opsize, mp_opt); + 395 : 2187406 : ptr += opsize - 2; + 396 : 2187406 : length -= opsize; 397 : : } 398 : : } 399 : : } 400 : : - 401 : 1883 : bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, + 401 : 1885 : bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, 402 : : unsigned int *size, struct mptcp_out_options *opts) 403 : : { - 404 [ + + ]: 1883 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 404 [ + + ]: 1885 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 405 : : 406 : : /* we will use snd_isn to detect first pkt [re]transmission 407 : : * in mptcp_established_options_mp() 408 : : */ - 409 : 1883 : subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; - 410 [ + + ]: 1883 : if (subflow->request_mptcp) { - 411 : 1288 : opts->suboptions = OPTION_MPTCP_MPC_SYN; - 412 : 1288 : opts->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk)); - 413 : 1288 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); - 414 : 1288 : *size = TCPOLEN_MPTCP_MPC_SYN; - 415 : 1288 : return true; - 416 [ + + ]: 595 : } else if (subflow->request_join) { - 417 [ - + ]: 571 : pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token, + 409 : 1885 : subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; + 410 [ + + ]: 1885 : if (subflow->request_mptcp) { + 411 : 1289 : opts->suboptions = OPTION_MPTCP_MPC_SYN; + 412 : 1289 : opts->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk)); + 413 : 1289 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); + 414 : 1289 : *size = TCPOLEN_MPTCP_MPC_SYN; + 415 : 1289 : return true; + 416 [ + + ]: 596 : } else if (subflow->request_join) { + 417 [ - + ]: 572 : pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token, 418 : : subflow->local_nonce); - 419 : 571 : opts->suboptions = OPTION_MPTCP_MPJ_SYN; - 420 : 571 : opts->join_id = subflow->local_id; - 421 : 571 : opts->token = subflow->remote_token; - 422 : 571 : opts->nonce = subflow->local_nonce; - 423 : 571 : opts->backup = subflow->request_bkup; - 424 : 571 : *size = TCPOLEN_MPTCP_MPJ_SYN; - 425 : 571 : return true; + 419 : 572 : opts->suboptions = OPTION_MPTCP_MPJ_SYN; + 420 : 572 : opts->join_id = subflow->local_id; + 421 : 572 : opts->token = subflow->remote_token; + 422 : 572 : opts->nonce = subflow->local_nonce; + 423 : 572 : opts->backup = subflow->request_bkup; + 424 : 572 : *size = TCPOLEN_MPTCP_MPJ_SYN; + 425 : 572 : return true; 426 : : } 427 : : return false; 428 : : } 429 : : - 430 : 986 : static void clear_3rdack_retransmission(struct sock *sk) + 430 : 984 : static void clear_3rdack_retransmission(struct sock *sk) 431 : : { - 432 : 986 : struct inet_connection_sock *icsk = inet_csk(sk); + 432 : 984 : struct inet_connection_sock *icsk = inet_csk(sk); 433 : : - 434 : 986 : sk_stop_timer(sk, &icsk->icsk_delack_timer); - 435 : 986 : icsk->icsk_ack.timeout = 0; - 436 : 986 : icsk->icsk_ack.ato = 0; - 437 : 986 : icsk->icsk_ack.pending &= ~(ICSK_ACK_SCHED | ICSK_ACK_TIMER); - 438 : 986 : } + 434 : 984 : sk_stop_timer(sk, &icsk->icsk_delack_timer); + 435 : 984 : icsk->icsk_ack.timeout = 0; + 436 : 984 : icsk->icsk_ack.ato = 0; + 437 : 984 : icsk->icsk_ack.pending &= ~(ICSK_ACK_SCHED | ICSK_ACK_TIMER); + 438 : 984 : } 439 : : - 440 : 2005943 : static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, + 440 : 2106481 : static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, 441 : : bool snd_data_fin_enable, 442 : : unsigned int *size, 443 : : struct mptcp_out_options *opts) 444 : : { - 445 [ - + ]: 2005943 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 446 [ - + ]: 2005943 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 447 : 2005943 : struct mptcp_ext *mpext; - 448 : 2005943 : unsigned int data_len; - 449 : 2005943 : u8 len; + 445 [ - + ]: 2106481 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 446 [ - + ]: 2106481 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 447 : 2106481 : struct mptcp_ext *mpext; + 448 : 2106481 : unsigned int data_len; + 449 : 2106481 : u8 len; 450 : : 451 : : /* When skb is not available, we better over-estimate the emitted 452 : : * options len. A full DSS option (28 bytes) is longer than @@ -534,167 +534,167 @@ 454 : : * tell the caller to defer the estimate to 455 : : * mptcp_established_options_dss(), which will reserve enough space. 456 : : */ - 457 [ + + ]: 2005943 : if (!skb) + 457 [ + + ]: 2106481 : if (!skb) 458 : : return false; 459 : : 460 : : /* MPC/MPJ needed only on 3rd ack packet, DATA_FIN and TCP shutdown take precedence */ - 461 [ + + + + : 864163 : if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable || - + + ] - 462 [ + + ]: 2757 : subflow->snd_isn != TCP_SKB_CB(skb)->seq || - 463 [ + + ]: 2219 : sk->sk_state != TCP_ESTABLISHED) + 461 [ + + + + : 876504 : if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable || + + + ] + 462 [ + + ]: 2712 : subflow->snd_isn != TCP_SKB_CB(skb)->seq || + 463 [ + + ]: 2230 : sk->sk_state != TCP_ESTABLISHED) 464 : : return false; 465 : : - 466 [ + + ]: 2219 : if (subflow->mp_capable) { - 467 [ + + ]: 1717 : mpext = mptcp_get_ext(skb); - 468 [ + + ]: 1155 : data_len = mpext ? mpext->data_len : 0; + 466 [ + + ]: 2230 : if (subflow->mp_capable) { + 467 [ + + ]: 1729 : mpext = mptcp_get_ext(skb); + 468 [ + + ]: 1167 : data_len = mpext ? mpext->data_len : 0; 469 : : 470 : : /* we will check ops->data_len in mptcp_write_options() to 471 : : * discriminate between TCPOLEN_MPTCP_MPC_ACK_DATA and 472 : : * TCPOLEN_MPTCP_MPC_ACK 473 : : */ - 474 : 1717 : opts->data_len = data_len; - 475 : 1717 : opts->suboptions = OPTION_MPTCP_MPC_ACK; - 476 : 1717 : opts->sndr_key = subflow->local_key; - 477 : 1717 : opts->rcvr_key = subflow->remote_key; - 478 [ - + ]: 1717 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); - 479 : 1717 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); + 474 : 1729 : opts->data_len = data_len; + 475 : 1729 : opts->suboptions = OPTION_MPTCP_MPC_ACK; + 476 : 1729 : opts->sndr_key = subflow->local_key; + 477 : 1729 : opts->rcvr_key = subflow->remote_key; + 478 [ - + ]: 1729 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); + 479 : 1729 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); 480 : : 481 : : /* Section 3.1. 482 : : * The MP_CAPABLE option is carried on the SYN, SYN/ACK, and ACK 483 : : * packets that start the first subflow of an MPTCP connection, 484 : : * as well as the first packet that carries data 485 : : */ - 486 [ + + ]: 1717 : if (data_len > 0) { - 487 : 593 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; - 488 [ + + ]: 593 : if (opts->csum_reqd) { + 486 [ + + ]: 1729 : if (data_len > 0) { + 487 : 604 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; + 488 [ + + ]: 604 : if (opts->csum_reqd) { 489 : : /* we need to propagate more info to csum the pseudo hdr */ 490 : 4 : opts->data_seq = mpext->data_seq; 491 : 4 : opts->subflow_seq = mpext->subflow_seq; 492 : 4 : opts->csum = mpext->csum; 493 : 4 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 494 : : } - 495 : 593 : *size = ALIGN(len, 4); + 495 : 604 : *size = ALIGN(len, 4); 496 : : } else { - 497 : 1124 : *size = TCPOLEN_MPTCP_MPC_ACK; + 497 : 1125 : *size = TCPOLEN_MPTCP_MPC_ACK; 498 : : } 499 : : - 500 [ - + ]: 1717 : pr_debug("subflow=%p, local_key=%llu, remote_key=%llu map_len=%d\n", + 500 [ - + ]: 1729 : pr_debug("subflow=%p, local_key=%llu, remote_key=%llu map_len=%d\n", 501 : : subflow, subflow->local_key, subflow->remote_key, 502 : : data_len); 503 : : - 504 : 1717 : return true; - 505 [ + + ]: 502 : } else if (subflow->mp_join) { - 506 : 502 : opts->suboptions = OPTION_MPTCP_MPJ_ACK; - 507 : 502 : memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN); - 508 : 502 : *size = TCPOLEN_MPTCP_MPJ_ACK; - 509 [ - + ]: 502 : pr_debug("subflow=%p\n", subflow); + 504 : 1729 : return true; + 505 [ + + ]: 501 : } else if (subflow->mp_join) { + 506 : 501 : opts->suboptions = OPTION_MPTCP_MPJ_ACK; + 507 : 501 : memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN); + 508 : 501 : *size = TCPOLEN_MPTCP_MPJ_ACK; + 509 [ - + ]: 501 : pr_debug("subflow=%p\n", subflow); 510 : : 511 : : /* we can use the full delegate action helper only from BH context 512 : : * If we are in process context - sk is flushing the backlog at 513 : : * socket lock release time - just set the appropriate flag, will 514 : : * be handled by the release callback 515 : : */ - 516 [ + + ]: 502 : if (sock_owned_by_user(sk)) - 517 : 417 : set_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status); + 516 [ + + ]: 501 : if (sock_owned_by_user(sk)) + 517 : 416 : set_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status); 518 : : else 519 : 85 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_ACK); - 520 : 502 : return true; + 520 : 501 : return true; 521 : : } 522 : : return false; 523 : : } 524 : : - 525 : 32198 : static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow, + 525 : 25626 : static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow, 526 : : struct sk_buff *skb, struct mptcp_ext *ext) 527 : : { 528 : : /* The write_seq value has already been incremented, so the actual 529 : : * sequence number for the DATA_FIN is one less. 530 : : */ - 531 [ - + ]: 32198 : u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; + 531 [ - + ]: 25626 : u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; 532 : : - 533 [ + + - + ]: 32198 : if (!ext->use_map || !skb->len) { + 533 [ + + - + ]: 25626 : if (!ext->use_map || !skb->len) { 534 : : /* RFC6824 requires a DSS mapping with specific values 535 : : * if DATA_FIN is set but no data payload is mapped 536 : : */ - 537 : 14787 : ext->data_fin = 1; - 538 : 14787 : ext->use_map = 1; - 539 : 14787 : ext->dsn64 = 1; - 540 : 14787 : ext->data_seq = data_fin_tx_seq; - 541 : 14787 : ext->subflow_seq = 0; - 542 : 14787 : ext->data_len = 1; - 543 [ + + ]: 17411 : } else if (ext->data_seq + ext->data_len == data_fin_tx_seq) { + 537 : 10248 : ext->data_fin = 1; + 538 : 10248 : ext->use_map = 1; + 539 : 10248 : ext->dsn64 = 1; + 540 : 10248 : ext->data_seq = data_fin_tx_seq; + 541 : 10248 : ext->subflow_seq = 0; + 542 : 10248 : ext->data_len = 1; + 543 [ + + ]: 15378 : } else if (ext->data_seq + ext->data_len == data_fin_tx_seq) { 544 : : /* If there's an existing DSS mapping and it is the 545 : : * final mapping, DATA_FIN consumes 1 additional byte of 546 : : * mapping space. 547 : : */ - 548 : 911 : ext->data_fin = 1; - 549 : 911 : ext->data_len++; + 548 : 921 : ext->data_fin = 1; + 549 : 921 : ext->data_len++; 550 : : } - 551 : 32198 : } + 551 : 25626 : } 552 : : - 553 : 2003724 : static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, + 553 : 2104251 : static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, 554 : : bool snd_data_fin_enable, 555 : : unsigned int *size, 556 : : struct mptcp_out_options *opts) 557 : : { - 558 [ - + ]: 2003724 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 559 [ - + ]: 2003724 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 560 : 2003724 : unsigned int dss_size = 0; - 561 : 2003724 : struct mptcp_ext *mpext; - 562 : 2003724 : unsigned int ack_size; - 563 : 2003724 : bool ret = false; - 564 : 2003724 : u64 ack_seq; + 558 [ - + ]: 2104251 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 559 [ - + ]: 2104251 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 560 : 2104251 : unsigned int dss_size = 0; + 561 : 2104251 : struct mptcp_ext *mpext; + 562 : 2104251 : unsigned int ack_size; + 563 : 2104251 : bool ret = false; + 564 : 2104251 : u64 ack_seq; 565 : : - 566 [ - + ]: 2003724 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); - 567 [ + + ]: 2003724 : mpext = skb ? mptcp_get_ext(skb) : NULL; + 566 [ - + ]: 2104251 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); + 567 [ + + ]: 2104251 : mpext = skb ? mptcp_get_ext(skb) : NULL; 568 : : - 569 [ + + - + : 861944 : if (!skb || (mpext && mpext->use_map) || snd_data_fin_enable) { - + + ] - 570 : 1635099 : unsigned int map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64; + 569 [ + + - + : 874274 : if (!skb || (mpext && mpext->use_map) || snd_data_fin_enable) { + + + ] + 570 : 1722030 : unsigned int map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64; 571 : : - 572 [ + + ]: 1635099 : if (mpext) { - 573 [ + + ]: 478532 : if (opts->csum_reqd) - 574 : 1759 : map_size += TCPOLEN_MPTCP_DSS_CHECKSUM; + 572 [ + + ]: 1722030 : if (mpext) { + 573 [ + + ]: 481805 : if (opts->csum_reqd) + 574 : 1595 : map_size += TCPOLEN_MPTCP_DSS_CHECKSUM; 575 : : - 576 : 478532 : opts->ext_copy = *mpext; + 576 : 481805 : opts->ext_copy = *mpext; 577 : : } 578 : : - 579 : 1635099 : dss_size = map_size; - 580 [ + + ]: 1635099 : if (skb && snd_data_fin_enable) - 581 : 32198 : mptcp_write_data_fin(subflow, skb, &opts->ext_copy); - 582 : 1635099 : opts->suboptions = OPTION_MPTCP_DSS; - 583 : 1635099 : ret = true; + 579 : 1722030 : dss_size = map_size; + 580 [ + + ]: 1722030 : if (skb && snd_data_fin_enable) + 581 : 25626 : mptcp_write_data_fin(subflow, skb, &opts->ext_copy); + 582 : 1722030 : opts->suboptions = OPTION_MPTCP_DSS; + 583 : 1722030 : ret = true; 584 : : } 585 : : 586 : : /* passive sockets msk will set the 'can_ack' after accept(), even 587 : : * if the first subflow may have the already the remote key handy 588 : : */ - 589 : 2003724 : opts->ext_copy.use_ack = 0; - 590 [ + + + + ]: 2003724 : if (!READ_ONCE(msk->can_ack)) { - 591 : 18 : *size = ALIGN(dss_size, 4); - 592 : 18 : return ret; + 589 : 2104251 : opts->ext_copy.use_ack = 0; + 590 [ + + + + ]: 2104251 : if (!READ_ONCE(msk->can_ack)) { + 591 : 19 : *size = ALIGN(dss_size, 4); + 592 : 19 : return ret; 593 : : } 594 : : - 595 : 2003706 : ack_seq = READ_ONCE(msk->ack_seq); - 596 [ + + + + ]: 2003706 : if (READ_ONCE(msk->use_64bit_ack)) { - 597 : 1560060 : ack_size = TCPOLEN_MPTCP_DSS_ACK64; - 598 : 1560060 : opts->ext_copy.data_ack = ack_seq; - 599 : 1560060 : opts->ext_copy.ack64 = 1; + 595 : 2104232 : ack_seq = READ_ONCE(msk->ack_seq); + 596 [ + + + + ]: 2104232 : if (READ_ONCE(msk->use_64bit_ack)) { + 597 : 1625657 : ack_size = TCPOLEN_MPTCP_DSS_ACK64; + 598 : 1625657 : opts->ext_copy.data_ack = ack_seq; + 599 : 1625657 : opts->ext_copy.ack64 = 1; 600 : : } else { - 601 : 443646 : ack_size = TCPOLEN_MPTCP_DSS_ACK32; - 602 : 443646 : opts->ext_copy.data_ack32 = (uint32_t)ack_seq; - 603 : 443646 : opts->ext_copy.ack64 = 0; + 601 : 478575 : ack_size = TCPOLEN_MPTCP_DSS_ACK32; + 602 : 478575 : opts->ext_copy.data_ack32 = (uint32_t)ack_seq; + 603 : 478575 : opts->ext_copy.ack64 = 0; 604 : : } - 605 : 2003706 : opts->ext_copy.use_ack = 1; - 606 : 2003706 : opts->suboptions = OPTION_MPTCP_DSS; + 605 : 2104232 : opts->ext_copy.use_ack = 1; + 606 : 2104232 : opts->suboptions = OPTION_MPTCP_DSS; 607 : : 608 : : /* Add kind/length/subtype/flag overhead if mapping is not populated */ - 609 [ + + ]: 2003706 : if (dss_size == 0) - 610 : 368625 : ack_size += TCPOLEN_MPTCP_DSS_BASE; + 609 [ + + ]: 2104232 : if (dss_size == 0) + 610 : 382221 : ack_size += TCPOLEN_MPTCP_DSS_BASE; 611 : : - 612 : 2003706 : dss_size += ack_size; + 612 : 2104232 : dss_size += ack_size; 613 : : - 614 : 2003706 : *size = ALIGN(dss_size, 4); - 615 : 2003706 : return true; + 614 : 2104232 : *size = ALIGN(dss_size, 4); + 615 : 2104232 : return true; 616 : : } 617 : : 618 : 764 : static u64 add_addr_generate_hmac(u64 key1, u64 key2, @@ -724,83 +724,83 @@ 642 : 764 : return get_unaligned_be64(&hmac[SHA256_DIGEST_SIZE - sizeof(u64)]); 643 : : } 644 : : - 645 : 2005939 : static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *skb, + 645 : 2106477 : static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *skb, 646 : : unsigned int *size, 647 : : unsigned int remaining, 648 : : struct mptcp_out_options *opts) 649 : : { - 650 [ - + ]: 2005939 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 651 [ - + ]: 2005939 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 652 : 2005939 : bool drop_other_suboptions = false; - 653 : 2005939 : unsigned int opt_size = *size; - 654 : 2005939 : bool echo; - 655 : 2005939 : int len; + 650 [ - + ]: 2106477 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 651 [ - + ]: 2106477 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 652 : 2106477 : bool drop_other_suboptions = false; + 653 : 2106477 : unsigned int opt_size = *size; + 654 : 2106477 : bool echo; + 655 : 2106477 : int len; 656 : : 657 : : /* add addr will strip the existing options, be sure to avoid breaking 658 : : * MPC/MPJ handshakes 659 : : */ - 660 [ + + ]: 2005939 : if (!mptcp_pm_should_add_signal(msk) || - 661 [ + - - + ]: 1512 : (opts->suboptions & (OPTION_MPTCP_MPJ_ACK | OPTION_MPTCP_MPC_ACK)) || - 662 : 756 : !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, &opts->addr, + 660 [ + + ]: 2106477 : if (!mptcp_pm_should_add_signal(msk) || + 661 [ + - - + ]: 1510 : (opts->suboptions & (OPTION_MPTCP_MPJ_ACK | OPTION_MPTCP_MPC_ACK)) || + 662 : 755 : !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, &opts->addr, 663 : : &echo, &drop_other_suboptions)) - 664 : 2005183 : return false; + 664 : 2105722 : return false; 665 : : 666 : : /* 667 : : * Later on, mptcp_write_options() will enforce mutually exclusion with 668 : : * DSS, bail out if such option is set and we can't drop it. 669 : : */ - 670 [ + + + - ]: 756 : if (drop_other_suboptions) - 671 : 756 : remaining += opt_size; + 670 [ + + + - ]: 755 : if (drop_other_suboptions) + 671 : 755 : remaining += opt_size; 672 [ # # ]: 0 : else if (opts->suboptions & OPTION_MPTCP_DSS) 673 : : return false; 674 : : - 675 [ + + + + ]: 756 : len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port); - 676 [ - + ]: 756 : if (remaining < len) + 675 [ + + + + ]: 755 : len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port); + 676 [ - + ]: 755 : if (remaining < len) 677 : : return false; 678 : : - 679 : 756 : *size = len; - 680 [ + + + - ]: 756 : if (drop_other_suboptions) { - 681 [ - + ]: 756 : pr_debug("drop other suboptions\n"); - 682 : 756 : opts->suboptions = 0; + 679 : 755 : *size = len; + 680 [ + + + - ]: 755 : if (drop_other_suboptions) { + 681 [ - + ]: 755 : pr_debug("drop other suboptions\n"); + 682 : 755 : opts->suboptions = 0; 683 : : 684 : : /* note that e.g. DSS could have written into the memory 685 : : * aliased by ahmac, we must reset the field here 686 : : * to avoid appending the hmac even for ADD_ADDR echo 687 : : * options 688 : : */ - 689 : 756 : opts->ahmac = 0; - 690 : 756 : *size -= opt_size; + 689 : 755 : opts->ahmac = 0; + 690 : 755 : *size -= opt_size; 691 : : } - 692 : 756 : opts->suboptions |= OPTION_MPTCP_ADD_ADDR; - 693 [ + + + + ]: 756 : if (!echo) { + 692 : 755 : opts->suboptions |= OPTION_MPTCP_ADD_ADDR; + 693 [ + + + + ]: 755 : if (!echo) { 694 [ + - ]: 404 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDRTX); 695 : 404 : opts->ahmac = add_addr_generate_hmac(READ_ONCE(msk->local_key), 696 : 404 : READ_ONCE(msk->remote_key), 697 : : &opts->addr); 698 : : } else { - 699 [ + - ]: 352 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); + 699 [ + - ]: 351 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); 700 : : } - 701 [ - + - - ]: 756 : pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d\n", + 701 [ - + - - ]: 755 : pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d\n", 702 : : opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port)); 703 : : 704 : : return true; 705 : : } 706 : : - 707 : 2005183 : static bool mptcp_established_options_rm_addr(struct sock *sk, + 707 : 2105722 : static bool mptcp_established_options_rm_addr(struct sock *sk, 708 : : unsigned int *size, 709 : : unsigned int remaining, 710 : : struct mptcp_out_options *opts) 711 : : { - 712 [ - + ]: 2005183 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 713 [ - + ]: 2005183 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 714 : 2005183 : struct mptcp_rm_list rm_list; - 715 : 2005183 : int i, len; + 712 [ - + ]: 2105722 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 713 [ - + ]: 2105722 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 714 : 2105722 : struct mptcp_rm_list rm_list; + 715 : 2105722 : int i, len; 716 : : - 717 [ + + - + ]: 2005289 : if (!mptcp_pm_should_rm_signal(msk) || + 717 [ + + - + ]: 2105828 : if (!mptcp_pm_should_rm_signal(msk) || 718 : 106 : !(mptcp_pm_rm_addr_signal(msk, remaining, &rm_list))) - 719 : 2005077 : return false; + 719 : 2105616 : return false; 720 : : - 721 [ - + ]: 408668 : len = mptcp_rm_addr_len(&rm_list); + 721 [ - + ]: 403907 : len = mptcp_rm_addr_len(&rm_list); 722 : 106 : if (len < 0) 723 : : return false; 724 [ - + ]: 106 : if (remaining < len) @@ -816,17 +816,17 @@ 734 : 106 : return true; 735 : : } 736 : : - 737 : 2005939 : static bool mptcp_established_options_mp_prio(struct sock *sk, + 737 : 2106477 : static bool mptcp_established_options_mp_prio(struct sock *sk, 738 : : unsigned int *size, 739 : : unsigned int remaining, 740 : : struct mptcp_out_options *opts) 741 : : { - 742 [ + + ]: 2005939 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 742 [ + + ]: 2106477 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 743 : : 744 : : /* can't send MP_PRIO with MPC, as they share the same option space: 745 : : * 'backup'. Also it makes no sense at all 746 : : */ - 747 [ + + + - ]: 2005939 : if (!subflow->send_mp_prio || (opts->suboptions & OPTIONS_MPTCP_MPC)) + 747 [ + + + - ]: 2106477 : if (!subflow->send_mp_prio || (opts->suboptions & OPTIONS_MPTCP_MPC)) 748 : : return false; 749 : : 750 : : /* account for the trailing 'nop' option */ @@ -842,56 +842,56 @@ 760 : : return true; 761 : : } 762 : : - 763 : 437 : static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_buff *skb, + 763 : 459 : static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_buff *skb, 764 : : unsigned int *size, 765 : : unsigned int remaining, 766 : : struct mptcp_out_options *opts) 767 : : { - 768 [ + - ]: 437 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 768 [ + - ]: 459 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 769 : : - 770 [ + - ]: 437 : if (remaining < TCPOLEN_MPTCP_RST) + 770 [ + - ]: 459 : if (remaining < TCPOLEN_MPTCP_RST) 771 : : return false; 772 : : - 773 : 437 : *size = TCPOLEN_MPTCP_RST; - 774 : 437 : opts->suboptions |= OPTION_MPTCP_RST; - 775 : 437 : opts->reset_transient = subflow->reset_transient; - 776 : 437 : opts->reset_reason = subflow->reset_reason; - 777 [ + - ]: 437 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX); + 773 : 459 : *size = TCPOLEN_MPTCP_RST; + 774 : 459 : opts->suboptions |= OPTION_MPTCP_RST; + 775 : 459 : opts->reset_transient = subflow->reset_transient; + 776 : 459 : opts->reset_reason = subflow->reset_reason; + 777 [ + - ]: 459 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX); 778 : : 779 : : return true; 780 : : } 781 : : - 782 : 437 : static bool mptcp_established_options_fastclose(struct sock *sk, + 782 : 459 : static bool mptcp_established_options_fastclose(struct sock *sk, 783 : : unsigned int *size, 784 : : unsigned int remaining, 785 : : struct mptcp_out_options *opts) 786 : : { - 787 [ - + ]: 437 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 788 [ - + ]: 437 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 787 [ - + ]: 459 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 788 [ - + ]: 459 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 789 : : - 790 [ + + ]: 437 : if (likely(!subflow->send_fastclose)) + 790 [ + + ]: 459 : if (likely(!subflow->send_fastclose)) 791 : : return false; 792 : : - 793 [ + - ]: 378 : if (remaining < TCPOLEN_MPTCP_FASTCLOSE) + 793 [ + - ]: 401 : if (remaining < TCPOLEN_MPTCP_FASTCLOSE) 794 : : return false; 795 : : - 796 : 378 : *size = TCPOLEN_MPTCP_FASTCLOSE; - 797 : 378 : opts->suboptions |= OPTION_MPTCP_FASTCLOSE; - 798 : 378 : opts->rcvr_key = READ_ONCE(msk->remote_key); + 796 : 401 : *size = TCPOLEN_MPTCP_FASTCLOSE; + 797 : 401 : opts->suboptions |= OPTION_MPTCP_FASTCLOSE; + 798 : 401 : opts->rcvr_key = READ_ONCE(msk->remote_key); 799 : : - 800 [ - + ]: 378 : pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key); - 801 [ + - ]: 378 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); + 800 [ - + ]: 401 : pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key); + 801 [ + - ]: 401 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); 802 : : return true; 803 : : } 804 : : - 805 : 2003783 : static bool mptcp_established_options_mp_fail(struct sock *sk, + 805 : 2104309 : static bool mptcp_established_options_mp_fail(struct sock *sk, 806 : : unsigned int *size, 807 : : unsigned int remaining, 808 : : struct mptcp_out_options *opts) 809 : : { - 810 [ + + ]: 2003783 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 810 [ + + ]: 2104309 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 811 : : - 812 [ + + ]: 2003783 : if (likely(!subflow->send_mp_fail)) + 812 [ + + ]: 2104309 : if (likely(!subflow->send_mp_fail)) 813 : : return false; 814 : : 815 [ + - ]: 6 : if (remaining < TCPOLEN_MPTCP_FAIL) @@ -907,43 +907,43 @@ 825 : : return true; 826 : : } 827 : : - 828 : 2055639 : bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, + 828 : 2163456 : bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, 829 : : unsigned int *size, unsigned int remaining, 830 : : struct mptcp_out_options *opts) 831 : : { - 832 [ - + ]: 2055639 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 833 [ - + ]: 2055639 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 834 : 2055639 : unsigned int opt_size = 0; - 835 : 2055639 : bool snd_data_fin; - 836 : 2055639 : bool ret = false; + 832 [ - + ]: 2163456 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 833 [ - + ]: 2163456 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 834 : 2163456 : unsigned int opt_size = 0; + 835 : 2163456 : bool snd_data_fin; + 836 : 2163456 : bool ret = false; 837 : : - 838 : 2055639 : opts->suboptions = 0; + 838 : 2163456 : opts->suboptions = 0; 839 : : - 840 [ + + + + ]: 2055639 : if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) + 840 [ + + + + ]: 2163456 : if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) 841 : : return false; 842 : : - 843 [ + + + + ]: 2006380 : if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { - 844 [ + + + + ]: 496 : if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) || - 845 : 59 : mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { - 846 : 380 : *size += opt_size; - 847 : 380 : remaining -= opt_size; + 843 [ + + + + ]: 2106940 : if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { + 844 [ + + + + ]: 517 : if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) || + 845 : 58 : mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { + 846 : 403 : *size += opt_size; + 847 : 403 : remaining -= opt_size; 848 : : } 849 : : /* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ - 850 [ + - ]: 437 : if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { - 851 : 437 : *size += opt_size; - 852 : 437 : remaining -= opt_size; + 850 [ + - ]: 459 : if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { + 851 : 459 : *size += opt_size; + 852 : 459 : remaining -= opt_size; 853 : : } - 854 : 437 : return true; + 854 : 459 : return true; 855 : : } 856 : : - 857 [ + + ]: 2005943 : snd_data_fin = mptcp_data_fin_enabled(msk); - 858 [ + + ]: 2005943 : if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, opts)) + 857 [ + + ]: 2106481 : snd_data_fin = mptcp_data_fin_enabled(msk); + 858 [ + + ]: 2106481 : if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, opts)) 859 : : ret = true; - 860 [ + - ]: 2003724 : else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, opts)) { - 861 : 2003724 : unsigned int mp_fail_size; + 860 [ + - ]: 2104251 : else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, opts)) { + 861 : 2104251 : unsigned int mp_fail_size; 862 : : - 863 : 2003724 : ret = true; - 864 [ + + ]: 2003724 : if (mptcp_established_options_mp_fail(sk, &mp_fail_size, + 863 : 2104251 : ret = true; + 864 [ + + ]: 2104251 : if (mptcp_established_options_mp_fail(sk, &mp_fail_size, 865 : : remaining - opt_size, opts)) { 866 : 4 : *size += opt_size + mp_fail_size; 867 : 4 : remaining -= opt_size - mp_fail_size; @@ -954,22 +954,22 @@ 872 : : /* we reserved enough space for the above options, and exceeding the 873 : : * TCP option space would be fatal 874 : : */ - 875 [ - + - + ]: 2005939 : if (WARN_ON_ONCE(opt_size > remaining)) + 875 [ - + - + ]: 2106477 : if (WARN_ON_ONCE(opt_size > remaining)) 876 : : return false; 877 : : - 878 : 2005939 : *size += opt_size; - 879 : 2005939 : remaining -= opt_size; - 880 [ + + ]: 2005939 : if (mptcp_established_options_add_addr(sk, skb, &opt_size, remaining, opts)) { - 881 : 756 : *size += opt_size; - 882 : 756 : remaining -= opt_size; - 883 : 756 : ret = true; - 884 [ + + ]: 2005183 : } else if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) { + 878 : 2106477 : *size += opt_size; + 879 : 2106477 : remaining -= opt_size; + 880 [ + + ]: 2106477 : if (mptcp_established_options_add_addr(sk, skb, &opt_size, remaining, opts)) { + 881 : 755 : *size += opt_size; + 882 : 755 : remaining -= opt_size; + 883 : 755 : ret = true; + 884 [ + + ]: 2105722 : } else if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) { 885 : 106 : *size += opt_size; 886 : 106 : remaining -= opt_size; 887 : 106 : ret = true; 888 : : } 889 : : - 890 [ + + ]: 2005939 : if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) { + 890 [ + + ]: 2106477 : if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) { 891 : 28 : *size += opt_size; 892 : 28 : remaining -= opt_size; 893 : 28 : ret = true; @@ -978,36 +978,36 @@ 896 : : return ret; 897 : : } 898 : : - 899 : 1780 : bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, + 899 : 1781 : bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, 900 : : struct mptcp_out_options *opts) 901 : : { - 902 : 1780 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 902 : 1781 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 903 : : - 904 [ + + ]: 1780 : if (subflow_req->mp_capable) { - 905 : 1186 : opts->suboptions = OPTION_MPTCP_MPC_SYNACK; - 906 : 1186 : opts->sndr_key = subflow_req->local_key; - 907 : 1186 : opts->csum_reqd = subflow_req->csum_reqd; - 908 : 1186 : opts->allow_join_id0 = subflow_req->allow_join_id0; - 909 : 1186 : *size = TCPOLEN_MPTCP_MPC_SYNACK; - 910 [ - + ]: 1186 : pr_debug("subflow_req=%p, local_key=%llu\n", + 904 [ + + ]: 1781 : if (subflow_req->mp_capable) { + 905 : 1188 : opts->suboptions = OPTION_MPTCP_MPC_SYNACK; + 906 : 1188 : opts->sndr_key = subflow_req->local_key; + 907 : 1188 : opts->csum_reqd = subflow_req->csum_reqd; + 908 : 1188 : opts->allow_join_id0 = subflow_req->allow_join_id0; + 909 : 1188 : *size = TCPOLEN_MPTCP_MPC_SYNACK; + 910 [ - + ]: 1188 : pr_debug("subflow_req=%p, local_key=%llu\n", 911 : : subflow_req, subflow_req->local_key); - 912 : 1186 : return true; - 913 [ + + ]: 594 : } else if (subflow_req->mp_join) { - 914 : 518 : opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; - 915 : 518 : opts->backup = subflow_req->request_bkup; - 916 : 518 : opts->join_id = subflow_req->local_id; - 917 : 518 : opts->thmac = subflow_req->thmac; - 918 : 518 : opts->nonce = subflow_req->local_nonce; - 919 [ - + ]: 518 : pr_debug("req=%p, bkup=%u, id=%u, thmac=%llu, nonce=%u\n", + 912 : 1188 : return true; + 913 [ + + ]: 593 : } else if (subflow_req->mp_join) { + 914 : 517 : opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; + 915 : 517 : opts->backup = subflow_req->request_bkup; + 916 : 517 : opts->join_id = subflow_req->local_id; + 917 : 517 : opts->thmac = subflow_req->thmac; + 918 : 517 : opts->nonce = subflow_req->local_nonce; + 919 [ - + ]: 517 : pr_debug("req=%p, bkup=%u, id=%u, thmac=%llu, nonce=%u\n", 920 : : subflow_req, opts->backup, opts->join_id, 921 : : opts->thmac, opts->nonce); - 922 : 518 : *size = TCPOLEN_MPTCP_MPJ_SYNACK; - 923 : 518 : return true; + 922 : 517 : *size = TCPOLEN_MPTCP_MPJ_SYNACK; + 923 : 517 : return true; 924 : : } 925 : : return false; 926 : : } 927 : : - 928 : 1042136 : static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, + 928 : 1085741 : static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, 929 : : struct mptcp_subflow_context *subflow, 930 : : struct sk_buff *skb, 931 : : struct mptcp_options_received *mp_opt) @@ -1015,17 +1015,17 @@ 933 : : /* here we can process OoO, in-window pkts, only in-sequence 4th ack 934 : : * will make the subflow fully established 935 : : */ - 936 [ + + + + ]: 1042136 : if (likely(READ_ONCE(subflow->fully_established))) { + 936 [ + + + + ]: 1085741 : if (likely(READ_ONCE(subflow->fully_established))) { 937 : : /* on passive sockets, check for 3rd ack retransmission 938 : : * note that msk is always set by subflow_syn_recv_sock() 939 : : * for mp_join subflows 940 : : */ - 941 [ + + ]: 1040488 : if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 && - 942 [ + + + + ]: 131730 : TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq && - 943 [ + + ]: 70799 : subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) && - 944 [ + - ]: 508 : !subflow->request_join) - 945 : 508 : tcp_send_ack(ssk); - 946 : 1040488 : goto check_notify; + 941 [ + + ]: 1084107 : if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 && + 942 [ + + + + ]: 142732 : TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq && + 943 [ + + ]: 73127 : subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) && + 944 [ + - ]: 507 : !subflow->request_join) + 945 : 507 : tcp_send_ack(ssk); + 946 : 1084107 : goto check_notify; 947 : : } 948 : : 949 : : /* we must process OoO packets before the first subflow is fully @@ -1033,23 +1033,23 @@ 951 : : * for MP_JOIN subflows as the peer must not send any data 952 : : * before receiving the forth ack - cfr. RFC 8684 section 3.2. 953 : : */ - 954 [ + + ]: 1648 : if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1) { - 955 [ - + ]: 64 : if (subflow->mp_join) + 954 [ + + ]: 1634 : if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1) { + 955 [ - + ]: 51 : if (subflow->mp_join) 956 : 0 : goto reset; - 957 [ - + - - ]: 64 : if (subflow->is_mptfo && mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) + 957 [ - + - - ]: 51 : if (subflow->is_mptfo && mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) 958 : 0 : goto set_fully_established; - 959 : 64 : return subflow->mp_capable; + 959 : 51 : return subflow->mp_capable; 960 : : } 961 : : - 962 [ + + ]: 1584 : if (subflow->remote_key_valid && - 963 [ + + - + : 1558 : (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) || - + + ] - 964 : 143 : ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && - 965 [ + + + - ]: 143 : (!mp_opt->echo || subflow->mp_join)))) { + 962 [ + + ]: 1583 : if (subflow->remote_key_valid && + 963 [ + + - + : 1557 : (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) || + + + ] + 964 : 138 : ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && + 965 [ + + + - ]: 138 : (!mp_opt->echo || subflow->mp_join)))) { 966 : : /* subflows are fully established as soon as we get any 967 : : * additional ack, including ADD_ADDR. 968 : : */ - 969 : 1550 : goto set_fully_established; + 969 : 1549 : goto set_fully_established; 970 : : } 971 : : 972 : : /* If the first established packet does not contain MP_CAPABLE + data @@ -1073,23 +1073,23 @@ 990 [ # # # # ]: 0 : WARN_ONCE(1, "bogus mpc option on established client sk"); 991 : : 992 : 26 : set_fully_established: - 993 : 1576 : mptcp_data_lock((struct sock *)msk); - 994 : 1576 : __mptcp_subflow_fully_established(msk, subflow, mp_opt); - 995 : 1576 : mptcp_data_unlock((struct sock *)msk); + 993 : 1575 : mptcp_data_lock((struct sock *)msk); + 994 : 1575 : __mptcp_subflow_fully_established(msk, subflow, mp_opt); + 995 : 1575 : mptcp_data_unlock((struct sock *)msk); 996 : : - 997 : 1042064 : check_notify: + 997 : 1085682 : check_notify: 998 : : /* if the subflow is not already linked into the conn_list, we can't 999 : : * notify the PM: this subflow is still on the listener queue 1000 : : * and the PM possibly acquiring the subflow lock could race with 1001 : : * the listener close 1002 : : */ - 1003 [ + + + - ]: 1042064 : if (likely(subflow->pm_notified) || list_empty(&subflow->node)) + 1003 [ + + + - ]: 1085682 : if (likely(subflow->pm_notified) || list_empty(&subflow->node)) 1004 : : return true; 1005 : : - 1006 : 2082 : subflow->pm_notified = 1; - 1007 [ + + ]: 2082 : if (subflow->mp_join) { - 1008 : 986 : clear_3rdack_retransmission(ssk); - 1009 : 986 : mptcp_pm_subflow_established(msk); + 1006 : 2080 : subflow->pm_notified = 1; + 1007 [ + + ]: 2080 : if (subflow->mp_join) { + 1008 : 984 : clear_3rdack_retransmission(ssk); + 1009 : 984 : mptcp_pm_subflow_established(msk); 1010 : : } else { 1011 : 1096 : mptcp_pm_fully_established(msk, ssk); 1012 : : } @@ -1100,93 +1100,93 @@ 1017 : 8 : return false; 1018 : : } 1019 : : - 1020 : 134029 : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq) + 1020 : 189599 : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq) 1021 : : { - 1022 : 134029 : u32 old_seq32, cur_seq32; + 1022 : 189599 : u32 old_seq32, cur_seq32; 1023 : : - 1024 : 134029 : old_seq32 = (u32)old_seq; - 1025 : 134029 : cur_seq32 = (u32)cur_seq; - 1026 : 134029 : cur_seq = (old_seq & GENMASK_ULL(63, 32)) + cur_seq32; - 1027 [ - + - - ]: 134029 : if (unlikely(cur_seq32 < old_seq32 && before(old_seq32, cur_seq32))) + 1024 : 189599 : old_seq32 = (u32)old_seq; + 1025 : 189599 : cur_seq32 = (u32)cur_seq; + 1026 : 189599 : cur_seq = (old_seq & GENMASK_ULL(63, 32)) + cur_seq32; + 1027 [ + + - + ]: 189599 : if (unlikely(cur_seq32 < old_seq32 && before(old_seq32, cur_seq32))) 1028 : 0 : return cur_seq + (1LL << 32); 1029 : : 1030 : : /* reverse wrap could happen, too */ - 1031 [ + + - + ]: 134029 : if (unlikely(cur_seq32 > old_seq32 && after(old_seq32, cur_seq32))) + 1031 [ + + - + ]: 189599 : if (unlikely(cur_seq32 > old_seq32 && after(old_seq32, cur_seq32))) 1032 : 0 : return cur_seq - (1LL << 32); 1033 : : return cur_seq; 1034 : : } 1035 : : 1036 : 0 : static void __mptcp_snd_una_update(struct mptcp_sock *msk, u64 new_snd_una) 1037 : : { - 1038 : 242802 : msk->bytes_acked += new_snd_una - msk->snd_una; - 1039 : 242802 : WRITE_ONCE(msk->snd_una, new_snd_una); + 1038 : 253273 : msk->bytes_acked += new_snd_una - msk->snd_una; + 1039 : 253273 : WRITE_ONCE(msk->snd_una, new_snd_una); 1040 : : } 1041 : : - 1042 : 1038676 : static void ack_update_msk(struct mptcp_sock *msk, + 1042 : 1082269 : static void ack_update_msk(struct mptcp_sock *msk, 1043 : : struct sock *ssk, 1044 : : struct mptcp_options_received *mp_opt) 1045 : : { - 1046 : 1038676 : u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt); - 1047 : 1038676 : struct sock *sk = (struct sock *)msk; - 1048 : 1038676 : u64 old_snd_una; + 1046 : 1082269 : u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt); + 1047 : 1082269 : struct sock *sk = (struct sock *)msk; + 1048 : 1082269 : u64 old_snd_una; 1049 : : - 1050 : 1038676 : mptcp_data_lock(sk); + 1050 : 1082269 : mptcp_data_lock(sk); 1051 : : 1052 : : /* avoid ack expansion on update conflict, to reduce the risk of 1053 : : * wrongly expanding to a future ack sequence number, which is way 1054 : : * more dangerous than missing an ack 1055 : : */ - 1056 : 1038676 : old_snd_una = msk->snd_una; - 1057 [ + + ]: 1038676 : new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64); + 1056 : 1082269 : old_snd_una = msk->snd_una; + 1057 [ + + ]: 1082269 : new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64); 1058 : : 1059 : : /* ACK for data not even sent yet? Ignore.*/ - 1060 [ + + ]: 1038676 : if (unlikely(after64(new_snd_una, snd_nxt))) - 1061 : 41 : new_snd_una = old_snd_una; + 1060 [ + + ]: 1082269 : if (unlikely(after64(new_snd_una, snd_nxt))) + 1061 : 40 : new_snd_una = old_snd_una; 1062 : : - 1063 [ - + ]: 1038676 : new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd; + 1063 [ - + ]: 1082269 : new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd; 1064 : : - 1065 [ + + ]: 1038676 : if (after64(new_wnd_end, msk->wnd_end)) - 1066 : 282940 : WRITE_ONCE(msk->wnd_end, new_wnd_end); + 1065 [ + + ]: 1082269 : if (after64(new_wnd_end, msk->wnd_end)) + 1066 : 294024 : WRITE_ONCE(msk->wnd_end, new_wnd_end); 1067 : : 1068 : : /* this assumes mptcp_incoming_options() is invoked after tcp_ack() */ - 1069 [ + + ]: 1038676 : if (after64(msk->wnd_end, snd_nxt)) - 1070 : 1000884 : __mptcp_check_push(sk, ssk); + 1069 [ + + ]: 1082269 : if (after64(msk->wnd_end, snd_nxt)) + 1070 : 987303 : __mptcp_check_push(sk, ssk); 1071 : : - 1072 [ + + ]: 1038676 : if (after64(new_snd_una, old_snd_una)) { - 1073 : 266752 : __mptcp_snd_una_update(msk, new_snd_una); - 1074 : 266752 : __mptcp_data_acked(sk); + 1072 [ + + ]: 1082269 : if (after64(new_snd_una, old_snd_una)) { + 1073 : 275304 : __mptcp_snd_una_update(msk, new_snd_una); + 1074 : 275304 : __mptcp_data_acked(sk); 1075 : : } - 1076 : 1038676 : msk->last_ack_recv = tcp_jiffies32; - 1077 : 1038676 : mptcp_data_unlock(sk); + 1076 : 1082269 : msk->last_ack_recv = tcp_jiffies32; + 1077 : 1082269 : mptcp_data_unlock(sk); 1078 : : - 1079 : 1038676 : trace_ack_update_msk(mp_opt->data_ack, + 1079 : 1082269 : trace_ack_update_msk(mp_opt->data_ack, 1080 : : old_snd_una, new_snd_una, - 1081 : 1038676 : new_wnd_end, READ_ONCE(msk->wnd_end)); - 1082 : 1038676 : } + 1081 : 1082269 : new_wnd_end, READ_ONCE(msk->wnd_end)); + 1082 : 1082269 : } 1083 : : - 1084 : 14591 : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit) + 1084 : 10033 : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit) 1085 : : { 1086 : : /* Skip if DATA_FIN was already received. 1087 : : * If updating simultaneously with the recvmsg loop, values 1088 : : * should match. If they mismatch, the peer is misbehaving and 1089 : : * we will prefer the most recent information. 1090 : : */ - 1091 [ + + + + ]: 14591 : if (READ_ONCE(msk->rcv_data_fin)) + 1091 [ + + + + ]: 10033 : if (READ_ONCE(msk->rcv_data_fin)) 1092 : : return false; 1093 : : - 1094 [ + + ]: 2203 : WRITE_ONCE(msk->rcv_data_fin_seq, + 1094 [ + + ]: 2202 : WRITE_ONCE(msk->rcv_data_fin_seq, 1095 : : mptcp_expand_seq(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit)); - 1096 : 2203 : WRITE_ONCE(msk->rcv_data_fin, 1); + 1096 : 2202 : WRITE_ONCE(msk->rcv_data_fin, 1); 1097 : : - 1098 : 2203 : return true; + 1098 : 2202 : return true; 1099 : : } 1100 : : - 1101 : 692 : static bool add_addr_hmac_valid(struct mptcp_sock *msk, + 1101 : 691 : static bool add_addr_hmac_valid(struct mptcp_sock *msk, 1102 : : struct mptcp_options_received *mp_opt) 1103 : : { - 1104 : 692 : u64 hmac = 0; + 1104 : 691 : u64 hmac = 0; 1105 : : - 1106 [ + + ]: 692 : if (mp_opt->echo) + 1106 [ + + ]: 691 : if (mp_opt->echo) 1107 : : return true; 1108 : : 1109 : 360 : hmac = add_addr_generate_hmac(READ_ONCE(msk->remote_key), @@ -1200,116 +1200,116 @@ 1117 : : } 1118 : : 1119 : : /* Return false if a subflow has been reset, else return true */ - 1120 : 1052718 : bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) + 1120 : 1099162 : bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) 1121 : : { - 1122 [ - + ]: 1052718 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1123 [ - + ]: 1052718 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 1124 : 1052718 : struct mptcp_options_received mp_opt; - 1125 : 1052718 : struct mptcp_ext *mpext; + 1122 [ - + ]: 1099162 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1123 [ - + ]: 1099162 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1124 : 1099162 : struct mptcp_options_received mp_opt; + 1125 : 1099162 : struct mptcp_ext *mpext; 1126 : : - 1127 [ + + ]: 1052718 : if (__mptcp_check_fallback(msk)) { + 1127 [ + + ]: 1099162 : if (__mptcp_check_fallback(msk)) { 1128 : : /* Keep it simple and unconditionally trigger send data cleanup and 1129 : : * pending queue spooling. We will need to acquire the data lock 1130 : : * for more accurate checks, and once the lock is acquired, such 1131 : : * helpers are cheap. 1132 : : */ - 1133 : 10582 : mptcp_data_lock(subflow->conn); - 1134 [ + + ]: 10582 : if (sk_stream_memory_free(sk)) - 1135 : 10521 : __mptcp_check_push(subflow->conn, sk); + 1133 : 13421 : mptcp_data_lock(subflow->conn); + 1134 [ + + ]: 13421 : if (sk_stream_memory_free(sk)) + 1135 : 13283 : __mptcp_check_push(subflow->conn, sk); 1136 : : 1137 : : /* on fallback we just need to ignore the msk-level snd_una, as 1138 : : * this is really plain TCP 1139 : : */ - 1140 : 10582 : __mptcp_snd_una_update(msk, READ_ONCE(msk->snd_nxt)); + 1140 : 13421 : __mptcp_snd_una_update(msk, READ_ONCE(msk->snd_nxt)); 1141 : : - 1142 : 10582 : __mptcp_data_acked(subflow->conn); - 1143 : 10582 : mptcp_data_unlock(subflow->conn); - 1144 : 10582 : return true; + 1142 : 13421 : __mptcp_data_acked(subflow->conn); + 1143 : 13421 : mptcp_data_unlock(subflow->conn); + 1144 : 13421 : return true; 1145 : : } 1146 : : - 1147 : 1042136 : mptcp_get_options(skb, &mp_opt); + 1147 : 1085741 : mptcp_get_options(skb, &mp_opt); 1148 : : 1149 : : /* The subflow can be in close state only if check_fully_established() 1150 : : * just sent a reset. If so, tell the caller to ignore the current packet. 1151 : : */ - 1152 [ + + ]: 1042136 : if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) - 1153 : 51 : return sk->sk_state != TCP_CLOSE; + 1152 [ + + ]: 1085741 : if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) + 1153 : 53 : return sk->sk_state != TCP_CLOSE; 1154 : : - 1155 [ + + ]: 1042085 : if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) { - 1156 [ + + ]: 5507 : if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && - 1157 [ + + ]: 245 : READ_ONCE(msk->local_key) == mp_opt.rcvr_key) { - 1158 : 235 : WRITE_ONCE(msk->rcv_fastclose, true); - 1159 : 235 : mptcp_schedule_work((struct sock *)msk); - 1160 [ + - ]: 235 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX); + 1155 [ + + ]: 1085688 : if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) { + 1156 [ + + ]: 5481 : if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && + 1157 [ + + ]: 269 : READ_ONCE(msk->local_key) == mp_opt.rcvr_key) { + 1158 : 259 : WRITE_ONCE(msk->rcv_fastclose, true); + 1159 : 259 : mptcp_schedule_work((struct sock *)msk); + 1160 [ + - ]: 259 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX); 1161 : : } 1162 : : - 1163 [ + + + - ]: 6199 : if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) && - 1164 : 692 : add_addr_hmac_valid(msk, &mp_opt)) { - 1165 [ + + ]: 692 : if (!mp_opt.echo) { + 1163 [ + + + - ]: 6172 : if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) && + 1164 : 691 : add_addr_hmac_valid(msk, &mp_opt)) { + 1165 [ + + ]: 691 : if (!mp_opt.echo) { 1166 : 360 : mptcp_pm_add_addr_received(sk, &mp_opt.addr); 1167 [ + - ]: 360 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDR); 1168 : : } else { - 1169 : 332 : mptcp_pm_add_addr_echoed(msk, &mp_opt.addr); - 1170 : 332 : mptcp_pm_del_add_timer(msk, &mp_opt.addr, true); - 1171 [ + - ]: 332 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADD); + 1169 : 331 : mptcp_pm_add_addr_echoed(msk, &mp_opt.addr); + 1170 : 331 : mptcp_pm_del_add_timer(msk, &mp_opt.addr, true); + 1171 [ + - ]: 331 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADD); 1172 : : } 1173 : : - 1174 [ + + ]: 692 : if (mp_opt.addr.port) + 1174 [ + + ]: 691 : if (mp_opt.addr.port) 1175 [ + - ]: 68 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_PORTADD); 1176 : : } 1177 : : - 1178 [ + + ]: 5507 : if (mp_opt.suboptions & OPTION_MPTCP_RM_ADDR) + 1178 [ + + ]: 5481 : if (mp_opt.suboptions & OPTION_MPTCP_RM_ADDR) 1179 : 106 : mptcp_pm_rm_addr_received(msk, &mp_opt.rm_list); 1180 : : - 1181 [ + + ]: 5507 : if (mp_opt.suboptions & OPTION_MPTCP_PRIO) { + 1181 [ + + ]: 5481 : if (mp_opt.suboptions & OPTION_MPTCP_PRIO) { 1182 : 40 : mptcp_pm_mp_prio_received(sk, mp_opt.backup); 1183 [ + - ]: 40 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPPRIORX); 1184 : : } 1185 : : - 1186 [ + + ]: 5507 : if (mp_opt.suboptions & OPTION_MPTCP_FAIL) { + 1186 [ + + ]: 5481 : if (mp_opt.suboptions & OPTION_MPTCP_FAIL) { 1187 : 6 : mptcp_pm_mp_fail_received(sk, mp_opt.fail_seq); 1188 [ + - ]: 6 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILRX); 1189 : : } 1190 : : - 1191 [ + + ]: 5507 : if (mp_opt.suboptions & OPTION_MPTCP_RST) { - 1192 : 241 : subflow->reset_seen = 1; - 1193 : 241 : subflow->reset_reason = mp_opt.reset_reason; - 1194 : 241 : subflow->reset_transient = mp_opt.reset_transient; - 1195 [ + - ]: 241 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX); + 1191 [ + + ]: 5481 : if (mp_opt.suboptions & OPTION_MPTCP_RST) { + 1192 : 263 : subflow->reset_seen = 1; + 1193 : 263 : subflow->reset_reason = mp_opt.reset_reason; + 1194 : 263 : subflow->reset_transient = mp_opt.reset_transient; + 1195 [ + - ]: 263 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX); 1196 : : } 1197 : : - 1198 [ + + ]: 5507 : if (!(mp_opt.suboptions & OPTION_MPTCP_DSS)) + 1198 [ + + ]: 5481 : if (!(mp_opt.suboptions & OPTION_MPTCP_DSS)) 1199 : : return true; 1200 : : } 1201 : : 1202 : : /* we can't wait for recvmsg() to update the ack_seq, otherwise 1203 : : * monodirectional flows will stuck 1204 : : */ - 1205 [ + + ]: 1039307 : if (mp_opt.use_ack) - 1206 : 1038676 : ack_update_msk(msk, sk, &mp_opt); + 1205 [ + + ]: 1082900 : if (mp_opt.use_ack) + 1206 : 1082269 : ack_update_msk(msk, sk, &mp_opt); 1207 : : 1208 : : /* Zero-data-length packets are dropped by the caller and not 1209 : : * propagated to the MPTCP layer, so the skb extension does not 1210 : : * need to be allocated or populated. DATA_FIN information, if 1211 : : * present, needs to be updated here before the skb is freed. 1212 : : */ - 1213 [ + + ]: 1039307 : if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { - 1214 [ + + + - : 387732 : if (mp_opt.data_fin && mp_opt.data_len == 1 && - + + ] - 1215 : 13204 : mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) - 1216 : 2114 : mptcp_schedule_work((struct sock *)msk); + 1213 [ + + ]: 1082900 : if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { + 1214 [ + + + - : 392590 : if (mp_opt.data_fin && mp_opt.data_len == 1 && + + + ] + 1215 : 8714 : mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) + 1216 : 2100 : mptcp_schedule_work((struct sock *)msk); 1217 : : - 1218 : 374528 : return true; + 1218 : 383876 : return true; 1219 : : } 1220 : : - 1221 : 664779 : mpext = skb_ext_add(skb, SKB_EXT_MPTCP); - 1222 [ - + ]: 664779 : if (!mpext) + 1221 : 699024 : mpext = skb_ext_add(skb, SKB_EXT_MPTCP); + 1222 [ - + ]: 699024 : if (!mpext) 1223 : : return true; 1224 : : - 1225 : 664779 : memset(mpext, 0, sizeof(*mpext)); + 1225 : 699024 : memset(mpext, 0, sizeof(*mpext)); 1226 : : - 1227 [ + + ]: 664779 : if (likely(mp_opt.use_map)) { - 1228 [ + + ]: 662786 : if (mp_opt.mpc_map) { + 1227 [ + + ]: 699024 : if (likely(mp_opt.use_map)) { + 1228 [ + + ]: 697028 : if (mp_opt.mpc_map) { 1229 : : /* this is an MP_CAPABLE carrying MPTCP data 1230 : : * we know this map the first chunk of data 1231 : : */ @@ -1321,124 +1321,124 @@ 1237 : 631 : mpext->mpc_map = 1; 1238 : 631 : mpext->data_fin = 0; 1239 : : } else { - 1240 : 662155 : mpext->data_seq = mp_opt.data_seq; - 1241 : 662155 : mpext->subflow_seq = mp_opt.subflow_seq; - 1242 : 662155 : mpext->dsn64 = mp_opt.dsn64; - 1243 : 662155 : mpext->data_fin = mp_opt.data_fin; + 1240 : 696397 : mpext->data_seq = mp_opt.data_seq; + 1241 : 696397 : mpext->subflow_seq = mp_opt.subflow_seq; + 1242 : 696397 : mpext->dsn64 = mp_opt.dsn64; + 1243 : 696397 : mpext->data_fin = mp_opt.data_fin; 1244 : : } - 1245 : 662786 : mpext->data_len = mp_opt.data_len; - 1246 : 662786 : mpext->use_map = 1; - 1247 : 662786 : mpext->csum_reqd = !!(mp_opt.suboptions & OPTION_MPTCP_CSUMREQD); + 1245 : 697028 : mpext->data_len = mp_opt.data_len; + 1246 : 697028 : mpext->use_map = 1; + 1247 : 697028 : mpext->csum_reqd = !!(mp_opt.suboptions & OPTION_MPTCP_CSUMREQD); 1248 : : - 1249 [ + + ]: 662786 : if (mpext->csum_reqd) - 1250 : 1621 : mpext->csum = mp_opt.csum; + 1249 [ + + ]: 697028 : if (mpext->csum_reqd) + 1250 : 1598 : mpext->csum = mp_opt.csum; 1251 : : } 1252 : : 1253 : : return true; 1254 : : } 1255 : : - 1256 : 866018 : static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) + 1256 : 878361 : static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) 1257 : : { - 1258 : 866018 : const struct sock *ssk = (const struct sock *)tp; - 1259 : 866018 : struct mptcp_subflow_context *subflow; - 1260 : 866018 : u64 ack_seq, rcv_wnd_old, rcv_wnd_new; - 1261 : 866018 : struct mptcp_sock *msk; - 1262 : 866018 : u32 new_win; - 1263 : 866018 : u64 win; + 1258 : 878361 : const struct sock *ssk = (const struct sock *)tp; + 1259 : 878361 : struct mptcp_subflow_context *subflow; + 1260 : 878361 : u64 ack_seq, rcv_wnd_old, rcv_wnd_new; + 1261 : 878361 : struct mptcp_sock *msk; + 1262 : 878361 : u32 new_win; + 1263 : 878361 : u64 win; 1264 : : - 1265 [ - + ]: 866018 : subflow = mptcp_subflow_ctx(ssk); - 1266 [ - + ]: 866018 : msk = mptcp_sk(subflow->conn); + 1265 [ - + ]: 878361 : subflow = mptcp_subflow_ctx(ssk); + 1266 [ - + ]: 878361 : msk = mptcp_sk(subflow->conn); 1267 : : - 1268 : 866018 : ack_seq = READ_ONCE(msk->ack_seq); - 1269 : 866018 : rcv_wnd_new = ack_seq + tp->rcv_wnd; + 1268 : 878361 : ack_seq = READ_ONCE(msk->ack_seq); + 1269 : 878361 : rcv_wnd_new = ack_seq + tp->rcv_wnd; 1270 : : - 1271 [ + + ]: 866018 : rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent); - 1272 [ + + ]: 866018 : if (after64(rcv_wnd_new, rcv_wnd_old)) { - 1273 : 36927 : u64 rcv_wnd; + 1271 [ + + ]: 878361 : rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent); + 1272 [ + + ]: 878361 : if (after64(rcv_wnd_new, rcv_wnd_old)) { + 1273 : 38520 : u64 rcv_wnd; 1274 : : - 1275 : 307878 : for (;;) { - 1276 : 344805 : rcv_wnd = atomic64_cmpxchg(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); + 1275 : 319531 : for (;;) { + 1276 : 358051 : rcv_wnd = atomic64_cmpxchg(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); 1277 : : - 1278 [ + + ]: 307878 : if (rcv_wnd == rcv_wnd_old) + 1278 [ + + ]: 319531 : if (rcv_wnd == rcv_wnd_old) 1279 : : break; 1280 : : - 1281 : 7 : rcv_wnd_old = rcv_wnd; - 1282 [ + + ]: 7 : if (before64(rcv_wnd_new, rcv_wnd_old)) { - 1283 [ # # ]: 1 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); - 1284 : 1 : goto raise_win; + 1281 : 3 : rcv_wnd_old = rcv_wnd; + 1282 [ - + ]: 3 : if (before64(rcv_wnd_new, rcv_wnd_old)) { + 1283 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); + 1284 : 0 : goto raise_win; 1285 : : } - 1286 [ - + ]: 36933 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); + 1286 [ - - ]: 38523 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); 1287 : : } - 1288 : 307871 : goto update_wspace; + 1288 : 319528 : goto update_wspace; 1289 : : } 1290 : : - 1291 [ + + ]: 558146 : if (rcv_wnd_new != rcv_wnd_old) { - 1292 : 69559 : raise_win: - 1293 : 69560 : win = rcv_wnd_old - ack_seq; - 1294 : 69560 : tp->rcv_wnd = min_t(u64, win, U32_MAX); - 1295 : 69560 : new_win = tp->rcv_wnd; + 1291 [ + + ]: 558833 : if (rcv_wnd_new != rcv_wnd_old) { + 1292 : 70804 : raise_win: + 1293 : 70804 : win = rcv_wnd_old - ack_seq; + 1294 : 70804 : tp->rcv_wnd = min_t(u64, win, U32_MAX); + 1295 : 70804 : new_win = tp->rcv_wnd; 1296 : : 1297 : : /* Make sure we do not exceed the maximum possible 1298 : : * scaled window. 1299 : : */ - 1300 [ + + ]: 69560 : if (unlikely(th->syn)) - 1301 : 523 : new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; - 1302 [ - + - - ]: 69560 : if (!tp->rx_opt.rcv_wscale && + 1300 [ + + ]: 70804 : if (unlikely(th->syn)) + 1301 : 525 : new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; + 1302 [ - + - - ]: 70804 : if (!tp->rx_opt.rcv_wscale && 1303 [ # # ]: 0 : READ_ONCE(sock_net(ssk)->ipv4.sysctl_tcp_workaround_signed_windows)) 1304 : 0 : new_win = min(new_win, MAX_TCP_WINDOW); 1305 : : else - 1306 : 69560 : new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); + 1306 : 70804 : new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); 1307 : : 1308 : : /* RFC1323 scaling applied */ - 1309 : 69560 : new_win >>= tp->rx_opt.rcv_wscale; - 1310 : 69560 : th->window = htons(new_win); - 1311 [ + - ]: 69560 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); + 1309 : 70804 : new_win >>= tp->rx_opt.rcv_wscale; + 1310 : 70804 : th->window = htons(new_win); + 1311 [ + - ]: 70804 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); 1312 : : } 1313 : : - 1314 : 488587 : update_wspace: - 1315 : 866018 : WRITE_ONCE(msk->old_wspace, tp->rcv_wnd); - 1316 : 866018 : } + 1314 : 488029 : update_wspace: + 1315 : 878361 : WRITE_ONCE(msk->old_wspace, tp->rcv_wnd); + 1316 : 878361 : } 1317 : : - 1318 : 2105 : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum) + 1318 : 2019 : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum) 1319 : : { - 1320 : 2105 : struct csum_pseudo_header header; - 1321 : 2105 : __wsum csum; + 1320 : 2019 : struct csum_pseudo_header header; + 1321 : 2019 : __wsum csum; 1322 : : 1323 : : /* cfr RFC 8684 3.3.1.: 1324 : : * the data sequence number used in the pseudo-header is 1325 : : * always the 64-bit value, irrespective of what length is used in the 1326 : : * DSS option itself. 1327 : : */ - 1328 : 2105 : header.data_seq = cpu_to_be64(data_seq); - 1329 : 2105 : header.subflow_seq = htonl(subflow_seq); - 1330 : 2105 : header.data_len = htons(data_len); - 1331 : 2105 : header.csum = 0; + 1328 : 2019 : header.data_seq = cpu_to_be64(data_seq); + 1329 : 2019 : header.subflow_seq = htonl(subflow_seq); + 1330 : 2019 : header.data_len = htons(data_len); + 1331 : 2019 : header.csum = 0; 1332 : : - 1333 : 2105 : csum = csum_partial(&header, sizeof(header), sum); - 1334 : 2105 : return csum_fold(csum); + 1333 : 2019 : csum = csum_partial(&header, sizeof(header), sum); + 1334 : 2019 : return csum_fold(csum); 1335 : : } 1336 : : - 1337 : 1965 : static __sum16 mptcp_make_csum(const struct mptcp_ext *mpext) + 1337 : 1889 : static __sum16 mptcp_make_csum(const struct mptcp_ext *mpext) 1338 : : { - 1339 : 3930 : return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len, - 1340 : 1965 : ~csum_unfold(mpext->csum)); + 1339 : 3778 : return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len, + 1340 : 1889 : ~csum_unfold(mpext->csum)); 1341 : : } 1342 : : 1343 : 0 : static void put_len_csum(u16 len, __sum16 csum, void *data) 1344 : : { - 1345 : 2072 : __sum16 *sumptr = data + 2; - 1346 : 2072 : __be16 *ptr = data; + 1345 : 1895 : __sum16 *sumptr = data + 2; + 1346 : 1895 : __be16 *ptr = data; 1347 : : - 1348 : 2072 : put_unaligned_be16(len, ptr); + 1348 : 1895 : put_unaligned_be16(len, ptr); 1349 : : - 1350 : 2072 : put_unaligned(csum, sumptr); - 1351 : 2072 : } + 1350 : 1895 : put_unaligned(csum, sumptr); + 1351 : 1895 : } 1352 : : - 1353 : 868163 : void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp, + 1353 : 880529 : void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp, 1354 : : struct mptcp_out_options *opts) 1355 : : { - 1356 : 868163 : const struct sock *ssk = (const struct sock *)tp; - 1357 : 868163 : struct mptcp_subflow_context *subflow; + 1356 : 880529 : const struct sock *ssk = (const struct sock *)tp; + 1357 : 880529 : struct mptcp_subflow_context *subflow; 1358 : : 1359 : : /* Which options can be used together? 1360 : : * @@ -1462,109 +1462,109 @@ 1378 : : * 1379 : : * The same applies in mptcp_established_options() function. 1380 : : */ - 1381 [ + + ]: 868163 : if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { - 1382 : 861188 : struct mptcp_ext *mpext = &opts->ext_copy; - 1383 : 861188 : u8 len = TCPOLEN_MPTCP_DSS_BASE; - 1384 : 861188 : u8 flags = 0; + 1381 [ + + ]: 880529 : if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { + 1382 : 873519 : struct mptcp_ext *mpext = &opts->ext_copy; + 1383 : 873519 : u8 len = TCPOLEN_MPTCP_DSS_BASE; + 1384 : 873519 : u8 flags = 0; 1385 : : - 1386 [ + - ]: 861188 : if (mpext->use_ack) { - 1387 : 861188 : flags = MPTCP_DSS_HAS_ACK; - 1388 [ + + ]: 861188 : if (mpext->ack64) { + 1386 [ + - ]: 873519 : if (mpext->use_ack) { + 1387 : 873519 : flags = MPTCP_DSS_HAS_ACK; + 1388 [ + + ]: 873519 : if (mpext->ack64) { 1389 : : len += TCPOLEN_MPTCP_DSS_ACK64; 1390 : : flags |= MPTCP_DSS_ACK64; 1391 : : } else { - 1392 : 102425 : len += TCPOLEN_MPTCP_DSS_ACK32; + 1392 : 98046 : len += TCPOLEN_MPTCP_DSS_ACK32; 1393 : : } 1394 : : } 1395 : : - 1396 [ + + ]: 861188 : if (mpext->use_map) { - 1397 : 493319 : len += TCPOLEN_MPTCP_DSS_MAP64; + 1396 [ + + ]: 873519 : if (mpext->use_map) { + 1397 : 492053 : len += TCPOLEN_MPTCP_DSS_MAP64; 1398 : : 1399 : : /* Use only 64-bit mapping flags for now, add 1400 : : * support for optional 32-bit mappings later. 1401 : : */ - 1402 : 493319 : flags |= MPTCP_DSS_HAS_MAP | MPTCP_DSS_DSN64; - 1403 [ + + ]: 493319 : if (mpext->data_fin) - 1404 : 15698 : flags |= MPTCP_DSS_DATA_FIN; + 1402 : 492053 : flags |= MPTCP_DSS_HAS_MAP | MPTCP_DSS_DSN64; + 1403 [ + + ]: 492053 : if (mpext->data_fin) + 1404 : 11169 : flags |= MPTCP_DSS_DATA_FIN; 1405 : : - 1406 [ + + ]: 493319 : if (opts->csum_reqd) - 1407 : 2068 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; + 1406 [ + + ]: 492053 : if (opts->csum_reqd) + 1407 : 1891 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 1408 : : } 1409 : : - 1410 [ + - ]: 861188 : *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags); + 1410 [ + - ]: 873519 : *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags); 1411 : : - 1412 [ + - ]: 861188 : if (mpext->use_ack) { - 1413 [ + + ]: 861188 : if (mpext->ack64) { - 1414 : 758763 : put_unaligned_be64(mpext->data_ack, ptr); - 1415 : 758763 : ptr += 2; + 1412 [ + - ]: 873519 : if (mpext->use_ack) { + 1413 [ + + ]: 873519 : if (mpext->ack64) { + 1414 : 775473 : put_unaligned_be64(mpext->data_ack, ptr); + 1415 : 775473 : ptr += 2; 1416 : : } else { - 1417 : 102425 : put_unaligned_be32(mpext->data_ack32, ptr); - 1418 : 102425 : ptr += 1; + 1417 : 98046 : put_unaligned_be32(mpext->data_ack32, ptr); + 1418 : 98046 : ptr += 1; 1419 : : } 1420 : : } 1421 : : - 1422 [ + + ]: 861188 : if (mpext->use_map) { - 1423 [ + + ]: 493319 : put_unaligned_be64(mpext->data_seq, ptr); - 1424 : 493319 : ptr += 2; - 1425 [ + + ]: 493319 : put_unaligned_be32(mpext->subflow_seq, ptr); - 1426 : 493319 : ptr += 1; - 1427 [ + + ]: 493319 : if (opts->csum_reqd) { + 1422 [ + + ]: 873519 : if (mpext->use_map) { + 1423 [ + + ]: 492053 : put_unaligned_be64(mpext->data_seq, ptr); + 1424 : 492053 : ptr += 2; + 1425 [ + + ]: 492053 : put_unaligned_be32(mpext->subflow_seq, ptr); + 1426 : 492053 : ptr += 1; + 1427 [ + + ]: 492053 : if (opts->csum_reqd) { 1428 : : /* data_len == 0 is reserved for the infinite mapping, 1429 : : * the checksum will also be set to 0. 1430 : : */ - 1431 : 2068 : put_len_csum(mpext->data_len, - 1432 [ + + ]: 2068 : (mpext->data_len ? mptcp_make_csum(mpext) : 0), + 1431 : 1891 : put_len_csum(mpext->data_len, + 1432 [ + + ]: 1891 : (mpext->data_len ? mptcp_make_csum(mpext) : 0), 1433 : : ptr); 1434 : : } else { - 1435 : 491251 : put_unaligned_be32(mpext->data_len << 16 | - 1436 : 491251 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); + 1435 : 490162 : put_unaligned_be32(mpext->data_len << 16 | + 1436 : 490162 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); 1437 : : } - 1438 : 493319 : ptr += 1; + 1438 : 492053 : ptr += 1; 1439 : : } 1440 : : 1441 : : /* We might need to add MP_FAIL options in rare cases */ - 1442 [ + + ]: 861188 : if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) + 1442 [ + + ]: 873519 : if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) 1443 : 4 : goto mp_fail; - 1444 [ + + ]: 6975 : } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { - 1445 : 4191 : u8 len, flag = MPTCP_CAP_HMAC_SHA256; + 1444 [ + + ]: 7010 : } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { + 1445 : 4206 : u8 len, flag = MPTCP_CAP_HMAC_SHA256; 1446 : : - 1447 [ + + ]: 4191 : if (OPTION_MPTCP_MPC_SYN & opts->suboptions) { + 1447 [ + + ]: 4206 : if (OPTION_MPTCP_MPC_SYN & opts->suboptions) { 1448 : : len = TCPOLEN_MPTCP_MPC_SYN; - 1449 [ + + ]: 2903 : } else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) { + 1449 [ + + ]: 2917 : } else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) { 1450 : : len = TCPOLEN_MPTCP_MPC_SYNACK; - 1451 [ + + ]: 1717 : } else if (opts->data_len) { - 1452 : 593 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; - 1453 [ + + ]: 593 : if (opts->csum_reqd) + 1451 [ + + ]: 1729 : } else if (opts->data_len) { + 1452 : 604 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; + 1453 [ + + ]: 604 : if (opts->csum_reqd) 1454 : 4 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 1455 : : } else { 1456 : : len = TCPOLEN_MPTCP_MPC_ACK; 1457 : : } 1458 : : - 1459 [ + + ]: 4191 : if (opts->csum_reqd) + 1459 [ + + ]: 4206 : if (opts->csum_reqd) 1460 : 30 : flag |= MPTCP_CAP_CHECKSUM_REQD; 1461 : : - 1462 [ + + ]: 4191 : if (!opts->allow_join_id0) + 1462 [ + + ]: 4206 : if (!opts->allow_join_id0) 1463 : 18 : flag |= MPTCP_CAP_DENY_JOIN_ID0; 1464 : : - 1465 [ + + ]: 4191 : *ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len, + 1465 [ + + ]: 4206 : *ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len, 1466 : : MPTCP_SUPPORTED_VERSION, 1467 : : flag); 1468 : : - 1469 : 4191 : if (!((OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & - 1470 [ + + ]: 4191 : opts->suboptions)) - 1471 : 1288 : goto mp_capable_done; + 1469 : 4206 : if (!((OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & + 1470 [ + + ]: 4206 : opts->suboptions)) + 1471 : 1289 : goto mp_capable_done; 1472 : : - 1473 [ + + ]: 2903 : put_unaligned_be64(opts->sndr_key, ptr); - 1474 : 2903 : ptr += 2; - 1475 [ + + ]: 2903 : if (!((OPTION_MPTCP_MPC_ACK) & opts->suboptions)) - 1476 : 1186 : goto mp_capable_done; + 1473 [ + + ]: 2917 : put_unaligned_be64(opts->sndr_key, ptr); + 1474 : 2917 : ptr += 2; + 1475 [ + + ]: 2917 : if (!((OPTION_MPTCP_MPC_ACK) & opts->suboptions)) + 1476 : 1188 : goto mp_capable_done; 1477 : : - 1478 [ + + ]: 1717 : put_unaligned_be64(opts->rcvr_key, ptr); - 1479 : 1717 : ptr += 2; - 1480 [ + + ]: 1717 : if (!opts->data_len) - 1481 : 1124 : goto mp_capable_done; + 1478 [ + + ]: 1729 : put_unaligned_be64(opts->rcvr_key, ptr); + 1479 : 1729 : ptr += 2; + 1480 [ + + ]: 1729 : if (!opts->data_len) + 1481 : 1125 : goto mp_capable_done; 1482 : : - 1483 [ + + ]: 593 : if (opts->csum_reqd) { + 1483 [ + + ]: 604 : if (opts->csum_reqd) { 1484 : 4 : put_len_csum(opts->data_len, 1485 : 4 : __mptcp_make_csum(opts->data_seq, 1486 : : opts->subflow_seq, @@ -1572,68 +1572,68 @@ 1488 : 4 : ~csum_unfold(opts->csum)), 1489 : : ptr); 1490 : : } else { - 1491 : 589 : put_unaligned_be32(opts->data_len << 16 | - 1492 : 589 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); + 1491 : 600 : put_unaligned_be32(opts->data_len << 16 | + 1492 : 600 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); 1493 : : } - 1494 : 593 : ptr += 1; + 1494 : 604 : ptr += 1; 1495 : : 1496 : : /* MPC is additionally mutually exclusive with MP_PRIO */ - 1497 : 593 : goto mp_capable_done; - 1498 [ + + ]: 2784 : } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { - 1499 [ + + ]: 1591 : if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { - 1500 : 571 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1497 : 604 : goto mp_capable_done; + 1498 [ + + ]: 2804 : } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { + 1499 [ + + ]: 1590 : if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { + 1500 : 572 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1501 : : TCPOLEN_MPTCP_MPJ_SYN, - 1502 : 571 : opts->backup, opts->join_id); - 1503 : 571 : put_unaligned_be32(opts->token, ptr); - 1504 : 571 : ptr += 1; - 1505 : 571 : put_unaligned_be32(opts->nonce, ptr); - 1506 : 571 : ptr += 1; - 1507 [ + + ]: 1020 : } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { - 1508 : 518 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1502 : 572 : opts->backup, opts->join_id); + 1503 : 572 : put_unaligned_be32(opts->token, ptr); + 1504 : 572 : ptr += 1; + 1505 : 572 : put_unaligned_be32(opts->nonce, ptr); + 1506 : 572 : ptr += 1; + 1507 [ + + ]: 1018 : } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { + 1508 : 517 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1509 : : TCPOLEN_MPTCP_MPJ_SYNACK, - 1510 : 518 : opts->backup, opts->join_id); - 1511 : 518 : put_unaligned_be64(opts->thmac, ptr); - 1512 : 518 : ptr += 2; - 1513 : 518 : put_unaligned_be32(opts->nonce, ptr); - 1514 : 518 : ptr += 1; + 1510 : 517 : opts->backup, opts->join_id); + 1511 : 517 : put_unaligned_be64(opts->thmac, ptr); + 1512 : 517 : ptr += 2; + 1513 : 517 : put_unaligned_be32(opts->nonce, ptr); + 1514 : 517 : ptr += 1; 1515 : : } else { - 1516 : 502 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1516 : 501 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1517 : : TCPOLEN_MPTCP_MPJ_ACK, 0, 0); - 1518 : 502 : memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); - 1519 : 502 : ptr += 5; + 1518 : 501 : memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); + 1519 : 501 : ptr += 5; 1520 : : } - 1521 [ + + ]: 1193 : } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { - 1522 : 756 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; - 1523 : 756 : u8 echo = MPTCP_ADDR_ECHO; + 1521 [ + + ]: 1214 : } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { + 1522 : 755 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + 1523 : 755 : u8 echo = MPTCP_ADDR_ECHO; 1524 : : 1525 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1526 [ + + ]: 756 : if (opts->addr.family == AF_INET6) - 1527 : 170 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; + 1526 [ + + ]: 755 : if (opts->addr.family == AF_INET6) + 1527 : 169 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; 1528 : : #endif 1529 : : - 1530 [ + + ]: 756 : if (opts->addr.port) + 1530 [ + + ]: 755 : if (opts->addr.port) 1531 : 68 : len += TCPOLEN_MPTCP_PORT_LEN; 1532 : : - 1533 [ + + ]: 756 : if (opts->ahmac) { + 1533 [ + + ]: 755 : if (opts->ahmac) { 1534 : 404 : len += sizeof(opts->ahmac); 1535 : 404 : echo = 0; 1536 : : } 1537 : : - 1538 : 756 : *ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, - 1539 [ + + ]: 756 : len, echo, opts->addr.id); - 1540 [ + + ]: 756 : if (opts->addr.family == AF_INET) { + 1538 : 755 : *ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, + 1539 [ + + ]: 755 : len, echo, opts->addr.id); + 1540 [ + + ]: 755 : if (opts->addr.family == AF_INET) { 1541 : 586 : memcpy((u8 *)ptr, (u8 *)&opts->addr.addr.s_addr, 4); 1542 : 586 : ptr += 1; 1543 : : } 1544 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1545 [ + - ]: 170 : else if (opts->addr.family == AF_INET6) { - 1546 : 170 : memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16); - 1547 : 170 : ptr += 4; + 1545 [ + - ]: 169 : else if (opts->addr.family == AF_INET6) { + 1546 : 169 : memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16); + 1547 : 169 : ptr += 4; 1548 : : } 1549 : : #endif 1550 : : - 1551 [ + + ]: 756 : if (!opts->addr.port) { - 1552 [ + + ]: 688 : if (opts->ahmac) { + 1551 [ + + ]: 755 : if (!opts->addr.port) { + 1552 [ + + ]: 687 : if (opts->ahmac) { 1553 : 376 : put_unaligned_be64(opts->ahmac, ptr); 1554 : 376 : ptr += 2; 1555 : : } @@ -1658,18 +1658,18 @@ 1574 : 40 : ptr += 1; 1575 : : } 1576 : : } - 1577 [ + + ]: 437 : } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { + 1577 [ + + ]: 459 : } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { 1578 : : /* FASTCLOSE is mutually exclusive with others except RST */ - 1579 : 378 : *ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE, + 1579 : 401 : *ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE, 1580 : : TCPOLEN_MPTCP_FASTCLOSE, 1581 : : 0, 0); - 1582 [ + - ]: 378 : put_unaligned_be64(opts->rcvr_key, ptr); - 1583 : 378 : ptr += 2; + 1582 [ + - ]: 401 : put_unaligned_be64(opts->rcvr_key, ptr); + 1583 : 401 : ptr += 2; 1584 : : - 1585 [ + - ]: 378 : if (OPTION_MPTCP_RST & opts->suboptions) - 1586 : 378 : goto mp_rst; + 1585 [ + - ]: 401 : if (OPTION_MPTCP_RST & opts->suboptions) + 1586 : 401 : goto mp_rst; 1587 : : return; - 1588 [ + + ]: 59 : } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { + 1588 [ + + ]: 58 : } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { 1589 : 2 : mp_fail: 1590 : : /* MP_FAIL is mutually exclusive with others except RST */ 1591 [ + + ]: 6 : subflow = mptcp_subflow_ctx(ssk); @@ -1684,16 +1684,16 @@ 1600 [ + + ]: 6 : if (OPTION_MPTCP_RST & opts->suboptions) 1601 : 2 : goto mp_rst; 1602 : : return; - 1603 [ + - ]: 57 : } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { - 1604 : 57 : mp_rst: - 1605 : 437 : *ptr++ = mptcp_option(MPTCPOPT_RST, + 1603 [ + - ]: 56 : } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { + 1604 : 56 : mp_rst: + 1605 : 459 : *ptr++ = mptcp_option(MPTCPOPT_RST, 1606 : : TCPOLEN_MPTCP_RST, - 1607 : 437 : opts->reset_transient, - 1608 : 437 : opts->reset_reason); - 1609 : 437 : return; + 1607 : 459 : opts->reset_transient, + 1608 : 459 : opts->reset_reason); + 1609 : 459 : return; 1610 : : } 1611 : : - 1612 [ + + ]: 863531 : if (OPTION_MPTCP_PRIO & opts->suboptions) { + 1612 [ + + ]: 875860 : if (OPTION_MPTCP_PRIO & opts->suboptions) { 1613 [ + - ]: 28 : subflow = mptcp_subflow_ctx(ssk); 1614 : 28 : subflow->send_mp_prio = 0; 1615 : : @@ -1704,8 +1704,8 @@ 1620 [ + - ]: 28 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPPRIOTX); 1621 : : } 1622 : : - 1623 : 863503 : mp_capable_done: - 1624 [ + + ]: 867722 : if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { + 1623 : 875832 : mp_capable_done: + 1624 [ + + ]: 880066 : if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { 1625 : 106 : u8 i = 1; 1626 : : 1627 : 106 : *ptr++ = mptcp_option(MPTCPOPT_RM_ADDR, @@ -1725,8 +1725,8 @@ 1641 : : } 1642 : : } 1643 : : - 1644 [ + + ]: 867722 : if (tp) - 1645 : 866018 : mptcp_set_rwin(tp, th); + 1644 [ + + ]: 880066 : if (tp) + 1645 : 878361 : mptcp_set_rwin(tp, th); 1646 : : } 1647 : : 1648 : 16 : __be32 mptcp_get_reset_option(const struct sk_buff *skb) diff --git a/html/lcov/export/mptcp/pm.c.func-c.html b/html/lcov/export/mptcp/pm.c.func-c.html index 84415d10..542d899b 100644 --- a/html/lcov/export/mptcp/pm.c.func-c.html +++ b/html/lcov/export/mptcp/pm.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -179,7 +179,7 @@ mptcp_pm_add_addr_echoed - 332 + 331 @@ -193,70 +193,70 @@ mptcp_pm_allow_new_subflow - 506 + 505 mptcp_pm_addr_families_match - 664 + 663 - mptcp_pm_subflow_check_next + mptcp_pm_subflow_chk_stale - 717 + 738 - mptcp_pm_add_addr_signal + mptcp_pm_subflow_check_next - 756 + 750 - mptcp_pm_announce_addr + mptcp_pm_add_addr_signal - 756 + 755 - mptcp_pm_get_local_id + mptcp_pm_announce_addr - 768 + 755 - mptcp_pm_is_backup + mptcp_pm_get_local_id - 768 + 766 - mptcp_pm_subflow_chk_stale + mptcp_pm_is_backup - 992 + 766 mptcp_pm_subflow_established - 998 + 996 mptcp_pm_schedule_work - 1386 + 1382 diff --git a/html/lcov/export/mptcp/pm.c.func.html b/html/lcov/export/mptcp/pm.c.func.html index 5440660f..3f5d2670 100644 --- a/html/lcov/export/mptcp/pm.c.func.html +++ b/html/lcov/export/mptcp/pm.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -81,7 +81,7 @@ mptcp_pm_add_addr_echoed - 332 + 331 @@ -102,28 +102,28 @@ mptcp_pm_add_addr_signal - 756 + 755 mptcp_pm_addr_families_match - 664 + 663 mptcp_pm_allow_new_subflow - 506 + 505 mptcp_pm_announce_addr - 756 + 755 @@ -179,7 +179,7 @@ mptcp_pm_get_local_id - 768 + 766 @@ -193,7 +193,7 @@ mptcp_pm_is_backup - 768 + 766 @@ -263,7 +263,7 @@ mptcp_pm_schedule_work - 1386 + 1382 @@ -277,21 +277,21 @@ mptcp_pm_subflow_check_next - 717 + 750 mptcp_pm_subflow_chk_stale - 992 + 738 mptcp_pm_subflow_established - 998 + 996 diff --git a/html/lcov/export/mptcp/pm.c.gcov.html b/html/lcov/export/mptcp/pm.c.gcov.html index b0853b16..d743ceba 100644 --- a/html/lcov/export/mptcp/pm.c.gcov.html +++ b/html/lcov/export/mptcp/pm.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -92,32 +92,32 @@ 14 : : 15 : : /* path manager command handlers */ 16 : : - 17 : 756 : int mptcp_pm_announce_addr(struct mptcp_sock *msk, + 17 : 755 : int mptcp_pm_announce_addr(struct mptcp_sock *msk, 18 : : const struct mptcp_addr_info *addr, 19 : : bool echo) 20 : : { - 21 : 756 : u8 add_addr = READ_ONCE(msk->pm.addr_signal); + 21 : 755 : u8 add_addr = READ_ONCE(msk->pm.addr_signal); 22 : : - 23 [ - + ]: 756 : pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo); + 23 [ - + ]: 755 : pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo); 24 : : - 25 [ + - - + ]: 756 : lockdep_assert_held(&msk->pm.lock); + 25 [ + - - + ]: 755 : lockdep_assert_held(&msk->pm.lock); 26 : : - 27 [ - + ]: 756 : if (add_addr & - 28 [ + + ]: 756 : (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { + 27 [ - + ]: 755 : if (add_addr & + 28 [ + + ]: 755 : (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { 29 [ # # # # ]: 0 : MPTCP_INC_STATS(sock_net((struct sock *)msk), 30 : : echo ? MPTCP_MIB_ECHOADDTXDROP : MPTCP_MIB_ADDADDRTXDROP); 31 : 0 : return -EINVAL; 32 : : } 33 : : - 34 [ + + ]: 756 : if (echo) { - 35 : 352 : msk->pm.remote = *addr; - 36 : 352 : add_addr |= BIT(MPTCP_ADD_ADDR_ECHO); + 34 [ + + ]: 755 : if (echo) { + 35 : 351 : msk->pm.remote = *addr; + 36 : 351 : add_addr |= BIT(MPTCP_ADD_ADDR_ECHO); 37 : : } else { 38 : 404 : msk->pm.local = *addr; 39 : 404 : add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL); 40 : : } - 41 : 756 : WRITE_ONCE(msk->pm.addr_signal, add_addr); - 42 : 756 : return 0; + 41 : 755 : WRITE_ONCE(msk->pm.addr_signal, add_addr); + 42 : 755 : return 0; 43 : : } 44 : : 45 : 106 : int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list) @@ -151,13 +151,13 @@ 73 : 2286 : mptcp_event(MPTCP_EVENT_CREATED, msk, ssk, GFP_ATOMIC); 74 : 2286 : } 75 : : - 76 : 506 : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) + 76 : 505 : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) 77 : : { - 78 : 506 : struct mptcp_pm_data *pm = &msk->pm; - 79 : 506 : unsigned int subflows_max; - 80 : 506 : int ret = 0; + 78 : 505 : struct mptcp_pm_data *pm = &msk->pm; + 79 : 505 : unsigned int subflows_max; + 80 : 505 : int ret = 0; 81 : : - 82 [ + + ]: 506 : if (mptcp_pm_is_userspace(msk)) { + 82 [ + + ]: 505 : if (mptcp_pm_is_userspace(msk)) { 83 [ + - ]: 22 : if (mptcp_userspace_pm_active(msk)) { 84 : 22 : spin_lock_bh(&pm->lock); 85 : 22 : pm->subflows++; @@ -167,40 +167,40 @@ 89 : : return false; 90 : : } 91 : : - 92 : 484 : subflows_max = mptcp_pm_get_subflows_max(msk); + 92 : 483 : subflows_max = mptcp_pm_get_subflows_max(msk); 93 : : - 94 [ - + - - ]: 484 : pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, + 94 [ - + - - ]: 483 : pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, 95 : : subflows_max, READ_ONCE(pm->accept_subflow)); 96 : : 97 : : /* try to avoid acquiring the lock below */ - 98 [ - + - + ]: 484 : if (!READ_ONCE(pm->accept_subflow)) + 98 [ - + - + ]: 483 : if (!READ_ONCE(pm->accept_subflow)) 99 : : return false; 100 : : - 101 : 484 : spin_lock_bh(&pm->lock); - 102 [ + + + - ]: 484 : if (READ_ONCE(pm->accept_subflow)) { - 103 : 484 : ret = pm->subflows < subflows_max; - 104 [ - + + + ]: 484 : if (ret && ++pm->subflows == subflows_max) + 101 : 483 : spin_lock_bh(&pm->lock); + 102 [ + + + - ]: 483 : if (READ_ONCE(pm->accept_subflow)) { + 103 : 483 : ret = pm->subflows < subflows_max; + 104 [ - + + + ]: 483 : if (ret && ++pm->subflows == subflows_max) 105 : 182 : WRITE_ONCE(pm->accept_subflow, false); 106 : : } - 107 : 484 : spin_unlock_bh(&pm->lock); + 107 : 483 : spin_unlock_bh(&pm->lock); 108 : : - 109 : 484 : return ret; + 109 : 483 : return ret; 110 : : } 111 : : 112 : : /* return true if the new status bit is currently cleared, that is, this event 113 : : * can be server, eventually by an already scheduled work 114 : : */ - 115 : 1386 : static bool mptcp_pm_schedule_work(struct mptcp_sock *msk, + 115 : 1382 : static bool mptcp_pm_schedule_work(struct mptcp_sock *msk, 116 : : enum mptcp_pm_status new_status) 117 : : { - 118 [ - + - - ]: 1386 : pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status, + 118 [ - + - - ]: 1382 : pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status, 119 : : BIT(new_status)); - 120 [ + + + + ]: 1386 : if (msk->pm.status & BIT(new_status)) + 120 [ + + + + ]: 1382 : if (msk->pm.status & BIT(new_status)) 121 : : return false; 122 : : - 123 [ - + ]: 1235 : msk->pm.status |= BIT(new_status); - 124 : 1235 : mptcp_schedule_work((struct sock *)msk); - 125 : 1235 : return true; + 123 [ - + ]: 1233 : msk->pm.status |= BIT(new_status); + 124 : 1233 : mptcp_schedule_work((struct sock *)msk); + 125 : 1233 : return true; 126 : : } 127 : : 128 : 2220 : void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) @@ -234,58 +234,58 @@ 156 : : { 157 [ - + ]: 3692 : pr_debug("msk=%p\n", msk); 158 : : - 159 [ + + ]: 3692 : if (msk->token) - 160 : 2276 : mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); + 159 [ + + ]: 3692 : if (msk->token) + 160 : 2297 : mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); 161 : 3692 : } 162 : : - 163 : 998 : void mptcp_pm_subflow_established(struct mptcp_sock *msk) + 163 : 996 : void mptcp_pm_subflow_established(struct mptcp_sock *msk) 164 : : { - 165 : 998 : struct mptcp_pm_data *pm = &msk->pm; + 165 : 996 : struct mptcp_pm_data *pm = &msk->pm; 166 : : - 167 [ - + ]: 998 : pr_debug("msk=%p\n", msk); + 167 [ - + ]: 996 : pr_debug("msk=%p\n", msk); 168 : : - 169 [ + + + + ]: 998 : if (!READ_ONCE(pm->work_pending)) + 169 [ + + + + ]: 996 : if (!READ_ONCE(pm->work_pending)) 170 : : return; 171 : : - 172 : 262 : spin_lock_bh(&pm->lock); + 172 : 261 : spin_lock_bh(&pm->lock); 173 : : - 174 [ + + + - ]: 262 : if (READ_ONCE(pm->work_pending)) - 175 : 262 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); + 174 [ + + + - ]: 261 : if (READ_ONCE(pm->work_pending)) + 175 : 261 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 176 : : - 177 : 262 : spin_unlock_bh(&pm->lock); + 177 : 261 : spin_unlock_bh(&pm->lock); 178 : : } 179 : : - 180 : 717 : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, + 180 : 750 : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, 181 : : const struct mptcp_subflow_context *subflow) 182 : : { - 183 : 717 : struct mptcp_pm_data *pm = &msk->pm; - 184 : 717 : bool update_subflows; + 183 : 750 : struct mptcp_pm_data *pm = &msk->pm; + 184 : 750 : bool update_subflows; 185 : : - 186 : 717 : update_subflows = subflow->request_join || subflow->mp_join; - 187 [ + + ]: 717 : if (mptcp_pm_is_userspace(msk)) { - 188 [ + + ]: 48 : if (update_subflows) { - 189 : 38 : spin_lock_bh(&pm->lock); - 190 : 38 : pm->subflows--; - 191 : 38 : spin_unlock_bh(&pm->lock); + 186 : 750 : update_subflows = subflow->request_join || subflow->mp_join; + 187 [ + + ]: 750 : if (mptcp_pm_is_userspace(msk)) { + 188 [ + + ]: 51 : if (update_subflows) { + 189 : 40 : spin_lock_bh(&pm->lock); + 190 : 40 : pm->subflows--; + 191 : 40 : spin_unlock_bh(&pm->lock); 192 : : } - 193 : 48 : return; + 193 : 51 : return; 194 : : } 195 : : - 196 [ + + + + : 669 : if (!READ_ONCE(pm->work_pending) && !update_subflows) - + + ] + 196 [ + + + + : 699 : if (!READ_ONCE(pm->work_pending) && !update_subflows) + + + ] 197 : : return; 198 : : - 199 : 295 : spin_lock_bh(&pm->lock); - 200 [ + - ]: 295 : if (update_subflows) - 201 : 295 : __mptcp_pm_close_subflow(msk); + 199 : 296 : spin_lock_bh(&pm->lock); + 200 [ + - ]: 296 : if (update_subflows) + 201 : 296 : __mptcp_pm_close_subflow(msk); 202 : : 203 : : /* Even if this subflow is not really established, tell the PM to try 204 : : * to pick the next ones, if possible. 205 : : */ - 206 [ + + ]: 295 : if (mptcp_pm_nl_check_work_pending(msk)) - 207 : 78 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); + 206 [ + + ]: 296 : if (mptcp_pm_nl_check_work_pending(msk)) + 207 : 77 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 208 : : - 209 : 295 : spin_unlock_bh(&pm->lock); + 209 : 296 : spin_unlock_bh(&pm->lock); 210 : : } 211 : : 212 : 360 : void mptcp_pm_add_addr_received(const struct sock *ssk, @@ -315,30 +315,30 @@ + + ] 236 : 34 : mptcp_pm_announce_addr(msk, addr, true); 237 : 34 : mptcp_pm_add_addr_send_ack(msk); - 238 [ + + ]: 296 : } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { - 239 : 290 : pm->remote = *addr; + 238 [ + + ]: 296 : } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { + 239 : 289 : pm->remote = *addr; 240 : : } else { - 241 [ + - ]: 6 : __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); + 241 [ + - ]: 7 : __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); 242 : : } 243 : : 244 : 360 : spin_unlock_bh(&pm->lock); 245 : 360 : } 246 : : - 247 : 332 : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, + 247 : 331 : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, 248 : : const struct mptcp_addr_info *addr) 249 : : { - 250 : 332 : struct mptcp_pm_data *pm = &msk->pm; + 250 : 331 : struct mptcp_pm_data *pm = &msk->pm; 251 : : - 252 [ - + ]: 332 : pr_debug("msk=%p\n", msk); + 252 [ - + ]: 331 : pr_debug("msk=%p\n", msk); 253 : : - 254 : 332 : spin_lock_bh(&pm->lock); + 254 : 331 : spin_lock_bh(&pm->lock); 255 : : - 256 [ + + + + : 332 : if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) + 256 [ + + + + : 331 : if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) + + ] - 257 : 86 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); + 257 : 84 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 258 : : - 259 : 332 : spin_unlock_bh(&pm->lock); - 260 : 332 : } + 259 : 331 : spin_unlock_bh(&pm->lock); + 260 : 331 : } 261 : : 262 : 122 : void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk) 263 : : { @@ -405,52 +405,52 @@ 324 : : 325 : : /* path manager helpers */ 326 : : - 327 : 756 : bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb, + 327 : 755 : bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb, 328 : : unsigned int opt_size, unsigned int remaining, 329 : : struct mptcp_addr_info *addr, bool *echo, 330 : : bool *drop_other_suboptions) 331 : : { - 332 : 756 : int ret = false; - 333 : 756 : u8 add_addr; - 334 : 756 : u8 family; - 335 : 756 : bool port; + 332 : 755 : int ret = false; + 333 : 755 : u8 add_addr; + 334 : 755 : u8 family; + 335 : 755 : bool port; 336 : : - 337 : 756 : spin_lock_bh(&msk->pm.lock); + 337 : 755 : spin_lock_bh(&msk->pm.lock); 338 : : 339 : : /* double check after the lock is acquired */ - 340 [ - + ]: 756 : if (!mptcp_pm_should_add_signal(msk)) + 340 [ - + ]: 755 : if (!mptcp_pm_should_add_signal(msk)) 341 : 0 : goto out_unlock; 342 : : 343 : : /* always drop every other options for pure ack ADD_ADDR; this is a 344 : : * plain dup-ack from TCP perspective. The other MPTCP-relevant info, 345 : : * if any, will be carried by the 'original' TCP ack 346 : : */ - 347 [ + - + - ]: 756 : if (skb && skb_is_tcp_pure_ack(skb)) { - 348 : 756 : remaining += opt_size; - 349 : 756 : *drop_other_suboptions = true; + 347 [ + - + - ]: 755 : if (skb && skb_is_tcp_pure_ack(skb)) { + 348 : 755 : remaining += opt_size; + 349 : 755 : *drop_other_suboptions = true; 350 : : } 351 : : - 352 [ + + ]: 756 : *echo = mptcp_pm_should_add_signal_echo(msk); - 353 [ + + + + ]: 756 : port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); + 352 [ + + ]: 755 : *echo = mptcp_pm_should_add_signal_echo(msk); + 353 [ + + + + ]: 755 : port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); 354 : : - 355 [ + + + + ]: 756 : family = *echo ? msk->pm.remote.family : msk->pm.local.family; - 356 [ + + + + : 1512 : if (remaining < mptcp_add_addr_len(family, *echo, port)) + 355 [ + + + + ]: 755 : family = *echo ? msk->pm.remote.family : msk->pm.local.family; + 356 [ + + + + : 1510 : if (remaining < mptcp_add_addr_len(family, *echo, port)) - + ] 357 : 0 : goto out_unlock; 358 : : - 359 [ + + + + ]: 756 : if (*echo) { - 360 : 352 : *addr = msk->pm.remote; - 361 : 352 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); + 359 [ + + + + ]: 755 : if (*echo) { + 360 : 351 : *addr = msk->pm.remote; + 361 : 351 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); 362 : : } else { 363 : 404 : *addr = msk->pm.local; 364 : 404 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL); 365 : : } - 366 : 756 : WRITE_ONCE(msk->pm.addr_signal, add_addr); - 367 : 756 : ret = true; + 366 : 755 : WRITE_ONCE(msk->pm.addr_signal, add_addr); + 367 : 755 : ret = true; 368 : : - 369 : 756 : out_unlock: - 370 : 756 : spin_unlock_bh(&msk->pm.lock); - 371 : 756 : return ret; + 369 : 755 : out_unlock: + 370 : 755 : spin_unlock_bh(&msk->pm.lock); + 371 : 755 : return ret; 372 : : } 373 : : 374 : 106 : bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, @@ -483,37 +483,37 @@ 401 : 106 : return ret; 402 : : } 403 : : - 404 : 768 : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) + 404 : 766 : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) 405 : : { - 406 : 768 : struct mptcp_addr_info skc_local; - 407 : 768 : struct mptcp_addr_info msk_local; + 406 : 766 : struct mptcp_addr_info skc_local; + 407 : 766 : struct mptcp_addr_info msk_local; 408 : : - 409 [ - + ]: 768 : if (WARN_ON_ONCE(!msk)) + 409 [ - + ]: 766 : if (WARN_ON_ONCE(!msk)) 410 : 0 : return -1; 411 : : 412 : : /* The 0 ID mapping is defined by the first subflow, copied into the msk 413 : : * addr 414 : : */ - 415 : 768 : mptcp_local_address((struct sock_common *)msk, &msk_local); - 416 : 768 : mptcp_local_address((struct sock_common *)skc, &skc_local); - 417 [ + + ]: 768 : if (mptcp_addresses_equal(&msk_local, &skc_local, false)) + 415 : 766 : mptcp_local_address((struct sock_common *)msk, &msk_local); + 416 : 766 : mptcp_local_address((struct sock_common *)skc, &skc_local); + 417 [ + + ]: 766 : if (mptcp_addresses_equal(&msk_local, &skc_local, false)) 418 : : return 0; 419 : : - 420 [ + + ]: 386 : if (mptcp_pm_is_userspace(msk)) + 420 [ + + ]: 384 : if (mptcp_pm_is_userspace(msk)) 421 : 22 : return mptcp_userspace_pm_get_local_id(msk, &skc_local); - 422 : 364 : return mptcp_pm_nl_get_local_id(msk, &skc_local); + 422 : 362 : return mptcp_pm_nl_get_local_id(msk, &skc_local); 423 : : } 424 : : - 425 : 768 : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) + 425 : 766 : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) 426 : : { - 427 : 768 : struct mptcp_addr_info skc_local; + 427 : 766 : struct mptcp_addr_info skc_local; 428 : : - 429 : 768 : mptcp_local_address((struct sock_common *)skc, &skc_local); + 429 : 766 : mptcp_local_address((struct sock_common *)skc, &skc_local); 430 : : - 431 [ + + ]: 768 : if (mptcp_pm_is_userspace(msk)) + 431 [ + + ]: 766 : if (mptcp_pm_is_userspace(msk)) 432 : 26 : return mptcp_userspace_pm_is_backup(msk, &skc_local); 433 : : - 434 : 742 : return mptcp_pm_nl_is_backup(msk, &skc_local); + 434 : 740 : return mptcp_pm_nl_is_backup(msk, &skc_local); 435 : : } 436 : : 437 : 28 : static int mptcp_pm_get_addr(u8 id, struct mptcp_pm_addr_entry *addr, @@ -631,45 +631,45 @@ 549 : 48 : return mptcp_pm_set_flags(info); 550 : : } 551 : : - 552 : 992 : void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) + 552 : 738 : void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) 553 : : { - 554 [ - + ]: 992 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 555 [ - + ]: 992 : u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp); + 554 [ - + ]: 738 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 555 [ - + ]: 738 : u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp); 556 : : 557 : : /* keep track of rtx periods with no progress */ - 558 [ + + ]: 992 : if (!subflow->stale_count) { - 559 : 313 : subflow->stale_rcv_tstamp = rcv_tstamp; - 560 : 313 : subflow->stale_count++; - 561 [ + + ]: 679 : } else if (subflow->stale_rcv_tstamp == rcv_tstamp) { - 562 [ + - ]: 536 : if (subflow->stale_count < U8_MAX) - 563 : 536 : subflow->stale_count++; - 564 : 536 : mptcp_pm_nl_subflow_chk_stale(msk, ssk); + 558 [ + + ]: 738 : if (!subflow->stale_count) { + 559 : 279 : subflow->stale_rcv_tstamp = rcv_tstamp; + 560 : 279 : subflow->stale_count++; + 561 [ + + ]: 459 : } else if (subflow->stale_rcv_tstamp == rcv_tstamp) { + 562 [ + - ]: 329 : if (subflow->stale_count < U8_MAX) + 563 : 329 : subflow->stale_count++; + 564 : 329 : mptcp_pm_nl_subflow_chk_stale(msk, ssk); 565 : : } else { - 566 : 143 : subflow->stale_count = 0; - 567 : 143 : mptcp_subflow_set_active(subflow); + 566 : 130 : subflow->stale_count = 0; + 567 : 130 : mptcp_subflow_set_active(subflow); 568 : : } - 569 : 992 : } + 569 : 738 : } 570 : : 571 : : /* if sk is ipv4 or ipv6_only allows only same-family local and remote addresses, 572 : : * otherwise allow any matching local/remote pair 573 : : */ - 574 : 664 : bool mptcp_pm_addr_families_match(const struct sock *sk, + 574 : 663 : bool mptcp_pm_addr_families_match(const struct sock *sk, 575 : : const struct mptcp_addr_info *loc, 576 : : const struct mptcp_addr_info *rem) 577 : : { - 578 : 664 : bool mptcp_is_v4 = sk->sk_family == AF_INET; + 578 : 663 : bool mptcp_is_v4 = sk->sk_family == AF_INET; 579 : : 580 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 581 [ + + + + ]: 664 : bool loc_is_v4 = loc->family == AF_INET || ipv6_addr_v4mapped(&loc->addr6); - 582 [ + + + + ]: 664 : bool rem_is_v4 = rem->family == AF_INET || ipv6_addr_v4mapped(&rem->addr6); + 581 [ + + + + ]: 663 : bool loc_is_v4 = loc->family == AF_INET || ipv6_addr_v4mapped(&loc->addr6); + 582 [ + + + + ]: 663 : bool rem_is_v4 = rem->family == AF_INET || ipv6_addr_v4mapped(&rem->addr6); 583 : : - 584 [ + + ]: 664 : if (mptcp_is_v4) + 584 [ + + ]: 663 : if (mptcp_is_v4) 585 : 538 : return loc_is_v4 && rem_is_v4; 586 : : - 587 [ - + ]: 126 : if (ipv6_only_sock(sk)) + 587 [ - + ]: 125 : if (ipv6_only_sock(sk)) 588 : 0 : return !loc_is_v4 && !rem_is_v4; 589 : : - 590 : 126 : return loc_is_v4 == rem_is_v4; + 590 : 125 : return loc_is_v4 == rem_is_v4; 591 : : #else 592 : : return mptcp_is_v4 && loc->family == AF_INET && rem->family == AF_INET; 593 : : #endif diff --git a/html/lcov/export/mptcp/pm_netlink.c.func-c.html b/html/lcov/export/mptcp/pm_netlink.c.func-c.html index 84b6604c..4f84fd94 100644 --- a/html/lcov/export/mptcp/pm_netlink.c.func-c.html +++ b/html/lcov/export/mptcp/pm_netlink.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -284,21 +284,21 @@ fill_local_addresses_vec - 272 + 271 lookup_subflow_by_daddr - 290 + 289 mptcp_pm_nl_add_addr_received - 290 + 289 @@ -308,6 +308,13 @@ 310 + + + mptcp_pm_nl_subflow_chk_stale + + 329 + + mptcp_pm_alloc_anno_list @@ -333,7 +340,7 @@ mptcp_pm_nl_get_local_id - 364 + 362 @@ -347,7 +354,7 @@ mptcp_nl_mcast_send - 438 + 430 @@ -361,14 +368,7 @@ mptcp_pm_del_add_timer - 462 - - - - - mptcp_pm_nl_subflow_chk_stale - - 537 + 461 @@ -396,7 +396,7 @@ mptcp_pm_nl_is_backup - 742 + 740 @@ -410,35 +410,35 @@ mptcp_pm_nl_addr_send_ack - 862 + 861 mptcp_pm_send_ack - 865 + 866 __mptcp_pm_send_ack - 887 + 888 pm_nl_exit_net - 918 + 927 mptcp_pm_nl_check_work_pending - 1086 + 1087 @@ -473,7 +473,7 @@ mptcp_lookup_anno_list_by_saddr - 1138 + 1136 @@ -515,7 +515,7 @@ __lookup_addr - 1590 + 1586 @@ -536,14 +536,14 @@ mptcp_event_pm_listener - 2520 + 2512 mptcp_local_address - 3412 + 3405 @@ -557,63 +557,63 @@ mptcp_pm_get_add_addr_signal_max - 4331 + 4355 mptcp_pm_get_add_addr_accept_max - 4633 + 4657 mptcp_pm_get_local_addr_max - 4633 + 4657 mptcp_pm_get_subflows_max - 5505 + 5527 mptcp_event - 8137 + 8157 mptcp_addresses_equal - 8930 + 8889 pm_nl_get_pernet_from_msk - 13203 + 13208 mptcp_pm_nl_work - 13695 + 13286 pm_nl_get_pernet - 15903 + 15986 diff --git a/html/lcov/export/mptcp/pm_netlink.c.func.html b/html/lcov/export/mptcp/pm_netlink.c.func.html index 01d07f45..e8eccc0f 100644 --- a/html/lcov/export/mptcp/pm_netlink.c.func.html +++ b/html/lcov/export/mptcp/pm_netlink.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -88,7 +88,7 @@ __lookup_addr - 1590 + 1586 @@ -116,14 +116,14 @@ __mptcp_pm_send_ack - 887 + 888 fill_local_addresses_vec - 272 + 271 @@ -144,21 +144,21 @@ lookup_subflow_by_daddr - 290 + 289 mptcp_addresses_equal - 8930 + 8889 mptcp_event - 8137 + 8157 @@ -193,7 +193,7 @@ mptcp_event_pm_listener - 2520 + 2512 @@ -214,14 +214,14 @@ mptcp_local_address - 3412 + 3405 mptcp_lookup_anno_list_by_saddr - 1138 + 1136 @@ -256,7 +256,7 @@ mptcp_nl_mcast_send - 438 + 430 @@ -305,7 +305,7 @@ mptcp_pm_del_add_timer - 462 + 461 @@ -326,28 +326,28 @@ mptcp_pm_get_add_addr_accept_max - 4633 + 4657 mptcp_pm_get_add_addr_signal_max - 4331 + 4355 mptcp_pm_get_local_addr_max - 4633 + 4657 mptcp_pm_get_subflows_max - 5505 + 5527 @@ -368,14 +368,14 @@ mptcp_pm_nl_add_addr_received - 290 + 289 mptcp_pm_nl_addr_send_ack - 862 + 861 @@ -389,7 +389,7 @@ mptcp_pm_nl_check_work_pending - 1086 + 1087 @@ -445,7 +445,7 @@ mptcp_pm_nl_get_local_id - 364 + 362 @@ -459,7 +459,7 @@ mptcp_pm_nl_is_backup - 742 + 740 @@ -501,14 +501,14 @@ mptcp_pm_nl_subflow_chk_stale - 537 + 329 mptcp_pm_nl_work - 13695 + 13286 @@ -543,7 +543,7 @@ mptcp_pm_send_ack - 865 + 866 @@ -578,21 +578,21 @@ pm_nl_exit_net - 918 + 927 pm_nl_get_pernet - 15903 + 15986 pm_nl_get_pernet_from_msk - 13203 + 13208 diff --git a/html/lcov/export/mptcp/pm_netlink.c.gcov.html b/html/lcov/export/mptcp/pm_netlink.c.gcov.html index c23d1bf5..c6f418fd 100644 --- a/html/lcov/export/mptcp/pm_netlink.c.gcov.html +++ b/html/lcov/export/mptcp/pm_netlink.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -121,67 +121,67 @@ 43 : : #define MPTCP_PM_ADDR_MAX 8 44 : : #define ADD_ADDR_RETRANS_MAX 3 45 : : - 46 : 15903 : static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) + 46 : 15986 : static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) 47 : : { - 48 : 29700 : return net_generic(net, pm_nl_pernet_id); + 48 : 29792 : return net_generic(net, pm_nl_pernet_id); 49 : : } 50 : : 51 : : static struct pm_nl_pernet * - 52 : 13203 : pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) + 52 : 13208 : pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) 53 : : { - 54 : 25342 : return pm_nl_get_pernet(sock_net((struct sock *)msk)); + 54 : 25426 : return pm_nl_get_pernet(sock_net((struct sock *)msk)); 55 : : } 56 : : - 57 : 8930 : bool mptcp_addresses_equal(const struct mptcp_addr_info *a, + 57 : 8889 : bool mptcp_addresses_equal(const struct mptcp_addr_info *a, 58 : : const struct mptcp_addr_info *b, bool use_port) 59 : : { - 60 : 8930 : bool addr_equals = false; + 60 : 8889 : bool addr_equals = false; 61 : : - 62 [ + + ]: 8930 : if (a->family == b->family) { - 63 [ + + ]: 7532 : if (a->family == AF_INET) - 64 : 6504 : addr_equals = a->addr.s_addr == b->addr.s_addr; + 62 [ + + ]: 8889 : if (a->family == b->family) { + 63 [ + + ]: 7508 : if (a->family == AF_INET) + 64 : 6502 : addr_equals = a->addr.s_addr == b->addr.s_addr; 65 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 66 : : else - 67 : 1028 : addr_equals = ipv6_addr_equal(&a->addr6, &b->addr6); - 68 [ + + ]: 1398 : } else if (a->family == AF_INET) { - 69 [ + + ]: 992 : if (ipv6_addr_v4mapped(&b->addr6)) - 70 : 676 : addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3]; - 71 [ + - ]: 406 : } else if (b->family == AF_INET) { - 72 [ + + ]: 406 : if (ipv6_addr_v4mapped(&a->addr6)) + 67 : 1006 : addr_equals = ipv6_addr_equal(&a->addr6, &b->addr6); + 68 [ + + ]: 1381 : } else if (a->family == AF_INET) { + 69 [ + + ]: 974 : if (ipv6_addr_v4mapped(&b->addr6)) + 70 : 678 : addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3]; + 71 [ + - ]: 407 : } else if (b->family == AF_INET) { + 72 [ + + ]: 407 : if (ipv6_addr_v4mapped(&a->addr6)) 73 : 182 : addr_equals = a->addr6.s6_addr32[3] == b->addr.s_addr; 74 : : #endif 75 : : } 76 : : - 77 [ + + ]: 8390 : if (!addr_equals) + 77 [ + + ]: 8368 : if (!addr_equals) 78 : : return false; - 79 [ + + ]: 2010 : if (!use_port) + 79 [ + + ]: 2004 : if (!use_port) 80 : : return true; 81 : : - 82 : 838 : return a->port == b->port; + 82 : 836 : return a->port == b->port; 83 : : } 84 : : - 85 : 3412 : void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) + 85 : 3405 : void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) 86 : : { - 87 : 3412 : addr->family = skc->skc_family; - 88 : 3412 : addr->port = htons(skc->skc_num); - 89 [ + + ]: 3412 : if (addr->family == AF_INET) - 90 : 1660 : addr->addr.s_addr = skc->skc_rcv_saddr; + 87 : 3405 : addr->family = skc->skc_family; + 88 : 3405 : addr->port = htons(skc->skc_num); + 89 [ + + ]: 3405 : if (addr->family == AF_INET) + 90 : 1658 : addr->addr.s_addr = skc->skc_rcv_saddr; 91 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 92 [ + - ]: 1752 : else if (addr->family == AF_INET6) - 93 : 1752 : addr->addr6 = skc->skc_v6_rcv_saddr; + 92 [ + - ]: 1747 : else if (addr->family == AF_INET6) + 93 : 1747 : addr->addr6 = skc->skc_v6_rcv_saddr; 94 : : #endif - 95 : 3412 : } + 95 : 3405 : } 96 : : 97 : 0 : static void remote_address(const struct sock_common *skc, 98 : : struct mptcp_addr_info *addr) 99 : : { - 100 : 792 : addr->family = skc->skc_family; - 101 : 792 : addr->port = skc->skc_dport; - 102 : 792 : if (addr->family == AF_INET) - 103 : 598 : addr->addr.s_addr = skc->skc_daddr; + 100 : 785 : addr->family = skc->skc_family; + 101 : 785 : addr->port = skc->skc_dport; + 102 : 785 : if (addr->family == AF_INET) + 103 : 594 : addr->addr.s_addr = skc->skc_daddr; 104 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 105 [ - - - - : 194 : else if (addr->family == AF_INET6) - + - + - + + 105 [ - - - - : 191 : else if (addr->family == AF_INET6) + + - + - + - ] 106 : 0 : addr->addr6 = skc->skc_v6_daddr; 107 : : #endif @@ -205,21 +205,21 @@ 125 : : return false; 126 : : } 127 : : - 128 : 290 : static bool lookup_subflow_by_daddr(const struct list_head *list, + 128 : 289 : static bool lookup_subflow_by_daddr(const struct list_head *list, 129 : : const struct mptcp_addr_info *daddr) 130 : : { - 131 : 290 : struct mptcp_subflow_context *subflow; - 132 : 290 : struct mptcp_addr_info cur; + 131 : 289 : struct mptcp_subflow_context *subflow; + 132 : 289 : struct mptcp_addr_info cur; 133 : : - 134 [ + + ]: 774 : list_for_each_entry(subflow, list, node) { - 135 : 502 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 134 [ + + ]: 766 : list_for_each_entry(subflow, list, node) { + 135 : 495 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 136 : : - 137 [ + + + + ]: 502 : if (!((1 << inet_sk_state_load(ssk)) & + 137 [ + + + + ]: 495 : if (!((1 << inet_sk_state_load(ssk)) & 138 : : (TCPF_ESTABLISHED | TCPF_SYN_SENT | TCPF_SYN_RECV))) 139 : 4 : continue; 140 : : - 141 [ + + ]: 498 : remote_address((struct sock_common *)ssk, &cur); - 142 [ + + ]: 498 : if (mptcp_addresses_equal(&cur, daddr, daddr->port)) + 141 [ + + ]: 491 : remote_address((struct sock_common *)ssk, &cur); + 142 [ + + ]: 491 : if (mptcp_addresses_equal(&cur, daddr, daddr->port)) 143 : : return true; 144 : : } 145 : : @@ -294,61 +294,61 @@ 206 : 310 : return found; 207 : : } 208 : : - 209 : 4481 : unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) + 209 : 4505 : unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) 210 : : { - 211 : 4331 : const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 211 : 4355 : const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 212 : : - 213 : 5122 : return READ_ONCE(pernet->add_addr_signal_max); + 213 : 5146 : return READ_ONCE(pernet->add_addr_signal_max); 214 : : } 215 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_signal_max); 216 : : - 217 : 4412 : unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) + 217 : 4436 : unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) 218 : : { - 219 : 4412 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 219 : 4436 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 220 : : - 221 : 4746 : return READ_ONCE(pernet->add_addr_accept_max); + 221 : 4769 : return READ_ONCE(pernet->add_addr_accept_max); 222 : : } 223 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_accept_max); 224 : : - 225 : 5140 : unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) + 225 : 5162 : unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) 226 : : { - 227 : 5140 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 227 : 5162 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 228 : : - 229 : 7485 : return READ_ONCE(pernet->subflows_max); + 229 : 7506 : return READ_ONCE(pernet->subflows_max); 230 : : } 231 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_subflows_max); 232 : : - 233 : 4783 : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) + 233 : 4807 : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) 234 : : { - 235 : 4633 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 235 : 4657 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 236 : : - 237 : 5424 : return READ_ONCE(pernet->local_addr_max); + 237 : 5448 : return READ_ONCE(pernet->local_addr_max); 238 : : } 239 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_local_addr_max); 240 : : - 241 : 1086 : bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) + 241 : 1087 : bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) 242 : : { - 243 : 1086 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 243 : 1087 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 244 : : - 245 [ + + + + ]: 1808 : if (msk->pm.subflows == mptcp_pm_get_subflows_max(msk) || - 246 [ + - ]: 896 : (find_next_and_bit(pernet->id_bitmap, msk->pm.id_avail_bitmap, + 245 [ + + + + ]: 1810 : if (msk->pm.subflows == mptcp_pm_get_subflows_max(msk) || + 246 [ + - ]: 897 : (find_next_and_bit(pernet->id_bitmap, msk->pm.id_avail_bitmap, 247 : : MPTCP_PM_MAX_ADDR_ID + 1, 0) == MPTCP_PM_MAX_ADDR_ID + 1)) { - 248 : 845 : WRITE_ONCE(msk->pm.work_pending, false); - 249 : 845 : return false; + 248 : 847 : WRITE_ONCE(msk->pm.work_pending, false); + 249 : 847 : return false; 250 : : } 251 : : return true; 252 : : } 253 : : 254 : : struct mptcp_pm_add_entry * - 255 : 1138 : mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, + 255 : 1136 : mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, 256 : : const struct mptcp_addr_info *addr) 257 : : { - 258 : 1138 : struct mptcp_pm_add_entry *entry; + 258 : 1136 : struct mptcp_pm_add_entry *entry; 259 : : - 260 [ + - - + ]: 1138 : lockdep_assert_held(&msk->pm.lock); + 260 [ + - - + ]: 1136 : lockdep_assert_held(&msk->pm.lock); 261 : : 262 [ + + ]: 1434 : list_for_each_entry(entry, &msk->pm.anno_list, list) { - 263 [ + + ]: 1026 : if (mptcp_addresses_equal(&entry->addr, addr, true)) + 263 [ + + ]: 1026 : if (mptcp_addresses_equal(&entry->addr, addr, true)) 264 : : return entry; 265 : : } 266 : : @@ -421,29 +421,29 @@ 333 : : } 334 : : 335 : : struct mptcp_pm_add_entry * - 336 : 462 : mptcp_pm_del_add_timer(struct mptcp_sock *msk, + 336 : 461 : mptcp_pm_del_add_timer(struct mptcp_sock *msk, 337 : : const struct mptcp_addr_info *addr, bool check_id) 338 : : { - 339 : 462 : struct mptcp_pm_add_entry *entry; - 340 : 462 : struct sock *sk = (struct sock *)msk; - 341 : 462 : struct timer_list *add_timer = NULL; + 339 : 461 : struct mptcp_pm_add_entry *entry; + 340 : 461 : struct sock *sk = (struct sock *)msk; + 341 : 461 : struct timer_list *add_timer = NULL; 342 : : - 343 : 462 : spin_lock_bh(&msk->pm.lock); - 344 : 462 : entry = mptcp_lookup_anno_list_by_saddr(msk, addr); - 345 [ + + + + : 462 : if (entry && (!check_id || entry->addr.id == addr->id)) { - + + ] - 346 : 394 : entry->retrans_times = ADD_ADDR_RETRANS_MAX; - 347 : 394 : add_timer = &entry->add_timer; + 343 : 461 : spin_lock_bh(&msk->pm.lock); + 344 : 461 : entry = mptcp_lookup_anno_list_by_saddr(msk, addr); + 345 [ + + + + : 461 : if (entry && (!check_id || entry->addr.id == addr->id)) { + + + ] + 346 : 393 : entry->retrans_times = ADD_ADDR_RETRANS_MAX; + 347 : 393 : add_timer = &entry->add_timer; 348 : : } - 349 [ + + ]: 462 : if (!check_id && entry) + 349 [ + + ]: 461 : if (!check_id && entry) 350 : 78 : list_del(&entry->list); - 351 : 462 : spin_unlock_bh(&msk->pm.lock); + 351 : 461 : spin_unlock_bh(&msk->pm.lock); 352 : : 353 : : /* no lock, because sk_stop_timer_sync() is calling del_timer_sync() */ - 354 [ + + ]: 462 : if (add_timer) - 355 : 394 : sk_stop_timer_sync(sk, add_timer); + 354 [ + + ]: 461 : if (add_timer) + 355 : 393 : sk_stop_timer_sync(sk, add_timer); 356 : : - 357 : 462 : return entry; + 357 : 461 : return entry; 358 : : } 359 : : 360 : 344 : bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, @@ -570,33 +570,33 @@ 480 : 340 : return i; 481 : : } 482 : : - 483 : 887 : static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, + 483 : 888 : static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, 484 : : bool prio, bool backup) 485 : : { - 486 [ - + ]: 887 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 487 : 887 : bool slow; + 486 [ - + ]: 888 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 487 : 888 : bool slow; 488 : : - 489 [ - + - - : 887 : pr_debug("send ack for %s\n", + 489 [ - + - - : 888 : pr_debug("send ack for %s\n", - - ] 490 : : prio ? "mp_prio" : (mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr")); 491 : : - 492 : 887 : slow = lock_sock_fast(ssk); - 493 [ + + ]: 887 : if (prio) { + 492 : 888 : slow = lock_sock_fast(ssk); + 493 [ + + ]: 888 : if (prio) { 494 : 28 : subflow->send_mp_prio = 1; 495 : 28 : subflow->request_bkup = backup; 496 : : } 497 : : - 498 : 887 : __mptcp_subflow_send_ack(ssk); - 499 : 887 : unlock_sock_fast(ssk, slow); - 500 : 887 : } + 498 : 888 : __mptcp_subflow_send_ack(ssk); + 499 : 888 : unlock_sock_fast(ssk, slow); + 500 : 888 : } 501 : : - 502 : 865 : static void mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, + 502 : 866 : static void mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, 503 : : bool prio, bool backup) 504 : : { - 505 : 865 : spin_unlock_bh(&msk->pm.lock); - 506 : 865 : __mptcp_pm_send_ack(msk, subflow, prio, backup); - 507 : 865 : spin_lock_bh(&msk->pm.lock); - 508 : 865 : } + 505 : 866 : spin_unlock_bh(&msk->pm.lock); + 506 : 866 : __mptcp_pm_send_ack(msk, subflow, prio, backup); + 507 : 866 : spin_lock_bh(&msk->pm.lock); + 508 : 866 : } 509 : : 510 : : static struct mptcp_pm_addr_entry * 511 : 450 : __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) @@ -616,16 +616,16 @@ 521 : : } 522 : : 523 : : static struct mptcp_pm_addr_entry * - 524 : 1590 : __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) + 524 : 1586 : __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) 525 : : { - 526 : 1590 : struct mptcp_pm_addr_entry *entry; + 526 : 1586 : struct mptcp_pm_addr_entry *entry; 527 : : - 528 [ + + + + : 3132 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list, + 528 [ + + + + : 3100 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list, - + - - - - - - + + ] 529 : : lockdep_is_held(&pernet->lock)) { - 530 [ + + ]: 2176 : if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) + 530 [ + + ]: 2144 : if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) 531 : : return entry; 532 : : } 533 : : return NULL; @@ -761,28 +761,28 @@ 660 : : /* Fill all the local addresses into the array addrs[], 661 : : * and return the array size. 662 : : */ - 663 : 272 : static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + 663 : 271 : static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, 664 : : struct mptcp_addr_info *remote, 665 : : struct mptcp_pm_local *locals) 666 : : { - 667 : 272 : struct sock *sk = (struct sock *)msk; - 668 : 272 : struct mptcp_pm_addr_entry *entry; - 669 : 272 : struct mptcp_addr_info mpc_addr; - 670 : 272 : struct pm_nl_pernet *pernet; - 671 : 272 : unsigned int subflows_max; - 672 : 272 : int i = 0; + 667 : 271 : struct sock *sk = (struct sock *)msk; + 668 : 271 : struct mptcp_pm_addr_entry *entry; + 669 : 271 : struct mptcp_addr_info mpc_addr; + 670 : 271 : struct pm_nl_pernet *pernet; + 671 : 271 : unsigned int subflows_max; + 672 : 271 : int i = 0; 673 : : - 674 : 272 : pernet = pm_nl_get_pernet_from_msk(msk); - 675 : 272 : subflows_max = mptcp_pm_get_subflows_max(msk); + 674 : 271 : pernet = pm_nl_get_pernet_from_msk(msk); + 675 : 271 : subflows_max = mptcp_pm_get_subflows_max(msk); 676 : : - 677 : 272 : mptcp_local_address((struct sock_common *)msk, &mpc_addr); + 677 : 271 : mptcp_local_address((struct sock_common *)msk, &mpc_addr); 678 : : - 679 : 272 : rcu_read_lock(); - 680 [ + + - + : 786 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { + 679 : 271 : rcu_read_lock(); + 680 [ + + - + : 777 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { - - - - - - + + ] - 681 [ + + ]: 514 : if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) - 682 : 506 : continue; + 681 [ + + ]: 506 : if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) + 682 : 498 : continue; 683 : : 684 [ + + ]: 8 : if (!mptcp_pm_addr_families_match(sk, &entry->addr, remote)) 685 : 2 : continue; @@ -800,78 +800,78 @@ 697 : 6 : i++; 698 : : } 699 : : } - 700 : 272 : rcu_read_unlock(); + 700 : 271 : rcu_read_unlock(); 701 : : 702 : : /* If the array is empty, fill in the single 703 : : * 'IPADDRANY' local address 704 : : */ - 705 [ + + ]: 272 : if (!i) { - 706 : 268 : memset(&locals[i], 0, sizeof(locals[i])); - 707 : 536 : locals[i].addr.family = + 705 [ + + ]: 271 : if (!i) { + 706 : 267 : memset(&locals[i], 0, sizeof(locals[i])); + 707 : 534 : locals[i].addr.family = 708 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 709 [ + + + + ]: 268 : remote->family == AF_INET6 && + 709 [ + + + + ]: 267 : remote->family == AF_INET6 && 710 [ # # ]: 0 : ipv6_addr_v4mapped(&remote->addr6) ? AF_INET : 711 : : #endif 712 : : remote->family; 713 : : - 714 [ + + ]: 268 : if (!mptcp_pm_addr_families_match(sk, &locals[i].addr, remote)) + 714 [ + + ]: 267 : if (!mptcp_pm_addr_families_match(sk, &locals[i].addr, remote)) 715 : : return 0; 716 : : - 717 : 246 : msk->pm.subflows++; - 718 : 246 : i++; + 717 : 245 : msk->pm.subflows++; + 718 : 245 : i++; 719 : : } 720 : : - 721 : 250 : return i; + 721 : 249 : return i; 722 : : } 723 : : - 724 : 290 : static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) + 724 : 289 : static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) 725 : : { - 726 : 290 : struct mptcp_pm_local locals[MPTCP_PM_ADDR_MAX]; - 727 : 290 : struct sock *sk = (struct sock *)msk; - 728 : 290 : unsigned int add_addr_accept_max; - 729 : 290 : struct mptcp_addr_info remote; - 730 : 290 : unsigned int subflows_max; - 731 : 290 : bool sf_created = false; - 732 : 290 : int i, nr; + 726 : 289 : struct mptcp_pm_local locals[MPTCP_PM_ADDR_MAX]; + 727 : 289 : struct sock *sk = (struct sock *)msk; + 728 : 289 : unsigned int add_addr_accept_max; + 729 : 289 : struct mptcp_addr_info remote; + 730 : 289 : unsigned int subflows_max; + 731 : 289 : bool sf_created = false; + 732 : 289 : int i, nr; 733 : : - 734 : 290 : add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); - 735 : 290 : subflows_max = mptcp_pm_get_subflows_max(msk); + 734 : 289 : add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); + 735 : 289 : subflows_max = mptcp_pm_get_subflows_max(msk); 736 : : - 737 [ - + ]: 290 : pr_debug("accepted %d:%d remote family %d\n", + 737 [ - + ]: 289 : pr_debug("accepted %d:%d remote family %d\n", 738 : : msk->pm.add_addr_accepted, add_addr_accept_max, 739 : : msk->pm.remote.family); 740 : : - 741 : 290 : remote = msk->pm.remote; - 742 : 290 : mptcp_pm_announce_addr(msk, &remote, true); - 743 : 290 : mptcp_pm_nl_addr_send_ack(msk); + 741 : 289 : remote = msk->pm.remote; + 742 : 289 : mptcp_pm_announce_addr(msk, &remote, true); + 743 : 289 : mptcp_pm_nl_addr_send_ack(msk); 744 : : - 745 [ + + ]: 290 : if (lookup_subflow_by_daddr(&msk->conn_list, &remote)) + 745 [ + + ]: 289 : if (lookup_subflow_by_daddr(&msk->conn_list, &remote)) 746 : 40 : return; 747 : : 748 : : /* pick id 0 port, if none is provided the remote address */ - 749 [ + + ]: 272 : if (!remote.port) - 750 : 240 : remote.port = sk->sk_dport; + 749 [ + + ]: 271 : if (!remote.port) + 750 : 239 : remote.port = sk->sk_dport; 751 : : 752 : : /* connect to the specified remote address, using whatever 753 : : * local address the routing configuration will pick. 754 : : */ - 755 : 272 : nr = fill_local_addresses_vec(msk, &remote, locals); - 756 [ + + ]: 272 : if (nr == 0) + 755 : 271 : nr = fill_local_addresses_vec(msk, &remote, locals); + 756 [ + + ]: 271 : if (nr == 0) 757 : : return; 758 : : - 759 : 250 : spin_unlock_bh(&msk->pm.lock); - 760 [ + + ]: 752 : for (i = 0; i < nr; i++) - 761 [ + + ]: 252 : if (__mptcp_subflow_connect(sk, &locals[i], &remote) == 0) - 762 : 226 : sf_created = true; - 763 : 250 : spin_lock_bh(&msk->pm.lock); + 759 : 249 : spin_unlock_bh(&msk->pm.lock); + 760 [ + + ]: 749 : for (i = 0; i < nr; i++) + 761 [ + + ]: 251 : if (__mptcp_subflow_connect(sk, &locals[i], &remote) == 0) + 762 : 225 : sf_created = true; + 763 : 249 : spin_lock_bh(&msk->pm.lock); 764 : : - 765 [ + + ]: 250 : if (sf_created) { + 765 [ + + ]: 249 : if (sf_created) { 766 : : /* add_addr_accepted is not decr for ID 0 */ - 767 [ + + ]: 224 : if (remote.id) - 768 : 220 : msk->pm.add_addr_accepted++; - 769 [ + + ]: 224 : if (msk->pm.add_addr_accepted >= add_addr_accept_max || - 770 [ + + ]: 110 : msk->pm.subflows >= subflows_max) - 771 : 250 : WRITE_ONCE(msk->pm.accept_addr, false); + 767 [ + + ]: 223 : if (remote.id) + 768 : 219 : msk->pm.add_addr_accepted++; + 769 [ + + ]: 223 : if (msk->pm.add_addr_accepted >= add_addr_accept_max || + 770 [ + + ]: 109 : msk->pm.subflows >= subflows_max) + 771 : 249 : WRITE_ONCE(msk->pm.accept_addr, false); 772 : : } 773 : : } 774 : : @@ -884,22 +884,22 @@ 781 : 4 : return mptcp_addresses_equal(&mpc_remote, remote, remote->port); 782 : : } 783 : : - 784 : 862 : void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) + 784 : 861 : void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) 785 : : { - 786 : 862 : struct mptcp_subflow_context *subflow, *alt = NULL; + 786 : 861 : struct mptcp_subflow_context *subflow, *alt = NULL; 787 : : - 788 : 862 : msk_owned_by_me(msk); - 789 [ + - - + ]: 862 : lockdep_assert_held(&msk->pm.lock); + 788 : 861 : msk_owned_by_me(msk); + 789 [ + - - + ]: 861 : lockdep_assert_held(&msk->pm.lock); 790 : : - 791 [ + + + + ]: 862 : if (!mptcp_pm_should_add_signal(msk) && + 791 [ + + + + ]: 861 : if (!mptcp_pm_should_add_signal(msk) && 792 [ # # ]: 0 : !mptcp_pm_should_rm_signal(msk)) 793 : : return; 794 : : - 795 [ + - ]: 873 : mptcp_for_each_subflow(msk, subflow) { - 796 [ + + ]: 873 : if (__mptcp_subflow_active(subflow)) { - 797 [ + - ]: 859 : if (!subflow->stale) { - 798 : 859 : mptcp_pm_send_ack(msk, subflow, false, false); - 799 : 859 : return; + 795 [ + - ]: 874 : mptcp_for_each_subflow(msk, subflow) { + 796 [ + + ]: 874 : if (__mptcp_subflow_active(subflow)) { + 797 [ + - ]: 860 : if (!subflow->stale) { + 798 : 860 : mptcp_pm_send_ack(msk, subflow, false, false); + 799 : 860 : return; 800 : : } 801 : : 802 [ # # ]: 0 : if (!alt) @@ -1027,21 +1027,21 @@ 924 : 86 : mptcp_pm_nl_rm_addr_or_subflow(msk, rm_list, MPTCP_MIB_RMSUBFLOW); 925 : 12 : } 926 : : - 927 : 13695 : void mptcp_pm_nl_work(struct mptcp_sock *msk) + 927 : 13286 : void mptcp_pm_nl_work(struct mptcp_sock *msk) 928 : : { - 929 : 13695 : struct mptcp_pm_data *pm = &msk->pm; + 929 : 13286 : struct mptcp_pm_data *pm = &msk->pm; 930 : : - 931 : 13695 : msk_owned_by_me(msk); + 931 : 13286 : msk_owned_by_me(msk); 932 : : - 933 [ + + ]: 13695 : if (!(pm->status & MPTCP_PM_WORK_MASK)) + 933 [ + + ]: 13286 : if (!(pm->status & MPTCP_PM_WORK_MASK)) 934 : : return; 935 : : 936 : 957 : spin_lock_bh(&msk->pm.lock); 937 : : 938 [ - + ]: 957 : pr_debug("msk=%p status=%x\n", msk, pm->status); - 939 [ + + ]: 957 : if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) { - 940 : 290 : pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED); - 941 : 290 : mptcp_pm_nl_add_addr_received(msk); + 939 [ + + ]: 957 : if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) { + 940 : 289 : pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED); + 941 : 289 : mptcp_pm_nl_add_addr_received(msk); 942 : : } 943 [ + + ]: 957 : if (pm->status & BIT(MPTCP_PM_ADD_ADDR_SEND_ACK)) { 944 : 122 : pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_SEND_ACK); @@ -1245,20 +1245,20 @@ 1139 : 22 : return err; 1140 : : } 1141 : : - 1142 : 364 : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) + 1142 : 362 : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) 1143 : : { - 1144 : 364 : struct mptcp_pm_addr_entry *entry; - 1145 : 364 : struct pm_nl_pernet *pernet; - 1146 : 364 : int ret; + 1144 : 362 : struct mptcp_pm_addr_entry *entry; + 1145 : 362 : struct pm_nl_pernet *pernet; + 1146 : 362 : int ret; 1147 : : - 1148 : 364 : pernet = pm_nl_get_pernet_from_msk(msk); + 1148 : 362 : pernet = pm_nl_get_pernet_from_msk(msk); 1149 : : - 1150 : 364 : rcu_read_lock(); - 1151 : 364 : entry = __lookup_addr(pernet, skc); - 1152 [ + + ]: 364 : ret = entry ? entry->addr.id : -1; - 1153 : 252 : rcu_read_unlock(); - 1154 : 364 : if (ret >= 0) - 1155 : 224 : return ret; + 1150 : 362 : rcu_read_lock(); + 1151 : 362 : entry = __lookup_addr(pernet, skc); + 1152 [ + + ]: 362 : ret = entry ? entry->addr.id : -1; + 1153 : 250 : rcu_read_unlock(); + 1154 : 362 : if (ret >= 0) + 1155 : 222 : return ret; 1156 : : 1157 : : /* address not found, add to local list */ 1158 : 140 : entry = kmalloc(sizeof(*entry), GFP_ATOMIC); @@ -1278,18 +1278,18 @@ 1172 : : return ret; 1173 : : } 1174 : : - 1175 : 742 : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) + 1175 : 740 : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) 1176 : : { - 1177 : 742 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - 1178 : 742 : struct mptcp_pm_addr_entry *entry; - 1179 : 742 : bool backup; + 1177 : 740 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 1178 : 740 : struct mptcp_pm_addr_entry *entry; + 1179 : 740 : bool backup; 1180 : : - 1181 : 742 : rcu_read_lock(); - 1182 : 742 : entry = __lookup_addr(pernet, skc); - 1183 [ + + + + ]: 742 : backup = entry && !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); - 1184 : 742 : rcu_read_unlock(); + 1181 : 740 : rcu_read_lock(); + 1182 : 740 : entry = __lookup_addr(pernet, skc); + 1183 [ + + + + ]: 740 : backup = entry && !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + 1184 : 740 : rcu_read_unlock(); 1185 : : - 1186 : 742 : return backup; + 1186 : 740 : return backup; 1187 : : } 1188 : : 1189 : : #define MPTCP_PM_CMD_GRP_OFFSET 0 @@ -1302,40 +1302,40 @@ 1196 : : }, 1197 : : }; 1198 : : - 1199 : 537 : void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) + 1199 : 329 : void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) 1200 : : { - 1201 : 537 : struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk); - 1202 : 537 : struct sock *sk = (struct sock *)msk; - 1203 : 537 : unsigned int active_max_loss_cnt; - 1204 : 537 : struct net *net = sock_net(sk); - 1205 : 537 : unsigned int stale_loss_cnt; - 1206 : 537 : bool slow; + 1201 : 329 : struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk); + 1202 : 329 : struct sock *sk = (struct sock *)msk; + 1203 : 329 : unsigned int active_max_loss_cnt; + 1204 : 329 : struct net *net = sock_net(sk); + 1205 : 329 : unsigned int stale_loss_cnt; + 1206 : 329 : bool slow; 1207 : : - 1208 : 537 : stale_loss_cnt = mptcp_stale_loss_cnt(net); - 1209 [ + + + - : 537 : if (subflow->stale || !stale_loss_cnt || subflow->stale_count <= stale_loss_cnt) - + + ] + 1208 : 329 : stale_loss_cnt = mptcp_stale_loss_cnt(net); + 1209 [ + + + - : 329 : if (subflow->stale || !stale_loss_cnt || subflow->stale_count <= stale_loss_cnt) + + + ] 1210 : : return; 1211 : : 1212 : : /* look for another available subflow not in loss state */ - 1213 : 408 : active_max_loss_cnt = max_t(int, stale_loss_cnt - 1, 1); - 1214 [ + + ]: 822 : mptcp_for_each_subflow(msk, iter) { - 1215 [ + + + + ]: 431 : if (iter != subflow && mptcp_subflow_active(iter) && - 1216 [ + + ]: 22 : iter->stale_count < active_max_loss_cnt) { + 1213 : 234 : active_max_loss_cnt = max_t(int, stale_loss_cnt - 1, 1); + 1214 [ + + ]: 474 : mptcp_for_each_subflow(msk, iter) { + 1215 [ + + + + ]: 256 : if (iter != subflow && mptcp_subflow_active(iter) && + 1216 [ + + ]: 21 : iter->stale_count < active_max_loss_cnt) { 1217 : : /* we have some alternatives, try to mark this subflow as idle ...*/ - 1218 : 17 : slow = lock_sock_fast(ssk); - 1219 [ + + ]: 17 : if (!tcp_rtx_and_write_queues_empty(ssk)) { - 1220 : 17 : subflow->stale = 1; - 1221 : 17 : __mptcp_retransmit_pending_data(sk); - 1222 [ + - ]: 17 : MPTCP_INC_STATS(net, MPTCP_MIB_SUBFLOWSTALE); + 1218 : 16 : slow = lock_sock_fast(ssk); + 1219 [ + + ]: 16 : if (!tcp_rtx_and_write_queues_empty(ssk)) { + 1220 : 16 : subflow->stale = 1; + 1221 : 16 : __mptcp_retransmit_pending_data(sk); + 1222 [ + - ]: 16 : MPTCP_INC_STATS(net, MPTCP_MIB_SUBFLOWSTALE); 1223 : : } - 1224 : 17 : unlock_sock_fast(ssk, slow); + 1224 : 16 : unlock_sock_fast(ssk, slow); 1225 : : 1226 : : /* always try to push the pending data regardless of re-injections: 1227 : : * we can possibly use backup subflows now, and subflow selection 1228 : : * is cheap under the msk socket lock 1229 : : */ - 1230 : 17 : __mptcp_push_pending(sk, 0); - 1231 : 17 : return; + 1230 : 16 : __mptcp_push_pending(sk, 0); + 1231 : 16 : return; 1232 : : } 1233 : : } 1234 : : } @@ -2108,11 +2108,11 @@ 1992 : 46 : return 0; 1993 : : } 1994 : : - 1995 : 438 : static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp) + 1995 : 430 : static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp) 1996 : : { - 1997 : 438 : genlmsg_multicast_netns(&mptcp_genl_family, net, + 1997 : 430 : genlmsg_multicast_netns(&mptcp_genl_family, net, 1998 : : nlskb, 0, MPTCP_PM_EV_GRP_OFFSET, gfp); - 1999 : 438 : } + 1999 : 430 : } 2000 : : 2001 : 78 : bool mptcp_userspace_pm_active(const struct mptcp_sock *msk) 2002 : : { @@ -2129,18 +2129,18 @@ 2013 [ - + ]: 268 : if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) 2014 : : return -EMSGSIZE; 2015 : : - 2016 [ + + - ]: 268 : switch (ssk->sk_family) { - 2017 : 154 : case AF_INET: - 2018 [ - + ]: 154 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) + 2016 [ + + - ]: 268 : switch (ssk->sk_family) { + 2017 : 152 : case AF_INET: + 2018 [ - + ]: 152 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) 2019 : : return -EMSGSIZE; - 2020 [ - + ]: 154 : if (nla_put_in_addr(skb, MPTCP_ATTR_DADDR4, issk->inet_daddr)) + 2020 [ - + ]: 152 : if (nla_put_in_addr(skb, MPTCP_ATTR_DADDR4, issk->inet_daddr)) 2021 : : return -EMSGSIZE; 2022 : : break; 2023 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 2024 : 114 : case AF_INET6: { - 2025 [ - + ]: 114 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &issk->pinet6->saddr)) + 2024 : 116 : case AF_INET6: { + 2025 [ - + ]: 116 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &issk->pinet6->saddr)) 2026 : : return -EMSGSIZE; - 2027 [ - + ]: 114 : if (nla_put_in6_addr(skb, MPTCP_ATTR_DADDR6, &ssk->sk_v6_daddr)) + 2027 [ - + ]: 116 : if (nla_put_in6_addr(skb, MPTCP_ATTR_DADDR6, &ssk->sk_v6_daddr)) 2028 : : return -EMSGSIZE; 2029 : : break; 2030 : : } @@ -2334,39 +2334,39 @@ 2217 : 0 : nlmsg_free(skb); 2218 : : } 2219 : : - 2220 : 2520 : void mptcp_event_pm_listener(const struct sock *ssk, + 2220 : 2512 : void mptcp_event_pm_listener(const struct sock *ssk, 2221 : : enum mptcp_event_type event) 2222 : : { - 2223 : 2520 : const struct inet_sock *issk = inet_sk(ssk); - 2224 : 2520 : struct net *net = sock_net(ssk); - 2225 : 2520 : struct nlmsghdr *nlh; - 2226 : 2520 : struct sk_buff *skb; + 2223 : 2512 : const struct inet_sock *issk = inet_sk(ssk); + 2224 : 2512 : struct net *net = sock_net(ssk); + 2225 : 2512 : struct nlmsghdr *nlh; + 2226 : 2512 : struct sk_buff *skb; 2227 : : - 2228 [ + + ]: 2520 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) + 2228 [ + + ]: 2512 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) 2229 : : return; 2230 : : - 2231 : 62 : skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - 2232 [ + - ]: 62 : if (!skb) + 2231 : 54 : skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); + 2232 [ + - ]: 54 : if (!skb) 2233 : : return; 2234 : : - 2235 : 62 : nlh = genlmsg_put(skb, 0, 0, &mptcp_genl_family, 0, event); - 2236 [ - + ]: 62 : if (!nlh) + 2235 : 54 : nlh = genlmsg_put(skb, 0, 0, &mptcp_genl_family, 0, event); + 2236 [ - + ]: 54 : if (!nlh) 2237 : 0 : goto nla_put_failure; 2238 : : - 2239 [ - + ]: 62 : if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) + 2239 [ - + ]: 54 : if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) 2240 : 0 : goto nla_put_failure; 2241 : : - 2242 [ - + ]: 62 : if (nla_put_be16(skb, MPTCP_ATTR_SPORT, issk->inet_sport)) + 2242 [ - + ]: 54 : if (nla_put_be16(skb, MPTCP_ATTR_SPORT, issk->inet_sport)) 2243 : 0 : goto nla_put_failure; 2244 : : - 2245 [ + + - ]: 62 : switch (ssk->sk_family) { - 2246 : 32 : case AF_INET: - 2247 [ - + ]: 32 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) + 2245 [ + + - ]: 54 : switch (ssk->sk_family) { + 2246 : 26 : case AF_INET: + 2247 [ - + ]: 26 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) 2248 : 0 : goto nla_put_failure; 2249 : : break; 2250 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 2251 : 30 : case AF_INET6: { - 2252 [ - + ]: 30 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &issk->pinet6->saddr)) + 2251 : 28 : case AF_INET6: { + 2252 [ - + ]: 28 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &issk->pinet6->saddr)) 2253 : 0 : goto nla_put_failure; 2254 : : break; 2255 : : } @@ -2376,22 +2376,22 @@ 2259 : 0 : goto nla_put_failure; 2260 : : } 2261 : : - 2262 : 62 : genlmsg_end(skb, nlh); - 2263 : 62 : mptcp_nl_mcast_send(net, skb, GFP_KERNEL); - 2264 : 62 : return; + 2262 : 54 : genlmsg_end(skb, nlh); + 2263 : 54 : mptcp_nl_mcast_send(net, skb, GFP_KERNEL); + 2264 : 54 : return; 2265 : : 2266 : 0 : nla_put_failure: 2267 : 0 : nlmsg_free(skb); 2268 : : } 2269 : : - 2270 : 8137 : void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, + 2270 : 8157 : void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, 2271 : : const struct sock *ssk, gfp_t gfp) 2272 : : { - 2273 : 8137 : struct net *net = sock_net((const struct sock *)msk); - 2274 : 8137 : struct nlmsghdr *nlh; - 2275 : 8137 : struct sk_buff *skb; + 2273 : 8157 : struct net *net = sock_net((const struct sock *)msk); + 2274 : 8157 : struct nlmsghdr *nlh; + 2275 : 8157 : struct sk_buff *skb; 2276 : : - 2277 [ + + ]: 8137 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) + 2277 [ + + ]: 8157 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) 2278 : : return; 2279 : : 2280 : 280 : skb = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); @@ -2474,11 +2474,11 @@ 2356 : 1094 : return 0; 2357 : : } 2358 : : - 2359 : 918 : static void __net_exit pm_nl_exit_net(struct list_head *net_list) + 2359 : 927 : static void __net_exit pm_nl_exit_net(struct list_head *net_list) 2360 : : { - 2361 : 918 : struct net *net; + 2361 : 927 : struct net *net; 2362 : : - 2363 [ + + ]: 1934 : list_for_each_entry(net, net_list, exit_list) { + 2363 [ + + ]: 1943 : list_for_each_entry(net, net_list, exit_list) { 2364 : 1016 : struct pm_nl_pernet *pernet = pm_nl_get_pernet(net); 2365 : : 2366 : : /* net is removed from namespace list, can't race with @@ -2487,7 +2487,7 @@ 2369 : : */ 2370 : 1016 : __flush_addrs(&pernet->local_addr_list); 2371 : : } - 2372 : 918 : } + 2372 : 927 : } 2373 : : 2374 : : static struct pernet_operations mptcp_pm_pernet_ops = { 2375 : : .init = pm_nl_init_net, diff --git a/html/lcov/export/mptcp/pm_userspace.c.func-c.html b/html/lcov/export/mptcp/pm_userspace.c.func-c.html index a7423f51..3491c58a 100644 --- a/html/lcov/export/mptcp/pm_userspace.c.func-c.html +++ b/html/lcov/export/mptcp/pm_userspace.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/pm_userspace.c.func.html b/html/lcov/export/mptcp/pm_userspace.c.func.html index 71d48f22..f8f65350 100644 --- a/html/lcov/export/mptcp/pm_userspace.c.func.html +++ b/html/lcov/export/mptcp/pm_userspace.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/pm_userspace.c.gcov.html b/html/lcov/export/mptcp/pm_userspace.c.gcov.html index 349a4fed..000ccc1a 100644 --- a/html/lcov/export/mptcp/pm_userspace.c.gcov.html +++ b/html/lcov/export/mptcp/pm_userspace.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/protocol.c.func-c.html b/html/lcov/export/mptcp/protocol.c.func-c.html index 6da1c384..b2bd998e 100644 --- a/html/lcov/export/mptcp/protocol.c.func-c.html +++ b/html/lcov/export/mptcp/protocol.c.func-c.html @@ -31,13 +31,13 @@ export Lines: - 91.0 % + 91.2 % 2158 - 1964 + 1968 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 69.0 % + 69.3 % 1623 - 1120 + 1124 @@ -165,7 +165,7 @@ __mptcp_flush_join_list - 32 + 33 @@ -207,21 +207,21 @@ mptcp_subflow_set_active - 143 + 130 mptcp_do_fastclose - 367 + 388 mptcp_inq_hint - 433 + 432 @@ -235,21 +235,21 @@ schedule_3rdack_retransmission - 500 + 499 __mptcp_finish_join - 506 + 505 __mptcp_close_subflow - 559 + 586 @@ -263,26 +263,26 @@ __mptcp_retransmit_pending_data - 734 + 766 mptcp_close_ssk - 754 + 787 - __mptcp_subflow_disconnect + __mptcp_error_report - 773 + 808 - __mptcp_error_report + __mptcp_subflow_disconnect 824 @@ -291,42 +291,42 @@ mptcp_update_data_checksum - 868 + 855 mptcp_finish_join - 994 + 992 mptcp_subflow_joined - 994 + 992 mptcp_reset_tout_timer - 1085 + 1065 - mptcp_set_datafin_timeout + mptcp_finish_connect - 1119 + 1124 - mptcp_finish_connect + mptcp_set_datafin_timeout - 1124 + 1143 @@ -345,14 +345,14 @@ - mptcp_bind + mptcp_listen - 1246 + 1242 - mptcp_listen + mptcp_bind 1246 @@ -368,35 +368,35 @@ mptcp_shutdown - 1487 + 1477 - __mptcp_wr_shutdown + mptcp_subflow_get_retrans - 2138 + 2082 - mptcp_subflow_get_retrans + __mptcp_wr_shutdown - 2290 + 2157 - mptcp_rcv_space_init + mptcp_check_listen_stop 2376 - mptcp_check_listen_stop + mptcp_rcv_space_init - 2382 + 2376 @@ -417,7 +417,7 @@ mptcp_close_state - 2587 + 2561 @@ -431,21 +431,21 @@ mptcp_cancel_work - 2627 + 2646 mptcp_send_ack - 2802 + 2799 mptcp_subflow_shutdown - 2998 + 3013 @@ -501,21 +501,21 @@ mptcp_subflow_send_ack - 3722 + 3751 mptcp_close_wake_up - 4370 + 4366 __mptcp_subflow_send_ack - 4609 + 4639 @@ -529,483 +529,483 @@ mptcp_copy_inaddrs - 4936 + 4928 __mptcp_close_ssk - 5402 + 5453 __mptcp_subflow_error_report - 5541 + 5521 __mptcp_nmpc_sk - 7162 + 7158 mptcp_check_and_set_pending - 10729 + 10259 __mptcp_retrans - 11633 + 11138 mptcp_clean_una_wakeup - 11633 + 11138 mptcp_retransmit_timer - 11963 + 11445 mptcp_check_data_fin_ack - 13691 + 13284 mptcp_check_fastclose - 13691 + 13284 mptcp_close_tout_expired - 13691 + 13284 mptcp_worker - 13832 + 13417 mptcp_schedule_work - 15323 + 14934 mptcp_set_state - 16937 + 16945 - mptcp_stop_rtx_timer + mptcp_subflow_process_delegated - 26111 + 30041 - mptcp_subflow_process_delegated + mptcp_stop_rtx_timer - 31072 + 40198 - mptcp_wnd_end + __mptcp_clean_una_wakeup - 42353 + 43300 - __mptcp_clean_una_wakeup + mptcp_napi_poll - 49803 + 43965 - mptcp_napi_poll + mptcp_wnd_end - 62587 + 59801 - __mptcp_subflow_push_pending + mptcp_check_data_fin - 74060 + 74163 - mptcp_check_data_fin + __mptcp_subflow_push_pending - 75335 + 90624 mptcp_data_queue_ofo - 116680 + 112621 tcp_can_send_ack - 158346 + 140389 - mptcp_subflow_cleanup_rbuf + __mptcp_first_ready_from - 229594 + 206105 - mptcp_reset_rtx_timer + mptcp_subflow_cleanup_rbuf - 246996 + 246585 - __mptcp_clean_una + mptcp_reset_rtx_timer - 248710 + 274580 - __mptcp_first_ready_from + __mptcp_clean_una - 254419 + 275499 - mptcp_pending_data_fin_ack + __mptcp_data_acked - 262401 + 288725 - __mptcp_add_ext + mptcp_pending_data_fin_ack - 267878 + 288783 - __mptcp_alloc_tx_skb + __mptcp_move_skbs - 267878 + 289067 - __mptcp_do_alloc_tx_skb + __mptcp_add_ext - 267878 + 312136 - __mptcp_data_acked + __mptcp_alloc_tx_skb - 277334 + 312136 - __mptcp_move_skbs + __mptcp_do_alloc_tx_skb - 299890 + 312136 mptcp_set_timeout - 330108 + 342646 - mptcp_check_writeable + mptcp_check_send_data_fin - 369093 + 417662 - mptcp_subflow_get_send + mptcp_check_writeable - 395043 + 438194 - mptcp_check_send_data_fin + mptcp_try_coalesce - 411732 + 492796 - mptcp_try_coalesce + mptcp_subflow_get_send - 467828 + 493832 dfrag_clear - 486120 + 501763 mptcp_carve_data_frag - 486126 + 501769 mptcp_page_frag_refill - 486126 + 501769 - mptcp_sendmsg + __mptcp_data_ready - 509914 + 567996 - mptcp_push_release + move_skbs_to_msk - 511642 + 567996 - mptcp_skb_can_collapse_to + mptcp_push_release - 531587 + 573107 - __mptcp_push_pending + mptcp_sendmsg - 532830 + 576310 - __mptcp_data_ready + mptcp_update_post_push - 538488 + 578775 - move_skbs_to_msk + __mptcp_push_pending - 538488 + 600054 - mptcp_update_post_push + mptcp_skb_can_collapse_to - 545793 + 600960 - __subflow_push_pending + mptcp_pending_data_fin - 587850 + 642159 - do_copy_data_nocache + __mptcp_move_skbs_from_subflow - 606383 + 642880 - mptcp_frag_can_collapse_to + __mptcp_move_skb - 606383 + 668383 - mptcp_send_limit + __subflow_push_pending - 608897 + 681533 - mptcp_pending_data_fin + do_copy_data_nocache - 613823 + 682253 - __mptcp_move_skbs_from_subflow + mptcp_frag_can_collapse_to - 614988 + 682253 - __mptcp_move_skb + mptcp_send_limit - 641989 + 684449 mptcp_data_ready - 650644 + 688962 - mptcp_poll + mptcp_recvmsg - 652353 + 728196 - mptcp_recvmsg + mptcp_poll - 667233 + 751128 - mptcp_check_allowed_size + __mptcp_recvmsg_mskq - 672303 + 752848 - mptcp_sendmsg_frag + mptcp_rcv_space_adjust - 672303 + 752848 - __mptcp_recvmsg_mskq + mptcp_check_allowed_size - 699965 + 791398 - mptcp_rcv_space_adjust + mptcp_sendmsg_frag - 699965 + 791398 - __mptcp_set_timeout + mptcp_cleanup_rbuf - 725151 + 804815 - mptcp_cleanup_rbuf + __mptcp_set_timeout - 748057 + 836478 __mptcp_ofo_queue - 838370 + 857056 __mptcp_check_push - 1011405 + 1000586 mptcp_subflow_active - 1152236 + 1278856 - mptcp_release_cb + mptcp_subflow_could_cleanup - 1249924 + 1316673 - mptcp_subflow_could_cleanup + mptcp_release_cb - 1274575 + 1370794 diff --git a/html/lcov/export/mptcp/protocol.c.func.html b/html/lcov/export/mptcp/protocol.c.func.html index d9119973..797d0b9c 100644 --- a/html/lcov/export/mptcp/protocol.c.func.html +++ b/html/lcov/export/mptcp/protocol.c.func.html @@ -31,13 +31,13 @@ export Lines: - 91.0 % + 91.2 % 2158 - 1964 + 1968 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 69.0 % + 69.3 % 1623 - 1120 + 1124 @@ -81,35 +81,35 @@ __mptcp_add_ext - 267878 + 312136 __mptcp_alloc_tx_skb - 267878 + 312136 __mptcp_check_push - 1011405 + 1000586 __mptcp_clean_una - 248710 + 275499 __mptcp_clean_una_wakeup - 49803 + 43300 @@ -130,28 +130,28 @@ __mptcp_close_ssk - 5402 + 5453 __mptcp_close_subflow - 559 + 586 __mptcp_data_acked - 277334 + 288725 __mptcp_data_ready - 538488 + 567996 @@ -165,35 +165,35 @@ __mptcp_do_alloc_tx_skb - 267878 + 312136 __mptcp_error_report - 824 + 808 __mptcp_finish_join - 506 + 505 __mptcp_first_ready_from - 254419 + 206105 __mptcp_flush_join_list - 32 + 33 @@ -207,70 +207,70 @@ __mptcp_move_skb - 641989 + 668383 __mptcp_move_skbs - 299890 + 289067 __mptcp_move_skbs_from_subflow - 614988 + 642880 __mptcp_nmpc_sk - 7162 + 7158 __mptcp_ofo_queue - 838370 + 857056 __mptcp_push_pending - 532830 + 600054 __mptcp_recvmsg_mskq - 699965 + 752848 __mptcp_retrans - 11633 + 11138 __mptcp_retransmit_pending_data - 734 + 766 __mptcp_set_timeout - 725151 + 836478 @@ -284,28 +284,28 @@ __mptcp_subflow_disconnect - 773 + 824 __mptcp_subflow_error_report - 5541 + 5521 __mptcp_subflow_push_pending - 74060 + 90624 __mptcp_subflow_send_ack - 4609 + 4639 @@ -319,35 +319,35 @@ __mptcp_wr_shutdown - 2138 + 2157 __subflow_push_pending - 587850 + 681533 dfrag_clear - 486120 + 501763 do_copy_data_nocache - 606383 + 682253 move_skbs_to_msk - 538488 + 567996 @@ -368,84 +368,84 @@ mptcp_cancel_work - 2627 + 2646 mptcp_carve_data_frag - 486126 + 501769 mptcp_check_allowed_size - 672303 + 791398 mptcp_check_and_set_pending - 10729 + 10259 mptcp_check_data_fin - 75335 + 74163 mptcp_check_data_fin_ack - 13691 + 13284 mptcp_check_fastclose - 13691 + 13284 mptcp_check_listen_stop - 2382 + 2376 mptcp_check_send_data_fin - 411732 + 417662 mptcp_check_writeable - 369093 + 438194 mptcp_clean_una_wakeup - 11633 + 11138 mptcp_cleanup_rbuf - 748057 + 804815 @@ -459,28 +459,28 @@ mptcp_close_ssk - 754 + 787 mptcp_close_state - 2587 + 2561 mptcp_close_tout_expired - 13691 + 13284 mptcp_close_wake_up - 4370 + 4366 @@ -494,7 +494,7 @@ mptcp_copy_inaddrs - 4936 + 4928 @@ -515,14 +515,14 @@ mptcp_data_queue_ofo - 116680 + 112621 mptcp_data_ready - 650644 + 688962 @@ -550,7 +550,7 @@ mptcp_do_fastclose - 367 + 388 @@ -585,14 +585,14 @@ mptcp_finish_join - 994 + 992 mptcp_frag_can_collapse_to - 606383 + 682253 @@ -620,7 +620,7 @@ mptcp_inq_hint - 433 + 432 @@ -641,7 +641,7 @@ mptcp_listen - 1246 + 1242 @@ -655,35 +655,35 @@ mptcp_napi_poll - 62587 + 43965 mptcp_page_frag_refill - 486126 + 501769 mptcp_pending_data_fin - 613823 + 642159 mptcp_pending_data_fin_ack - 262401 + 288783 mptcp_poll - 652353 + 751128 @@ -704,14 +704,14 @@ mptcp_push_release - 511642 + 573107 mptcp_rcv_space_adjust - 699965 + 752848 @@ -725,63 +725,63 @@ mptcp_recvmsg - 667233 + 728196 mptcp_release_cb - 1249924 + 1370794 mptcp_reset_rtx_timer - 246996 + 274580 mptcp_reset_tout_timer - 1085 + 1065 mptcp_retransmit_timer - 11963 + 11445 mptcp_schedule_work - 15323 + 14934 mptcp_send_ack - 2802 + 2799 mptcp_send_limit - 608897 + 684449 mptcp_sendmsg - 509914 + 576310 @@ -795,35 +795,35 @@ mptcp_sendmsg_frag - 672303 + 791398 mptcp_set_datafin_timeout - 1119 + 1143 mptcp_set_state - 16937 + 16945 mptcp_set_timeout - 330108 + 342646 mptcp_shutdown - 1487 + 1477 @@ -837,7 +837,7 @@ mptcp_skb_can_collapse_to - 531587 + 600960 @@ -851,7 +851,7 @@ mptcp_stop_rtx_timer - 26111 + 40198 @@ -865,70 +865,70 @@ mptcp_subflow_active - 1152236 + 1278856 mptcp_subflow_cleanup_rbuf - 229594 + 246585 mptcp_subflow_could_cleanup - 1274575 + 1316673 mptcp_subflow_get_retrans - 2290 + 2082 mptcp_subflow_get_send - 395043 + 493832 mptcp_subflow_joined - 994 + 992 mptcp_subflow_process_delegated - 31072 + 30041 mptcp_subflow_send_ack - 3722 + 3751 mptcp_subflow_set_active - 143 + 130 mptcp_subflow_shutdown - 2998 + 3013 @@ -949,7 +949,7 @@ mptcp_try_coalesce - 467828 + 492796 @@ -963,7 +963,7 @@ mptcp_update_data_checksum - 868 + 855 @@ -977,35 +977,35 @@ mptcp_update_post_push - 545793 + 578775 mptcp_wnd_end - 42353 + 59801 mptcp_worker - 13832 + 13417 schedule_3rdack_retransmission - 500 + 499 tcp_can_send_ack - 158346 + 140389 diff --git a/html/lcov/export/mptcp/protocol.c.gcov.html b/html/lcov/export/mptcp/protocol.c.gcov.html index 96a88f4b..3c25ae12 100644 --- a/html/lcov/export/mptcp/protocol.c.gcov.html +++ b/html/lcov/export/mptcp/protocol.c.gcov.html @@ -31,13 +31,13 @@ export Lines: - 91.0 % + 91.2 % 2158 - 1964 + 1968 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 69.0 % + 69.3 % 1623 - 1120 + 1124 @@ -128,9 +128,9 @@ 50 : : static struct net_device *mptcp_napi_dev; 51 : : 52 : : /* Returns end sequence number of the receiver's advertised window */ - 53 : 328212 : u64 mptcp_wnd_end(const struct mptcp_sock *msk) + 53 : 346135 : u64 mptcp_wnd_end(const struct mptcp_sock *msk) 54 : : { - 55 : 328212 : return READ_ONCE(msk->wnd_end); + 55 : 346135 : return READ_ONCE(msk->wnd_end); 56 : : } 57 : : 58 : 94 : static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *sk) @@ -173,21 +173,21 @@ 95 : : /* If the MPC handshake is not started, returns the first subflow, 96 : : * eventually allocating it. 97 : : */ - 98 : 7162 : struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk) + 98 : 7158 : struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk) 99 : : { - 100 : 7162 : struct sock *sk = (struct sock *)msk; - 101 : 7162 : int ret; + 100 : 7158 : struct sock *sk = (struct sock *)msk; + 101 : 7158 : int ret; 102 : : - 103 [ + + + + ]: 7162 : if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) + 103 [ + + + + ]: 7158 : if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) 104 : : return ERR_PTR(-EINVAL); 105 : : - 106 [ + + ]: 7144 : if (!msk->first) { + 106 [ + + ]: 7140 : if (!msk->first) { 107 : 2518 : ret = __mptcp_socket_create(msk); 108 [ - + ]: 2518 : if (ret) 109 : 0 : return ERR_PTR(ret); 110 : : } 111 : : - 112 : 7144 : return msk->first; + 112 : 7140 : return msk->first; 113 : : } 114 : : 115 : 0 : static void mptcp_drop(struct sock *sk, struct sk_buff *skb) @@ -196,61 +196,61 @@ 118 : 0 : __kfree_skb(skb); 119 : : } 120 : : - 121 : 467828 : static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, + 121 : 492796 : static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, 122 : : struct sk_buff *from) 123 : : { - 124 : 467828 : bool fragstolen; - 125 : 467828 : int delta; + 124 : 492796 : bool fragstolen; + 125 : 492796 : int delta; 126 : : - 127 [ + + ]: 467828 : if (unlikely(MPTCP_SKB_CB(to)->cant_coalesce) || - 128 [ + + ]: 467809 : MPTCP_SKB_CB(from)->offset || - 129 [ + + + + ]: 923959 : ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || - 130 : 456170 : !skb_try_coalesce(to, from, &fragstolen, &delta)) - 131 : 114727 : return false; + 127 [ + + ]: 492796 : if (unlikely(MPTCP_SKB_CB(to)->cant_coalesce) || + 128 [ + + ]: 492777 : MPTCP_SKB_CB(from)->offset || + 129 [ + + + + ]: 966301 : ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || + 130 : 473549 : !skb_try_coalesce(to, from, &fragstolen, &delta)) + 131 : 119787 : return false; 132 : : - 133 [ - + ]: 353101 : pr_debug("colesced seq %llx into %llx new len %d new end seq %llx\n", + 133 [ - + ]: 373009 : pr_debug("colesced seq %llx into %llx new len %d new end seq %llx\n", 134 : : MPTCP_SKB_CB(from)->map_seq, MPTCP_SKB_CB(to)->map_seq, 135 : : to->len, MPTCP_SKB_CB(from)->end_seq); - 136 : 353101 : MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; + 136 : 373009 : MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; 137 : : 138 : : /* note the fwd memory can reach a negative value after accounting 139 : : * for the delta, but the later skb free will restore a non 140 : : * negative one 141 : : */ - 142 : 353101 : atomic_add(delta, &sk->sk_rmem_alloc); - 143 [ + - ]: 353101 : sk_mem_charge(sk, delta); - 144 [ - + ]: 353101 : kfree_skb_partial(from, fragstolen); + 142 : 373009 : atomic_add(delta, &sk->sk_rmem_alloc); + 143 [ + - ]: 373009 : sk_mem_charge(sk, delta); + 144 [ - + ]: 373009 : kfree_skb_partial(from, fragstolen); 145 : : - 146 : 353101 : return true; + 146 : 373009 : return true; 147 : : } 148 : : - 149 : 29561 : static bool mptcp_ooo_try_coalesce(struct mptcp_sock *msk, struct sk_buff *to, + 149 : 25939 : static bool mptcp_ooo_try_coalesce(struct mptcp_sock *msk, struct sk_buff *to, 150 : : struct sk_buff *from) 151 : : { - 152 [ + + ]: 63998 : if (MPTCP_SKB_CB(from)->map_seq != MPTCP_SKB_CB(to)->end_seq) + 152 [ + + ]: 56072 : if (MPTCP_SKB_CB(from)->map_seq != MPTCP_SKB_CB(to)->end_seq) 153 : : return false; 154 : : - 155 : 143695 : return mptcp_try_coalesce((struct sock *)msk, to, from); + 155 : 134862 : return mptcp_try_coalesce((struct sock *)msk, to, from); 156 : : } 157 : : 158 : : /* "inspired" by tcp_data_queue_ofo(), main differences: 159 : : * - use mptcp seqs 160 : : * - don't cope with sacks 161 : : */ - 162 : 116680 : static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) + 162 : 112621 : static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) 163 : : { - 164 : 116680 : struct sock *sk = (struct sock *)msk; - 165 : 116680 : struct rb_node **p, *parent; - 166 : 116680 : u64 seq, end_seq, max_seq; - 167 : 116680 : struct sk_buff *skb1; + 164 : 112621 : struct sock *sk = (struct sock *)msk; + 165 : 112621 : struct rb_node **p, *parent; + 166 : 112621 : u64 seq, end_seq, max_seq; + 167 : 112621 : struct sk_buff *skb1; 168 : : - 169 : 116680 : seq = MPTCP_SKB_CB(skb)->map_seq; - 170 : 116680 : end_seq = MPTCP_SKB_CB(skb)->end_seq; - 171 [ - + ]: 116680 : max_seq = atomic64_read(&msk->rcv_wnd_sent); + 169 : 112621 : seq = MPTCP_SKB_CB(skb)->map_seq; + 170 : 112621 : end_seq = MPTCP_SKB_CB(skb)->end_seq; + 171 [ - + ]: 112621 : max_seq = atomic64_read(&msk->rcv_wnd_sent); 172 : : - 173 [ - + ]: 116680 : pr_debug("msk=%p seq=%llx limit=%llx empty=%d\n", msk, seq, max_seq, + 173 [ - + ]: 112621 : pr_debug("msk=%p seq=%llx limit=%llx empty=%d\n", msk, seq, max_seq, 174 : : RB_EMPTY_ROOT(&msk->out_of_order_queue)); - 175 [ - + ]: 116680 : if (after64(end_seq, max_seq)) { + 175 [ - + ]: 112621 : if (after64(end_seq, max_seq)) { 176 : : /* out of window */ 177 : 0 : mptcp_drop(sk, skb); 178 [ # # ]: 0 : pr_debug("oow by %lld, rcv_wnd_sent %llu\n", @@ -260,49 +260,49 @@ 182 : 0 : return; 183 : : } 184 : : - 185 : 116680 : p = &msk->out_of_order_queue.rb_node; - 186 [ + - ]: 116680 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE); - 187 [ + + ]: 116680 : if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) { - 188 : 14876 : rb_link_node(&skb->rbnode, NULL, p); - 189 : 14876 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); - 190 : 14876 : msk->ooo_last_skb = skb; - 191 : 14876 : goto end; + 185 : 112621 : p = &msk->out_of_order_queue.rb_node; + 186 [ + - ]: 112621 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE); + 187 [ + + ]: 112621 : if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) { + 188 : 13689 : rb_link_node(&skb->rbnode, NULL, p); + 189 : 13689 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); + 190 : 13689 : msk->ooo_last_skb = skb; + 191 : 13689 : goto end; 192 : : } 193 : : 194 : : /* with 2 subflows, adding at end of ooo queue is quite likely 195 : : * Use of ooo_last_skb avoids the O(Log(N)) rbtree lookup. 196 : : */ - 197 [ + + + + ]: 168901 : if (mptcp_ooo_try_coalesce(msk, msk->ooo_last_skb, skb)) { - 198 [ + - ]: 44500 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); - 199 [ + - ]: 44500 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); - 200 : 44500 : return; + 197 [ + + + + ]: 166702 : if (mptcp_ooo_try_coalesce(msk, msk->ooo_last_skb, skb)) { + 198 [ + - ]: 46835 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); + 199 [ + - ]: 46835 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); + 200 : 46835 : return; 201 : : } 202 : : 203 : : /* Can avoid an rbtree lookup if we are adding skb after ooo_last_skb */ - 204 [ + + ]: 57304 : if (!before64(seq, MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq)) { - 205 [ + - ]: 40230 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); - 206 : 40230 : parent = &msk->ooo_last_skb->rbnode; - 207 : 40230 : p = &parent->rb_right; - 208 : 40230 : goto insert; + 204 [ + + ]: 52097 : if (!before64(seq, MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq)) { + 205 [ + - ]: 37468 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); + 206 : 37468 : parent = &msk->ooo_last_skb->rbnode; + 207 : 37468 : p = &parent->rb_right; + 208 : 37468 : goto insert; 209 : : } 210 : : 211 : : /* Find place to insert this segment. Handle overlaps on the way. */ 212 : : parent = NULL; - 213 [ + + ]: 106244 : while (*p) { - 214 : 97196 : parent = *p; - 215 : 97196 : skb1 = rb_to_skb(parent); - 216 [ + + ]: 97196 : if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { - 217 : 31699 : p = &parent->rb_left; - 218 : 31699 : continue; + 213 [ + + ]: 70689 : while (*p) { + 214 : 65570 : parent = *p; + 215 : 65570 : skb1 = rb_to_skb(parent); + 216 [ + + ]: 65570 : if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { + 217 : 17823 : p = &parent->rb_left; + 218 : 17823 : continue; 219 : : } - 220 [ + + ]: 65497 : if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) { - 221 [ + + ]: 501 : if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) { + 220 [ + + ]: 47747 : if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) { + 221 [ + + ]: 635 : if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) { 222 : : /* All the bits are present. Drop. */ - 223 : 233 : mptcp_drop(sk, skb); - 224 [ + - ]: 233 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 225 : 233 : return; + 223 : 286 : mptcp_drop(sk, skb); + 224 [ + - ]: 286 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 225 : 286 : return; 226 : : } - 227 [ + + ]: 268 : if (after64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { + 227 [ + + ]: 349 : if (after64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { 228 : : /* partial overlap: 229 : : * | skb | 230 : : * | skb1 | @@ -312,286 +312,286 @@ 234 : : /* skb's seq == skb1's seq and skb covers skb1. 235 : : * Replace skb1 with skb. 236 : : */ - 237 : 8 : rb_replace_node(&skb1->rbnode, &skb->rbnode, + 237 : 11 : rb_replace_node(&skb1->rbnode, &skb->rbnode, 238 : : &msk->out_of_order_queue); - 239 : 8 : mptcp_drop(sk, skb1); - 240 [ + - ]: 8 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 241 : 8 : goto merge_right; + 239 : 11 : mptcp_drop(sk, skb1); + 240 [ + - ]: 11 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 241 : 11 : goto merge_right; 242 : : } - 243 [ + + + + ]: 78324 : } else if (mptcp_ooo_try_coalesce(msk, skb1, skb)) { - 244 [ + - ]: 7785 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); - 245 : 7785 : return; + 243 [ + + + + ]: 59038 : } else if (mptcp_ooo_try_coalesce(msk, skb1, skb)) { + 244 [ + - ]: 9213 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); + 245 : 9213 : return; 246 : : } - 247 : 57471 : p = &parent->rb_right; + 247 : 38237 : p = &parent->rb_right; 248 : : } 249 : : - 250 : 9048 : insert: + 250 : 5119 : insert: 251 : : /* Insert segment into RB tree. */ - 252 : 49278 : rb_link_node(&skb->rbnode, parent, p); - 253 : 49278 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); + 252 : 42587 : rb_link_node(&skb->rbnode, parent, p); + 253 : 42587 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); 254 : : 255 : : merge_right: 256 : : /* Remove other segments covered by skb. */ - 257 [ + + ]: 49371 : while ((skb1 = skb_rb_next(skb)) != NULL) { - 258 [ + + ]: 9140 : if (before64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) + 257 [ + + ]: 42711 : while ((skb1 = skb_rb_next(skb)) != NULL) { + 258 [ + + ]: 5242 : if (before64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) 259 : : break; - 260 : 85 : rb_erase(&skb1->rbnode, &msk->out_of_order_queue); - 261 : 85 : mptcp_drop(sk, skb1); - 262 [ + - ]: 9228 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 260 : 113 : rb_erase(&skb1->rbnode, &msk->out_of_order_queue); + 261 : 113 : mptcp_drop(sk, skb1); + 262 [ + - ]: 7954 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); 263 : : } 264 : : /* If there is no skb after us, we are the last_skb ! */ - 265 [ + + ]: 49286 : if (!skb1) - 266 : 40231 : msk->ooo_last_skb = skb; + 265 [ + + ]: 42598 : if (!skb1) + 266 : 37469 : msk->ooo_last_skb = skb; 267 : : - 268 : 9055 : end: - 269 : 64162 : skb_condense(skb); - 270 : 64162 : skb_set_owner_r(skb, sk); + 268 : 5129 : end: + 269 : 56287 : skb_condense(skb); + 270 : 56287 : skb_set_owner_r(skb, sk); 271 : : } 272 : : - 273 : 641989 : static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, + 273 : 668383 : static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, 274 : : struct sk_buff *skb, unsigned int offset, 275 : : size_t copy_len) 276 : : { - 277 : 641989 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 278 : 641989 : struct sock *sk = (struct sock *)msk; - 279 : 641989 : struct sk_buff *tail; - 280 : 641989 : bool has_rxtstamp; + 277 : 668383 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 278 : 668383 : struct sock *sk = (struct sock *)msk; + 279 : 668383 : struct sk_buff *tail; + 280 : 668383 : bool has_rxtstamp; 281 : : - 282 : 641989 : __skb_unlink(skb, &ssk->sk_receive_queue); + 282 : 668383 : __skb_unlink(skb, &ssk->sk_receive_queue); 283 : : - 284 : 641989 : skb_ext_reset(skb); - 285 : 641989 : skb_orphan(skb); + 284 : 668383 : skb_ext_reset(skb); + 285 : 668383 : skb_orphan(skb); 286 : : 287 : : /* try to fetch required memory from subflow */ - 288 [ - + ]: 641989 : if (!sk_rmem_schedule(sk, skb, skb->truesize)) { + 288 [ - + ]: 668383 : if (!sk_rmem_schedule(sk, skb, skb->truesize)) { 289 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED); 290 : 0 : goto drop; 291 : : } 292 : : - 293 : 641989 : has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp; + 293 : 668383 : has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp; 294 : : 295 : : /* the skb map_seq accounts for the skb offset: 296 : : * mptcp_subflow_get_mapped_dsn() is based on the current tp->copied_seq 297 : : * value 298 : : */ - 299 : 641989 : MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow); - 300 : 641989 : MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + copy_len; - 301 : 641989 : MPTCP_SKB_CB(skb)->offset = offset; - 302 : 641989 : MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp; - 303 : 641989 : MPTCP_SKB_CB(skb)->cant_coalesce = 0; + 299 : 668383 : MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow); + 300 : 668383 : MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + copy_len; + 301 : 668383 : MPTCP_SKB_CB(skb)->offset = offset; + 302 : 668383 : MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp; + 303 : 668383 : MPTCP_SKB_CB(skb)->cant_coalesce = 0; 304 : : - 305 [ + + ]: 641989 : if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { + 305 [ + + ]: 668383 : if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { 306 : : /* in sequence */ - 307 : 525275 : msk->bytes_received += copy_len; - 308 : 525275 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); - 309 [ + + ]: 525275 : tail = skb_peek_tail(&sk->sk_receive_queue); - 310 [ + - + + ]: 324133 : if (tail && mptcp_try_coalesce(sk, tail, skb)) + 307 : 555711 : msk->bytes_received += copy_len; + 308 : 555711 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); + 309 [ + + ]: 555711 : tail = skb_peek_tail(&sk->sk_receive_queue); + 310 [ + - + + ]: 357934 : if (tail && mptcp_try_coalesce(sk, tail, skb)) 311 : : return true; 312 : : - 313 : 262355 : skb_set_owner_r(skb, sk); - 314 : 262355 : __skb_queue_tail(&sk->sk_receive_queue, skb); - 315 : 262355 : return true; - 316 [ + + ]: 116714 : } else if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) { - 317 : 116680 : mptcp_data_queue_ofo(msk, skb); - 318 : 116680 : return false; + 313 : 271657 : skb_set_owner_r(skb, sk); + 314 : 271657 : __skb_queue_tail(&sk->sk_receive_queue, skb); + 315 : 271657 : return true; + 316 [ + + ]: 112672 : } else if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) { + 317 : 112621 : mptcp_data_queue_ofo(msk, skb); + 318 : 112621 : return false; 319 : : } 320 : : 321 : : /* old data, keep it simple and drop the whole pkt, sender 322 : : * will retransmit as needed, if needed. 323 : : */ - 324 [ + - ]: 34 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 325 : 34 : drop: - 326 : 34 : mptcp_drop(sk, skb); - 327 : 34 : return false; + 324 [ + - ]: 51 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 325 : 51 : drop: + 326 : 51 : mptcp_drop(sk, skb); + 327 : 51 : return false; 328 : : } 329 : : - 330 : 26111 : static void mptcp_stop_rtx_timer(struct sock *sk) + 330 : 40198 : static void mptcp_stop_rtx_timer(struct sock *sk) 331 : : { - 332 : 26111 : struct inet_connection_sock *icsk = inet_csk(sk); + 332 : 40198 : struct inet_connection_sock *icsk = inet_csk(sk); 333 : : - 334 : 26111 : sk_stop_timer(sk, &icsk->icsk_retransmit_timer); - 335 [ - + ]: 26111 : mptcp_sk(sk)->timer_ival = 0; - 336 : 26111 : } + 334 : 40198 : sk_stop_timer(sk, &icsk->icsk_retransmit_timer); + 335 [ - + ]: 40198 : mptcp_sk(sk)->timer_ival = 0; + 336 : 40198 : } 337 : : - 338 : 4370 : static void mptcp_close_wake_up(struct sock *sk) + 338 : 4366 : static void mptcp_close_wake_up(struct sock *sk) 339 : : { - 340 [ + + ]: 4370 : if (sock_flag(sk, SOCK_DEAD)) + 340 [ + + ]: 4366 : if (sock_flag(sk, SOCK_DEAD)) 341 : : return; 342 : : - 343 : 3004 : sk->sk_state_change(sk); - 344 [ + + ]: 3004 : if (sk->sk_shutdown == SHUTDOWN_MASK || - 345 [ + + ]: 1482 : sk->sk_state == TCP_CLOSE) - 346 : 1573 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP); + 343 : 3007 : sk->sk_state_change(sk); + 344 [ + + ]: 3007 : if (sk->sk_shutdown == SHUTDOWN_MASK || + 345 [ + + ]: 1484 : sk->sk_state == TCP_CLOSE) + 346 : 1575 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP); 347 : : else - 348 : 1431 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); + 348 : 1432 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); 349 : : } 350 : : 351 : : /* called under the msk socket lock */ - 352 : 262401 : static bool mptcp_pending_data_fin_ack(struct sock *sk) + 352 : 288783 : static bool mptcp_pending_data_fin_ack(struct sock *sk) 353 : : { - 354 [ - + ]: 262401 : struct mptcp_sock *msk = mptcp_sk(sk); + 354 [ - + ]: 288783 : struct mptcp_sock *msk = mptcp_sk(sk); 355 : : - 356 : 103787 : return ((1 << sk->sk_state) & - 357 [ + + + + ]: 262401 : (TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK)) && - 358 [ + + ]: 35126 : msk->write_seq == READ_ONCE(msk->snd_una); + 356 : 144475 : return ((1 << sk->sk_state) & + 357 [ + + + + ]: 288783 : (TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK)) && + 358 [ + + ]: 31498 : msk->write_seq == READ_ONCE(msk->snd_una); 359 : : } 360 : : - 361 : 13691 : static void mptcp_check_data_fin_ack(struct sock *sk) + 361 : 13284 : static void mptcp_check_data_fin_ack(struct sock *sk) 362 : : { - 363 [ - + ]: 13691 : struct mptcp_sock *msk = mptcp_sk(sk); + 363 [ - + ]: 13284 : struct mptcp_sock *msk = mptcp_sk(sk); 364 : : 365 : : /* Look for an acknowledged DATA_FIN */ - 366 [ + + ]: 13691 : if (mptcp_pending_data_fin_ack(sk)) { - 367 : 1789 : WRITE_ONCE(msk->snd_data_fin_enable, 0); + 366 [ + + ]: 13284 : if (mptcp_pending_data_fin_ack(sk)) { + 367 : 1759 : WRITE_ONCE(msk->snd_data_fin_enable, 0); 368 : : - 369 [ + + - ]: 1789 : switch (sk->sk_state) { - 370 : 955 : case TCP_FIN_WAIT1: - 371 : 955 : mptcp_set_state(sk, TCP_FIN_WAIT2); - 372 : 955 : break; - 373 : 834 : case TCP_CLOSING: + 369 [ + + - ]: 1759 : switch (sk->sk_state) { + 370 : 963 : case TCP_FIN_WAIT1: + 371 : 963 : mptcp_set_state(sk, TCP_FIN_WAIT2); + 372 : 963 : break; + 373 : 796 : case TCP_CLOSING: 374 : : case TCP_LAST_ACK: - 375 : 834 : mptcp_set_state(sk, TCP_CLOSE); - 376 : 834 : break; + 375 : 796 : mptcp_set_state(sk, TCP_CLOSE); + 376 : 796 : break; 377 : : } 378 : : - 379 : 1789 : mptcp_close_wake_up(sk); + 379 : 1759 : mptcp_close_wake_up(sk); 380 : : } - 381 : 13691 : } + 381 : 13284 : } 382 : : 383 : : /* can be called with no lock acquired */ - 384 : 613823 : static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq) + 384 : 642159 : static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq) 385 : : { - 386 [ - + ]: 613823 : struct mptcp_sock *msk = mptcp_sk(sk); + 386 [ - + ]: 642159 : struct mptcp_sock *msk = mptcp_sk(sk); 387 : : - 388 [ + + + + : 637950 : if (READ_ONCE(msk->rcv_data_fin) && - + + + + ] - 389 [ + + ]: 154 : ((1 << inet_sk_state_load(sk)) & + 388 [ + + + + : 662435 : if (READ_ONCE(msk->rcv_data_fin) && + + + + + ] + 389 [ + + ]: 165 : ((1 << inet_sk_state_load(sk)) & 390 : : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2))) { - 391 : 23591 : u64 rcv_data_fin_seq = READ_ONCE(msk->rcv_data_fin_seq); + 391 : 19711 : u64 rcv_data_fin_seq = READ_ONCE(msk->rcv_data_fin_seq); 392 : : - 393 [ + + ]: 23591 : if (READ_ONCE(msk->ack_seq) == rcv_data_fin_seq) { - 394 [ + + ]: 2021 : if (seq) - 395 : 1750 : *seq = rcv_data_fin_seq; + 393 [ + + ]: 19711 : if (READ_ONCE(msk->ack_seq) == rcv_data_fin_seq) { + 394 [ + + ]: 1988 : if (seq) + 395 : 1725 : *seq = rcv_data_fin_seq; 396 : : - 397 : 2021 : return true; + 397 : 1988 : return true; 398 : : } 399 : : } 400 : : 401 : : return false; 402 : : } 403 : : - 404 : 1119 : static void mptcp_set_datafin_timeout(struct sock *sk) + 404 : 1143 : static void mptcp_set_datafin_timeout(struct sock *sk) 405 : : { - 406 : 1119 : struct inet_connection_sock *icsk = inet_csk(sk); - 407 : 1119 : u32 retransmits; + 406 : 1143 : struct inet_connection_sock *icsk = inet_csk(sk); + 407 : 1143 : u32 retransmits; 408 : : - 409 : 1119 : retransmits = min_t(u32, icsk->icsk_retransmits, + 409 : 1143 : retransmits = min_t(u32, icsk->icsk_retransmits, 410 : : ilog2(TCP_RTO_MAX / TCP_RTO_MIN)); 411 : : - 412 [ - + ]: 1119 : mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits; - 413 : 1119 : } + 412 [ - + ]: 1143 : mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits; + 413 : 1143 : } 414 : : - 415 : 725151 : static void __mptcp_set_timeout(struct sock *sk, long tout) + 415 : 836478 : static void __mptcp_set_timeout(struct sock *sk, long tout) 416 : : { - 417 [ + + - + ]: 1260721 : mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN; - 418 : 725151 : } + 417 [ + + - + ]: 1413472 : mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN; + 418 : 836478 : } 419 : : - 420 : 312380 : static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subflow) + 420 : 278574 : static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subflow) 421 : : { - 422 : 1294231 : const struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 422 : 1384023 : const struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 423 : : - 424 [ + + + + ]: 1106883 : return inet_csk(ssk)->icsk_pending && !subflow->stale_count ? - 425 [ + + + + ]: 2220899 : inet_csk(ssk)->icsk_timeout - jiffies : 0; + 424 [ + + + + ]: 1132017 : return inet_csk(ssk)->icsk_pending && !subflow->stale_count ? + 425 [ + + + + ]: 2306185 : inet_csk(ssk)->icsk_timeout - jiffies : 0; 426 : : } 427 : : - 428 : 330108 : void mptcp_set_timeout(struct sock *sk) + 428 : 342646 : void mptcp_set_timeout(struct sock *sk) 429 : : { - 430 : 330108 : struct mptcp_subflow_context *subflow; - 431 : 330108 : long tout = 0; + 430 : 342646 : struct mptcp_subflow_context *subflow; + 431 : 342646 : long tout = 0; 432 : : - 433 [ - + - + : 959882 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) - + + ] - 434 [ + + ]: 1182834 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); - 435 : 330108 : __mptcp_set_timeout(sk, tout); - 436 : 330108 : } + 433 [ - + - + : 944374 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) + + + ] + 434 [ + + ]: 1103157 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); + 435 : 342646 : __mptcp_set_timeout(sk, tout); + 436 : 342646 : } 437 : : - 438 : 178114 : static inline bool tcp_can_send_ack(const struct sock *ssk) + 438 : 162082 : static inline bool tcp_can_send_ack(const struct sock *ssk) 439 : : { - 440 [ - + ]: 312970 : return !((1 << inet_sk_state_load(ssk)) & + 440 [ - + ]: 364479 : return !((1 << inet_sk_state_load(ssk)) & 441 : : (TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_TIME_WAIT | TCPF_CLOSE | TCPF_LISTEN)); 442 : : } 443 : : - 444 : 4609 : void __mptcp_subflow_send_ack(struct sock *ssk) + 444 : 4639 : void __mptcp_subflow_send_ack(struct sock *ssk) 445 : : { - 446 [ + + ]: 4609 : if (tcp_can_send_ack(ssk)) - 447 : 4531 : tcp_send_ack(ssk); - 448 : 4609 : } + 446 [ + + ]: 4639 : if (tcp_can_send_ack(ssk)) + 447 : 4562 : tcp_send_ack(ssk); + 448 : 4639 : } 449 : : - 450 : 3722 : static void mptcp_subflow_send_ack(struct sock *ssk) + 450 : 3751 : static void mptcp_subflow_send_ack(struct sock *ssk) 451 : : { - 452 : 3722 : bool slow; + 452 : 3751 : bool slow; 453 : : - 454 : 3722 : slow = lock_sock_fast(ssk); - 455 : 3722 : __mptcp_subflow_send_ack(ssk); - 456 : 3722 : unlock_sock_fast(ssk, slow); - 457 : 3722 : } + 454 : 3751 : slow = lock_sock_fast(ssk); + 455 : 3751 : __mptcp_subflow_send_ack(ssk); + 456 : 3751 : unlock_sock_fast(ssk, slow); + 457 : 3751 : } 458 : : - 459 : 2802 : static void mptcp_send_ack(struct mptcp_sock *msk) + 459 : 2799 : static void mptcp_send_ack(struct mptcp_sock *msk) 460 : : { - 461 : 2802 : struct mptcp_subflow_context *subflow; + 461 : 2799 : struct mptcp_subflow_context *subflow; 462 : : - 463 [ + + ]: 6524 : mptcp_for_each_subflow(msk, subflow) - 464 : 3722 : mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); - 465 : 2802 : } + 463 [ + + ]: 6550 : mptcp_for_each_subflow(msk, subflow) + 464 : 3751 : mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); + 465 : 2799 : } 466 : : - 467 : 229594 : static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) + 467 : 246585 : static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) 468 : : { - 469 : 229594 : bool slow; + 469 : 246585 : bool slow; 470 : : - 471 : 229594 : slow = lock_sock_fast(ssk); - 472 [ + + ]: 229594 : if (tcp_can_send_ack(ssk)) - 473 : 221125 : tcp_cleanup_rbuf(ssk, copied); - 474 : 229594 : unlock_sock_fast(ssk, slow); - 475 : 229594 : } + 471 : 246585 : slow = lock_sock_fast(ssk); + 472 [ + + ]: 246585 : if (tcp_can_send_ack(ssk)) + 473 : 236446 : tcp_cleanup_rbuf(ssk, copied); + 474 : 246585 : unlock_sock_fast(ssk, slow); + 475 : 246585 : } 476 : : - 477 : 1274575 : static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty) + 477 : 1316673 : static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty) 478 : : { - 479 : 1274575 : const struct inet_connection_sock *icsk = inet_csk(ssk); - 480 : 1274575 : u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending); - 481 [ - + ]: 1274575 : const struct tcp_sock *tp = tcp_sk(ssk); + 479 : 1316673 : const struct inet_connection_sock *icsk = inet_csk(ssk); + 480 : 1316673 : u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending); + 481 [ - + ]: 1316673 : const struct tcp_sock *tp = tcp_sk(ssk); 482 : : - 483 [ + + ]: 1274575 : return (ack_pending & ICSK_ACK_SCHED) && - 484 : 584107 : ((READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->rcv_wup) > - 485 [ + + + + ]: 584107 : READ_ONCE(icsk->icsk_ack.rcv_mss)) || - 486 [ + + ]: 59951 : (rx_empty && ack_pending & + 483 [ + + ]: 1316673 : return (ack_pending & ICSK_ACK_SCHED) && + 484 : 575189 : ((READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->rcv_wup) > + 485 [ + + + + ]: 575189 : READ_ONCE(icsk->icsk_ack.rcv_mss)) || + 486 [ + + ]: 58432 : (rx_empty && ack_pending & 487 : : (ICSK_ACK_PUSHED2 | ICSK_ACK_PUSHED))); 488 : : } 489 : : - 490 : 748057 : static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) + 490 : 804815 : static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) 491 : : { - 492 : 748057 : int old_space = READ_ONCE(msk->old_wspace); - 493 : 748057 : struct mptcp_subflow_context *subflow; - 494 : 748057 : struct sock *sk = (struct sock *)msk; - 495 : 748057 : int space = __mptcp_space(sk); - 496 : 748057 : bool cleanup, rx_empty; + 492 : 804815 : int old_space = READ_ONCE(msk->old_wspace); + 493 : 804815 : struct mptcp_subflow_context *subflow; + 494 : 804815 : struct sock *sk = (struct sock *)msk; + 495 : 804815 : int space = __mptcp_space(sk); + 496 : 804815 : bool cleanup, rx_empty; 497 : : - 498 [ + + + + : 748057 : cleanup = (space > 0) && (space >= (old_space << 1)) && copied; - + + ] - 499 [ + + + + ]: 748057 : rx_empty = !sk_rmem_alloc_get(sk) && copied; + 498 [ + + + + : 804815 : cleanup = (space > 0) && (space >= (old_space << 1)) && copied; + + + ] + 499 [ + + + + ]: 804815 : rx_empty = !sk_rmem_alloc_get(sk) && copied; 500 : : - 501 [ + + ]: 2091056 : mptcp_for_each_subflow(msk, subflow) { - 502 [ + + ]: 1342999 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 501 [ + + ]: 2195015 : mptcp_for_each_subflow(msk, subflow) { + 502 [ + + ]: 1390200 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 503 : : - 504 [ + + + + ]: 1342999 : if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) - 505 : 229594 : mptcp_subflow_cleanup_rbuf(ssk, copied); + 504 [ + + + + ]: 1390200 : if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) + 505 : 246585 : mptcp_subflow_cleanup_rbuf(ssk, copied); 506 : : } - 507 : 748057 : } + 507 : 804815 : } 508 : : - 509 : 75335 : static bool mptcp_check_data_fin(struct sock *sk) + 509 : 74163 : static bool mptcp_check_data_fin(struct sock *sk) 510 : : { - 511 [ - + ]: 75335 : struct mptcp_sock *msk = mptcp_sk(sk); - 512 : 75335 : u64 rcv_data_fin_seq; - 513 : 75335 : bool ret = false; + 511 [ - + ]: 74163 : struct mptcp_sock *msk = mptcp_sk(sk); + 512 : 74163 : u64 rcv_data_fin_seq; + 513 : 74163 : bool ret = false; 514 : : 515 : : /* Need to ack a DATA_FIN received from a peer while this side 516 : : * of the connection is in ESTABLISHED, FIN_WAIT1, or FIN_WAIT2. @@ -606,35 +606,35 @@ 525 : : * when catching up. 526 : : */ 527 : : - 528 [ + + ]: 75335 : if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) { - 529 : 1750 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1); - 530 : 1750 : WRITE_ONCE(msk->rcv_data_fin, 0); + 528 [ + + ]: 74163 : if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) { + 529 : 1725 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1); + 530 : 1725 : WRITE_ONCE(msk->rcv_data_fin, 0); 531 : : - 532 : 1750 : WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN); - 533 : 1750 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ + 532 : 1725 : WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN); + 533 : 1725 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ 534 : : - 535 [ + + + - ]: 1750 : switch (sk->sk_state) { + 535 [ + + + - ]: 1725 : switch (sk->sk_state) { 536 : : case TCP_ESTABLISHED: - 537 : 733 : mptcp_set_state(sk, TCP_CLOSE_WAIT); - 538 : 733 : break; - 539 : 240 : case TCP_FIN_WAIT1: - 540 : 240 : mptcp_set_state(sk, TCP_CLOSING); - 541 : 240 : break; - 542 : 777 : case TCP_FIN_WAIT2: - 543 : 777 : mptcp_set_state(sk, TCP_CLOSE); - 544 : 777 : break; + 537 : 740 : mptcp_set_state(sk, TCP_CLOSE_WAIT); + 538 : 740 : break; + 539 : 213 : case TCP_FIN_WAIT1: + 540 : 213 : mptcp_set_state(sk, TCP_CLOSING); + 541 : 213 : break; + 542 : 772 : case TCP_FIN_WAIT2: + 543 : 772 : mptcp_set_state(sk, TCP_CLOSE); + 544 : 772 : break; 545 : : default: 546 : : /* Other states not expected */ 547 : 0 : WARN_ON_ONCE(1); 548 : 0 : break; 549 : : } 550 : : - 551 : 1750 : ret = true; - 552 [ + + ]: 1750 : if (!__mptcp_check_fallback(msk)) - 553 : 1683 : mptcp_send_ack(msk); - 554 : 1750 : mptcp_close_wake_up(sk); + 551 : 1725 : ret = true; + 552 [ + + ]: 1725 : if (!__mptcp_check_fallback(msk)) + 553 : 1656 : mptcp_send_ack(msk); + 554 : 1725 : mptcp_close_wake_up(sk); 555 : : } - 556 : 75335 : return ret; + 556 : 74163 : return ret; 557 : : } 558 : : 559 : 0 : static void mptcp_dss_corruption(struct mptcp_sock *msk, struct sock *ssk) @@ -649,135 +649,135 @@ 568 : : } 569 : 0 : } 570 : : - 571 : 614988 : static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, + 571 : 642880 : static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, 572 : : struct sock *ssk) 573 : : { - 574 [ - + ]: 614988 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 575 : 614988 : struct sock *sk = (struct sock *)msk; - 576 : 614988 : bool more_data_avail; - 577 : 614988 : struct tcp_sock *tp; - 578 : 614988 : bool ret = false; + 574 [ - + ]: 642880 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 575 : 642880 : struct sock *sk = (struct sock *)msk; + 576 : 642880 : bool more_data_avail; + 577 : 642880 : struct tcp_sock *tp; + 578 : 642880 : bool ret = false; 579 : : - 580 [ - + ]: 614988 : pr_debug("msk=%p ssk=%p\n", msk, ssk); - 581 [ - + ]: 614988 : tp = tcp_sk(ssk); - 582 : 644226 : do { - 583 : 644226 : u32 map_remaining, offset; - 584 : 644226 : u32 seq = tp->copied_seq; - 585 : 644226 : struct sk_buff *skb; - 586 : 644226 : bool fin; + 580 [ - + ]: 642880 : pr_debug("msk=%p ssk=%p\n", msk, ssk); + 581 [ - + ]: 642880 : tp = tcp_sk(ssk); + 582 : 671618 : do { + 583 : 671618 : u32 map_remaining, offset; + 584 : 671618 : u32 seq = tp->copied_seq; + 585 : 671618 : struct sk_buff *skb; + 586 : 671618 : bool fin; 587 : : - 588 [ + + ]: 644226 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) + 588 [ + + ]: 671618 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) 589 : : break; 590 : : 591 : : /* try to move as much data as available */ - 592 : 1284016 : map_remaining = subflow->map_data_len - - 593 : 642008 : mptcp_subflow_get_map_offset(subflow); + 592 : 1336820 : map_remaining = subflow->map_data_len - + 593 : 668410 : mptcp_subflow_get_map_offset(subflow); 594 : : - 595 [ + - ]: 642008 : skb = skb_peek(&ssk->sk_receive_queue); - 596 [ + - ]: 642008 : if (unlikely(!skb)) + 595 [ + - ]: 668410 : skb = skb_peek(&ssk->sk_receive_queue); + 596 [ + - ]: 668410 : if (unlikely(!skb)) 597 : : break; 598 : : - 599 [ + + ]: 642008 : if (__mptcp_check_fallback(msk)) { + 599 [ + + ]: 668410 : if (__mptcp_check_fallback(msk)) { 600 : : /* Under fallback skbs have no MPTCP extension and TCP could 601 : : * collapse them between the dummy map creation and the 602 : : * current dequeue. Be sure to adjust the map size. 603 : : */ - 604 : 3855 : map_remaining = skb->len; - 605 : 3855 : subflow->map_data_len = skb->len; + 604 : 5088 : map_remaining = skb->len; + 605 : 5088 : subflow->map_data_len = skb->len; 606 : : } 607 : : - 608 : 642008 : offset = seq - TCP_SKB_CB(skb)->seq; - 609 : 642008 : fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; - 610 [ + + ]: 642008 : if (fin) - 611 : 67 : seq++; + 608 : 668410 : offset = seq - TCP_SKB_CB(skb)->seq; + 609 : 668410 : fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; + 610 [ + + ]: 668410 : if (fin) + 611 : 70 : seq++; 612 : : - 613 [ + + ]: 642008 : if (offset < skb->len) { - 614 : 641989 : size_t len = skb->len - offset; + 613 [ + + ]: 668410 : if (offset < skb->len) { + 614 : 668383 : size_t len = skb->len - offset; 615 : : - 616 [ + + + + ]: 641989 : ret = __mptcp_move_skb(msk, ssk, skb, offset, len) || ret; - 617 : 641989 : seq += len; + 616 [ + + + + ]: 668383 : ret = __mptcp_move_skb(msk, ssk, skb, offset, len) || ret; + 617 : 668383 : seq += len; 618 : : - 619 [ - + ]: 641989 : if (unlikely(map_remaining < len)) { + 619 [ - + ]: 668383 : if (unlikely(map_remaining < len)) { 620 : 0 : DEBUG_NET_WARN_ON_ONCE(1); 621 : 0 : mptcp_dss_corruption(msk, ssk); 622 : : } 623 : : } else { - 624 [ - + ]: 19 : if (unlikely(!fin)) { + 624 [ - + ]: 27 : if (unlikely(!fin)) { 625 : 0 : DEBUG_NET_WARN_ON_ONCE(1); 626 : 0 : mptcp_dss_corruption(msk, ssk); 627 : : } 628 : : - 629 : 19 : sk_eat_skb(ssk, skb); + 629 : 27 : sk_eat_skb(ssk, skb); 630 : : } 631 : : - 632 : 642008 : WRITE_ONCE(tp->copied_seq, seq); - 633 : 642008 : more_data_avail = mptcp_subflow_data_available(ssk); + 632 : 668410 : WRITE_ONCE(tp->copied_seq, seq); + 633 : 668410 : more_data_avail = mptcp_subflow_data_available(ssk); 634 : : - 635 [ + + ]: 642008 : } while (more_data_avail); + 635 [ + + ]: 668410 : } while (more_data_avail); 636 : : - 637 [ + + ]: 614988 : if (ret) - 638 : 504722 : msk->last_data_recv = tcp_jiffies32; - 639 : 614988 : return ret; + 637 [ + + ]: 642880 : if (ret) + 638 : 535134 : msk->last_data_recv = tcp_jiffies32; + 639 : 642880 : return ret; 640 : : } 641 : : - 642 : 838370 : static bool __mptcp_ofo_queue(struct mptcp_sock *msk) + 642 : 857056 : static bool __mptcp_ofo_queue(struct mptcp_sock *msk) 643 : : { - 644 : 838370 : struct sock *sk = (struct sock *)msk; - 645 : 838370 : struct sk_buff *skb, *tail; - 646 : 838370 : bool moved = false; - 647 : 838370 : struct rb_node *p; - 648 : 838370 : u64 end_seq; + 644 : 857056 : struct sock *sk = (struct sock *)msk; + 645 : 857056 : struct sk_buff *skb, *tail; + 646 : 857056 : bool moved = false; + 647 : 857056 : struct rb_node *p; + 648 : 857056 : u64 end_seq; 649 : : - 650 : 838370 : p = rb_first(&msk->out_of_order_queue); - 651 [ - + ]: 838370 : pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); - 652 [ + + ]: 902439 : while (p) { - 653 : 279329 : skb = rb_to_skb(p); - 654 [ + + ]: 279329 : if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) + 650 : 857056 : p = rb_first(&msk->out_of_order_queue); + 651 [ - + ]: 857056 : pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); + 652 [ + + ]: 913219 : while (p) { + 653 : 262475 : skb = rb_to_skb(p); + 654 [ + + ]: 262475 : if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) 655 : : break; 656 : : - 657 : 64069 : p = rb_next(p); - 658 : 64069 : rb_erase(&skb->rbnode, &msk->out_of_order_queue); + 657 : 56163 : p = rb_next(p); + 658 : 56163 : rb_erase(&skb->rbnode, &msk->out_of_order_queue); 659 : : - 660 [ + + ]: 64069 : if (unlikely(!after64(MPTCP_SKB_CB(skb)->end_seq, + 660 [ + + ]: 56163 : if (unlikely(!after64(MPTCP_SKB_CB(skb)->end_seq, 661 : : msk->ack_seq))) { - 662 : 71 : mptcp_drop(sk, skb); - 663 [ + - ]: 71 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 664 : 71 : continue; + 662 : 91 : mptcp_drop(sk, skb); + 663 [ + - ]: 91 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 664 : 91 : continue; 665 : : } 666 : : - 667 : 63998 : end_seq = MPTCP_SKB_CB(skb)->end_seq; - 668 [ + - ]: 63998 : tail = skb_peek_tail(&sk->sk_receive_queue); - 669 [ + - + + ]: 127268 : if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) { - 670 : 26102 : int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; + 667 : 56072 : end_seq = MPTCP_SKB_CB(skb)->end_seq; + 668 [ + - ]: 56072 : tail = skb_peek_tail(&sk->sk_receive_queue); + 669 [ + - + + ]: 111238 : if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) { + 670 : 23165 : int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; 671 : : 672 : : /* skip overlapping data, if any */ - 673 [ - + ]: 26102 : pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n", + 673 [ - + ]: 23165 : pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n", 674 : : MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq, 675 : : delta); - 676 : 26102 : MPTCP_SKB_CB(skb)->offset += delta; - 677 : 26102 : MPTCP_SKB_CB(skb)->map_seq += delta; - 678 : 26102 : __skb_queue_tail(&sk->sk_receive_queue, skb); + 676 : 23165 : MPTCP_SKB_CB(skb)->offset += delta; + 677 : 23165 : MPTCP_SKB_CB(skb)->map_seq += delta; + 678 : 23165 : __skb_queue_tail(&sk->sk_receive_queue, skb); 679 : : } - 680 : 63998 : msk->bytes_received += end_seq - msk->ack_seq; - 681 : 63998 : WRITE_ONCE(msk->ack_seq, end_seq); - 682 : 63998 : moved = true; + 680 : 56072 : msk->bytes_received += end_seq - msk->ack_seq; + 681 : 56072 : WRITE_ONCE(msk->ack_seq, end_seq); + 682 : 56072 : moved = true; 683 : : } - 684 : 838370 : return moved; + 684 : 857056 : return moved; 685 : : } 686 : : - 687 : 5541 : static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) + 687 : 5521 : static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) 688 : : { - 689 [ + + ]: 5541 : int err = sock_error(ssk); - 690 : 3306 : int ssk_state; + 689 [ + + ]: 5521 : int err = sock_error(ssk); + 690 : 3342 : int ssk_state; 691 : : - 692 [ + + ]: 3187 : if (!err) - 693 : 2354 : return false; + 692 [ + + ]: 3222 : if (!err) + 693 : 2299 : return false; 694 : : 695 : : /* only propagate errors on fallen-back sockets or 696 : : * on MPC connect 697 : : */ - 698 [ + + - + : 870 : if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk))) - + + ] + 698 [ + + - + : 916 : if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk))) + + + ] 699 : : return false; 700 : : 701 : : /* We need to propagate only transition to CLOSE state. @@ -785,38 +785,38 @@ 703 : : * subflow_sched_work_if_closed() and that path will properly 704 : : * destroy the msk as needed. 705 : : */ - 706 : 46 : ssk_state = inet_sk_state_load(ssk); - 707 [ + - + + ]: 46 : if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) + 706 : 45 : ssk_state = inet_sk_state_load(ssk); + 707 [ + - + + ]: 45 : if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) 708 : 27 : mptcp_set_state(sk, ssk_state); - 709 : 46 : WRITE_ONCE(sk->sk_err, -err); + 709 : 45 : WRITE_ONCE(sk->sk_err, -err); 710 : : 711 : : /* This barrier is coupled with smp_rmb() in mptcp_poll() */ - 712 : 46 : smp_wmb(); - 713 : 46 : sk_error_report(sk); - 714 : 46 : return true; + 712 : 45 : smp_wmb(); + 713 : 45 : sk_error_report(sk); + 714 : 45 : return true; 715 : : } 716 : : - 717 : 824 : void __mptcp_error_report(struct sock *sk) + 717 : 808 : void __mptcp_error_report(struct sock *sk) 718 : : { - 719 : 824 : struct mptcp_subflow_context *subflow; - 720 [ - + ]: 824 : struct mptcp_sock *msk = mptcp_sk(sk); + 719 : 808 : struct mptcp_subflow_context *subflow; + 720 [ - + ]: 808 : struct mptcp_sock *msk = mptcp_sk(sk); 721 : : - 722 [ + + ]: 1709 : mptcp_for_each_subflow(msk, subflow) - 723 [ + + ]: 912 : if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow))) + 722 [ + + ]: 1673 : mptcp_for_each_subflow(msk, subflow) + 723 [ + + ]: 892 : if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow))) 724 : : break; - 725 : 824 : } + 725 : 808 : } 726 : : 727 : : /* In most cases we will be able to lock the mptcp socket. If its already 728 : : * owned, we need to defer to the work queue to avoid ABBA deadlock. 729 : : */ - 730 : 538488 : static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) + 730 : 567996 : static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) 731 : : { - 732 : 538488 : struct sock *sk = (struct sock *)msk; - 733 : 538488 : bool moved; + 732 : 567996 : struct sock *sk = (struct sock *)msk; + 733 : 567996 : bool moved; 734 : : - 735 : 538488 : moved = __mptcp_move_skbs_from_subflow(msk, ssk); - 736 : 538488 : __mptcp_ofo_queue(msk); - 737 [ - + ]: 538488 : if (unlikely(ssk->sk_err)) { + 735 : 567996 : moved = __mptcp_move_skbs_from_subflow(msk, ssk); + 736 : 567996 : __mptcp_ofo_queue(msk); + 737 [ - + ]: 567996 : if (unlikely(ssk->sk_err)) { 738 [ # # ]: 0 : if (!sock_owned_by_user(sk)) 739 : 0 : __mptcp_error_report(sk); 740 : : else @@ -829,134 +829,134 @@ 746 : : * this is not a good place to change state. Let the workqueue 747 : : * do it. 748 : : */ - 749 [ + + ]: 538488 : if (mptcp_pending_data_fin(sk, NULL)) - 750 : 271 : mptcp_schedule_work(sk); - 751 : 538488 : return moved; + 749 [ + + ]: 567996 : if (mptcp_pending_data_fin(sk, NULL)) + 750 : 263 : mptcp_schedule_work(sk); + 751 : 567996 : return moved; 752 : : } 753 : : - 754 : 188203 : static void __mptcp_rcvbuf_update(struct sock *sk, struct sock *ssk) + 754 : 181037 : static void __mptcp_rcvbuf_update(struct sock *sk, struct sock *ssk) 755 : : { - 756 : 1102338 : if (unlikely(ssk->sk_rcvbuf > sk->sk_rcvbuf)) - 757 : 0 : WRITE_ONCE(sk->sk_rcvbuf, ssk->sk_rcvbuf); + 756 : 1107661 : if (unlikely(ssk->sk_rcvbuf > sk->sk_rcvbuf)) + 757 : 75 : WRITE_ONCE(sk->sk_rcvbuf, ssk->sk_rcvbuf); 758 : : } 759 : : - 760 : 538488 : static void __mptcp_data_ready(struct sock *sk, struct sock *ssk) + 760 : 567996 : static void __mptcp_data_ready(struct sock *sk, struct sock *ssk) 761 : : { - 762 [ - + ]: 538488 : struct mptcp_sock *msk = mptcp_sk(sk); + 762 [ - + ]: 567996 : struct mptcp_sock *msk = mptcp_sk(sk); 763 : : - 764 [ - + ]: 538488 : __mptcp_rcvbuf_update(sk, ssk); + 764 [ + + ]: 567996 : __mptcp_rcvbuf_update(sk, ssk); 765 : : 766 : : /* Wake-up the reader only for in-sequence data */ - 767 [ + + + - ]: 538488 : if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) - 768 : 436277 : sk->sk_data_ready(sk); - 769 : 538488 : } + 767 [ + + + - ]: 567996 : if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) + 768 : 467868 : sk->sk_data_ready(sk); + 769 : 567996 : } 770 : : - 771 : 650644 : void mptcp_data_ready(struct sock *sk, struct sock *ssk) + 771 : 688962 : void mptcp_data_ready(struct sock *sk, struct sock *ssk) 772 : : { - 773 [ + - ]: 650644 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 773 [ + - ]: 688962 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 774 : : 775 : : /* The peer can send data while we are shutting down this 776 : : * subflow at msk destruction time, but we must avoid enqueuing 777 : : * more data to the msk receive queue 778 : : */ - 779 [ + - ]: 650644 : if (unlikely(subflow->disposable)) + 779 [ + - ]: 688962 : if (unlikely(subflow->disposable)) 780 : : return; 781 : : - 782 : 650644 : mptcp_data_lock(sk); - 783 [ + + ]: 650644 : if (!sock_owned_by_user(sk)) - 784 : 538488 : __mptcp_data_ready(sk, ssk); + 782 : 688962 : mptcp_data_lock(sk); + 783 [ + + ]: 688962 : if (!sock_owned_by_user(sk)) + 784 : 567996 : __mptcp_data_ready(sk, ssk); 785 : : else - 786 [ - + ]: 112156 : __set_bit(MPTCP_DEQUEUE, &mptcp_sk(sk)->cb_flags); - 787 : 650644 : mptcp_data_unlock(sk); + 786 [ - + ]: 120966 : __set_bit(MPTCP_DEQUEUE, &mptcp_sk(sk)->cb_flags); + 787 : 688962 : mptcp_data_unlock(sk); 788 : : } 789 : : - 790 : 994 : static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk) + 790 : 992 : static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk) 791 : : { - 792 : 994 : mptcp_subflow_ctx(ssk)->map_seq = READ_ONCE(msk->ack_seq); - 793 : 994 : WRITE_ONCE(msk->allow_infinite_fallback, false); - 794 : 994 : mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC); - 795 : 994 : } + 792 : 992 : mptcp_subflow_ctx(ssk)->map_seq = READ_ONCE(msk->ack_seq); + 793 : 992 : WRITE_ONCE(msk->allow_infinite_fallback, false); + 794 : 992 : mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC); + 795 : 992 : } 796 : : - 797 : 506 : static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk) + 797 : 505 : static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk) 798 : : { - 799 : 506 : struct sock *sk = (struct sock *)msk; + 799 : 505 : struct sock *sk = (struct sock *)msk; 800 : : - 801 [ + - ]: 506 : if (sk->sk_state != TCP_ESTABLISHED) + 801 [ + - ]: 505 : if (sk->sk_state != TCP_ESTABLISHED) 802 : : return false; 803 : : 804 : : /* attach to msk socket only after we are sure we will deal with it 805 : : * at close time 806 : : */ - 807 [ + + + - ]: 506 : if (sk->sk_socket && !ssk->sk_socket) - 808 : 478 : mptcp_sock_graft(ssk, sk->sk_socket); + 807 [ + + + - ]: 505 : if (sk->sk_socket && !ssk->sk_socket) + 808 : 475 : mptcp_sock_graft(ssk, sk->sk_socket); 809 : : - 810 : 506 : mptcp_subflow_ctx(ssk)->subflow_id = msk->subflow_id++; - 811 : 506 : mptcp_sockopt_sync_locked(msk, ssk); - 812 : 506 : mptcp_subflow_joined(msk, ssk); - 813 : 506 : mptcp_stop_tout_timer(sk); - 814 [ + - ]: 506 : __mptcp_propagate_sndbuf(sk, ssk); + 810 : 505 : mptcp_subflow_ctx(ssk)->subflow_id = msk->subflow_id++; + 811 : 505 : mptcp_sockopt_sync_locked(msk, ssk); + 812 : 505 : mptcp_subflow_joined(msk, ssk); + 813 : 505 : mptcp_stop_tout_timer(sk); + 814 [ + - ]: 505 : __mptcp_propagate_sndbuf(sk, ssk); 815 : : return true; 816 : : } 817 : : - 818 : 32 : static void __mptcp_flush_join_list(struct sock *sk, struct list_head *join_list) + 818 : 33 : static void __mptcp_flush_join_list(struct sock *sk, struct list_head *join_list) 819 : : { - 820 : 32 : struct mptcp_subflow_context *tmp, *subflow; - 821 [ - + ]: 32 : struct mptcp_sock *msk = mptcp_sk(sk); + 820 : 33 : struct mptcp_subflow_context *tmp, *subflow; + 821 [ - + ]: 33 : struct mptcp_sock *msk = mptcp_sk(sk); 822 : : - 823 [ + + ]: 68 : list_for_each_entry_safe(subflow, tmp, join_list, node) { - 824 : 36 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 825 : 36 : bool slow = lock_sock_fast(ssk); + 823 [ + + ]: 68 : list_for_each_entry_safe(subflow, tmp, join_list, node) { + 824 : 35 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 825 : 35 : bool slow = lock_sock_fast(ssk); 826 : : - 827 : 36 : list_move_tail(&subflow->node, &msk->conn_list); - 828 [ - + ]: 36 : if (!__mptcp_finish_join(msk, ssk)) + 827 : 35 : list_move_tail(&subflow->node, &msk->conn_list); + 828 [ - + ]: 35 : if (!__mptcp_finish_join(msk, ssk)) 829 : 0 : mptcp_subflow_reset(ssk); - 830 : 36 : unlock_sock_fast(ssk, slow); + 830 : 35 : unlock_sock_fast(ssk, slow); 831 : : } - 832 : 32 : } + 832 : 33 : } 833 : : - 834 : 269188 : static bool mptcp_rtx_timer_pending(struct sock *sk) + 834 : 269704 : static bool mptcp_rtx_timer_pending(struct sock *sk) 835 : : { - 836 : 606653 : return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); + 836 : 703876 : return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); 837 : : } 838 : : - 839 : 246996 : static void mptcp_reset_rtx_timer(struct sock *sk) + 839 : 274580 : static void mptcp_reset_rtx_timer(struct sock *sk) 840 : : { - 841 : 246996 : struct inet_connection_sock *icsk = inet_csk(sk); - 842 : 246996 : unsigned long tout; + 841 : 274580 : struct inet_connection_sock *icsk = inet_csk(sk); + 842 : 274580 : unsigned long tout; 843 : : 844 : : /* prevent rescheduling on close */ - 845 [ + + ]: 246996 : if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) + 845 [ + + ]: 274580 : if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) 846 : : return; 847 : : - 848 [ - + ]: 246937 : tout = mptcp_sk(sk)->timer_ival; - 849 : 246937 : sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout); + 848 [ - + ]: 274491 : tout = mptcp_sk(sk)->timer_ival; + 849 : 274491 : sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout); 850 : : } 851 : : - 852 : 15323 : bool mptcp_schedule_work(struct sock *sk) + 852 : 14934 : bool mptcp_schedule_work(struct sock *sk) 853 : : { - 854 [ + + + + ]: 29744 : if (inet_sk_state_load(sk) != TCP_CLOSE && - 855 [ - + + + ]: 15009 : schedule_work(&mptcp_sk(sk)->work)) { + 854 [ + + + + ]: 28961 : if (inet_sk_state_load(sk) != TCP_CLOSE && + 855 [ - + + + ]: 14641 : schedule_work(&mptcp_sk(sk)->work)) { 856 : : /* each subflow already holds a reference to the sk, and the 857 : : * workqueue is invoked by a subflow, so sk can't go away here. 858 : : */ - 859 : 13856 : sock_hold(sk); - 860 : 13856 : return true; + 859 : 13446 : sock_hold(sk); + 860 : 13446 : return true; 861 : : } 862 : : return false; 863 : : } 864 : : - 865 : 531587 : static bool mptcp_skb_can_collapse_to(u64 write_seq, + 865 : 600960 : static bool mptcp_skb_can_collapse_to(u64 write_seq, 866 : : const struct sk_buff *skb, 867 : : const struct mptcp_ext *mpext) 868 : : { - 869 [ + + ]: 531587 : if (!tcp_skb_can_collapse_to(skb)) + 869 [ + + ]: 600960 : if (!tcp_skb_can_collapse_to(skb)) 870 : : return false; 871 : : 872 : : /* can collapse only if MPTCP level sequence is in order and this 873 : : * mapping has not been xmitted yet 874 : : */ - 875 [ + - + + ]: 1035820 : return mpext && mpext->data_seq + mpext->data_len == write_seq && - 876 [ + + ]: 442997 : !mpext->frozen; + 875 [ + - + + ]: 1165924 : return mpext && mpext->data_seq + mpext->data_len == write_seq && + 876 [ + + ]: 517154 : !mpext->frozen; 877 : : } 878 : : 879 : : /* we can append data to the given data frag if: @@ -964,44 +964,44 @@ 881 : : * - the data frag tail matches the current page_frag free offset 882 : : * - the data frag end sequence number matches the current write seq 883 : : */ - 884 : 606383 : static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk, + 884 : 682253 : static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk, 885 : : const struct page_frag *pfrag, 886 : : const struct mptcp_data_frag *df) 887 : : { - 888 [ + - ]: 215320 : return df && pfrag->page == df->page && - 889 [ + + ]: 215320 : pfrag->size - pfrag->offset > 0 && - 890 [ + + + - ]: 726640 : pfrag->offset == (df->offset + df->data_len) && - 891 [ - + ]: 120257 : df->data_seq + df->data_len == msk->write_seq; + 888 [ + - ]: 285320 : return df && pfrag->page == df->page && + 889 [ + + ]: 285320 : pfrag->size - pfrag->offset > 0 && + 890 [ + + + - ]: 862737 : pfrag->offset == (df->offset + df->data_len) && + 891 [ - + ]: 180484 : df->data_seq + df->data_len == msk->write_seq; 892 : : } 893 : : - 894 : 224514 : static void dfrag_uncharge(struct sock *sk, int len) + 894 : 208063 : static void dfrag_uncharge(struct sock *sk, int len) 895 : : { - 896 : 634632 : sk_mem_uncharge(sk, len); - 897 : 634632 : sk_wmem_queued_add(sk, -len); - 898 : 148512 : } + 896 : 663326 : sk_mem_uncharge(sk, len); + 897 : 663326 : sk_wmem_queued_add(sk, -len); + 898 : 161563 : } 899 : : - 900 : 486120 : static void dfrag_clear(struct sock *sk, struct mptcp_data_frag *dfrag) + 900 : 501763 : static void dfrag_clear(struct sock *sk, struct mptcp_data_frag *dfrag) 901 : : { - 902 : 486120 : int len = dfrag->data_len + dfrag->overhead; + 902 : 501763 : int len = dfrag->data_len + dfrag->overhead; 903 : : - 904 : 486120 : list_del(&dfrag->list); - 905 : 486120 : dfrag_uncharge(sk, len); - 906 : 486120 : put_page(dfrag->page); - 907 : 486120 : } + 904 : 501763 : list_del(&dfrag->list); + 905 : 501763 : dfrag_uncharge(sk, len); + 906 : 501763 : put_page(dfrag->page); + 907 : 501763 : } 908 : : 909 : : /* called under both the msk socket lock and the data lock */ - 910 : 248710 : static void __mptcp_clean_una(struct sock *sk) + 910 : 275499 : static void __mptcp_clean_una(struct sock *sk) 911 : : { - 912 [ - + ]: 248710 : struct mptcp_sock *msk = mptcp_sk(sk); - 913 : 248710 : struct mptcp_data_frag *dtmp, *dfrag; - 914 : 248710 : u64 snd_una; + 912 [ - + ]: 275499 : struct mptcp_sock *msk = mptcp_sk(sk); + 913 : 275499 : struct mptcp_data_frag *dtmp, *dfrag; + 914 : 275499 : u64 snd_una; 915 : : - 916 : 248710 : snd_una = msk->snd_una; - 917 [ + + ]: 733651 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) { - 918 [ + + ]: 702275 : if (after64(dfrag->data_seq + dfrag->data_len, snd_una)) + 916 : 275499 : snd_una = msk->snd_una; + 917 [ + + ]: 777080 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) { + 918 [ + + ]: 732477 : if (after64(dfrag->data_seq + dfrag->data_len, snd_una)) 919 : : break; 920 : : - 921 [ - + ]: 484941 : if (unlikely(dfrag == msk->first_pending)) { + 921 [ - + ]: 501581 : if (unlikely(dfrag == msk->first_pending)) { 922 : : /* in recovery mode can see ack after the current snd head */ 923 [ # # # # ]: 0 : if (WARN_ON_ONCE(!msk->recovery)) 924 : : break; @@ -1009,15 +1009,15 @@ 926 : 0 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); 927 : : } 928 : : - 929 : 484941 : dfrag_clear(sk, dfrag); + 929 : 501581 : dfrag_clear(sk, dfrag); 930 : : } 931 : : - 932 : 248710 : dfrag = mptcp_rtx_head(sk); - 933 [ + + + + ]: 248710 : if (dfrag && after64(snd_una, dfrag->data_seq)) { - 934 : 148512 : u64 delta = snd_una - dfrag->data_seq; + 932 : 275499 : dfrag = mptcp_rtx_head(sk); + 933 [ + + + + ]: 275499 : if (dfrag && after64(snd_una, dfrag->data_seq)) { + 934 : 161563 : u64 delta = snd_una - dfrag->data_seq; 935 : : 936 : : /* prevent wrap around in recovery mode */ - 937 [ - + ]: 148512 : if (unlikely(delta > dfrag->already_sent)) { + 937 [ - + ]: 161563 : if (unlikely(delta > dfrag->already_sent)) { 938 [ # # # # ]: 0 : if (WARN_ON_ONCE(!msk->recovery)) 939 : 0 : goto out; 940 [ # # # # ]: 0 : if (WARN_ON_ONCE(delta > dfrag->data_len)) @@ -1025,45 +1025,45 @@ 942 : 0 : dfrag->already_sent += delta - dfrag->already_sent; 943 : : } 944 : : - 945 : 148512 : dfrag->data_seq += delta; - 946 : 148512 : dfrag->offset += delta; - 947 : 148512 : dfrag->data_len -= delta; - 948 : 148512 : dfrag->already_sent -= delta; + 945 : 161563 : dfrag->data_seq += delta; + 946 : 161563 : dfrag->offset += delta; + 947 : 161563 : dfrag->data_len -= delta; + 948 : 161563 : dfrag->already_sent -= delta; 949 : : - 950 : 148512 : dfrag_uncharge(sk, delta); + 950 : 161563 : dfrag_uncharge(sk, delta); 951 : : } 952 : : 953 : : /* all retransmitted data acked, recovery completed */ - 954 [ + + + + : 248710 : if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) - + + ] - 955 : 33 : msk->recovery = false; + 954 [ + + + + : 275499 : if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) + + + ] + 955 : 28 : msk->recovery = false; 956 : : - 957 : 213251 : out: - 958 [ + + + + ]: 248710 : if (snd_una == msk->snd_nxt && snd_una == msk->write_seq) { - 959 [ + + + + ]: 29990 : if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) - 960 : 22439 : mptcp_stop_rtx_timer(sk); + 957 : 239474 : out: + 958 [ + + + + ]: 275499 : if (snd_una == msk->snd_nxt && snd_una == msk->write_seq) { + 959 [ + + + + ]: 43224 : if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) + 960 : 36526 : mptcp_stop_rtx_timer(sk); 961 : : } else { - 962 : 218720 : mptcp_reset_rtx_timer(sk); + 962 : 232275 : mptcp_reset_rtx_timer(sk); 963 : : } 964 : : - 965 [ + + ]: 248710 : if (mptcp_pending_data_fin_ack(sk)) - 966 : 1745 : mptcp_schedule_work(sk); - 967 : 248710 : } + 965 [ + + ]: 275499 : if (mptcp_pending_data_fin_ack(sk)) + 966 : 1722 : mptcp_schedule_work(sk); + 967 : 275499 : } 968 : : - 969 : 65767 : static void __mptcp_clean_una_wakeup(struct sock *sk) + 969 : 59458 : static void __mptcp_clean_una_wakeup(struct sock *sk) 970 : : { - 971 [ + - - + ]: 74349 : lockdep_assert_held_once(&sk->sk_lock.slock); + 971 [ + - - + ]: 76648 : lockdep_assert_held_once(&sk->sk_lock.slock); 972 : : - 973 : 74349 : __mptcp_clean_una(sk); - 974 : 58663 : mptcp_write_space(sk); - 975 : 71466 : } + 973 : 76648 : __mptcp_clean_una(sk); + 974 : 60712 : mptcp_write_space(sk); + 975 : 71456 : } 976 : : - 977 : 11633 : static void mptcp_clean_una_wakeup(struct sock *sk) + 977 : 11138 : static void mptcp_clean_una_wakeup(struct sock *sk) 978 : : { - 979 : 11633 : mptcp_data_lock(sk); - 980 : 11633 : __mptcp_clean_una_wakeup(sk); - 981 : 11633 : mptcp_data_unlock(sk); - 982 : 11633 : } + 979 : 11138 : mptcp_data_lock(sk); + 980 : 11138 : __mptcp_clean_una_wakeup(sk); + 981 : 11138 : mptcp_data_unlock(sk); + 982 : 11138 : } 983 : : 984 : 0 : static void mptcp_enter_memory_pressure(struct sock *sk) 985 : : { @@ -1086,9 +1086,9 @@ 1002 : : /* ensure we get enough memory for the frag hdr, beyond some minimal amount of 1003 : : * data 1004 : : */ - 1005 : 486126 : static bool mptcp_page_frag_refill(struct sock *sk, struct page_frag *pfrag) + 1005 : 501769 : static bool mptcp_page_frag_refill(struct sock *sk, struct page_frag *pfrag) 1006 : : { - 1007 [ - + ]: 486126 : if (likely(skb_page_frag_refill(32U + sizeof(struct mptcp_data_frag), + 1007 [ - + ]: 501769 : if (likely(skb_page_frag_refill(32U + sizeof(struct mptcp_data_frag), 1008 : : pfrag, sk->sk_allocation))) 1009 : : return true; 1010 : : @@ -1097,21 +1097,21 @@ 1013 : : } 1014 : : 1015 : : static struct mptcp_data_frag * - 1016 : 486126 : mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, + 1016 : 501769 : mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, 1017 : : int orig_offset) 1018 : : { - 1019 : 486126 : int offset = ALIGN(orig_offset, sizeof(long)); - 1020 : 486126 : struct mptcp_data_frag *dfrag; + 1019 : 501769 : int offset = ALIGN(orig_offset, sizeof(long)); + 1020 : 501769 : struct mptcp_data_frag *dfrag; 1021 : : - 1022 : 486126 : dfrag = (struct mptcp_data_frag *)(page_to_virt(pfrag->page) + offset); - 1023 : 486126 : dfrag->data_len = 0; - 1024 : 486126 : dfrag->data_seq = msk->write_seq; - 1025 : 486126 : dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); - 1026 : 486126 : dfrag->offset = offset + sizeof(struct mptcp_data_frag); - 1027 : 486126 : dfrag->already_sent = 0; - 1028 : 486126 : dfrag->page = pfrag->page; + 1022 : 501769 : dfrag = (struct mptcp_data_frag *)(page_to_virt(pfrag->page) + offset); + 1023 : 501769 : dfrag->data_len = 0; + 1024 : 501769 : dfrag->data_seq = msk->write_seq; + 1025 : 501769 : dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); + 1026 : 501769 : dfrag->offset = offset + sizeof(struct mptcp_data_frag); + 1027 : 501769 : dfrag->already_sent = 0; + 1028 : 501769 : dfrag->page = pfrag->page; 1029 : : - 1030 : 486126 : return dfrag; + 1030 : 501769 : return dfrag; 1031 : : } 1032 : : 1033 : : struct mptcp_sendmsg_info { @@ -1123,47 +1123,47 @@ 1039 : : bool data_lock_held; 1040 : : }; 1041 : : - 1042 : 672303 : static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, + 1042 : 791398 : static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, 1043 : : u64 data_seq, int avail_size) 1044 : : { - 1045 : 672303 : u64 window_end = mptcp_wnd_end(msk); - 1046 : 672303 : u64 mptcp_snd_wnd; + 1045 : 791398 : u64 window_end = mptcp_wnd_end(msk); + 1046 : 791398 : u64 mptcp_snd_wnd; 1047 : : - 1048 [ + + ]: 672303 : if (__mptcp_check_fallback(msk)) + 1048 [ + + ]: 791398 : if (__mptcp_check_fallback(msk)) 1049 : : return avail_size; 1050 : : - 1051 : 638801 : mptcp_snd_wnd = window_end - data_seq; - 1052 : 638801 : avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); + 1051 : 754708 : mptcp_snd_wnd = window_end - data_seq; + 1052 : 754708 : avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); 1053 : : - 1054 [ - + + + ]: 638801 : if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { - 1055 [ - + ]: 2487 : tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); - 1056 [ + - ]: 2487 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); + 1054 [ - + + + ]: 754708 : if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { + 1055 [ - + ]: 4553 : tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); + 1056 [ + - ]: 4553 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); 1057 : : } 1058 : : 1059 : : return avail_size; 1060 : : } 1061 : : - 1062 : 267878 : static bool __mptcp_add_ext(struct sk_buff *skb, gfp_t gfp) + 1062 : 312136 : static bool __mptcp_add_ext(struct sk_buff *skb, gfp_t gfp) 1063 : : { - 1064 : 267878 : struct skb_ext *mpext = __skb_ext_alloc(gfp); + 1064 : 312136 : struct skb_ext *mpext = __skb_ext_alloc(gfp); 1065 : : - 1066 [ + - ]: 267878 : if (!mpext) + 1066 [ + - ]: 312136 : if (!mpext) 1067 : : return false; - 1068 : 267878 : __skb_ext_set(skb, SKB_EXT_MPTCP, mpext); - 1069 : 267878 : return true; + 1068 : 312136 : __skb_ext_set(skb, SKB_EXT_MPTCP, mpext); + 1069 : 312136 : return true; 1070 : : } 1071 : : - 1072 : 267878 : static struct sk_buff *__mptcp_do_alloc_tx_skb(struct sock *sk, gfp_t gfp) + 1072 : 312136 : static struct sk_buff *__mptcp_do_alloc_tx_skb(struct sock *sk, gfp_t gfp) 1073 : : { - 1074 : 267878 : struct sk_buff *skb; + 1074 : 312136 : struct sk_buff *skb; 1075 : : - 1076 : 267878 : skb = alloc_skb_fclone(MAX_TCP_HEADER, gfp); - 1077 [ + - ]: 267878 : if (likely(skb)) { - 1078 [ + - ]: 267878 : if (likely(__mptcp_add_ext(skb, gfp))) { - 1079 : 267878 : skb_reserve(skb, MAX_TCP_HEADER); - 1080 : 267878 : skb->ip_summed = CHECKSUM_PARTIAL; - 1081 : 267878 : INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); - 1082 : 267878 : return skb; + 1076 : 312136 : skb = alloc_skb_fclone(MAX_TCP_HEADER, gfp); + 1077 [ + - ]: 312136 : if (likely(skb)) { + 1078 [ + - ]: 312136 : if (likely(__mptcp_add_ext(skb, gfp))) { + 1079 : 312136 : skb_reserve(skb, MAX_TCP_HEADER); + 1080 : 312136 : skb->ip_summed = CHECKSUM_PARTIAL; + 1081 : 312136 : INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); + 1082 : 312136 : return skb; 1083 : : } 1084 : 0 : __kfree_skb(skb); 1085 : : } else { @@ -1172,41 +1172,41 @@ 1088 : : return NULL; 1089 : : } 1090 : : - 1091 : 267878 : static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t gfp) + 1091 : 312136 : static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t gfp) 1092 : : { - 1093 : 267878 : struct sk_buff *skb; + 1093 : 312136 : struct sk_buff *skb; 1094 : : - 1095 : 267878 : skb = __mptcp_do_alloc_tx_skb(sk, gfp); - 1096 [ - + ]: 267878 : if (!skb) + 1095 : 312136 : skb = __mptcp_do_alloc_tx_skb(sk, gfp); + 1096 [ - + ]: 312136 : if (!skb) 1097 : : return NULL; 1098 : : - 1099 [ + - ]: 267878 : if (likely(sk_wmem_schedule(ssk, skb->truesize))) { - 1100 : 267878 : tcp_skb_entail(ssk, skb); - 1101 : 267878 : return skb; + 1099 [ + - ]: 312136 : if (likely(sk_wmem_schedule(ssk, skb->truesize))) { + 1100 : 312136 : tcp_skb_entail(ssk, skb); + 1101 : 312136 : return skb; 1102 : : } 1103 : 0 : tcp_skb_tsorted_anchor_cleanup(skb); 1104 : 0 : kfree_skb(skb); 1105 : 0 : return NULL; 1106 : : } 1107 : : - 1108 : 80371 : static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, bool data_lock_held) + 1108 : 80290 : static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, bool data_lock_held) 1109 : : { - 1110 : 244093 : gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation; + 1110 : 277341 : gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation; 1111 : : - 1112 : 267878 : return __mptcp_alloc_tx_skb(sk, ssk, gfp); + 1112 : 312136 : return __mptcp_alloc_tx_skb(sk, ssk, gfp); 1113 : : } 1114 : : 1115 : : /* note: this always recompute the csum on the whole skb, even 1116 : : * if we just appended a single frag. More status info needed 1117 : : */ - 1118 : 868 : static void mptcp_update_data_checksum(struct sk_buff *skb, int added) + 1118 : 855 : static void mptcp_update_data_checksum(struct sk_buff *skb, int added) 1119 : : { - 1120 [ + - ]: 868 : struct mptcp_ext *mpext = mptcp_get_ext(skb); - 1121 : 868 : __wsum csum = ~csum_unfold(mpext->csum); - 1122 : 868 : int offset = skb->len - added; + 1120 [ + - ]: 855 : struct mptcp_ext *mpext = mptcp_get_ext(skb); + 1121 : 855 : __wsum csum = ~csum_unfold(mpext->csum); + 1122 : 855 : int offset = skb->len - added; 1123 : : - 1124 [ # # ]: 868 : mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); - 1125 : 868 : } + 1124 [ # # ]: 855 : mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); + 1125 : 855 : } 1126 : : 1127 : 2 : static void mptcp_update_infinite_map(struct mptcp_sock *msk, 1128 : : struct sock *ssk, @@ -1226,79 +1226,79 @@ 1142 : : 1143 : : #define MPTCP_MAX_GSO_SIZE (GSO_LEGACY_MAX_SIZE - (MAX_TCP_HEADER + 1)) 1144 : : - 1145 : 672303 : static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, + 1145 : 791398 : static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, 1146 : : struct mptcp_data_frag *dfrag, 1147 : : struct mptcp_sendmsg_info *info) 1148 : : { - 1149 : 672303 : u64 data_seq = dfrag->data_seq + info->sent; - 1150 : 672303 : int offset = dfrag->offset + info->sent; - 1151 [ - + ]: 672303 : struct mptcp_sock *msk = mptcp_sk(sk); - 1152 : 672303 : bool zero_window_probe = false; - 1153 : 672303 : struct mptcp_ext *mpext = NULL; - 1154 : 672303 : bool can_coalesce = false; - 1155 : 672303 : bool reuse_skb = true; - 1156 : 672303 : struct sk_buff *skb; - 1157 : 672303 : size_t copy; - 1158 : 672303 : int i; + 1149 : 791398 : u64 data_seq = dfrag->data_seq + info->sent; + 1150 : 791398 : int offset = dfrag->offset + info->sent; + 1151 [ - + ]: 791398 : struct mptcp_sock *msk = mptcp_sk(sk); + 1152 : 791398 : bool zero_window_probe = false; + 1153 : 791398 : struct mptcp_ext *mpext = NULL; + 1154 : 791398 : bool can_coalesce = false; + 1155 : 791398 : bool reuse_skb = true; + 1156 : 791398 : struct sk_buff *skb; + 1157 : 791398 : size_t copy; + 1158 : 791398 : int i; 1159 : : - 1160 [ - + ]: 672303 : pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u\n", + 1160 [ - + ]: 791398 : pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u\n", 1161 : : msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent); 1162 : : - 1163 [ + - - + ]: 672303 : if (WARN_ON_ONCE(info->sent > info->limit || + 1163 [ + - - + ]: 791398 : if (WARN_ON_ONCE(info->sent > info->limit || 1164 : : info->limit > dfrag->data_len)) 1165 : 0 : return 0; 1166 : : - 1167 [ + - ]: 672303 : if (unlikely(!__tcp_can_send(ssk))) + 1167 [ + - ]: 791398 : if (unlikely(!__tcp_can_send(ssk))) 1168 : : return -EAGAIN; 1169 : : 1170 : : /* compute send limit */ - 1171 [ - + ]: 672303 : if (unlikely(ssk->sk_gso_max_size > MPTCP_MAX_GSO_SIZE)) + 1171 [ - + ]: 791398 : if (unlikely(ssk->sk_gso_max_size > MPTCP_MAX_GSO_SIZE)) 1172 : 0 : ssk->sk_gso_max_size = MPTCP_MAX_GSO_SIZE; - 1173 : 672303 : info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); - 1174 : 672303 : copy = info->size_goal; + 1173 : 791398 : info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); + 1174 : 791398 : copy = info->size_goal; 1175 : : - 1176 [ + + ]: 672303 : skb = tcp_write_queue_tail(ssk); - 1177 [ + - + + ]: 560415 : if (skb && copy > skb->len) { + 1176 [ + + ]: 791398 : skb = tcp_write_queue_tail(ssk); + 1177 [ + - + + ]: 631926 : if (skb && copy > skb->len) { 1178 : : /* Limit the write to the size available in the 1179 : : * current skb, if any, so that we create at most a new skb. 1180 : : * Explicitly tells TCP internals to avoid collapsing on later 1181 : : * queue management operation, to avoid breaking the ext <-> 1182 : : * SSN association set here 1183 : : */ - 1184 [ + - ]: 531587 : mpext = mptcp_get_ext(skb); - 1185 [ + + ]: 531587 : if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { - 1186 : 121544 : TCP_SKB_CB(skb)->eor = 1; - 1187 [ - + ]: 121544 : tcp_mark_push(tcp_sk(ssk), skb); - 1188 : 121544 : goto alloc_skb; + 1184 [ + - ]: 600960 : mpext = mptcp_get_ext(skb); + 1185 [ + + ]: 600960 : if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { + 1186 : 116898 : TCP_SKB_CB(skb)->eor = 1; + 1187 [ - + ]: 116898 : tcp_mark_push(tcp_sk(ssk), skb); + 1188 : 116898 : goto alloc_skb; 1189 : : } 1190 : : - 1191 : 410043 : i = skb_shinfo(skb)->nr_frags; - 1192 : 410043 : can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); - 1193 [ + + + + ]: 410043 : if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) { - 1194 [ - + ]: 5618 : tcp_mark_push(tcp_sk(ssk), skb); - 1195 : 5618 : goto alloc_skb; + 1191 : 484062 : i = skb_shinfo(skb)->nr_frags; + 1192 : 484062 : can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); + 1193 [ + + + + ]: 484062 : if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) { + 1194 [ - + ]: 4800 : tcp_mark_push(tcp_sk(ssk), skb); + 1195 : 4800 : goto alloc_skb; 1196 : : } 1197 : : - 1198 : 404425 : copy -= skb->len; + 1198 : 479262 : copy -= skb->len; 1199 : : } else { - 1200 [ + + ]: 80371 : alloc_skb: - 1201 [ + + + + ]: 267878 : skb = mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); - 1202 [ - + ]: 267878 : if (!skb) + 1200 [ + + ]: 80290 : alloc_skb: + 1201 [ + + + + ]: 312136 : skb = mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); + 1202 [ - + ]: 312136 : if (!skb) 1203 : : return -ENOMEM; 1204 : : - 1205 [ + - ]: 267878 : i = skb_shinfo(skb)->nr_frags; - 1206 : 267878 : reuse_skb = false; - 1207 [ + - ]: 267878 : mpext = mptcp_get_ext(skb); + 1205 [ + - ]: 312136 : i = skb_shinfo(skb)->nr_frags; + 1206 : 312136 : reuse_skb = false; + 1207 [ + - ]: 312136 : mpext = mptcp_get_ext(skb); 1208 : : } 1209 : : 1210 : : /* Zero window and all data acked? Probe. */ - 1211 : 672303 : copy = mptcp_check_allowed_size(msk, ssk, data_seq, copy); - 1212 [ + + ]: 672303 : if (copy == 0) { - 1213 : 122788 : u64 snd_una = READ_ONCE(msk->snd_una); + 1211 : 791398 : copy = mptcp_check_allowed_size(msk, ssk, data_seq, copy); + 1212 [ + + ]: 791398 : if (copy == 0) { + 1213 : 208775 : u64 snd_una = READ_ONCE(msk->snd_una); 1214 : : - 1215 [ + + + - ]: 127732 : if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { - 1216 : 122788 : tcp_remove_empty_skb(ssk); - 1217 : 122788 : return 0; + 1215 [ + + + - ]: 225225 : if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { + 1216 : 208775 : tcp_remove_empty_skb(ssk); + 1217 : 208775 : return 0; 1218 : : } 1219 : : 1220 : 0 : zero_window_probe = true; @@ -1306,47 +1306,47 @@ 1222 : 0 : copy = 1; 1223 : : } 1224 : : - 1225 : 549515 : copy = min_t(size_t, copy, info->limit - info->sent); - 1226 [ - + ]: 549515 : if (!sk_wmem_schedule(ssk, copy)) { + 1225 : 582623 : copy = min_t(size_t, copy, info->limit - info->sent); + 1226 [ - + ]: 582623 : if (!sk_wmem_schedule(ssk, copy)) { 1227 : 0 : tcp_remove_empty_skb(ssk); 1228 : 0 : return -ENOMEM; 1229 : : } 1230 : : - 1231 [ + + ]: 549515 : if (can_coalesce) { - 1232 : 15712 : skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); + 1231 [ + + ]: 582623 : if (can_coalesce) { + 1232 : 23086 : skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); 1233 : : } else { - 1234 : 533803 : get_page(dfrag->page); - 1235 : 533803 : skb_fill_page_desc(skb, i, dfrag->page, offset, copy); + 1234 : 559537 : get_page(dfrag->page); + 1235 : 559537 : skb_fill_page_desc(skb, i, dfrag->page, offset, copy); 1236 : : } 1237 : : - 1238 : 549515 : skb->len += copy; - 1239 : 549515 : skb->data_len += copy; - 1240 : 549515 : skb->truesize += copy; - 1241 [ + - ]: 549515 : sk_wmem_queued_add(ssk, copy); - 1242 [ + - ]: 549515 : sk_mem_charge(ssk, copy); - 1243 [ - + - + ]: 549515 : WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); - 1244 : 549515 : TCP_SKB_CB(skb)->end_seq += copy; - 1245 [ + + ]: 549515 : tcp_skb_pcount_set(skb, 0); + 1238 : 582623 : skb->len += copy; + 1239 : 582623 : skb->data_len += copy; + 1240 : 582623 : skb->truesize += copy; + 1241 [ + - ]: 582623 : sk_wmem_queued_add(ssk, copy); + 1242 [ + - ]: 582623 : sk_mem_charge(ssk, copy); + 1243 [ - + - + ]: 582623 : WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); + 1244 : 582623 : TCP_SKB_CB(skb)->end_seq += copy; + 1245 [ + + ]: 582623 : tcp_skb_pcount_set(skb, 0); 1246 : : 1247 : : /* on skb reuse we just need to update the DSS len */ - 1248 [ + + ]: 549515 : if (reuse_skb) { - 1249 : 325211 : TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; - 1250 : 325211 : mpext->data_len += copy; - 1251 : 325211 : goto out; + 1248 [ + + ]: 582623 : if (reuse_skb) { + 1249 : 341631 : TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; + 1250 : 341631 : mpext->data_len += copy; + 1251 : 341631 : goto out; 1252 : : } 1253 : : - 1254 : 224304 : memset(mpext, 0, sizeof(*mpext)); - 1255 : 224304 : mpext->data_seq = data_seq; - 1256 [ - + ]: 224304 : mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq; - 1257 : 224304 : mpext->data_len = copy; - 1258 : 224304 : mpext->use_map = 1; - 1259 : 224304 : mpext->dsn64 = 1; + 1254 : 240992 : memset(mpext, 0, sizeof(*mpext)); + 1255 : 240992 : mpext->data_seq = data_seq; + 1256 [ - + ]: 240992 : mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq; + 1257 : 240992 : mpext->data_len = copy; + 1258 : 240992 : mpext->use_map = 1; + 1259 : 240992 : mpext->dsn64 = 1; 1260 : : - 1261 [ - + ]: 224304 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d\n", + 1261 [ - + ]: 240992 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d\n", 1262 : : mpext->data_seq, mpext->subflow_seq, mpext->data_len, 1263 : : mpext->dsn64); 1264 : : - 1265 [ - + ]: 224304 : if (zero_window_probe) { + 1265 [ - + ]: 240992 : if (zero_window_probe) { 1266 [ # # ]: 0 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; 1267 : 0 : mpext->frozen = 1; 1268 [ # # # # ]: 0 : if (READ_ONCE(msk->csum_enabled)) @@ -1354,14 +1354,14 @@ 1270 : 0 : tcp_push_pending_frames(ssk); 1271 : 0 : return 0; 1272 : : } - 1273 : 224304 : out: - 1274 [ + + + + ]: 549515 : if (READ_ONCE(msk->csum_enabled)) - 1275 : 868 : mptcp_update_data_checksum(skb, copy); - 1276 [ + + ]: 549515 : if (mptcp_subflow_ctx(ssk)->send_infinite_map) + 1273 : 240992 : out: + 1274 [ + + + + ]: 582623 : if (READ_ONCE(msk->csum_enabled)) + 1275 : 855 : mptcp_update_data_checksum(skb, copy); + 1276 [ + + ]: 582623 : if (mptcp_subflow_ctx(ssk)->send_infinite_map) 1277 : 2 : mptcp_update_infinite_map(msk, ssk, mpext); - 1278 : 549515 : trace_mptcp_sendmsg_frag(mpext); - 1279 : 549515 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; - 1280 : 549515 : return copy; + 1278 : 582623 : trace_mptcp_sendmsg_frag(mpext); + 1279 : 582623 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; + 1280 : 582623 : return copy; 1281 : : } 1282 : : 1283 : : #define MPTCP_SEND_BURST_SIZE ((1 << 16) - \ @@ -1375,26 +1375,26 @@ 1291 : : u64 linger_time; 1292 : : }; 1293 : : - 1294 : 143 : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow) + 1294 : 130 : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow) 1295 : : { - 1296 [ - + ]: 143 : if (!subflow->stale) + 1296 [ - + ]: 130 : if (!subflow->stale) 1297 : : return; 1298 : : 1299 : 0 : subflow->stale = 0; 1300 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(mptcp_subflow_tcp_sock(subflow)), MPTCP_MIB_SUBFLOWRECOVER); 1301 : : } 1302 : : - 1303 : 1152236 : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) + 1303 : 1278856 : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) 1304 : : { - 1305 [ + + ]: 1152236 : if (unlikely(subflow->stale)) { - 1306 [ - + ]: 114368 : u32 rcv_tstamp = READ_ONCE(tcp_sk(mptcp_subflow_tcp_sock(subflow))->rcv_tstamp); + 1305 [ + + ]: 1278856 : if (unlikely(subflow->stale)) { + 1306 [ - + ]: 110127 : u32 rcv_tstamp = READ_ONCE(tcp_sk(mptcp_subflow_tcp_sock(subflow))->rcv_tstamp); 1307 : : - 1308 [ - + ]: 114368 : if (subflow->stale_rcv_tstamp == rcv_tstamp) + 1308 [ - + ]: 110127 : if (subflow->stale_rcv_tstamp == rcv_tstamp) 1309 : : return false; 1310 : : 1311 : 0 : mptcp_subflow_set_active(subflow); 1312 : : } - 1313 : 1037868 : return __mptcp_subflow_active(subflow); + 1313 : 1168729 : return __mptcp_subflow_active(subflow); 1314 : : } 1315 : : 1316 : : #define SSK_MODE_ACTIVE 0 @@ -1405,53 +1405,53 @@ 1321 : : * returns the subflow that will transmit the next DSS 1322 : : * additionally updates the rtx timeout 1323 : : */ - 1324 : 395043 : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) + 1324 : 493832 : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) 1325 : : { - 1326 : 395043 : struct subflow_send_info send_info[SSK_MODE_MAX]; - 1327 : 395043 : struct mptcp_subflow_context *subflow; - 1328 : 395043 : struct sock *sk = (struct sock *)msk; - 1329 : 395043 : u32 pace, burst, wmem; - 1330 : 395043 : int i, nr_active = 0; - 1331 : 395043 : struct sock *ssk; - 1332 : 395043 : u64 linger_time; - 1333 : 395043 : long tout = 0; + 1326 : 493832 : struct subflow_send_info send_info[SSK_MODE_MAX]; + 1327 : 493832 : struct mptcp_subflow_context *subflow; + 1328 : 493832 : struct sock *sk = (struct sock *)msk; + 1329 : 493832 : u32 pace, burst, wmem; + 1330 : 493832 : int i, nr_active = 0; + 1331 : 493832 : struct sock *ssk; + 1332 : 493832 : u64 linger_time; + 1333 : 493832 : long tout = 0; 1334 : : 1335 : : /* pick the subflow with the lower wmem/wspace ratio */ - 1336 [ + + ]: 1185129 : for (i = 0; i < SSK_MODE_MAX; ++i) { - 1337 : 790086 : send_info[i].ssk = NULL; - 1338 : 790086 : send_info[i].linger_time = -1; + 1336 [ + + ]: 1481496 : for (i = 0; i < SSK_MODE_MAX; ++i) { + 1337 : 987664 : send_info[i].ssk = NULL; + 1338 : 987664 : send_info[i].linger_time = -1; 1339 : : } 1340 : : - 1341 [ + + ]: 1175287 : mptcp_for_each_subflow(msk, subflow) { - 1342 : 780244 : bool backup = subflow->backup || subflow->request_bkup; + 1341 [ + + ]: 1387689 : mptcp_for_each_subflow(msk, subflow) { + 1342 : 893857 : bool backup = subflow->backup || subflow->request_bkup; 1343 : : - 1344 : 780244 : trace_mptcp_subflow_get_send(subflow); - 1345 : 780244 : ssk = mptcp_subflow_tcp_sock(subflow); - 1346 [ + + ]: 780244 : if (!mptcp_subflow_active(subflow)) - 1347 : 115787 : continue; + 1344 : 893857 : trace_mptcp_subflow_get_send(subflow); + 1345 : 893857 : ssk = mptcp_subflow_tcp_sock(subflow); + 1346 [ + + ]: 893857 : if (!mptcp_subflow_active(subflow)) + 1347 : 111562 : continue; 1348 : : - 1349 [ + + ]: 664457 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); - 1350 : 664457 : nr_active += !backup; - 1351 : 664457 : pace = subflow->avg_pacing_rate; - 1352 [ + + ]: 664457 : if (unlikely(!pace)) { + 1349 [ + + ]: 782295 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); + 1350 : 782295 : nr_active += !backup; + 1351 : 782295 : pace = subflow->avg_pacing_rate; + 1352 [ + + ]: 782295 : if (unlikely(!pace)) { 1353 : : /* init pacing rate from socket */ - 1354 : 2490 : subflow->avg_pacing_rate = READ_ONCE(ssk->sk_pacing_rate); - 1355 : 2490 : pace = subflow->avg_pacing_rate; - 1356 [ - + ]: 2490 : if (!pace) + 1354 : 2488 : subflow->avg_pacing_rate = READ_ONCE(ssk->sk_pacing_rate); + 1355 : 2488 : pace = subflow->avg_pacing_rate; + 1356 [ - + ]: 2488 : if (!pace) 1357 : 0 : continue; 1358 : : } 1359 : : - 1360 [ + + ]: 664457 : linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); - 1361 [ + + ]: 664457 : if (linger_time < send_info[backup].linger_time) { - 1362 : 513443 : send_info[backup].ssk = ssk; - 1363 : 513443 : send_info[backup].linger_time = linger_time; + 1360 [ + + ]: 782295 : linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); + 1361 [ + + ]: 782295 : if (linger_time < send_info[backup].linger_time) { + 1362 : 633890 : send_info[backup].ssk = ssk; + 1363 : 633890 : send_info[backup].linger_time = linger_time; 1364 : : } 1365 : : } - 1366 : 395043 : __mptcp_set_timeout(sk, tout); + 1366 : 493832 : __mptcp_set_timeout(sk, tout); 1367 : : 1368 : : /* pick the best backup if no other subflow is active */ - 1369 [ + + ]: 395043 : if (!nr_active) - 1370 : 44135 : send_info[SSK_MODE_ACTIVE].ssk = send_info[SSK_MODE_BACKUP].ssk; + 1369 [ + + ]: 493832 : if (!nr_active) + 1370 : 37132 : send_info[SSK_MODE_ACTIVE].ssk = send_info[SSK_MODE_BACKUP].ssk; 1371 : : 1372 : : /* According to the blest algorithm, to avoid HoL blocking for the 1373 : : * faster flow, we need to: @@ -1464,40 +1464,40 @@ 1380 : : * the queued mem, which basically ensure the above. We just need 1381 : : * to check that subflow has a non empty cwin. 1382 : : */ - 1383 : 395043 : ssk = send_info[SSK_MODE_ACTIVE].ssk; - 1384 [ + + + + ]: 790076 : if (!ssk || !sk_stream_memory_free(ssk)) - 1385 : 71628 : return NULL; + 1383 : 493832 : ssk = send_info[SSK_MODE_ACTIVE].ssk; + 1384 [ + + + + ]: 987649 : if (!ssk || !sk_stream_memory_free(ssk)) + 1385 : 79804 : return NULL; 1386 : : - 1387 : 323415 : burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); - 1388 : 323415 : wmem = READ_ONCE(ssk->sk_wmem_queued); - 1389 [ + + ]: 323415 : if (!burst) + 1387 : 414028 : burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); + 1388 : 414028 : wmem = READ_ONCE(ssk->sk_wmem_queued); + 1389 [ + + ]: 414028 : if (!burst) 1390 : : return ssk; 1391 : : - 1392 : 226886 : subflow = mptcp_subflow_ctx(ssk); - 1393 : 226886 : subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem + - 1394 : 226886 : READ_ONCE(ssk->sk_pacing_rate) * burst, + 1392 : 263194 : subflow = mptcp_subflow_ctx(ssk); + 1393 : 263194 : subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem + + 1394 : 263194 : READ_ONCE(ssk->sk_pacing_rate) * burst, 1395 : : burst + wmem); - 1396 : 226886 : msk->snd_burst = burst; - 1397 : 226886 : return ssk; + 1396 : 263194 : msk->snd_burst = burst; + 1397 : 263194 : return ssk; 1398 : : } 1399 : : - 1400 : 511642 : static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info) + 1400 : 573107 : static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info) 1401 : : { - 1402 [ - + ]: 511642 : tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); - 1403 : 511642 : release_sock(ssk); - 1404 : 511642 : } + 1402 [ - + ]: 573107 : tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); + 1403 : 573107 : release_sock(ssk); + 1404 : 573107 : } 1405 : : - 1406 : 545793 : static void mptcp_update_post_push(struct mptcp_sock *msk, + 1406 : 578775 : static void mptcp_update_post_push(struct mptcp_sock *msk, 1407 : : struct mptcp_data_frag *dfrag, 1408 : : u32 sent) 1409 : : { - 1410 : 545793 : u64 snd_nxt_new = dfrag->data_seq; + 1410 : 578775 : u64 snd_nxt_new = dfrag->data_seq; 1411 : : - 1412 : 545793 : dfrag->already_sent += sent; + 1412 : 578775 : dfrag->already_sent += sent; 1413 : : - 1414 : 545793 : msk->snd_burst -= sent; + 1414 : 578775 : msk->snd_burst -= sent; 1415 : : - 1416 : 545793 : snd_nxt_new += dfrag->already_sent; + 1416 : 578775 : snd_nxt_new += dfrag->already_sent; 1417 : : 1418 : : /* snd_nxt_new can be smaller than snd_nxt in case mptcp 1419 : : * is recovering after a failover. In that event, this re-sends @@ -1508,113 +1508,113 @@ 1424 : : * that has been handed to the subflow for transmission 1425 : : * and skip update in case it was old dfrag. 1426 : : */ - 1427 [ + + ]: 545793 : if (likely(after64(snd_nxt_new, msk->snd_nxt))) { - 1428 : 540110 : msk->bytes_sent += snd_nxt_new - msk->snd_nxt; - 1429 : 540110 : WRITE_ONCE(msk->snd_nxt, snd_nxt_new); + 1427 [ + + ]: 578775 : if (likely(after64(snd_nxt_new, msk->snd_nxt))) { + 1428 : 573219 : msk->bytes_sent += snd_nxt_new - msk->snd_nxt; + 1429 : 573219 : WRITE_ONCE(msk->snd_nxt, snd_nxt_new); 1430 : : } - 1431 : 545793 : } + 1431 : 578775 : } 1432 : : - 1433 : 10729 : void mptcp_check_and_set_pending(struct sock *sk) + 1433 : 10259 : void mptcp_check_and_set_pending(struct sock *sk) 1434 : : { - 1435 [ + + ]: 10729 : if (mptcp_send_head(sk)) { - 1436 : 2385 : mptcp_data_lock(sk); - 1437 [ - + ]: 2385 : mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); - 1438 : 2385 : mptcp_data_unlock(sk); + 1435 [ + + ]: 10259 : if (mptcp_send_head(sk)) { + 1436 : 1791 : mptcp_data_lock(sk); + 1437 [ - + ]: 1791 : mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); + 1438 : 1791 : mptcp_data_unlock(sk); 1439 : : } - 1440 : 10729 : } + 1440 : 10259 : } 1441 : : - 1442 : 587850 : static int __subflow_push_pending(struct sock *sk, struct sock *ssk, + 1442 : 681533 : static int __subflow_push_pending(struct sock *sk, struct sock *ssk, 1443 : : struct mptcp_sendmsg_info *info) 1444 : : { - 1445 [ - + ]: 587850 : struct mptcp_sock *msk = mptcp_sk(sk); - 1446 : 349404 : struct mptcp_data_frag *dfrag; - 1447 : 349404 : int len, copied = 0, err = 0; + 1445 [ - + ]: 681533 : struct mptcp_sock *msk = mptcp_sk(sk); + 1446 : 332578 : struct mptcp_data_frag *dfrag; + 1447 : 332578 : int len, copied = 0, err = 0; 1448 : : - 1449 [ + + ]: 876005 : while ((dfrag = mptcp_send_head(sk))) { - 1450 : 614107 : info->sent = dfrag->already_sent; - 1451 : 614107 : info->limit = dfrag->data_len; - 1452 : 614107 : len = dfrag->data_len - dfrag->already_sent; - 1453 [ + + ]: 1159900 : while (len > 0) { - 1454 : 668581 : int ret = 0; + 1449 [ + + ]: 981730 : while ((dfrag = mptcp_send_head(sk))) { + 1450 : 715644 : info->sent = dfrag->already_sent; + 1451 : 715644 : info->limit = dfrag->data_len; + 1452 : 715644 : len = dfrag->data_len - dfrag->already_sent; + 1453 [ + + ]: 1294419 : while (len > 0) { + 1454 : 787550 : int ret = 0; 1455 : : - 1456 : 668581 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info); - 1457 [ + + ]: 668581 : if (ret <= 0) { - 1458 [ + + ]: 122788 : err = copied ? : ret; - 1459 : 122788 : goto out; + 1456 : 787550 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info); + 1457 [ + + ]: 787550 : if (ret <= 0) { + 1458 [ + + ]: 208775 : err = copied ? : ret; + 1459 : 208775 : goto out; 1460 : : } 1461 : : - 1462 : 545793 : info->sent += ret; - 1463 : 545793 : copied += ret; - 1464 : 545793 : len -= ret; + 1462 : 578775 : info->sent += ret; + 1463 : 578775 : copied += ret; + 1464 : 578775 : len -= ret; 1465 : : - 1466 : 545793 : mptcp_update_post_push(msk, dfrag, ret); + 1466 : 578775 : mptcp_update_post_push(msk, dfrag, ret); 1467 : : } - 1468 : 491319 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); + 1468 : 506869 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); 1469 : : - 1470 [ + + + + ]: 714440 : if (msk->snd_burst <= 0 || - 1471 [ + + - + ]: 360258 : !sk_stream_memory_free(ssk) || - 1472 : 288155 : !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { - 1473 : 203164 : err = copied; - 1474 : 203164 : goto out; + 1470 [ + + + + ]: 759925 : if (msk->snd_burst <= 0 || + 1471 [ + + - + ]: 354940 : !sk_stream_memory_free(ssk) || + 1472 : 300197 : !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { + 1473 : 206672 : err = copied; + 1474 : 206672 : goto out; 1475 : : } - 1476 : 288155 : mptcp_set_timeout(sk); + 1476 : 300197 : mptcp_set_timeout(sk); 1477 : : } 1478 : : err = copied; 1479 : : - 1480 : 587850 : out: - 1481 [ + + ]: 587850 : if (err > 0) - 1482 : 450630 : msk->last_data_sent = tcp_jiffies32; - 1483 : 587850 : return err; + 1480 : 681533 : out: + 1481 [ + + ]: 681533 : if (err > 0) + 1482 : 473855 : msk->last_data_sent = tcp_jiffies32; + 1483 : 681533 : return err; 1484 : : } 1485 : : - 1486 : 532830 : void __mptcp_push_pending(struct sock *sk, unsigned int flags) + 1486 : 600054 : void __mptcp_push_pending(struct sock *sk, unsigned int flags) 1487 : : { - 1488 : 532830 : struct sock *prev_ssk = NULL, *ssk = NULL; - 1489 [ - + ]: 532830 : struct mptcp_sock *msk = mptcp_sk(sk); - 1490 : 532830 : struct mptcp_sendmsg_info info = { + 1488 : 600054 : struct sock *prev_ssk = NULL, *ssk = NULL; + 1489 [ - + ]: 600054 : struct mptcp_sock *msk = mptcp_sk(sk); + 1490 : 600054 : struct mptcp_sendmsg_info info = { 1491 : : .flags = flags, 1492 : : }; - 1493 : 532830 : bool do_check_data_fin = false; - 1494 : 532830 : int push_count = 1; + 1493 : 600054 : bool do_check_data_fin = false; + 1494 : 600054 : int push_count = 1; 1495 : : - 1496 [ + + + + ]: 1021404 : while (mptcp_send_head(sk) && (push_count > 0)) { - 1497 : 542291 : struct mptcp_subflow_context *subflow; - 1498 : 542291 : int ret = 0; + 1496 [ + + + + ]: 1150364 : while (mptcp_send_head(sk) && (push_count > 0)) { + 1497 : 609192 : struct mptcp_subflow_context *subflow; + 1498 : 609192 : int ret = 0; 1499 : : - 1500 [ + + ]: 542291 : if (mptcp_sched_get_send(msk)) + 1500 [ + + ]: 609192 : if (mptcp_sched_get_send(msk)) 1501 : : break; 1502 : : - 1503 : 488574 : push_count = 0; + 1503 : 550310 : push_count = 0; 1504 : : - 1505 [ + + ]: 1385202 : mptcp_for_each_subflow(msk, subflow) { - 1506 [ + + + + ]: 896628 : if (READ_ONCE(subflow->scheduled)) { - 1507 : 530367 : mptcp_subflow_set_scheduled(subflow, false); + 1505 [ + + ]: 1488038 : mptcp_for_each_subflow(msk, subflow) { + 1506 [ + + + + ]: 937728 : if (READ_ONCE(subflow->scheduled)) { + 1507 : 592121 : mptcp_subflow_set_scheduled(subflow, false); 1508 : : - 1509 : 530367 : prev_ssk = ssk; - 1510 [ + + ]: 530367 : ssk = mptcp_subflow_tcp_sock(subflow); - 1511 [ + + ]: 530367 : if (ssk != prev_ssk) { + 1509 : 592121 : prev_ssk = ssk; + 1510 [ + + ]: 592121 : ssk = mptcp_subflow_tcp_sock(subflow); + 1511 [ + + ]: 592121 : if (ssk != prev_ssk) { 1512 : : /* First check. If the ssk has changed since 1513 : : * the last round, release prev_ssk 1514 : : */ - 1515 [ + + ]: 511642 : if (prev_ssk) - 1516 : 44064 : mptcp_push_release(prev_ssk, &info); + 1515 [ + + ]: 573107 : if (prev_ssk) + 1516 : 44336 : mptcp_push_release(prev_ssk, &info); 1517 : : 1518 : : /* Need to lock the new subflow only if different 1519 : : * from the previous one, otherwise we are still 1520 : : * helding the relevant lock 1521 : : */ - 1522 : 511642 : lock_sock(ssk); + 1522 : 573107 : lock_sock(ssk); 1523 : : } 1524 : : - 1525 : 530367 : push_count++; + 1525 : 592121 : push_count++; 1526 : : - 1527 : 530367 : ret = __subflow_push_pending(sk, ssk, &info); - 1528 [ + + ]: 530367 : if (ret <= 0) { - 1529 [ - + - - ]: 115725 : if (ret != -EAGAIN || + 1527 : 592121 : ret = __subflow_push_pending(sk, ssk, &info); + 1528 [ + + ]: 592121 : if (ret <= 0) { + 1529 [ - + - - ]: 171754 : if (ret != -EAGAIN || 1530 [ # # ]: 0 : (1 << ssk->sk_state) & 1531 : : (TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSE)) - 1532 : 46585 : push_count--; - 1533 : 115725 : continue; + 1532 : 93976 : push_count--; + 1533 : 171754 : continue; 1534 : : } 1535 : : do_check_data_fin = true; 1536 : : } @@ -1622,82 +1622,82 @@ 1538 : : } 1539 : : 1540 : : /* at this point we held the socket lock for the last subflow we used */ - 1541 [ + + ]: 532830 : if (ssk) - 1542 : 467578 : mptcp_push_release(ssk, &info); + 1541 [ + + ]: 600054 : if (ssk) + 1542 : 528771 : mptcp_push_release(ssk, &info); 1543 : : 1544 : : /* ensure the rtx timer is running */ - 1545 [ + + ]: 532830 : if (!mptcp_rtx_timer_pending(sk)) - 1546 : 26519 : mptcp_reset_rtx_timer(sk); - 1547 [ + + ]: 532830 : if (do_check_data_fin) - 1548 : 395903 : mptcp_check_send_data_fin(sk); - 1549 : 532830 : } + 1545 [ + + ]: 600054 : if (!mptcp_rtx_timer_pending(sk)) + 1546 : 40499 : mptcp_reset_rtx_timer(sk); + 1547 [ + + ]: 600054 : if (do_check_data_fin) + 1548 : 402221 : mptcp_check_send_data_fin(sk); + 1549 : 600054 : } 1550 : : - 1551 : 74060 : static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) + 1551 : 90624 : static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) 1552 : : { - 1553 [ - + ]: 74060 : struct mptcp_sock *msk = mptcp_sk(sk); - 1554 : 74060 : struct mptcp_sendmsg_info info = { + 1553 [ - + ]: 90624 : struct mptcp_sock *msk = mptcp_sk(sk); + 1554 : 90624 : struct mptcp_sendmsg_info info = { 1555 : : .data_lock_held = true, 1556 : : }; - 1557 : 74060 : bool keep_pushing = true; - 1558 : 74060 : struct sock *xmit_ssk; - 1559 : 74060 : int copied = 0; + 1557 : 90624 : bool keep_pushing = true; + 1558 : 90624 : struct sock *xmit_ssk; + 1559 : 90624 : int copied = 0; 1560 : : - 1561 : 74060 : info.flags = 0; - 1562 [ + + + + ]: 134380 : while (mptcp_send_head(sk) && keep_pushing) { - 1563 [ + + ]: 107757 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1564 : 107757 : int ret = 0; + 1561 : 90624 : info.flags = 0; + 1562 [ + + + + ]: 183219 : while (mptcp_send_head(sk) && keep_pushing) { + 1563 [ + + ]: 141406 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1564 : 141406 : int ret = 0; 1565 : : 1566 : : /* check for a different subflow usage only after 1567 : : * spooling the first chunk of data 1568 : : */ - 1569 [ + + ]: 107757 : if (first) { - 1570 : 3679 : mptcp_subflow_set_scheduled(subflow, false); - 1571 : 3679 : ret = __subflow_push_pending(sk, ssk, &info); - 1572 : 3679 : first = false; - 1573 [ + + ]: 3679 : if (ret <= 0) + 1569 [ + + ]: 141406 : if (first) { + 1570 : 3882 : mptcp_subflow_set_scheduled(subflow, false); + 1571 : 3882 : ret = __subflow_push_pending(sk, ssk, &info); + 1572 : 3882 : first = false; + 1573 [ + + ]: 3882 : if (ret <= 0) 1574 : : break; - 1575 : 2077 : copied += ret; - 1576 : 2077 : continue; + 1575 : 2362 : copied += ret; + 1576 : 2362 : continue; 1577 : : } 1578 : : - 1579 [ + + ]: 104078 : if (mptcp_sched_get_send(msk)) - 1580 : 45835 : goto out; + 1579 [ + + ]: 137524 : if (mptcp_sched_get_send(msk)) + 1580 : 47291 : goto out; 1581 : : - 1582 [ + + + + ]: 58243 : if (READ_ONCE(subflow->scheduled)) { - 1583 : 53804 : mptcp_subflow_set_scheduled(subflow, false); - 1584 : 53804 : ret = __subflow_push_pending(sk, ssk, &info); - 1585 [ + + ]: 53804 : if (ret <= 0) - 1586 : 19893 : keep_pushing = false; - 1587 : 53804 : copied += ret; + 1582 [ + + + + ]: 90233 : if (READ_ONCE(subflow->scheduled)) { + 1583 : 85530 : mptcp_subflow_set_scheduled(subflow, false); + 1584 : 85530 : ret = __subflow_push_pending(sk, ssk, &info); + 1585 [ + + ]: 85530 : if (ret <= 0) + 1586 : 34404 : keep_pushing = false; + 1587 : 85530 : copied += ret; 1588 : : } 1589 : : - 1590 [ + + ]: 154129 : mptcp_for_each_subflow(msk, subflow) { - 1591 [ + + + + ]: 95886 : if (READ_ONCE(subflow->scheduled)) { - 1592 [ + - ]: 4439 : xmit_ssk = mptcp_subflow_tcp_sock(subflow); - 1593 [ + - ]: 4439 : if (xmit_ssk != ssk) { - 1594 : 4439 : mptcp_subflow_delegate(subflow, + 1590 [ + + ]: 225810 : mptcp_for_each_subflow(msk, subflow) { + 1591 [ + + + + ]: 135577 : if (READ_ONCE(subflow->scheduled)) { + 1592 [ + - ]: 4703 : xmit_ssk = mptcp_subflow_tcp_sock(subflow); + 1593 [ + - ]: 4703 : if (xmit_ssk != ssk) { + 1594 : 4703 : mptcp_subflow_delegate(subflow, 1595 : : MPTCP_DELEGATE_SEND); - 1596 : 4439 : keep_pushing = false; + 1596 : 4703 : keep_pushing = false; 1597 : : } 1598 : : } 1599 : : } 1600 : : } 1601 : : - 1602 : 28225 : out: + 1602 : 43333 : out: 1603 : : /* __mptcp_alloc_tx_skb could have released some wmem and we are 1604 : : * not going to flush it via release_sock() 1605 : : */ - 1606 [ + + ]: 74060 : if (copied) { - 1607 [ - + ]: 30232 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + 1606 [ + + ]: 90624 : if (copied) { + 1607 [ - + ]: 47453 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, 1608 : : info.size_goal); - 1609 [ + + ]: 30232 : if (!mptcp_rtx_timer_pending(sk)) - 1610 : 70 : mptcp_reset_rtx_timer(sk); + 1609 [ + + ]: 47453 : if (!mptcp_rtx_timer_pending(sk)) + 1610 : 69 : mptcp_reset_rtx_timer(sk); 1611 : : - 1612 [ + + + + ]: 30232 : if (msk->snd_data_fin_enable && - 1613 [ + + ]: 4604 : msk->snd_nxt + 1 == msk->write_seq) - 1614 : 263 : mptcp_schedule_work(sk); + 1612 [ + + + + ]: 47453 : if (msk->snd_data_fin_enable && + 1613 [ + + ]: 5307 : msk->snd_nxt + 1 == msk->write_seq) + 1614 : 258 : mptcp_schedule_work(sk); 1615 : : } - 1616 : 74060 : } + 1616 : 90624 : } 1617 : : 1618 : : static int mptcp_disconnect(struct sock *sk, int flags); 1619 : : @@ -1759,13 +1759,13 @@ 1675 : 82 : return ret; 1676 : : } 1677 : : - 1678 : 606383 : static int do_copy_data_nocache(struct sock *sk, int copy, + 1678 : 682253 : static int do_copy_data_nocache(struct sock *sk, int copy, 1679 : : struct iov_iter *from, char *to) 1680 : : { - 1681 [ - + ]: 606383 : if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { + 1681 [ - + ]: 682253 : if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { 1682 [ # # ]: 0 : if (!copy_from_iter_full_nocache(to, copy, from)) 1683 : 0 : return -EFAULT; - 1684 [ - + ]: 606383 : } else if (!copy_from_iter_full(to, copy, from)) { + 1684 [ - + ]: 682253 : } else if (!copy_from_iter_full(to, copy, from)) { 1685 : 0 : return -EFAULT; 1686 : : } 1687 : : return 0; @@ -1776,16 +1776,16 @@ 1692 : : * Called under the msk socket lock, so we can avoid a bunch of ONCE 1693 : : * annotations. 1694 : : */ - 1695 : 608897 : static u32 mptcp_send_limit(const struct sock *sk) + 1695 : 684449 : static u32 mptcp_send_limit(const struct sock *sk) 1696 : : { - 1697 [ - + ]: 608897 : const struct mptcp_sock *msk = mptcp_sk(sk); - 1698 : 608897 : u32 limit, not_sent; + 1697 [ - + ]: 684449 : const struct mptcp_sock *msk = mptcp_sk(sk); + 1698 : 684449 : u32 limit, not_sent; 1699 : : - 1700 [ + + ]: 608897 : if (sk->sk_wmem_queued >= READ_ONCE(sk->sk_sndbuf)) + 1700 [ + + ]: 684449 : if (sk->sk_wmem_queued >= READ_ONCE(sk->sk_sndbuf)) 1701 : : return 0; 1702 : : - 1703 : 606383 : limit = mptcp_notsent_lowat(sk); - 1704 [ - + ]: 606383 : if (limit == UINT_MAX) + 1703 : 682253 : limit = mptcp_notsent_lowat(sk); + 1704 [ - + ]: 682253 : if (limit == UINT_MAX) 1705 : : return UINT_MAX; 1706 : : 1707 : 0 : not_sent = msk->write_seq - msk->snd_nxt; @@ -1795,20 +1795,20 @@ 1711 : 0 : return limit - not_sent; 1712 : : } 1713 : : - 1714 : 509914 : static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + 1714 : 576310 : static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 1715 : : { - 1716 [ - + ]: 509914 : struct mptcp_sock *msk = mptcp_sk(sk); - 1717 : 509914 : struct page_frag *pfrag; - 1718 : 509914 : size_t copied = 0; - 1719 : 509914 : int ret = 0; - 1720 : 509914 : long timeo; + 1716 [ - + ]: 576310 : struct mptcp_sock *msk = mptcp_sk(sk); + 1717 : 576310 : struct page_frag *pfrag; + 1718 : 576310 : size_t copied = 0; + 1719 : 576310 : int ret = 0; + 1720 : 576310 : long timeo; 1721 : : 1722 : : /* silently ignore everything else */ - 1723 : 509914 : msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_FASTOPEN; + 1723 : 576310 : msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_FASTOPEN; 1724 : : - 1725 : 509914 : lock_sock(sk); + 1725 : 576310 : lock_sock(sk); 1726 : : - 1727 [ + + + + ]: 509914 : if (unlikely(inet_test_bit(DEFER_CONNECT, sk) || + 1727 [ + + + + ]: 576310 : if (unlikely(inet_test_bit(DEFER_CONNECT, sk) || 1728 : : msg->msg_flags & MSG_FASTOPEN)) { 1729 : 88 : int copied_syn = 0; 1730 : : @@ -1820,338 +1820,338 @@ 1736 : 24 : goto do_error; 1737 : : } 1738 : : - 1739 [ + + ]: 509848 : timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); + 1739 [ + + ]: 576244 : timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); 1740 : : - 1741 [ + + + + ]: 509848 : if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { - 1742 : 57 : ret = sk_stream_wait_connect(sk, &timeo); - 1743 [ + - ]: 57 : if (ret) - 1744 : 57 : goto do_error; + 1741 [ + + + + ]: 576244 : if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { + 1742 : 54 : ret = sk_stream_wait_connect(sk, &timeo); + 1743 [ + - ]: 54 : if (ret) + 1744 : 54 : goto do_error; 1745 : : } 1746 : : - 1747 : 509791 : ret = -EPIPE; - 1748 [ + - - + ]: 509791 : if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) + 1747 : 576190 : ret = -EPIPE; + 1748 [ + - - + ]: 576190 : if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) 1749 : 0 : goto do_error; 1750 : : - 1751 [ + - ]: 509791 : pfrag = sk_page_frag(sk); + 1751 [ + - ]: 576190 : pfrag = sk_page_frag(sk); 1752 : : - 1753 [ + + ]: 1118688 : while (msg_data_left(msg)) { - 1754 : 608897 : int total_ts, frag_truesize = 0; - 1755 : 608897 : struct mptcp_data_frag *dfrag; - 1756 : 608897 : bool dfrag_collapsed; - 1757 : 608897 : size_t psize, offset; - 1758 : 608897 : u32 copy_limit; + 1753 [ + + ]: 1260639 : while (msg_data_left(msg)) { + 1754 : 684449 : int total_ts, frag_truesize = 0; + 1755 : 684449 : struct mptcp_data_frag *dfrag; + 1756 : 684449 : bool dfrag_collapsed; + 1757 : 684449 : size_t psize, offset; + 1758 : 684449 : u32 copy_limit; 1759 : : 1760 : : /* ensure fitting the notsent_lowat() constraint */ - 1761 : 608897 : copy_limit = mptcp_send_limit(sk); - 1762 [ + + ]: 608897 : if (!copy_limit) - 1763 : 2514 : goto wait_for_memory; + 1761 : 684449 : copy_limit = mptcp_send_limit(sk); + 1762 [ + + ]: 684449 : if (!copy_limit) + 1763 : 2196 : goto wait_for_memory; 1764 : : 1765 : : /* reuse tail pfrag, if possible, or carve a new one from the 1766 : : * page allocator 1767 : : */ - 1768 : 606383 : dfrag = mptcp_pending_tail(sk); - 1769 : 606383 : dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); - 1770 [ + + ]: 606383 : if (!dfrag_collapsed) { - 1771 [ - + ]: 486126 : if (!mptcp_page_frag_refill(sk, pfrag)) + 1768 : 682253 : dfrag = mptcp_pending_tail(sk); + 1769 : 682253 : dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); + 1770 [ + + ]: 682253 : if (!dfrag_collapsed) { + 1771 [ - + ]: 501769 : if (!mptcp_page_frag_refill(sk, pfrag)) 1772 : 0 : goto wait_for_memory; 1773 : : - 1774 : 486126 : dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); - 1775 : 486126 : frag_truesize = dfrag->overhead; + 1774 : 501769 : dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); + 1775 : 501769 : frag_truesize = dfrag->overhead; 1776 : : } 1777 : : 1778 : : /* we do not bound vs wspace, to allow a single packet. 1779 : : * memory accounting will prevent execessive memory usage 1780 : : * anyway 1781 : : */ - 1782 : 606383 : offset = dfrag->offset + dfrag->data_len; - 1783 : 606383 : psize = pfrag->size - offset; - 1784 : 606383 : psize = min_t(size_t, psize, msg_data_left(msg)); - 1785 : 606383 : psize = min_t(size_t, psize, copy_limit); - 1786 : 606383 : total_ts = psize + frag_truesize; + 1782 : 682253 : offset = dfrag->offset + dfrag->data_len; + 1783 : 682253 : psize = pfrag->size - offset; + 1784 : 682253 : psize = min_t(size_t, psize, msg_data_left(msg)); + 1785 : 682253 : psize = min_t(size_t, psize, copy_limit); + 1786 : 682253 : total_ts = psize + frag_truesize; 1787 : : - 1788 [ - + ]: 606383 : if (!sk_wmem_schedule(sk, total_ts)) + 1788 [ - + ]: 682253 : if (!sk_wmem_schedule(sk, total_ts)) 1789 : 0 : goto wait_for_memory; 1790 : : - 1791 : 867951 : ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, - 1792 : 606383 : page_address(dfrag->page) + offset); - 1793 [ - + ]: 606383 : if (ret) + 1791 : 943996 : ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, + 1792 : 682253 : page_address(dfrag->page) + offset); + 1793 [ - + ]: 682253 : if (ret) 1794 : 0 : goto do_error; 1795 : : 1796 : : /* data successfully copied into the write queue */ - 1797 [ + + ]: 606383 : sk_forward_alloc_add(sk, -total_ts); - 1798 : 606383 : copied += psize; - 1799 : 606383 : dfrag->data_len += psize; - 1800 : 606383 : frag_truesize += psize; - 1801 : 606383 : pfrag->offset += frag_truesize; - 1802 : 606383 : WRITE_ONCE(msk->write_seq, msk->write_seq + psize); + 1797 [ + + ]: 682253 : sk_forward_alloc_add(sk, -total_ts); + 1798 : 682253 : copied += psize; + 1799 : 682253 : dfrag->data_len += psize; + 1800 : 682253 : frag_truesize += psize; + 1801 : 682253 : pfrag->offset += frag_truesize; + 1802 : 682253 : WRITE_ONCE(msk->write_seq, msk->write_seq + psize); 1803 : : 1804 : : /* charge data on mptcp pending queue to the msk socket 1805 : : * Note: we charge such data both to sk and ssk 1806 : : */ - 1807 [ + + ]: 606383 : sk_wmem_queued_add(sk, frag_truesize); - 1808 [ + + ]: 606383 : if (!dfrag_collapsed) { - 1809 : 486126 : get_page(dfrag->page); - 1810 [ + + ]: 486126 : list_add_tail(&dfrag->list, &msk->rtx_queue); - 1811 [ + + ]: 486126 : if (!msk->first_pending) - 1812 : 391063 : WRITE_ONCE(msk->first_pending, dfrag); + 1807 [ + + ]: 682253 : sk_wmem_queued_add(sk, frag_truesize); + 1808 [ + + ]: 682253 : if (!dfrag_collapsed) { + 1809 : 501769 : get_page(dfrag->page); + 1810 [ + + ]: 501769 : list_add_tail(&dfrag->list, &msk->rtx_queue); + 1811 [ + + ]: 501769 : if (!msk->first_pending) + 1812 : 396933 : WRITE_ONCE(msk->first_pending, dfrag); 1813 : : } - 1814 [ - + ]: 606383 : pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d\n", msk, + 1814 [ - + ]: 682253 : pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d\n", msk, 1815 : : dfrag->data_seq, dfrag->data_len, dfrag->already_sent, 1816 : : !dfrag_collapsed); 1817 : : - 1818 : 606383 : continue; + 1818 : 682253 : continue; 1819 : : - 1820 : 2514 : wait_for_memory: - 1821 : 2514 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - 1822 : 2514 : __mptcp_push_pending(sk, msg->msg_flags); - 1823 : 2514 : ret = sk_stream_wait_memory(sk, &timeo); - 1824 [ - + ]: 2514 : if (ret) + 1820 : 2196 : wait_for_memory: + 1821 : 2196 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + 1822 : 2196 : __mptcp_push_pending(sk, msg->msg_flags); + 1823 : 2196 : ret = sk_stream_wait_memory(sk, &timeo); + 1824 [ - + ]: 2196 : if (ret) 1825 : 0 : goto do_error; 1826 : : } 1827 : : - 1828 [ + + ]: 509791 : if (copied) - 1829 : 509776 : __mptcp_push_pending(sk, msg->msg_flags); + 1828 [ + + ]: 576190 : if (copied) + 1829 : 576177 : __mptcp_push_pending(sk, msg->msg_flags); 1830 : : - 1831 : 15 : out: - 1832 : 509914 : release_sock(sk); - 1833 : 509914 : return copied; + 1831 : 13 : out: + 1832 : 576310 : release_sock(sk); + 1833 : 576310 : return copied; 1834 : : - 1835 : 81 : do_error: - 1836 [ - + ]: 81 : if (copied) + 1835 : 78 : do_error: + 1836 [ - + ]: 78 : if (copied) 1837 : 0 : goto out; 1838 : : - 1839 : 81 : copied = sk_stream_error(sk, msg->msg_flags, ret); - 1840 : 81 : goto out; + 1839 : 78 : copied = sk_stream_error(sk, msg->msg_flags, ret); + 1840 : 78 : goto out; 1841 : : } 1842 : : 1843 : : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied); 1844 : : - 1845 : 699965 : static int __mptcp_recvmsg_mskq(struct sock *sk, + 1845 : 752848 : static int __mptcp_recvmsg_mskq(struct sock *sk, 1846 : : struct msghdr *msg, 1847 : : size_t len, int flags, 1848 : : struct scm_timestamping_internal *tss, 1849 : : int *cmsg_flags) 1850 : : { - 1851 [ - + ]: 699965 : struct mptcp_sock *msk = mptcp_sk(sk); - 1852 : 699965 : struct sk_buff *skb, *tmp; - 1853 : 699965 : int copied = 0; + 1851 [ - + ]: 752848 : struct mptcp_sock *msk = mptcp_sk(sk); + 1852 : 752848 : struct sk_buff *skb, *tmp; + 1853 : 752848 : int copied = 0; 1854 : : - 1855 [ + + ]: 934715 : skb_queue_walk_safe(&sk->sk_receive_queue, skb, tmp) { - 1856 : 745253 : u32 offset = MPTCP_SKB_CB(skb)->offset; - 1857 : 745253 : u32 data_len = skb->len - offset; - 1858 : 745253 : u32 count = min_t(size_t, len - copied, data_len); - 1859 : 745253 : int err; + 1855 [ + + ]: 989576 : skb_queue_walk_safe(&sk->sk_receive_queue, skb, tmp) { + 1856 : 815861 : u32 offset = MPTCP_SKB_CB(skb)->offset; + 1857 : 815861 : u32 data_len = skb->len - offset; + 1858 : 815861 : u32 count = min_t(size_t, len - copied, data_len); + 1859 : 815861 : int err; 1860 : : - 1861 [ + - ]: 745253 : if (!(flags & MSG_TRUNC)) { - 1862 : 745253 : err = skb_copy_datagram_msg(skb, offset, msg, count); - 1863 [ - + ]: 745253 : if (unlikely(err < 0)) { + 1861 [ + - ]: 815861 : if (!(flags & MSG_TRUNC)) { + 1862 : 815861 : err = skb_copy_datagram_msg(skb, offset, msg, count); + 1863 [ - + ]: 815861 : if (unlikely(err < 0)) { 1864 [ # # ]: 0 : if (!copied) 1865 : : return err; 1866 : : break; 1867 : : } 1868 : : } 1869 : : - 1870 [ + + ]: 745253 : if (MPTCP_SKB_CB(skb)->has_rxtstamp) { - 1871 : 599 : tcp_update_recv_tstamps(skb, tss); - 1872 : 599 : *cmsg_flags |= MPTCP_CMSG_TS; + 1870 [ + + ]: 815861 : if (MPTCP_SKB_CB(skb)->has_rxtstamp) { + 1871 : 598 : tcp_update_recv_tstamps(skb, tss); + 1872 : 598 : *cmsg_flags |= MPTCP_CMSG_TS; 1873 : : } 1874 : : - 1875 : 745253 : copied += count; + 1875 : 815861 : copied += count; 1876 : : - 1877 [ + + ]: 745253 : if (count < data_len) { - 1878 [ + + ]: 454815 : if (!(flags & MSG_PEEK)) { - 1879 : 437064 : MPTCP_SKB_CB(skb)->offset += count; - 1880 : 437064 : MPTCP_SKB_CB(skb)->map_seq += count; - 1881 : 437064 : msk->bytes_consumed += count; + 1877 [ + + ]: 815861 : if (count < data_len) { + 1878 [ + + ]: 518350 : if (!(flags & MSG_PEEK)) { + 1879 : 492533 : MPTCP_SKB_CB(skb)->offset += count; + 1880 : 492533 : MPTCP_SKB_CB(skb)->map_seq += count; + 1881 : 492533 : msk->bytes_consumed += count; 1882 : : } 1883 : : break; 1884 : : } 1885 : : - 1886 [ + + ]: 290438 : if (!(flags & MSG_PEEK)) { + 1886 [ + + ]: 297511 : if (!(flags & MSG_PEEK)) { 1887 : : /* avoid the indirect call, we know the destructor is sock_wfree */ - 1888 : 288177 : skb->destructor = NULL; - 1889 : 288177 : atomic_sub(skb->truesize, &sk->sk_rmem_alloc); - 1890 : 288177 : sk_mem_uncharge(sk, skb->truesize); - 1891 : 288177 : __skb_unlink(skb, &sk->sk_receive_queue); - 1892 : 288177 : __kfree_skb(skb); - 1893 : 288177 : msk->bytes_consumed += count; + 1888 : 294532 : skb->destructor = NULL; + 1889 : 294532 : atomic_sub(skb->truesize, &sk->sk_rmem_alloc); + 1890 : 294532 : sk_mem_uncharge(sk, skb->truesize); + 1891 : 294532 : __skb_unlink(skb, &sk->sk_receive_queue); + 1892 : 294532 : __kfree_skb(skb); + 1893 : 294532 : msk->bytes_consumed += count; 1894 : : } 1895 : : - 1896 [ + + ]: 290438 : if (copied >= len) + 1896 [ + + ]: 297511 : if (copied >= len) 1897 : : break; 1898 : : } 1899 : : - 1900 : 699965 : mptcp_rcv_space_adjust(msk, copied); - 1901 : 699965 : return copied; + 1900 : 752848 : mptcp_rcv_space_adjust(msk, copied); + 1901 : 752848 : return copied; 1902 : : } 1903 : : 1904 : : /* receive buffer autotuning. See tcp_rcv_space_adjust for more information. 1905 : : * 1906 : : * Only difference: Use highest rtt estimate of the subflows in use. 1907 : : */ - 1908 : 699965 : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) + 1908 : 752848 : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) 1909 : : { - 1910 : 699965 : struct mptcp_subflow_context *subflow; - 1911 : 699965 : struct sock *sk = (struct sock *)msk; - 1912 : 699965 : u8 scaling_ratio = U8_MAX; - 1913 : 699965 : u32 time, advmss = 1; - 1914 : 699965 : u64 rtt_us, mstamp; + 1910 : 752848 : struct mptcp_subflow_context *subflow; + 1911 : 752848 : struct sock *sk = (struct sock *)msk; + 1912 : 752848 : u8 scaling_ratio = U8_MAX; + 1913 : 752848 : u32 time, advmss = 1; + 1914 : 752848 : u64 rtt_us, mstamp; 1915 : : - 1916 : 699965 : msk_owned_by_me(msk); + 1916 : 752848 : msk_owned_by_me(msk); 1917 : : - 1918 [ + + ]: 699965 : if (copied <= 0) + 1918 [ + + ]: 752848 : if (copied <= 0) 1919 : : return; 1920 : : - 1921 [ - + ]: 672228 : if (!msk->rcvspace_init) + 1921 [ - + ]: 730882 : if (!msk->rcvspace_init) 1922 : 0 : mptcp_rcv_space_init(msk, msk->first); 1923 : : - 1924 : 672228 : msk->rcvq_space.copied += copied; + 1924 : 730882 : msk->rcvq_space.copied += copied; 1925 : : - 1926 [ + + ]: 672228 : mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); - 1927 [ + + ]: 672228 : time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); + 1926 [ + + ]: 730882 : mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); + 1927 [ + + ]: 730882 : time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); 1928 : : - 1929 : 672228 : rtt_us = msk->rcvq_space.rtt_us; - 1930 [ + + + + ]: 672228 : if (rtt_us && time < (rtt_us >> 3)) + 1929 : 730882 : rtt_us = msk->rcvq_space.rtt_us; + 1930 [ + + + + ]: 730882 : if (rtt_us && time < (rtt_us >> 3)) 1931 : : return; 1932 : : - 1933 : 81514 : rtt_us = 0; - 1934 [ + + ]: 184248 : mptcp_for_each_subflow(msk, subflow) { - 1935 : 102734 : const struct tcp_sock *tp; - 1936 : 102734 : u64 sf_rtt_us; - 1937 : 102734 : u32 sf_advmss; + 1933 : 111626 : rtt_us = 0; + 1934 [ + + ]: 245269 : mptcp_for_each_subflow(msk, subflow) { + 1935 : 133643 : const struct tcp_sock *tp; + 1936 : 133643 : u64 sf_rtt_us; + 1937 : 133643 : u32 sf_advmss; 1938 : : - 1939 [ - + ]: 102734 : tp = tcp_sk(mptcp_subflow_tcp_sock(subflow)); + 1939 [ - + ]: 133643 : tp = tcp_sk(mptcp_subflow_tcp_sock(subflow)); 1940 : : - 1941 : 102734 : sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us); - 1942 : 102734 : sf_advmss = READ_ONCE(tp->advmss); + 1941 : 133643 : sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us); + 1942 : 133643 : sf_advmss = READ_ONCE(tp->advmss); 1943 : : - 1944 : 102734 : rtt_us = max(sf_rtt_us, rtt_us); - 1945 : 102734 : advmss = max(sf_advmss, advmss); - 1946 : 102734 : scaling_ratio = min(tp->scaling_ratio, scaling_ratio); + 1944 : 133643 : rtt_us = max(sf_rtt_us, rtt_us); + 1945 : 133643 : advmss = max(sf_advmss, advmss); + 1946 : 133643 : scaling_ratio = min(tp->scaling_ratio, scaling_ratio); 1947 : : } 1948 : : - 1949 : 81514 : msk->rcvq_space.rtt_us = rtt_us; - 1950 : 81514 : msk->scaling_ratio = scaling_ratio; - 1951 [ + + + + ]: 81514 : if (time < (rtt_us >> 3) || rtt_us == 0) + 1949 : 111626 : msk->rcvq_space.rtt_us = rtt_us; + 1950 : 111626 : msk->scaling_ratio = scaling_ratio; + 1951 [ + + + + ]: 111626 : if (time < (rtt_us >> 3) || rtt_us == 0) 1952 : : return; 1953 : : - 1954 [ + + ]: 68613 : if (msk->rcvq_space.copied <= msk->rcvq_space.space) - 1955 : 65689 : goto new_measure; + 1954 [ + + ]: 98648 : if (msk->rcvq_space.copied <= msk->rcvq_space.space) + 1955 : 95895 : goto new_measure; 1956 : : - 1957 [ + - ]: 2924 : if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && - 1958 [ + - ]: 2924 : !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { - 1959 : 2924 : u64 rcvwin, grow; - 1960 : 2924 : int rcvbuf; + 1957 [ + - ]: 2753 : if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && + 1958 [ + - ]: 2753 : !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { + 1959 : 2753 : u64 rcvwin, grow; + 1960 : 2753 : int rcvbuf; 1961 : : - 1962 : 2924 : rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss; + 1962 : 2753 : rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss; 1963 : : - 1964 : 2924 : grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space); + 1964 : 2753 : grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space); 1965 : : - 1966 : 2924 : do_div(grow, msk->rcvq_space.space); - 1967 : 2924 : rcvwin += (grow << 1); + 1966 : 2753 : do_div(grow, msk->rcvq_space.space); + 1967 : 2753 : rcvwin += (grow << 1); 1968 : : - 1969 [ + + ]: 2924 : rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin), + 1969 [ + + ]: 2753 : rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin), 1970 : : READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 1971 : : - 1972 [ + + ]: 2924 : if (rcvbuf > sk->sk_rcvbuf) { - 1973 : 1315 : u32 window_clamp; + 1972 [ + + ]: 2753 : if (rcvbuf > sk->sk_rcvbuf) { + 1973 : 1071 : u32 window_clamp; 1974 : : - 1975 : 1315 : window_clamp = mptcp_win_from_space(sk, rcvbuf); - 1976 : 1315 : WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); + 1975 : 1071 : window_clamp = mptcp_win_from_space(sk, rcvbuf); + 1976 : 1071 : WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); 1977 : : 1978 : : /* Make subflows follow along. If we do not do this, we 1979 : : * get drops at subflow level if skbs can't be moved to 1980 : : * the mptcp rx queue fast enough (announced rcv_win can 1981 : : * exceed ssk->sk_rcvbuf). 1982 : : */ - 1983 [ + + ]: 2770 : mptcp_for_each_subflow(msk, subflow) { - 1984 : 1455 : struct sock *ssk; - 1985 : 1455 : bool slow; + 1983 [ + + ]: 2281 : mptcp_for_each_subflow(msk, subflow) { + 1984 : 1210 : struct sock *ssk; + 1985 : 1210 : bool slow; 1986 : : - 1987 : 1455 : ssk = mptcp_subflow_tcp_sock(subflow); - 1988 : 1455 : slow = lock_sock_fast(ssk); - 1989 : 1455 : WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); - 1990 [ - + ]: 1455 : WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); - 1991 [ + + ]: 1455 : if (tcp_can_send_ack(ssk)) - 1992 : 1452 : tcp_cleanup_rbuf(ssk, 1); - 1993 : 1455 : unlock_sock_fast(ssk, slow); + 1987 : 1210 : ssk = mptcp_subflow_tcp_sock(subflow); + 1988 : 1210 : slow = lock_sock_fast(ssk); + 1989 : 1210 : WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); + 1990 [ - + ]: 1210 : WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); + 1991 [ + + ]: 1210 : if (tcp_can_send_ack(ssk)) + 1992 : 1207 : tcp_cleanup_rbuf(ssk, 1); + 1993 : 1210 : unlock_sock_fast(ssk, slow); 1994 : : } 1995 : : } 1996 : : } 1997 : : - 1998 : 2924 : msk->rcvq_space.space = msk->rcvq_space.copied; - 1999 : 68613 : new_measure: - 2000 : 68613 : msk->rcvq_space.copied = 0; - 2001 : 68613 : msk->rcvq_space.time = mstamp; + 1998 : 2753 : msk->rcvq_space.space = msk->rcvq_space.copied; + 1999 : 98648 : new_measure: + 2000 : 98648 : msk->rcvq_space.copied = 0; + 2001 : 98648 : msk->rcvq_space.time = mstamp; 2002 : : } 2003 : : 2004 : : static struct mptcp_subflow_context * - 2005 : 254419 : __mptcp_first_ready_from(struct mptcp_sock *msk, + 2005 : 206105 : __mptcp_first_ready_from(struct mptcp_sock *msk, 2006 : : struct mptcp_subflow_context *subflow) 2007 : : { - 2008 : 254419 : struct mptcp_subflow_context *start_subflow = subflow; + 2008 : 206105 : struct mptcp_subflow_context *start_subflow = subflow; 2009 : : - 2010 [ + + + + ]: 647248 : while (!READ_ONCE(subflow->data_avail)) { - 2011 [ + + ]: 570748 : subflow = mptcp_next_subflow(msk, subflow); - 2012 [ + + ]: 570748 : if (subflow == start_subflow) + 2010 [ + + + + ]: 619270 : while (!READ_ONCE(subflow->data_avail)) { + 2011 [ + + ]: 544386 : subflow = mptcp_next_subflow(msk, subflow); + 2012 [ + + ]: 544386 : if (subflow == start_subflow) 2013 : : return NULL; 2014 : : } 2015 : : return subflow; 2016 : : } 2017 : : - 2018 : 299890 : static bool __mptcp_move_skbs(struct sock *sk) + 2018 : 289067 : static bool __mptcp_move_skbs(struct sock *sk) 2019 : : { - 2020 : 299890 : struct mptcp_subflow_context *subflow; - 2021 [ - + ]: 299890 : struct mptcp_sock *msk = mptcp_sk(sk); - 2022 : 299890 : bool ret = false; + 2020 : 289067 : struct mptcp_subflow_context *subflow; + 2021 [ - + ]: 289067 : struct mptcp_sock *msk = mptcp_sk(sk); + 2022 : 289067 : bool ret = false; 2023 : : - 2024 [ + + ]: 299890 : if (list_empty(&msk->conn_list)) + 2024 [ + + ]: 289067 : if (list_empty(&msk->conn_list)) 2025 : : return false; 2026 : : 2027 : : /* verify we can move any data from the subflow, eventually updating */ - 2028 [ + - ]: 299882 : if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) - 2029 [ + + ]: 863732 : mptcp_for_each_subflow(msk, subflow) - 2030 [ + + ]: 563850 : __mptcp_rcvbuf_update(sk, subflow->tcp_sock); + 2028 [ + - ]: 289060 : if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) + 2029 [ + + ]: 828725 : mptcp_for_each_subflow(msk, subflow) + 2030 [ + + ]: 539665 : __mptcp_rcvbuf_update(sk, subflow->tcp_sock); 2031 : : - 2032 : 299882 : subflow = list_first_entry(&msk->conn_list, + 2032 : 289060 : subflow = list_first_entry(&msk->conn_list, 2033 : : struct mptcp_subflow_context, node); - 2034 : 376382 : for (;;) { - 2035 : 376382 : struct sock *ssk; - 2036 : 376382 : bool slowpath; + 2034 : 363944 : for (;;) { + 2035 : 363944 : struct sock *ssk; + 2036 : 363944 : bool slowpath; 2037 : : 2038 : : /* 2039 : : * As an optimization avoid traversing the subflows list 2040 : : * and ev. acquiring the subflow socket lock before baling out 2041 : : */ - 2042 [ + + ]: 376382 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) + 2042 [ + + ]: 363944 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) 2043 : : break; 2044 : : - 2045 : 305414 : subflow = __mptcp_first_ready_from(msk, subflow); - 2046 [ + + ]: 374608 : if (!subflow) + 2045 : 258151 : subflow = __mptcp_first_ready_from(msk, subflow); + 2046 [ + + ]: 358932 : if (!subflow) 2047 : : break; 2048 : : - 2049 : 76500 : ssk = mptcp_subflow_tcp_sock(subflow); - 2050 : 76500 : slowpath = lock_sock_fast(ssk); - 2051 [ + + + + ]: 76500 : ret = __mptcp_move_skbs_from_subflow(msk, ssk) || ret; - 2052 [ - + ]: 76500 : if (unlikely(ssk->sk_err)) - 2053 : 0 : __mptcp_error_report(sk); - 2054 : 76500 : unlock_sock_fast(ssk, slowpath); + 2049 : 74884 : ssk = mptcp_subflow_tcp_sock(subflow); + 2050 : 74884 : slowpath = lock_sock_fast(ssk); + 2051 [ + + + + ]: 74884 : ret = __mptcp_move_skbs_from_subflow(msk, ssk) || ret; + 2052 [ + + ]: 74884 : if (unlikely(ssk->sk_err)) + 2053 : 1 : __mptcp_error_report(sk); + 2054 : 74884 : unlock_sock_fast(ssk, slowpath); 2055 : : - 2056 [ + + ]: 76500 : subflow = mptcp_next_subflow(msk, subflow); + 2056 [ + + ]: 74884 : subflow = mptcp_next_subflow(msk, subflow); 2057 : : } 2058 : : - 2059 : 299882 : __mptcp_ofo_queue(msk); - 2060 [ + + ]: 299882 : if (ret) - 2061 : 61644 : mptcp_check_data_fin((struct sock *)msk); + 2059 : 289060 : __mptcp_ofo_queue(msk); + 2060 [ + + ]: 289060 : if (ret) + 2061 : 60879 : mptcp_check_data_fin((struct sock *)msk); 2062 : : return ret; 2063 : : } 2064 : : - 2065 : 433 : static unsigned int mptcp_inq_hint(const struct sock *sk) + 2065 : 432 : static unsigned int mptcp_inq_hint(const struct sock *sk) 2066 : : { - 2067 [ - + ]: 433 : const struct mptcp_sock *msk = mptcp_sk(sk); - 2068 : 433 : const struct sk_buff *skb; + 2067 [ - + ]: 432 : const struct mptcp_sock *msk = mptcp_sk(sk); + 2068 : 432 : const struct sk_buff *skb; 2069 : : - 2070 [ - + ]: 433 : skb = skb_peek(&sk->sk_receive_queue); + 2070 [ - + ]: 432 : skb = skb_peek(&sk->sk_receive_queue); 2071 [ # # ]: 0 : if (skb) { 2072 : 0 : u64 hint_val = READ_ONCE(msk->ack_seq) - MPTCP_SKB_CB(skb)->map_seq; 2073 : : @@ -2161,61 +2161,61 @@ 2077 : 0 : return (unsigned int)hint_val; 2078 : : } 2079 : : - 2080 [ + + + + ]: 433 : if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN)) + 2080 [ + + + + ]: 432 : if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN)) 2081 : 8 : return 1; 2082 : : 2083 : : return 0; 2084 : : } 2085 : : - 2086 : 667233 : static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, + 2086 : 728196 : static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 2087 : : int flags, int *addr_len) 2088 : : { - 2089 [ - + ]: 667233 : struct mptcp_sock *msk = mptcp_sk(sk); - 2090 : 667233 : struct scm_timestamping_internal tss; - 2091 : 667233 : int copied = 0, cmsg_flags = 0; - 2092 : 667233 : int target; - 2093 : 667233 : long timeo; + 2089 [ - + ]: 728196 : struct mptcp_sock *msk = mptcp_sk(sk); + 2090 : 728196 : struct scm_timestamping_internal tss; + 2091 : 728196 : int copied = 0, cmsg_flags = 0; + 2092 : 728196 : int target; + 2093 : 728196 : long timeo; 2094 : : 2095 : : /* MSG_ERRQUEUE is really a no-op till we support IP_RECVERR */ - 2096 [ - + ]: 667233 : if (unlikely(flags & MSG_ERRQUEUE)) + 2096 [ - + ]: 728196 : if (unlikely(flags & MSG_ERRQUEUE)) 2097 : 0 : return inet_recv_error(sk, msg, len, addr_len); 2098 : : - 2099 : 667233 : lock_sock(sk); - 2100 [ - + ]: 667233 : if (unlikely(sk->sk_state == TCP_LISTEN)) { + 2099 : 728196 : lock_sock(sk); + 2100 [ - + ]: 728196 : if (unlikely(sk->sk_state == TCP_LISTEN)) { 2101 : 0 : copied = -ENOTCONN; 2102 : 0 : goto out_err; 2103 : : } 2104 : : - 2105 [ + + ]: 667233 : timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); + 2105 [ + + ]: 728196 : timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 2106 : : - 2107 : 667233 : len = min_t(size_t, len, INT_MAX); - 2108 [ + - ]: 667233 : target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); + 2107 : 728196 : len = min_t(size_t, len, INT_MAX); + 2108 [ + - ]: 728196 : target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 2109 : : - 2110 [ + + ]: 667233 : if (unlikely(msk->recvmsg_inq)) - 2111 : 433 : cmsg_flags = MPTCP_CMSG_INQ; + 2110 [ + + ]: 728196 : if (unlikely(msk->recvmsg_inq)) + 2111 : 432 : cmsg_flags = MPTCP_CMSG_INQ; 2112 : : - 2113 [ + + ]: 700431 : while (copied < len) { - 2114 : 699965 : int err, bytes_read; + 2113 [ + + ]: 753346 : while (copied < len) { + 2114 : 752848 : int err, bytes_read; 2115 : : - 2116 : 699965 : bytes_read = __mptcp_recvmsg_mskq(sk, msg, len - copied, flags, &tss, &cmsg_flags); - 2117 [ - + ]: 699965 : if (unlikely(bytes_read < 0)) { + 2116 : 752848 : bytes_read = __mptcp_recvmsg_mskq(sk, msg, len - copied, flags, &tss, &cmsg_flags); + 2117 [ - + ]: 752848 : if (unlikely(bytes_read < 0)) { 2118 [ # # ]: 0 : if (!copied) 2119 : 0 : copied = bytes_read; 2120 : 0 : goto out_err; 2121 : : } 2122 : : - 2123 : 699965 : copied += bytes_read; + 2123 : 752848 : copied += bytes_read; 2124 : : - 2125 [ + + + + ]: 699965 : if (skb_queue_empty(&sk->sk_receive_queue) && __mptcp_move_skbs(sk)) - 2126 : 7009 : continue; + 2125 [ + + + + ]: 752848 : if (skb_queue_empty(&sk->sk_receive_queue) && __mptcp_move_skbs(sk)) + 2126 : 4705 : continue; 2127 : : 2128 : : /* only the MPTCP socket status is relevant here. The exit 2129 : : * conditions mirror closely tcp_recvmsg() 2130 : : */ - 2131 [ + + ]: 692956 : if (copied >= target) + 2131 [ + + ]: 748143 : if (copied >= target) 2132 : : break; 2133 : : - 2134 [ - + ]: 27612 : if (copied) { + 2134 [ - + ]: 21870 : if (copied) { 2135 [ # # ]: 0 : if (sk->sk_err || 2136 [ # # ]: 0 : sk->sk_state == TCP_CLOSE || 2137 [ # # ]: 0 : (sk->sk_shutdown & RCV_SHUTDOWN) || @@ -2223,12 +2223,12 @@ 2139 : 0 : signal_pending(current)) 2140 : : break; 2141 : : } else { - 2142 [ + + ]: 27612 : if (sk->sk_err) { - 2143 : 3 : copied = sock_error(sk); - 2144 : 3 : break; + 2142 [ + + ]: 21870 : if (sk->sk_err) { + 2143 : 4 : copied = sock_error(sk); + 2144 : 4 : break; 2145 : : } 2146 : : - 2147 [ + + ]: 27609 : if (sk->sk_shutdown & RCV_SHUTDOWN) { + 2147 [ + + ]: 21866 : if (sk->sk_shutdown & RCV_SHUTDOWN) { 2148 : : /* race breaker: the shutdown could be after the 2149 : : * previous receive queue check 2150 : : */ @@ -2237,72 +2237,72 @@ 2153 : : break; 2154 : : } 2155 : : - 2156 [ + + ]: 26207 : if (sk->sk_state == TCP_CLOSE) { + 2156 [ + + ]: 20464 : if (sk->sk_state == TCP_CLOSE) { 2157 : : copied = -ENOTCONN; 2158 : : break; 2159 : : } 2160 : : - 2161 [ + - ]: 26189 : if (!timeo) { + 2161 [ + - ]: 20446 : if (!timeo) { 2162 : : copied = -EAGAIN; 2163 : : break; 2164 : : } 2165 : : - 2166 [ - + ]: 26189 : if (signal_pending(current)) { - 2167 [ # # ]: 0 : copied = sock_intr_errno(timeo); + 2166 [ + + ]: 20446 : if (signal_pending(current)) { + 2167 [ - + ]: 1 : copied = sock_intr_errno(timeo); 2168 : : break; 2169 : : } 2170 : : } 2171 : : - 2172 [ - + ]: 26189 : pr_debug("block timeout %ld\n", timeo); - 2173 : 26189 : mptcp_cleanup_rbuf(msk, copied); - 2174 : 26189 : err = sk_wait_data(sk, &timeo, NULL); - 2175 [ - + ]: 26189 : if (err < 0) { + 2172 [ - + ]: 20445 : pr_debug("block timeout %ld\n", timeo); + 2173 : 20445 : mptcp_cleanup_rbuf(msk, copied); + 2174 : 20445 : err = sk_wait_data(sk, &timeo, NULL); + 2175 [ - + ]: 20445 : if (err < 0) { 2176 : 0 : err = copied ? : err; 2177 : 0 : goto out_err; 2178 : : } 2179 : : } 2180 : : - 2181 : 667233 : mptcp_cleanup_rbuf(msk, copied); + 2181 : 728196 : mptcp_cleanup_rbuf(msk, copied); 2182 : : - 2183 : 667233 : out_err: - 2184 [ + + + - ]: 667233 : if (cmsg_flags && copied >= 0) { - 2185 [ + + ]: 583 : if (cmsg_flags & MPTCP_CMSG_TS) - 2186 : 575 : tcp_recv_timestamp(msg, sk, &tss); + 2183 : 728196 : out_err: + 2184 [ + + + - ]: 728196 : if (cmsg_flags && copied >= 0) { + 2185 [ + + ]: 582 : if (cmsg_flags & MPTCP_CMSG_TS) + 2186 : 574 : tcp_recv_timestamp(msg, sk, &tss); 2187 : : - 2188 [ + + ]: 583 : if (cmsg_flags & MPTCP_CMSG_INQ) { - 2189 : 433 : unsigned int inq = mptcp_inq_hint(sk); + 2188 [ + + ]: 582 : if (cmsg_flags & MPTCP_CMSG_INQ) { + 2189 : 432 : unsigned int inq = mptcp_inq_hint(sk); 2190 : : - 2191 : 433 : put_cmsg(msg, SOL_TCP, TCP_CM_INQ, sizeof(inq), &inq); + 2191 : 432 : put_cmsg(msg, SOL_TCP, TCP_CM_INQ, sizeof(inq), &inq); 2192 : : } 2193 : : } 2194 : : - 2195 [ - + ]: 667233 : pr_debug("msk=%p rx queue empty=%d copied=%d\n", + 2195 [ - + ]: 728196 : pr_debug("msk=%p rx queue empty=%d copied=%d\n", 2196 : : msk, skb_queue_empty(&sk->sk_receive_queue), copied); 2197 : : - 2198 : 667233 : release_sock(sk); - 2199 : 667233 : return copied; + 2198 : 728196 : release_sock(sk); + 2199 : 728196 : return copied; 2200 : : } 2201 : : - 2202 : 11963 : static void mptcp_retransmit_timer(struct timer_list *t) + 2202 : 11445 : static void mptcp_retransmit_timer(struct timer_list *t) 2203 : : { - 2204 : 11963 : struct inet_connection_sock *icsk = from_timer(icsk, t, + 2204 : 11445 : struct inet_connection_sock *icsk = from_timer(icsk, t, 2205 : : icsk_retransmit_timer); - 2206 : 11963 : struct sock *sk = &icsk->icsk_inet.sk; - 2207 [ - + ]: 11963 : struct mptcp_sock *msk = mptcp_sk(sk); + 2206 : 11445 : struct sock *sk = &icsk->icsk_inet.sk; + 2207 [ - + ]: 11445 : struct mptcp_sock *msk = mptcp_sk(sk); 2208 : : - 2209 : 11963 : bh_lock_sock(sk); - 2210 [ + + ]: 11963 : if (!sock_owned_by_user(sk)) { + 2209 : 11445 : bh_lock_sock(sk); + 2210 [ + + ]: 11445 : if (!sock_owned_by_user(sk)) { 2211 : : /* we need a process context to retransmit */ - 2212 [ + + ]: 14676 : if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags)) - 2213 : 8546 : mptcp_schedule_work(sk); + 2212 [ + + ]: 11591 : if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags)) + 2213 : 8143 : mptcp_schedule_work(sk); 2214 : : } else { 2215 : : /* delegate our work to tcp_release_cb() */ - 2216 [ - + - - : 3413 : __set_bit(MPTCP_RETRANSMIT, &msk->cb_flags); + 2216 [ - + - - : 3298 : __set_bit(MPTCP_RETRANSMIT, &msk->cb_flags); - - ] 2217 : : } - 2218 : 11963 : bh_unlock_sock(sk); - 2219 : 11963 : sock_put(sk); - 2220 : 11963 : } + 2218 : 11445 : bh_unlock_sock(sk); + 2219 : 11445 : sock_put(sk); + 2220 : 11445 : } 2221 : : 2222 : 114 : static void mptcp_tout_timer(struct timer_list *t) 2223 : : { @@ -2317,74 +2317,74 @@ 2232 : : * 2233 : : * A backup subflow is returned only if that is the only kind available. 2234 : : */ - 2235 : 2290 : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) + 2235 : 2082 : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) 2236 : : { - 2237 : 2290 : struct sock *backup = NULL, *pick = NULL; - 2238 : 2290 : struct mptcp_subflow_context *subflow; - 2239 : 2290 : int min_stale_count = INT_MAX; + 2237 : 2082 : struct sock *backup = NULL, *pick = NULL; + 2238 : 2082 : struct mptcp_subflow_context *subflow; + 2239 : 2082 : int min_stale_count = INT_MAX; 2240 : : - 2241 [ + + ]: 5329 : mptcp_for_each_subflow(msk, subflow) { - 2242 : 3039 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 2241 [ + + ]: 4823 : mptcp_for_each_subflow(msk, subflow) { + 2242 : 2741 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 2243 : : - 2244 [ + + ]: 3039 : if (!__mptcp_subflow_active(subflow)) - 2245 : 91 : continue; + 2244 [ + + ]: 2741 : if (!__mptcp_subflow_active(subflow)) + 2245 : 86 : continue; 2246 : : 2247 : : /* still data outstanding at TCP level? skip this */ - 2248 [ + + ]: 2948 : if (!tcp_rtx_and_write_queues_empty(ssk)) { - 2249 : 989 : mptcp_pm_subflow_chk_stale(msk, ssk); - 2250 : 989 : min_stale_count = min_t(int, min_stale_count, subflow->stale_count); - 2251 : 989 : continue; + 2248 [ + + ]: 2655 : if (!tcp_rtx_and_write_queues_empty(ssk)) { + 2249 : 735 : mptcp_pm_subflow_chk_stale(msk, ssk); + 2250 : 735 : min_stale_count = min_t(int, min_stale_count, subflow->stale_count); + 2251 : 735 : continue; 2252 : : } 2253 : : - 2254 [ + + ]: 1959 : if (subflow->backup || subflow->request_bkup) { - 2255 [ + + ]: 68 : if (!backup) - 2256 : 62 : backup = ssk; - 2257 : 68 : continue; + 2254 [ + + ]: 1920 : if (subflow->backup || subflow->request_bkup) { + 2255 [ + + ]: 78 : if (!backup) + 2256 : 68 : backup = ssk; + 2257 : 78 : continue; 2258 : : } 2259 : : - 2260 [ + + ]: 1891 : if (!pick) - 2261 : 1415 : pick = ssk; + 2260 [ + + ]: 1842 : if (!pick) + 2261 : 1435 : pick = ssk; 2262 : : } 2263 : : - 2264 [ + + ]: 2290 : if (pick) + 2264 [ + + ]: 2082 : if (pick) 2265 : : return pick; 2266 : : 2267 : : /* use backup only if there are no progresses anywhere */ - 2268 [ + + ]: 875 : return min_stale_count > 1 ? backup : NULL; + 2268 [ + + ]: 647 : return min_stale_count > 1 ? backup : NULL; 2269 : : } 2270 : : - 2271 : 734 : bool __mptcp_retransmit_pending_data(struct sock *sk) + 2271 : 766 : bool __mptcp_retransmit_pending_data(struct sock *sk) 2272 : : { - 2273 : 734 : struct mptcp_data_frag *cur, *rtx_head; - 2274 [ - + ]: 734 : struct mptcp_sock *msk = mptcp_sk(sk); + 2273 : 766 : struct mptcp_data_frag *cur, *rtx_head; + 2274 [ - + ]: 766 : struct mptcp_sock *msk = mptcp_sk(sk); 2275 : : - 2276 [ + + ]: 734 : if (__mptcp_check_fallback(msk)) + 2276 [ + + ]: 766 : if (__mptcp_check_fallback(msk)) 2277 : : return false; 2278 : : 2279 : : /* the closing socket has some data untransmitted and/or unacked: 2280 : : * some data in the mptcp rtx queue has not really xmitted yet. 2281 : : * keep it simple and re-inject the whole mptcp level rtx queue 2282 : : */ - 2283 : 710 : mptcp_data_lock(sk); - 2284 : 710 : __mptcp_clean_una_wakeup(sk); - 2285 : 710 : rtx_head = mptcp_rtx_head(sk); - 2286 [ + + ]: 710 : if (!rtx_head) { - 2287 : 666 : mptcp_data_unlock(sk); - 2288 : 666 : return false; + 2283 : 729 : mptcp_data_lock(sk); + 2284 : 729 : __mptcp_clean_una_wakeup(sk); + 2285 : 729 : rtx_head = mptcp_rtx_head(sk); + 2286 [ + + ]: 729 : if (!rtx_head) { + 2287 : 683 : mptcp_data_unlock(sk); + 2288 : 683 : return false; 2289 : : } 2290 : : - 2291 : 44 : msk->recovery_snd_nxt = msk->snd_nxt; - 2292 : 44 : msk->recovery = true; - 2293 : 44 : mptcp_data_unlock(sk); + 2291 : 46 : msk->recovery_snd_nxt = msk->snd_nxt; + 2292 : 46 : msk->recovery = true; + 2293 : 46 : mptcp_data_unlock(sk); 2294 : : - 2295 : 44 : msk->first_pending = rtx_head; - 2296 : 44 : msk->snd_burst = 0; + 2295 : 46 : msk->first_pending = rtx_head; + 2296 : 46 : msk->snd_burst = 0; 2297 : : 2298 : : /* be sure to clear the "sent status" on all re-injected fragments */ - 2299 [ + + ]: 5250 : list_for_each_entry(cur, &msk->rtx_queue, list) { - 2300 [ + + ]: 5214 : if (!cur->already_sent) + 2299 [ + + ]: 5163 : list_for_each_entry(cur, &msk->rtx_queue, list) { + 2300 [ + + ]: 5127 : if (!cur->already_sent) 2301 : : break; - 2302 : 5206 : cur->already_sent = 0; + 2302 : 5117 : cur->already_sent = 0; 2303 : : } 2304 : : 2305 : : return true; @@ -2398,22 +2398,22 @@ 2313 : : * clean completely the subflow status when the subflow reaches 2314 : : * TCP_CLOSE state 2315 : : */ - 2316 : 773 : static void __mptcp_subflow_disconnect(struct sock *ssk, + 2316 : 824 : static void __mptcp_subflow_disconnect(struct sock *ssk, 2317 : : struct mptcp_subflow_context *subflow, 2318 : : unsigned int flags) 2319 : : { - 2320 [ + + + + : 773 : if (((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) || - + + ] + 2320 [ + + + + : 824 : if (((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) || + + + ] 2321 : : (flags & MPTCP_CF_FASTCLOSE)) { 2322 : : /* The MPTCP code never wait on the subflow sockets, TCP-level 2323 : : * disconnect should never fail 2324 : : */ - 2325 [ - + ]: 749 : WARN_ON_ONCE(tcp_disconnect(ssk, 0)); - 2326 : 749 : mptcp_subflow_ctx_reset(subflow); + 2325 [ - + ]: 800 : WARN_ON_ONCE(tcp_disconnect(ssk, 0)); + 2326 : 800 : mptcp_subflow_ctx_reset(subflow); 2327 : : } else { 2328 : 24 : tcp_shutdown(ssk, SEND_SHUTDOWN); 2329 : : } - 2330 : 773 : } + 2330 : 824 : } 2331 : : 2332 : : /* subflow sockets can be either outgoing (connect) or incoming 2333 : : * (accept). @@ -2423,19 +2423,19 @@ 2337 : : * so we need to use tcp_close() after detaching them from the mptcp 2338 : : * parent socket. 2339 : : */ - 2340 : 5402 : static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, + 2340 : 5453 : static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, 2341 : : struct mptcp_subflow_context *subflow, 2342 : : unsigned int flags) 2343 : : { - 2344 [ - + ]: 5402 : struct mptcp_sock *msk = mptcp_sk(sk); - 2345 : 5402 : bool dispose_it, need_push = false; + 2344 [ - + ]: 5453 : struct mptcp_sock *msk = mptcp_sk(sk); + 2345 : 5453 : bool dispose_it, need_push = false; 2346 : : 2347 : : /* If the first subflow moved to a close state before accept, e.g. due 2348 : : * to an incoming reset or listener shutdown, the subflow socket is 2349 : : * already deleted by inet_child_forget() and the mptcp socket can't 2350 : : * survive too. 2351 : : */ - 2352 [ + + + + : 5444 : if (msk->in_accept_queue && msk->first == ssk && + 2352 [ + + + + : 5495 : if (msk->in_accept_queue && msk->first == ssk && - + ] 2353 [ - - ]: 42 : (sock_flag(sk, SOCK_DEAD) || sock_flag(ssk, SOCK_DEAD))) { 2354 : : /* ensure later check in mptcp_worker() will dispose the msk */ @@ -2446,27 +2446,27 @@ 2359 : 42 : goto out_release; 2360 : : } 2361 : : - 2362 [ + + + + ]: 5360 : dispose_it = msk->free_first || ssk != msk->first; + 2362 [ + + + + ]: 5411 : dispose_it = msk->free_first || ssk != msk->first; 2363 : : if (dispose_it) 2364 : 4587 : list_del(&subflow->node); 2365 : : - 2366 : 5360 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); + 2366 : 5411 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); 2367 : : - 2368 [ + + + + ]: 5360 : if ((flags & MPTCP_CF_FASTCLOSE) && !__mptcp_check_fallback(msk)) { + 2368 [ + + + + ]: 5411 : if ((flags & MPTCP_CF_FASTCLOSE) && !__mptcp_check_fallback(msk)) { 2369 : : /* be sure to force the tcp_close path 2370 : : * to generate the egress reset 2371 : : */ - 2372 : 421 : ssk->sk_lingertime = 0; - 2373 : 421 : sock_set_flag(ssk, SOCK_LINGER); - 2374 : 421 : subflow->send_fastclose = 1; + 2372 : 443 : ssk->sk_lingertime = 0; + 2373 : 443 : sock_set_flag(ssk, SOCK_LINGER); + 2374 : 443 : subflow->send_fastclose = 1; 2375 : : } 2376 : : - 2377 [ + + + + ]: 5360 : need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); - 2378 [ + + ]: 5360 : if (!dispose_it) { - 2379 : 773 : __mptcp_subflow_disconnect(ssk, subflow, flags); - 2380 : 773 : release_sock(ssk); + 2377 [ + + + + ]: 5411 : need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); + 2378 [ + + ]: 5411 : if (!dispose_it) { + 2379 : 824 : __mptcp_subflow_disconnect(ssk, subflow, flags); + 2380 : 824 : release_sock(ssk); 2381 : : - 2382 : 773 : goto out; + 2382 : 824 : goto out; 2383 : : } 2384 : : 2385 : 4587 : subflow->disposable = 1; @@ -2496,46 +2496,46 @@ 2409 : 3602 : WRITE_ONCE(msk->first, NULL); 2410 : : 2411 : 1027 : out: - 2412 : 5402 : __mptcp_sync_sndbuf(sk); - 2413 [ + + ]: 5402 : if (need_push) - 2414 : 27 : __mptcp_push_pending(sk, 0); + 2412 : 5453 : __mptcp_sync_sndbuf(sk); + 2413 [ + + ]: 5453 : if (need_push) + 2414 : 30 : __mptcp_push_pending(sk, 0); 2415 : : 2416 : : /* Catch every 'all subflows closed' scenario, including peers silently 2417 : : * closing them, e.g. due to timeout. 2418 : : * For established sockets, allow an additional timeout before closing, 2419 : : * as the protocol can still create more subflows. 2420 : : */ - 2421 [ + + + + : 7562 : if (list_is_singular(&msk->conn_list) && msk->first && - + + ] + 2421 [ + + + + : 7715 : if (list_is_singular(&msk->conn_list) && msk->first && + + + ] 2422 [ + - ]: 30 : inet_sk_state_load(msk->first) == TCP_CLOSE) { - 2423 [ + + + - ]: 750 : if (sk->sk_state != TCP_ESTABLISHED || - 2424 [ - + ]: 34 : msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { - 2425 : 716 : mptcp_set_state(sk, TCP_CLOSE); - 2426 : 716 : mptcp_close_wake_up(sk); + 2423 [ + + + - ]: 801 : if (sk->sk_state != TCP_ESTABLISHED || + 2424 [ - + ]: 33 : msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { + 2425 : 768 : mptcp_set_state(sk, TCP_CLOSE); + 2426 : 768 : mptcp_close_wake_up(sk); 2427 : : } else { - 2428 : 34 : mptcp_start_tout_timer(sk); + 2428 : 33 : mptcp_start_tout_timer(sk); 2429 : : } 2430 : : } - 2431 : 5402 : } + 2431 : 5453 : } 2432 : : - 2433 : 754 : void mptcp_close_ssk(struct sock *sk, struct sock *ssk, + 2433 : 787 : void mptcp_close_ssk(struct sock *sk, struct sock *ssk, 2434 : : struct mptcp_subflow_context *subflow) 2435 : : { 2436 : : /* The first subflow can already be closed and still in the list */ - 2437 [ + + ]: 754 : if (subflow->close_event_done) + 2437 [ + + ]: 787 : if (subflow->close_event_done) 2438 : : return; 2439 : : - 2440 : 717 : subflow->close_event_done = true; + 2440 : 750 : subflow->close_event_done = true; 2441 : : - 2442 [ + + ]: 717 : if (sk->sk_state == TCP_ESTABLISHED) - 2443 [ - + ]: 321 : mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); + 2442 [ + + ]: 750 : if (sk->sk_state == TCP_ESTABLISHED) + 2443 [ - + ]: 322 : mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); 2444 : : 2445 : : /* subflow aborted before reaching the fully_established status 2446 : : * attempt the creation of the next subflow 2447 : : */ - 2448 [ - + ]: 717 : mptcp_pm_subflow_check_next(mptcp_sk(sk), subflow); + 2448 [ - + ]: 750 : mptcp_pm_subflow_check_next(mptcp_sk(sk), subflow); 2449 : : - 2450 : 717 : __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH); + 2450 : 750 : __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH); 2451 : : } 2452 : : 2453 : 0 : static unsigned int mptcp_sync_mss(struct sock *sk, u32 pmtu) @@ -2543,189 +2543,189 @@ 2455 : 0 : return 0; 2456 : : } 2457 : : - 2458 : 559 : static void __mptcp_close_subflow(struct sock *sk) + 2458 : 586 : static void __mptcp_close_subflow(struct sock *sk) 2459 : : { - 2460 : 559 : struct mptcp_subflow_context *subflow, *tmp; - 2461 [ - + ]: 559 : struct mptcp_sock *msk = mptcp_sk(sk); + 2460 : 586 : struct mptcp_subflow_context *subflow, *tmp; + 2461 [ - + ]: 586 : struct mptcp_sock *msk = mptcp_sk(sk); 2462 : : - 2463 : 559 : might_sleep(); + 2463 : 586 : might_sleep(); 2464 : : - 2465 [ + + ]: 1432 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { - 2466 : 873 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 2467 : 873 : int ssk_state = inet_sk_state_load(ssk); + 2465 [ + + ]: 1491 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { + 2466 : 905 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 2467 : 905 : int ssk_state = inet_sk_state_load(ssk); 2468 : : - 2469 [ + + + + ]: 873 : if (ssk_state != TCP_CLOSE && - 2470 [ + + ]: 75 : (ssk_state != TCP_CLOSE_WAIT || + 2469 [ + + + + ]: 905 : if (ssk_state != TCP_CLOSE && + 2470 [ + + ]: 71 : (ssk_state != TCP_CLOSE_WAIT || 2471 [ # # ]: 0 : inet_sk_state_load(sk) != TCP_ESTABLISHED)) - 2472 : 311 : continue; + 2472 : 310 : continue; 2473 : : 2474 : : /* 'subflow_data_ready' will re-sched once rx queue is empty */ - 2475 [ - + ]: 562 : if (!skb_queue_empty_lockless(&ssk->sk_receive_queue)) + 2475 [ - + ]: 595 : if (!skb_queue_empty_lockless(&ssk->sk_receive_queue)) 2476 : 0 : continue; 2477 : : - 2478 : 562 : mptcp_close_ssk(sk, ssk, subflow); + 2478 : 595 : mptcp_close_ssk(sk, ssk, subflow); 2479 : : } 2480 : : - 2481 : 559 : } + 2481 : 586 : } 2482 : : - 2483 : 13691 : static bool mptcp_close_tout_expired(const struct sock *sk) + 2483 : 13284 : static bool mptcp_close_tout_expired(const struct sock *sk) 2484 : : { - 2485 [ + + ]: 13691 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp || - 2486 [ + + ]: 3487 : sk->sk_state == TCP_CLOSE) + 2485 [ + + ]: 13284 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp || + 2486 [ + + ]: 2642 : sk->sk_state == TCP_CLOSE) 2487 : : return false; 2488 : : - 2489 : 2603 : return time_after32(tcp_jiffies32, + 2489 : 1776 : return time_after32(tcp_jiffies32, 2490 : : inet_csk(sk)->icsk_mtup.probe_timestamp + mptcp_close_timeout(sk)); 2491 : : } 2492 : : - 2493 : 13691 : static void mptcp_check_fastclose(struct mptcp_sock *msk) + 2493 : 13284 : static void mptcp_check_fastclose(struct mptcp_sock *msk) 2494 : : { - 2495 : 13691 : struct mptcp_subflow_context *subflow, *tmp; - 2496 : 13691 : struct sock *sk = (struct sock *)msk; + 2495 : 13284 : struct mptcp_subflow_context *subflow, *tmp; + 2496 : 13284 : struct sock *sk = (struct sock *)msk; 2497 : : - 2498 [ + + + + ]: 13691 : if (likely(!READ_ONCE(msk->rcv_fastclose))) + 2498 [ + + + + ]: 13284 : if (likely(!READ_ONCE(msk->rcv_fastclose))) 2499 : : return; 2500 : : - 2501 : 211 : mptcp_token_destroy(msk); + 2501 : 229 : mptcp_token_destroy(msk); 2502 : : - 2503 [ + + ]: 486 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { - 2504 : 275 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); - 2505 : 275 : bool slow; + 2503 [ + + ]: 523 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { + 2504 : 294 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); + 2505 : 294 : bool slow; 2506 : : - 2507 : 275 : slow = lock_sock_fast(tcp_sk); - 2508 [ + + ]: 275 : if (tcp_sk->sk_state != TCP_CLOSE) { - 2509 : 35 : mptcp_send_active_reset_reason(tcp_sk); - 2510 : 35 : tcp_set_state(tcp_sk, TCP_CLOSE); + 2507 : 294 : slow = lock_sock_fast(tcp_sk); + 2508 [ + + ]: 294 : if (tcp_sk->sk_state != TCP_CLOSE) { + 2509 : 34 : mptcp_send_active_reset_reason(tcp_sk); + 2510 : 34 : tcp_set_state(tcp_sk, TCP_CLOSE); 2511 : : } - 2512 : 275 : unlock_sock_fast(tcp_sk, slow); + 2512 : 294 : unlock_sock_fast(tcp_sk, slow); 2513 : : } 2514 : : 2515 : : /* Mirror the tcp_reset() error propagation */ - 2516 [ - + + - ]: 211 : switch (sk->sk_state) { + 2516 [ - + + - ]: 229 : switch (sk->sk_state) { 2517 : : case TCP_SYN_SENT: 2518 : 0 : WRITE_ONCE(sk->sk_err, ECONNREFUSED); 2519 : 0 : break; 2520 : : case TCP_CLOSE_WAIT: - 2521 : 30 : WRITE_ONCE(sk->sk_err, EPIPE); - 2522 : 30 : break; + 2521 : 12 : WRITE_ONCE(sk->sk_err, EPIPE); + 2522 : 12 : break; 2523 : : case TCP_CLOSE: 2524 : : return; 2525 : : default: - 2526 : 181 : WRITE_ONCE(sk->sk_err, ECONNRESET); + 2526 : 217 : WRITE_ONCE(sk->sk_err, ECONNRESET); 2527 : : } 2528 : : - 2529 : 211 : mptcp_set_state(sk, TCP_CLOSE); - 2530 : 211 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); - 2531 : 211 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ - 2532 : 211 : set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); + 2529 : 229 : mptcp_set_state(sk, TCP_CLOSE); + 2530 : 229 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); + 2531 : 229 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ + 2532 : 229 : set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); 2533 : : 2534 : : /* the calling mptcp_worker will properly destroy the socket */ - 2535 [ + + ]: 211 : if (sock_flag(sk, SOCK_DEAD)) + 2535 [ + + ]: 229 : if (sock_flag(sk, SOCK_DEAD)) 2536 : : return; 2537 : : - 2538 : 120 : sk->sk_state_change(sk); - 2539 : 120 : sk_error_report(sk); + 2538 : 99 : sk->sk_state_change(sk); + 2539 : 99 : sk_error_report(sk); 2540 : : } 2541 : : - 2542 : 11633 : static void __mptcp_retrans(struct sock *sk) + 2542 : 11138 : static void __mptcp_retrans(struct sock *sk) 2543 : : { - 2544 [ - + ]: 11633 : struct mptcp_sock *msk = mptcp_sk(sk); - 2545 : 11633 : struct mptcp_subflow_context *subflow; - 2546 : 11633 : struct mptcp_sendmsg_info info = {}; - 2547 : 11633 : struct mptcp_data_frag *dfrag; - 2548 : 11633 : struct sock *ssk; - 2549 : 11633 : int ret, err; - 2550 : 11633 : u16 len = 0; + 2544 [ - + ]: 11138 : struct mptcp_sock *msk = mptcp_sk(sk); + 2545 : 11138 : struct mptcp_subflow_context *subflow; + 2546 : 11138 : struct mptcp_sendmsg_info info = {}; + 2547 : 11138 : struct mptcp_data_frag *dfrag; + 2548 : 11138 : struct sock *ssk; + 2549 : 11138 : int ret, err; + 2550 : 11138 : u16 len = 0; 2551 : : - 2552 : 11633 : mptcp_clean_una_wakeup(sk); + 2552 : 11138 : mptcp_clean_una_wakeup(sk); 2553 : : 2554 : : /* first check ssk: need to kick "stale" logic */ - 2555 : 11633 : err = mptcp_sched_get_retrans(msk); - 2556 : 11633 : dfrag = mptcp_rtx_head(sk); - 2557 [ + + ]: 11633 : if (!dfrag) { - 2558 [ + + ]: 3549 : if (mptcp_data_fin_enabled(msk)) { - 2559 : 1119 : struct inet_connection_sock *icsk = inet_csk(sk); + 2555 : 11138 : err = mptcp_sched_get_retrans(msk); + 2556 : 11138 : dfrag = mptcp_rtx_head(sk); + 2557 [ + + ]: 11138 : if (!dfrag) { + 2558 [ + + ]: 3214 : if (mptcp_data_fin_enabled(msk)) { + 2559 : 1143 : struct inet_connection_sock *icsk = inet_csk(sk); 2560 : : - 2561 : 1119 : icsk->icsk_retransmits++; - 2562 : 1119 : mptcp_set_datafin_timeout(sk); - 2563 : 1119 : mptcp_send_ack(msk); + 2561 : 1143 : icsk->icsk_retransmits++; + 2562 : 1143 : mptcp_set_datafin_timeout(sk); + 2563 : 1143 : mptcp_send_ack(msk); 2564 : : - 2565 : 1119 : goto reset_timer; + 2565 : 1143 : goto reset_timer; 2566 : : } 2567 : : - 2568 [ + + ]: 2430 : if (!mptcp_send_head(sk)) - 2569 : 922 : return; + 2568 [ + + ]: 2071 : if (!mptcp_send_head(sk)) + 2569 : 897 : return; 2570 : : - 2571 : 1508 : goto reset_timer; + 2571 : 1174 : goto reset_timer; 2572 : : } 2573 : : - 2574 [ + + ]: 8084 : if (err) - 2575 : 4726 : goto reset_timer; + 2574 [ + + ]: 7924 : if (err) + 2575 : 4594 : goto reset_timer; 2576 : : - 2577 [ + + ]: 9776 : mptcp_for_each_subflow(msk, subflow) { - 2578 [ + + + + ]: 6418 : if (READ_ONCE(subflow->scheduled)) { - 2579 : 3716 : u16 copied = 0; + 2577 [ + + ]: 9589 : mptcp_for_each_subflow(msk, subflow) { + 2578 [ + + + + ]: 6259 : if (READ_ONCE(subflow->scheduled)) { + 2579 : 3842 : u16 copied = 0; 2580 : : - 2581 : 3716 : mptcp_subflow_set_scheduled(subflow, false); + 2581 : 3842 : mptcp_subflow_set_scheduled(subflow, false); 2582 : : - 2583 : 3716 : ssk = mptcp_subflow_tcp_sock(subflow); + 2583 : 3842 : ssk = mptcp_subflow_tcp_sock(subflow); 2584 : : - 2585 : 3716 : lock_sock(ssk); + 2585 : 3842 : lock_sock(ssk); 2586 : : 2587 : : /* limit retransmission to the bytes already sent on some subflows */ - 2588 : 3716 : info.sent = 0; - 2589 [ + + - + ]: 3716 : info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len : + 2588 : 3842 : info.sent = 0; + 2589 [ - + - + ]: 3842 : info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len : 2590 : : dfrag->already_sent; - 2591 [ + + ]: 7438 : while (info.sent < info.limit) { - 2592 : 3722 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info); - 2593 [ + - ]: 3722 : if (ret <= 0) + 2591 [ + + ]: 7690 : while (info.sent < info.limit) { + 2592 : 3848 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info); + 2593 [ + - ]: 3848 : if (ret <= 0) 2594 : : break; 2595 : : - 2596 [ + - ]: 3722 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS); - 2597 : 3722 : copied += ret; - 2598 : 3722 : info.sent += ret; + 2596 [ + - ]: 3848 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS); + 2597 : 3848 : copied += ret; + 2598 : 3848 : info.sent += ret; 2599 : : } - 2600 [ + - ]: 3716 : if (copied) { - 2601 : 3716 : len = max(copied, len); - 2602 [ - + ]: 3716 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + 2600 [ + - ]: 3842 : if (copied) { + 2601 : 3842 : len = max(copied, len); + 2602 [ - + ]: 3842 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, 2603 : : info.size_goal); - 2604 : 3716 : WRITE_ONCE(msk->allow_infinite_fallback, false); + 2604 : 3842 : WRITE_ONCE(msk->allow_infinite_fallback, false); 2605 : : } 2606 : : - 2607 : 3716 : release_sock(ssk); + 2607 : 3842 : release_sock(ssk); 2608 : : } 2609 : : } 2610 : : - 2611 : 3358 : msk->bytes_retrans += len; - 2612 : 3358 : dfrag->already_sent = max(dfrag->already_sent, len); + 2611 : 3330 : msk->bytes_retrans += len; + 2612 : 3330 : dfrag->already_sent = max(dfrag->already_sent, len); 2613 : : - 2614 : 10711 : reset_timer: - 2615 : 10711 : mptcp_check_and_set_pending(sk); + 2614 : 10241 : reset_timer: + 2615 : 10241 : mptcp_check_and_set_pending(sk); 2616 : : - 2617 [ + + ]: 10711 : if (!mptcp_rtx_timer_pending(sk)) - 2618 : 79 : mptcp_reset_rtx_timer(sk); + 2617 [ + + ]: 10241 : if (!mptcp_rtx_timer_pending(sk)) + 2618 : 81 : mptcp_reset_rtx_timer(sk); 2619 : : } 2620 : : 2621 : : /* schedule the timeout timer for the relevant event: either close timeout 2622 : : * or mp_fail timeout. The close timeout takes precedence on the mp_fail one 2623 : : */ - 2624 : 1085 : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) + 2624 : 1065 : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) 2625 : : { - 2626 : 1085 : struct sock *sk = (struct sock *)msk; - 2627 : 1085 : unsigned long timeout, close_timeout; + 2626 : 1065 : struct sock *sk = (struct sock *)msk; + 2627 : 1065 : unsigned long timeout, close_timeout; 2628 : : - 2629 [ + + + - ]: 1085 : if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) + 2629 [ + + + - ]: 1065 : if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) 2630 : : return; 2631 : : - 2632 : 2170 : close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - - 2633 : 1085 : tcp_jiffies32 + jiffies + mptcp_close_timeout(sk); + 2632 : 2130 : close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - + 2633 : 1065 : tcp_jiffies32 + jiffies + mptcp_close_timeout(sk); 2634 : : 2635 : : /* the close timeout takes precedence on the fail one, and here at least one of 2636 : : * them is active 2637 : : */ - 2638 [ + + ]: 1085 : timeout = inet_csk(sk)->icsk_mtup.probe_timestamp ? close_timeout : fail_tout; + 2638 [ + + ]: 1065 : timeout = inet_csk(sk)->icsk_mtup.probe_timestamp ? close_timeout : fail_tout; 2639 : : - 2640 : 1085 : sk_reset_timer(sk, &sk->sk_timer, timeout); + 2640 : 1065 : sk_reset_timer(sk, &sk->sk_timer, timeout); 2641 : : } 2642 : : 2643 : 0 : static void mptcp_mp_fail_no_response(struct mptcp_sock *msk) @@ -2744,61 +2744,61 @@ 2656 : 0 : unlock_sock_fast(ssk, slow); 2657 : : } 2658 : : - 2659 : 367 : static void mptcp_do_fastclose(struct sock *sk) + 2659 : 388 : static void mptcp_do_fastclose(struct sock *sk) 2660 : : { - 2661 : 367 : struct mptcp_subflow_context *subflow, *tmp; - 2662 [ - + ]: 367 : struct mptcp_sock *msk = mptcp_sk(sk); + 2661 : 388 : struct mptcp_subflow_context *subflow, *tmp; + 2662 [ - + ]: 388 : struct mptcp_sock *msk = mptcp_sk(sk); 2663 : : - 2664 : 367 : mptcp_set_state(sk, TCP_CLOSE); - 2665 [ + + ]: 812 : mptcp_for_each_subflow_safe(msk, subflow, tmp) - 2666 : 445 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), + 2664 : 388 : mptcp_set_state(sk, TCP_CLOSE); + 2665 [ + + ]: 855 : mptcp_for_each_subflow_safe(msk, subflow, tmp) + 2666 : 467 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), 2667 : : subflow, MPTCP_CF_FASTCLOSE); - 2668 : 367 : } + 2668 : 388 : } 2669 : : - 2670 : 13832 : static void mptcp_worker(struct work_struct *work) + 2670 : 13417 : static void mptcp_worker(struct work_struct *work) 2671 : : { - 2672 : 13832 : struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work); - 2673 : 13832 : struct sock *sk = (struct sock *)msk; - 2674 : 13832 : unsigned long fail_tout; - 2675 : 13832 : int state; + 2672 : 13417 : struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work); + 2673 : 13417 : struct sock *sk = (struct sock *)msk; + 2674 : 13417 : unsigned long fail_tout; + 2675 : 13417 : int state; 2676 : : - 2677 : 13832 : lock_sock(sk); - 2678 : 13832 : state = sk->sk_state; - 2679 [ + + + + ]: 13832 : if (unlikely((1 << state) & (TCPF_CLOSE | TCPF_LISTEN))) - 2680 : 141 : goto unlock; + 2677 : 13417 : lock_sock(sk); + 2678 : 13417 : state = sk->sk_state; + 2679 [ + + + + ]: 13417 : if (unlikely((1 << state) & (TCPF_CLOSE | TCPF_LISTEN))) + 2680 : 133 : goto unlock; 2681 : : - 2682 : 13691 : mptcp_check_fastclose(msk); + 2682 : 13284 : mptcp_check_fastclose(msk); 2683 : : - 2684 : 13691 : mptcp_pm_nl_work(msk); + 2684 : 13284 : mptcp_pm_nl_work(msk); 2685 : : - 2686 : 13691 : mptcp_check_send_data_fin(sk); - 2687 : 13691 : mptcp_check_data_fin_ack(sk); - 2688 : 13691 : mptcp_check_data_fin(sk); + 2686 : 13284 : mptcp_check_send_data_fin(sk); + 2687 : 13284 : mptcp_check_data_fin_ack(sk); + 2688 : 13284 : mptcp_check_data_fin(sk); 2689 : : - 2690 [ + + ]: 22314 : if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - 2691 : 559 : __mptcp_close_subflow(sk); + 2690 [ + + ]: 19211 : if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + 2691 : 586 : __mptcp_close_subflow(sk); 2692 : : - 2693 [ + + ]: 13691 : if (mptcp_close_tout_expired(sk)) { - 2694 : 115 : mptcp_do_fastclose(sk); - 2695 : 115 : mptcp_close_wake_up(sk); + 2693 [ + + ]: 13284 : if (mptcp_close_tout_expired(sk)) { + 2694 : 114 : mptcp_do_fastclose(sk); + 2695 : 114 : mptcp_close_wake_up(sk); 2696 : : } 2697 : : - 2698 [ + + + + ]: 13691 : if (sock_flag(sk, SOCK_DEAD) && sk->sk_state == TCP_CLOSE) { - 2699 : 987 : __mptcp_destroy_sock(sk); - 2700 : 987 : goto unlock; + 2698 [ + + + + ]: 13284 : if (sock_flag(sk, SOCK_DEAD) && sk->sk_state == TCP_CLOSE) { + 2699 : 968 : __mptcp_destroy_sock(sk); + 2700 : 968 : goto unlock; 2701 : : } 2702 : : - 2703 [ + + ]: 20816 : if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) - 2704 : 8220 : __mptcp_retrans(sk); + 2703 [ + + ]: 17753 : if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) + 2704 : 7840 : __mptcp_retrans(sk); 2705 : : - 2706 [ + - + - ]: 12704 : fail_tout = msk->first ? READ_ONCE(mptcp_subflow_ctx(msk->first)->fail_tout) : 0; - 2707 [ + - - - ]: 12704 : if (fail_tout && time_after(jiffies, fail_tout)) + 2706 [ + - + - ]: 12316 : fail_tout = msk->first ? READ_ONCE(mptcp_subflow_ctx(msk->first)->fail_tout) : 0; + 2707 [ + - - - ]: 12316 : if (fail_tout && time_after(jiffies, fail_tout)) 2708 : 0 : mptcp_mp_fail_no_response(msk); 2709 : : 2710 : 0 : unlock: - 2711 : 13832 : release_sock(sk); - 2712 : 13832 : sock_put(sk); - 2713 : 13832 : } + 2711 : 13417 : release_sock(sk); + 2712 : 13417 : sock_put(sk); + 2713 : 13417 : } 2714 : : 2715 : 3696 : static void __mptcp_init_sock(struct sock *sk) 2716 : : { @@ -2883,23 +2883,23 @@ 2795 : 3676 : struct mptcp_data_frag *dtmp, *dfrag; 2796 : : 2797 : 3676 : WRITE_ONCE(msk->first_pending, NULL); - 2798 [ + + ]: 4855 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) - 2799 : 1179 : dfrag_clear(sk, dfrag); + 2798 [ + + ]: 3858 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) + 2799 : 182 : dfrag_clear(sk, dfrag); 2800 : 3676 : } 2801 : : - 2802 : 2627 : void mptcp_cancel_work(struct sock *sk) + 2802 : 2646 : void mptcp_cancel_work(struct sock *sk) 2803 : : { - 2804 [ - + ]: 2627 : struct mptcp_sock *msk = mptcp_sk(sk); + 2804 [ - + ]: 2646 : struct mptcp_sock *msk = mptcp_sk(sk); 2805 : : - 2806 [ + + ]: 2627 : if (cancel_work_sync(&msk->work)) - 2807 : 24 : __sock_put(sk); - 2808 : 2627 : } + 2806 [ + + ]: 2646 : if (cancel_work_sync(&msk->work)) + 2807 : 29 : __sock_put(sk); + 2808 : 2646 : } 2809 : : - 2810 : 2998 : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) + 2810 : 3013 : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) 2811 : : { - 2812 : 2998 : lock_sock(ssk); + 2812 : 3013 : lock_sock(ssk); 2813 : : - 2814 [ - + + ]: 2998 : switch (ssk->sk_state) { + 2814 [ - + + ]: 3013 : switch (ssk->sk_state) { 2815 : 0 : case TCP_LISTEN: 2816 [ # # ]: 0 : if (!(how & RCV_SHUTDOWN)) 2817 : : break; @@ -2907,34 +2907,34 @@ 2819 : : case TCP_SYN_SENT: 2820 [ - + ]: 16 : WARN_ON_ONCE(tcp_disconnect(ssk, O_NONBLOCK)); 2821 : : break; - 2822 : 2982 : default: - 2823 [ - + + + ]: 2982 : if (__mptcp_check_fallback(mptcp_sk(sk))) { - 2824 [ - + ]: 92 : pr_debug("Fallback\n"); - 2825 : 92 : ssk->sk_shutdown |= how; - 2826 : 92 : tcp_shutdown(ssk, how); + 2822 : 2997 : default: + 2823 [ - + + + ]: 2997 : if (__mptcp_check_fallback(mptcp_sk(sk))) { + 2824 [ - + ]: 93 : pr_debug("Fallback\n"); + 2825 : 93 : ssk->sk_shutdown |= how; + 2826 : 93 : tcp_shutdown(ssk, how); 2827 : : 2828 : : /* simulate the data_fin ack reception to let the state 2829 : : * machine move forward 2830 : : */ - 2831 [ - + - + ]: 92 : WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); - 2832 : 92 : mptcp_schedule_work(sk); + 2831 [ - + - + ]: 93 : WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); + 2832 : 93 : mptcp_schedule_work(sk); 2833 : : } else { - 2834 [ - + ]: 2890 : pr_debug("Sending DATA_FIN on subflow %p\n", ssk); - 2835 : 2890 : tcp_send_ack(ssk); - 2836 [ + + ]: 2890 : if (!mptcp_rtx_timer_pending(sk)) - 2837 : 1608 : mptcp_reset_rtx_timer(sk); + 2834 [ - + ]: 2904 : pr_debug("Sending DATA_FIN on subflow %p\n", ssk); + 2835 : 2904 : tcp_send_ack(ssk); + 2836 [ + + ]: 2904 : if (!mptcp_rtx_timer_pending(sk)) + 2837 : 1656 : mptcp_reset_rtx_timer(sk); 2838 : : } 2839 : : break; 2840 : : } 2841 : : - 2842 : 2998 : release_sock(ssk); - 2843 : 2998 : } + 2842 : 3013 : release_sock(ssk); + 2843 : 3013 : } 2844 : : - 2845 : 16989 : void mptcp_set_state(struct sock *sk, int state) + 2845 : 17000 : void mptcp_set_state(struct sock *sk, int state) 2846 : : { - 2847 : 17670 : int oldstate = sk->sk_state; + 2847 : 17685 : int oldstate = sk->sk_state; 2848 : : - 2849 [ + + - ]: 16937 : switch (state) { + 2849 [ + + - ]: 16945 : switch (state) { 2850 : 2376 : case TCP_ESTABLISHED: 2851 [ + - ]: 2376 : if (oldstate != TCP_ESTABLISHED) 2852 [ + - ]: 2376 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); @@ -2945,13 +2945,13 @@ 2857 : : * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT. 2858 : : */ 2859 : : break; - 2860 : 14561 : default: - 2861 [ + + ]: 14561 : if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) + 2860 : 14569 : default: + 2861 [ + + ]: 14569 : if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2862 [ + - ]: 2376 : MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2863 : : } 2864 : : - 2865 : 17670 : inet_sk_state_store(sk, state); - 2866 : 733 : } + 2865 : 17685 : inet_sk_state_store(sk, state); + 2866 : 740 : } 2867 : : 2868 : : static const unsigned char new_state[16] = { 2869 : : /* current state: new state: action: */ @@ -2970,56 +2970,56 @@ 2882 : : [TCP_NEW_SYN_RECV] = TCP_CLOSE, /* should not happen ! */ 2883 : : }; 2884 : : - 2885 : 2587 : static int mptcp_close_state(struct sock *sk) + 2885 : 2561 : static int mptcp_close_state(struct sock *sk) 2886 : : { - 2887 : 2587 : int next = (int)new_state[sk->sk_state]; - 2888 : 2587 : int ns = next & TCP_STATE_MASK; + 2887 : 2561 : int next = (int)new_state[sk->sk_state]; + 2888 : 2561 : int ns = next & TCP_STATE_MASK; 2889 : : - 2890 : 2587 : mptcp_set_state(sk, ns); + 2890 : 2561 : mptcp_set_state(sk, ns); 2891 : : - 2892 : 2587 : return next & TCP_ACTION_FIN; + 2892 : 2561 : return next & TCP_ACTION_FIN; 2893 : : } 2894 : : - 2895 : 411732 : static void mptcp_check_send_data_fin(struct sock *sk) + 2895 : 417662 : static void mptcp_check_send_data_fin(struct sock *sk) 2896 : : { - 2897 : 411732 : struct mptcp_subflow_context *subflow; - 2898 [ - + ]: 411732 : struct mptcp_sock *msk = mptcp_sk(sk); + 2897 : 417662 : struct mptcp_subflow_context *subflow; + 2898 [ - + ]: 417662 : struct mptcp_sock *msk = mptcp_sk(sk); 2899 : : - 2900 [ - + - - ]: 411732 : pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu\n", + 2900 [ - + - - ]: 417662 : pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu\n", 2901 : : msk, msk->snd_data_fin_enable, !!mptcp_send_head(sk), 2902 : : msk->snd_nxt, msk->write_seq); 2903 : : 2904 : : /* we still need to enqueue subflows or not really shutting down, 2905 : : * skip this 2906 : : */ - 2907 [ + + + + : 413869 : if (!msk->snd_data_fin_enable || msk->snd_nxt + 1 != msk->write_seq || - + + - + ] - 2908 : 2137 : mptcp_send_head(sk)) - 2909 : 409595 : return; + 2907 [ + + + + : 419819 : if (!msk->snd_data_fin_enable || msk->snd_nxt + 1 != msk->write_seq || + + + - + ] + 2908 : 2157 : mptcp_send_head(sk)) + 2909 : 415505 : return; 2910 : : - 2911 : 2137 : WRITE_ONCE(msk->snd_nxt, msk->write_seq); + 2911 : 2157 : WRITE_ONCE(msk->snd_nxt, msk->write_seq); 2912 : : - 2913 [ + + ]: 4943 : mptcp_for_each_subflow(msk, subflow) { - 2914 : 2806 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); + 2913 [ + + ]: 4978 : mptcp_for_each_subflow(msk, subflow) { + 2914 : 2821 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); 2915 : : - 2916 : 2806 : mptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN); + 2916 : 2821 : mptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN); 2917 : : } 2918 : : } 2919 : : - 2920 : 2138 : static void __mptcp_wr_shutdown(struct sock *sk) + 2920 : 2157 : static void __mptcp_wr_shutdown(struct sock *sk) 2921 : : { - 2922 [ - + ]: 2138 : struct mptcp_sock *msk = mptcp_sk(sk); + 2922 [ - + ]: 2157 : struct mptcp_sock *msk = mptcp_sk(sk); 2923 : : - 2924 [ - + - - ]: 2138 : pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d\n", + 2924 [ - + - - ]: 2157 : pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d\n", 2925 : : msk, msk->snd_data_fin_enable, sk->sk_shutdown, sk->sk_state, 2926 : : !!mptcp_send_head(sk)); 2927 : : 2928 : : /* will be ignored by fallback sockets */ - 2929 : 2138 : WRITE_ONCE(msk->write_seq, msk->write_seq + 1); - 2930 : 2138 : WRITE_ONCE(msk->snd_data_fin_enable, 1); + 2929 : 2157 : WRITE_ONCE(msk->write_seq, msk->write_seq + 1); + 2930 : 2157 : WRITE_ONCE(msk->snd_data_fin_enable, 1); 2931 : : - 2932 : 2138 : mptcp_check_send_data_fin(sk); - 2933 : 2138 : } + 2932 : 2157 : mptcp_check_send_data_fin(sk); + 2933 : 2157 : } 2934 : : 2935 : 3614 : static void __mptcp_destroy_sock(struct sock *sk) 2936 : : { @@ -3051,27 +3051,27 @@ 2962 : : 2963 : 0 : static __poll_t mptcp_check_readable(struct sock *sk) 2964 : : { - 2965 [ + + ]: 650465 : return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; + 2965 [ + + ]: 749240 : return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; 2966 : : } 2967 : : - 2968 : 2382 : static void mptcp_check_listen_stop(struct sock *sk) + 2968 : 2376 : static void mptcp_check_listen_stop(struct sock *sk) 2969 : : { - 2970 : 2382 : struct sock *ssk; + 2970 : 2376 : struct sock *ssk; 2971 : : - 2972 [ + + ]: 2382 : if (inet_sk_state_load(sk) != TCP_LISTEN) + 2972 [ + + ]: 2376 : if (inet_sk_state_load(sk) != TCP_LISTEN) 2973 : : return; 2974 : : - 2975 : 1252 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); - 2976 [ - + ]: 1252 : ssk = mptcp_sk(sk)->first; - 2977 [ + - - + ]: 2504 : if (WARN_ON_ONCE(!ssk || inet_sk_state_load(ssk) != TCP_LISTEN)) + 2975 : 1248 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); + 2976 [ - + ]: 1248 : ssk = mptcp_sk(sk)->first; + 2977 [ + - - + ]: 2496 : if (WARN_ON_ONCE(!ssk || inet_sk_state_load(ssk) != TCP_LISTEN)) 2978 : 0 : return; 2979 : : - 2980 : 1252 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); - 2981 : 1252 : tcp_set_state(ssk, TCP_CLOSE); - 2982 : 1252 : mptcp_subflow_queue_clean(sk, ssk); - 2983 : 1252 : inet_csk_listen_stop(ssk); - 2984 : 1252 : mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CLOSED); - 2985 : 1252 : release_sock(ssk); + 2980 : 1248 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); + 2981 : 1248 : tcp_set_state(ssk, TCP_CLOSE); + 2982 : 1248 : mptcp_subflow_queue_clean(sk, ssk); + 2983 : 1248 : inet_csk_listen_stop(ssk); + 2984 : 1248 : mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CLOSED); + 2985 : 1248 : release_sock(ssk); 2986 : : } 2987 : : 2988 : 3634 : bool __mptcp_close(struct sock *sk, long timeout) @@ -3083,62 +3083,62 @@ 2994 : : 2995 : 3634 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); 2996 : : - 2997 [ + + + + ]: 3634 : if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { - 2998 : 2324 : mptcp_check_listen_stop(sk); - 2999 : 2324 : mptcp_set_state(sk, TCP_CLOSE); - 3000 : 2324 : goto cleanup; + 2997 [ + + + + ]: 3634 : if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { + 2998 : 2318 : mptcp_check_listen_stop(sk); + 2999 : 2318 : mptcp_set_state(sk, TCP_CLOSE); + 3000 : 2318 : goto cleanup; 3001 : : } 3002 : : - 3003 [ + + - + ]: 1310 : if (mptcp_data_avail(msk) || timeout < 0) { + 3003 [ + + - + ]: 1316 : if (mptcp_data_avail(msk) || timeout < 0) { 3004 : : /* If the msk has read data, or the caller explicitly ask it, 3005 : : * do the MPTCP equivalent of TCP reset, aka MPTCP fastclose 3006 : : */ - 3007 : 210 : mptcp_do_fastclose(sk); - 3008 : 210 : timeout = 0; - 3009 [ + + ]: 1100 : } else if (mptcp_close_state(sk)) { - 3010 : 755 : __mptcp_wr_shutdown(sk); + 3007 : 232 : mptcp_do_fastclose(sk); + 3008 : 232 : timeout = 0; + 3009 [ + + ]: 1084 : } else if (mptcp_close_state(sk)) { + 3010 : 762 : __mptcp_wr_shutdown(sk); 3011 : : } 3012 : : - 3013 : 1310 : sk_stream_wait_close(sk, timeout); + 3013 : 1316 : sk_stream_wait_close(sk, timeout); 3014 : : 3015 : 3634 : cleanup: 3016 : : /* orphan all the subflows */ - 3017 [ + + ]: 7924 : mptcp_for_each_subflow(msk, subflow) { - 3018 : 4290 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 3019 : 4290 : bool slow = lock_sock_fast_nested(ssk); + 3017 [ + + ]: 7920 : mptcp_for_each_subflow(msk, subflow) { + 3018 : 4286 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3019 : 4286 : bool slow = lock_sock_fast_nested(ssk); 3020 : : - 3021 : 4290 : subflows_alive += ssk->sk_state != TCP_CLOSE; + 3021 : 4286 : subflows_alive += ssk->sk_state != TCP_CLOSE; 3022 : : 3023 : : /* since the close timeout takes precedence on the fail one, 3024 : : * cancel the latter 3025 : : */ - 3026 [ + + ]: 4290 : if (ssk == msk->first) + 3026 [ + + ]: 4286 : if (ssk == msk->first) 3027 : 3622 : subflow->fail_tout = 0; 3028 : : 3029 : : /* detach from the parent socket, but allow data_ready to 3030 : : * push incoming data into the mptcp stack, to properly ack it 3031 : : */ - 3032 : 4290 : ssk->sk_socket = NULL; - 3033 : 4290 : ssk->sk_wq = NULL; - 3034 : 4290 : unlock_sock_fast(ssk, slow); + 3032 : 4286 : ssk->sk_socket = NULL; + 3033 : 4286 : ssk->sk_wq = NULL; + 3034 : 4286 : unlock_sock_fast(ssk, slow); 3035 : : } 3036 : 3634 : sock_orphan(sk); 3037 : : 3038 : : /* all the subflows are closed, only timeout can change the msk 3039 : : * state, let's not keep resources busy for no reasons 3040 : : */ - 3041 [ + + ]: 3634 : if (subflows_alive == 0) - 3042 : 1685 : mptcp_set_state(sk, TCP_CLOSE); + 3041 [ + + ]: 3634 : if (subflows_alive == 0) + 3042 : 1704 : mptcp_set_state(sk, TCP_CLOSE); 3043 : : 3044 : 3634 : sock_hold(sk); 3045 [ - + ]: 3634 : pr_debug("msk=%p state=%d\n", sk, sk->sk_state); 3046 : 3634 : mptcp_pm_connection_closed(msk); 3047 : : - 3048 [ + + ]: 3634 : if (sk->sk_state == TCP_CLOSE) { - 3049 : 2585 : __mptcp_destroy_sock(sk); - 3050 : 2585 : do_cancel_work = true; + 3048 [ + + ]: 3634 : if (sk->sk_state == TCP_CLOSE) { + 3049 : 2604 : __mptcp_destroy_sock(sk); + 3050 : 2604 : do_cancel_work = true; 3051 : : } else { - 3052 : 1049 : mptcp_start_tout_timer(sk); + 3052 : 1030 : mptcp_start_tout_timer(sk); 3053 : : } 3054 : : 3055 : 3634 : return do_cancel_work; @@ -3152,34 +3152,34 @@ 3063 : : 3064 : 3634 : do_cancel_work = __mptcp_close(sk, timeout); 3065 : 3634 : release_sock(sk); - 3066 [ + + ]: 3634 : if (do_cancel_work) - 3067 : 2585 : mptcp_cancel_work(sk); + 3066 [ + + ]: 3634 : if (do_cancel_work) + 3067 : 2604 : mptcp_cancel_work(sk); 3068 : : 3069 : 3634 : sock_put(sk); 3070 : 3634 : } 3071 : : - 3072 : 4936 : static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) + 3072 : 4928 : static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) 3073 : : { 3074 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 3075 [ + - ]: 4936 : const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); - 3076 [ + - ]: 4936 : struct ipv6_pinfo *msk6 = inet6_sk(msk); + 3075 [ + - ]: 4928 : const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); + 3076 [ + - ]: 4928 : struct ipv6_pinfo *msk6 = inet6_sk(msk); 3077 : : - 3078 : 4936 : msk->sk_v6_daddr = ssk->sk_v6_daddr; - 3079 : 4936 : msk->sk_v6_rcv_saddr = ssk->sk_v6_rcv_saddr; + 3078 : 4928 : msk->sk_v6_daddr = ssk->sk_v6_daddr; + 3079 : 4928 : msk->sk_v6_rcv_saddr = ssk->sk_v6_rcv_saddr; 3080 : : - 3081 [ + + ]: 4936 : if (msk6 && ssk6) { - 3082 : 1932 : msk6->saddr = ssk6->saddr; - 3083 : 1932 : msk6->flow_label = ssk6->flow_label; + 3081 [ + + ]: 4928 : if (msk6 && ssk6) { + 3082 : 1930 : msk6->saddr = ssk6->saddr; + 3083 : 1930 : msk6->flow_label = ssk6->flow_label; 3084 : : } 3085 : : #endif 3086 : : - 3087 : 4936 : inet_sk(msk)->inet_num = inet_sk(ssk)->inet_num; - 3088 : 4936 : inet_sk(msk)->inet_dport = inet_sk(ssk)->inet_dport; - 3089 : 4936 : inet_sk(msk)->inet_sport = inet_sk(ssk)->inet_sport; - 3090 : 4936 : inet_sk(msk)->inet_daddr = inet_sk(ssk)->inet_daddr; - 3091 : 4936 : inet_sk(msk)->inet_saddr = inet_sk(ssk)->inet_saddr; - 3092 : 4936 : inet_sk(msk)->inet_rcv_saddr = inet_sk(ssk)->inet_rcv_saddr; - 3093 : 4936 : } + 3087 : 4928 : inet_sk(msk)->inet_num = inet_sk(ssk)->inet_num; + 3088 : 4928 : inet_sk(msk)->inet_dport = inet_sk(ssk)->inet_dport; + 3089 : 4928 : inet_sk(msk)->inet_sport = inet_sk(ssk)->inet_sport; + 3090 : 4928 : inet_sk(msk)->inet_daddr = inet_sk(ssk)->inet_daddr; + 3091 : 4928 : inet_sk(msk)->inet_saddr = inet_sk(ssk)->inet_saddr; + 3092 : 4928 : inet_sk(msk)->inet_rcv_saddr = inet_sk(ssk)->inet_rcv_saddr; + 3093 : 4928 : } 3094 : : 3095 : 58 : static int mptcp_disconnect(struct sock *sk, int flags) 3096 : : { @@ -3388,8 +3388,8 @@ 3295 : 3676 : __mptcp_clear_xmit(sk); 3296 : : 3297 : : /* join list will be eventually flushed (with rst) at sock lock release time */ - 3298 [ + + ]: 7910 : mptcp_for_each_subflow_safe(msk, subflow, tmp) - 3299 : 4234 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags); + 3298 [ + + ]: 7906 : mptcp_for_each_subflow_safe(msk, subflow, tmp) + 3299 : 4230 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags); 3300 : : 3301 : 3676 : __skb_queue_purge(&sk->sk_receive_queue); 3302 : 3676 : skb_rbtree_purge(&msk->out_of_order_queue); @@ -3412,23 +3412,23 @@ 3319 : 3618 : sk_sockets_allocated_dec(sk); 3320 : 3618 : } 3321 : : - 3322 : 277334 : void __mptcp_data_acked(struct sock *sk) + 3322 : 288725 : void __mptcp_data_acked(struct sock *sk) 3323 : : { - 3324 [ + + ]: 277334 : if (!sock_owned_by_user(sk)) - 3325 : 174361 : __mptcp_clean_una(sk); + 3324 [ + + ]: 288725 : if (!sock_owned_by_user(sk)) + 3325 : 198851 : __mptcp_clean_una(sk); 3326 : : else - 3327 [ - + ]: 102973 : __set_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->cb_flags); - 3328 : 277334 : } + 3327 [ - + ]: 89874 : __set_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->cb_flags); + 3328 : 288725 : } 3329 : : - 3330 : 1011405 : void __mptcp_check_push(struct sock *sk, struct sock *ssk) + 3330 : 1000586 : void __mptcp_check_push(struct sock *sk, struct sock *ssk) 3331 : : { - 3332 [ + + ]: 1011405 : if (!mptcp_send_head(sk)) + 3332 [ + + ]: 1000586 : if (!mptcp_send_head(sk)) 3333 : : return; 3334 : : - 3335 [ + + ]: 106308 : if (!sock_owned_by_user(sk)) - 3336 : 70359 : __mptcp_subflow_push_pending(sk, ssk, false); + 3335 [ + + ]: 119846 : if (!sock_owned_by_user(sk)) + 3336 : 86724 : __mptcp_subflow_push_pending(sk, ssk, false); 3337 : : else - 3338 [ - + ]: 35949 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); + 3338 [ - + ]: 33122 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); 3339 : : } 3340 : : 3341 : : #define MPTCP_FLAGS_PROCESS_CTX_NEED (BIT(MPTCP_PUSH_PENDING) | \ @@ -3437,20 +3437,20 @@ 3344 : : BIT(MPTCP_DEQUEUE)) 3345 : : 3346 : : /* processes deferred events and flush wmem */ - 3347 : 1249924 : static void mptcp_release_cb(struct sock *sk) + 3347 : 1370794 : static void mptcp_release_cb(struct sock *sk) 3348 : : __must_hold(&sk->sk_lock.slock) 3349 : : { - 3350 [ - + ]: 1249924 : struct mptcp_sock *msk = mptcp_sk(sk); + 3350 [ - + ]: 1370794 : struct mptcp_sock *msk = mptcp_sk(sk); 3351 : : - 3352 : 655973 : for (;;) { - 3353 : 1341399 : unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); - 3354 : 1341399 : struct list_head join_list; + 3352 : 653617 : for (;;) { + 3353 : 1460727 : unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); + 3354 : 1460727 : struct list_head join_list; 3355 : : - 3356 [ + + ]: 1341399 : if (!flags) + 3356 [ + + ]: 1460727 : if (!flags) 3357 : : break; 3358 : : - 3359 [ + + ]: 91475 : INIT_LIST_HEAD(&join_list); - 3360 [ + + ]: 91475 : list_splice_init(&msk->join_list, &join_list); + 3359 [ + + ]: 89933 : INIT_LIST_HEAD(&join_list); + 3360 [ + + ]: 89933 : list_splice_init(&msk->join_list, &join_list); 3361 : : 3362 : : /* the following actions acquire the subflow socket lock 3363 : : * @@ -3459,57 +3459,57 @@ 3366 : : * datapath acquires the msk socket spinlock while helding 3367 : : * the subflow socket lock 3368 : : */ - 3369 : 91475 : msk->cb_flags &= ~flags; - 3370 : 91475 : spin_unlock_bh(&sk->sk_lock.slock); + 3369 : 89933 : msk->cb_flags &= ~flags; + 3370 : 89933 : spin_unlock_bh(&sk->sk_lock.slock); 3371 : : - 3372 [ + + ]: 91475 : if (flags & BIT(MPTCP_FLUSH_JOIN_LIST)) - 3373 : 32 : __mptcp_flush_join_list(sk, &join_list); - 3374 [ + + ]: 91475 : if (flags & BIT(MPTCP_PUSH_PENDING)) - 3375 : 20496 : __mptcp_push_pending(sk, 0); - 3376 [ + + ]: 91475 : if (flags & BIT(MPTCP_RETRANSMIT)) - 3377 : 3413 : __mptcp_retrans(sk); - 3378 [ + + + + ]: 91475 : if ((flags & BIT(MPTCP_DEQUEUE)) && __mptcp_move_skbs(sk)) { + 3372 [ + + ]: 89933 : if (flags & BIT(MPTCP_FLUSH_JOIN_LIST)) + 3373 : 33 : __mptcp_flush_join_list(sk, &join_list); + 3374 [ + + ]: 89933 : if (flags & BIT(MPTCP_PUSH_PENDING)) + 3375 : 21635 : __mptcp_push_pending(sk, 0); + 3376 [ + + ]: 89933 : if (flags & BIT(MPTCP_RETRANSMIT)) + 3377 : 3298 : __mptcp_retrans(sk); + 3378 [ + + + + ]: 89933 : if ((flags & BIT(MPTCP_DEQUEUE)) && __mptcp_move_skbs(sk)) { 3379 : : /* notify ack seq update */ - 3380 : 54635 : mptcp_cleanup_rbuf(msk, 0); - 3381 : 54635 : sk->sk_data_ready(sk); + 3380 : 56174 : mptcp_cleanup_rbuf(msk, 0); + 3381 : 56174 : sk->sk_data_ready(sk); 3382 : : } 3383 : : - 3384 : 91475 : cond_resched(); - 3385 : 91475 : spin_lock_bh(&sk->sk_lock.slock); + 3384 : 89933 : cond_resched(); + 3385 : 89933 : spin_lock_bh(&sk->sk_lock.slock); 3386 : : } 3387 : : - 3388 [ - + - - : 1976615 : if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) - - - + + ] - 3389 : 62006 : __mptcp_clean_una_wakeup(sk); - 3390 [ + + ]: 1249924 : if (unlikely(msk->cb_flags)) { + 3388 [ - + - - : 2219848 : if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) + - - + + ] + 3389 : 64781 : __mptcp_clean_una_wakeup(sk); + 3390 [ + + ]: 1370794 : if (unlikely(msk->cb_flags)) { 3391 : : /* be sure to sync the msk state before taking actions 3392 : : * depending on sk_state (MPTCP_ERROR_REPORT) 3393 : : * On sk release avoid actions depending on the first subflow 3394 : : */ - 3395 [ - + - - : 6541 : if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) - - - + + + + 3395 [ - + - - : 6382 : if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) + - - + + + - ] - 3396 : 876 : __mptcp_sync_state(sk, msk->pending_state); - 3397 [ - + - - : 6541 : if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) - - - + + ] - 3398 : 422 : __mptcp_error_report(sk); - 3399 [ - + - - : 6541 : if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) - - - + + ] - 3400 : 2029 : __mptcp_sync_sndbuf(sk); + 3396 : 882 : __mptcp_sync_state(sk, msk->pending_state); + 3397 [ - + - - : 6382 : if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) + - - + + ] + 3398 : 439 : __mptcp_error_report(sk); + 3399 [ - + - - : 6382 : if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) + - - + + ] + 3400 : 1926 : __mptcp_sync_sndbuf(sk); 3401 : : } - 3402 : 1249924 : } + 3402 : 1370794 : } 3403 : : 3404 : : /* MP_JOIN client subflow must wait for 4th ack before sending any data: 3405 : : * TCP can't schedule delack timer before the subflow is fully established. 3406 : : * MPTCP uses the delack timer to do 3rd ack retransmissions 3407 : : */ - 3408 : 500 : static void schedule_3rdack_retransmission(struct sock *ssk) + 3408 : 499 : static void schedule_3rdack_retransmission(struct sock *ssk) 3409 : : { - 3410 : 500 : struct inet_connection_sock *icsk = inet_csk(ssk); - 3411 [ - + ]: 500 : struct tcp_sock *tp = tcp_sk(ssk); - 3412 : 500 : unsigned long timeout; + 3410 : 499 : struct inet_connection_sock *icsk = inet_csk(ssk); + 3411 [ - + ]: 499 : struct tcp_sock *tp = tcp_sk(ssk); + 3412 : 499 : unsigned long timeout; 3413 : : - 3414 [ + + + + ]: 500 : if (READ_ONCE(mptcp_subflow_ctx(ssk)->fully_established)) + 3414 [ + + + + ]: 499 : if (READ_ONCE(mptcp_subflow_ctx(ssk)->fully_established)) 3415 : : return; 3416 : : 3417 : : /* reschedule with a timeout above RTT, as we must look only for drop */ @@ -3526,30 +3526,30 @@ 3428 : 90 : sk_reset_timer(ssk, &icsk->icsk_delack_timer, timeout); 3429 : : } 3430 : : - 3431 : 31072 : void mptcp_subflow_process_delegated(struct sock *ssk, long status) + 3431 : 30041 : void mptcp_subflow_process_delegated(struct sock *ssk, long status) 3432 : : { - 3433 [ + + ]: 31072 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 3434 : 31072 : struct sock *sk = subflow->conn; + 3433 [ + + ]: 30041 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 3434 : 30041 : struct sock *sk = subflow->conn; 3435 : : - 3436 [ + + ]: 31072 : if (status & BIT(MPTCP_DELEGATE_SEND)) { - 3437 : 4056 : mptcp_data_lock(sk); - 3438 [ + + ]: 4056 : if (!sock_owned_by_user(sk)) - 3439 : 3701 : __mptcp_subflow_push_pending(sk, ssk, true); + 3436 [ + + ]: 30041 : if (status & BIT(MPTCP_DELEGATE_SEND)) { + 3437 : 4257 : mptcp_data_lock(sk); + 3438 [ + + ]: 4257 : if (!sock_owned_by_user(sk)) + 3439 : 3900 : __mptcp_subflow_push_pending(sk, ssk, true); 3440 : : else - 3441 [ - + ]: 355 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); - 3442 : 4056 : mptcp_data_unlock(sk); + 3441 [ - + ]: 357 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); + 3442 : 4257 : mptcp_data_unlock(sk); 3443 : : } - 3444 [ + + ]: 31072 : if (status & BIT(MPTCP_DELEGATE_SNDBUF)) { - 3445 : 26367 : mptcp_data_lock(sk); - 3446 [ + + ]: 26367 : if (!sock_owned_by_user(sk)) - 3447 : 23907 : __mptcp_sync_sndbuf(sk); + 3444 [ + + ]: 30041 : if (status & BIT(MPTCP_DELEGATE_SNDBUF)) { + 3445 : 25254 : mptcp_data_lock(sk); + 3446 [ + + ]: 25254 : if (!sock_owned_by_user(sk)) + 3447 : 22941 : __mptcp_sync_sndbuf(sk); 3448 : : else - 3449 [ - + ]: 2460 : __set_bit(MPTCP_SYNC_SNDBUF, &mptcp_sk(sk)->cb_flags); - 3450 : 26367 : mptcp_data_unlock(sk); + 3449 [ - + ]: 2313 : __set_bit(MPTCP_SYNC_SNDBUF, &mptcp_sk(sk)->cb_flags); + 3450 : 25254 : mptcp_data_unlock(sk); 3451 : : } - 3452 [ + + ]: 31072 : if (status & BIT(MPTCP_DELEGATE_ACK)) - 3453 : 500 : schedule_3rdack_retransmission(ssk); - 3454 : 31072 : } + 3452 [ + + ]: 30041 : if (status & BIT(MPTCP_DELEGATE_ACK)) + 3453 : 499 : schedule_3rdack_retransmission(ssk); + 3454 : 30041 : } 3455 : : 3456 : 0 : static int mptcp_hash(struct sock *sk) 3457 : : { @@ -3608,50 +3608,50 @@ 3510 : 4655 : write_unlock_bh(&sk->sk_callback_lock); 3511 : 4655 : } 3512 : : - 3513 : 994 : bool mptcp_finish_join(struct sock *ssk) + 3513 : 992 : bool mptcp_finish_join(struct sock *ssk) 3514 : : { - 3515 [ - + ]: 994 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 3516 [ - + ]: 994 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 3517 : 994 : struct sock *parent = (void *)msk; - 3518 : 994 : bool ret = true; + 3515 [ - + ]: 992 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 3516 [ - + ]: 992 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 3517 : 992 : struct sock *parent = (void *)msk; + 3518 : 992 : bool ret = true; 3519 : : - 3520 [ - + ]: 994 : pr_debug("msk=%p, subflow=%p\n", msk, subflow); + 3520 [ - + ]: 992 : pr_debug("msk=%p, subflow=%p\n", msk, subflow); 3521 : : 3522 : : /* mptcp socket already closing? */ - 3523 [ - + ]: 994 : if (!mptcp_is_fully_established(parent)) { + 3523 [ - + ]: 992 : if (!mptcp_is_fully_established(parent)) { 3524 : 0 : subflow->reset_reason = MPTCP_RST_EMPTCP; 3525 : 0 : return false; 3526 : : } 3527 : : 3528 : : /* active subflow, already present inside the conn_list */ - 3529 [ + + ]: 994 : if (!list_empty(&subflow->node)) { - 3530 : 488 : mptcp_subflow_joined(msk, ssk); - 3531 : 488 : mptcp_propagate_sndbuf(parent, ssk); - 3532 : 488 : return true; + 3529 [ + + ]: 992 : if (!list_empty(&subflow->node)) { + 3530 : 487 : mptcp_subflow_joined(msk, ssk); + 3531 : 487 : mptcp_propagate_sndbuf(parent, ssk); + 3532 : 487 : return true; 3533 : : } 3534 : : - 3535 [ - + ]: 506 : if (!mptcp_pm_allow_new_subflow(msk)) + 3535 [ - + ]: 505 : if (!mptcp_pm_allow_new_subflow(msk)) 3536 : 0 : goto err_prohibited; 3537 : : 3538 : : /* If we can't acquire msk socket lock here, let the release callback 3539 : : * handle it 3540 : : */ - 3541 : 506 : mptcp_data_lock(parent); - 3542 [ + + ]: 506 : if (!sock_owned_by_user(parent)) { + 3541 : 505 : mptcp_data_lock(parent); + 3542 [ + + ]: 505 : if (!sock_owned_by_user(parent)) { 3543 : 470 : ret = __mptcp_finish_join(msk, ssk); 3544 [ + - ]: 470 : if (ret) { 3545 : 470 : sock_hold(ssk); 3546 : 470 : list_add_tail(&subflow->node, &msk->conn_list); 3547 : : } 3548 : : } else { - 3549 : 36 : sock_hold(ssk); - 3550 [ - + ]: 36 : list_add_tail(&subflow->node, &msk->join_list); - 3551 [ - + - - : 36 : __set_bit(MPTCP_FLUSH_JOIN_LIST, &msk->cb_flags); + 3549 : 35 : sock_hold(ssk); + 3550 [ - + ]: 35 : list_add_tail(&subflow->node, &msk->join_list); + 3551 [ - + - - : 35 : __set_bit(MPTCP_FLUSH_JOIN_LIST, &msk->cb_flags); - - ] 3552 : : } - 3553 : 506 : mptcp_data_unlock(parent); + 3553 : 505 : mptcp_data_unlock(parent); 3554 : : - 3555 [ - + ]: 506 : if (!ret) { + 3555 [ - + ]: 505 : if (!ret) { 3556 : 0 : err_prohibited: 3557 : 0 : subflow->reset_reason = MPTCP_RST_EPROHIBIT; 3558 : 0 : return false; @@ -3660,13 +3660,13 @@ 3561 : : return true; 3562 : : } 3563 : : - 3564 : 1487 : static void mptcp_shutdown(struct sock *sk, int how) + 3564 : 1477 : static void mptcp_shutdown(struct sock *sk, int how) 3565 : : { - 3566 [ - + ]: 1487 : pr_debug("sk=%p, how=%d\n", sk, how); + 3566 [ - + ]: 1477 : pr_debug("sk=%p, how=%d\n", sk, how); 3567 : : - 3568 [ + - + + ]: 1487 : if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) - 3569 : 1383 : __mptcp_wr_shutdown(sk); - 3570 : 1487 : } + 3568 [ + - + + ]: 1477 : if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) + 3569 : 1395 : __mptcp_wr_shutdown(sk); + 3570 : 1477 : } 3571 : : 3572 : 16 : static int mptcp_ioctl_outq(const struct mptcp_sock *msk, u64 v) 3573 : : { @@ -3861,52 +3861,52 @@ 3761 [ + - ]: 542 : else if (sk->sk_family == AF_INET6) 3762 : 542 : err = inet6_bind_sk(ssk, uaddr, addr_len); 3763 : : #endif - 3764 [ - + ]: 1246 : if (!err) - 3765 : 1246 : mptcp_copy_inaddrs(sk, ssk); + 3764 [ + + ]: 1246 : if (!err) + 3765 : 1242 : mptcp_copy_inaddrs(sk, ssk); 3766 : : - 3767 : 0 : unlock: - 3768 : 1246 : release_sock(sk); + 3767 : 4 : unlock: + 3768 : 1246 : release_sock(sk); 3769 : 1246 : return err; 3770 : : } 3771 : : - 3772 : 1246 : static int mptcp_listen(struct socket *sock, int backlog) + 3772 : 1242 : static int mptcp_listen(struct socket *sock, int backlog) 3773 : : { - 3774 [ - + ]: 1246 : struct mptcp_sock *msk = mptcp_sk(sock->sk); - 3775 : 1246 : struct sock *sk = sock->sk; - 3776 : 1246 : struct sock *ssk; - 3777 : 1246 : int err; + 3774 [ - + ]: 1242 : struct mptcp_sock *msk = mptcp_sk(sock->sk); + 3775 : 1242 : struct sock *sk = sock->sk; + 3776 : 1242 : struct sock *ssk; + 3777 : 1242 : int err; 3778 : : - 3779 [ - + ]: 1246 : pr_debug("msk=%p\n", msk); + 3779 [ - + ]: 1242 : pr_debug("msk=%p\n", msk); 3780 : : - 3781 : 1246 : lock_sock(sk); + 3781 : 1242 : lock_sock(sk); 3782 : : - 3783 : 1246 : err = -EINVAL; - 3784 [ - + ]: 1246 : if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM) + 3783 : 1242 : err = -EINVAL; + 3784 [ - + ]: 1242 : if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM) 3785 : 0 : goto unlock; 3786 : : - 3787 : 1246 : ssk = __mptcp_nmpc_sk(msk); - 3788 [ - + ]: 1246 : if (IS_ERR(ssk)) { + 3787 : 1242 : ssk = __mptcp_nmpc_sk(msk); + 3788 [ - + ]: 1242 : if (IS_ERR(ssk)) { 3789 : 0 : err = PTR_ERR(ssk); 3790 : 0 : goto unlock; 3791 : : } 3792 : : - 3793 : 1246 : mptcp_set_state(sk, TCP_LISTEN); - 3794 : 1246 : sock_set_flag(sk, SOCK_RCU_FREE); + 3793 : 1242 : mptcp_set_state(sk, TCP_LISTEN); + 3794 : 1242 : sock_set_flag(sk, SOCK_RCU_FREE); 3795 : : - 3796 : 1246 : lock_sock(ssk); - 3797 : 1246 : err = __inet_listen_sk(ssk, backlog); - 3798 : 1246 : release_sock(ssk); - 3799 : 1246 : mptcp_set_state(sk, inet_sk_state_load(ssk)); + 3796 : 1242 : lock_sock(ssk); + 3797 : 1242 : err = __inet_listen_sk(ssk, backlog); + 3798 : 1242 : release_sock(ssk); + 3799 : 1242 : mptcp_set_state(sk, inet_sk_state_load(ssk)); 3800 : : - 3801 [ - + ]: 1246 : if (!err) { - 3802 : 1246 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); - 3803 : 1246 : mptcp_copy_inaddrs(sk, ssk); - 3804 : 1246 : mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CREATED); + 3801 [ - + ]: 1242 : if (!err) { + 3802 : 1242 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); + 3803 : 1242 : mptcp_copy_inaddrs(sk, ssk); + 3804 : 1242 : mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CREATED); 3805 : : } 3806 : : 3807 : 0 : unlock: - 3808 : 1246 : release_sock(sk); - 3809 : 1246 : return err; + 3808 : 1242 : release_sock(sk); + 3809 : 1242 : return err; 3810 : : } 3811 : : 3812 : 1220 : static int mptcp_stream_accept(struct socket *sock, struct socket *newsock, @@ -3959,11 +3959,11 @@ 3859 : : /* set ssk->sk_socket of accept()ed flows to mptcp socket. 3860 : : * This is needed so NOSPACE flag can be set from tcp stack. 3861 : : */ - 3862 [ + + ]: 2244 : mptcp_for_each_subflow(msk, subflow) { - 3863 [ + - ]: 1124 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3862 [ + + ]: 2246 : mptcp_for_each_subflow(msk, subflow) { + 3863 [ + - ]: 1126 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 3864 : : - 3865 [ + - ]: 1124 : if (!ssk->sk_socket) - 3866 : 1124 : mptcp_sock_graft(ssk, newsock); + 3865 [ + - ]: 1126 : if (!ssk->sk_socket) + 3866 : 1126 : mptcp_sock_graft(ssk, newsock); 3867 : : } 3868 : : 3869 : : /* Do late cleanup for the first subflow as necessary. Also @@ -3994,36 +3994,36 @@ 3894 : 1214 : return 0; 3895 : : } 3896 : : - 3897 : 369093 : static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) + 3897 : 438194 : static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) 3898 : : { - 3899 : 369093 : struct sock *sk = (struct sock *)msk; + 3899 : 438194 : struct sock *sk = (struct sock *)msk; 3900 : : - 3901 [ + + ]: 369093 : if (__mptcp_stream_is_writeable(sk, 1)) + 3901 [ + + ]: 438194 : if (__mptcp_stream_is_writeable(sk, 1)) 3902 : : return EPOLLOUT | EPOLLWRNORM; 3903 : : - 3904 : 117223 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - 3905 : 117223 : smp_mb__after_atomic(); /* NOSPACE is changed by mptcp_write_space() */ - 3906 [ + + ]: 117223 : if (__mptcp_stream_is_writeable(sk, 1)) + 3904 : 121971 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + 3905 : 121971 : smp_mb__after_atomic(); /* NOSPACE is changed by mptcp_write_space() */ + 3906 [ + + ]: 121971 : if (__mptcp_stream_is_writeable(sk, 1)) 3907 : : return EPOLLOUT | EPOLLWRNORM; 3908 : : 3909 : : return 0; 3910 : : } 3911 : : - 3912 : 652353 : static __poll_t mptcp_poll(struct file *file, struct socket *sock, + 3912 : 751128 : static __poll_t mptcp_poll(struct file *file, struct socket *sock, 3913 : : struct poll_table_struct *wait) 3914 : : { - 3915 : 652353 : struct sock *sk = sock->sk; - 3916 : 652353 : struct mptcp_sock *msk; - 3917 : 652353 : __poll_t mask = 0; - 3918 : 652353 : u8 shutdown; - 3919 : 652353 : int state; + 3915 : 751128 : struct sock *sk = sock->sk; + 3916 : 751128 : struct mptcp_sock *msk; + 3917 : 751128 : __poll_t mask = 0; + 3918 : 751128 : u8 shutdown; + 3919 : 751128 : int state; 3920 : : - 3921 [ - + ]: 652353 : msk = mptcp_sk(sk); - 3922 : 652353 : sock_poll_wait(file, sock, wait); + 3921 [ - + ]: 751128 : msk = mptcp_sk(sk); + 3922 : 751128 : sock_poll_wait(file, sock, wait); 3923 : : - 3924 : 652353 : state = inet_sk_state_load(sk); - 3925 [ - + ]: 652353 : pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags); - 3926 [ + + ]: 652353 : if (state == TCP_LISTEN) { + 3924 : 751128 : state = inet_sk_state_load(sk); + 3925 [ - + ]: 751128 : pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags); + 3926 [ + + ]: 751128 : if (state == TCP_LISTEN) { 3927 : 1888 : struct sock *ssk = READ_ONCE(msk->first); 3928 : : 3929 [ - + ]: 1888 : if (WARN_ON_ONCE(!ssk)) @@ -4032,18 +4032,18 @@ 3932 [ + + ]: 2832 : return inet_csk_listen_poll(ssk); 3933 : : } 3934 : : - 3935 : 650465 : shutdown = READ_ONCE(sk->sk_shutdown); - 3936 [ + + ]: 650465 : if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) - 3937 : 11405 : mask |= EPOLLHUP; - 3938 [ + + ]: 650465 : if (shutdown & RCV_SHUTDOWN) - 3939 : 199457 : mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; + 3935 : 749240 : shutdown = READ_ONCE(sk->sk_shutdown); + 3936 [ + + ]: 749240 : if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) + 3937 : 12302 : mask |= EPOLLHUP; + 3938 [ + + ]: 749240 : if (shutdown & RCV_SHUTDOWN) + 3939 : 212957 : mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; 3940 : : - 3941 [ + - ]: 650465 : if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { - 3942 : 650465 : mask |= mptcp_check_readable(sk); - 3943 [ + + ]: 650465 : if (shutdown & SEND_SHUTDOWN) - 3944 : 281372 : mask |= EPOLLOUT | EPOLLWRNORM; + 3941 [ + - ]: 749240 : if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { + 3942 : 749240 : mask |= mptcp_check_readable(sk); + 3943 [ + + ]: 749240 : if (shutdown & SEND_SHUTDOWN) + 3944 : 311046 : mask |= EPOLLOUT | EPOLLWRNORM; 3945 : : else - 3946 : 369093 : mask |= mptcp_check_writeable(msk); + 3946 : 438194 : mask |= mptcp_check_writeable(msk); 3947 [ # # # # ]: 0 : } else if (state == TCP_SYN_SENT && 3948 [ # # ]: 0 : inet_test_bit(DEFER_CONNECT, sk)) { 3949 : : /* cf tcp_poll() note about TFO */ @@ -4051,9 +4051,9 @@ 3951 : : } 3952 : : 3953 : : /* This barrier is coupled with smp_wmb() in __mptcp_error_report() */ - 3954 : 650465 : smp_rmb(); - 3955 [ + + ]: 650465 : if (READ_ONCE(sk->sk_err)) - 3956 : 24 : mask |= EPOLLERR; + 3954 : 749240 : smp_rmb(); + 3955 [ + + ]: 749240 : if (READ_ONCE(sk->sk_err)) + 3956 : 21 : mask |= EPOLLERR; 3957 : : 3958 : : return mask; 3959 : : } @@ -4088,40 +4088,40 @@ 3988 : : .flags = INET_PROTOSW_ICSK, 3989 : : }; 3990 : : - 3991 : 62587 : static int mptcp_napi_poll(struct napi_struct *napi, int budget) + 3991 : 43965 : static int mptcp_napi_poll(struct napi_struct *napi, int budget) 3992 : : { - 3993 : 62587 : struct mptcp_delegated_action *delegated; - 3994 : 62587 : struct mptcp_subflow_context *subflow; - 3995 : 62587 : int work_done = 0; + 3993 : 43965 : struct mptcp_delegated_action *delegated; + 3994 : 43965 : struct mptcp_subflow_context *subflow; + 3995 : 43965 : int work_done = 0; 3996 : : - 3997 : 62587 : delegated = container_of(napi, struct mptcp_delegated_action, napi); - 3998 [ + + ]: 126226 : while ((subflow = mptcp_subflow_delegated_next(delegated)) != NULL) { - 3999 : 63639 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3997 : 43965 : delegated = container_of(napi, struct mptcp_delegated_action, napi); + 3998 [ + + ]: 89118 : while ((subflow = mptcp_subflow_delegated_next(delegated)) != NULL) { + 3999 : 45153 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 4000 : : - 4001 : 63639 : bh_lock_sock_nested(ssk); - 4002 [ + + ]: 63639 : if (!sock_owned_by_user(ssk)) { - 4003 : 28358 : mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0)); + 4001 : 45153 : bh_lock_sock_nested(ssk); + 4002 [ + + ]: 45153 : if (!sock_owned_by_user(ssk)) { + 4003 : 27653 : mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0)); 4004 : : } else { 4005 : : /* tcp_release_cb_override already processed 4006 : : * the action or will do at next release_sock(). 4007 : : * In both case must dequeue the subflow here - on the same 4008 : : * CPU that scheduled it. 4009 : : */ - 4010 : 35281 : smp_wmb(); - 4011 : 35281 : clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status); + 4010 : 17500 : smp_wmb(); + 4011 : 17500 : clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status); 4012 : : } - 4013 : 63639 : bh_unlock_sock(ssk); - 4014 : 63639 : sock_put(ssk); + 4013 : 45153 : bh_unlock_sock(ssk); + 4014 : 45153 : sock_put(ssk); 4015 : : - 4016 [ + - ]: 63639 : if (++work_done == budget) + 4016 [ + - ]: 45153 : if (++work_done == budget) 4017 : : return budget; 4018 : : } 4019 : : 4020 : : /* always provide a 0 'work_done' argument, so that napi_complete_done 4021 : : * will not try accessing the NULL napi->dev ptr 4022 : : */ - 4023 : 62587 : napi_complete_done(napi, 0); - 4024 : 62587 : return work_done; + 4023 : 43965 : napi_complete_done(napi, 0); + 4024 : 43965 : return work_done; 4025 : : } 4026 : : 4027 : 4 : void __init mptcp_proto_init(void) diff --git a/html/lcov/export/mptcp/protocol.h.func-c.html b/html/lcov/export/mptcp/protocol.h.func-c.html index 85f22837..278b6898 100644 --- a/html/lcov/export/mptcp/protocol.h.func-c.html +++ b/html/lcov/export/mptcp/protocol.h.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 @@ -88,49 +88,49 @@ mptcp_send_active_reset_reason - 45 + 44 mptcp_do_fallback - 81 + 82 mptcp_pm_close_subflow - 93 + 91 __mptcp_do_fallback - 105 + 106 __mptcp_pm_close_subflow - 388 + 387 __mptcp_has_initial_subflow - 995 + 1019 mptcp_start_tout_timer - 1083 + 1063 @@ -144,175 +144,175 @@ mptcp_is_fully_established - 2158 + 2154 mptcp_space_from_win - 2924 + 2753 subflow_simultaneous_connect - 4991 + 5002 __mptcp_sync_sndbuf - 34188 + 33169 mptcp_check_infinite_map - 49362 + 56518 mptcp_subflow_delegate - 104770 + 84312 mptcp_subflow_delegated_next - 126226 + 89118 mptcp_rtx_head - 261053 + 287366 mptcp_propagate_sndbuf - 451938 + 416825 - __mptcp_stream_is_writeable + mptcp_send_next - 486316 + 506869 - mptcp_send_next + mptcp_write_space - 491319 + 526155 - mptcp_write_space + __mptcp_stream_is_writeable - 559987 + 560165 - mptcp_pending_tail + mptcp_check_fallback - 606383 + 667366 - mptcp_check_fallback + mptcp_pending_tail - 639696 + 682253 __tcp_can_send - 981856 + 987306 - __mptcp_subflow_active + mptcp_data_fin_enabled - 1041780 + 1084428 - mptcp_epollin_ready + __mptcp_space - 1086742 + 1160385 - mptcp_data_fin_enabled + __mptcp_subflow_active - 1228769 + 1172344 - __mptcp_space + mptcp_epollin_ready - 1333380 + 1217108 mptcp_stream_memory_free - 1460299 + 1572305 mptcp_notsent_lowat - 2066682 + 2254558 mptcp_subflow_get_map_offset - 3022893 + 3152291 mptcp_send_head - 3058490 + 3330386 mptcp_win_from_space - 3540446 + 3716998 __mptcp_check_fallback - 6400160 + 6867069 diff --git a/html/lcov/export/mptcp/protocol.h.func.html b/html/lcov/export/mptcp/protocol.h.func.html index 52a40819..2b361dca 100644 --- a/html/lcov/export/mptcp/protocol.h.func.html +++ b/html/lcov/export/mptcp/protocol.h.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 @@ -81,175 +81,175 @@ __mptcp_check_fallback - 6400160 + 6867069 __mptcp_do_fallback - 105 + 106 __mptcp_has_initial_subflow - 995 + 1019 __mptcp_pm_close_subflow - 388 + 387 __mptcp_space - 1333380 + 1160385 __mptcp_stream_is_writeable - 486316 + 560165 __mptcp_subflow_active - 1041780 + 1172344 __mptcp_sync_sndbuf - 34188 + 33169 __tcp_can_send - 981856 + 987306 mptcp_check_fallback - 639696 + 667366 mptcp_check_infinite_map - 49362 + 56518 mptcp_data_fin_enabled - 1228769 + 1084428 mptcp_do_fallback - 81 + 82 mptcp_epollin_ready - 1086742 + 1217108 mptcp_is_fully_established - 2158 + 2154 mptcp_notsent_lowat - 2066682 + 2254558 mptcp_pending_tail - 606383 + 682253 mptcp_pm_close_subflow - 93 + 91 mptcp_propagate_sndbuf - 451938 + 416825 mptcp_rtx_head - 261053 + 287366 mptcp_send_active_reset_reason - 45 + 44 mptcp_send_head - 3058490 + 3330386 mptcp_send_next - 491319 + 506869 mptcp_space_from_win - 2924 + 2753 mptcp_start_tout_timer - 1083 + 1063 @@ -263,21 +263,21 @@ mptcp_stream_memory_free - 1460299 + 1572305 mptcp_subflow_delegate - 104770 + 84312 mptcp_subflow_delegated_next - 126226 + 89118 @@ -291,28 +291,28 @@ mptcp_subflow_get_map_offset - 3022893 + 3152291 mptcp_win_from_space - 3540446 + 3716998 mptcp_write_space - 559987 + 526155 subflow_simultaneous_connect - 4991 + 5002 diff --git a/html/lcov/export/mptcp/protocol.h.gcov.html b/html/lcov/export/mptcp/protocol.h.gcov.html index 3bcc066c..59fdccb2 100644 --- a/html/lcov/export/mptcp/protocol.h.gcov.html +++ b/html/lcov/export/mptcp/protocol.h.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 71.9 % - 474 - 341 + 74.0 % + 526 + 389 @@ -214,17 +214,23 @@ 136 : : 137 : : #define MPTCP_SKB_CB(__skb) ((struct mptcp_skb_cb *)&((__skb)->cb[0])) 138 : : - 139 : 75921 : static inline bool before64(__u64 seq1, __u64 seq2) + 139 : 72252 : static inline bool before64(__u64 seq1, __u64 seq2) 140 : : { - 141 [ + + ][ + + : 7066543 : return (__s64)(seq1 - seq2) < 0; - + + + + + - + + + + + - + + - + + - + + + + + - + + + + + - + ][ + + + - + + + + + - + + + + ] + 141 [ + + - - : 7189613 : return (__s64)(seq1 - seq2) < 0; + + + + + + + + + + ][ + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + ][ + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + ] 142 : : } 143 : : 144 : : #define after64(seq2, seq1) before64(seq1, seq2) @@ -265,8 +271,8 @@ 179 : : 180 : 0 : static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field) 181 : : { - 182 [ + - + + : 867811 : return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) | - + + + - ] + 182 [ + - + + : 880178 : return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) | + + + + - ] 183 : : ((nib & 0xF) << 8) | field); 184 : : } 185 : : @@ -446,9 +452,9 @@ 359 : : 360 : : extern struct genl_family mptcp_genl_family; 361 : : - 362 : 268855 : static inline void msk_owned_by_me(const struct mptcp_sock *msk) + 362 : 268564 : static inline void msk_owned_by_me(const struct mptcp_sock *msk) 363 : : { - 364 : 791890 : sock_owned_by_me((const struct sock *)msk); + 364 : 756106 : sock_owned_by_me((const struct sock *)msk); 365 : : } 366 : : 367 : : #ifdef CONFIG_DEBUG_NET @@ -469,60 +475,60 @@ 382 : : #define mptcp_sk(ptr) container_of_const(ptr, struct mptcp_sock, sk.icsk_inet.sk) 383 : : #endif 384 : : - 385 : 3540446 : static inline int mptcp_win_from_space(const struct sock *sk, int space) + 385 : 3716998 : static inline int mptcp_win_from_space(const struct sock *sk, int space) 386 : : { - 387 [ - + ]: 3540446 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space); + 387 [ - + ]: 3716998 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space); 388 : : } 389 : : - 390 : 2924 : static inline int mptcp_space_from_win(const struct sock *sk, int win) + 390 : 2753 : static inline int mptcp_space_from_win(const struct sock *sk, int win) 391 : : { - 392 [ - + ]: 2924 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win); + 392 [ - + ]: 2753 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win); 393 : : } 394 : : - 395 : 1551216 : static inline int __mptcp_space(const struct sock *sk) + 395 : 1377055 : static inline int __mptcp_space(const struct sock *sk) 396 : : { - 397 : 2143594 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - - 398 : 448886 : sk_rmem_alloc_get(sk)); + 397 : 2260371 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - + 398 : 442423 : sk_rmem_alloc_get(sk)); 399 : : } 400 : : - 401 : 3058490 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk) + 401 : 3330386 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk) 402 : : { - 403 [ - + ]: 3058490 : const struct mptcp_sock *msk = mptcp_sk(sk); + 403 [ - + ]: 3330386 : const struct mptcp_sock *msk = mptcp_sk(sk); 404 : : - 405 : 3058490 : return READ_ONCE(msk->first_pending); + 405 : 3330386 : return READ_ONCE(msk->first_pending); 406 : : } 407 : : - 408 : 491319 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk) + 408 : 506869 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk) 409 : : { - 410 [ - + ]: 491319 : struct mptcp_sock *msk = mptcp_sk(sk); - 411 : 491319 : struct mptcp_data_frag *cur; + 410 [ - + ]: 506869 : struct mptcp_sock *msk = mptcp_sk(sk); + 411 : 506869 : struct mptcp_data_frag *cur; 412 : : - 413 : 491319 : cur = msk->first_pending; - 414 [ + + ]: 491319 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL : - 415 : 100226 : list_next_entry(cur, list); + 413 : 506869 : cur = msk->first_pending; + 414 [ + + ]: 506869 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL : + 415 : 109909 : list_next_entry(cur, list); 416 : : } 417 : : - 418 : 606383 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk) + 418 : 682253 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk) 419 : : { - 420 [ - + ]: 606383 : const struct mptcp_sock *msk = mptcp_sk(sk); + 420 [ - + ]: 682253 : const struct mptcp_sock *msk = mptcp_sk(sk); 421 : : - 422 [ + + ]: 606383 : if (!msk->first_pending) + 422 [ + + ]: 682253 : if (!msk->first_pending) 423 : : return NULL; 424 : : - 425 [ - + + - ]: 215320 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue))) + 425 [ - + + - ]: 285320 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue))) 426 : : return NULL; 427 : : - 428 : 215320 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list); + 428 : 285320 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list); 429 : : } 430 : : - 431 : 261053 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk) + 431 : 287366 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk) 432 : : { - 433 [ - + ]: 261053 : struct mptcp_sock *msk = mptcp_sk(sk); + 433 [ - + ]: 287366 : struct mptcp_sock *msk = mptcp_sk(sk); 434 : : - 435 [ + + ]: 261053 : if (msk->snd_una == msk->snd_nxt) + 435 [ + + ]: 287366 : if (msk->snd_una == msk->snd_nxt) 436 : : return NULL; 437 : : - 438 [ + + ]: 224443 : return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list); + 438 [ + + ]: 234610 : return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list); 439 : : } 440 : : 441 : : struct csum_pseudo_header { @@ -661,57 +667,62 @@ 574 : : static inline struct mptcp_subflow_context * 575 : 84 : mptcp_subflow_ctx(const struct sock *sk) 576 : : { - 577 [ - + + - ]: 5450 : const struct inet_connection_sock *icsk = inet_csk(sk); + 577 [ - + + - ]: 4937 : const struct inet_connection_sock *icsk = inet_csk(sk); 578 : : 579 : : /* Use RCU on icsk_ulp_data only for sock diag code */ - 580 [ + + ][ - + : 27730119 : return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data; + 580 [ + + ][ - + : 29104575 : return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data; + + - + - - + ][ + + + - - + - - + - - + + + + - + + + - + - - + + + + - + - + - - - - + + + + - - + + - + - - + - + + - + + - + + - - + ][ + + - + - - + - - + + + + + - + + + + + - + - + + + - - + + + + - + ][ + + - - + - + - + - + + - + + - - + + - + - - + - + - - + + + ] + + ][ + + + + - + + - + + + + + + + + + + + + + + - + + + + + + + + + + + - + + + + + - + + - + + - + - + + + + + - + + + - + ][ + + + + - + + - + + + + + + + + + + + - + + - + + + + + + + + - + + - + + + + + - + + - + + - + - + + + + + - + + + - + ][ + + + - + - + + - + + + - + + + - + + + - + - + - + + - + + + + ] 581 : : } 582 : : 583 : : static inline struct sock * 584 : 0 : mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow) 585 : : { - 586 [ + + + + : 4339003 : return subflow->tcp_sock; + 586 [ + + + + : 4657858 : return subflow->tcp_sock; + + ][ + + + + + + ] - [ - + + + ] - [ + - - + - + - + + + - + - + - - - + + + + + - + - - - + [ - + + + ] + [ + - - + + + - + + + + + - + - - + + + + + + + + - - - - ] 587 : : } 588 : : 589 : : static inline void 590 : 30 : mptcp_subflow_ctx_reset(struct mptcp_subflow_context *subflow) 591 : : { - 592 : 749 : memset(&subflow->reset, 0, sizeof(subflow->reset)); - 593 : 749 : subflow->request_mptcp = 1; - 594 : 749 : WRITE_ONCE(subflow->local_id, -1); - 595 : 749 : } + 592 : 800 : memset(&subflow->reset, 0, sizeof(subflow->reset)); + 593 : 800 : subflow->request_mptcp = 1; + 594 : 800 : WRITE_ONCE(subflow->local_id, -1); + 595 : 800 : } 596 : : 597 : : /* Convert reset reasons in MPTCP to enum sk_rst_reason type */ 598 : : static inline enum sk_rst_reason @@ -741,71 +752,71 @@ 622 : : } 623 : : 624 : : static inline void - 625 : 45 : mptcp_send_active_reset_reason(struct sock *sk) + 625 : 44 : mptcp_send_active_reset_reason(struct sock *sk) 626 : : { - 627 : 45 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 628 : 45 : enum sk_rst_reason reason; + 627 : 44 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 628 : 44 : enum sk_rst_reason reason; 629 : : - 630 [ + - ]: 45 : reason = sk_rst_convert_mptcp_reason(subflow->reset_reason); - 631 : 45 : tcp_send_active_reset(sk, GFP_ATOMIC, reason); - 632 : 45 : } + 630 [ + - ]: 44 : reason = sk_rst_convert_mptcp_reason(subflow->reset_reason); + 631 : 44 : tcp_send_active_reset(sk, GFP_ATOMIC, reason); + 632 : 44 : } 633 : : 634 : : static inline u64 - 635 : 3022893 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow) + 635 : 3152291 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow) 636 : : { - 637 [ - + ]: 3022893 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq - - 638 : 3022893 : subflow->ssn_offset - - 639 : 3022893 : subflow->map_subflow_seq; + 637 [ - + ]: 3152291 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq - + 638 : 3152291 : subflow->ssn_offset - + 639 : 3152291 : subflow->map_subflow_seq; 640 : : } 641 : : 642 : : static inline u64 - 643 : 148843 : mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) + 643 : 141418 : mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) 644 : : { - 645 [ + + ]: 1275356 : return subflow->map_seq + mptcp_subflow_get_map_offset(subflow); + 645 [ + + ]: 1328228 : return subflow->map_seq + mptcp_subflow_get_map_offset(subflow); 646 : : } 647 : : 648 : : void mptcp_subflow_process_delegated(struct sock *ssk, long actions); 649 : : - 650 : 104770 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action) + 650 : 84312 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action) 651 : : { - 652 [ - + ]: 104770 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action); - 653 : 104770 : struct mptcp_delegated_action *delegated; - 654 : 104770 : bool schedule; + 652 [ - + ]: 84312 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action); + 653 : 84312 : struct mptcp_delegated_action *delegated; + 654 : 84312 : bool schedule; 655 : : 656 : : /* the caller held the subflow bh socket lock */ - 657 [ + - + - : 104770 : lockdep_assert_in_softirq(); - + - + - - - + ] + 657 [ + - + - : 84312 : lockdep_assert_in_softirq(); + + - + - - + + ] 658 : : 659 : : /* The implied barrier pairs with tcp_release_cb_override() 660 : : * mptcp_napi_poll(), and ensures the below list check sees list 661 : : * updates done prior to delegated status bits changes 662 : : */ - 663 [ - + - + ]: 104770 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits); - 664 [ + + ]: 104770 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) { - 665 [ - + + - ]: 63639 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node))) + 663 [ - + - + ]: 84312 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits); + 664 [ + + ]: 84312 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) { + 665 [ - + + - ]: 45153 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node))) 666 : : return; 667 : : - 668 : 63639 : delegated = this_cpu_ptr(&mptcp_delegated_actions); - 669 : 63639 : schedule = list_empty(&delegated->head); - 670 : 63639 : list_add_tail(&subflow->delegated_node, &delegated->head); - 671 : 63639 : sock_hold(mptcp_subflow_tcp_sock(subflow)); - 672 [ + + ]: 63639 : if (schedule) - 673 : 62705 : napi_schedule(&delegated->napi); + 668 : 45153 : delegated = this_cpu_ptr(&mptcp_delegated_actions); + 669 : 45153 : schedule = list_empty(&delegated->head); + 670 : 45153 : list_add_tail(&subflow->delegated_node, &delegated->head); + 671 : 45153 : sock_hold(mptcp_subflow_tcp_sock(subflow)); + 672 [ + + ]: 45153 : if (schedule) + 673 : 44058 : napi_schedule(&delegated->napi); 674 : : } 675 : : } 676 : : 677 : : static inline struct mptcp_subflow_context * - 678 : 126226 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) + 678 : 89118 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) 679 : : { - 680 : 126226 : struct mptcp_subflow_context *ret; + 680 : 89118 : struct mptcp_subflow_context *ret; 681 : : - 682 [ + + ]: 126226 : if (list_empty(&delegated->head)) + 682 [ + + ]: 89118 : if (list_empty(&delegated->head)) 683 : : return NULL; 684 : : - 685 : 63639 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node); - 686 : 63639 : list_del_init(&ret->delegated_node); - 687 : 63639 : return ret; + 685 : 45153 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node); + 686 : 45153 : list_del_init(&ret->delegated_node); + 687 : 45153 : return ret; 688 : : } 689 : : 690 : : int mptcp_is_enabled(const struct net *net); @@ -874,43 +885,43 @@ 753 : : int mptcp_sched_get_send(struct mptcp_sock *msk); 754 : : int mptcp_sched_get_retrans(struct mptcp_sock *msk); 755 : : - 756 : 94634 : static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) + 756 : 88976 : static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) 757 : : { - 758 [ + + ]: 651864 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); + 758 [ + + ]: 690182 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); 759 : : } 760 : : - 761 : 1086742 : static inline bool mptcp_epollin_ready(const struct sock *sk) + 761 : 1217108 : static inline bool mptcp_epollin_ready(const struct sock *sk) 762 : : { - 763 [ - + ]: 1086742 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk)); + 763 [ - + ]: 1217108 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk)); 764 : : - 765 [ + + ]: 1086742 : if (!data_avail) + 765 [ + + ]: 1217108 : if (!data_avail) 766 : : return false; 767 : : 768 : : /* mptcp doesn't have to deal with small skbs in the receive queue, 769 : : * as it can always coalesce them 770 : : */ - 771 : 737078 : return (data_avail >= sk->sk_rcvlowat) || + 771 : 841086 : return (data_avail >= sk->sk_rcvlowat) || 772 : : (mem_cgroup_sockets_enabled && sk->sk_memcg && - 773 [ - + ]: 1474156 : mem_cgroup_under_socket_pressure(sk->sk_memcg)) || + 773 [ - + ]: 1682172 : mem_cgroup_under_socket_pressure(sk->sk_memcg)) || 774 [ # # ]: 0 : READ_ONCE(tcp_memory_pressure); 775 : : } 776 : : 777 : : int mptcp_set_rcvlowat(struct sock *sk, int val); 778 : : - 779 : 1222248 : static inline bool __tcp_can_send(const struct sock *ssk) + 779 : 1217868 : static inline bool __tcp_can_send(const struct sock *ssk) 780 : : { 781 : : /* only send if our side has not closed yet */ - 782 [ + + ]: 1278245 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); + 782 [ + + ]: 1422133 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); 783 : : } 784 : : - 785 : 1041780 : static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow) + 785 : 1172344 : static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow) 786 : : { 787 : : /* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */ - 788 [ + + + + : 1041780 : if (subflow->request_join && !READ_ONCE(subflow->fully_established)) - + + ] + 788 [ + + + + : 1172344 : if (subflow->request_join && !READ_ONCE(subflow->fully_established)) + + + ] 789 : : return false; 790 : : - 791 : 1041413 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); + 791 : 1171974 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); 792 : : } 793 : : 794 : : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow); @@ -961,16 +972,16 @@ 839 : 42 : inet_csk(sk)->icsk_mtup.probe_timestamp = tout ? : 1; 840 : : } 841 : : - 842 : 1083 : static inline void mptcp_start_tout_timer(struct sock *sk) + 842 : 1063 : static inline void mptcp_start_tout_timer(struct sock *sk) 843 : : { - 844 : 1083 : mptcp_set_close_tout(sk, tcp_jiffies32); - 845 [ - + ]: 1083 : mptcp_reset_tout_timer(mptcp_sk(sk), 0); - 846 : 1083 : } + 844 : 1063 : mptcp_set_close_tout(sk, tcp_jiffies32); + 845 [ - + ]: 1063 : mptcp_reset_tout_timer(mptcp_sk(sk), 0); + 846 : 1063 : } 847 : : - 848 : 2158 : static inline bool mptcp_is_fully_established(struct sock *sk) + 848 : 2154 : static inline bool mptcp_is_fully_established(struct sock *sk) 849 : : { - 850 [ + - ]: 2158 : return inet_sk_state_load(sk) == TCP_ESTABLISHED && - 851 [ - + - + : 2158 : READ_ONCE(mptcp_sk(sk)->fully_established); + 850 [ + - ]: 2154 : return inet_sk_state_load(sk) == TCP_ESTABLISHED && + 851 [ - + - + : 2154 : READ_ONCE(mptcp_sk(sk)->fully_established); - + ] 852 : : } 853 : : @@ -984,78 +995,78 @@ 861 : : char __user *optval, int __user *option); 862 : : 863 : : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq); - 864 : 201543 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit) + 864 : 194091 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit) 865 : : { - 866 [ + + ]: 1674035 : if (use_64bit) - [ + + + + ] + 866 [ + + + + ]: 1744084 : if (use_64bit) + [ + + + + ] 867 : : return cur_seq; 868 : : - 869 : 57845 : return __mptcp_expand_seq(old_seq, cur_seq); + 869 : 117071 : return __mptcp_expand_seq(old_seq, cur_seq); 870 : : } 871 : : void __mptcp_check_push(struct sock *sk, struct sock *ssk); 872 : : void __mptcp_data_acked(struct sock *sk); 873 : : void __mptcp_error_report(struct sock *sk); 874 : : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit); - 875 : 1430023 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) + 875 : 1283976 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) 876 : : { - 877 [ + + + + ]: 2033472 : return READ_ONCE(msk->snd_data_fin_enable) && - [ + + ] - 878 [ + + - + ]: 124631 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); - [ + + ] + 877 [ + + + + ]: 2147779 : return READ_ONCE(msk->snd_data_fin_enable) && + [ + + + + ] + 878 [ + + ]: 104666 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); + [ + + - + ] 879 : : } 880 : : - 881 : 2066682 : static inline u32 mptcp_notsent_lowat(const struct sock *sk) + 881 : 2254558 : static inline u32 mptcp_notsent_lowat(const struct sock *sk) 882 : : { - 883 [ - + ]: 2066682 : struct net *net = sock_net(sk); - 884 : 2066682 : u32 val; + 883 [ - + ]: 2254558 : struct net *net = sock_net(sk); + 884 : 2254558 : u32 val; 885 : : - 886 [ - + ]: 2066682 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat); - 887 [ + - ]: 2066682 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); + 886 [ - + ]: 2254558 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat); + 887 [ + - ]: 2254558 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); 888 : : } 889 : : - 890 : 1460299 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake) + 890 : 1572305 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake) 891 : : { - 892 [ - + ]: 1460299 : const struct mptcp_sock *msk = mptcp_sk(sk); - 893 : 1460299 : u32 notsent_bytes; + 892 [ - + ]: 1572305 : const struct mptcp_sock *msk = mptcp_sk(sk); + 893 : 1572305 : u32 notsent_bytes; 894 : : - 895 : 1460299 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt); - 896 [ - + ]: 1460299 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk); + 895 : 1572305 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt); + 896 [ - + ]: 1572305 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk); 897 : : } 898 : : - 899 : 486316 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake) + 899 : 560165 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake) 900 : : { - 901 [ + - + + ]: 972632 : return mptcp_stream_memory_free(sk, wake) && - 902 : 486316 : __sk_stream_is_writeable(sk, wake); + 901 [ + - + + ]: 1120330 : return mptcp_stream_memory_free(sk, wake) && + 902 : 560165 : __sk_stream_is_writeable(sk, wake); 903 : : } 904 : : - 905 : 559987 : static inline void mptcp_write_space(struct sock *sk) + 905 : 526155 : static inline void mptcp_write_space(struct sock *sk) 906 : : { 907 : : /* pairs with memory barrier in mptcp_poll */ - 908 : 559987 : smp_mb(); - 909 [ + - ]: 559987 : if (mptcp_stream_memory_free(sk, 1)) - 910 : 559987 : sk_stream_write_space(sk); - 911 : 559987 : } + 908 : 526155 : smp_mb(); + 909 [ + - ]: 526155 : if (mptcp_stream_memory_free(sk, 1)) + 910 : 526155 : sk_stream_write_space(sk); + 911 : 526155 : } 912 : : - 913 : 34188 : static inline void __mptcp_sync_sndbuf(struct sock *sk) + 913 : 33169 : static inline void __mptcp_sync_sndbuf(struct sock *sk) 914 : : { - 915 : 34188 : struct mptcp_subflow_context *subflow; - 916 : 34188 : int ssk_sndbuf, new_sndbuf; + 915 : 33169 : struct mptcp_subflow_context *subflow; + 916 : 33169 : int ssk_sndbuf, new_sndbuf; 917 : : - 918 [ + - ]: 34188 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) + 918 [ + - ]: 33169 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) 919 : : return; 920 : : - 921 [ - + ]: 34188 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]); - 922 [ - + - + : 101677 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) { - + + ] - 923 : 67489 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf); + 921 [ - + ]: 33169 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]); + 922 [ - + - + : 96768 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) { + + + ] + 923 : 63599 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf); 924 : : - 925 : 67489 : subflow->cached_sndbuf = ssk_sndbuf; - 926 : 67489 : new_sndbuf += ssk_sndbuf; + 925 : 63599 : subflow->cached_sndbuf = ssk_sndbuf; + 926 : 63599 : new_sndbuf += ssk_sndbuf; 927 : : } 928 : : 929 : : /* the msk max wmem limit is <nr_subflows> * tcp wmem[2] */ - 930 : 34188 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); - 931 : 34188 : mptcp_write_space(sk); + 930 : 33169 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); + 931 : 33169 : mptcp_write_space(sk); 932 : : } 933 : : 934 : : /* The called held both the msk socket and the subflow socket locks, @@ -1063,11 +1074,11 @@ 936 : : */ 937 : 186 : static inline void __mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) 938 : : { - 939 : 2882 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 939 : 2881 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 940 : : - 941 [ + + ]: 2882 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf) - [ + - + - ] - 942 : 2850 : __mptcp_sync_sndbuf(sk); + 941 [ + + ]: 2881 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf) + [ + - + - ] + 942 : 2849 : __mptcp_sync_sndbuf(sk); 943 : : } 944 : : 945 : : /* the caller held only the subflow socket lock, either in process or @@ -1075,16 +1086,16 @@ 947 : : * so we can't acquire such lock here: let the delegate action acquires 948 : : * the needed locks in suitable order. 949 : : */ - 950 : 451938 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) + 950 : 416825 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) 951 : : { - 952 : 451938 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 952 : 416825 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 953 : : - 954 [ + + ]: 451938 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf)) + 954 [ + + ]: 416825 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf)) 955 : : return; 956 : : - 957 : 100246 : local_bh_disable(); - 958 : 100246 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF); - 959 : 100246 : local_bh_enable(); + 957 : 79524 : local_bh_disable(); + 958 : 79524 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF); + 959 : 79524 : local_bh_enable(); 960 : : } 961 : : 962 : : void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags); @@ -1094,7 +1105,7 @@ 966 : : void __init mptcp_token_init(void); 967 : 126 : static inline void mptcp_token_init_request(struct request_sock *req) 968 : : { - 969 : 1840 : mptcp_subflow_rsk(req)->token_node.pprev = NULL; + 969 : 1839 : mptcp_subflow_rsk(req)->token_node.pprev = NULL; 970 : : } 971 : : 972 : : int mptcp_token_new_request(struct request_sock *req); @@ -1193,10 +1204,10 @@ 1065 : : struct netlink_callback *cb, 1066 : : struct mptcp_pm_addr_entry *entry); 1067 : : - 1068 : 408574 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) + 1068 : 403813 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) 1069 : : { - 1070 [ + + + - ]: 2007679 : return READ_ONCE(msk->pm.addr_signal) & - [ + + ] + 1070 [ + + + - ]: 2108215 : return READ_ONCE(msk->pm.addr_signal) & + [ + + ] 1071 : : (BIT(MPTCP_ADD_ADDR_SIGNAL) | BIT(MPTCP_ADD_ADDR_ECHO)); 1072 : : } 1073 : : @@ -1207,41 +1218,41 @@ 1078 : : 1079 : 6 : static inline bool mptcp_pm_should_add_signal_echo(struct mptcp_sock *msk) 1080 : : { - 1081 [ + + ]: 756 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_ECHO); + 1081 [ + + ]: 755 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_ECHO); 1082 : : } 1083 : : - 1084 : 408562 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) + 1084 : 403801 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) 1085 : : { - 1086 [ + + ]: 2005398 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL); + 1086 [ + + ]: 2105935 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL); 1087 : : } 1088 : : 1089 : 60 : static inline bool mptcp_pm_is_userspace(const struct mptcp_sock *msk) 1090 : : { - 1091 [ - + + + ]: 7273 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE; - [ + + + + - + + + + + - + ][ + + ] + 1091 [ - + + + ]: 7300 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE; + [ + + + + + + + + + + + + ][ + + ] 1092 : : } 1093 : : 1094 : 29 : static inline bool mptcp_pm_is_kernel(const struct mptcp_sock *msk) 1095 : : { - 1096 [ + + ]: 1085 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_KERNEL; + 1096 [ + + ]: 1109 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_KERNEL; [ - + - - ] 1097 : : } 1098 : : 1099 : 12 : static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port) 1100 : : { - 1101 : 1512 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + 1101 : 1510 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; 1102 : : - 1103 [ + + ]: 1512 : if (family == AF_INET6) - 1104 : 340 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; - 1105 [ + + ]: 1512 : if (!echo) + 1103 [ + + ]: 1510 : if (family == AF_INET6) + 1104 : 338 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; + 1105 [ + + ]: 1510 : if (!echo) 1106 : 808 : len += MPTCPOPT_THMAC_LEN; 1107 : : /* account for 2 trailing 'nop' options */ - 1108 [ + + ]: 1512 : if (port) + 1108 [ + + ]: 1510 : if (port) 1109 : 136 : len += TCPOLEN_MPTCP_PORT_LEN + TCPOLEN_MPTCP_PORT_ALIGN; 1110 : : - 1111 [ - + ]: 1512 : return len; + 1111 [ - + ]: 1510 : return len; 1112 : : } 1113 : : 1114 : 0 : static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list) @@ -1275,9 +1286,9 @@ 1142 : : 1143 : 72 : static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow) 1144 : : { - 1145 : 1020 : int local_id = READ_ONCE(subflow->local_id); + 1145 : 1018 : int local_id = READ_ONCE(subflow->local_id); 1146 : : - 1147 : 1020 : if (local_id < 0) + 1147 : 1018 : if (local_id < 0) 1148 : : return 0; 1149 : : return local_id; 1150 : : } @@ -1290,77 +1301,77 @@ 1157 : : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk); 1158 : : 1159 : : /* called under PM lock */ - 1160 : 388 : static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk) + 1160 : 387 : static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk) 1161 : : { - 1162 [ + - ]: 388 : if (--msk->pm.subflows < mptcp_pm_get_subflows_max(msk)) - 1163 : 388 : WRITE_ONCE(msk->pm.accept_subflow, true); - 1164 : 388 : } + 1162 [ + - ]: 387 : if (--msk->pm.subflows < mptcp_pm_get_subflows_max(msk)) + 1163 : 387 : WRITE_ONCE(msk->pm.accept_subflow, true); + 1164 : 387 : } 1165 : : - 1166 : 93 : static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk) + 1166 : 91 : static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk) 1167 : : { - 1168 : 93 : spin_lock_bh(&msk->pm.lock); - 1169 : 93 : __mptcp_pm_close_subflow(msk); - 1170 : 93 : spin_unlock_bh(&msk->pm.lock); - 1171 : 93 : } + 1168 : 91 : spin_lock_bh(&msk->pm.lock); + 1169 : 91 : __mptcp_pm_close_subflow(msk); + 1170 : 91 : spin_unlock_bh(&msk->pm.lock); + 1171 : 91 : } 1172 : : 1173 : : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk); 1174 : : 1175 : 0 : static inline struct mptcp_ext *mptcp_get_ext(const struct sk_buff *skb) 1176 : : { - 1177 [ + + + - : 2316502 : return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP); - + + - - - - - ][ + - + - + + - - - - ][ + - + - + + + + + - + + + - - - - ] + 1177 [ + - + + : 2473356 : return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP); + + + + + + + + + - - + - ][ + + + + - + + - - + - - ][ + - + + + + - - + - ] 1178 : : } 1179 : : 1180 : : void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops); 1181 : : - 1182 : 6400160 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk) + 1182 : 6867069 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk) 1183 : : { - 1184 [ - + - - : 6400160 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags); + 1184 [ - + - - : 6867069 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags); - - ] 1185 : : } 1186 : : - 1187 : 639696 : static inline bool mptcp_check_fallback(const struct sock *sk) + 1187 : 667366 : static inline bool mptcp_check_fallback(const struct sock *sk) 1188 : : { - 1189 : 639696 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1190 [ - + ]: 639696 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1189 : 667366 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1190 [ - + ]: 667366 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 1191 : : - 1192 : 639696 : return __mptcp_check_fallback(msk); + 1192 : 667366 : return __mptcp_check_fallback(msk); 1193 : : } 1194 : : - 1195 : 105 : static inline void __mptcp_do_fallback(struct mptcp_sock *msk) + 1195 : 106 : static inline void __mptcp_do_fallback(struct mptcp_sock *msk) 1196 : : { - 1197 [ - + ]: 105 : if (__mptcp_check_fallback(msk)) { + 1197 [ - + ]: 106 : if (__mptcp_check_fallback(msk)) { 1198 [ # # ]: 0 : pr_debug("TCP fallback already done (msk=%p)\n", msk); 1199 : 0 : return; 1200 : : } - 1201 : 105 : set_bit(MPTCP_FALLBACK_DONE, &msk->flags); + 1201 : 106 : set_bit(MPTCP_FALLBACK_DONE, &msk->flags); 1202 : : } 1203 : : - 1204 : 995 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) + 1204 : 1019 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) 1205 : : { - 1206 : 995 : struct sock *ssk = READ_ONCE(msk->first); + 1206 : 1019 : struct sock *ssk = READ_ONCE(msk->first); 1207 : : - 1208 [ + - + + : 1990 : return ssk && ((1 << inet_sk_state_load(ssk)) & - + + ] + 1208 [ + - + + : 2038 : return ssk && ((1 << inet_sk_state_load(ssk)) & + + + ] 1209 : : (TCPF_ESTABLISHED | TCPF_SYN_SENT | 1210 : : TCPF_SYN_RECV | TCPF_LISTEN)); 1211 : : } 1212 : : - 1213 : 81 : static inline void mptcp_do_fallback(struct sock *ssk) + 1213 : 82 : static inline void mptcp_do_fallback(struct sock *ssk) 1214 : : { - 1215 : 81 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1216 : 81 : struct sock *sk = subflow->conn; - 1217 : 81 : struct mptcp_sock *msk; + 1215 : 82 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1216 : 82 : struct sock *sk = subflow->conn; + 1217 : 82 : struct mptcp_sock *msk; 1218 : : - 1219 [ - + ]: 81 : msk = mptcp_sk(sk); - 1220 : 81 : __mptcp_do_fallback(msk); - 1221 [ - + - + : 81 : if (READ_ONCE(msk->snd_data_fin_enable) && !(ssk->sk_shutdown & SEND_SHUTDOWN)) { + 1219 [ - + ]: 82 : msk = mptcp_sk(sk); + 1220 : 82 : __mptcp_do_fallback(msk); + 1221 [ - + - + : 82 : if (READ_ONCE(msk->snd_data_fin_enable) && !(ssk->sk_shutdown & SEND_SHUTDOWN)) { - - ] 1222 : 0 : gfp_t saved_allocation = ssk->sk_allocation; 1223 : : @@ -1372,7 +1383,7 @@ 1229 : 0 : tcp_shutdown(ssk, SEND_SHUTDOWN); 1230 : 0 : ssk->sk_allocation = saved_allocation; 1231 : : } - 1232 : 81 : } + 1232 : 82 : } 1233 : : 1234 : : #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)\n", __func__, a) 1235 : : @@ -1384,31 +1395,31 @@ 1241 : 24 : __mptcp_do_fallback(msk); 1242 : 24 : } 1243 : : - 1244 : 49362 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb) + 1244 : 56518 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb) 1245 : : { - 1246 : 49362 : struct mptcp_ext *mpext; + 1246 : 56518 : struct mptcp_ext *mpext; 1247 : : - 1248 [ + + ]: 49362 : mpext = skb ? mptcp_get_ext(skb) : NULL; - 1249 [ + + + + ]: 9374 : if (mpext && mpext->infinite_map) - 1250 : 102 : return true; + 1248 [ + + ]: 56518 : mpext = skb ? mptcp_get_ext(skb) : NULL; + 1249 [ + + + + ]: 11856 : if (mpext && mpext->infinite_map) + 1250 : 1 : return true; 1251 : : 1252 : : return false; 1253 : : } 1254 : : 1255 : 246 : static inline bool is_active_ssk(struct mptcp_subflow_context *subflow) 1256 : : { - 1257 : 3414 : return (subflow->request_mptcp || subflow->request_join); + 1257 : 3417 : return (subflow->request_mptcp || subflow->request_join); 1258 : : } 1259 : : - 1260 : 4991 : static inline bool subflow_simultaneous_connect(struct sock *sk) + 1260 : 5002 : static inline bool subflow_simultaneous_connect(struct sock *sk) 1261 : : { - 1262 : 4991 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1262 : 5002 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1263 : : - 1264 : 2515 : return (1 << sk->sk_state) & - 1265 [ + + ]: 3414 : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && - 1266 [ + + + + : 4991 : is_active_ssk(subflow) && + 1264 : 2484 : return (1 << sk->sk_state) & + 1265 [ + + ]: 3417 : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && + 1266 [ + + + + : 5002 : is_active_ssk(subflow) && + + ] - 1267 [ + - ]: 1724 : !subflow->conn_finished; + 1267 [ + - ]: 1729 : !subflow->conn_finished; 1268 : : } 1269 : : 1270 : : #ifdef CONFIG_SYN_COOKIES diff --git a/html/lcov/export/mptcp/sched.c.func-c.html b/html/lcov/export/mptcp/sched.c.func-c.html index 4712df54..f2d295e8 100644 --- a/html/lcov/export/mptcp/sched.c.func-c.html +++ b/html/lcov/export/mptcp/sched.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 84.6 % @@ -144,28 +144,28 @@ mptcp_sched_get_retrans - 11638 + 11140 mptcp_sched_data_set_contexts - 195792 + 196299 mptcp_sched_get_send - 646369 + 746716 mptcp_subflow_set_scheduled - 829515 + 924003 diff --git a/html/lcov/export/mptcp/sched.c.func.html b/html/lcov/export/mptcp/sched.c.func.html index 9a10b577..aa289175 100644 --- a/html/lcov/export/mptcp/sched.c.func.html +++ b/html/lcov/export/mptcp/sched.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 84.6 % @@ -109,7 +109,7 @@ mptcp_sched_data_set_contexts - 195792 + 196299 @@ -137,14 +137,14 @@ mptcp_sched_get_retrans - 11638 + 11140 mptcp_sched_get_send - 646369 + 746716 @@ -158,7 +158,7 @@ mptcp_subflow_set_scheduled - 829515 + 924003 diff --git a/html/lcov/export/mptcp/sched.c.gcov.html b/html/lcov/export/mptcp/sched.c.gcov.html index ced4b0fe..21fe8f69 100644 --- a/html/lcov/export/mptcp/sched.c.gcov.html +++ b/html/lcov/export/mptcp/sched.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 84.6 % @@ -100,7 +100,7 @@ 22 : 0 : struct sock *ssk; 23 : : 24 : 0 : ssk = mptcp_subflow_get_send(msk); - 25 [ + + - - ]: 395043 : if (!ssk) + 25 [ + + - - ]: 493832 : if (!ssk) 26 : : return -EINVAL; 27 : : 28 : 0 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true); @@ -113,7 +113,7 @@ 35 : 0 : struct sock *ssk; 36 : : 37 : 0 : ssk = mptcp_subflow_get_retrans(msk); - 38 [ + + - - ]: 2295 : if (!ssk) + 38 [ + + - - ]: 2084 : if (!ssk) 39 : : return -EINVAL; 40 : : 41 : 0 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true); @@ -230,84 +230,84 @@ 148 : 3614 : bpf_module_put(sched, sched->owner); 149 : : } 150 : : - 151 : 311238 : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, + 151 : 404405 : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, 152 : : bool scheduled) 153 : : { 154 : 0 : WRITE_ONCE(subflow->scheduled, scheduled); - 155 : 829515 : } + 155 : 924003 : } 156 : : - 157 : 195792 : static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk, + 157 : 196299 : static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk, 158 : : struct mptcp_sched_data *data) 159 : : { - 160 : 195792 : struct mptcp_subflow_context *subflow; - 161 : 195792 : int i = 0; + 160 : 196299 : struct mptcp_subflow_context *subflow; + 161 : 196299 : int i = 0; 162 : : - 163 [ + + ]: 586829 : mptcp_for_each_subflow(msk, subflow) { - 164 [ - + ]: 391037 : if (i == MPTCP_SUBFLOWS_MAX) { + 163 [ + + ]: 588386 : mptcp_for_each_subflow(msk, subflow) { + 164 [ - + ]: 392087 : if (i == MPTCP_SUBFLOWS_MAX) { 165 [ # # # # ]: 0 : pr_warn_once("too many subflows"); 166 : : break; 167 : : } - 168 : 391037 : mptcp_subflow_set_scheduled(subflow, false); - 169 : 391037 : data->contexts[i++] = subflow; + 168 : 392087 : mptcp_subflow_set_scheduled(subflow, false); + 169 : 392087 : data->contexts[i++] = subflow; 170 : : } - 171 : 195792 : data->subflows = i; + 171 : 196299 : data->subflows = i; 172 : : - 173 [ + + ]: 1371091 : for (; i < MPTCP_SUBFLOWS_MAX; i++) - 174 : 1175299 : data->contexts[i] = NULL; - 175 : 195792 : } + 173 [ + + ]: 1374604 : for (; i < MPTCP_SUBFLOWS_MAX; i++) + 174 : 1178305 : data->contexts[i] = NULL; + 175 : 196299 : } 176 : : - 177 : 646369 : int mptcp_sched_get_send(struct mptcp_sock *msk) + 177 : 746716 : int mptcp_sched_get_send(struct mptcp_sock *msk) 178 : : { - 179 : 646369 : struct mptcp_subflow_context *subflow; - 180 : 646369 : struct mptcp_sched_data data; + 179 : 746716 : struct mptcp_subflow_context *subflow; + 180 : 746716 : struct mptcp_sched_data data; 181 : : - 182 : 646369 : msk_owned_by_me(msk); + 182 : 746716 : msk_owned_by_me(msk); 183 : : 184 : : /* the following check is moved out of mptcp_subflow_get_send */ - 185 [ + + ]: 646369 : if (__mptcp_check_fallback(msk)) { - 186 [ + - + - ]: 70472 : if (msk->first && - 187 [ + + ]: 60245 : __tcp_can_send(msk->first) && - 188 [ # # ]: 35236 : sk_stream_memory_free(msk->first)) { - 189 : 29330 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(msk->first), true); - 190 : 29330 : return 0; + 185 [ + + ]: 746716 : if (__mptcp_check_fallback(msk)) { + 186 [ + - + - ]: 72526 : if (msk->first && + 187 [ + + ]: 51833 : __tcp_can_send(msk->first) && + 188 [ # # ]: 36263 : sk_stream_memory_free(msk->first)) { + 189 : 31900 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(msk->first), true); + 190 : 31900 : return 0; 191 : : } - 192 : 5906 : return -EINVAL; + 192 : 4363 : return -EINVAL; 193 : : } 194 : : - 195 [ + + ]: 1778048 : mptcp_for_each_subflow(msk, subflow) { - 196 [ + + + + ]: 1190093 : if (READ_ONCE(subflow->scheduled)) + 195 [ + + ]: 1991721 : mptcp_for_each_subflow(msk, subflow) { + 196 [ + + + + ]: 1304497 : if (READ_ONCE(subflow->scheduled)) 197 : : return 0; 198 : : } 199 : : - 200 [ + + - + ]: 587955 : if (msk->sched == &mptcp_sched_default || !msk->sched) - 201 : 790086 : return mptcp_sched_default_get_send(msk, &data); - 202 : 192912 : mptcp_sched_data_set_contexts(msk, &data); - 203 : 192912 : return msk->sched->get_send(msk, &data); + 200 [ + + - + ]: 687224 : if (msk->sched == &mptcp_sched_default || !msk->sched) + 201 : 987664 : return mptcp_sched_default_get_send(msk, &data); + 202 : 193392 : mptcp_sched_data_set_contexts(msk, &data); + 203 : 193392 : return msk->sched->get_send(msk, &data); 204 : : } 205 : : - 206 : 11638 : int mptcp_sched_get_retrans(struct mptcp_sock *msk) + 206 : 11140 : int mptcp_sched_get_retrans(struct mptcp_sock *msk) 207 : : { - 208 : 11638 : struct mptcp_subflow_context *subflow; - 209 : 11638 : struct mptcp_sched_data data; + 208 : 11140 : struct mptcp_subflow_context *subflow; + 209 : 11140 : struct mptcp_sched_data data; 210 : : - 211 : 11638 : msk_owned_by_me(msk); + 211 : 11140 : msk_owned_by_me(msk); 212 : : 213 : : /* the following check is moved out of mptcp_subflow_get_retrans */ - 214 [ + + ]: 11638 : if (__mptcp_check_fallback(msk)) + 214 [ + + ]: 11140 : if (__mptcp_check_fallback(msk)) 215 : : return -EINVAL; 216 : : - 217 [ + + ]: 14974 : mptcp_for_each_subflow(msk, subflow) { - 218 [ + + + + ]: 9799 : if (READ_ONCE(subflow->scheduled)) + 217 [ + + ]: 14541 : mptcp_for_each_subflow(msk, subflow) { + 218 [ + + + + ]: 9550 : if (READ_ONCE(subflow->scheduled)) 219 : : return 0; 220 : : } 221 : : - 222 [ + + + + ]: 5175 : if (msk->sched == &mptcp_sched_default || !msk->sched) - 223 : 4590 : return mptcp_sched_default_get_retrans(msk, &data); + 222 [ + + + + ]: 4991 : if (msk->sched == &mptcp_sched_default || !msk->sched) + 223 : 4168 : return mptcp_sched_default_get_retrans(msk, &data); 224 : : - 225 : 2880 : mptcp_sched_data_set_contexts(msk, &data); - 226 [ + + ]: 2880 : if (msk->sched->get_retrans) - 227 : 3 : return msk->sched->get_retrans(msk, &data); - 228 : 2877 : return msk->sched->get_send(msk, &data); + 225 : 2907 : mptcp_sched_data_set_contexts(msk, &data); + 226 [ + + ]: 2907 : if (msk->sched->get_retrans) + 227 : 6 : return msk->sched->get_retrans(msk, &data); + 228 : 2901 : return msk->sched->get_send(msk, &data); 229 : : } diff --git a/html/lcov/export/mptcp/sockopt.c.func-c.html b/html/lcov/export/mptcp/sockopt.c.func-c.html index 44287a99..3c8a769b 100644 --- a/html/lcov/export/mptcp/sockopt.c.func-c.html +++ b/html/lcov/export/mptcp/sockopt.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 90.2 % @@ -221,7 +221,7 @@ sync_socket_options - 46 + 45 @@ -305,7 +305,7 @@ mptcp_diag_fill_info - 995 + 1019 diff --git a/html/lcov/export/mptcp/sockopt.c.func.html b/html/lcov/export/mptcp/sockopt.c.func.html index cd0c7d55..c981f4f0 100644 --- a/html/lcov/export/mptcp/sockopt.c.func.html +++ b/html/lcov/export/mptcp/sockopt.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 90.2 % @@ -109,7 +109,7 @@ mptcp_diag_fill_info - 995 + 1019 @@ -361,7 +361,7 @@ sync_socket_options - 46 + 45 diff --git a/html/lcov/export/mptcp/sockopt.c.gcov.html b/html/lcov/export/mptcp/sockopt.c.gcov.html index 6a01e1c4..d99a5855 100644 --- a/html/lcov/export/mptcp/sockopt.c.gcov.html +++ b/html/lcov/export/mptcp/sockopt.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 90.2 % @@ -236,12 +236,12 @@ 157 : : return ret; 158 : : 159 : 8 : lock_sock(sk); - 160 [ + + ]: 24 : mptcp_for_each_subflow(msk, subflow) { - 161 : 16 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 162 : 16 : bool slow = lock_sock_fast(ssk); + 160 [ + + ]: 22 : mptcp_for_each_subflow(msk, subflow) { + 161 : 14 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 162 : 14 : bool slow = lock_sock_fast(ssk); 163 : : - 164 : 16 : sock_set_timestamp(sk, optname, !!val); - 165 : 16 : unlock_sock_fast(ssk, slow); + 164 : 14 : sock_set_timestamp(sk, optname, !!val); + 165 : 14 : unlock_sock_fast(ssk, slow); 166 : : } 167 : : 168 : 8 : release_sock(sk); @@ -1015,62 +1015,62 @@ 932 : 6354 : return ret; 933 : : } 934 : : - 935 : 995 : void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) + 935 : 1019 : void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) 936 : : { - 937 : 995 : struct sock *sk = (struct sock *)msk; - 938 : 995 : u32 flags = 0; - 939 : 995 : bool slow; - 940 : 995 : u32 now; + 937 : 1019 : struct sock *sk = (struct sock *)msk; + 938 : 1019 : u32 flags = 0; + 939 : 1019 : bool slow; + 940 : 1019 : u32 now; 941 : : - 942 : 995 : memset(info, 0, sizeof(*info)); + 942 : 1019 : memset(info, 0, sizeof(*info)); 943 : : - 944 : 995 : info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); - 945 : 995 : info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); - 946 : 995 : info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); - 947 : 995 : info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); + 944 : 1019 : info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); + 945 : 1019 : info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); + 946 : 1019 : info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); + 947 : 1019 : info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); 948 : : - 949 [ + - ]: 995 : if (inet_sk_state_load(sk) == TCP_LISTEN) + 949 [ + - ]: 1019 : if (inet_sk_state_load(sk) == TCP_LISTEN) 950 : : return; 951 : : 952 : : /* The following limits only make sense for the in-kernel PM */ - 953 [ + + ]: 995 : if (mptcp_pm_is_kernel(msk)) { - 954 : 1886 : info->mptcpi_subflows_max = - 955 : 943 : mptcp_pm_get_subflows_max(msk); - 956 : 1886 : info->mptcpi_add_addr_signal_max = - 957 : 943 : mptcp_pm_get_add_addr_signal_max(msk); - 958 : 1886 : info->mptcpi_add_addr_accepted_max = - 959 : 943 : mptcp_pm_get_add_addr_accept_max(msk); - 960 : 943 : info->mptcpi_local_addr_max = - 961 : 943 : mptcp_pm_get_local_addr_max(msk); + 953 [ + + ]: 1019 : if (mptcp_pm_is_kernel(msk)) { + 954 : 1934 : info->mptcpi_subflows_max = + 955 : 967 : mptcp_pm_get_subflows_max(msk); + 956 : 1934 : info->mptcpi_add_addr_signal_max = + 957 : 967 : mptcp_pm_get_add_addr_signal_max(msk); + 958 : 1934 : info->mptcpi_add_addr_accepted_max = + 959 : 967 : mptcp_pm_get_add_addr_accept_max(msk); + 960 : 967 : info->mptcpi_local_addr_max = + 961 : 967 : mptcp_pm_get_local_addr_max(msk); 962 : : } 963 : : - 964 [ + + ]: 995 : if (__mptcp_check_fallback(msk)) - 965 : 3 : flags |= MPTCP_INFO_FLAG_FALLBACK; - 966 [ + + + + ]: 995 : if (READ_ONCE(msk->can_ack)) - 967 : 993 : flags |= MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED; - 968 : 995 : info->mptcpi_flags = flags; + 964 [ + + ]: 1019 : if (__mptcp_check_fallback(msk)) + 965 : 2 : flags |= MPTCP_INFO_FLAG_FALLBACK; + 966 [ + + + + ]: 1019 : if (READ_ONCE(msk->can_ack)) + 967 : 1017 : flags |= MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED; + 968 : 1019 : info->mptcpi_flags = flags; 969 : : - 970 : 995 : slow = lock_sock_fast(sk); - 971 [ - + ]: 995 : info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled); - 972 : 995 : info->mptcpi_token = msk->token; - 973 : 995 : info->mptcpi_write_seq = msk->write_seq; - 974 : 995 : info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits; - 975 : 995 : info->mptcpi_bytes_sent = msk->bytes_sent; - 976 : 995 : info->mptcpi_bytes_received = msk->bytes_received; - 977 : 995 : info->mptcpi_bytes_retrans = msk->bytes_retrans; - 978 : 1990 : info->mptcpi_subflows_total = info->mptcpi_subflows + - 979 : 995 : __mptcp_has_initial_subflow(msk); - 980 : 995 : now = tcp_jiffies32; - 981 : 995 : info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); - 982 : 995 : info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); - 983 : 995 : unlock_sock_fast(sk, slow); + 970 : 1019 : slow = lock_sock_fast(sk); + 971 [ - + ]: 1019 : info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled); + 972 : 1019 : info->mptcpi_token = msk->token; + 973 : 1019 : info->mptcpi_write_seq = msk->write_seq; + 974 : 1019 : info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits; + 975 : 1019 : info->mptcpi_bytes_sent = msk->bytes_sent; + 976 : 1019 : info->mptcpi_bytes_received = msk->bytes_received; + 977 : 1019 : info->mptcpi_bytes_retrans = msk->bytes_retrans; + 978 : 2038 : info->mptcpi_subflows_total = info->mptcpi_subflows + + 979 : 1019 : __mptcp_has_initial_subflow(msk); + 980 : 1019 : now = tcp_jiffies32; + 981 : 1019 : info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); + 982 : 1019 : info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); + 983 : 1019 : unlock_sock_fast(sk, slow); 984 : : - 985 : 995 : mptcp_data_lock(sk); - 986 : 995 : info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); - 987 : 995 : info->mptcpi_snd_una = msk->snd_una; - 988 : 995 : info->mptcpi_rcv_nxt = msk->ack_seq; - 989 : 995 : info->mptcpi_bytes_acked = msk->bytes_acked; - 990 : 995 : mptcp_data_unlock(sk); + 985 : 1019 : mptcp_data_lock(sk); + 986 : 1019 : info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); + 987 : 1019 : info->mptcpi_snd_una = msk->snd_una; + 988 : 1019 : info->mptcpi_rcv_nxt = msk->ack_seq; + 989 : 1019 : info->mptcpi_bytes_acked = msk->bytes_acked; + 990 : 1019 : mptcp_data_unlock(sk); 991 : : } 992 : : EXPORT_SYMBOL_GPL(mptcp_diag_fill_info); 993 : : @@ -1562,25 +1562,25 @@ 1476 : : return -EOPNOTSUPP; 1477 : : } 1478 : : - 1479 : 46 : static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) + 1479 : 45 : static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) 1480 : : { - 1481 : 46 : static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK; - 1482 : 46 : struct sock *sk = (struct sock *)msk; + 1481 : 45 : static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK; + 1482 : 45 : struct sock *sk = (struct sock *)msk; 1483 : : - 1484 [ + - ]: 46 : if (ssk->sk_prot->keepalive) { - 1485 [ - + ]: 46 : if (sock_flag(sk, SOCK_KEEPOPEN)) + 1484 [ + - ]: 45 : if (ssk->sk_prot->keepalive) { + 1485 [ - + ]: 45 : if (sock_flag(sk, SOCK_KEEPOPEN)) 1486 : 0 : ssk->sk_prot->keepalive(ssk, 1); 1487 : : else - 1488 : 46 : ssk->sk_prot->keepalive(ssk, 0); + 1488 : 45 : ssk->sk_prot->keepalive(ssk, 0); 1489 : : } 1490 : : - 1491 : 46 : ssk->sk_priority = sk->sk_priority; - 1492 : 46 : ssk->sk_bound_dev_if = sk->sk_bound_dev_if; - 1493 : 46 : ssk->sk_incoming_cpu = sk->sk_incoming_cpu; - 1494 : 46 : ssk->sk_ipv6only = sk->sk_ipv6only; - 1495 : 46 : __ip_sock_set_tos(ssk, inet_sk(sk)->tos); + 1491 : 45 : ssk->sk_priority = sk->sk_priority; + 1492 : 45 : ssk->sk_bound_dev_if = sk->sk_bound_dev_if; + 1493 : 45 : ssk->sk_incoming_cpu = sk->sk_incoming_cpu; + 1494 : 45 : ssk->sk_ipv6only = sk->sk_ipv6only; + 1495 : 45 : __ip_sock_set_tos(ssk, inet_sk(sk)->tos); 1496 : : - 1497 [ - + ]: 46 : if (sk->sk_userlocks & tx_rx_locks) { + 1497 [ - + ]: 45 : if (sk->sk_userlocks & tx_rx_locks) { 1498 : 0 : ssk->sk_userlocks |= sk->sk_userlocks & tx_rx_locks; 1499 [ # # ]: 0 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) { 1500 : 0 : WRITE_ONCE(ssk->sk_sndbuf, sk->sk_sndbuf); @@ -1590,37 +1590,37 @@ 1504 : 0 : WRITE_ONCE(ssk->sk_rcvbuf, sk->sk_rcvbuf); 1505 : : } 1506 : : - 1507 [ - + ]: 46 : if (sock_flag(sk, SOCK_LINGER)) { + 1507 [ - + ]: 45 : if (sock_flag(sk, SOCK_LINGER)) { 1508 : 0 : ssk->sk_lingertime = sk->sk_lingertime; 1509 : 0 : sock_set_flag(ssk, SOCK_LINGER); 1510 : : } else { - 1511 : 46 : sock_reset_flag(ssk, SOCK_LINGER); + 1511 : 45 : sock_reset_flag(ssk, SOCK_LINGER); 1512 : : } 1513 : : - 1514 [ + + ]: 46 : if (sk->sk_mark != ssk->sk_mark) { - 1515 : 30 : ssk->sk_mark = sk->sk_mark; - 1516 : 30 : sk_dst_reset(ssk); + 1514 [ + + ]: 45 : if (sk->sk_mark != ssk->sk_mark) { + 1515 : 29 : ssk->sk_mark = sk->sk_mark; + 1516 : 29 : sk_dst_reset(ssk); 1517 : : } 1518 : : - 1519 : 46 : sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG)); + 1519 : 45 : sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG)); 1520 : : - 1521 [ + - ]: 46 : if (inet_csk(sk)->icsk_ca_ops != inet_csk(ssk)->icsk_ca_ops) - 1522 : 46 : tcp_set_congestion_control(ssk, msk->ca_name, false, true); - 1523 : 46 : __tcp_sock_set_cork(ssk, !!msk->cork); - 1524 : 46 : __tcp_sock_set_nodelay(ssk, !!msk->nodelay); - 1525 : 46 : tcp_sock_set_keepidle_locked(ssk, msk->keepalive_idle); - 1526 : 46 : tcp_sock_set_keepintvl(ssk, msk->keepalive_intvl); - 1527 : 46 : tcp_sock_set_keepcnt(ssk, msk->keepalive_cnt); + 1521 [ + - ]: 45 : if (inet_csk(sk)->icsk_ca_ops != inet_csk(ssk)->icsk_ca_ops) + 1522 : 45 : tcp_set_congestion_control(ssk, msk->ca_name, false, true); + 1523 : 45 : __tcp_sock_set_cork(ssk, !!msk->cork); + 1524 : 45 : __tcp_sock_set_nodelay(ssk, !!msk->nodelay); + 1525 : 45 : tcp_sock_set_keepidle_locked(ssk, msk->keepalive_idle); + 1526 : 45 : tcp_sock_set_keepintvl(ssk, msk->keepalive_intvl); + 1527 : 45 : tcp_sock_set_keepcnt(ssk, msk->keepalive_cnt); 1528 : : - 1529 [ - + ]: 46 : inet_assign_bit(TRANSPARENT, ssk, inet_test_bit(TRANSPARENT, sk)); - 1530 [ - + ]: 46 : inet_assign_bit(FREEBIND, ssk, inet_test_bit(FREEBIND, sk)); - 1531 [ - + ]: 46 : inet_assign_bit(BIND_ADDRESS_NO_PORT, ssk, inet_test_bit(BIND_ADDRESS_NO_PORT, sk)); - 1532 : 46 : WRITE_ONCE(inet_sk(ssk)->local_port_range, READ_ONCE(inet_sk(sk)->local_port_range)); - 1533 : 46 : } + 1529 [ - + ]: 45 : inet_assign_bit(TRANSPARENT, ssk, inet_test_bit(TRANSPARENT, sk)); + 1530 [ - + ]: 45 : inet_assign_bit(FREEBIND, ssk, inet_test_bit(FREEBIND, sk)); + 1531 [ - + ]: 45 : inet_assign_bit(BIND_ADDRESS_NO_PORT, ssk, inet_test_bit(BIND_ADDRESS_NO_PORT, sk)); + 1532 : 45 : WRITE_ONCE(inet_sk(ssk)->local_port_range, READ_ONCE(inet_sk(sk)->local_port_range)); + 1533 : 45 : } 1534 : : 1535 : 3587 : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) 1536 : : { - 1537 [ - + ]: 3587 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1537 [ - + ]: 3587 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 1538 : : 1539 : 3587 : msk_owned_by_me(msk); 1540 : : @@ -1632,10 +1632,10 @@ 1546 : : */ 1547 [ - + ]: 3587 : tcp_sk(ssk)->notsent_lowat = UINT_MAX; 1548 : : - 1549 [ + + ]: 3587 : if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { - 1550 : 46 : sync_socket_options(msk, ssk); + 1549 [ + + ]: 3587 : if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { + 1550 : 45 : sync_socket_options(msk, ssk); 1551 : : - 1552 : 46 : subflow->setsockopt_seq = msk->setsockopt_seq; + 1552 : 45 : subflow->setsockopt_seq = msk->setsockopt_seq; 1553 : : } 1554 : 3587 : } 1555 : : diff --git a/html/lcov/export/mptcp/subflow.c.func-c.html b/html/lcov/export/mptcp/subflow.c.func-c.html index fb890dd7..7fc1384f 100644 --- a/html/lcov/export/mptcp/subflow.c.func-c.html +++ b/html/lcov/export/mptcp/subflow.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 63.1 % + 63.3 % 854 - 539 + 541 @@ -121,14 +121,14 @@ - subflow_can_fallback + mptcp_subflow_reset - 7 + 8 - mptcp_subflow_reset + subflow_can_fallback 8 @@ -186,70 +186,70 @@ subflow_v6_route_req - 302 + 301 subflow_v6_send_synack - 304 + 303 subflow_v6_req_destructor - 310 + 309 subflow_thmac_valid - 488 + 487 subflow_hmac_valid - 514 + 513 subflow_req_create_thmac - 516 + 515 subflow_token_join_request - 522 + 521 mptcp_can_accept_new_subflow - 536 + 535 __mptcp_subflow_connect - 628 + 627 mptcpv6_handle_mapped - 726 + 727 @@ -270,7 +270,7 @@ mptcp_info2sockaddr - 1146 + 1148 @@ -291,14 +291,14 @@ mptcp_subflow_queue_clean - 1252 + 1248 subflow_v4_send_synack - 1476 + 1478 @@ -326,98 +326,98 @@ subflow_v6_rebuild_header - 1566 + 1551 subflow_syn_recv_sock - 1770 + 1769 subflow_ulp_clone - 1770 + 1769 subflow_prep_synack - 1780 + 1781 - subflow_error_report + subflow_check_req - 1784 + 1785 - subflow_check_req + subflow_init_req - 1786 + 1833 - subflow_init_req + subflow_req_destructor - 1834 + 1833 - subflow_req_destructor + subflow_error_report - 1834 + 1882 subflow_generate_hmac - 2006 + 2002 __mptcp_subflow_fully_established - 2700 + 2699 mptcp_attach_cgroup - 3081 + 3082 mptcp_subflow_create_socket - 3146 + 3145 subflow_ulp_init - 3393 + 3394 subflow_set_remote_key - 3824 + 3823 @@ -429,121 +429,121 @@ - subflow_create_ctx + subflow_finish_connect - 4775 + 4694 - __subflow_state_change + subflow_create_ctx - 4991 + 4775 - subflow_state_change + __subflow_state_change - 4991 + 5002 - subflow_finish_connect + subflow_state_change - 5024 + 5002 mptcp_subflow_discard_data - 5479 + 5423 subflow_rebuild_header - 5719 + 6050 subflow_chk_local_id - 7285 + 7601 validate_mapping - 216148 + 230248 subflow_write_space - 451450 + 416338 tcp_release_cb_override - 529480 + 591097 subflow_sched_work_if_closed - 630098 + 656897 validate_data_csum - 634849 + 661318 subflow_data_ready - 659754 + 697946 get_mapping_status - 1262336 + 1316834 mptcp_subflow_data_available - 1304991 + 1369597 subflow_check_data_avail - 1304991 + 1369597 mptcp_space - 1395537 + 1455556 diff --git a/html/lcov/export/mptcp/subflow.c.func.html b/html/lcov/export/mptcp/subflow.c.func.html index 75015bf6..6549c8e6 100644 --- a/html/lcov/export/mptcp/subflow.c.func.html +++ b/html/lcov/export/mptcp/subflow.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 63.1 % + 63.3 % 854 - 539 + 541 @@ -81,14 +81,14 @@ __mptcp_subflow_connect - 628 + 627 __mptcp_subflow_fully_established - 2700 + 2699 @@ -102,7 +102,7 @@ __subflow_state_change - 4991 + 5002 @@ -116,21 +116,21 @@ get_mapping_status - 1262336 + 1316834 mptcp_attach_cgroup - 3081 + 3082 mptcp_can_accept_new_subflow - 536 + 535 @@ -144,7 +144,7 @@ mptcp_info2sockaddr - 1146 + 1148 @@ -158,28 +158,28 @@ mptcp_space - 1395537 + 1455556 mptcp_subflow_create_socket - 3146 + 3145 mptcp_subflow_data_available - 1304991 + 1369597 mptcp_subflow_discard_data - 5479 + 5423 @@ -214,7 +214,7 @@ mptcp_subflow_queue_clean - 1252 + 1248 @@ -235,7 +235,7 @@ mptcpv6_handle_mapped - 726 + 727 @@ -256,28 +256,28 @@ subflow_can_fallback - 7 + 8 subflow_check_data_avail - 1304991 + 1369597 subflow_check_req - 1786 + 1785 subflow_chk_local_id - 7285 + 7601 @@ -291,42 +291,42 @@ subflow_data_ready - 659754 + 697946 subflow_error_report - 1784 + 1882 subflow_finish_connect - 5024 + 4694 subflow_generate_hmac - 2006 + 2002 subflow_hmac_valid - 514 + 513 subflow_init_req - 1834 + 1833 @@ -340,28 +340,28 @@ subflow_prep_synack - 1780 + 1781 subflow_rebuild_header - 5719 + 6050 subflow_req_create_thmac - 516 + 515 subflow_req_destructor - 1834 + 1833 @@ -375,7 +375,7 @@ subflow_sched_work_if_closed - 630098 + 656897 @@ -389,42 +389,42 @@ subflow_set_remote_key - 3824 + 3823 subflow_state_change - 4991 + 5002 subflow_syn_recv_sock - 1770 + 1769 subflow_thmac_valid - 488 + 487 subflow_token_join_request - 522 + 521 subflow_ulp_clone - 1770 + 1769 @@ -438,7 +438,7 @@ subflow_ulp_init - 3393 + 3394 @@ -473,7 +473,7 @@ subflow_v4_send_synack - 1476 + 1478 @@ -487,35 +487,35 @@ subflow_v6_rebuild_header - 1566 + 1551 subflow_v6_req_destructor - 310 + 309 subflow_v6_route_req - 302 + 301 subflow_v6_send_synack - 304 + 303 subflow_write_space - 451450 + 416338 @@ -529,21 +529,21 @@ tcp_release_cb_override - 529480 + 591097 validate_data_csum - 634849 + 661318 validate_mapping - 216148 + 230248 diff --git a/html/lcov/export/mptcp/subflow.c.gcov.html b/html/lcov/export/mptcp/subflow.c.gcov.html index 455f151d..1bd1ecdd 100644 --- a/html/lcov/export/mptcp/subflow.c.gcov.html +++ b/html/lcov/export/mptcp/subflow.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 63.1 % + 63.3 % 854 - 539 + 541 @@ -118,91 +118,91 @@ - - - - ] 36 : : } 37 : : - 38 : 1834 : static void subflow_req_destructor(struct request_sock *req) + 38 : 1833 : static void subflow_req_destructor(struct request_sock *req) 39 : : { - 40 : 1834 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 40 : 1833 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 41 : : - 42 [ - + ]: 1834 : pr_debug("subflow_req=%p\n", subflow_req); + 42 [ - + ]: 1833 : pr_debug("subflow_req=%p\n", subflow_req); 43 : : - 44 [ + + ]: 1834 : if (subflow_req->msk) + 44 [ + + ]: 1833 : if (subflow_req->msk) 45 : 30 : sock_put((struct sock *)subflow_req->msk); 46 : : - 47 : 1834 : mptcp_token_destroy_request(req); - 48 : 1834 : } + 47 : 1833 : mptcp_token_destroy_request(req); + 48 : 1833 : } 49 : : - 50 : 2006 : static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, + 50 : 2002 : static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, 51 : : void *hmac) 52 : : { - 53 : 2006 : u8 msg[8]; + 53 : 2002 : u8 msg[8]; 54 : : - 55 : 2006 : put_unaligned_be32(nonce1, &msg[0]); - 56 : 2006 : put_unaligned_be32(nonce2, &msg[4]); + 55 : 2002 : put_unaligned_be32(nonce1, &msg[0]); + 56 : 2002 : put_unaligned_be32(nonce2, &msg[4]); 57 : : - 58 : 2006 : mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac); - 59 : 2006 : } + 58 : 2002 : mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac); + 59 : 2002 : } 60 : : - 61 : 536 : static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk) + 61 : 535 : static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk) 62 : : { - 63 [ + - + + ]: 536 : return mptcp_is_fully_established((void *)msk) && + 63 [ + - + + ]: 535 : return mptcp_is_fully_established((void *)msk) && 64 [ + + - - ]: 86 : ((mptcp_pm_is_userspace(msk) && 65 : 26 : mptcp_userspace_pm_active(msk)) || - 66 [ + + + + ]: 514 : READ_ONCE(msk->pm.accept_subflow)); + 66 [ + + + + ]: 513 : READ_ONCE(msk->pm.accept_subflow)); 67 : : } 68 : : 69 : : /* validate received token and create truncated hmac and nonce for SYN-ACK */ - 70 : 516 : static void subflow_req_create_thmac(struct mptcp_subflow_request_sock *subflow_req) + 70 : 515 : static void subflow_req_create_thmac(struct mptcp_subflow_request_sock *subflow_req) 71 : : { - 72 : 516 : struct mptcp_sock *msk = subflow_req->msk; - 73 : 516 : u8 hmac[SHA256_DIGEST_SIZE]; + 72 : 515 : struct mptcp_sock *msk = subflow_req->msk; + 73 : 515 : u8 hmac[SHA256_DIGEST_SIZE]; 74 : : - 75 : 516 : get_random_bytes(&subflow_req->local_nonce, sizeof(u32)); + 75 : 515 : get_random_bytes(&subflow_req->local_nonce, sizeof(u32)); 76 : : - 77 : 516 : subflow_generate_hmac(READ_ONCE(msk->local_key), - 78 : 516 : READ_ONCE(msk->remote_key), + 77 : 515 : subflow_generate_hmac(READ_ONCE(msk->local_key), + 78 : 515 : READ_ONCE(msk->remote_key), 79 : : subflow_req->local_nonce, 80 : : subflow_req->remote_nonce, hmac); 81 : : - 82 : 516 : subflow_req->thmac = get_unaligned_be64(hmac); - 83 : 516 : } + 82 : 515 : subflow_req->thmac = get_unaligned_be64(hmac); + 83 : 515 : } 84 : : - 85 : 522 : static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) + 85 : 521 : static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) 86 : : { - 87 : 522 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 88 : 522 : struct mptcp_sock *msk; - 89 : 522 : int local_id; + 87 : 521 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 88 : 521 : struct mptcp_sock *msk; + 89 : 521 : int local_id; 90 : : - 91 : 522 : msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); - 92 [ + + ]: 522 : if (!msk) { + 91 : 521 : msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); + 92 [ + + ]: 521 : if (!msk) { 93 [ + - ]: 6 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINNOTOKEN); 94 : 6 : return NULL; 95 : : } 96 : : - 97 : 516 : local_id = mptcp_pm_get_local_id(msk, (struct sock_common *)req); - 98 [ - + ]: 516 : if (local_id < 0) { + 97 : 515 : local_id = mptcp_pm_get_local_id(msk, (struct sock_common *)req); + 98 [ - + ]: 515 : if (local_id < 0) { 99 : 0 : sock_put((struct sock *)msk); 100 : 0 : return NULL; 101 : : } - 102 : 516 : subflow_req->local_id = local_id; - 103 : 516 : subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); + 102 : 515 : subflow_req->local_id = local_id; + 103 : 515 : subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); 104 : : - 105 : 516 : return msk; + 105 : 515 : return msk; 106 : : } 107 : : - 108 : 1834 : static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) + 108 : 1833 : static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) 109 : : { - 110 : 1834 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 110 : 1833 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 111 : : - 112 : 1834 : subflow_req->mp_capable = 0; - 113 : 1834 : subflow_req->mp_join = 0; - 114 : 1834 : subflow_req->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk_listener)); - 115 : 1834 : subflow_req->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk_listener)); - 116 : 1834 : subflow_req->msk = NULL; - 117 : 1834 : mptcp_token_init_request(req); - 118 : 1834 : } + 112 : 1833 : subflow_req->mp_capable = 0; + 113 : 1833 : subflow_req->mp_join = 0; + 114 : 1833 : subflow_req->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk_listener)); + 115 : 1833 : subflow_req->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk_listener)); + 116 : 1833 : subflow_req->msk = NULL; + 117 : 1833 : mptcp_token_init_request(req); + 118 : 1833 : } 119 : : 120 : 120 : static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk) 121 : : { - 122 : 1022 : return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport; + 122 : 1020 : return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport; 123 : : } 124 : : 125 : 18 : static void subflow_add_reset_reason(struct sk_buff *skb, u8 reason) @@ -227,16 +227,16 @@ 144 : : * Returns an error code if a JOIN has failed and a TCP reset 145 : : * should be sent. 146 : : */ - 147 : 1786 : static int subflow_check_req(struct request_sock *req, + 147 : 1785 : static int subflow_check_req(struct request_sock *req, 148 : : const struct sock *sk_listener, 149 : : struct sk_buff *skb) 150 : : { - 151 [ - + ]: 1786 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener); - 152 : 1786 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 153 : 1786 : struct mptcp_options_received mp_opt; - 154 : 1786 : bool opt_mp_capable, opt_mp_join; + 151 [ - + ]: 1785 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener); + 152 : 1785 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 153 : 1785 : struct mptcp_options_received mp_opt; + 154 : 1785 : bool opt_mp_capable, opt_mp_join; 155 : : - 156 [ - + ]: 1786 : pr_debug("subflow_req=%p, listener=%p\n", subflow_req, listener); + 156 [ - + ]: 1785 : pr_debug("subflow_req=%p, listener=%p\n", subflow_req, listener); 157 : : 158 : : #ifdef CONFIG_TCP_MD5SIG 159 : : /* no MPTCP if MD5SIG is enabled on this socket or we may run out of @@ -248,27 +248,27 @@ 165 : : } 166 : : #endif 167 : : - 168 : 1786 : mptcp_get_options(skb, &mp_opt); + 168 : 1785 : mptcp_get_options(skb, &mp_opt); 169 : : - 170 : 1786 : opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN); - 171 : 1786 : opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN); - 172 [ + + ]: 1786 : if (opt_mp_capable) { + 170 : 1785 : opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN); + 171 : 1785 : opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN); + 172 [ + + ]: 1785 : if (opt_mp_capable) { 173 [ + - ]: 1188 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE); 174 : : 175 [ + + + + ]: 1188 : if (unlikely(listener->pm_listener)) 176 : 2 : return subflow_reset_req_endp(req, skb); 177 [ - + ]: 1186 : if (opt_mp_join) 178 : : return 0; - 179 [ + + ]: 598 : } else if (opt_mp_join) { - 180 [ + - ]: 522 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); + 179 [ + + ]: 597 : } else if (opt_mp_join) { + 180 [ + - ]: 521 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); 181 : : - 182 [ + + ]: 522 : if (mp_opt.backup) + 182 [ + + ]: 521 : if (mp_opt.backup) 183 [ + - ]: 20 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNBACKUPRX); 184 [ - + - + ]: 76 : } else if (unlikely(listener->pm_listener)) { 185 : 0 : return subflow_reset_req_endp(req, skb); 186 : : } 187 : : - 188 [ + + + - ]: 1784 : if (opt_mp_capable && listener->request_mptcp) { + 188 [ + + + - ]: 1783 : if (opt_mp_capable && listener->request_mptcp) { 189 : 1186 : int err, retries = MPTCP_TOKEN_MAX_RETRIES; 190 : : 191 : 1186 : subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq; @@ -299,22 +299,22 @@ 216 : : else 217 [ # # ]: 0 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_TOKENFALLBACKINIT); 218 : : - 219 [ + + - + ]: 598 : } else if (opt_mp_join && listener->request_mptcp) { - 220 : 522 : subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq; - 221 : 522 : subflow_req->mp_join = 1; - 222 : 522 : subflow_req->backup = mp_opt.backup; - 223 : 522 : subflow_req->remote_id = mp_opt.join_id; - 224 : 522 : subflow_req->token = mp_opt.token; - 225 : 522 : subflow_req->remote_nonce = mp_opt.nonce; - 226 : 522 : subflow_req->msk = subflow_token_join_request(req); + 219 [ + + - + ]: 597 : } else if (opt_mp_join && listener->request_mptcp) { + 220 : 521 : subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq; + 221 : 521 : subflow_req->mp_join = 1; + 222 : 521 : subflow_req->backup = mp_opt.backup; + 223 : 521 : subflow_req->remote_id = mp_opt.join_id; + 224 : 521 : subflow_req->token = mp_opt.token; + 225 : 521 : subflow_req->remote_nonce = mp_opt.nonce; + 226 : 521 : subflow_req->msk = subflow_token_join_request(req); 227 : : 228 : : /* Can't fall back to TCP in this case. */ - 229 [ + + ]: 522 : if (!subflow_req->msk) { + 229 [ + + ]: 521 : if (!subflow_req->msk) { 230 : 6 : subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP); 231 : 6 : return -EPERM; 232 : : } 233 : : - 234 [ + + ]: 516 : if (subflow_use_different_sport(subflow_req->msk, sk_listener)) { + 234 [ + + ]: 515 : if (subflow_use_different_sport(subflow_req->msk, sk_listener)) { 235 [ - + ]: 24 : pr_debug("syn inet_sport=%d %d\n", 236 : : ntohs(inet_sk(sk_listener)->inet_sport), 237 : : ntohs(inet_sk((struct sock *)subflow_req->msk)->inet_sport)); @@ -326,9 +326,9 @@ 243 [ + - ]: 24 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINPORTSYNRX); 244 : : } 245 : : - 246 : 516 : subflow_req_create_thmac(subflow_req); + 246 : 515 : subflow_req_create_thmac(subflow_req); 247 : : - 248 [ + + ]: 516 : if (unlikely(req->syncookie)) { + 248 [ + + ]: 515 : if (unlikely(req->syncookie)) { 249 [ + + ]: 22 : if (!mptcp_can_accept_new_subflow(subflow_req->msk)) { 250 : 2 : subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT); 251 : 2 : return -EPERM; @@ -337,7 +337,7 @@ 254 : 20 : subflow_init_req_cookie_join_save(subflow_req, skb); 255 : : } 256 : : - 257 [ + - ]: 514 : pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token, + 257 [ + - ]: 513 : pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token, 258 : : subflow_req->remote_nonce, subflow_req->msk); 259 : : } 260 : : @@ -422,66 +422,66 @@ 339 : : return NULL; 340 : : } 341 : : - 342 : 1780 : static void subflow_prep_synack(const struct sock *sk, struct request_sock *req, + 342 : 1781 : static void subflow_prep_synack(const struct sock *sk, struct request_sock *req, 343 : : struct tcp_fastopen_cookie *foc, 344 : : enum tcp_synack_type synack_type) 345 : : { - 346 [ + + ]: 1780 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 347 : 1780 : struct inet_request_sock *ireq = inet_rsk(req); + 346 [ + + ]: 1781 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 347 : 1781 : struct inet_request_sock *ireq = inet_rsk(req); 348 : : 349 : : /* clear tstamp_ok, as needed depending on cookie */ - 350 [ + + + + ]: 1780 : if (foc && foc->len > -1) + 350 [ + + + + ]: 1781 : if (foc && foc->len > -1) 351 : 20 : ireq->tstamp_ok = 0; 352 : : - 353 [ + + ]: 1780 : if (synack_type == TCP_SYNACK_FASTOPEN) + 353 [ + + ]: 1781 : if (synack_type == TCP_SYNACK_FASTOPEN) 354 : 38 : mptcp_fastopen_subflow_synack_set_params(subflow, req); - 355 : 1780 : } + 355 : 1781 : } 356 : : - 357 : 1476 : static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst, + 357 : 1478 : static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst, 358 : : struct flowi *fl, 359 : : struct request_sock *req, 360 : : struct tcp_fastopen_cookie *foc, 361 : : enum tcp_synack_type synack_type, 362 : : struct sk_buff *syn_skb) 363 : : { - 364 : 1476 : subflow_prep_synack(sk, req, foc, synack_type); + 364 : 1478 : subflow_prep_synack(sk, req, foc, synack_type); 365 : : - 366 : 1476 : return tcp_request_sock_ipv4_ops.send_synack(sk, dst, fl, req, foc, + 366 : 1478 : return tcp_request_sock_ipv4_ops.send_synack(sk, dst, fl, req, foc, 367 : : synack_type, syn_skb); 368 : : } 369 : : 370 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 371 : 304 : static int subflow_v6_send_synack(const struct sock *sk, struct dst_entry *dst, + 371 : 303 : static int subflow_v6_send_synack(const struct sock *sk, struct dst_entry *dst, 372 : : struct flowi *fl, 373 : : struct request_sock *req, 374 : : struct tcp_fastopen_cookie *foc, 375 : : enum tcp_synack_type synack_type, 376 : : struct sk_buff *syn_skb) 377 : : { - 378 : 304 : subflow_prep_synack(sk, req, foc, synack_type); + 378 : 303 : subflow_prep_synack(sk, req, foc, synack_type); 379 : : - 380 : 304 : return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc, + 380 : 303 : return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc, 381 : : synack_type, syn_skb); 382 : : } 383 : : - 384 : 302 : static struct dst_entry *subflow_v6_route_req(const struct sock *sk, + 384 : 301 : static struct dst_entry *subflow_v6_route_req(const struct sock *sk, 385 : : struct sk_buff *skb, 386 : : struct flowi *fl, 387 : : struct request_sock *req, 388 : : u32 tw_isn) 389 : : { - 390 : 302 : struct dst_entry *dst; - 391 : 302 : int err; + 390 : 301 : struct dst_entry *dst; + 391 : 301 : int err; 392 : : - 393 : 302 : tcp_rsk(req)->is_mptcp = 1; - 394 : 302 : subflow_init_req(req, sk); + 393 : 301 : tcp_rsk(req)->is_mptcp = 1; + 394 : 301 : subflow_init_req(req, sk); 395 : : - 396 : 302 : dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req, tw_isn); - 397 [ - + ]: 302 : if (!dst) + 396 : 301 : dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req, tw_isn); + 397 [ - + ]: 301 : if (!dst) 398 : : return NULL; 399 : : - 400 : 302 : err = subflow_check_req(req, sk, skb); - 401 [ + + ]: 302 : if (err == 0) + 400 : 301 : err = subflow_check_req(req, sk, skb); + 401 [ + + ]: 301 : if (err == 0) 402 : : return dst; 403 : : 404 : 2 : dst_release(dst); @@ -493,20 +493,20 @@ 410 : : #endif 411 : : 412 : : /* validate received truncated hmac and create hmac for third ACK */ - 413 : 488 : static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) + 413 : 487 : static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) 414 : : { - 415 : 488 : u8 hmac[SHA256_DIGEST_SIZE]; - 416 : 488 : u64 thmac; + 415 : 487 : u8 hmac[SHA256_DIGEST_SIZE]; + 416 : 487 : u64 thmac; 417 : : - 418 : 488 : subflow_generate_hmac(subflow->remote_key, subflow->local_key, + 418 : 487 : subflow_generate_hmac(subflow->remote_key, subflow->local_key, 419 : : subflow->remote_nonce, subflow->local_nonce, 420 : : hmac); 421 : : - 422 [ - + ]: 488 : thmac = get_unaligned_be64(hmac); - 423 [ - + ]: 488 : pr_debug("subflow=%p, token=%u, thmac=%llu, subflow->thmac=%llu\n", + 422 [ - + ]: 487 : thmac = get_unaligned_be64(hmac); + 423 [ - + ]: 487 : pr_debug("subflow=%p, token=%u, thmac=%llu, subflow->thmac=%llu\n", 424 : : subflow, subflow->token, thmac, subflow->thmac); 425 : : - 426 : 488 : return thmac == subflow->thmac; + 426 : 487 : return thmac == subflow->thmac; 427 : : } 428 : : 429 : 8 : void mptcp_subflow_reset(struct sock *ssk) @@ -533,7 +533,7 @@ 450 : : 451 : 60 : static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct sock *sk) 452 : : { - 453 : 488 : return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; + 453 : 487 : return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; 454 : : } 455 : : 456 : 1214 : void __mptcp_sync_state(struct sock *sk, int state) @@ -558,14 +558,14 @@ 475 : : } 476 : 1214 : } 477 : : - 478 : 3824 : static void subflow_set_remote_key(struct mptcp_sock *msk, + 478 : 3823 : static void subflow_set_remote_key(struct mptcp_sock *msk, 479 : : struct mptcp_subflow_context *subflow, 480 : : const struct mptcp_options_received *mp_opt) 481 : : { 482 : : /* active MPC subflow will reach here multiple times: 483 : : * at subflow_finish_connect() time and at 4th ack time 484 : : */ - 485 [ + + ]: 3824 : if (subflow->remote_key_valid) + 485 [ + + ]: 3823 : if (subflow->remote_key_valid) 486 : : return; 487 : : 488 : 2274 : subflow->remote_key_valid = 1; @@ -595,37 +595,37 @@ 512 : 1124 : subflow_set_remote_key(msk, subflow, mp_opt); 513 : : } 514 : : - 515 [ + + ]: 1214 : if (!sock_owned_by_user(sk)) { - 516 : 338 : __mptcp_sync_state(sk, ssk->sk_state); + 515 [ + + ]: 1214 : if (!sock_owned_by_user(sk)) { + 516 : 332 : __mptcp_sync_state(sk, ssk->sk_state); 517 : : } else { - 518 : 876 : msk->pending_state = ssk->sk_state; - 519 [ - + - - : 876 : __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); + 518 : 882 : msk->pending_state = ssk->sk_state; + 519 [ - + - - : 882 : __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); - - ] 520 : : } 521 : 1214 : mptcp_data_unlock(sk); 522 : 1214 : } 523 : : - 524 : 5024 : static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) + 524 : 4694 : static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) 525 : : { - 526 : 5024 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 527 : 5024 : struct mptcp_options_received mp_opt; - 528 : 5024 : struct sock *parent = subflow->conn; - 529 : 5024 : struct mptcp_sock *msk; + 526 : 4694 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 527 : 4694 : struct mptcp_options_received mp_opt; + 528 : 4694 : struct sock *parent = subflow->conn; + 529 : 4694 : struct mptcp_sock *msk; 530 : : - 531 : 5024 : subflow->icsk_af_ops->sk_rx_dst_set(sk, skb); + 531 : 4694 : subflow->icsk_af_ops->sk_rx_dst_set(sk, skb); 532 : : 533 : : /* be sure no special action on any packet other than syn-ack */ - 534 [ + + ]: 5024 : if (subflow->conn_finished) - 535 : 5024 : return; + 534 [ + + ]: 4694 : if (subflow->conn_finished) + 535 : 4694 : return; 536 : : - 537 [ - + ]: 1702 : msk = mptcp_sk(parent); - 538 : 1702 : subflow->rel_write_seq = 1; - 539 : 1702 : subflow->conn_finished = 1; - 540 : 1702 : subflow->ssn_offset = TCP_SKB_CB(skb)->seq; - 541 [ - + ]: 1702 : pr_debug("subflow=%p synack seq=%x\n", subflow, subflow->ssn_offset); + 537 [ - + ]: 1701 : msk = mptcp_sk(parent); + 538 : 1701 : subflow->rel_write_seq = 1; + 539 : 1701 : subflow->conn_finished = 1; + 540 : 1701 : subflow->ssn_offset = TCP_SKB_CB(skb)->seq; + 541 [ - + ]: 1701 : pr_debug("subflow=%p synack seq=%x\n", subflow, subflow->ssn_offset); 542 : : - 543 : 1702 : mptcp_get_options(skb, &mp_opt); - 544 [ + + ]: 1702 : if (subflow->request_mptcp) { + 543 : 1701 : mptcp_get_options(skb, &mp_opt); + 544 [ + + ]: 1701 : if (subflow->request_mptcp) { 545 [ + + ]: 1196 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYNACK)) { 546 [ + - ]: 72 : MPTCP_INC_STATS(sock_net(sk), 547 : : MPTCP_MIB_MPCAPABLEACTIVEFALLBACK); @@ -643,44 +643,44 @@ 559 : 1124 : mptcp_finish_connect(sk); 560 : 1124 : mptcp_active_enable(parent); 561 : 1124 : mptcp_propagate_state(parent, sk, subflow, &mp_opt); - 562 [ + + ]: 506 : } else if (subflow->request_join) { - 563 : 488 : u8 hmac[SHA256_DIGEST_SIZE]; + 562 [ + + ]: 505 : } else if (subflow->request_join) { + 563 : 487 : u8 hmac[SHA256_DIGEST_SIZE]; 564 : : - 565 [ - + ]: 488 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { + 565 [ - + ]: 487 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { 566 : 0 : subflow->reset_reason = MPTCP_RST_EMPTCP; 567 : 0 : goto do_reset; 568 : : } 569 : : - 570 : 488 : subflow->backup = mp_opt.backup; - 571 : 488 : subflow->thmac = mp_opt.thmac; - 572 : 488 : subflow->remote_nonce = mp_opt.nonce; - 573 : 488 : WRITE_ONCE(subflow->remote_id, mp_opt.join_id); - 574 [ - + ]: 488 : pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d\n", + 570 : 487 : subflow->backup = mp_opt.backup; + 571 : 487 : subflow->thmac = mp_opt.thmac; + 572 : 487 : subflow->remote_nonce = mp_opt.nonce; + 573 : 487 : WRITE_ONCE(subflow->remote_id, mp_opt.join_id); + 574 [ - + ]: 487 : pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d\n", 575 : : subflow, subflow->thmac, subflow->remote_nonce, 576 : : subflow->backup); 577 : : - 578 [ - + ]: 488 : if (!subflow_thmac_valid(subflow)) { + 578 [ - + ]: 487 : if (!subflow_thmac_valid(subflow)) { 579 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINACKMAC); 580 : 0 : subflow->reset_reason = MPTCP_RST_EMPTCP; 581 : 0 : goto do_reset; 582 : : } 583 : : - 584 [ - + ]: 488 : if (!mptcp_finish_join(sk)) + 584 [ - + ]: 487 : if (!mptcp_finish_join(sk)) 585 : 0 : goto do_reset; 586 : : - 587 : 488 : subflow_generate_hmac(subflow->local_key, subflow->remote_key, + 587 : 487 : subflow_generate_hmac(subflow->local_key, subflow->remote_key, 588 : : subflow->local_nonce, 589 : : subflow->remote_nonce, 590 : : hmac); - 591 : 488 : memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN); + 591 : 487 : memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN); 592 : : - 593 : 488 : subflow->mp_join = 1; - 594 [ + - ]: 488 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); + 593 : 487 : subflow->mp_join = 1; + 594 [ + - ]: 487 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); 595 : : - 596 [ + + ]: 488 : if (subflow->backup) + 596 [ + + ]: 487 : if (subflow->backup) 597 [ + - ]: 6 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX); 598 : : - 599 [ + + ]: 488 : if (subflow_use_different_dport(msk, sk)) { + 599 [ + + ]: 487 : if (subflow_use_different_dport(msk, sk)) { 600 [ - + ]: 24 : pr_debug("synack inet_dport=%d %d\n", 601 : : ntohs(inet_sk(sk)->inet_dport), 602 : : ntohs(inet_sk(parent)->inet_dport)); @@ -706,44 +706,44 @@ 622 : 2263 : WRITE_ONCE(subflow->local_id, local_id); 623 : 2263 : } 624 : : - 625 : 7285 : static int subflow_chk_local_id(struct sock *sk) + 625 : 7601 : static int subflow_chk_local_id(struct sock *sk) 626 : : { - 627 [ - + ]: 7285 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 628 [ - + ]: 7285 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 629 : 7285 : int err; + 627 [ - + ]: 7601 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 628 [ - + ]: 7601 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 629 : 7601 : int err; 630 : : - 631 [ + + ]: 7285 : if (likely(subflow->local_id >= 0)) + 631 [ + + ]: 7601 : if (likely(subflow->local_id >= 0)) 632 : : return 0; 633 : : - 634 : 252 : err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); - 635 [ + - ]: 252 : if (err < 0) + 634 : 251 : err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); + 635 [ + - ]: 251 : if (err < 0) 636 : : return err; 637 : : - 638 : 252 : subflow_set_local_id(subflow, err); - 639 : 252 : subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); + 638 : 251 : subflow_set_local_id(subflow, err); + 639 : 251 : subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); 640 : : - 641 : 252 : return 0; + 641 : 251 : return 0; 642 : : } 643 : : - 644 : 5719 : static int subflow_rebuild_header(struct sock *sk) + 644 : 6050 : static int subflow_rebuild_header(struct sock *sk) 645 : : { - 646 : 5719 : int err = subflow_chk_local_id(sk); + 646 : 6050 : int err = subflow_chk_local_id(sk); 647 : : - 648 [ + - ]: 5719 : if (unlikely(err < 0)) + 648 [ + - ]: 6050 : if (unlikely(err < 0)) 649 : : return err; 650 : : - 651 : 5719 : return inet_sk_rebuild_header(sk); + 651 : 6050 : return inet_sk_rebuild_header(sk); 652 : : } 653 : : 654 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 655 : 1566 : static int subflow_v6_rebuild_header(struct sock *sk) + 655 : 1551 : static int subflow_v6_rebuild_header(struct sock *sk) 656 : : { - 657 : 1566 : int err = subflow_chk_local_id(sk); + 657 : 1551 : int err = subflow_chk_local_id(sk); 658 : : - 659 [ + - ]: 1566 : if (unlikely(err < 0)) + 659 [ + - ]: 1551 : if (unlikely(err < 0)) 660 : : return err; 661 : : - 662 : 1566 : return inet6_sk_rebuild_header(sk); + 662 : 1551 : return inet6_sk_rebuild_header(sk); 663 : : } 664 : : #endif 665 : : @@ -787,18 +787,18 @@ 703 : : 704 [ - + ]: 938 : pr_debug("subflow=%p\n", subflow); 705 : : - 706 [ + + ]: 938 : if (skb->protocol == htons(ETH_P_IP)) - 707 : 636 : return subflow_v4_conn_request(sk, skb); + 706 [ + + ]: 938 : if (skb->protocol == htons(ETH_P_IP)) + 707 : 637 : return subflow_v4_conn_request(sk, skb); 708 : : - 709 [ - + ]: 302 : if (!ipv6_unicast_destination(skb)) + 709 [ - + ]: 301 : if (!ipv6_unicast_destination(skb)) 710 : 0 : goto drop; 711 : : - 712 [ - + ]: 302 : if (ipv6_addr_v4mapped(&ipv6_hdr(skb)->saddr)) { + 712 [ - + ]: 301 : if (ipv6_addr_v4mapped(&ipv6_hdr(skb)->saddr)) { 713 : 0 : __IP6_INC_STATS(sock_net(sk), NULL, IPSTATS_MIB_INHDRERRORS); 714 : 0 : return 0; 715 : : } 716 : : - 717 : 302 : return tcp_conn_request(&mptcp_subflow_v6_request_sock_ops, + 717 : 301 : return tcp_conn_request(&mptcp_subflow_v6_request_sock_ops, 718 : : &subflow_request_sock_ipv6_ops, sk, skb); 719 : : 720 : 0 : drop: @@ -806,11 +806,11 @@ 722 : 0 : return 0; /* don't send reset */ 723 : : } 724 : : - 725 : 310 : static void subflow_v6_req_destructor(struct request_sock *req) + 725 : 309 : static void subflow_v6_req_destructor(struct request_sock *req) 726 : : { - 727 : 310 : subflow_req_destructor(req); - 728 : 310 : tcp6_request_sock_ops.destructor(req); - 729 : 310 : } + 727 : 309 : subflow_req_destructor(req); + 728 : 309 : tcp6_request_sock_ops.destructor(req); + 729 : 309 : } 730 : : #endif 731 : : 732 : 48 : struct request_sock *mptcp_subflow_reqsk_alloc(const struct request_sock_ops *ops, @@ -829,24 +829,24 @@ 745 : : EXPORT_SYMBOL(mptcp_subflow_reqsk_alloc); 746 : : 747 : : /* validate hmac received in third ACK */ - 748 : 514 : static bool subflow_hmac_valid(const struct request_sock *req, + 748 : 513 : static bool subflow_hmac_valid(const struct request_sock *req, 749 : : const struct mptcp_options_received *mp_opt) 750 : : { - 751 : 514 : const struct mptcp_subflow_request_sock *subflow_req; - 752 : 514 : u8 hmac[SHA256_DIGEST_SIZE]; - 753 : 514 : struct mptcp_sock *msk; + 751 : 513 : const struct mptcp_subflow_request_sock *subflow_req; + 752 : 513 : u8 hmac[SHA256_DIGEST_SIZE]; + 753 : 513 : struct mptcp_sock *msk; 754 : : - 755 : 514 : subflow_req = mptcp_subflow_rsk(req); - 756 : 514 : msk = subflow_req->msk; - 757 [ + - ]: 514 : if (!msk) + 755 : 513 : subflow_req = mptcp_subflow_rsk(req); + 756 : 513 : msk = subflow_req->msk; + 757 [ + - ]: 513 : if (!msk) 758 : : return false; 759 : : - 760 : 514 : subflow_generate_hmac(READ_ONCE(msk->remote_key), - 761 : 514 : READ_ONCE(msk->local_key), - 762 : 514 : subflow_req->remote_nonce, - 763 : 514 : subflow_req->local_nonce, hmac); + 760 : 513 : subflow_generate_hmac(READ_ONCE(msk->remote_key), + 761 : 513 : READ_ONCE(msk->local_key), + 762 : 513 : subflow_req->remote_nonce, + 763 : 513 : subflow_req->local_nonce, hmac); 764 : : - 765 : 514 : return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); + 765 : 513 : return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); 766 : : } 767 : : 768 : 144 : static void subflow_ulp_fallback(struct sock *sk, @@ -879,47 +879,47 @@ 795 : 68 : kfree_rcu(ctx, rcu); 796 : : } 797 : : - 798 : 2700 : void __mptcp_subflow_fully_established(struct mptcp_sock *msk, + 798 : 2699 : void __mptcp_subflow_fully_established(struct mptcp_sock *msk, 799 : : struct mptcp_subflow_context *subflow, 800 : : const struct mptcp_options_received *mp_opt) 801 : : { - 802 : 2700 : subflow_set_remote_key(msk, subflow, mp_opt); - 803 : 2700 : WRITE_ONCE(subflow->fully_established, true); - 804 : 2700 : WRITE_ONCE(msk->fully_established, true); - 805 : 2700 : } + 802 : 2699 : subflow_set_remote_key(msk, subflow, mp_opt); + 803 : 2699 : WRITE_ONCE(subflow->fully_established, true); + 804 : 2699 : WRITE_ONCE(msk->fully_established, true); + 805 : 2699 : } 806 : : - 807 : 1770 : static struct sock *subflow_syn_recv_sock(const struct sock *sk, + 807 : 1769 : static struct sock *subflow_syn_recv_sock(const struct sock *sk, 808 : : struct sk_buff *skb, 809 : : struct request_sock *req, 810 : : struct dst_entry *dst, 811 : : struct request_sock *req_unhash, 812 : : bool *own_req) 813 : : { - 814 [ - + ]: 1770 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk); - 815 : 1770 : struct mptcp_subflow_request_sock *subflow_req; - 816 : 1770 : struct mptcp_options_received mp_opt; - 817 : 1770 : bool fallback, fallback_is_fatal; - 818 : 1770 : enum sk_rst_reason reason; - 819 : 1770 : struct mptcp_sock *owner; - 820 : 1770 : struct sock *child; + 814 [ - + ]: 1769 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk); + 815 : 1769 : struct mptcp_subflow_request_sock *subflow_req; + 816 : 1769 : struct mptcp_options_received mp_opt; + 817 : 1769 : bool fallback, fallback_is_fatal; + 818 : 1769 : enum sk_rst_reason reason; + 819 : 1769 : struct mptcp_sock *owner; + 820 : 1769 : struct sock *child; 821 : : - 822 [ - + ]: 1770 : pr_debug("listener=%p, req=%p, conn=%p\n", listener, req, listener->conn); + 822 [ - + ]: 1769 : pr_debug("listener=%p, req=%p, conn=%p\n", listener, req, listener->conn); 823 : : 824 : : /* After child creation we must look for MPC even when options 825 : : * are not parsed 826 : : */ - 827 : 1770 : mp_opt.suboptions = 0; + 827 : 1769 : mp_opt.suboptions = 0; 828 : : 829 : : /* hopefully temporary handling for MP_JOIN+syncookie */ - 830 : 1770 : subflow_req = mptcp_subflow_rsk(req); - 831 [ + + + + : 1770 : fallback_is_fatal = tcp_rsk(req)->is_mptcp && subflow_req->mp_join; + 830 : 1769 : subflow_req = mptcp_subflow_rsk(req); + 831 [ + + + + : 1769 : fallback_is_fatal = tcp_rsk(req)->is_mptcp && subflow_req->mp_join; + + ] - 832 [ - + ]: 1770 : fallback = !tcp_rsk(req)->is_mptcp; - 833 [ - + ]: 1770 : if (fallback) + 832 [ - + ]: 1769 : fallback = !tcp_rsk(req)->is_mptcp; + 833 [ - + ]: 1769 : if (fallback) 834 : 0 : goto create_child; 835 : : 836 : : /* if the sk is MP_CAPABLE, we try to fetch the client key */ - 837 [ + + ]: 1770 : if (subflow_req->mp_capable) { + 837 [ + + ]: 1769 : if (subflow_req->mp_capable) { 838 : : /* we can receive and accept an in-window, out-of-order pkt, 839 : : * which may not carry the MP_CAPABLE opt even on mptcp enabled 840 : : * paths: always try to extract the peer key, and fallback @@ -933,31 +933,31 @@ 848 : : (OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_ACK))) 849 : 0 : fallback = true; 850 : : - 851 [ + + ]: 590 : } else if (subflow_req->mp_join) { - 852 : 514 : mptcp_get_options(skb, &mp_opt); - 853 [ + - + - ]: 1028 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) || - 854 [ + + ]: 1028 : !subflow_hmac_valid(req, &mp_opt) || - 855 : 514 : !mptcp_can_accept_new_subflow(subflow_req->msk)) { + 851 [ + + ]: 589 : } else if (subflow_req->mp_join) { + 852 : 513 : mptcp_get_options(skb, &mp_opt); + 853 [ + - + - ]: 1026 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) || + 854 [ + + ]: 1026 : !subflow_hmac_valid(req, &mp_opt) || + 855 : 513 : !mptcp_can_accept_new_subflow(subflow_req->msk)) { 856 [ - + ]: 8 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); 857 : : fallback = true; 858 : : } 859 : : } 860 : : - 861 : 522 : create_child: - 862 : 1770 : child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst, + 861 : 521 : create_child: + 862 : 1769 : child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst, 863 : : req_unhash, own_req); 864 : : - 865 [ + - + + : 1770 : if (child && *own_req) { + 865 [ + - + + : 1769 : if (child && *own_req) { + - ] - 866 [ + + ]: 1770 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); + 866 [ + + ]: 1769 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); 867 : : - 868 : 1770 : tcp_rsk(req)->drop_req = false; + 868 : 1769 : tcp_rsk(req)->drop_req = false; 869 : : 870 : : /* we need to fallback on ctx allocation failure and on pre-reqs 871 : : * checking above. In the latter scenario we additionally need 872 : : * to reset the context to non MPTCP status. 873 : : */ - 874 [ + + ]: 1770 : if (!ctx || fallback) { + 874 [ + + ]: 1769 : if (!ctx || fallback) { 875 [ + + ]: 102 : if (fallback_is_fatal) { 876 : 8 : subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP); 877 : 8 : goto dispose_child; @@ -966,9 +966,9 @@ 880 : : } 881 : : 882 : : /* ssk inherits options of listener sk */ - 883 : 1668 : ctx->setsockopt_seq = listener->setsockopt_seq; + 883 : 1667 : ctx->setsockopt_seq = listener->setsockopt_seq; 884 : : - 885 [ + + ]: 1668 : if (ctx->mp_capable) { + 885 [ + + ]: 1667 : if (ctx->mp_capable) { 886 : 1162 : ctx->conn = mptcp_sk_clone_init(listener->conn, &mp_opt, child, req); 887 [ - + ]: 1162 : if (!ctx->conn) 888 : 0 : goto fallback; @@ -984,18 +984,18 @@ 898 : 1124 : mptcp_pm_fully_established(owner, child); 899 : 1124 : ctx->pm_notified = 1; 900 : : } - 901 [ + - ]: 506 : } else if (ctx->mp_join) { - 902 : 506 : owner = subflow_req->msk; - 903 [ - + ]: 506 : if (!owner) { + 901 [ + - ]: 505 : } else if (ctx->mp_join) { + 902 : 505 : owner = subflow_req->msk; + 903 [ - + ]: 505 : if (!owner) { 904 : 0 : subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT); 905 : 0 : goto dispose_child; 906 : : } 907 : : 908 : : /* move the msk reference ownership to the subflow */ - 909 : 506 : subflow_req->msk = NULL; - 910 : 506 : ctx->conn = (struct sock *)owner; + 909 : 505 : subflow_req->msk = NULL; + 910 : 505 : ctx->conn = (struct sock *)owner; 911 : : - 912 [ + + ]: 506 : if (subflow_use_different_sport(owner, sk)) { + 912 [ + + ]: 505 : if (subflow_use_different_sport(owner, sk)) { 913 [ - + ]: 24 : pr_debug("ack inet_sport=%d %d\n", 914 : : ntohs(inet_sk(sk)->inet_sport), 915 : : ntohs(inet_sk((struct sock *)owner)->inet_sport)); @@ -1007,28 +1007,28 @@ 921 [ + - ]: 24 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINPORTACKRX); 922 : : } 923 : : - 924 [ - + ]: 506 : if (!mptcp_finish_join(child)) { + 924 [ - + ]: 505 : if (!mptcp_finish_join(child)) { 925 : 0 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(child); 926 : : 927 : 0 : subflow_add_reset_reason(skb, subflow->reset_reason); 928 : 0 : goto dispose_child; 929 : : } 930 : : - 931 [ + - ]: 506 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX); - 932 : 506 : tcp_rsk(req)->drop_req = true; + 931 [ + - ]: 505 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX); + 932 : 505 : tcp_rsk(req)->drop_req = true; 933 : : } 934 : : } 935 : : 936 : : /* check for expected invariant - should never trigger, just help 937 : : * catching earlier subtle bugs 938 : : */ - 939 [ + + + + : 1668 : WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp && - + + + + + - + + - - + 939 [ + + + + : 1667 : WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp && + + + + + + + + + - - + ] 940 : : (!mptcp_subflow_ctx(child) || 941 : : !mptcp_subflow_ctx(child)->conn)); - 942 : 1668 : return child; + 942 : 1667 : return child; 943 : : 944 : 8 : dispose_child: 945 : 8 : mptcp_subflow_drop_ctx(child); @@ -1082,19 +1082,19 @@ 993 : 0 : mptcp_subflow_get_map_offset(subflow); 994 : : } 995 : : - 996 : 216148 : static bool validate_mapping(struct sock *ssk, struct sk_buff *skb) + 996 : 230248 : static bool validate_mapping(struct sock *ssk, struct sk_buff *skb) 997 : : { - 998 [ - + ]: 216148 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 999 [ - + ]: 216148 : u32 ssn = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + 998 [ - + ]: 230248 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 999 [ - + ]: 230248 : u32 ssn = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; 1000 : : - 1001 [ - + ]: 216148 : if (unlikely(before(ssn, subflow->map_subflow_seq))) { + 1001 [ - + ]: 230248 : if (unlikely(before(ssn, subflow->map_subflow_seq))) { 1002 : : /* Mapping covers data later in the subflow stream, 1003 : : * currently unsupported. 1004 : : */ 1005 : 0 : dbg_bad_map(subflow, ssn); 1006 : 0 : return false; 1007 : : } - 1008 [ - + ]: 216148 : if (unlikely(!before(ssn, subflow->map_subflow_seq + + 1008 [ - + ]: 230248 : if (unlikely(!before(ssn, subflow->map_subflow_seq + 1009 : : subflow->map_data_len))) { 1010 : : /* Mapping does covers past subflow data, invalid */ 1011 : 0 : dbg_bad_map(subflow, ssn); @@ -1103,19 +1103,19 @@ 1014 : : return true; 1015 : : } 1016 : : - 1017 : 634849 : static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *skb, + 1017 : 661318 : static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *skb, 1018 : : bool csum_reqd) 1019 : : { - 1020 [ + + ]: 634849 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1021 : 634849 : u32 offset, seq, delta; - 1022 : 634849 : __sum16 csum; - 1023 : 634849 : int len; + 1020 [ + + ]: 661318 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1021 : 661318 : u32 offset, seq, delta; + 1022 : 661318 : __sum16 csum; + 1023 : 661318 : int len; 1024 : : - 1025 [ + + ]: 634849 : if (!csum_reqd) + 1025 [ + + ]: 661318 : if (!csum_reqd) 1026 : : return MAPPING_OK; 1027 : : 1028 : : /* mapping already validated on previous traversal */ - 1029 [ + + ]: 1623 : if (subflow->map_csum_len == subflow->map_data_len) + 1029 [ + + ]: 1602 : if (subflow->map_csum_len == subflow->map_data_len) 1030 : : return MAPPING_OK; 1031 : : 1032 : : /* traverse the receive queue, ensuring it contains a full @@ -1123,39 +1123,39 @@ 1034 : : * Preserve the accoumlate csum across multiple calls, to compute 1035 : : * the csum only once 1036 : : */ - 1037 : 1614 : delta = subflow->map_data_len - subflow->map_csum_len; - 1038 : 10460 : for (;;) { - 1039 [ - + ]: 10460 : seq = tcp_sk(ssk)->copied_seq + subflow->map_csum_len; - 1040 : 10460 : offset = seq - TCP_SKB_CB(skb)->seq; + 1037 : 1595 : delta = subflow->map_data_len - subflow->map_csum_len; + 1038 : 10420 : for (;;) { + 1039 [ - + ]: 10420 : seq = tcp_sk(ssk)->copied_seq + subflow->map_csum_len; + 1040 : 10420 : offset = seq - TCP_SKB_CB(skb)->seq; 1041 : : 1042 : : /* if the current skb has not been accounted yet, csum its contents 1043 : : * up to the amount covered by the current DSS 1044 : : */ - 1045 [ + + ]: 10460 : if (offset < skb->len) { - 1046 : 1619 : __wsum csum; + 1045 [ + + ]: 10420 : if (offset < skb->len) { + 1046 : 1596 : __wsum csum; 1047 : : - 1048 : 1619 : len = min(skb->len - offset, delta); - 1049 : 1619 : csum = skb_checksum(skb, offset, len, 0); - 1050 : 3238 : subflow->map_data_csum = csum_block_add(subflow->map_data_csum, csum, - 1051 [ - + ]: 1619 : subflow->map_csum_len); + 1048 : 1596 : len = min(skb->len - offset, delta); + 1049 : 1596 : csum = skb_checksum(skb, offset, len, 0); + 1050 : 3192 : subflow->map_data_csum = csum_block_add(subflow->map_data_csum, csum, + 1051 [ - + ]: 1596 : subflow->map_csum_len); 1052 : : - 1053 : 1619 : delta -= len; - 1054 : 1619 : subflow->map_csum_len += len; + 1053 : 1596 : delta -= len; + 1054 : 1596 : subflow->map_csum_len += len; 1055 : : } - 1056 [ + + ]: 10460 : if (delta == 0) + 1056 [ + + ]: 10420 : if (delta == 0) 1057 : : break; 1058 : : - 1059 [ + + ]: 10324 : if (skb_queue_is_last(&ssk->sk_receive_queue, skb)) { + 1059 [ + + ]: 10294 : if (skb_queue_is_last(&ssk->sk_receive_queue, skb)) { 1060 : : /* if this subflow is closed, the partial mapping 1061 : : * will be never completed; flush the pending skbs, so 1062 : : * that subflow_sched_work_if_closed() can kick in 1063 : : */ - 1064 [ - + ]: 1478 : if (unlikely(ssk->sk_state == TCP_CLOSE)) + 1064 [ - + ]: 1469 : if (unlikely(ssk->sk_state == TCP_CLOSE)) 1065 [ # # # # ]: 0 : while ((skb = skb_peek(&ssk->sk_receive_queue))) 1066 : 0 : sk_eat_skb(ssk, skb); 1067 : : 1068 : : /* not enough data to validate the csum */ - 1069 : 1478 : return MAPPING_EMPTY; + 1069 : 1469 : return MAPPING_EMPTY; 1070 : : } 1071 : : 1072 : : /* the DSS mapping for next skbs will be validated later, @@ -1169,73 +1169,73 @@ 1080 : : * while the pseudo header requires the original DSS data len, 1081 : : * including that 1082 : : */ - 1083 : 136 : csum = __mptcp_make_csum(subflow->map_seq, + 1083 : 126 : csum = __mptcp_make_csum(subflow->map_seq, 1084 : : subflow->map_subflow_seq, - 1085 : 136 : subflow->map_data_len + subflow->map_data_fin, + 1085 : 126 : subflow->map_data_len + subflow->map_data_fin, 1086 : : subflow->map_data_csum); - 1087 [ + + ]: 136 : if (unlikely(csum)) { + 1087 [ + + ]: 126 : if (unlikely(csum)) { 1088 [ + - ]: 4 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); 1089 : 4 : return MAPPING_BAD_CSUM; 1090 : : } 1091 : : - 1092 : 132 : subflow->valid_csum_seen = 1; - 1093 : 132 : return MAPPING_OK; + 1092 : 122 : subflow->valid_csum_seen = 1; + 1093 : 122 : return MAPPING_OK; 1094 : : } 1095 : : - 1096 : 1262336 : static enum mapping_status get_mapping_status(struct sock *ssk, + 1096 : 1316834 : static enum mapping_status get_mapping_status(struct sock *ssk, 1097 : : struct mptcp_sock *msk) 1098 : : { - 1099 [ + + ]: 1262336 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1100 [ - + ]: 1262336 : bool csum_reqd = READ_ONCE(msk->csum_enabled); - 1101 : 1262336 : struct mptcp_ext *mpext; - 1102 : 1262336 : struct sk_buff *skb; - 1103 : 1262336 : u16 data_len; - 1104 : 1262336 : u64 map_seq; + 1099 [ + + ]: 1316834 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1100 [ - + ]: 1316834 : bool csum_reqd = READ_ONCE(msk->csum_enabled); + 1101 : 1316834 : struct mptcp_ext *mpext; + 1102 : 1316834 : struct sk_buff *skb; + 1103 : 1316834 : u16 data_len; + 1104 : 1316834 : u64 map_seq; 1105 : : - 1106 [ + + ]: 1262408 : skb = skb_peek(&ssk->sk_receive_queue); - 1107 [ - + ]: 639678 : if (!skb) + 1106 [ + + ]: 1316906 : skb = skb_peek(&ssk->sk_receive_queue); + 1107 [ - + ]: 667348 : if (!skb) 1108 : : return MAPPING_EMPTY; 1109 : : - 1110 [ + + ]: 639678 : if (mptcp_check_fallback(ssk)) + 1110 [ + + ]: 667348 : if (mptcp_check_fallback(ssk)) 1111 : : return MAPPING_DUMMY; 1112 : : - 1113 [ + + ]: 635827 : mpext = mptcp_get_ext(skb); - 1114 [ + + + + ]: 634974 : if (!mpext || !mpext->use_map) { - 1115 [ + + + + ]: 2658 : if (!subflow->map_valid && !skb->len) { + 1113 [ + + ]: 662266 : mpext = mptcp_get_ext(skb); + 1114 [ + + + + ]: 661441 : if (!mpext || !mpext->use_map) { + 1115 [ + + + + ]: 2639 : if (!subflow->map_valid && !skb->len) { 1116 : : /* the TCP stack deliver 0 len FIN pkt to the receive 1117 : : * queue, that is the only 0len pkts ever expected here, 1118 : : * and we can admit no mapping only for 0 len pkts 1119 : : */ - 1120 [ - + ]: 959 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) + 1120 [ - + ]: 928 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) 1121 [ # # # # ]: 0 : WARN_ONCE(1, "0len seq %d:%d flags %x", 1122 : : TCP_SKB_CB(skb)->seq, 1123 : : TCP_SKB_CB(skb)->end_seq, 1124 : : TCP_SKB_CB(skb)->tcp_flags); - 1125 : 959 : sk_eat_skb(ssk, skb); - 1126 : 959 : return MAPPING_EMPTY; + 1125 : 928 : sk_eat_skb(ssk, skb); + 1126 : 928 : return MAPPING_EMPTY; 1127 : : } 1128 : : 1129 : : /* If the required DSS has likely been dropped by a middlebox */ - 1130 [ + + ]: 1699 : if (!subflow->map_valid) + 1130 [ + + ]: 1711 : if (!subflow->map_valid) 1131 : : return MAPPING_NODSS; 1132 : : - 1133 : 1693 : goto validate_seq; + 1133 : 1705 : goto validate_seq; 1134 : : } 1135 : : - 1136 : 633169 : trace_get_mapping_status(mpext); + 1136 : 659627 : trace_get_mapping_status(mpext); 1137 : : - 1138 : 633169 : data_len = mpext->data_len; - 1139 [ + + ]: 633169 : if (data_len == 0) { - 1140 [ - + ]: 1 : pr_debug("infinite mapping received\n"); - 1141 [ # # ]: 1 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); - 1142 : 1 : subflow->map_data_len = 0; - 1143 : 1 : return MAPPING_INVALID; + 1138 : 659627 : data_len = mpext->data_len; + 1139 [ + + ]: 659627 : if (data_len == 0) { + 1140 [ - + ]: 2 : pr_debug("infinite mapping received\n"); + 1141 [ + - ]: 2 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); + 1142 : 2 : subflow->map_data_len = 0; + 1143 : 2 : return MAPPING_INVALID; 1144 : : } 1145 : : - 1146 [ + + ]: 633168 : if (mpext->data_fin == 1) { - 1147 : 1190 : u64 data_fin_seq; + 1146 [ + + ]: 659625 : if (mpext->data_fin == 1) { + 1147 : 1077 : u64 data_fin_seq; 1148 : : - 1149 [ + + ]: 1190 : if (data_len == 1) { + 1149 [ + + ]: 1077 : if (data_len == 1) { 1150 : 12 : bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq, 1151 : 12 : mpext->dsn64); 1152 [ - + ]: 12 : pr_debug("DATA_FIN with no payload seq=%llu\n", mpext->data_seq); @@ -1255,33 +1255,33 @@ 1166 : 12 : return MAPPING_DATA_FIN; 1167 : : } 1168 : : - 1169 : 1178 : data_fin_seq = mpext->data_seq + data_len - 1; + 1169 : 1065 : data_fin_seq = mpext->data_seq + data_len - 1; 1170 : : 1171 : : /* If mpext->data_seq is a 32-bit value, data_fin_seq must also 1172 : : * be limited to 32 bits. 1173 : : */ - 1174 [ - + ]: 1178 : if (!mpext->dsn64) + 1174 [ - + ]: 1065 : if (!mpext->dsn64) 1175 : 0 : data_fin_seq &= GENMASK_ULL(31, 0); 1176 : : - 1177 : 1178 : mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); - 1178 [ - + ]: 1178 : pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d\n", + 1177 : 1065 : mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); + 1178 [ - + ]: 1065 : pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d\n", 1179 : : data_fin_seq, mpext->dsn64); 1180 : : 1181 : : /* Adjust for DATA_FIN using 1 byte of sequence space */ - 1182 : 1178 : data_len--; + 1182 : 1065 : data_len--; 1183 : : } 1184 : : - 1185 [ + + ]: 633156 : map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64); - 1186 [ - + ]: 633156 : WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64); + 1185 [ + + ]: 659613 : map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64); + 1186 [ - + ]: 659613 : WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64); 1187 : : - 1188 [ + + ]: 633156 : if (subflow->map_valid) { + 1188 [ + + ]: 659613 : if (subflow->map_valid) { 1189 : : /* Allow replacing only with an identical map */ - 1190 [ + - ]: 418701 : if (subflow->map_seq == map_seq && - 1191 [ + - ]: 418701 : subflow->map_subflow_seq == mpext->subflow_seq && - 1192 [ + - ]: 418701 : subflow->map_data_len == data_len && - 1193 [ + - ]: 418701 : subflow->map_csum_reqd == mpext->csum_reqd) { - 1194 : 418701 : skb_ext_del(skb, SKB_EXT_MPTCP); - 1195 : 418701 : goto validate_csum; + 1190 [ + - ]: 431070 : if (subflow->map_seq == map_seq && + 1191 [ + - ]: 431070 : subflow->map_subflow_seq == mpext->subflow_seq && + 1192 [ + - ]: 431070 : subflow->map_data_len == data_len && + 1193 [ + - ]: 431070 : subflow->map_csum_reqd == mpext->csum_reqd) { + 1194 : 431070 : skb_ext_del(skb, SKB_EXT_MPTCP); + 1195 : 431070 : goto validate_csum; 1196 : : } 1197 : : 1198 : : /* If this skb data are fully covered by the current mapping, @@ -1296,106 +1296,106 @@ 1207 : 0 : goto validate_csum; 1208 : : } 1209 : : - 1210 : 214455 : subflow->map_seq = map_seq; - 1211 : 214455 : subflow->map_subflow_seq = mpext->subflow_seq; - 1212 : 214455 : subflow->map_data_len = data_len; - 1213 : 214455 : subflow->map_valid = 1; - 1214 : 214455 : subflow->map_data_fin = mpext->data_fin; - 1215 : 214455 : subflow->mpc_map = mpext->mpc_map; - 1216 : 214455 : subflow->map_csum_reqd = mpext->csum_reqd; - 1217 : 214455 : subflow->map_csum_len = 0; - 1218 [ - + ]: 214455 : subflow->map_data_csum = csum_unfold(mpext->csum); + 1210 : 228543 : subflow->map_seq = map_seq; + 1211 : 228543 : subflow->map_subflow_seq = mpext->subflow_seq; + 1212 : 228543 : subflow->map_data_len = data_len; + 1213 : 228543 : subflow->map_valid = 1; + 1214 : 228543 : subflow->map_data_fin = mpext->data_fin; + 1215 : 228543 : subflow->mpc_map = mpext->mpc_map; + 1216 : 228543 : subflow->map_csum_reqd = mpext->csum_reqd; + 1217 : 228543 : subflow->map_csum_len = 0; + 1218 [ - + ]: 228543 : subflow->map_data_csum = csum_unfold(mpext->csum); 1219 : : 1220 : : /* Cfr RFC 8684 Section 3.3.0 */ - 1221 [ - + ]: 214455 : if (unlikely(subflow->map_csum_reqd != csum_reqd)) + 1221 [ - + ]: 228543 : if (unlikely(subflow->map_csum_reqd != csum_reqd)) 1222 : : return MAPPING_INVALID; 1223 : : - 1224 [ - + ]: 214455 : pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", + 1224 [ - + ]: 228543 : pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", 1225 : : subflow->map_seq, subflow->map_subflow_seq, 1226 : : subflow->map_data_len, subflow->map_csum_reqd, 1227 : : subflow->map_data_csum); 1228 : : - 1229 : 216148 : validate_seq: + 1229 : 230248 : validate_seq: 1230 : : /* we revalidate valid mapping on new skb, because we must ensure 1231 : : * the current skb is completely covered by the available mapping 1232 : : */ - 1233 [ - + ]: 216148 : if (!validate_mapping(ssk, skb)) { + 1233 [ - + ]: 230248 : if (!validate_mapping(ssk, skb)) { 1234 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DSSTCPMISMATCH); 1235 : 0 : return MAPPING_INVALID; 1236 : : } 1237 : : - 1238 : 216148 : skb_ext_del(skb, SKB_EXT_MPTCP); + 1238 : 230248 : skb_ext_del(skb, SKB_EXT_MPTCP); 1239 : : - 1240 : 634849 : validate_csum: - 1241 : 634849 : return validate_data_csum(ssk, skb, csum_reqd); + 1240 : 661318 : validate_csum: + 1241 : 661318 : return validate_data_csum(ssk, skb, csum_reqd); 1242 : : } 1243 : : - 1244 : 5479 : static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, + 1244 : 5423 : static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, 1245 : : u64 limit) 1246 : : { - 1247 [ - + ]: 5479 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1248 : 5479 : bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; - 1249 [ - + ]: 5479 : struct tcp_sock *tp = tcp_sk(ssk); - 1250 : 5479 : u32 offset, incr, avail_len; + 1247 [ - + ]: 5423 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1248 : 5423 : bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; + 1249 [ - + ]: 5423 : struct tcp_sock *tp = tcp_sk(ssk); + 1250 : 5423 : u32 offset, incr, avail_len; 1251 : : - 1252 : 5479 : offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; - 1253 [ - + - + ]: 5479 : if (WARN_ON_ONCE(offset > skb->len)) + 1252 : 5423 : offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; + 1253 [ - + - + ]: 5423 : if (WARN_ON_ONCE(offset > skb->len)) 1254 : 0 : goto out; 1255 : : - 1256 : 5479 : avail_len = skb->len - offset; - 1257 [ + + ]: 5479 : incr = limit >= avail_len ? avail_len + fin : limit; + 1256 : 5423 : avail_len = skb->len - offset; + 1257 [ + + ]: 5423 : incr = limit >= avail_len ? avail_len + fin : limit; 1258 : : - 1259 [ - + ]: 5479 : pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len, + 1259 [ - + ]: 5423 : pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len, 1260 : : offset, subflow->map_subflow_seq); - 1261 [ + - ]: 5479 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); - 1262 [ - + ]: 5479 : tcp_sk(ssk)->copied_seq += incr; + 1261 [ + - ]: 5423 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); + 1262 [ - + ]: 5423 : tcp_sk(ssk)->copied_seq += incr; 1263 : : - 1264 : 5479 : out: - 1265 [ - + + + ]: 5479 : if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) - 1266 : 5264 : sk_eat_skb(ssk, skb); - 1267 [ + + ]: 5479 : if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) - 1268 : 3937 : subflow->map_valid = 0; - 1269 : 5479 : } + 1264 : 5423 : out: + 1265 [ - + + + ]: 5423 : if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) + 1266 : 5187 : sk_eat_skb(ssk, skb); + 1267 [ + + ]: 5423 : if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) + 1268 : 3981 : subflow->map_valid = 0; + 1269 : 5423 : } 1270 : : 1271 : 0 : static bool subflow_is_done(const struct sock *sk) 1272 : : { - 1273 [ - + - - ]: 197 : return sk->sk_shutdown & RCV_SHUTDOWN || sk->sk_state == TCP_CLOSE; + 1273 [ - + - - ]: 242 : return sk->sk_shutdown & RCV_SHUTDOWN || sk->sk_state == TCP_CLOSE; 1274 : : } 1275 : : 1276 : : /* sched mptcp worker for subflow cleanup if no more data is pending */ - 1277 : 630098 : static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) + 1277 : 656897 : static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) 1278 : : { - 1279 : 630098 : struct sock *sk = (struct sock *)msk; + 1279 : 656897 : struct sock *sk = (struct sock *)msk; 1280 : : - 1281 [ + + + + : 633011 : if (likely(ssk->sk_state != TCP_CLOSE && - + + ] + 1281 [ + + + + : 659709 : if (likely(ssk->sk_state != TCP_CLOSE && + + + ] 1282 : : (ssk->sk_state != TCP_CLOSE_WAIT || 1283 : : inet_sk_state_load(sk) != TCP_ESTABLISHED))) - 1284 : 628455 : return; + 1284 : 655167 : return; 1285 : : - 1286 [ + + ]: 1643 : if (!skb_queue_empty(&ssk->sk_receive_queue)) + 1286 [ + + ]: 1730 : if (!skb_queue_empty(&ssk->sk_receive_queue)) 1287 : : return; 1288 : : - 1289 [ + + ]: 2333 : if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - 1290 : 621 : mptcp_schedule_work(sk); + 1289 [ + + ]: 2493 : if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + 1290 : 653 : mptcp_schedule_work(sk); 1291 : : 1292 : : /* when the fallback subflow closes the rx side, trigger a 'dummy' 1293 : : * ingress data fin, so that the msk state will follow along 1294 : : */ - 1295 [ + + ]: 1563 : if (__mptcp_check_fallback(msk) && subflow_is_done(ssk) && - 1296 [ + - + + ]: 394 : msk->first == ssk && - 1297 : 197 : mptcp_update_rcv_data_fin(msk, READ_ONCE(msk->ack_seq), true)) - 1298 : 81 : mptcp_schedule_work(sk); + 1295 [ + + ]: 1655 : if (__mptcp_check_fallback(msk) && subflow_is_done(ssk) && + 1296 [ + - + + ]: 484 : msk->first == ssk && + 1297 : 242 : mptcp_update_rcv_data_fin(msk, READ_ONCE(msk->ack_seq), true)) + 1298 : 90 : mptcp_schedule_work(sk); 1299 : : } 1300 : : - 1301 : 7 : static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) + 1301 : 8 : static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) 1302 : : { - 1303 [ - + ]: 7 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1303 [ - + ]: 8 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 1304 : : - 1305 [ + - ]: 7 : if (subflow->mp_join) + 1305 [ + - ]: 8 : if (subflow->mp_join) 1306 : : return false; - 1307 [ - + + + ]: 7 : else if (READ_ONCE(msk->csum_enabled)) - 1308 : 1 : return !subflow->valid_csum_seen; + 1307 [ + + + + ]: 8 : else if (READ_ONCE(msk->csum_enabled)) + 1308 : 2 : return !subflow->valid_csum_seen; 1309 : : else 1310 [ - + ]: 6 : return READ_ONCE(msk->allow_infinite_fallback); 1311 : : } @@ -1427,61 +1427,61 @@ 1337 : 2 : mptcp_reset_tout_timer(msk, subflow->fail_tout); 1338 : : } 1339 : : - 1340 : 1304991 : static bool subflow_check_data_avail(struct sock *ssk) + 1340 : 1369597 : static bool subflow_check_data_avail(struct sock *ssk) 1341 : : { - 1342 [ + + ]: 1304991 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1343 : 1304991 : enum mapping_status status; - 1344 : 1304991 : struct mptcp_sock *msk; - 1345 : 1304991 : struct sk_buff *skb; + 1342 [ + + ]: 1369597 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1343 : 1369597 : enum mapping_status status; + 1344 : 1369597 : struct mptcp_sock *msk; + 1345 : 1369597 : struct sk_buff *skb; 1346 : : - 1347 [ + + - + ]: 1304991 : if (!skb_peek(&ssk->sk_receive_queue)) - 1348 : 617473 : WRITE_ONCE(subflow->data_avail, false); - 1349 [ + + + + ]: 1304991 : if (subflow->data_avail) + 1347 [ + + - + ]: 1369597 : if (!skb_peek(&ssk->sk_receive_queue)) + 1348 : 644391 : WRITE_ONCE(subflow->data_avail, false); + 1349 [ + + + + ]: 1369597 : if (subflow->data_avail) 1350 : : return true; 1351 : : - 1352 [ - + ]: 1256857 : msk = mptcp_sk(subflow->conn); - 1353 : 1267815 : for (;;) { - 1354 : 1262336 : u64 ack_seq; - 1355 : 1262336 : u64 old_ack; + 1352 [ - + ]: 1311411 : msk = mptcp_sk(subflow->conn); + 1353 : 1322257 : for (;;) { + 1354 : 1316834 : u64 ack_seq; + 1355 : 1316834 : u64 old_ack; 1356 : : - 1357 : 1262336 : status = get_mapping_status(ssk, msk); - 1358 [ + + ]: 1885953 : trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); - 1359 [ + + + + ]: 1262336 : if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY || + 1357 : 1316834 : status = get_mapping_status(ssk, msk); + 1358 [ + + ]: 1967248 : trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); + 1359 [ + + + + ]: 1316834 : if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY || 1360 : : status == MAPPING_BAD_CSUM || status == MAPPING_NODSS)) - 1361 : 3862 : goto fallback; + 1361 : 5094 : goto fallback; 1362 : : - 1363 [ + + ]: 1258474 : if (status != MAPPING_OK) - 1364 : 625107 : goto no_data; + 1363 [ + + ]: 1311740 : if (status != MAPPING_OK) + 1364 : 651895 : goto no_data; 1365 : : - 1366 [ + - ]: 633367 : skb = skb_peek(&ssk->sk_receive_queue); - 1367 [ - + ]: 633367 : if (WARN_ON_ONCE(!skb)) + 1366 [ + - ]: 659845 : skb = skb_peek(&ssk->sk_receive_queue); + 1367 [ - + ]: 659845 : if (WARN_ON_ONCE(!skb)) 1368 : 0 : goto no_data; 1369 : : - 1370 [ - + - + ]: 633367 : if (unlikely(!READ_ONCE(msk->can_ack))) + 1370 [ - + - + ]: 659845 : if (unlikely(!READ_ONCE(msk->can_ack))) 1371 : 0 : goto fallback; 1372 : : - 1373 : 633367 : old_ack = READ_ONCE(msk->ack_seq); - 1374 : 633367 : ack_seq = mptcp_subflow_get_mapped_dsn(subflow); - 1375 [ - + ]: 633367 : pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack, + 1373 : 659845 : old_ack = READ_ONCE(msk->ack_seq); + 1374 : 659845 : ack_seq = mptcp_subflow_get_mapped_dsn(subflow); + 1375 [ - + ]: 659845 : pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack, 1376 : : ack_seq); - 1377 [ + + ]: 633367 : if (unlikely(before64(ack_seq, old_ack))) { - 1378 : 5479 : mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); - 1379 : 5479 : continue; + 1377 [ + + ]: 659845 : if (unlikely(before64(ack_seq, old_ack))) { + 1378 : 5423 : mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); + 1379 : 5423 : continue; 1380 : : } 1381 : : - 1382 : 627888 : WRITE_ONCE(subflow->data_avail, true); - 1383 : 627888 : break; + 1382 : 654422 : WRITE_ONCE(subflow->data_avail, true); + 1383 : 654422 : break; 1384 : : } - 1385 : 627888 : return true; + 1385 : 654422 : return true; 1386 : : - 1387 : 625107 : no_data: - 1388 : 625107 : subflow_sched_work_if_closed(msk, ssk); - 1389 : 625107 : return false; + 1387 : 651895 : no_data: + 1388 : 651895 : subflow_sched_work_if_closed(msk, ssk); + 1389 : 651895 : return false; 1390 : : - 1391 : 3862 : fallback: - 1392 [ + + ]: 3862 : if (!__mptcp_check_fallback(msk)) { + 1391 : 5094 : fallback: + 1392 [ + + ]: 5094 : if (!__mptcp_check_fallback(msk)) { 1393 : : /* RFC 8684 section 3.7. */ - 1394 [ + + ]: 11 : if (status == MAPPING_BAD_CSUM && + 1394 [ + + ]: 12 : if (status == MAPPING_BAD_CSUM && 1395 [ + - ]: 4 : (subflow->mp_join || subflow->valid_csum_seen)) { 1396 : 4 : subflow->send_mp_fail = 1; 1397 : : @@ -1495,7 +1495,7 @@ 1405 : 2 : return true; 1406 : : } 1407 : : - 1408 [ + + - + ]: 7 : if (!subflow_can_fallback(subflow) && subflow->map_data_len) { + 1408 [ + + - + ]: 8 : if (!subflow_can_fallback(subflow) && subflow->map_data_len) { 1409 : : /* fatal protocol error, close the socket. 1410 : : * subflow_error_report() will introduce the appropriate barriers 1411 : : */ @@ -1507,41 +1507,41 @@ 1417 : 2 : reset: 1418 : 2 : WRITE_ONCE(ssk->sk_err, EBADMSG); 1419 : 2 : tcp_set_state(ssk, TCP_CLOSE); - 1420 [ + + + - ]: 5 : while ((skb = skb_peek(&ssk->sk_receive_queue))) - 1421 : 3 : sk_eat_skb(ssk, skb); + 1420 [ + + + - ]: 6 : while ((skb = skb_peek(&ssk->sk_receive_queue))) + 1421 : 4 : sk_eat_skb(ssk, skb); 1422 : 2 : mptcp_send_active_reset_reason(ssk); 1423 : 2 : WRITE_ONCE(subflow->data_avail, false); 1424 : 2 : return false; 1425 : : } 1426 : : - 1427 : 7 : mptcp_do_fallback(ssk); + 1427 : 8 : mptcp_do_fallback(ssk); 1428 : : } 1429 : : - 1430 [ - + ]: 3858 : skb = skb_peek(&ssk->sk_receive_queue); - 1431 : 3858 : subflow->map_valid = 1; - 1432 : 3858 : subflow->map_seq = READ_ONCE(msk->ack_seq); - 1433 : 3858 : subflow->map_data_len = skb->len; - 1434 [ - + ]: 3858 : subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; - 1435 : 3858 : WRITE_ONCE(subflow->data_avail, true); - 1436 : 3858 : return true; + 1430 [ - + ]: 5090 : skb = skb_peek(&ssk->sk_receive_queue); + 1431 : 5090 : subflow->map_valid = 1; + 1432 : 5090 : subflow->map_seq = READ_ONCE(msk->ack_seq); + 1433 : 5090 : subflow->map_data_len = skb->len; + 1434 [ - + ]: 5090 : subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + 1435 : 5090 : WRITE_ONCE(subflow->data_avail, true); + 1436 : 5090 : return true; 1437 : : } 1438 : : - 1439 : 1304991 : bool mptcp_subflow_data_available(struct sock *sk) + 1439 : 1369597 : bool mptcp_subflow_data_available(struct sock *sk) 1440 : : { - 1441 [ + + ]: 1304991 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1441 [ + + ]: 1369597 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1442 : : 1443 : : /* check if current mapping is still valid */ - 1444 [ + + ]: 1304991 : if (subflow->map_valid && - 1445 [ + + ]: 1100050 : mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { - 1446 : 214370 : subflow->map_valid = 0; - 1447 : 214370 : WRITE_ONCE(subflow->data_avail, false); + 1444 [ + + ]: 1369597 : if (subflow->map_valid && + 1445 [ + + ]: 1150230 : mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { + 1446 : 229647 : subflow->map_valid = 0; + 1447 : 229647 : WRITE_ONCE(subflow->data_avail, false); 1448 : : - 1449 [ - + ]: 214370 : pr_debug("Done with mapping: seq=%u data_len=%u\n", + 1449 [ - + ]: 229647 : pr_debug("Done with mapping: seq=%u data_len=%u\n", 1450 : : subflow->map_subflow_seq, 1451 : : subflow->map_data_len); 1452 : : } 1453 : : - 1454 : 1304991 : return subflow_check_data_avail(sk); + 1454 : 1369597 : return subflow_check_data_avail(sk); 1455 : : } 1456 : : 1457 : : /* If ssk has an mptcp parent socket, use the mptcp rcvbuf occupancy, @@ -1553,81 +1553,81 @@ 1463 : : * as far as mptcp peer is concerned that data is still inflight. 1464 : : * DSS ACK is updated when skb is moved to the mptcp rx queue. 1465 : : */ - 1466 : 1395537 : void mptcp_space(const struct sock *ssk, int *space, int *full_space) + 1466 : 1455556 : void mptcp_space(const struct sock *ssk, int *space, int *full_space) 1467 : : { - 1468 : 1395537 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1469 : 1395537 : const struct sock *sk = subflow->conn; + 1468 : 1455556 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1469 : 1455556 : const struct sock *sk = subflow->conn; 1470 : : - 1471 : 1395537 : *space = __mptcp_space(sk); - 1472 : 1395537 : *full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); - 1473 : 1395537 : } + 1471 : 1455556 : *space = __mptcp_space(sk); + 1472 : 1455556 : *full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); + 1473 : 1455556 : } 1474 : : - 1475 : 1784 : static void subflow_error_report(struct sock *ssk) + 1475 : 1882 : static void subflow_error_report(struct sock *ssk) 1476 : : { - 1477 [ + + ]: 1784 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; + 1477 [ + + ]: 1882 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; 1478 : : 1479 : : /* bail early if this is a no-op, so that we avoid introducing a 1480 : : * problematic lockdep dependency between TCP accept queue lock 1481 : : * and msk socket spinlock 1482 : : */ - 1483 [ + + ]: 1784 : if (!sk->sk_socket) + 1483 [ + + ]: 1882 : if (!sk->sk_socket) 1484 : : return; 1485 : : - 1486 : 970 : mptcp_data_lock(sk); - 1487 [ + + ]: 970 : if (!sock_owned_by_user(sk)) - 1488 : 402 : __mptcp_error_report(sk); + 1486 : 957 : mptcp_data_lock(sk); + 1487 [ + + ]: 957 : if (!sock_owned_by_user(sk)) + 1488 : 368 : __mptcp_error_report(sk); 1489 : : else - 1490 [ - + ]: 568 : __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); - 1491 : 970 : mptcp_data_unlock(sk); + 1490 [ - + ]: 589 : __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); + 1491 : 957 : mptcp_data_unlock(sk); 1492 : : } 1493 : : - 1494 : 659754 : static void subflow_data_ready(struct sock *sk) + 1494 : 697946 : static void subflow_data_ready(struct sock *sk) 1495 : : { - 1496 : 659754 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1497 [ - + ]: 659754 : u16 state = 1 << inet_sk_state_load(sk); - 1498 : 659754 : struct sock *parent = subflow->conn; - 1499 : 659754 : struct mptcp_sock *msk; + 1496 : 697946 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1497 [ - + ]: 697946 : u16 state = 1 << inet_sk_state_load(sk); + 1498 : 697946 : struct sock *parent = subflow->conn; + 1499 : 697946 : struct mptcp_sock *msk; 1500 : : - 1501 : 659754 : trace_sk_data_ready(sk); + 1501 : 697946 : trace_sk_data_ready(sk); 1502 : : - 1503 [ - + ]: 659754 : msk = mptcp_sk(parent); - 1504 [ + + ]: 659754 : if (state & TCPF_LISTEN) { + 1503 [ - + ]: 697946 : msk = mptcp_sk(parent); + 1504 [ + + ]: 697946 : if (state & TCPF_LISTEN) { 1505 : : /* MPJ subflow are removed from accept queue before reaching here, 1506 : : * avoid stray wakeups 1507 : : */ - 1508 [ + + ]: 1762 : if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue)) + 1508 [ + + ]: 1761 : if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue)) 1509 : : return; 1510 : : - 1511 : 1283 : parent->sk_data_ready(parent); - 1512 : 1283 : return; + 1511 : 1284 : parent->sk_data_ready(parent); + 1512 : 1284 : return; 1513 : : } 1514 : : - 1515 [ + + - + : 657992 : WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && + 1515 [ + + - + : 696185 : WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && - - ] 1516 : : !subflow->mp_join && !(state & TCPF_CLOSE)); 1517 : : - 1518 [ + + ]: 657992 : if (mptcp_subflow_data_available(sk)) { - 1519 : 650554 : mptcp_data_ready(parent, sk); + 1518 [ + + ]: 696185 : if (mptcp_subflow_data_available(sk)) { + 1519 : 688866 : mptcp_data_ready(parent, sk); 1520 : : 1521 : : /* subflow-level lowat test are not relevant. 1522 : : * respect the msk-level threshold eventually mandating an immediate ack 1523 : : */ - 1524 [ + + ]: 650554 : if (mptcp_data_avail(msk) < parent->sk_rcvlowat && - 1525 [ - + - + : 119732 : (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) - + + ] - 1526 : 73968 : inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; - 1527 [ + + ]: 7438 : } else if (unlikely(sk->sk_err)) { + 1524 [ + + ]: 688866 : if (mptcp_data_avail(msk) < parent->sk_rcvlowat && + 1525 [ - + - + : 114580 : (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) + + + ] + 1526 : 69695 : inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; + 1527 [ + + ]: 7319 : } else if (unlikely(sk->sk_err)) { 1528 : 2 : subflow_error_report(sk); 1529 : : } 1530 : : } 1531 : : - 1532 : 451450 : static void subflow_write_space(struct sock *ssk) + 1532 : 416338 : static void subflow_write_space(struct sock *ssk) 1533 : : { - 1534 : 451450 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; + 1534 : 416338 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; 1535 : : - 1536 : 451450 : mptcp_propagate_sndbuf(sk, ssk); - 1537 : 451450 : mptcp_write_space(sk); - 1538 : 451450 : } + 1536 : 416338 : mptcp_propagate_sndbuf(sk, ssk); + 1537 : 416338 : mptcp_write_space(sk); + 1538 : 416338 : } 1539 : : 1540 : : static const struct inet_connection_sock_af_ops * 1541 : 0 : subflow_default_af_ops(struct sock *sk) @@ -1640,150 +1640,150 @@ 1548 : : } 1549 : : 1550 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1551 : 726 : void mptcpv6_handle_mapped(struct sock *sk, bool mapped) + 1551 : 727 : void mptcpv6_handle_mapped(struct sock *sk, bool mapped) 1552 : : { - 1553 [ - + ]: 726 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1554 : 726 : struct inet_connection_sock *icsk = inet_csk(sk); - 1555 : 726 : const struct inet_connection_sock_af_ops *target; + 1553 [ - + ]: 727 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1554 : 727 : struct inet_connection_sock *icsk = inet_csk(sk); + 1555 : 727 : const struct inet_connection_sock_af_ops *target; 1556 : : - 1557 [ - + ]: 726 : target = mapped ? &subflow_v6m_specific : subflow_default_af_ops(sk); + 1557 [ - + ]: 727 : target = mapped ? &subflow_v6m_specific : subflow_default_af_ops(sk); 1558 : : - 1559 [ - + ]: 726 : pr_debug("subflow=%p family=%d ops=%p target=%p mapped=%d\n", + 1559 [ - + ]: 727 : pr_debug("subflow=%p family=%d ops=%p target=%p mapped=%d\n", 1560 : : subflow, sk->sk_family, icsk->icsk_af_ops, target, mapped); 1561 : : - 1562 [ + - ]: 726 : if (likely(icsk->icsk_af_ops == target)) + 1562 [ + - ]: 727 : if (likely(icsk->icsk_af_ops == target)) 1563 : : return; 1564 : : - 1565 : 726 : subflow->icsk_af_ops = icsk->icsk_af_ops; - 1566 : 726 : icsk->icsk_af_ops = target; + 1565 : 727 : subflow->icsk_af_ops = icsk->icsk_af_ops; + 1566 : 727 : icsk->icsk_af_ops = target; 1567 : : } 1568 : : #endif 1569 : : - 1570 : 1146 : void mptcp_info2sockaddr(const struct mptcp_addr_info *info, + 1570 : 1148 : void mptcp_info2sockaddr(const struct mptcp_addr_info *info, 1571 : : struct sockaddr_storage *addr, 1572 : : unsigned short family) 1573 : : { - 1574 : 1146 : memset(addr, 0, sizeof(*addr)); - 1575 : 1146 : addr->ss_family = family; - 1576 [ + + ]: 1146 : if (addr->ss_family == AF_INET) { - 1577 : 1026 : struct sockaddr_in *in_addr = (struct sockaddr_in *)addr; + 1574 : 1148 : memset(addr, 0, sizeof(*addr)); + 1575 : 1148 : addr->ss_family = family; + 1576 [ + + ]: 1148 : if (addr->ss_family == AF_INET) { + 1577 : 1030 : struct sockaddr_in *in_addr = (struct sockaddr_in *)addr; 1578 : : - 1579 [ + + ]: 1026 : if (info->family == AF_INET) - 1580 : 1007 : in_addr->sin_addr = info->addr; + 1579 [ + + ]: 1030 : if (info->family == AF_INET) + 1580 : 1009 : in_addr->sin_addr = info->addr; 1581 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1582 [ + - ]: 19 : else if (ipv6_addr_v4mapped(&info->addr6)) - 1583 : 19 : in_addr->sin_addr.s_addr = info->addr6.s6_addr32[3]; + 1582 [ + - ]: 21 : else if (ipv6_addr_v4mapped(&info->addr6)) + 1583 : 21 : in_addr->sin_addr.s_addr = info->addr6.s6_addr32[3]; 1584 : : #endif - 1585 : 1026 : in_addr->sin_port = info->port; + 1585 : 1030 : in_addr->sin_port = info->port; 1586 : : } 1587 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1588 [ + - ]: 120 : else if (addr->ss_family == AF_INET6) { - 1589 : 120 : struct sockaddr_in6 *in6_addr = (struct sockaddr_in6 *)addr; + 1588 [ + - ]: 118 : else if (addr->ss_family == AF_INET6) { + 1589 : 118 : struct sockaddr_in6 *in6_addr = (struct sockaddr_in6 *)addr; 1590 : : - 1591 [ + + ]: 120 : if (info->family == AF_INET) + 1591 [ + + ]: 118 : if (info->family == AF_INET) 1592 [ - + ]: 2 : ipv6_addr_set_v4mapped(info->addr.s_addr, 1593 : : &in6_addr->sin6_addr); 1594 : : else - 1595 : 118 : in6_addr->sin6_addr = info->addr6; - 1596 : 120 : in6_addr->sin6_port = info->port; + 1595 : 116 : in6_addr->sin6_addr = info->addr6; + 1596 : 118 : in6_addr->sin6_port = info->port; 1597 : : } 1598 : : #endif - 1599 : 1146 : } + 1599 : 1148 : } 1600 : : - 1601 : 628 : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, + 1601 : 627 : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, 1602 : : const struct mptcp_addr_info *remote) 1603 : : { - 1604 [ - + ]: 628 : struct mptcp_sock *msk = mptcp_sk(sk); - 1605 : 628 : struct mptcp_subflow_context *subflow; - 1606 : 628 : int local_id = local->addr.id; - 1607 : 628 : struct sockaddr_storage addr; - 1608 : 628 : int remote_id = remote->id; - 1609 : 628 : int err = -ENOTCONN; - 1610 : 628 : struct socket *sf; - 1611 : 628 : struct sock *ssk; - 1612 : 628 : u32 remote_token; - 1613 : 628 : int addrlen; + 1604 [ - + ]: 627 : struct mptcp_sock *msk = mptcp_sk(sk); + 1605 : 627 : struct mptcp_subflow_context *subflow; + 1606 : 627 : int local_id = local->addr.id; + 1607 : 627 : struct sockaddr_storage addr; + 1608 : 627 : int remote_id = remote->id; + 1609 : 627 : int err = -ENOTCONN; + 1610 : 627 : struct socket *sf; + 1611 : 627 : struct sock *ssk; + 1612 : 627 : u32 remote_token; + 1613 : 627 : int addrlen; 1614 : : 1615 : : /* The userspace PM sent the request too early? */ - 1616 [ - + ]: 628 : if (!mptcp_is_fully_established(sk)) + 1616 [ - + ]: 627 : if (!mptcp_is_fully_established(sk)) 1617 : 0 : goto err_out; 1618 : : - 1619 : 628 : err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); - 1620 [ + + ]: 628 : if (err) { - 1621 [ + - ]: 65 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); - 1622 [ - + ]: 65 : pr_debug("msk=%p local=%d remote=%d create sock error: %d\n", + 1619 : 627 : err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); + 1620 [ + + ]: 627 : if (err) { + 1621 [ + - ]: 63 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); + 1622 [ - + ]: 63 : pr_debug("msk=%p local=%d remote=%d create sock error: %d\n", 1623 : : msk, local_id, remote_id, err); - 1624 : 65 : goto err_out; + 1624 : 63 : goto err_out; 1625 : : } 1626 : : - 1627 : 563 : ssk = sf->sk; - 1628 : 563 : subflow = mptcp_subflow_ctx(ssk); - 1629 : 563 : do { - 1630 : 563 : get_random_bytes(&subflow->local_nonce, sizeof(u32)); - 1631 [ - + ]: 563 : } while (!subflow->local_nonce); + 1627 : 564 : ssk = sf->sk; + 1628 : 564 : subflow = mptcp_subflow_ctx(ssk); + 1629 : 564 : do { + 1630 : 564 : get_random_bytes(&subflow->local_nonce, sizeof(u32)); + 1631 [ - + ]: 564 : } while (!subflow->local_nonce); 1632 : : 1633 : : /* if 'IPADDRANY', the ID will be set later, after the routing */ - 1634 [ + + ]: 563 : if (local->addr.family == AF_INET) { - 1635 [ + + ]: 503 : if (!local->addr.addr.s_addr) + 1634 [ + + ]: 564 : if (local->addr.family == AF_INET) { + 1635 [ + + ]: 505 : if (!local->addr.addr.s_addr) 1636 : : local_id = -1; 1637 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1638 [ + + ]: 60 : } else if (sk->sk_family == AF_INET6) { - 1639 [ + + ]: 58 : if (ipv6_addr_any(&local->addr.addr6)) + 1638 [ + + ]: 59 : } else if (sk->sk_family == AF_INET6) { + 1639 [ + + ]: 57 : if (ipv6_addr_any(&local->addr.addr6)) 1640 : : local_id = -1; 1641 : : #endif 1642 : : } 1643 : : - 1644 : 317 : if (local_id >= 0) - 1645 : 317 : subflow_set_local_id(subflow, local_id); + 1644 : 319 : if (local_id >= 0) + 1645 : 319 : subflow_set_local_id(subflow, local_id); 1646 : : - 1647 : 563 : subflow->remote_key_valid = 1; - 1648 : 563 : subflow->remote_key = READ_ONCE(msk->remote_key); - 1649 : 563 : subflow->local_key = READ_ONCE(msk->local_key); - 1650 : 563 : subflow->token = msk->token; - 1651 : 563 : mptcp_info2sockaddr(&local->addr, &addr, ssk->sk_family); + 1647 : 564 : subflow->remote_key_valid = 1; + 1648 : 564 : subflow->remote_key = READ_ONCE(msk->remote_key); + 1649 : 564 : subflow->local_key = READ_ONCE(msk->local_key); + 1650 : 564 : subflow->token = msk->token; + 1651 : 564 : mptcp_info2sockaddr(&local->addr, &addr, ssk->sk_family); 1652 : : - 1653 : 563 : addrlen = sizeof(struct sockaddr_in); + 1653 : 564 : addrlen = sizeof(struct sockaddr_in); 1654 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1655 [ + + ]: 563 : if (addr.ss_family == AF_INET6) - 1656 : 60 : addrlen = sizeof(struct sockaddr_in6); + 1655 [ + + ]: 564 : if (addr.ss_family == AF_INET6) + 1656 : 59 : addrlen = sizeof(struct sockaddr_in6); 1657 : : #endif - 1658 : 563 : ssk->sk_bound_dev_if = local->ifindex; - 1659 : 563 : err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen); - 1660 [ + + ]: 563 : if (err) { + 1658 : 564 : ssk->sk_bound_dev_if = local->ifindex; + 1659 : 564 : err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen); + 1660 [ + + ]: 564 : if (err) { 1661 [ + - ]: 2 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXBINDERR); 1662 [ - + ]: 2 : pr_debug("msk=%p local=%d remote=%d bind error: %d\n", 1663 : : msk, local_id, remote_id, err); 1664 : 2 : goto failed; 1665 : : } 1666 : : - 1667 : 561 : mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); - 1668 [ - + ]: 561 : pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d\n", msk, + 1667 : 562 : mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); + 1668 [ - + ]: 562 : pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d\n", msk, 1669 : : remote_token, local_id, remote_id); - 1670 : 561 : subflow->remote_token = remote_token; - 1671 : 561 : WRITE_ONCE(subflow->remote_id, remote_id); - 1672 : 561 : subflow->request_join = 1; - 1673 : 561 : subflow->request_bkup = !!(local->flags & MPTCP_PM_ADDR_FLAG_BACKUP); - 1674 : 561 : subflow->subflow_id = msk->subflow_id++; - 1675 : 561 : mptcp_info2sockaddr(remote, &addr, ssk->sk_family); + 1670 : 562 : subflow->remote_token = remote_token; + 1671 : 562 : WRITE_ONCE(subflow->remote_id, remote_id); + 1672 : 562 : subflow->request_join = 1; + 1673 : 562 : subflow->request_bkup = !!(local->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + 1674 : 562 : subflow->subflow_id = msk->subflow_id++; + 1675 : 562 : mptcp_info2sockaddr(remote, &addr, ssk->sk_family); 1676 : : - 1677 : 561 : sock_hold(ssk); - 1678 : 561 : list_add_tail(&subflow->node, &msk->conn_list); - 1679 : 561 : err = kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK); - 1680 [ + + ]: 561 : if (err && err != -EINPROGRESS) { + 1677 : 562 : sock_hold(ssk); + 1678 : 562 : list_add_tail(&subflow->node, &msk->conn_list); + 1679 : 562 : err = kernel_connect(sf, (struct sockaddr *)&addr, addrlen, O_NONBLOCK); + 1680 [ + + ]: 562 : if (err && err != -EINPROGRESS) { 1681 [ + - ]: 26 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCONNECTERR); 1682 [ - + ]: 26 : pr_debug("msk=%p local=%d remote=%d connect error: %d\n", 1683 : : msk, local_id, remote_id, err); 1684 : 26 : goto failed_unlink; 1685 : : } 1686 : : - 1687 [ + - ]: 535 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); + 1687 [ + - ]: 536 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); 1688 : : 1689 : : /* discard the subflow socket */ - 1690 : 535 : mptcp_sock_graft(ssk, sk->sk_socket); - 1691 : 535 : iput(SOCK_INODE(sf)); - 1692 : 535 : WRITE_ONCE(msk->allow_infinite_fallback, false); - 1693 : 535 : mptcp_stop_tout_timer(sk); - 1694 : 535 : return 0; + 1690 : 536 : mptcp_sock_graft(ssk, sk->sk_socket); + 1691 : 536 : iput(SOCK_INODE(sf)); + 1692 : 536 : WRITE_ONCE(msk->allow_infinite_fallback, false); + 1693 : 536 : mptcp_stop_tout_timer(sk); + 1694 : 536 : return 0; 1695 : : 1696 : 0 : failed_unlink: 1697 : 26 : list_del(&subflow->node); @@ -1793,22 +1793,22 @@ 1701 : 28 : subflow->disposable = 1; 1702 : 28 : sock_release(sf); 1703 : : - 1704 : 93 : err_out: + 1704 : 91 : err_out: 1705 : : /* we account subflows before the creation, and this failures will not 1706 : : * be caught by sk_state_change() 1707 : : */ - 1708 : 93 : mptcp_pm_close_subflow(msk); - 1709 : 93 : return err; + 1708 : 91 : mptcp_pm_close_subflow(msk); + 1709 : 91 : return err; 1710 : : } 1711 : : - 1712 : 3081 : static void mptcp_attach_cgroup(struct sock *parent, struct sock *child) + 1712 : 3082 : static void mptcp_attach_cgroup(struct sock *parent, struct sock *child) 1713 : : { 1714 : : #ifdef CONFIG_SOCK_CGROUP_DATA - 1715 : 3081 : struct sock_cgroup_data *parent_skcd = &parent->sk_cgrp_data, - 1716 : 3081 : *child_skcd = &child->sk_cgrp_data; + 1715 : 3082 : struct sock_cgroup_data *parent_skcd = &parent->sk_cgrp_data, + 1716 : 3082 : *child_skcd = &child->sk_cgrp_data; 1717 : : 1718 : : /* only the additional subflows created by kworkers have to be modified */ - 1719 [ + + ]: 3081 : if (cgroup_id(sock_cgroup_ptr(parent_skcd)) != + 1719 [ + + ]: 3082 : if (cgroup_id(sock_cgroup_ptr(parent_skcd)) != 1720 [ + + ]: 186 : cgroup_id(sock_cgroup_ptr(child_skcd))) { 1721 : : #ifdef CONFIG_MEMCG 1722 : : struct mem_cgroup *memcg = parent->sk_memcg; @@ -1823,69 +1823,69 @@ 1731 : 60 : cgroup_sk_clone(child_skcd); 1732 : : } 1733 : : #endif /* CONFIG_SOCK_CGROUP_DATA */ - 1734 : 3081 : } + 1734 : 3082 : } 1735 : : 1736 : 186 : static void mptcp_subflow_ops_override(struct sock *ssk) 1737 : : { 1738 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1739 : 3081 : if (ssk->sk_prot == &tcpv6_prot) - 1740 : 938 : ssk->sk_prot = &tcpv6_prot_override; + 1739 : 3082 : if (ssk->sk_prot == &tcpv6_prot) + 1740 : 937 : ssk->sk_prot = &tcpv6_prot_override; 1741 : : else 1742 : : #endif - 1743 : 2143 : ssk->sk_prot = &tcp_prot_override; + 1743 : 2145 : ssk->sk_prot = &tcp_prot_override; 1744 : : } 1745 : : 1746 : 312 : static void mptcp_subflow_ops_undo_override(struct sock *ssk) 1747 : : { 1748 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 1749 [ + + ]: 144 : if (ssk->sk_prot == &tcpv6_prot_override) - 1750 : 1815 : ssk->sk_prot = &tcpv6_prot; + 1750 : 1814 : ssk->sk_prot = &tcpv6_prot; 1751 : : else 1752 : : #endif - 1753 : 2936 : ssk->sk_prot = &tcp_prot; + 1753 : 2937 : ssk->sk_prot = &tcp_prot; 1754 : : } 1755 : : - 1756 : 3146 : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, + 1756 : 3145 : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, 1757 : : struct socket **new_sock) 1758 : : { - 1759 : 3146 : struct mptcp_subflow_context *subflow; - 1760 [ + + ]: 3146 : struct net *net = sock_net(sk); - 1761 : 3146 : struct socket *sf; - 1762 : 3146 : int err; + 1759 : 3145 : struct mptcp_subflow_context *subflow; + 1760 [ + + ]: 3145 : struct net *net = sock_net(sk); + 1761 : 3145 : struct socket *sf; + 1762 : 3145 : int err; 1763 : : 1764 : : /* un-accepted server sockets can reach here - on bad configuration 1765 : : * bail early to avoid greater trouble later 1766 : : */ - 1767 [ + + ]: 3146 : if (unlikely(!sk->sk_socket)) + 1767 [ + + ]: 3145 : if (unlikely(!sk->sk_socket)) 1768 : : return -EINVAL; 1769 : : - 1770 : 3081 : err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf); - 1771 [ + - ]: 3081 : if (err) + 1770 : 3082 : err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf); + 1771 [ + - ]: 3082 : if (err) 1772 : : return err; 1773 : : - 1774 : 3081 : lock_sock_nested(sf->sk, SINGLE_DEPTH_NESTING); + 1774 : 3082 : lock_sock_nested(sf->sk, SINGLE_DEPTH_NESTING); 1775 : : - 1776 : 3081 : err = security_mptcp_add_subflow(sk, sf->sk); - 1777 [ - + ]: 3081 : if (err) + 1776 : 3082 : err = security_mptcp_add_subflow(sk, sf->sk); + 1777 [ - + ]: 3082 : if (err) 1778 : 0 : goto err_free; 1779 : : 1780 : : /* the newly created socket has to be in the same cgroup as its parent */ - 1781 : 3081 : mptcp_attach_cgroup(sk, sf->sk); + 1781 : 3082 : mptcp_attach_cgroup(sk, sf->sk); 1782 : : 1783 : : /* kernel sockets do not by default acquire net ref, but TCP timer 1784 : : * needs it. 1785 : : * Update ns_tracker to current stack trace and refcounted tracker. 1786 : : */ - 1787 : 3081 : __netns_tracker_free(net, &sf->sk->ns_tracker, false); - 1788 : 3081 : sf->sk->sk_net_refcnt = 1; - 1789 : 3081 : get_net_track(net, &sf->sk->ns_tracker, GFP_KERNEL); - 1790 : 3081 : sock_inuse_add(net, 1); - 1791 : 3081 : err = tcp_set_ulp(sf->sk, "mptcp"); - 1792 [ - + ]: 3081 : if (err) + 1787 : 3082 : __netns_tracker_free(net, &sf->sk->ns_tracker, false); + 1788 : 3082 : sf->sk->sk_net_refcnt = 1; + 1789 : 3082 : get_net_track(net, &sf->sk->ns_tracker, GFP_KERNEL); + 1790 : 3082 : sock_inuse_add(net, 1); + 1791 : 3082 : err = tcp_set_ulp(sf->sk, "mptcp"); + 1792 [ - + ]: 3082 : if (err) 1793 : 0 : goto err_free; 1794 : : - 1795 [ - + ]: 3081 : mptcp_sockopt_sync_locked(mptcp_sk(sk), sf->sk); - 1796 : 3081 : release_sock(sf->sk); + 1795 [ - + ]: 3082 : mptcp_sockopt_sync_locked(mptcp_sk(sk), sf->sk); + 1796 : 3082 : release_sock(sf->sk); 1797 : : 1798 : : /* the newly created socket really belongs to the owning MPTCP 1799 : : * socket, even if for additional subflows the allocation is performed @@ -1893,17 +1893,17 @@ 1801 : : * procfs/diag interfaces really show this one belonging to the correct 1802 : : * user. 1803 : : */ - 1804 [ - + ]: 3081 : SOCK_INODE(sf)->i_ino = SOCK_INODE(sk->sk_socket)->i_ino; - 1805 : 3081 : SOCK_INODE(sf)->i_uid = SOCK_INODE(sk->sk_socket)->i_uid; - 1806 : 3081 : SOCK_INODE(sf)->i_gid = SOCK_INODE(sk->sk_socket)->i_gid; + 1804 [ - + ]: 3082 : SOCK_INODE(sf)->i_ino = SOCK_INODE(sk->sk_socket)->i_ino; + 1805 : 3082 : SOCK_INODE(sf)->i_uid = SOCK_INODE(sk->sk_socket)->i_uid; + 1806 : 3082 : SOCK_INODE(sf)->i_gid = SOCK_INODE(sk->sk_socket)->i_gid; 1807 : : - 1808 [ - + ]: 3081 : subflow = mptcp_subflow_ctx(sf->sk); - 1809 [ - + ]: 3081 : pr_debug("subflow=%p\n", subflow); + 1808 [ - + ]: 3082 : subflow = mptcp_subflow_ctx(sf->sk); + 1809 [ - + ]: 3082 : pr_debug("subflow=%p\n", subflow); 1810 : : - 1811 : 3081 : *new_sock = sf; - 1812 : 3081 : sock_hold(sk); - 1813 : 3081 : subflow->conn = sk; - 1814 [ + + ]: 3081 : mptcp_subflow_ops_override(sf->sk); + 1811 : 3082 : *new_sock = sf; + 1812 : 3082 : sock_hold(sk); + 1813 : 3082 : subflow->conn = sk; + 1814 [ + + ]: 3082 : mptcp_subflow_ops_override(sf->sk); 1815 : : 1816 : : return 0; 1817 : : @@ -1935,29 +1935,29 @@ 1843 : 4775 : return ctx; 1844 : : } 1845 : : - 1846 : 4991 : static void __subflow_state_change(struct sock *sk) + 1846 : 5002 : static void __subflow_state_change(struct sock *sk) 1847 : : { - 1848 : 4991 : struct socket_wq *wq; + 1848 : 5002 : struct socket_wq *wq; 1849 : : - 1850 : 4991 : rcu_read_lock(); - 1851 [ + - - + : 4991 : wq = rcu_dereference(sk->sk_wq); + 1850 : 5002 : rcu_read_lock(); + 1851 [ + - - + : 5002 : wq = rcu_dereference(sk->sk_wq); - - - - - - ] - 1852 [ + + ]: 4991 : if (skwq_has_sleeper(wq)) - 1853 : 361 : wake_up_interruptible_all(&wq->wait); - 1854 : 4991 : rcu_read_unlock(); - 1855 : 4991 : } + 1852 [ + + ]: 5002 : if (skwq_has_sleeper(wq)) + 1853 : 375 : wake_up_interruptible_all(&wq->wait); + 1854 : 5002 : rcu_read_unlock(); + 1855 : 5002 : } 1856 : : - 1857 : 4991 : static void subflow_state_change(struct sock *sk) + 1857 : 5002 : static void subflow_state_change(struct sock *sk) 1858 : : { - 1859 : 4991 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1860 : 4991 : struct sock *parent = subflow->conn; - 1861 : 4991 : struct mptcp_sock *msk; + 1859 : 5002 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1860 : 5002 : struct sock *parent = subflow->conn; + 1861 : 5002 : struct mptcp_sock *msk; 1862 : : - 1863 : 4991 : __subflow_state_change(sk); + 1863 : 5002 : __subflow_state_change(sk); 1864 : : - 1865 [ - + ]: 4991 : msk = mptcp_sk(parent); - 1866 [ - + ]: 4991 : if (subflow_simultaneous_connect(sk)) { + 1865 [ - + ]: 5002 : msk = mptcp_sk(parent); + 1866 [ - + ]: 5002 : if (subflow_simultaneous_connect(sk)) { 1867 : 0 : mptcp_do_fallback(sk); 1868 [ # # ]: 0 : pr_fallback(msk); 1869 : 0 : subflow->conn_finished = 1; @@ -1968,33 +1968,33 @@ 1874 : : * a fin packet carrying a DSS can be unnoticed if we don't trigger 1875 : : * the data available machinery here. 1876 : : */ - 1877 [ + + ]: 4991 : if (mptcp_subflow_data_available(sk)) - 1878 : 90 : mptcp_data_ready(parent, sk); - 1879 [ + + ]: 4901 : else if (unlikely(sk->sk_err)) - 1880 : 461 : subflow_error_report(sk); + 1877 [ + + ]: 5002 : if (mptcp_subflow_data_available(sk)) + 1878 : 96 : mptcp_data_ready(parent, sk); + 1879 [ + + ]: 4906 : else if (unlikely(sk->sk_err)) + 1880 : 483 : subflow_error_report(sk); 1881 : : - 1882 [ - + ]: 4991 : subflow_sched_work_if_closed(mptcp_sk(parent), sk); - 1883 : 4991 : } + 1882 [ - + ]: 5002 : subflow_sched_work_if_closed(mptcp_sk(parent), sk); + 1883 : 5002 : } 1884 : : - 1885 : 1252 : void mptcp_subflow_queue_clean(struct sock *listener_sk, struct sock *listener_ssk) + 1885 : 1248 : void mptcp_subflow_queue_clean(struct sock *listener_sk, struct sock *listener_ssk) 1886 : : { - 1887 : 1252 : struct request_sock_queue *queue = &inet_csk(listener_ssk)->icsk_accept_queue; - 1888 : 1252 : struct request_sock *req, *head, *tail; - 1889 : 1252 : struct mptcp_subflow_context *subflow; - 1890 : 1252 : struct sock *sk, *ssk; + 1887 : 1248 : struct request_sock_queue *queue = &inet_csk(listener_ssk)->icsk_accept_queue; + 1888 : 1248 : struct request_sock *req, *head, *tail; + 1889 : 1248 : struct mptcp_subflow_context *subflow; + 1890 : 1248 : struct sock *sk, *ssk; 1891 : : 1892 : : /* Due to lock dependencies no relevant lock can be acquired under rskq_lock. 1893 : : * Splice the req list, so that accept() can not reach the pending ssk after 1894 : : * the listener socket is released below. 1895 : : */ - 1896 : 1252 : spin_lock_bh(&queue->rskq_lock); - 1897 : 1252 : head = queue->rskq_accept_head; - 1898 : 1252 : tail = queue->rskq_accept_tail; - 1899 : 1252 : queue->rskq_accept_head = NULL; - 1900 : 1252 : queue->rskq_accept_tail = NULL; - 1901 : 1252 : spin_unlock_bh(&queue->rskq_lock); + 1896 : 1248 : spin_lock_bh(&queue->rskq_lock); + 1897 : 1248 : head = queue->rskq_accept_head; + 1898 : 1248 : tail = queue->rskq_accept_tail; + 1899 : 1248 : queue->rskq_accept_head = NULL; + 1900 : 1248 : queue->rskq_accept_tail = NULL; + 1901 : 1248 : spin_unlock_bh(&queue->rskq_lock); 1902 : : - 1903 [ + + ]: 1252 : if (!head) + 1903 [ + + ]: 1248 : if (!head) 1904 : : return; 1905 : : 1906 : : /* can't acquire the msk socket lock under the subflow one, @@ -2047,44 +2047,44 @@ 1953 : 42 : spin_unlock_bh(&queue->rskq_lock); 1954 : : } 1955 : : - 1956 : 3393 : static int subflow_ulp_init(struct sock *sk) + 1956 : 3394 : static int subflow_ulp_init(struct sock *sk) 1957 : : { - 1958 : 3393 : struct inet_connection_sock *icsk = inet_csk(sk); - 1959 : 3393 : struct mptcp_subflow_context *ctx; - 1960 [ - + ]: 3393 : struct tcp_sock *tp = tcp_sk(sk); - 1961 : 3393 : int err = 0; + 1958 : 3394 : struct inet_connection_sock *icsk = inet_csk(sk); + 1959 : 3394 : struct mptcp_subflow_context *ctx; + 1960 [ - + ]: 3394 : struct tcp_sock *tp = tcp_sk(sk); + 1961 : 3394 : int err = 0; 1962 : : 1963 : : /* disallow attaching ULP to a socket unless it has been 1964 : : * created with sock_create_kern() 1965 : : */ - 1966 [ + + ]: 3393 : if (!sk->sk_kern_sock) { + 1966 [ + + ]: 3394 : if (!sk->sk_kern_sock) { 1967 : 312 : err = -EOPNOTSUPP; 1968 : 312 : goto out; 1969 : : } 1970 : : - 1971 : 3081 : ctx = subflow_create_ctx(sk, GFP_KERNEL); - 1972 [ - + ]: 3081 : if (!ctx) { + 1971 : 3082 : ctx = subflow_create_ctx(sk, GFP_KERNEL); + 1972 [ - + ]: 3082 : if (!ctx) { 1973 : 0 : err = -ENOMEM; 1974 : 0 : goto out; 1975 : : } 1976 : : - 1977 [ - + ]: 3081 : pr_debug("subflow=%p, family=%d\n", ctx, sk->sk_family); + 1977 [ - + ]: 3082 : pr_debug("subflow=%p, family=%d\n", ctx, sk->sk_family); 1978 : : - 1979 : 3081 : tp->is_mptcp = 1; - 1980 : 3081 : ctx->icsk_af_ops = icsk->icsk_af_ops; - 1981 [ + + ]: 3081 : icsk->icsk_af_ops = subflow_default_af_ops(sk); - 1982 : 3081 : ctx->tcp_state_change = sk->sk_state_change; - 1983 : 3081 : ctx->tcp_error_report = sk->sk_error_report; + 1979 : 3082 : tp->is_mptcp = 1; + 1980 : 3082 : ctx->icsk_af_ops = icsk->icsk_af_ops; + 1981 [ + + ]: 3082 : icsk->icsk_af_ops = subflow_default_af_ops(sk); + 1982 : 3082 : ctx->tcp_state_change = sk->sk_state_change; + 1983 : 3082 : ctx->tcp_error_report = sk->sk_error_report; 1984 : : - 1985 [ - + ]: 3081 : WARN_ON_ONCE(sk->sk_data_ready != sock_def_readable); - 1986 [ - + ]: 3081 : WARN_ON_ONCE(sk->sk_write_space != sk_stream_write_space); + 1985 [ - + ]: 3082 : WARN_ON_ONCE(sk->sk_data_ready != sock_def_readable); + 1986 [ - + ]: 3082 : WARN_ON_ONCE(sk->sk_write_space != sk_stream_write_space); 1987 : : - 1988 : 3081 : sk->sk_data_ready = subflow_data_ready; - 1989 : 3081 : sk->sk_write_space = subflow_write_space; - 1990 : 3081 : sk->sk_state_change = subflow_state_change; - 1991 : 3081 : sk->sk_error_report = subflow_error_report; - 1992 : 3393 : out: - 1993 : 3393 : return err; + 1988 : 3082 : sk->sk_data_ready = subflow_data_ready; + 1989 : 3082 : sk->sk_write_space = subflow_write_space; + 1990 : 3082 : sk->sk_state_change = subflow_state_change; + 1991 : 3082 : sk->sk_error_report = subflow_error_report; + 1992 : 3394 : out: + 1993 : 3394 : return err; 1994 : : } 1995 : : 1996 : 4615 : static void subflow_ulp_release(struct sock *ssk) @@ -2113,38 +2113,38 @@ 2019 : 4615 : sock_put(sk); 2020 : : } 2021 : : - 2022 [ + + ]: 4615 : mptcp_subflow_ops_undo_override(ssk); + 2022 [ + + ]: 4615 : mptcp_subflow_ops_undo_override(ssk); 2023 [ + - ]: 4615 : if (release) 2024 : 4615 : kfree_rcu(ctx, rcu); 2025 : : } 2026 : : - 2027 : 1770 : static void subflow_ulp_clone(const struct request_sock *req, + 2027 : 1769 : static void subflow_ulp_clone(const struct request_sock *req, 2028 : : struct sock *newsk, 2029 : : const gfp_t priority) 2030 : : { - 2031 : 1770 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 2032 [ + + ]: 1770 : struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk); - 2033 : 1770 : struct mptcp_subflow_context *new_ctx; + 2031 : 1769 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 2032 [ + + ]: 1769 : struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk); + 2033 : 1769 : struct mptcp_subflow_context *new_ctx; 2034 : : - 2035 [ + + + - ]: 1770 : if (!tcp_rsk(req)->is_mptcp || - 2036 [ + + ]: 1770 : (!subflow_req->mp_capable && !subflow_req->mp_join)) { + 2035 [ + + + - ]: 1769 : if (!tcp_rsk(req)->is_mptcp || + 2036 [ + + ]: 1769 : (!subflow_req->mp_capable && !subflow_req->mp_join)) { 2037 : 76 : subflow_ulp_fallback(newsk, old_ctx); 2038 : 76 : return; 2039 : : } 2040 : : - 2041 : 1694 : new_ctx = subflow_create_ctx(newsk, priority); - 2042 [ - + ]: 1694 : if (!new_ctx) { + 2041 : 1693 : new_ctx = subflow_create_ctx(newsk, priority); + 2042 [ - + ]: 1693 : if (!new_ctx) { 2043 : 0 : subflow_ulp_fallback(newsk, old_ctx); 2044 : 0 : return; 2045 : : } 2046 : : - 2047 : 1694 : new_ctx->conn_finished = 1; - 2048 : 1694 : new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; - 2049 : 1694 : new_ctx->tcp_state_change = old_ctx->tcp_state_change; - 2050 : 1694 : new_ctx->tcp_error_report = old_ctx->tcp_error_report; - 2051 : 1694 : new_ctx->rel_write_seq = 1; + 2047 : 1693 : new_ctx->conn_finished = 1; + 2048 : 1693 : new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; + 2049 : 1693 : new_ctx->tcp_state_change = old_ctx->tcp_state_change; + 2050 : 1693 : new_ctx->tcp_error_report = old_ctx->tcp_error_report; + 2051 : 1693 : new_ctx->rel_write_seq = 1; 2052 : : - 2053 [ + + ]: 1694 : if (subflow_req->mp_capable) { + 2053 [ + + ]: 1693 : if (subflow_req->mp_capable) { 2054 : : /* see comments in subflow_syn_recv_sock(), MPTCP connection 2055 : : * is fully established only after we receive the remote key 2056 : : */ @@ -2156,39 +2156,39 @@ 2062 : : 2063 : : /* this is the first subflow, id is always 0 */ 2064 : 1180 : subflow_set_local_id(new_ctx, 0); - 2065 [ + - ]: 514 : } else if (subflow_req->mp_join) { - 2066 : 514 : new_ctx->ssn_offset = subflow_req->ssn_offset; - 2067 : 514 : new_ctx->mp_join = 1; - 2068 : 514 : WRITE_ONCE(new_ctx->fully_established, true); - 2069 : 514 : new_ctx->remote_key_valid = 1; - 2070 : 514 : new_ctx->backup = subflow_req->backup; - 2071 : 514 : new_ctx->request_bkup = subflow_req->request_bkup; - 2072 : 514 : WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id); - 2073 : 514 : new_ctx->token = subflow_req->token; - 2074 : 514 : new_ctx->thmac = subflow_req->thmac; + 2065 [ + - ]: 513 : } else if (subflow_req->mp_join) { + 2066 : 513 : new_ctx->ssn_offset = subflow_req->ssn_offset; + 2067 : 513 : new_ctx->mp_join = 1; + 2068 : 513 : WRITE_ONCE(new_ctx->fully_established, true); + 2069 : 513 : new_ctx->remote_key_valid = 1; + 2070 : 513 : new_ctx->backup = subflow_req->backup; + 2071 : 513 : new_ctx->request_bkup = subflow_req->request_bkup; + 2072 : 513 : WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id); + 2073 : 513 : new_ctx->token = subflow_req->token; + 2074 : 513 : new_ctx->thmac = subflow_req->thmac; 2075 : : 2076 : : /* the subflow req id is valid, fetched via subflow_check_req() 2077 : : * and subflow_token_join_request() 2078 : : */ - 2079 : 514 : subflow_set_local_id(new_ctx, subflow_req->local_id); + 2079 : 513 : subflow_set_local_id(new_ctx, subflow_req->local_id); 2080 : : } 2081 : : } 2082 : : - 2083 : 529480 : static void tcp_release_cb_override(struct sock *ssk) + 2083 : 591097 : static void tcp_release_cb_override(struct sock *ssk) 2084 : : { - 2085 : 529480 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 2086 : 529480 : long status; + 2085 : 591097 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 2086 : 591097 : long status; 2087 : : 2088 : : /* process and clear all the pending actions, but leave the subflow into 2089 : : * the napi queue. To respect locking, only the same CPU that originated 2090 : : * the action can touch the list. mptcp_napi_poll will take care of it. 2091 : : */ - 2092 [ - + - + ]: 529480 : status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0); - 2093 [ + + ]: 529480 : if (status) - 2094 : 2714 : mptcp_subflow_process_delegated(ssk, status); + 2092 [ - + - + ]: 591097 : status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0); + 2093 [ + + ]: 591097 : if (status) + 2094 : 2388 : mptcp_subflow_process_delegated(ssk, status); 2095 : : - 2096 : 529480 : tcp_release_cb(ssk); - 2097 : 529480 : } + 2096 : 591097 : tcp_release_cb(ssk); + 2097 : 591097 : } 2098 : : 2099 : 0 : static int tcp_abort_override(struct sock *ssk, int err) 2100 : : { diff --git a/html/lcov/export/mptcp/syncookies.c.func-c.html b/html/lcov/export/mptcp/syncookies.c.func-c.html index 16375805..a97272d4 100644 --- a/html/lcov/export/mptcp/syncookies.c.func-c.html +++ b/html/lcov/export/mptcp/syncookies.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/syncookies.c.func.html b/html/lcov/export/mptcp/syncookies.c.func.html index 84a6a8e5..2210299d 100644 --- a/html/lcov/export/mptcp/syncookies.c.func.html +++ b/html/lcov/export/mptcp/syncookies.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/syncookies.c.gcov.html b/html/lcov/export/mptcp/syncookies.c.gcov.html index e4efc43f..a995f9af 100644 --- a/html/lcov/export/mptcp/syncookies.c.gcov.html +++ b/html/lcov/export/mptcp/syncookies.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/token.c.func-c.html b/html/lcov/export/mptcp/token.c.func-c.html index b63dbbde..9dc68c81 100644 --- a/html/lcov/export/mptcp/token.c.func-c.html +++ b/html/lcov/export/mptcp/token.c.func-c.html @@ -31,13 +31,13 @@ export Lines: - 88.7 % + 88.1 % 177 - 157 + 156 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 58.3 % + 57.4 % 108 - 63 + 62 @@ -95,7 +95,7 @@ mptcp_token_get_sock - 694 + 693 @@ -130,7 +130,7 @@ mptcp_token_destroy_request - 1838 + 1837 @@ -144,7 +144,7 @@ mptcp_token_destroy - 3893 + 3911 @@ -158,7 +158,7 @@ mptcp_token_iter_next - 5641 + 5732 diff --git a/html/lcov/export/mptcp/token.c.func.html b/html/lcov/export/mptcp/token.c.func.html index 3951718b..f9e7c90e 100644 --- a/html/lcov/export/mptcp/token.c.func.html +++ b/html/lcov/export/mptcp/token.c.func.html @@ -31,13 +31,13 @@ export Lines: - 88.7 % + 88.1 % 177 - 157 + 156 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 58.3 % + 57.4 % 108 - 63 + 62 @@ -109,14 +109,14 @@ mptcp_token_destroy - 3893 + 3911 mptcp_token_destroy_request - 1838 + 1837 @@ -130,7 +130,7 @@ mptcp_token_get_sock - 694 + 693 @@ -144,7 +144,7 @@ mptcp_token_iter_next - 5641 + 5732 diff --git a/html/lcov/export/mptcp/token.c.gcov.html b/html/lcov/export/mptcp/token.c.gcov.html index c31a0793..96343a65 100644 --- a/html/lcov/export/mptcp/token.c.gcov.html +++ b/html/lcov/export/mptcp/token.c.gcov.html @@ -31,13 +31,13 @@ export Lines: - 88.7 % + 88.1 % 177 - 157 + 156 Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 58.3 % + 57.4 % 108 - 63 + 62 @@ -125,7 +125,7 @@ 47 : : 48 : 0 : static struct token_bucket *token_bucket(u32 token) 49 : : { - 50 : 6391 : return &token_hash[token & token_mask]; + 50 : 6390 : return &token_hash[token & token_mask]; 51 : : } 52 : : 53 : : /* called with bucket lock held */ @@ -150,8 +150,8 @@ 70 : 4855 : struct hlist_nulls_node *pos; 71 : 4855 : struct sock *sk; 72 : : - 73 [ + + ]: 4882 : sk_nulls_for_each_rcu(sk, pos, &t->msk_chain) - 74 [ + + - + ]: 2412 : if (mptcp_sk(sk)->token == token) + 73 [ + + ]: 4872 : sk_nulls_for_each_rcu(sk, pos, &t->msk_chain) + 74 [ + + - + ]: 2402 : if (mptcp_sk(sk)->token == token) 75 [ - + ]: 2385 : return mptcp_sk(sk); 76 : : return NULL; 77 : : } @@ -324,32 +324,32 @@ 243 : : * 244 : : * returns NULL if no connection with the given token value exists. 245 : : */ - 246 : 694 : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) + 246 : 693 : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) 247 : : { - 248 : 694 : struct hlist_nulls_node *pos; - 249 : 694 : struct token_bucket *bucket; - 250 : 694 : struct mptcp_sock *msk; - 251 : 694 : struct sock *sk; + 248 : 693 : struct hlist_nulls_node *pos; + 249 : 693 : struct token_bucket *bucket; + 250 : 693 : struct mptcp_sock *msk; + 251 : 693 : struct sock *sk; 252 : : - 253 : 694 : rcu_read_lock(); - 254 : 694 : bucket = token_bucket(token); + 253 : 693 : rcu_read_lock(); + 254 : 693 : bucket = token_bucket(token); 255 : : 256 : : again: - 257 [ + + ]: 696 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { - 258 [ - + ]: 682 : msk = mptcp_sk(sk); - 259 [ + + - + ]: 992 : if (READ_ONCE(msk->token) != token || + 257 [ + + ]: 693 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + 258 [ - + ]: 679 : msk = mptcp_sk(sk); + 259 [ + - - + ]: 989 : if (READ_ONCE(msk->token) != token || 260 [ - + ]: 60 : !net_eq(sock_net(sk), net)) - 261 : 2 : continue; + 261 : 0 : continue; 262 : : - 263 [ + + ]: 680 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 263 [ + + ]: 679 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 264 : 2 : goto not_found; 265 : : - 266 [ + - - + ]: 987 : if (READ_ONCE(msk->token) != token || + 266 [ + - - + ]: 986 : if (READ_ONCE(msk->token) != token || 267 [ - + ]: 60 : !net_eq(sock_net(sk), net)) { 268 : 0 : sock_put(sk); 269 : 0 : goto again; 270 : : } - 271 : 678 : goto found; + 271 : 677 : goto found; 272 : : } 273 [ - + ]: 14 : if (get_nulls_value(pos) != (token & token_mask)) 274 : 0 : goto again; @@ -357,9 +357,9 @@ 276 : 14 : not_found: 277 : : msk = NULL; 278 : : - 279 : 694 : found: - 280 : 694 : rcu_read_unlock(); - 281 : 694 : return msk; + 279 : 693 : found: + 280 : 693 : rcu_read_unlock(); + 281 : 693 : return msk; 282 : : } 283 : : EXPORT_SYMBOL_GPL(mptcp_token_get_sock); 284 : : @@ -375,50 +375,50 @@ 294 : : * On successful iteration, the iterator is moved to the next position and 295 : : * a reference to the returned socket is acquired. 296 : : */ - 297 : 5641 : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, + 297 : 5732 : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, 298 : : long *s_num) 299 : : { - 300 : 5641 : struct mptcp_sock *ret = NULL; - 301 : 5641 : struct hlist_nulls_node *pos; - 302 : 5641 : int slot, num = 0; + 300 : 5732 : struct mptcp_sock *ret = NULL; + 301 : 5732 : struct hlist_nulls_node *pos; + 302 : 5732 : int slot, num = 0; 303 : : - 304 [ + + ]: 9696777 : for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { - 305 : 9694164 : struct token_bucket *bucket = &token_hash[slot]; - 306 : 9694164 : struct sock *sk; + 304 [ + + ]: 9737828 : for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { + 305 : 9735201 : struct token_bucket *bucket = &token_hash[slot]; + 306 : 9735201 : struct sock *sk; 307 : : - 308 : 9694164 : num = 0; + 308 : 9735201 : num = 0; 309 : : - 310 [ + + ]: 9694164 : if (hlist_nulls_empty(&bucket->msk_chain)) - 311 : 9686521 : continue; + 310 [ + + ]: 9735201 : if (hlist_nulls_empty(&bucket->msk_chain)) + 311 : 9727358 : continue; 312 : : - 313 : 7643 : rcu_read_lock(); - 314 [ + + ]: 12378 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { - 315 : 7763 : ++num; - 316 [ + + ]: 7763 : if (!net_eq(sock_net(sk), net)) - 317 : 1665 : continue; + 313 : 7843 : rcu_read_lock(); + 314 [ + + ]: 12677 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + 315 : 7939 : ++num; + 316 [ + + ]: 7939 : if (!net_eq(sock_net(sk), net)) + 317 : 1693 : continue; 318 : : - 319 [ + + ]: 6098 : if (num <= *s_num) - 320 : 3070 : continue; + 319 [ + + ]: 6246 : if (num <= *s_num) + 320 : 3141 : continue; 321 : : - 322 [ - + ]: 3028 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 322 [ - + ]: 3105 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 323 : 0 : continue; 324 : : - 325 [ - + ]: 3028 : if (!net_eq(sock_net(sk), net)) { + 325 [ - + ]: 3105 : if (!net_eq(sock_net(sk), net)) { 326 : 0 : sock_put(sk); 327 : 0 : continue; 328 : : } 329 : : - 330 [ - + ]: 3028 : ret = mptcp_sk(sk); - 331 : 3028 : rcu_read_unlock(); - 332 : 3028 : goto out; + 330 [ - + ]: 3105 : ret = mptcp_sk(sk); + 331 : 3105 : rcu_read_unlock(); + 332 : 3105 : goto out; 333 : : } - 334 : 4615 : rcu_read_unlock(); + 334 : 4738 : rcu_read_unlock(); 335 : : } 336 : : - 337 : 2613 : out: - 338 : 5641 : *s_slot = slot; - 339 : 5641 : *s_num = num; - 340 : 5641 : return ret; + 337 : 2627 : out: + 338 : 5732 : *s_slot = slot; + 339 : 5732 : *s_num = num; + 340 : 5732 : return ret; 341 : : } 342 : : EXPORT_SYMBOL_GPL(mptcp_token_iter_next); 343 : : @@ -428,13 +428,13 @@ 347 : : * 348 : : * Remove the token associated to @req. 349 : : */ - 350 : 1838 : void mptcp_token_destroy_request(struct request_sock *req) + 350 : 1837 : void mptcp_token_destroy_request(struct request_sock *req) 351 : : { - 352 : 1838 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 353 : 1838 : struct mptcp_subflow_request_sock *pos; - 354 : 1838 : struct token_bucket *bucket; + 352 : 1837 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 353 : 1837 : struct mptcp_subflow_request_sock *pos; + 354 : 1837 : struct token_bucket *bucket; 355 : : - 356 [ + + ]: 1838 : if (hlist_nulls_unhashed(&subflow_req->token_node)) + 356 [ + + ]: 1837 : if (hlist_nulls_unhashed(&subflow_req->token_node)) 357 : : return; 358 : : 359 : 26 : bucket = token_bucket(subflow_req->token); @@ -453,13 +453,13 @@ 372 : : * 373 : : * Remove the token associated to @msk 374 : : */ - 375 : 3893 : void mptcp_token_destroy(struct mptcp_sock *msk) + 375 : 3911 : void mptcp_token_destroy(struct mptcp_sock *msk) 376 : : { - 377 : 3893 : struct sock *sk = (struct sock *)msk; - 378 : 3893 : struct token_bucket *bucket; - 379 : 3893 : struct mptcp_sock *pos; + 377 : 3911 : struct sock *sk = (struct sock *)msk; + 378 : 3911 : struct token_bucket *bucket; + 379 : 3911 : struct mptcp_sock *pos; 380 : : - 381 [ + + ]: 3893 : if (sk_unhashed((struct sock *)msk)) + 381 [ + + ]: 3911 : if (sk_unhashed((struct sock *)msk)) 382 : : return; 383 : : 384 : 2385 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); diff --git a/html/lcov/export/mptcp/token_test.c.func-c.html b/html/lcov/export/mptcp/token_test.c.func-c.html index af6d58d2..f7d9b693 100644 --- a/html/lcov/export/mptcp/token_test.c.func-c.html +++ b/html/lcov/export/mptcp/token_test.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/token_test.c.func.html b/html/lcov/export/mptcp/token_test.c.func.html index 3c16a738..2117e91a 100644 --- a/html/lcov/export/mptcp/token_test.c.func.html +++ b/html/lcov/export/mptcp/token_test.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/token_test.c.gcov.html b/html/lcov/export/mptcp/token_test.c.gcov.html index d5d66113..785f1479 100644 --- a/html/lcov/export/mptcp/token_test.c.gcov.html +++ b/html/lcov/export/mptcp/token_test.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 12:55:35 + 2025-02-04 06:50:51 Functions: 100.0 %