From 107bf546f685f496b36ddec4bec9fc5a9b15270f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 06:41:25 +0000 Subject: [PATCH] lcov: new: export/20250130T054924 --- html/lcov/export/index-sort-b.html | 114 +- html/lcov/export/index-sort-f.html | 58 +- html/lcov/export/index-sort-l.html | 58 +- html/lcov/export/index.html | 58 +- html/lcov/export/mptcp/bpf.c.func-c.html | 10 +- html/lcov/export/mptcp/bpf.c.func.html | 10 +- html/lcov/export/mptcp/bpf.c.gcov.html | 16 +- html/lcov/export/mptcp/crypto.c.func-c.html | 6 +- html/lcov/export/mptcp/crypto.c.func.html | 6 +- html/lcov/export/mptcp/crypto.c.gcov.html | 62 +- .../export/mptcp/crypto_test.c.func-c.html | 2 +- .../lcov/export/mptcp/crypto_test.c.func.html | 2 +- .../lcov/export/mptcp/crypto_test.c.gcov.html | 2 +- html/lcov/export/mptcp/ctrl.c.func-c.html | 18 +- html/lcov/export/mptcp/ctrl.c.func.html | 18 +- html/lcov/export/mptcp/ctrl.c.gcov.html | 62 +- html/lcov/export/mptcp/diag.c.func-c.html | 2 +- html/lcov/export/mptcp/diag.c.func.html | 2 +- html/lcov/export/mptcp/diag.c.gcov.html | 2 +- html/lcov/export/mptcp/fastopen.c.func-c.html | 2 +- html/lcov/export/mptcp/fastopen.c.func.html | 2 +- html/lcov/export/mptcp/fastopen.c.gcov.html | 2 +- html/lcov/export/mptcp/mib.c.func-c.html | 4 +- html/lcov/export/mptcp/mib.c.func.html | 4 +- html/lcov/export/mptcp/mib.c.gcov.html | 34 +- html/lcov/export/mptcp/mib.h.func-c.html | 8 +- html/lcov/export/mptcp/mib.h.func.html | 8 +- html/lcov/export/mptcp/mib.h.gcov.html | 112 +- .../export/mptcp/mptcp_diag.c.func-c.html | 18 +- html/lcov/export/mptcp/mptcp_diag.c.func.html | 18 +- html/lcov/export/mptcp/mptcp_diag.c.gcov.html | 186 +- html/lcov/export/mptcp/options.c.func-c.html | 56 +- html/lcov/export/mptcp/options.c.func.html | 56 +- html/lcov/export/mptcp/options.c.gcov.html | 1368 ++++---- html/lcov/export/mptcp/pm.c.func-c.html | 28 +- html/lcov/export/mptcp/pm.c.func.html | 24 +- html/lcov/export/mptcp/pm.c.gcov.html | 246 +- .../export/mptcp/pm_netlink.c.func-c.html | 72 +- html/lcov/export/mptcp/pm_netlink.c.func.html | 60 +- html/lcov/export/mptcp/pm_netlink.c.gcov.html | 522 +-- .../export/mptcp/pm_userspace.c.func-c.html | 4 +- .../export/mptcp/pm_userspace.c.func.html | 4 +- .../export/mptcp/pm_userspace.c.gcov.html | 14 +- html/lcov/export/mptcp/protocol.c.func-c.html | 324 +- html/lcov/export/mptcp/protocol.c.func.html | 210 +- html/lcov/export/mptcp/protocol.c.gcov.html | 3106 ++++++++--------- html/lcov/export/mptcp/protocol.h.func-c.html | 96 +- html/lcov/export/mptcp/protocol.h.func.html | 74 +- html/lcov/export/mptcp/protocol.h.gcov.html | 515 +-- html/lcov/export/mptcp/sched.c.func-c.html | 14 +- html/lcov/export/mptcp/sched.c.func.html | 14 +- html/lcov/export/mptcp/sched.c.gcov.html | 114 +- html/lcov/export/mptcp/sockopt.c.func-c.html | 16 +- html/lcov/export/mptcp/sockopt.c.func.html | 16 +- html/lcov/export/mptcp/sockopt.c.gcov.html | 234 +- html/lcov/export/mptcp/subflow.c.func-c.html | 134 +- html/lcov/export/mptcp/subflow.c.func.html | 98 +- html/lcov/export/mptcp/subflow.c.gcov.html | 1246 +++---- .../export/mptcp/syncookies.c.func-c.html | 2 +- html/lcov/export/mptcp/syncookies.c.func.html | 2 +- html/lcov/export/mptcp/syncookies.c.gcov.html | 2 +- html/lcov/export/mptcp/token.c.func-c.html | 12 +- html/lcov/export/mptcp/token.c.func.html | 12 +- html/lcov/export/mptcp/token.c.gcov.html | 140 +- .../export/mptcp/token_test.c.func-c.html | 2 +- html/lcov/export/mptcp/token_test.c.func.html | 2 +- html/lcov/export/mptcp/token_test.c.gcov.html | 2 +- 67 files changed, 4881 insertions(+), 4866 deletions(-) diff --git a/html/lcov/export/index-sort-b.html b/html/lcov/export/index-sort-b.html index a11faef8..4eb1fe7c 100644 --- a/html/lcov/export/index-sort-b.html +++ b/html/lcov/export/index-sort-b.html @@ -31,13 +31,13 @@ export Lines: - 89.0 % + 89.1 % 8227 - 7326 + 7328 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 96.4 % @@ -53,9 +53,9 @@ Branches: - 64.7 % - 6471 - 4185 + 64.6 % + 6549 + 4232 @@ -99,6 +99,21 @@ Total Hit + + mptcp/mib.h + +
84.6%84.6%
+ + 84.6 % + 13 + 11 + 42.4 % + 278 + 118 + 100.0 % + 1 + 1 + mptcp/pm_userspace.c @@ -114,21 +129,6 @@ 17 17 - - mptcp/mib.h - -
84.6%84.6%
- - 84.6 % - 13 - 11 - 44.9 % - 254 - 114 - 100.0 % - 1 - 1 - mptcp/fastopen.c @@ -212,13 +212,28 @@ 89.3 % 1277 1140 - 61.5 % + 61.4 % 1026 - 631 + 630 100.0 % 77 77 + + mptcp/subflow.c + +
90.5%90.5%
+ + 90.5 % + 1135 + 1027 + 63.6 % + 854 + 543 + 95.5 % + 67 + 64 + mptcp/bpf.c @@ -227,27 +242,27 @@ 82.6 % 115 95 - 62.3 % + 63.6 % 77 - 48 + 49 85.0 % 20 17 - mptcp/subflow.c + mptcp/mptcp_diag.c -
90.3%90.3%
+
72.9%72.9%
- 90.3 % - 1135 - 1025 - 63.1 % - 854 - 539 - 95.5 % - 67 - 64 + 72.9 % + 133 + 97 + 64.3 % + 70 + 45 + 71.4 % + 7 + 5 mptcp/ctrl.c @@ -279,21 +294,6 @@ 12 12 - - mptcp/mptcp_diag.c - -
73.7%73.7%
- - 73.7 % - 133 - 98 - 65.7 % - 70 - 46 - 71.4 % - 7 - 5 - mptcp/protocol.c @@ -301,7 +301,7 @@ 91.1 % 2158 - 1966 + 1967 69.3 % 1623 1124 @@ -332,9 +332,9 @@ 94.5 % 235 222 - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 100.0 % 34 34 @@ -377,9 +377,9 @@ 98.3 % 876 861 - 78.1 % + 77.8 % 689 - 538 + 536 100.0 % 27 27 diff --git a/html/lcov/export/index-sort-f.html b/html/lcov/export/index-sort-f.html index 183c571f..a971ec11 100644 --- a/html/lcov/export/index-sort-f.html +++ b/html/lcov/export/index-sort-f.html @@ -31,13 +31,13 @@ export Lines: - 89.0 % + 89.1 % 8227 - 7326 + 7328 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 96.4 % @@ -53,9 +53,9 @@ Branches: - 64.7 % - 6471 - 4185 + 64.6 % + 6549 + 4232 @@ -117,14 +117,14 @@ mptcp/mptcp_diag.c -
73.7%73.7%
+
72.9%72.9%
- 73.7 % + 72.9 % 133 - 98 - 65.7 % + 97 + 64.3 % 70 - 46 + 45 71.4 % 7 5 @@ -137,9 +137,9 @@ 82.6 % 115 95 - 62.3 % + 63.6 % 77 - 48 + 49 85.0 % 20 17 @@ -166,7 +166,7 @@ 91.1 % 2158 - 1966 + 1967 69.3 % 1623 1124 @@ -177,14 +177,14 @@ mptcp/subflow.c -
90.3%90.3%
+
90.5%90.5%
- 90.3 % + 90.5 % 1135 - 1025 - 63.1 % + 1027 + 63.6 % 854 - 539 + 543 95.5 % 67 64 @@ -227,9 +227,9 @@ 84.6 % 13 11 - 44.9 % - 254 - 114 + 42.4 % + 278 + 118 100.0 % 1 1 @@ -362,9 +362,9 @@ 98.3 % 876 861 - 78.1 % + 77.8 % 689 - 538 + 536 100.0 % 27 27 @@ -392,9 +392,9 @@ 94.5 % 235 222 - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 100.0 % 34 34 @@ -407,9 +407,9 @@ 89.3 % 1277 1140 - 61.5 % + 61.4 % 1026 - 631 + 630 100.0 % 77 77 diff --git a/html/lcov/export/index-sort-l.html b/html/lcov/export/index-sort-l.html index f775f9fc..77b89b21 100644 --- a/html/lcov/export/index-sort-l.html +++ b/html/lcov/export/index-sort-l.html @@ -31,13 +31,13 @@ export Lines: - 89.0 % + 89.1 % 8227 - 7326 + 7328 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 96.4 % @@ -53,9 +53,9 @@ Branches: - 64.7 % - 6471 - 4185 + 64.6 % + 6549 + 4232 @@ -117,14 +117,14 @@ mptcp/mptcp_diag.c -
73.7%73.7%
+
72.9%72.9%
- 73.7 % + 72.9 % 133 - 98 - 65.7 % + 97 + 64.3 % 70 - 46 + 45 71.4 % 7 5 @@ -167,9 +167,9 @@ 82.6 % 115 95 - 62.3 % + 63.6 % 77 - 48 + 49 85.0 % 20 17 @@ -182,9 +182,9 @@ 84.6 % 13 11 - 44.9 % - 254 - 114 + 42.4 % + 278 + 118 100.0 % 1 1 @@ -212,9 +212,9 @@ 89.3 % 1277 1140 - 61.5 % + 61.4 % 1026 - 631 + 630 100.0 % 77 77 @@ -222,14 +222,14 @@ mptcp/subflow.c -
90.3%90.3%
+
90.5%90.5%
- 90.3 % + 90.5 % 1135 - 1025 - 63.1 % + 1027 + 63.6 % 854 - 539 + 543 95.5 % 67 64 @@ -256,7 +256,7 @@ 91.1 % 2158 - 1966 + 1967 69.3 % 1623 1124 @@ -302,9 +302,9 @@ 94.5 % 235 222 - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 100.0 % 34 34 @@ -377,9 +377,9 @@ 98.3 % 876 861 - 78.1 % + 77.8 % 689 - 538 + 536 100.0 % 27 27 diff --git a/html/lcov/export/index.html b/html/lcov/export/index.html index 2b3987a9..47899b59 100644 --- a/html/lcov/export/index.html +++ b/html/lcov/export/index.html @@ -31,13 +31,13 @@ export Lines: - 89.0 % + 89.1 % 8227 - 7326 + 7328 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 96.4 % @@ -53,9 +53,9 @@ Branches: - 64.7 % - 6471 - 4185 + 64.6 % + 6549 + 4232 @@ -107,9 +107,9 @@ 82.6 % 115 95 - 62.3 % + 63.6 % 77 - 48 + 49 85.0 % 20 17 @@ -212,9 +212,9 @@ 84.6 % 13 11 - 44.9 % - 254 - 114 + 42.4 % + 278 + 118 100.0 % 1 1 @@ -222,14 +222,14 @@ mptcp/mptcp_diag.c -
73.7%73.7%
+
72.9%72.9%
- 73.7 % + 72.9 % 133 - 98 - 65.7 % + 97 + 64.3 % 70 - 46 + 45 71.4 % 7 5 @@ -242,9 +242,9 @@ 98.3 % 876 861 - 78.1 % + 77.8 % 689 - 538 + 536 100.0 % 27 27 @@ -272,9 +272,9 @@ 89.3 % 1277 1140 - 61.5 % + 61.4 % 1026 - 631 + 630 100.0 % 77 77 @@ -301,7 +301,7 @@ 91.1 % 2158 - 1966 + 1967 69.3 % 1623 1124 @@ -317,9 +317,9 @@ 94.5 % 235 222 - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 100.0 % 34 34 @@ -357,14 +357,14 @@ mptcp/subflow.c -
90.3%90.3%
+
90.5%90.5%
- 90.3 % + 90.5 % 1135 - 1025 - 63.1 % + 1027 + 63.6 % 854 - 539 + 543 95.5 % 67 64 diff --git a/html/lcov/export/mptcp/bpf.c.func-c.html b/html/lcov/export/mptcp/bpf.c.func-c.html index be0875ff..b83a3e86 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 85.0 % @@ -56,9 +56,9 @@ Branches: - 62.3 % + 63.6 % 77 - 48 + 49 @@ -151,7 +151,7 @@ bpf_mptcp_subflow_queues_empty - 6 + 10 @@ -214,7 +214,7 @@ bpf_mptcp_subflow_ctx_by_pos - 542917 + 542452 diff --git a/html/lcov/export/mptcp/bpf.c.func.html b/html/lcov/export/mptcp/bpf.c.func.html index 237e2c5b..aae9f589 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 85.0 % @@ -56,9 +56,9 @@ Branches: - 62.3 % + 63.6 % 77 - 48 + 49 @@ -207,14 +207,14 @@ bpf_mptcp_subflow_ctx_by_pos - 542917 + 542452 bpf_mptcp_subflow_queues_empty - 6 + 10 diff --git a/html/lcov/export/mptcp/bpf.c.gcov.html b/html/lcov/export/mptcp/bpf.c.gcov.html index 0a666aa1..df202d72 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 85.0 % @@ -56,9 +56,9 @@ Branches: - 62.3 % + 63.6 % 77 - 48 + 49 @@ -370,16 +370,16 @@ 291 : 6 : } 292 : : 293 : : __bpf_kfunc struct mptcp_subflow_context * - 294 : 542917 : bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) + 294 : 542452 : bpf_mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos) 295 : : { - 296 [ + - ]: 542917 : if (pos >= MPTCP_SUBFLOWS_MAX) + 296 [ + + ]: 542452 : if (pos >= MPTCP_SUBFLOWS_MAX) 297 : : return NULL; - 298 : 542917 : return data->contexts[pos]; + 298 : 542451 : return data->contexts[pos]; 299 : : } 300 : : - 301 : 6 : __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk) + 301 : 10 : __bpf_kfunc static bool bpf_mptcp_subflow_queues_empty(struct sock *sk) 302 : : { - 303 : 6 : return tcp_rtx_queue_empty(sk); + 303 : 10 : return tcp_rtx_queue_empty(sk); 304 : : } 305 : : 306 : : __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 216f3423..3ea72756 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -81,14 +81,14 @@ mptcp_crypto_hmac_sha - 2772 + 2776 mptcp_crypto_key_sha - 5961 + 6020 diff --git a/html/lcov/export/mptcp/crypto.c.func.html b/html/lcov/export/mptcp/crypto.c.func.html index 5aa8c1a8..11afdcff 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -81,14 +81,14 @@ mptcp_crypto_hmac_sha - 2772 + 2776 mptcp_crypto_key_sha - 5961 + 6020 diff --git a/html/lcov/export/mptcp/crypto.c.gcov.html b/html/lcov/export/mptcp/crypto.c.gcov.html index 376f80a8..564f68e5 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -106,55 +106,55 @@ 28 : : 29 : : #define SHA256_DIGEST_WORDS (SHA256_DIGEST_SIZE / 4) 30 : : - 31 : 5961 : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) + 31 : 6020 : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) 32 : : { - 33 : 5961 : __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS]; - 34 : 5961 : __be64 input = cpu_to_be64(key); + 33 : 6020 : __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS]; + 34 : 6020 : __be64 input = cpu_to_be64(key); 35 : : - 36 : 5961 : sha256((__force u8 *)&input, sizeof(input), (u8 *)mptcp_hashed_key); + 36 : 6020 : sha256((__force u8 *)&input, sizeof(input), (u8 *)mptcp_hashed_key); 37 : : - 38 [ + + ]: 5961 : if (token) + 38 [ + + ]: 6020 : if (token) 39 : 3058 : *token = be32_to_cpu(mptcp_hashed_key[0]); - 40 [ + + ]: 5961 : if (idsn) - 41 : 5401 : *idsn = be64_to_cpu(*((__be64 *)&mptcp_hashed_key[6])); - 42 : 5961 : } + 40 [ + + ]: 6020 : if (idsn) + 41 : 5460 : *idsn = be64_to_cpu(*((__be64 *)&mptcp_hashed_key[6])); + 42 : 6020 : } 43 : : - 44 : 2772 : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) + 44 : 2776 : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) 45 : : { - 46 : 2772 : u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE]; - 47 : 2772 : u8 key1be[8]; - 48 : 2772 : u8 key2be[8]; - 49 : 2772 : int i; + 46 : 2776 : u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE]; + 47 : 2776 : u8 key1be[8]; + 48 : 2776 : u8 key2be[8]; + 49 : 2776 : int i; 50 : : - 51 [ - + ]: 2772 : if (WARN_ON_ONCE(len > SHA256_DIGEST_SIZE)) + 51 [ - + ]: 2776 : if (WARN_ON_ONCE(len > SHA256_DIGEST_SIZE)) 52 : 0 : len = SHA256_DIGEST_SIZE; 53 : : - 54 : 2772 : put_unaligned_be64(key1, key1be); - 55 : 2772 : put_unaligned_be64(key2, key2be); + 54 : 2776 : put_unaligned_be64(key1, key1be); + 55 : 2776 : put_unaligned_be64(key2, key2be); 56 : : 57 : : /* Generate key xored with ipad */ - 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]; + 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]; 63 : : - 64 : 2772 : memcpy(&input[SHA256_BLOCK_SIZE], msg, len); + 64 : 2776 : 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 : 2772 : sha256(input, SHA256_BLOCK_SIZE + len, &input[SHA256_BLOCK_SIZE]); + 69 : 2776 : sha256(input, SHA256_BLOCK_SIZE + len, &input[SHA256_BLOCK_SIZE]); 70 : : 71 : : /* Prepare second part of hmac */ - 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]; + 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]; 77 : : - 78 : 2772 : sha256(input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE, hmac); - 79 : 2772 : } + 78 : 2776 : sha256(input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE, hmac); + 79 : 2776 : } 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 c452adfb..661f3a58 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 ae83a338..0caf1be8 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 11920033..72d048ca 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 625cb2fe..fca46b2d 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -130,7 +130,7 @@ mptcp_stale_loss_cnt - 285 + 187 @@ -144,21 +144,21 @@ mptcp_active_detect_blackhole - 814 + 812 mptcp_net_exit - 1016 + 1020 mptcp_pernet_del_table - 1016 + 1020 @@ -214,7 +214,7 @@ mptcp_close_timeout - 2984 + 3258 @@ -228,21 +228,21 @@ mptcp_allow_join_id0 - 4840 + 4876 mptcp_is_checksum_enabled - 6875 + 6876 mptcp_get_pernet - 12910 + 12874 diff --git a/html/lcov/export/mptcp/ctrl.c.func.html b/html/lcov/export/mptcp/ctrl.c.func.html index d0600ba3..c689079b 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -81,7 +81,7 @@ mptcp_active_detect_blackhole - 814 + 812 @@ -109,14 +109,14 @@ mptcp_allow_join_id0 - 4840 + 4876 mptcp_close_timeout - 2984 + 3258 @@ -130,7 +130,7 @@ mptcp_get_pernet - 12910 + 12874 @@ -158,7 +158,7 @@ mptcp_is_checksum_enabled - 6875 + 6876 @@ -172,7 +172,7 @@ mptcp_net_exit - 1016 + 1020 @@ -186,7 +186,7 @@ mptcp_pernet_del_table - 1016 + 1020 @@ -214,7 +214,7 @@ mptcp_stale_loss_cnt - 285 + 187 diff --git a/html/lcov/export/mptcp/ctrl.c.gcov.html b/html/lcov/export/mptcp/ctrl.c.gcov.html index 9ac35a94..891bf263 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -119,9 +119,9 @@ 41 : : char scheduler[MPTCP_SCHED_NAME_MAX]; 42 : : }; 43 : : - 44 : 12910 : static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) + 44 : 12874 : static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) 45 : : { - 46 : 13480 : return net_generic(net, mptcp_pernet_id); + 46 : 13735 : return net_generic(net, mptcp_pernet_id); 47 : : } 48 : : 49 : 2534 : int mptcp_is_enabled(const struct net *net) @@ -134,26 +134,26 @@ 56 : 392 : return mptcp_get_pernet(net)->add_addr_timeout; 57 : : } 58 : : - 59 : 6875 : int mptcp_is_checksum_enabled(const struct net *net) + 59 : 6876 : int mptcp_is_checksum_enabled(const struct net *net) 60 : : { - 61 : 6875 : return mptcp_get_pernet(net)->checksum_enabled; + 61 : 6876 : return mptcp_get_pernet(net)->checksum_enabled; 62 : : } 63 : : - 64 : 4840 : int mptcp_allow_join_id0(const struct net *net) + 64 : 4876 : int mptcp_allow_join_id0(const struct net *net) 65 : : { - 66 : 4840 : return mptcp_get_pernet(net)->allow_join_initial_addr_port; + 66 : 4876 : return mptcp_get_pernet(net)->allow_join_initial_addr_port; 67 : : } 68 : : - 69 : 285 : unsigned int mptcp_stale_loss_cnt(const struct net *net) + 69 : 187 : unsigned int mptcp_stale_loss_cnt(const struct net *net) 70 : : { - 71 : 285 : return mptcp_get_pernet(net)->stale_loss_cnt; + 71 : 187 : return mptcp_get_pernet(net)->stale_loss_cnt; 72 : : } 73 : : - 74 : 2984 : unsigned int mptcp_close_timeout(const struct sock *sk) + 74 : 3258 : unsigned int mptcp_close_timeout(const struct sock *sk) 75 : : { - 76 [ + + ]: 2984 : if (sock_flag(sk, SOCK_DEAD)) + 76 [ + + ]: 3258 : if (sock_flag(sk, SOCK_DEAD)) 77 : : return TCP_TIMEWAIT_LEN; - 78 : 112 : return mptcp_get_pernet(sock_net(sk))->close_timeout; + 78 : 696 : return mptcp_get_pernet(sock_net(sk))->close_timeout; 79 : : } 80 : : 81 : 3754 : int mptcp_get_pm_type(const struct net *net) @@ -373,14 +373,14 @@ 295 : : return -ENOMEM; 296 : : } 297 : : - 298 : 1016 : static void mptcp_pernet_del_table(struct mptcp_pernet *pernet) + 298 : 1020 : static void mptcp_pernet_del_table(struct mptcp_pernet *pernet) 299 : : { - 300 : 1016 : const struct ctl_table *table = pernet->ctl_table_hdr->ctl_table_arg; + 300 : 1020 : const struct ctl_table *table = pernet->ctl_table_hdr->ctl_table_arg; 301 : : - 302 : 1016 : unregister_net_sysctl_table(pernet->ctl_table_hdr); + 302 : 1020 : unregister_net_sysctl_table(pernet->ctl_table_hdr); 303 : : - 304 : 1016 : kfree(table); - 305 : 1016 : } + 304 : 1020 : kfree(table); + 305 : 1020 : } 306 : : 307 : : #else 308 : : @@ -477,24 +477,24 @@ 398 : 1124 : } 399 : : 400 : : /* Check the number of retransmissions, and fallback to TCP if needed */ - 401 : 814 : void mptcp_active_detect_blackhole(struct sock *ssk, bool expired) + 401 : 812 : void mptcp_active_detect_blackhole(struct sock *ssk, bool expired) 402 : : { - 403 : 814 : struct mptcp_subflow_context *subflow; - 404 : 814 : u8 timeouts, to_max; - 405 : 814 : struct net *net; + 403 : 812 : struct mptcp_subflow_context *subflow; + 404 : 812 : u8 timeouts, to_max; + 405 : 812 : struct net *net; 406 : : 407 : : /* Only check MPTCP SYN ... */ - 408 [ + + + + : 814 : if (likely(!sk_is_mptcp(ssk) || ssk->sk_state != TCP_SYN_SENT)) - + + ] + 408 [ + + + + : 812 : if (likely(!sk_is_mptcp(ssk) || ssk->sk_state != TCP_SYN_SENT)) + + + ] 409 : : return; 410 : : - 411 [ + + ]: 78 : subflow = mptcp_subflow_ctx(ssk); + 411 [ + + ]: 77 : subflow = mptcp_subflow_ctx(ssk); 412 : : 413 : : /* ... + MP_CAPABLE */ - 414 [ + + ]: 78 : if (!subflow->request_mptcp) { + 414 [ + + ]: 77 : 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; + 416 : 41 : subflow->mpc_drop = 0; + 417 : 41 : return; 418 : : } 419 : : 420 : 36 : net = sock_net(ssk); @@ -518,12 +518,12 @@ 438 : : } 439 : : 440 : : /* Note: the callback will only be called per extra netns */ - 441 : 1016 : static void __net_exit mptcp_net_exit(struct net *net) + 441 : 1020 : static void __net_exit mptcp_net_exit(struct net *net) 442 : : { - 443 : 1016 : struct mptcp_pernet *pernet = mptcp_get_pernet(net); + 443 : 1020 : struct mptcp_pernet *pernet = mptcp_get_pernet(net); 444 : : - 445 : 1016 : mptcp_pernet_del_table(pernet); - 446 : 1016 : } + 445 : 1020 : mptcp_pernet_del_table(pernet); + 446 : 1020 : } 447 : : 448 : : static struct pernet_operations mptcp_pernet_ops = { 449 : : .init = mptcp_net_init, diff --git a/html/lcov/export/mptcp/diag.c.func-c.html b/html/lcov/export/mptcp/diag.c.func-c.html index fa200115..a35f15f7 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 66.7 % diff --git a/html/lcov/export/mptcp/diag.c.func.html b/html/lcov/export/mptcp/diag.c.func.html index 3b28668e..c260c084 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 66.7 % diff --git a/html/lcov/export/mptcp/diag.c.gcov.html b/html/lcov/export/mptcp/diag.c.gcov.html index 16c13d86..c3981b8d 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 66.7 % diff --git a/html/lcov/export/mptcp/fastopen.c.func-c.html b/html/lcov/export/mptcp/fastopen.c.func-c.html index 4ff3547d..9be04935 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/fastopen.c.func.html b/html/lcov/export/mptcp/fastopen.c.func.html index 8de22d4a..5096504f 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/fastopen.c.gcov.html b/html/lcov/export/mptcp/fastopen.c.gcov.html index 4aa26f6f..897cf68e 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 fdbf8196..61841408 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -88,7 +88,7 @@ mptcp_seq_show - 8603 + 8606 diff --git a/html/lcov/export/mptcp/mib.c.func.html b/html/lcov/export/mptcp/mib.c.func.html index 75d99f23..b4854f20 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -88,7 +88,7 @@ mptcp_seq_show - 8603 + 8606 diff --git a/html/lcov/export/mptcp/mib.c.gcov.html b/html/lcov/export/mptcp/mib.c.gcov.html index 5e1e7e27..f3c301ac 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -178,29 +178,29 @@ 100 : : return true; 101 : : } 102 : : - 103 : 8603 : void mptcp_seq_show(struct seq_file *seq) + 103 : 8606 : void mptcp_seq_show(struct seq_file *seq) 104 : : { - 105 : 8603 : unsigned long sum[ARRAY_SIZE(mptcp_snmp_list) - 1]; - 106 : 8603 : struct net *net = seq->private; - 107 : 8603 : int i; + 105 : 8606 : unsigned long sum[ARRAY_SIZE(mptcp_snmp_list) - 1]; + 106 : 8606 : struct net *net = seq->private; + 107 : 8606 : int i; 108 : : - 109 : 8603 : seq_puts(seq, "MPTcpExt:"); - 110 [ + + ]: 619416 : for (i = 0; mptcp_snmp_list[i].name; i++) - 111 : 602210 : seq_printf(seq, " %s", mptcp_snmp_list[i].name); + 109 : 8606 : seq_puts(seq, "MPTcpExt:"); + 110 [ + + ]: 619632 : for (i = 0; mptcp_snmp_list[i].name; i++) + 111 : 602420 : seq_printf(seq, " %s", mptcp_snmp_list[i].name); 112 : : - 113 : 8603 : seq_puts(seq, "\nMPTcpExt:"); + 113 : 8606 : seq_puts(seq, "\nMPTcpExt:"); 114 : : - 115 : 8603 : memset(sum, 0, sizeof(sum)); - 116 [ + + ]: 8603 : if (net->mib.mptcp_statistics) - 117 [ + + + - : 2266890 : snmp_get_cpu_field_batch(sum, mptcp_snmp_list, - + - ] + 115 : 8606 : memset(sum, 0, sizeof(sum)); + 116 [ + + ]: 8606 : if (net->mib.mptcp_statistics) + 117 [ + + + - : 2267175 : snmp_get_cpu_field_batch(sum, mptcp_snmp_list, + + - ] 118 : : net->mib.mptcp_statistics); 119 : : - 120 [ + + ]: 610813 : for (i = 0; mptcp_snmp_list[i].name; i++) - 121 : 602210 : seq_printf(seq, " %lu", sum[i]); + 120 [ + + ]: 611026 : for (i = 0; mptcp_snmp_list[i].name; i++) + 121 : 602420 : seq_printf(seq, " %lu", sum[i]); 122 : : - 123 : 8603 : seq_putc(seq, '\n'); - 124 : 8603 : } + 123 : 8606 : seq_putc(seq, '\n'); + 124 : 8606 : } diff --git a/html/lcov/export/mptcp/mib.h.func-c.html b/html/lcov/export/mptcp/mib.h.func-c.html index 4ff717ea..1f489332 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 44.9 % - 254 - 114 + 42.4 % + 278 + 118 diff --git a/html/lcov/export/mptcp/mib.h.func.html b/html/lcov/export/mptcp/mib.h.func.html index 2464825f..b4aa243f 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 44.9 % - 254 - 114 + 42.4 % + 278 + 118 diff --git a/html/lcov/export/mptcp/mib.h.gcov.html b/html/lcov/export/mptcp/mib.h.gcov.html index 452aaf3e..4de8ece6 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 44.9 % - 254 - 114 + 42.4 % + 278 + 118 @@ -178,63 +178,67 @@ 99 : 0 : static inline void MPTCP_INC_STATS(struct net *net, 100 : : enum linux_mptcp_mib_field field) 101 : : { - 102 [ + - # # ]: 313693 : if (likely(net->mib.mptcp_statistics)) - [ + - + - - + - + - + - - + - - - - - - + - - - + - - + - - + - + - + - - + - - - - + - + - + - - + - + - - + - - - - - - - - + - - + - + - ] - [ + - + - - + - + - + - - + - - - - + - + - + - + - - + - - + - + - + - - + - + - - + - + - + - - + - + - - + - - - - - - - - + - - + - + - ] - [ + - + - - - - + - + - - + - - - - + - + - + - - - - - - - - - + - - - - + - + - - + - + - + - - + - + - - + - ][ + - - + - - + + - - + - + - - + - + - + - - + - + - - + - + - + - - + - + - - ] - 103 [ - + - + : 261524 : SNMP_INC_STATS(net->mib.mptcp_statistics, field); - - + - + + + 102 [ + - ][ + - : 369896 : if (likely(net->mib.mptcp_statistics)) + + - + - + + - + - - - + - - - - + + - - + - - + + - + - + + - + - + - + - - + - + + - + - + - + + - + - - + - - - - - + + - + - + + - ][ + - + + - + - + - + + - + - + + - - - + - + + + + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - - - + - - - - + + - + - + + - ][ + - + + - - - + - + + - + - - + - + - + - + + - - - - + - + - + - + - - + - + + - + - + - + + - + - + + - + - - - + - - - - - + - - - - + - ][ + - + + - - - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + - - - - + + - - - ] + 103 [ - + - + : 267296 : 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 [ - - + - : 213 : if (likely(net->mib.mptcp_statistics)) - + - ] + 109 [ - - + - : 212 : 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 4215f90a..63f5ce73 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: - 73.7 % + 72.9 % 133 - 98 + 97 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 71.4 % @@ -56,9 +56,9 @@ Branches: - 65.7 % + 64.3 % 70 - 46 + 45 @@ -102,28 +102,28 @@ mptcp_diag_dump_listeners - 66 + 75 mptcp_diag_dump - 829 + 859 mptcp_diag_get_info - 1268 + 1322 sk_diag_dump - 1300 + 1354 diff --git a/html/lcov/export/mptcp/mptcp_diag.c.func.html b/html/lcov/export/mptcp/mptcp_diag.c.func.html index ccccb066..32b1c672 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: - 73.7 % + 72.9 % 133 - 98 + 97 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 71.4 % @@ -56,9 +56,9 @@ Branches: - 65.7 % + 64.3 % 70 - 46 + 45 @@ -81,14 +81,14 @@ mptcp_diag_dump - 829 + 859 mptcp_diag_dump_listeners - 66 + 75 @@ -109,7 +109,7 @@ mptcp_diag_get_info - 1268 + 1322 @@ -123,7 +123,7 @@ sk_diag_dump - 1300 + 1354 diff --git a/html/lcov/export/mptcp/mptcp_diag.c.gcov.html b/html/lcov/export/mptcp/mptcp_diag.c.gcov.html index 2fa118e5..ede64b93 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: - 73.7 % + 72.9 % 133 - 98 + 97 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 71.4 % @@ -56,9 +56,9 @@ Branches: - 65.7 % + 64.3 % 70 - 46 + 45 @@ -90,15 +90,15 @@ 12 : : #include <net/netlink.h> 13 : : #include "protocol.h" 14 : : - 15 : 1300 : static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, + 15 : 1354 : 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 [ + + ]: 1300 : if (!inet_diag_bc_sk(bc, sk)) + 20 [ + + ]: 1354 : if (!inet_diag_bc_sk(bc, sk)) 21 : : return 0; 22 : : - 23 : 1286 : return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, req, NLM_F_MULTI, + 23 : 1340 : 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 : 66 : static void mptcp_diag_dump_listeners(struct sk_buff *skb, struct netlink_callback *cb, + 75 : 75 : 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 : 66 : struct inet_diag_dump_data *cb_data = cb->data; - 80 : 66 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; - 81 : 66 : struct nlattr *bc = cb_data->inet_diag_nla_bc; - 82 : 66 : struct net *net = sock_net(skb->sk); - 83 : 66 : struct inet_hashinfo *hinfo; - 84 : 66 : int i; + 79 : 75 : struct inet_diag_dump_data *cb_data = cb->data; + 80 : 75 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + 81 : 75 : struct nlattr *bc = cb_data->inet_diag_nla_bc; + 82 : 75 : struct net *net = sock_net(skb->sk); + 83 : 75 : struct inet_hashinfo *hinfo; + 84 : 75 : int i; 85 : : - 86 : 66 : hinfo = net->ipv4.tcp_death_row.hashinfo; + 86 : 75 : hinfo = net->ipv4.tcp_death_row.hashinfo; 87 : : - 88 [ + + ]: 102466 : 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; + 88 [ + + ]: 118859 : for (i = diag_ctx->l_slot; i <= hinfo->lhash2_mask; i++) { + 89 : 118790 : struct inet_listen_hashbucket *ilb; + 90 : 118790 : struct hlist_nulls_node *node; + 91 : 118790 : struct sock *sk; + 92 : 118790 : int num = 0; 93 : : - 94 : 102406 : ilb = &hinfo->lhash2[i]; + 94 : 118790 : ilb = &hinfo->lhash2[i]; 95 : : - 96 : 102406 : rcu_read_lock(); - 97 : 102406 : spin_lock(&ilb->lock); - 98 [ + + ]: 103020 : sk_nulls_for_each(sk, node, &ilb->nulls_head) { - 99 [ - + ]: 620 : const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); - 100 : 620 : struct inet_sock *inet = inet_sk(sk); - 101 : 620 : int ret; + 96 : 118790 : rcu_read_lock(); + 97 : 118790 : spin_lock(&ilb->lock); + 98 [ + + ]: 119508 : sk_nulls_for_each(sk, node, &ilb->nulls_head) { + 99 [ - + ]: 724 : const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); + 100 : 724 : struct inet_sock *inet = inet_sk(sk); + 101 : 724 : int ret; 102 : : - 103 [ - + ]: 620 : if (num < diag_ctx->l_num) + 103 [ - + ]: 724 : if (num < diag_ctx->l_num) 104 : 0 : goto next_listen; 105 : : - 106 [ + + - + ]: 620 : if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) - 107 : 4 : goto next_listen; + 106 [ + - - + ]: 724 : if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) + 107 : 0 : goto next_listen; 108 : : - 109 : 616 : sk = ctx->conn; - 110 [ + - + + ]: 946 : if (!sk || !net_eq(sock_net(sk), net)) - 111 : 4 : goto next_listen; + 109 : 724 : sk = ctx->conn; + 110 [ + - + + ]: 1118 : if (!sk || !net_eq(sock_net(sk), net)) + 111 : 68 : goto next_listen; 112 : : - 113 [ + - ]: 612 : if (r->sdiag_family != AF_UNSPEC && - 114 [ + + ]: 612 : sk->sk_family != r->sdiag_family) - 115 : 302 : goto next_listen; + 113 [ + - ]: 656 : if (r->sdiag_family != AF_UNSPEC && + 114 [ + + ]: 656 : sk->sk_family != r->sdiag_family) + 115 : 324 : goto next_listen; 116 : : - 117 [ + - - + ]: 310 : if (r->id.idiag_sport != inet->inet_sport && + 117 [ + - - + ]: 332 : if (r->id.idiag_sport != inet->inet_sport && 118 : : r->id.idiag_sport) 119 : 0 : goto next_listen; 120 : : - 121 [ - + ]: 310 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 121 [ - + ]: 332 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 122 : 0 : goto next_listen; 123 : : - 124 : 310 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + 124 : 332 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); 125 : : - 126 : 310 : sock_put(sk); + 126 : 332 : sock_put(sk); 127 : : - 128 [ + + ]: 310 : if (ret < 0) { + 128 [ + + ]: 332 : 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 : 304 : diag_ctx->l_num = num + 1; - 136 : 304 : num = 0; - 137 : 614 : next_listen: - 138 : 614 : ++num; + 135 : 326 : diag_ctx->l_num = num + 1; + 136 : 326 : num = 0; + 137 : 718 : next_listen: + 138 : 718 : ++num; 139 : : } - 140 : 102400 : spin_unlock(&ilb->lock); - 141 : 102400 : rcu_read_unlock(); + 140 : 118784 : spin_unlock(&ilb->lock); + 141 : 118784 : rcu_read_unlock(); 142 : : - 143 : 102400 : cond_resched(); - 144 : 102400 : diag_ctx->l_num = 0; + 143 : 118784 : cond_resched(); + 144 : 118784 : diag_ctx->l_num = 0; 145 : : } 146 : : - 147 : 60 : diag_ctx->l_num = 0; - 148 : 60 : diag_ctx->l_slot = i; + 147 : 69 : diag_ctx->l_num = 0; + 148 : 69 : diag_ctx->l_slot = i; 149 : : } 150 : : - 151 : 829 : static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, + 151 : 859 : static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 152 : : const struct inet_diag_req_v2 *r) 153 : : { - 154 : 829 : bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); - 155 : 829 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; - 156 : 829 : struct net *net = sock_net(skb->sk); - 157 : 829 : struct inet_diag_dump_data *cb_data; - 158 : 829 : struct mptcp_sock *msk; - 159 : 829 : struct nlattr *bc; + 154 : 859 : bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); + 155 : 859 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + 156 : 859 : struct net *net = sock_net(skb->sk); + 157 : 859 : struct inet_diag_dump_data *cb_data; + 158 : 859 : struct mptcp_sock *msk; + 159 : 859 : struct nlattr *bc; 160 : : - 161 : 829 : BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); + 161 : 859 : BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); 162 : : - 163 : 829 : cb_data = cb->data; - 164 : 829 : bc = cb_data->inet_diag_nla_bc; + 163 : 859 : cb_data = cb->data; + 164 : 859 : bc = cb_data->inet_diag_nla_bc; 165 : : - 166 : 829 : while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, - 167 [ + + ]: 3661 : &diag_ctx->s_num)) != NULL) { - 168 : 2844 : struct inet_sock *inet = (struct inet_sock *)msk; - 169 : 2844 : struct sock *sk = (struct sock *)msk; - 170 : 2844 : int ret = 0; + 166 : 859 : while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, + 167 [ + + ]: 3755 : &diag_ctx->s_num)) != NULL) { + 168 : 2908 : struct inet_sock *inet = (struct inet_sock *)msk; + 169 : 2908 : struct sock *sk = (struct sock *)msk; + 170 : 2908 : int ret = 0; 171 : : - 172 [ + + + + ]: 2844 : if (!(r->idiag_states & (1 << sk->sk_state))) + 172 [ + + + + ]: 2908 : if (!(r->idiag_states & (1 << sk->sk_state))) 173 : 876 : goto next; - 174 [ + - ]: 1968 : if (r->sdiag_family != AF_UNSPEC && - 175 [ + + ]: 1968 : sk->sk_family != r->sdiag_family) - 176 : 978 : goto next; - 177 [ + - - + ]: 990 : if (r->id.idiag_sport != inet->inet_sport && + 174 [ + - ]: 2032 : if (r->sdiag_family != AF_UNSPEC && + 175 [ + + ]: 2032 : sk->sk_family != r->sdiag_family) + 176 : 1010 : goto next; + 177 [ + - - + ]: 1022 : if (r->id.idiag_sport != inet->inet_sport && 178 : : r->id.idiag_sport) 179 : 0 : goto next; - 180 [ + - - + ]: 990 : if (r->id.idiag_dport != inet->inet_dport && + 180 [ + - - + ]: 1022 : if (r->id.idiag_dport != inet->inet_dport && 181 : : r->id.idiag_dport) 182 : 0 : goto next; 183 : : - 184 : 990 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); - 185 : 2844 : next: - 186 : 2844 : sock_put(sk); - 187 [ + + ]: 2844 : if (ret < 0) { + 184 : 1022 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + 185 : 2908 : next: + 186 : 2908 : sock_put(sk); + 187 [ + + ]: 2908 : if (ret < 0) { 188 : : /* will retry on the same position */ 189 : 12 : diag_ctx->s_num--; 190 : 12 : break; 191 : : } - 192 : 2832 : cond_resched(); + 192 : 2896 : cond_resched(); 193 : : } 194 : : - 195 [ + + + - ]: 829 : if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) - 196 : 66 : mptcp_diag_dump_listeners(skb, cb, r, net_admin); - 197 : 829 : } + 195 [ + + + - ]: 859 : if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) + 196 : 75 : mptcp_diag_dump_listeners(skb, cb, r, net_admin); + 197 : 859 : } 198 : : - 199 : 1268 : static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, + 199 : 1322 : static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, 200 : : void *_info) 201 : : { - 202 [ - + ]: 1268 : struct mptcp_sock *msk = mptcp_sk(sk); - 203 : 1268 : struct mptcp_info *info = _info; + 202 [ - + ]: 1322 : struct mptcp_sock *msk = mptcp_sk(sk); + 203 : 1322 : struct mptcp_info *info = _info; 204 : : - 205 : 1268 : r->idiag_rqueue = sk_rmem_alloc_get(sk); - 206 : 1268 : r->idiag_wqueue = sk_wmem_alloc_get(sk); + 205 : 1322 : r->idiag_rqueue = sk_rmem_alloc_get(sk); + 206 : 1322 : r->idiag_wqueue = sk_wmem_alloc_get(sk); 207 : : - 208 [ + + ]: 1268 : if (inet_sk_state_load(sk) == TCP_LISTEN) { - 209 : 302 : struct sock *lsk = READ_ONCE(msk->first); + 208 [ + + ]: 1322 : if (inet_sk_state_load(sk) == TCP_LISTEN) { + 209 : 324 : struct sock *lsk = READ_ONCE(msk->first); 210 : : - 211 [ + - ]: 302 : if (lsk) { + 211 [ + - ]: 324 : if (lsk) { 212 : : /* override with settings from tcp listener, 213 : : * so Send-Q will show accept queue. 214 : : */ - 215 : 302 : r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); - 216 : 302 : r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); + 215 : 324 : r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); + 216 : 324 : r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); 217 : : } 218 : : } 219 : : - 220 [ + + ]: 1268 : if (!info) + 220 [ + + ]: 1322 : if (!info) 221 : : return; 222 : : - 223 : 964 : mptcp_diag_fill_info(msk, info); + 223 : 982 : 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 0a50a106..a937ee8f 100644 --- a/html/lcov/export/mptcp/options.c.func-c.html +++ b/html/lcov/export/mptcp/options.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 78.1 % + 77.8 % 689 - 538 + 536 @@ -88,21 +88,21 @@ mptcp_established_options_fastclose - 439 + 470 mptcp_established_options_rst - 439 + 470 add_addr_hmac_valid - 691 + 692 @@ -116,154 +116,154 @@ clear_3rdack_retransmission - 984 + 986 mptcp_synack_options - 1775 + 1778 mptcp_syn_options - 1882 + 1881 mptcp_make_csum - 1913 + 1890 __mptcp_make_csum - 2045 + 2020 mptcp_update_rcv_data_fin - 7567 + 7771 mptcp_write_data_fin - 20871 + 24948 __mptcp_expand_seq - 84767 + 202609 mptcp_set_rwin - 641130 + 844641 mptcp_write_options - 643272 + 846816 ack_update_msk - 713146 + 1049048 check_fully_established - 716589 + 1052579 mptcp_get_options - 721816 + 1057809 mptcp_parse_option - 721884 + 1057896 mptcp_incoming_options - 723043 + 1063399 mptcp_established_options_dss - 1457378 + 2022717 mptcp_established_options_mp_fail - 1457440 + 2022775 mptcp_established_options_rm_addr - 1458837 + 2024213 mptcp_established_options_add_addr - 1459592 + 2024969 mptcp_established_options_mp_prio - 1459592 + 2024969 mptcp_established_options_mp - 1459596 + 2024972 mptcp_established_options - 1492612 + 2078533 diff --git a/html/lcov/export/mptcp/options.c.func.html b/html/lcov/export/mptcp/options.c.func.html index b63843bb..ac4507fe 100644 --- a/html/lcov/export/mptcp/options.c.func.html +++ b/html/lcov/export/mptcp/options.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 78.1 % + 77.8 % 689 - 538 + 536 @@ -81,21 +81,21 @@ __mptcp_expand_seq - 84767 + 202609 __mptcp_make_csum - 2045 + 2020 ack_update_msk - 713146 + 1049048 @@ -109,91 +109,91 @@ add_addr_hmac_valid - 691 + 692 check_fully_established - 716589 + 1052579 clear_3rdack_retransmission - 984 + 986 mptcp_established_options - 1492612 + 2078533 mptcp_established_options_add_addr - 1459592 + 2024969 mptcp_established_options_dss - 1457378 + 2022717 mptcp_established_options_fastclose - 439 + 470 mptcp_established_options_mp - 1459596 + 2024972 mptcp_established_options_mp_fail - 1457440 + 2022775 mptcp_established_options_mp_prio - 1459592 + 2024969 mptcp_established_options_rm_addr - 1458837 + 2024213 mptcp_established_options_rst - 439 + 470 mptcp_get_options - 721816 + 1057809 @@ -207,63 +207,63 @@ mptcp_incoming_options - 723043 + 1063399 mptcp_make_csum - 1913 + 1890 mptcp_parse_option - 721884 + 1057896 mptcp_set_rwin - 641130 + 844641 mptcp_syn_options - 1882 + 1881 mptcp_synack_options - 1775 + 1778 mptcp_update_rcv_data_fin - 7567 + 7771 mptcp_write_data_fin - 20871 + 24948 mptcp_write_options - 643272 + 846816 diff --git a/html/lcov/export/mptcp/options.c.gcov.html b/html/lcov/export/mptcp/options.c.gcov.html index 8162052a..ed60e610 100644 --- a/html/lcov/export/mptcp/options.c.gcov.html +++ b/html/lcov/export/mptcp/options.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 78.1 % + 77.8 % 689 - 538 + 536 @@ -98,24 +98,24 @@ 20 : : return (flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA256; 21 : : } 22 : : - 23 : 721884 : static void mptcp_parse_option(const struct sk_buff *skb, + 23 : 1057896 : 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 : 721884 : u8 subtype = *ptr >> 4; - 28 : 721884 : int expected_opsize; - 29 : 721884 : u16 subopt; - 30 : 721884 : u8 version; - 31 : 721884 : u8 flags; - 32 : 721884 : u8 i; + 27 : 1057896 : u8 subtype = *ptr >> 4; + 28 : 1057896 : int expected_opsize; + 29 : 1057896 : u16 subopt; + 30 : 1057896 : u8 version; + 31 : 1057896 : u8 flags; + 32 : 1057896 : u8 i; 33 : : - 34 [ + + + + : 721884 : switch (subtype) { - + + + + + + 34 [ + + + + : 1057896 : switch (subtype) { + + + + + + - ] - 35 : 5329 : case MPTCPOPT_MP_CAPABLE: + 35 : 5388 : case MPTCPOPT_MP_CAPABLE: 36 : : /* strict size checking */ - 37 [ + + ]: 5329 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) { - 38 [ + + ]: 2943 : if (skb->len > tcp_hdr(skb)->doff << 2) + 37 [ + + ]: 5388 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) { + 38 [ + + ]: 3002 : 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; @@ -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 [ + + ]: 5329 : if (opsize != expected_opsize && + 63 [ + + ]: 5388 : 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 : 5317 : version = *ptr++ & MPTCP_VERSION_MASK; - 70 [ + + ]: 5317 : if (opsize != TCPOLEN_MPTCP_MPC_SYN) { - 71 [ + + ]: 4079 : if (version != MPTCP_SUPPORTED_VERSION) + 69 : 5376 : version = *ptr++ & MPTCP_VERSION_MASK; + 70 [ + + ]: 5376 : if (opsize != TCPOLEN_MPTCP_MPC_SYN) { + 71 [ + + ]: 4138 : if (version != MPTCP_SUPPORTED_VERSION) 72 : : break; 73 [ + - ]: 1238 : } else if (version < MPTCP_SUPPORTED_VERSION) { 74 : : break; 75 : : } 76 : : - 77 : 5311 : flags = *ptr++; - 78 [ + + + + ]: 5311 : if (!mptcp_cap_flag_sha256(flags) || + 77 : 5370 : flags = *ptr++; + 78 [ + + + + ]: 5370 : if (!mptcp_cap_flag_sha256(flags) || 79 : : (flags & MPTCP_CAP_EXTENSIBILITY)) 80 : : break; 81 : : @@ -165,101 +165,101 @@ 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 [ + + ]: 5275 : if (flags & MPTCP_CAP_CHECKSUM_REQD) + 88 [ + + ]: 5334 : if (flags & MPTCP_CAP_CHECKSUM_REQD) 89 : 40 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; 90 : : - 91 : 5275 : mp_opt->deny_join_id0 = !!(flags & MPTCP_CAP_DENY_JOIN_ID0); + 91 : 5334 : mp_opt->deny_join_id0 = !!(flags & MPTCP_CAP_DENY_JOIN_ID0); 92 : : - 93 : 5275 : mp_opt->suboptions |= subopt; - 94 [ + + ]: 5275 : if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) { - 95 [ + + ]: 4049 : mp_opt->sndr_key = get_unaligned_be64(ptr); - 96 : 4049 : ptr += 8; + 93 : 5334 : mp_opt->suboptions |= subopt; + 94 [ + + ]: 5334 : if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) { + 95 [ + + ]: 4108 : mp_opt->sndr_key = get_unaligned_be64(ptr); + 96 : 4108 : ptr += 8; 97 : : } - 98 [ + + ]: 4049 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK) { - 99 : 2925 : mp_opt->rcvr_key = get_unaligned_be64(ptr); - 100 : 2925 : ptr += 8; + 98 [ + + ]: 4108 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK) { + 99 : 2984 : mp_opt->rcvr_key = get_unaligned_be64(ptr); + 100 : 2984 : ptr += 8; 101 : : } - 102 [ + + ]: 4151 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK_DATA) { + 102 [ + + ]: 4210 : 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 106 : : * interchangeably." 107 : : */ - 108 : 635 : mp_opt->suboptions |= OPTION_MPTCP_DSS; - 109 : 635 : mp_opt->use_map = 1; - 110 : 635 : mp_opt->mpc_map = 1; - 111 [ + + ]: 635 : mp_opt->data_len = get_unaligned_be16(ptr); - 112 : 635 : ptr += 2; + 108 : 694 : mp_opt->suboptions |= OPTION_MPTCP_DSS; + 109 : 694 : mp_opt->use_map = 1; + 110 : 694 : mp_opt->mpc_map = 1; + 111 [ + + ]: 694 : mp_opt->data_len = get_unaligned_be16(ptr); + 112 : 694 : ptr += 2; 113 : : } - 114 [ + + ]: 635 : if (opsize == TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM) { + 114 [ + + ]: 694 : if (opsize == TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM) { 115 : 4 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); 116 : 4 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; 117 : 4 : ptr += 2; 118 : : } - 119 [ - + ]: 5275 : pr_debug("MP_CAPABLE version=%x, flags=%x, optlen=%d sndr=%llu, rcvr=%llu len=%d csum=%u\n", + 119 [ - + ]: 5334 : 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 : 2046 : case MPTCPOPT_MP_JOIN: - 125 [ + + ]: 2046 : 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", + 124 : 2051 : case MPTCPOPT_MP_JOIN: + 125 [ + + ]: 2051 : 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", 134 : : mp_opt->backup, mp_opt->join_id, 135 : : mp_opt->token, mp_opt->nonce); - 136 [ + + ]: 1525 : } 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", + 136 [ + + ]: 1529 : } 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", 145 : : mp_opt->backup, mp_opt->join_id, 146 : : mp_opt->thmac, mp_opt->nonce); - 147 [ + - ]: 1038 : } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { - 148 : 1038 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; - 149 : 1038 : ptr += 2; - 150 : 1038 : memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); - 151 [ - + ]: 1038 : pr_debug("MP_JOIN hmac\n"); + 147 [ + - ]: 1041 : } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { + 148 : 1041 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; + 149 : 1041 : ptr += 2; + 150 : 1041 : memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); + 151 [ - + ]: 1041 : pr_debug("MP_JOIN hmac\n"); 152 : : } 153 : : break; 154 : : 155 : : case MPTCPOPT_DSS: - 156 [ - + ]: 713146 : pr_debug("DSS\n"); - 157 : 713146 : ptr++; + 156 [ - + ]: 1049048 : pr_debug("DSS\n"); + 157 : 1049048 : ptr++; 158 : : - 159 : 713146 : flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; - 160 : 713146 : mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; - 161 : 713146 : mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; - 162 : 713146 : mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; - 163 : 713146 : mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; - 164 : 713146 : mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); + 159 : 1049048 : flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; + 160 : 1049048 : mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; + 161 : 1049048 : mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; + 162 : 1049048 : mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; + 163 : 1049048 : mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; + 164 : 1049048 : mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); 165 : : - 166 [ - + ]: 713146 : pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n", + 166 [ - + ]: 1049048 : 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 : 713146 : expected_opsize = TCPOLEN_MPTCP_DSS_BASE; + 171 : 1049048 : expected_opsize = TCPOLEN_MPTCP_DSS_BASE; 172 : : - 173 [ + - ]: 713146 : if (mp_opt->use_ack) { - 174 [ + + ]: 713146 : if (mp_opt->ack64) + 173 [ + - ]: 1049048 : if (mp_opt->use_ack) { + 174 [ + + ]: 1049048 : if (mp_opt->ack64) 175 : : expected_opsize += TCPOLEN_MPTCP_DSS_ACK64; 176 : : else - 177 : 84725 : expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + 177 : 202567 : expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; 178 : : } 179 : : - 180 [ + + ]: 713146 : if (mp_opt->use_map) { - 181 [ + + ]: 439350 : if (mp_opt->dsn64) - 182 : 439308 : expected_opsize += TCPOLEN_MPTCP_DSS_MAP64; + 180 [ + + ]: 1049048 : if (mp_opt->use_map) { + 181 [ + + ]: 661987 : if (mp_opt->dsn64) + 182 : 661945 : 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 [ + + ]: 713146 : if (opsize != expected_opsize && - 191 [ + - ]: 1915 : opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) + 190 [ + + ]: 1049048 : if (opsize != expected_opsize && + 191 [ + - ]: 1891 : opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) 192 : : break; 193 : : - 194 : 713146 : mp_opt->suboptions |= OPTION_MPTCP_DSS; - 195 [ + - ]: 713146 : if (mp_opt->use_ack) { - 196 [ + + ]: 713146 : if (mp_opt->ack64) { - 197 : 628421 : mp_opt->data_ack = get_unaligned_be64(ptr); - 198 : 628421 : ptr += 8; + 194 : 1049048 : mp_opt->suboptions |= OPTION_MPTCP_DSS; + 195 [ + - ]: 1049048 : if (mp_opt->use_ack) { + 196 [ + + ]: 1049048 : if (mp_opt->ack64) { + 197 : 846481 : mp_opt->data_ack = get_unaligned_be64(ptr); + 198 : 846481 : ptr += 8; 199 : : } else { - 200 : 84725 : mp_opt->data_ack = get_unaligned_be32(ptr); - 201 : 84725 : ptr += 4; + 200 : 202567 : mp_opt->data_ack = get_unaligned_be32(ptr); + 201 : 202567 : ptr += 4; 202 : : } 203 : : - 204 [ - + ]: 713146 : pr_debug("data_ack=%llu\n", mp_opt->data_ack); + 204 [ - + ]: 1049048 : pr_debug("data_ack=%llu\n", mp_opt->data_ack); 205 : : } 206 : : - 207 [ + + ]: 713146 : if (mp_opt->use_map) { - 208 [ + + ]: 439350 : if (mp_opt->dsn64) { - 209 : 439308 : mp_opt->data_seq = get_unaligned_be64(ptr); - 210 : 439308 : ptr += 8; + 207 [ + + ]: 1049048 : if (mp_opt->use_map) { + 208 [ + + ]: 661987 : if (mp_opt->dsn64) { + 209 : 661945 : mp_opt->data_seq = get_unaligned_be64(ptr); + 210 : 661945 : ptr += 8; 211 : : } else { 212 : 42 : mp_opt->data_seq = get_unaligned_be32(ptr); 213 : 42 : ptr += 4; 214 : : } 215 : : - 216 [ + + ]: 439350 : mp_opt->subflow_seq = get_unaligned_be32(ptr); - 217 : 439350 : ptr += 4; + 216 [ + + ]: 661987 : mp_opt->subflow_seq = get_unaligned_be32(ptr); + 217 : 661987 : ptr += 4; 218 : : - 219 [ + + ]: 439350 : mp_opt->data_len = get_unaligned_be16(ptr); - 220 : 439350 : ptr += 2; + 219 [ + + ]: 661987 : mp_opt->data_len = get_unaligned_be16(ptr); + 220 : 661987 : ptr += 2; 221 : : - 222 [ + + ]: 439350 : if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) { - 223 : 1915 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; - 224 : 1915 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); - 225 : 1915 : ptr += 2; + 222 [ + + ]: 661987 : if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) { + 223 : 1891 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; + 224 : 1891 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); + 225 : 1891 : ptr += 2; 226 : : } 227 : : - 228 [ - + ]: 439350 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", + 228 [ - + ]: 661987 : 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 : 691 : case MPTCPOPT_ADD_ADDR: - 237 : 691 : mp_opt->echo = (*ptr++) & MPTCP_ADDR_ECHO; - 238 [ + + ]: 691 : if (!mp_opt->echo) { + 236 : 692 : case MPTCPOPT_ADD_ADDR: + 237 : 692 : mp_opt->echo = (*ptr++) & MPTCP_ADDR_ECHO; + 238 [ + + ]: 692 : 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 : 331 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE || - 251 [ + + ]: 331 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) + 250 : 332 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE || + 251 [ + + ]: 332 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) 252 : 258 : mp_opt->addr.family = AF_INET; 253 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 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; + 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; 257 : : #endif 258 : : else 259 : : break; 260 : : } 261 : : - 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) { + 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) { 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 : 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) { + 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) { 281 : 6 : mp_opt->addr.port = htons(get_unaligned_be16(ptr)); 282 : 6 : ptr += 2; 283 : : } 284 : : } 285 : : #endif - 286 [ + + ]: 691 : if (!mp_opt->echo) { + 286 [ + + ]: 692 : if (!mp_opt->echo) { 287 : 360 : mp_opt->ahmac = get_unaligned_be64(ptr); 288 : 360 : ptr += 8; 289 : : } - 290 [ - + - - ]: 691 : pr_debug("ADD_ADDR%s: id=%d, ahmac=%llu, echo=%d, port=%d\n", + 290 [ - + - - ]: 692 : 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,138 +395,138 @@ 315 [ - + ]: 40 : pr_debug("MP_PRIO: prio=%d\n", mp_opt->backup); 316 : : break; 317 : : - 318 : 247 : case MPTCPOPT_MP_FASTCLOSE: - 319 [ + - ]: 247 : if (opsize != TCPOLEN_MPTCP_FASTCLOSE) + 318 : 271 : case MPTCPOPT_MP_FASTCLOSE: + 319 [ + - ]: 271 : if (opsize != TCPOLEN_MPTCP_FASTCLOSE) 320 : : break; 321 : : - 322 : 247 : ptr += 2; - 323 [ - + ]: 247 : mp_opt->rcvr_key = get_unaligned_be64(ptr); - 324 : 247 : ptr += 8; - 325 : 247 : mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE; - 326 [ - + ]: 247 : pr_debug("MP_FASTCLOSE: recv_key=%llu\n", mp_opt->rcvr_key); + 322 : 271 : ptr += 2; + 323 [ - + ]: 271 : mp_opt->rcvr_key = get_unaligned_be64(ptr); + 324 : 271 : ptr += 8; + 325 : 271 : mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE; + 326 [ - + ]: 271 : pr_debug("MP_FASTCLOSE: recv_key=%llu\n", mp_opt->rcvr_key); 327 : : break; 328 : : - 329 : 267 : case MPTCPOPT_RST: - 330 [ + - ]: 267 : if (opsize != TCPOLEN_MPTCP_RST) + 329 : 289 : case MPTCPOPT_RST: + 330 [ + - ]: 289 : if (opsize != TCPOLEN_MPTCP_RST) 331 : : break; 332 : : - 333 [ + + ]: 267 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) + 333 [ + + ]: 289 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) 334 : : break; 335 : : - 336 : 255 : mp_opt->suboptions |= OPTION_MPTCP_RST; - 337 : 255 : flags = *ptr++; - 338 : 255 : mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; - 339 : 255 : mp_opt->reset_reason = *ptr; - 340 [ - + ]: 255 : pr_debug("MP_RST: transient=%u reason=%u\n", + 336 : 277 : mp_opt->suboptions |= OPTION_MPTCP_RST; + 337 : 277 : flags = *ptr++; + 338 : 277 : mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; + 339 : 277 : mp_opt->reset_reason = *ptr; + 340 [ - + ]: 277 : pr_debug("MP_RST: transient=%u reason=%u\n", 341 : : mp_opt->reset_transient, mp_opt->reset_reason); 342 : : break; 343 : : - 344 : 6 : case MPTCPOPT_MP_FAIL: - 345 [ + - ]: 6 : if (opsize != TCPOLEN_MPTCP_FAIL) + 344 : 5 : case MPTCPOPT_MP_FAIL: + 345 [ + - ]: 5 : if (opsize != TCPOLEN_MPTCP_FAIL) 346 : : break; 347 : : - 348 : 6 : ptr += 2; - 349 : 6 : mp_opt->suboptions |= OPTION_MPTCP_FAIL; - 350 [ - + ]: 6 : mp_opt->fail_seq = get_unaligned_be64(ptr); - 351 [ - + ]: 6 : pr_debug("MP_FAIL: data_seq=%llu\n", mp_opt->fail_seq); + 348 : 5 : ptr += 2; + 349 : 5 : mp_opt->suboptions |= OPTION_MPTCP_FAIL; + 350 [ - + ]: 5 : mp_opt->fail_seq = get_unaligned_be64(ptr); + 351 [ - + ]: 5 : pr_debug("MP_FAIL: data_seq=%llu\n", mp_opt->fail_seq); 352 : : break; 353 : : 354 : : default: 355 : : break; 356 : : } - 357 : 721884 : } + 357 : 1057896 : } 358 : : - 359 : 721816 : void mptcp_get_options(const struct sk_buff *skb, + 359 : 1057809 : void mptcp_get_options(const struct sk_buff *skb, 360 : : struct mptcp_options_received *mp_opt) 361 : : { - 362 : 721816 : const struct tcphdr *th = tcp_hdr(skb); - 363 : 721816 : const unsigned char *ptr; - 364 : 721816 : int length; + 362 : 1057809 : const struct tcphdr *th = tcp_hdr(skb); + 363 : 1057809 : const unsigned char *ptr; + 364 : 1057809 : int length; 365 : : 366 : : /* Ensure that casting the whole status to u32 is efficient and safe */ - 367 : 721816 : BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); - 368 : 721816 : BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status), + 367 : 1057809 : BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); + 368 : 1057809 : BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status), 369 : : sizeof(u32))); - 370 : 721816 : *(u32 *)&mp_opt->status = 0; + 370 : 1057809 : *(u32 *)&mp_opt->status = 0; 371 : : - 372 : 721816 : length = (th->doff * 4) - sizeof(struct tcphdr); - 373 : 721816 : ptr = (const unsigned char *)(th + 1); + 372 : 1057809 : length = (th->doff * 4) - sizeof(struct tcphdr); + 373 : 1057809 : ptr = (const unsigned char *)(th + 1); 374 : : - 375 [ + + ]: 4487494 : while (length > 0) { - 376 : 3765678 : int opcode = *ptr++; - 377 : 3765678 : int opsize; + 375 [ + + ]: 6614314 : while (length > 0) { + 376 : 5556505 : int opcode = *ptr++; + 377 : 5556505 : int opsize; 378 : : - 379 [ + + - ]: 3765678 : switch (opcode) { + 379 [ + + - ]: 5556505 : switch (opcode) { 380 : : case TCPOPT_EOL: 381 : : return; - 382 : 2313330 : case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */ - 383 : 2313330 : length--; - 384 : 2313330 : continue; - 385 : 1452348 : default: - 386 [ + - ]: 1452348 : if (length < 2) + 382 : 3431682 : case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */ + 383 : 3431682 : length--; + 384 : 3431682 : continue; + 385 : 2124823 : default: + 386 [ + - ]: 2124823 : if (length < 2) 387 : : return; - 388 : 1452348 : opsize = *ptr++; - 389 [ + - ]: 1452348 : if (opsize < 2) /* "silly options" */ + 388 : 2124823 : opsize = *ptr++; + 389 [ + - ]: 2124823 : if (opsize < 2) /* "silly options" */ 390 : : return; - 391 [ + - ]: 1452348 : if (opsize > length) + 391 [ + - ]: 2124823 : if (opsize > length) 392 : : return; /* don't parse partial options */ - 393 [ + + ]: 1452348 : if (opcode == TCPOPT_MPTCP) - 394 : 721884 : mptcp_parse_option(skb, ptr, opsize, mp_opt); - 395 : 1452348 : ptr += opsize - 2; - 396 : 1452348 : length -= opsize; + 393 [ + + ]: 2124823 : if (opcode == TCPOPT_MPTCP) + 394 : 1057896 : mptcp_parse_option(skb, ptr, opsize, mp_opt); + 395 : 2124823 : ptr += opsize - 2; + 396 : 2124823 : length -= opsize; 397 : : } 398 : : } 399 : : } 400 : : - 401 : 1882 : bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, + 401 : 1881 : bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, 402 : : unsigned int *size, struct mptcp_out_options *opts) 403 : : { - 404 [ + + ]: 1882 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 404 [ + + ]: 1881 : 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 : 1882 : subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; - 410 [ + + ]: 1882 : if (subflow->request_mptcp) { + 409 : 1881 : subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; + 410 [ + + ]: 1881 : 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 [ + + ]: 594 : } else if (subflow->request_join) { - 417 [ - + ]: 570 : pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token, + 416 [ + + ]: 593 : } else if (subflow->request_join) { + 417 [ - + ]: 569 : pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token, 418 : : subflow->local_nonce); - 419 : 570 : opts->suboptions = OPTION_MPTCP_MPJ_SYN; - 420 : 570 : opts->join_id = subflow->local_id; - 421 : 570 : opts->token = subflow->remote_token; - 422 : 570 : opts->nonce = subflow->local_nonce; - 423 : 570 : opts->backup = subflow->request_bkup; - 424 : 570 : *size = TCPOLEN_MPTCP_MPJ_SYN; - 425 : 570 : return true; + 419 : 569 : opts->suboptions = OPTION_MPTCP_MPJ_SYN; + 420 : 569 : opts->join_id = subflow->local_id; + 421 : 569 : opts->token = subflow->remote_token; + 422 : 569 : opts->nonce = subflow->local_nonce; + 423 : 569 : opts->backup = subflow->request_bkup; + 424 : 569 : *size = TCPOLEN_MPTCP_MPJ_SYN; + 425 : 569 : return true; 426 : : } 427 : : return false; 428 : : } 429 : : - 430 : 984 : static void clear_3rdack_retransmission(struct sock *sk) + 430 : 986 : static void clear_3rdack_retransmission(struct sock *sk) 431 : : { - 432 : 984 : struct inet_connection_sock *icsk = inet_csk(sk); + 432 : 986 : struct inet_connection_sock *icsk = inet_csk(sk); 433 : : - 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 : } + 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 : } 439 : : - 440 : 1459596 : static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, + 440 : 2024972 : 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 [ - + ]: 1459596 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 446 [ - + ]: 1459596 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 447 : 1459596 : struct mptcp_ext *mpext; - 448 : 1459596 : unsigned int data_len; - 449 : 1459596 : u8 len; + 445 [ - + ]: 2024972 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 446 [ - + ]: 2024972 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 447 : 2024972 : struct mptcp_ext *mpext; + 448 : 2024972 : unsigned int data_len; + 449 : 2024972 : 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 [ + + ]: 1459596 : if (!skb) + 457 [ + + ]: 2024972 : if (!skb) 458 : : return false; 459 : : 460 : : /* MPC/MPJ needed only on 3rd ack packet, DATA_FIN and TCP shutdown take precedence */ - 461 [ + + + + : 639276 : if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable || - + + ] - 462 [ + + ]: 2661 : subflow->snd_isn != TCP_SKB_CB(skb)->seq || - 463 [ + + ]: 2218 : sk->sk_state != TCP_ESTABLISHED) + 461 [ + + + + : 842787 : if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable || + + + ] + 462 [ + + ]: 2739 : subflow->snd_isn != TCP_SKB_CB(skb)->seq || + 463 [ + + ]: 2255 : sk->sk_state != TCP_ESTABLISHED) 464 : : return false; 465 : : - 466 [ + + ]: 2218 : if (subflow->mp_capable) { - 467 [ + + ]: 1719 : mpext = mptcp_get_ext(skb); - 468 [ + + ]: 1157 : data_len = mpext ? mpext->data_len : 0; + 466 [ + + ]: 2255 : if (subflow->mp_capable) { + 467 [ + + ]: 1754 : mpext = mptcp_get_ext(skb); + 468 [ + + ]: 1192 : 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 : 1719 : opts->data_len = data_len; - 475 : 1719 : opts->suboptions = OPTION_MPTCP_MPC_ACK; - 476 : 1719 : opts->sndr_key = subflow->local_key; - 477 : 1719 : opts->rcvr_key = subflow->remote_key; - 478 [ - + ]: 1719 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); - 479 : 1719 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); + 474 : 1754 : opts->data_len = data_len; + 475 : 1754 : opts->suboptions = OPTION_MPTCP_MPC_ACK; + 476 : 1754 : opts->sndr_key = subflow->local_key; + 477 : 1754 : opts->rcvr_key = subflow->remote_key; + 478 [ - + ]: 1754 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); + 479 : 1754 : 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 [ + + ]: 1719 : if (data_len > 0) { - 487 : 595 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; - 488 [ + + ]: 595 : if (opts->csum_reqd) { + 486 [ + + ]: 1754 : if (data_len > 0) { + 487 : 630 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; + 488 [ + + ]: 630 : 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 : 595 : *size = ALIGN(len, 4); + 495 : 630 : *size = ALIGN(len, 4); 496 : : } else { 497 : 1124 : *size = TCPOLEN_MPTCP_MPC_ACK; 498 : : } 499 : : - 500 [ - + ]: 1719 : pr_debug("subflow=%p, local_key=%llu, remote_key=%llu map_len=%d\n", + 500 [ - + ]: 1754 : 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 : 1719 : return true; - 505 [ + + ]: 499 : } else if (subflow->mp_join) { - 506 : 499 : opts->suboptions = OPTION_MPTCP_MPJ_ACK; - 507 : 499 : memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN); - 508 : 499 : *size = TCPOLEN_MPTCP_MPJ_ACK; - 509 [ - + ]: 499 : pr_debug("subflow=%p\n", subflow); + 504 : 1754 : 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 [ + + ]: 499 : if (sock_owned_by_user(sk)) + 516 [ + + ]: 501 : if (sock_owned_by_user(sk)) 517 : 418 : set_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status); 518 : : else - 519 : 81 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_ACK); - 520 : 499 : return true; + 519 : 83 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_ACK); + 520 : 501 : return true; 521 : : } 522 : : return false; 523 : : } 524 : : - 525 : 20871 : static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow, + 525 : 24948 : 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 [ - + ]: 20871 : u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; + 531 [ - + ]: 24948 : u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; 532 : : - 533 [ + + - + ]: 20871 : if (!ext->use_map || !skb->len) { + 533 [ + + - + ]: 24948 : 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 : 7968 : ext->data_fin = 1; - 538 : 7968 : ext->use_map = 1; - 539 : 7968 : ext->dsn64 = 1; - 540 : 7968 : ext->data_seq = data_fin_tx_seq; - 541 : 7968 : ext->subflow_seq = 0; - 542 : 7968 : ext->data_len = 1; - 543 [ + + ]: 12903 : } else if (ext->data_seq + ext->data_len == data_fin_tx_seq) { + 537 : 7693 : ext->data_fin = 1; + 538 : 7693 : ext->use_map = 1; + 539 : 7693 : ext->dsn64 = 1; + 540 : 7693 : ext->data_seq = data_fin_tx_seq; + 541 : 7693 : ext->subflow_seq = 0; + 542 : 7693 : ext->data_len = 1; + 543 [ + + ]: 17255 : } 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 : 773 : ext->data_fin = 1; - 549 : 773 : ext->data_len++; + 548 : 835 : ext->data_fin = 1; + 549 : 835 : ext->data_len++; 550 : : } - 551 : 20871 : } + 551 : 24948 : } 552 : : - 553 : 1457378 : static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, + 553 : 2022717 : 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 [ - + ]: 1457378 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 559 [ - + ]: 1457378 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 560 : 1457378 : unsigned int dss_size = 0; - 561 : 1457378 : struct mptcp_ext *mpext; - 562 : 1457378 : unsigned int ack_size; - 563 : 1457378 : bool ret = false; - 564 : 1457378 : u64 ack_seq; + 558 [ - + ]: 2022717 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 559 [ - + ]: 2022717 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 560 : 2022717 : unsigned int dss_size = 0; + 561 : 2022717 : struct mptcp_ext *mpext; + 562 : 2022717 : unsigned int ack_size; + 563 : 2022717 : bool ret = false; + 564 : 2022717 : u64 ack_seq; 565 : : - 566 [ - + ]: 1457378 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); - 567 [ + + ]: 1457378 : mpext = skb ? mptcp_get_ext(skb) : NULL; + 566 [ - + ]: 2022717 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); + 567 [ + + ]: 2022717 : mpext = skb ? mptcp_get_ext(skb) : NULL; 568 : : - 569 [ + + - + : 637058 : if (!skb || (mpext && mpext->use_map) || snd_data_fin_enable) { - + + ] - 570 : 1179097 : unsigned int map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64; + 569 [ + + - + : 840532 : if (!skb || (mpext && mpext->use_map) || snd_data_fin_enable) { + + + ] + 570 : 1631051 : unsigned int map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64; 571 : : - 572 [ + + ]: 1179097 : if (mpext) { - 573 [ + + ]: 350809 : if (opts->csum_reqd) - 574 : 1601 : map_size += TCPOLEN_MPTCP_DSS_CHECKSUM; + 572 [ + + ]: 1631051 : if (mpext) { + 573 [ + + ]: 441173 : if (opts->csum_reqd) + 574 : 1591 : map_size += TCPOLEN_MPTCP_DSS_CHECKSUM; 575 : : - 576 : 350809 : opts->ext_copy = *mpext; + 576 : 441173 : opts->ext_copy = *mpext; 577 : : } 578 : : - 579 : 1179097 : dss_size = map_size; - 580 [ + + ]: 1179097 : if (skb && snd_data_fin_enable) - 581 : 20871 : mptcp_write_data_fin(subflow, skb, &opts->ext_copy); - 582 : 1179097 : opts->suboptions = OPTION_MPTCP_DSS; - 583 : 1179097 : ret = true; + 579 : 1631051 : dss_size = map_size; + 580 [ + + ]: 1631051 : if (skb && snd_data_fin_enable) + 581 : 24948 : mptcp_write_data_fin(subflow, skb, &opts->ext_copy); + 582 : 1631051 : opts->suboptions = OPTION_MPTCP_DSS; + 583 : 1631051 : 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 : 1457378 : opts->ext_copy.use_ack = 0; - 590 [ + + + + ]: 1457378 : if (!READ_ONCE(msk->can_ack)) { + 589 : 2022717 : opts->ext_copy.use_ack = 0; + 590 [ + + + + ]: 2022717 : if (!READ_ONCE(msk->can_ack)) { 591 : 18 : *size = ALIGN(dss_size, 4); 592 : 18 : return ret; 593 : : } 594 : : - 595 : 1457360 : ack_seq = READ_ONCE(msk->ack_seq); - 596 [ + + + + ]: 1457360 : if (READ_ONCE(msk->use_64bit_ack)) { - 597 : 1067503 : ack_size = TCPOLEN_MPTCP_DSS_ACK64; - 598 : 1067503 : opts->ext_copy.data_ack = ack_seq; - 599 : 1067503 : opts->ext_copy.ack64 = 1; + 595 : 2022699 : ack_seq = READ_ONCE(msk->ack_seq); + 596 [ + + + + ]: 2022699 : if (READ_ONCE(msk->use_64bit_ack)) { + 597 : 1520402 : ack_size = TCPOLEN_MPTCP_DSS_ACK64; + 598 : 1520402 : opts->ext_copy.data_ack = ack_seq; + 599 : 1520402 : opts->ext_copy.ack64 = 1; 600 : : } else { - 601 : 389857 : ack_size = TCPOLEN_MPTCP_DSS_ACK32; - 602 : 389857 : opts->ext_copy.data_ack32 = (uint32_t)ack_seq; - 603 : 389857 : opts->ext_copy.ack64 = 0; + 601 : 502297 : ack_size = TCPOLEN_MPTCP_DSS_ACK32; + 602 : 502297 : opts->ext_copy.data_ack32 = (uint32_t)ack_seq; + 603 : 502297 : opts->ext_copy.ack64 = 0; 604 : : } - 605 : 1457360 : opts->ext_copy.use_ack = 1; - 606 : 1457360 : opts->suboptions = OPTION_MPTCP_DSS; + 605 : 2022699 : opts->ext_copy.use_ack = 1; + 606 : 2022699 : opts->suboptions = OPTION_MPTCP_DSS; 607 : : 608 : : /* Add kind/length/subtype/flag overhead if mapping is not populated */ - 609 [ + + ]: 1457360 : if (dss_size == 0) - 610 : 278281 : ack_size += TCPOLEN_MPTCP_DSS_BASE; + 609 [ + + ]: 2022699 : if (dss_size == 0) + 610 : 391666 : ack_size += TCPOLEN_MPTCP_DSS_BASE; 611 : : - 612 : 1457360 : dss_size += ack_size; + 612 : 2022699 : dss_size += ack_size; 613 : : - 614 : 1457360 : *size = ALIGN(dss_size, 4); - 615 : 1457360 : return true; + 614 : 2022699 : *size = ALIGN(dss_size, 4); + 615 : 2022699 : 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 : 1459592 : static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *skb, + 645 : 2024969 : 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 [ - + ]: 1459592 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 651 [ - + ]: 1459592 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 652 : 1459592 : bool drop_other_suboptions = false; - 653 : 1459592 : unsigned int opt_size = *size; - 654 : 1459592 : bool echo; - 655 : 1459592 : int len; + 650 [ - + ]: 2024969 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 651 [ - + ]: 2024969 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 652 : 2024969 : bool drop_other_suboptions = false; + 653 : 2024969 : unsigned int opt_size = *size; + 654 : 2024969 : bool echo; + 655 : 2024969 : int len; 656 : : 657 : : /* add addr will strip the existing options, be sure to avoid breaking 658 : : * MPC/MPJ handshakes 659 : : */ - 660 [ + + ]: 1459592 : 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, + 660 [ + + ]: 2024969 : 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, 663 : : &echo, &drop_other_suboptions)) - 664 : 1458837 : return false; + 664 : 2024213 : 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 [ + + + - ]: 755 : if (drop_other_suboptions) - 671 : 755 : remaining += opt_size; + 670 [ + + + - ]: 756 : if (drop_other_suboptions) + 671 : 756 : remaining += opt_size; 672 [ # # ]: 0 : else if (opts->suboptions & OPTION_MPTCP_DSS) 673 : : return false; 674 : : - 675 [ + + + + ]: 755 : len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port); - 676 [ - + ]: 755 : if (remaining < len) + 675 [ + + + + ]: 756 : len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port); + 676 [ - + ]: 756 : if (remaining < len) 677 : : return false; 678 : : - 679 : 755 : *size = len; - 680 [ + + + - ]: 755 : if (drop_other_suboptions) { - 681 [ - + ]: 755 : pr_debug("drop other suboptions\n"); - 682 : 755 : opts->suboptions = 0; + 679 : 756 : *size = len; + 680 [ + + + - ]: 756 : if (drop_other_suboptions) { + 681 [ - + ]: 756 : pr_debug("drop other suboptions\n"); + 682 : 756 : 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 : 755 : opts->ahmac = 0; - 690 : 755 : *size -= opt_size; + 689 : 756 : opts->ahmac = 0; + 690 : 756 : *size -= opt_size; 691 : : } - 692 : 755 : opts->suboptions |= OPTION_MPTCP_ADD_ADDR; - 693 [ + + + + ]: 755 : if (!echo) { + 692 : 756 : opts->suboptions |= OPTION_MPTCP_ADD_ADDR; + 693 [ + + + + ]: 756 : 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 [ + - ]: 351 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); + 699 [ + - ]: 352 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); 700 : : } - 701 [ - + - - ]: 755 : pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d\n", + 701 [ - + - - ]: 756 : 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 : 1458837 : static bool mptcp_established_options_rm_addr(struct sock *sk, + 707 : 2024213 : 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 [ - + ]: 1458837 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 713 [ - + ]: 1458837 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 714 : 1458837 : struct mptcp_rm_list rm_list; - 715 : 1458837 : int i, len; + 712 [ - + ]: 2024213 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 713 [ - + ]: 2024213 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 714 : 2024213 : struct mptcp_rm_list rm_list; + 715 : 2024213 : int i, len; 716 : : - 717 [ + + - + ]: 1458943 : if (!mptcp_pm_should_rm_signal(msk) || + 717 [ + + - + ]: 2024319 : if (!mptcp_pm_should_rm_signal(msk) || 718 : 106 : !(mptcp_pm_rm_addr_signal(msk, remaining, &rm_list))) - 719 : 1458731 : return false; + 719 : 2024107 : return false; 720 : : - 721 [ - + ]: 401078 : len = mptcp_rm_addr_len(&rm_list); + 721 [ - + ]: 403450 : 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 : 1459592 : static bool mptcp_established_options_mp_prio(struct sock *sk, + 737 : 2024969 : 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 [ + + ]: 1459592 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 742 [ + + ]: 2024969 : 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 [ + + + - ]: 1459592 : if (!subflow->send_mp_prio || (opts->suboptions & OPTIONS_MPTCP_MPC)) + 747 [ + + + - ]: 2024969 : 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 : 439 : static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_buff *skb, + 763 : 470 : 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 [ + - ]: 439 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 768 [ + - ]: 470 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 769 : : - 770 [ + - ]: 439 : if (remaining < TCPOLEN_MPTCP_RST) + 770 [ + - ]: 470 : if (remaining < TCPOLEN_MPTCP_RST) 771 : : return false; 772 : : - 773 : 439 : *size = TCPOLEN_MPTCP_RST; - 774 : 439 : opts->suboptions |= OPTION_MPTCP_RST; - 775 : 439 : opts->reset_transient = subflow->reset_transient; - 776 : 439 : opts->reset_reason = subflow->reset_reason; - 777 [ + - ]: 439 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX); + 773 : 470 : *size = TCPOLEN_MPTCP_RST; + 774 : 470 : opts->suboptions |= OPTION_MPTCP_RST; + 775 : 470 : opts->reset_transient = subflow->reset_transient; + 776 : 470 : opts->reset_reason = subflow->reset_reason; + 777 [ + - ]: 470 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX); 778 : : 779 : : return true; 780 : : } 781 : : - 782 : 439 : static bool mptcp_established_options_fastclose(struct sock *sk, + 782 : 470 : 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 [ - + ]: 439 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 788 [ - + ]: 439 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 787 [ - + ]: 470 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 788 [ - + ]: 470 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 789 : : - 790 [ + + ]: 439 : if (likely(!subflow->send_fastclose)) + 790 [ + + ]: 470 : if (likely(!subflow->send_fastclose)) 791 : : return false; 792 : : - 793 [ + - ]: 377 : if (remaining < TCPOLEN_MPTCP_FASTCLOSE) + 793 [ + - ]: 412 : if (remaining < TCPOLEN_MPTCP_FASTCLOSE) 794 : : return false; 795 : : - 796 : 377 : *size = TCPOLEN_MPTCP_FASTCLOSE; - 797 : 377 : opts->suboptions |= OPTION_MPTCP_FASTCLOSE; - 798 : 377 : opts->rcvr_key = READ_ONCE(msk->remote_key); + 796 : 412 : *size = TCPOLEN_MPTCP_FASTCLOSE; + 797 : 412 : opts->suboptions |= OPTION_MPTCP_FASTCLOSE; + 798 : 412 : opts->rcvr_key = READ_ONCE(msk->remote_key); 799 : : - 800 [ - + ]: 377 : pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key); - 801 [ + - ]: 377 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); + 800 [ - + ]: 412 : pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key); + 801 [ + - ]: 412 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); 802 : : return true; 803 : : } 804 : : - 805 : 1457440 : static bool mptcp_established_options_mp_fail(struct sock *sk, + 805 : 2022775 : 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 [ + + ]: 1457440 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 810 [ + + ]: 2022775 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 811 : : - 812 [ + + ]: 1457440 : if (likely(!subflow->send_mp_fail)) + 812 [ + + ]: 2022775 : if (likely(!subflow->send_mp_fail)) 813 : : return false; 814 : : 815 [ + - ]: 6 : if (remaining < TCPOLEN_MPTCP_FAIL) @@ -907,69 +907,69 @@ 825 : : return true; 826 : : } 827 : : - 828 : 1492612 : bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, + 828 : 2078533 : 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 [ - + ]: 1492612 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 833 [ - + ]: 1492612 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 834 : 1492612 : unsigned int opt_size = 0; - 835 : 1492612 : bool snd_data_fin; - 836 : 1492612 : bool ret = false; + 832 [ - + ]: 2078533 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 833 [ - + ]: 2078533 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 834 : 2078533 : unsigned int opt_size = 0; + 835 : 2078533 : bool snd_data_fin; + 836 : 2078533 : bool ret = false; 837 : : - 838 : 1492612 : opts->suboptions = 0; + 838 : 2078533 : opts->suboptions = 0; 839 : : - 840 [ + + + + ]: 1492612 : if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) + 840 [ + + + + ]: 2078533 : if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) 841 : : return false; 842 : : - 843 [ + + + + ]: 1460035 : if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { - 844 [ + + + + ]: 501 : if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) || - 845 : 62 : mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { - 846 : 379 : *size += opt_size; - 847 : 379 : remaining -= opt_size; + 843 [ + + + + ]: 2025442 : if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { + 844 [ + + + + ]: 528 : if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) || + 845 : 58 : mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { + 846 : 415 : *size += opt_size; + 847 : 415 : remaining -= opt_size; 848 : : } 849 : : /* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ - 850 [ + - ]: 439 : if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { - 851 : 439 : *size += opt_size; - 852 : 439 : remaining -= opt_size; + 850 [ + - ]: 470 : if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { + 851 : 470 : *size += opt_size; + 852 : 470 : remaining -= opt_size; 853 : : } - 854 : 439 : return true; + 854 : 470 : return true; 855 : : } 856 : : - 857 [ + + ]: 1459596 : snd_data_fin = mptcp_data_fin_enabled(msk); - 858 [ + + ]: 1459596 : if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, opts)) + 857 [ + + ]: 2024972 : snd_data_fin = mptcp_data_fin_enabled(msk); + 858 [ + + ]: 2024972 : if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, opts)) 859 : : ret = true; - 860 [ + - ]: 1457378 : else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, opts)) { - 861 : 1457378 : unsigned int mp_fail_size; + 860 [ + - ]: 2022717 : else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, opts)) { + 861 : 2022717 : unsigned int mp_fail_size; 862 : : - 863 : 1457378 : ret = true; - 864 [ + + ]: 1457378 : if (mptcp_established_options_mp_fail(sk, &mp_fail_size, + 863 : 2022717 : ret = true; + 864 [ + + ]: 2022717 : 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; - 868 : 4 : return true; + 866 : 3 : *size += opt_size + mp_fail_size; + 867 : 3 : remaining -= opt_size - mp_fail_size; + 868 : 3 : return true; 869 : : } 870 : : } 871 : : 872 : : /* we reserved enough space for the above options, and exceeding the 873 : : * TCP option space would be fatal 874 : : */ - 875 [ - + - + ]: 1459592 : if (WARN_ON_ONCE(opt_size > remaining)) + 875 [ - + - + ]: 2024969 : if (WARN_ON_ONCE(opt_size > remaining)) 876 : : return false; 877 : : - 878 : 1459592 : *size += opt_size; - 879 : 1459592 : remaining -= opt_size; - 880 [ + + ]: 1459592 : 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 [ + + ]: 1458837 : } else if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) { + 878 : 2024969 : *size += opt_size; + 879 : 2024969 : remaining -= opt_size; + 880 [ + + ]: 2024969 : 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 [ + + ]: 2024213 : } 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 [ + + ]: 1459592 : if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) { + 890 [ + + ]: 2024969 : 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,12 +978,12 @@ 896 : : return ret; 897 : : } 898 : : - 899 : 1775 : bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, + 899 : 1778 : bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, 900 : : struct mptcp_out_options *opts) 901 : : { - 902 : 1775 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 902 : 1778 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 903 : : - 904 [ + + ]: 1775 : if (subflow_req->mp_capable) { + 904 [ + + ]: 1778 : 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; @@ -992,22 +992,22 @@ 910 [ - + ]: 1186 : pr_debug("subflow_req=%p, local_key=%llu\n", 911 : : subflow_req, subflow_req->local_key); 912 : 1186 : return true; - 913 [ + + ]: 589 : } else if (subflow_req->mp_join) { - 914 : 513 : opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; - 915 : 513 : opts->backup = subflow_req->request_bkup; - 916 : 513 : opts->join_id = subflow_req->local_id; - 917 : 513 : opts->thmac = subflow_req->thmac; - 918 : 513 : opts->nonce = subflow_req->local_nonce; - 919 [ - + ]: 513 : pr_debug("req=%p, bkup=%u, id=%u, thmac=%llu, nonce=%u\n", + 913 [ + + ]: 592 : } else if (subflow_req->mp_join) { + 914 : 516 : opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; + 915 : 516 : opts->backup = subflow_req->request_bkup; + 916 : 516 : opts->join_id = subflow_req->local_id; + 917 : 516 : opts->thmac = subflow_req->thmac; + 918 : 516 : opts->nonce = subflow_req->local_nonce; + 919 [ - + ]: 516 : 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 : 513 : *size = TCPOLEN_MPTCP_MPJ_SYNACK; - 923 : 513 : return true; + 922 : 516 : *size = TCPOLEN_MPTCP_MPJ_SYNACK; + 923 : 516 : return true; 924 : : } 925 : : return false; 926 : : } 927 : : - 928 : 716589 : static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, + 928 : 1052579 : 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 [ + + + + ]: 716589 : if (likely(READ_ONCE(subflow->fully_established))) { + 936 [ + + + + ]: 1052579 : 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 [ + + ]: 714957 : if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 && - 942 [ + + + + ]: 98405 : TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq && - 943 [ + + ]: 56332 : subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) && - 944 [ + - ]: 505 : !subflow->request_join) - 945 : 505 : tcp_send_ack(ssk); - 946 : 714957 : goto check_notify; + 941 [ + + ]: 1050947 : if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 && + 942 [ + + + + ]: 166668 : TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq && + 943 [ + + ]: 83097 : subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) && + 944 [ + - ]: 507 : !subflow->request_join) + 945 : 507 : tcp_send_ack(ssk); + 946 : 1050947 : 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 [ + + ]: 1632 : if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1) { - 955 [ - + ]: 49 : if (subflow->mp_join) + 954 [ + + ]: 1632 : if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1) { + 955 [ - + ]: 48 : if (subflow->mp_join) 956 : 0 : goto reset; - 957 [ - + - - ]: 49 : if (subflow->is_mptfo && mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) + 957 [ - + - - ]: 48 : if (subflow->is_mptfo && mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) 958 : 0 : goto set_fully_established; - 959 : 49 : return subflow->mp_capable; + 959 : 48 : return subflow->mp_capable; 960 : : } 961 : : - 962 [ + + ]: 1583 : if (subflow->remote_key_valid && - 963 [ + + - + : 1557 : (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) || - + + ] - 964 : 141 : ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && - 965 [ + + + - ]: 141 : (!mp_opt->echo || subflow->mp_join)))) { + 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)))) { 966 : : /* subflows are fully established as soon as we get any 967 : : * additional ack, including ADD_ADDR. 968 : : */ - 969 : 1549 : goto set_fully_established; + 969 : 1550 : 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 : 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); + 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); 996 : : - 997 : 716532 : check_notify: + 997 : 1052523 : 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 [ + + + - ]: 716532 : if (likely(subflow->pm_notified) || list_empty(&subflow->node)) + 1003 [ + + + - ]: 1052523 : if (likely(subflow->pm_notified) || list_empty(&subflow->node)) 1004 : : return true; 1005 : : - 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); + 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); 1010 : : } else { 1011 : 1096 : mptcp_pm_fully_established(msk, ssk); 1012 : : } @@ -1100,93 +1100,93 @@ 1017 : 8 : return false; 1018 : : } 1019 : : - 1020 : 84767 : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq) + 1020 : 202609 : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq) 1021 : : { - 1022 : 84767 : u32 old_seq32, cur_seq32; + 1022 : 202609 : u32 old_seq32, cur_seq32; 1023 : : - 1024 : 84767 : old_seq32 = (u32)old_seq; - 1025 : 84767 : cur_seq32 = (u32)cur_seq; - 1026 : 84767 : cur_seq = (old_seq & GENMASK_ULL(63, 32)) + cur_seq32; - 1027 [ + + - + ]: 84767 : if (unlikely(cur_seq32 < old_seq32 && before(old_seq32, cur_seq32))) + 1024 : 202609 : old_seq32 = (u32)old_seq; + 1025 : 202609 : cur_seq32 = (u32)cur_seq; + 1026 : 202609 : cur_seq = (old_seq & GENMASK_ULL(63, 32)) + cur_seq32; + 1027 [ + + - + ]: 202609 : 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 [ + + - + ]: 84767 : if (unlikely(cur_seq32 > old_seq32 && after(old_seq32, cur_seq32))) + 1031 [ + + - + ]: 202609 : 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 : 156872 : msk->bytes_acked += new_snd_una - msk->snd_una; - 1039 : 156872 : WRITE_ONCE(msk->snd_una, new_snd_una); + 1038 : 241859 : msk->bytes_acked += new_snd_una - msk->snd_una; + 1039 : 241859 : WRITE_ONCE(msk->snd_una, new_snd_una); 1040 : : } 1041 : : - 1042 : 713146 : static void ack_update_msk(struct mptcp_sock *msk, + 1042 : 1049048 : static void ack_update_msk(struct mptcp_sock *msk, 1043 : : struct sock *ssk, 1044 : : struct mptcp_options_received *mp_opt) 1045 : : { - 1046 : 713146 : u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt); - 1047 : 713146 : struct sock *sk = (struct sock *)msk; - 1048 : 713146 : u64 old_snd_una; + 1046 : 1049048 : u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt); + 1047 : 1049048 : struct sock *sk = (struct sock *)msk; + 1048 : 1049048 : u64 old_snd_una; 1049 : : - 1050 : 713146 : mptcp_data_lock(sk); + 1050 : 1049048 : 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 : 713146 : old_snd_una = msk->snd_una; - 1057 [ + + ]: 713146 : new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64); + 1056 : 1049048 : old_snd_una = msk->snd_una; + 1057 [ + + ]: 1049048 : 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 [ + + ]: 713146 : if (unlikely(after64(new_snd_una, snd_nxt))) - 1061 : 47 : new_snd_una = old_snd_una; + 1060 [ + + ]: 1049048 : if (unlikely(after64(new_snd_una, snd_nxt))) + 1061 : 32 : new_snd_una = old_snd_una; 1062 : : - 1063 [ - + ]: 713146 : new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd; + 1063 [ - + ]: 1049048 : new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd; 1064 : : - 1065 [ + + ]: 713146 : if (after64(new_wnd_end, msk->wnd_end)) - 1066 : 198882 : WRITE_ONCE(msk->wnd_end, new_wnd_end); + 1065 [ + + ]: 1049048 : if (after64(new_wnd_end, msk->wnd_end)) + 1066 : 288131 : WRITE_ONCE(msk->wnd_end, new_wnd_end); 1067 : : 1068 : : /* this assumes mptcp_incoming_options() is invoked after tcp_ack() */ - 1069 [ + + ]: 713146 : if (after64(msk->wnd_end, snd_nxt)) - 1070 : 695343 : __mptcp_check_push(sk, ssk); + 1069 [ + + ]: 1049048 : if (after64(msk->wnd_end, snd_nxt)) + 1070 : 1003736 : __mptcp_check_push(sk, ssk); 1071 : : - 1072 [ + + ]: 713146 : if (after64(new_snd_una, old_snd_una)) { - 1073 : 184795 : __mptcp_snd_una_update(msk, new_snd_una); - 1074 : 184795 : __mptcp_data_acked(sk); + 1072 [ + + ]: 1049048 : if (after64(new_snd_una, old_snd_una)) { + 1073 : 264773 : __mptcp_snd_una_update(msk, new_snd_una); + 1074 : 264773 : __mptcp_data_acked(sk); 1075 : : } - 1076 : 713146 : msk->last_ack_recv = tcp_jiffies32; - 1077 : 713146 : mptcp_data_unlock(sk); + 1076 : 1049048 : msk->last_ack_recv = tcp_jiffies32; + 1077 : 1049048 : mptcp_data_unlock(sk); 1078 : : - 1079 : 713146 : trace_ack_update_msk(mp_opt->data_ack, + 1079 : 1049048 : trace_ack_update_msk(mp_opt->data_ack, 1080 : : old_snd_una, new_snd_una, - 1081 : 713146 : new_wnd_end, READ_ONCE(msk->wnd_end)); - 1082 : 713146 : } + 1081 : 1049048 : new_wnd_end, READ_ONCE(msk->wnd_end)); + 1082 : 1049048 : } 1083 : : - 1084 : 7567 : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit) + 1084 : 7771 : 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 [ + + + + ]: 7567 : if (READ_ONCE(msk->rcv_data_fin)) + 1091 [ + + + + ]: 7771 : if (READ_ONCE(msk->rcv_data_fin)) 1092 : : return false; 1093 : : - 1094 [ + + ]: 2184 : WRITE_ONCE(msk->rcv_data_fin_seq, + 1094 [ + + ]: 2205 : WRITE_ONCE(msk->rcv_data_fin_seq, 1095 : : mptcp_expand_seq(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit)); - 1096 : 2184 : WRITE_ONCE(msk->rcv_data_fin, 1); + 1096 : 2205 : WRITE_ONCE(msk->rcv_data_fin, 1); 1097 : : - 1098 : 2184 : return true; + 1098 : 2205 : return true; 1099 : : } 1100 : : - 1101 : 691 : static bool add_addr_hmac_valid(struct mptcp_sock *msk, + 1101 : 692 : static bool add_addr_hmac_valid(struct mptcp_sock *msk, 1102 : : struct mptcp_options_received *mp_opt) 1103 : : { - 1104 : 691 : u64 hmac = 0; + 1104 : 692 : u64 hmac = 0; 1105 : : - 1106 [ + + ]: 691 : if (mp_opt->echo) + 1106 [ + + ]: 692 : if (mp_opt->echo) 1107 : : return true; 1108 : : 1109 : 360 : hmac = add_addr_generate_hmac(READ_ONCE(msk->remote_key), @@ -1200,245 +1200,245 @@ 1117 : : } 1118 : : 1119 : : /* Return false if a subflow has been reset, else return true */ - 1120 : 723043 : bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) + 1120 : 1063399 : bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) 1121 : : { - 1122 [ - + ]: 723043 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1123 [ - + ]: 723043 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 1124 : 723043 : struct mptcp_options_received mp_opt; - 1125 : 723043 : struct mptcp_ext *mpext; + 1122 [ - + ]: 1063399 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1123 [ - + ]: 1063399 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1124 : 1063399 : struct mptcp_options_received mp_opt; + 1125 : 1063399 : struct mptcp_ext *mpext; 1126 : : - 1127 [ + + ]: 723043 : if (__mptcp_check_fallback(msk)) { + 1127 [ + + ]: 1063399 : 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 : 6454 : mptcp_data_lock(subflow->conn); - 1134 [ + + ]: 6454 : if (sk_stream_memory_free(sk)) - 1135 : 6424 : __mptcp_check_push(subflow->conn, sk); + 1133 : 10820 : mptcp_data_lock(subflow->conn); + 1134 [ + + ]: 10820 : if (sk_stream_memory_free(sk)) + 1135 : 10580 : __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 : 6454 : __mptcp_snd_una_update(msk, READ_ONCE(msk->snd_nxt)); + 1140 : 10820 : __mptcp_snd_una_update(msk, READ_ONCE(msk->snd_nxt)); 1141 : : - 1142 : 6454 : __mptcp_data_acked(subflow->conn); - 1143 : 6454 : mptcp_data_unlock(subflow->conn); - 1144 : 6454 : return true; + 1142 : 10820 : __mptcp_data_acked(subflow->conn); + 1143 : 10820 : mptcp_data_unlock(subflow->conn); + 1144 : 10820 : return true; 1145 : : } 1146 : : - 1147 : 716589 : mptcp_get_options(skb, &mp_opt); + 1147 : 1052579 : 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 [ + + ]: 716589 : if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) - 1153 : 51 : return sk->sk_state != TCP_CLOSE; + 1152 [ + + ]: 1052579 : if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) + 1153 : 50 : return sk->sk_state != TCP_CLOSE; 1154 : : - 1155 [ + + ]: 716538 : if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) { - 1156 [ + + ]: 5479 : if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && - 1157 [ + + ]: 247 : READ_ONCE(msk->local_key) == mp_opt.rcvr_key) { - 1158 : 237 : WRITE_ONCE(msk->rcv_fastclose, true); - 1159 : 237 : mptcp_schedule_work((struct sock *)msk); - 1160 [ + - ]: 237 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX); + 1155 [ + + ]: 1052529 : if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) { + 1156 [ + + ]: 5542 : if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && + 1157 [ + + ]: 271 : READ_ONCE(msk->local_key) == mp_opt.rcvr_key) { + 1158 : 261 : WRITE_ONCE(msk->rcv_fastclose, true); + 1159 : 261 : mptcp_schedule_work((struct sock *)msk); + 1160 [ + - ]: 261 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX); 1161 : : } 1162 : : - 1163 [ + + + - ]: 6170 : if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) && - 1164 : 691 : add_addr_hmac_valid(msk, &mp_opt)) { - 1165 [ + + ]: 691 : if (!mp_opt.echo) { + 1163 [ + + + - ]: 6234 : if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) && + 1164 : 692 : add_addr_hmac_valid(msk, &mp_opt)) { + 1165 [ + + ]: 692 : 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 : 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); + 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); 1172 : : } 1173 : : - 1174 [ + + ]: 691 : if (mp_opt.addr.port) + 1174 [ + + ]: 692 : if (mp_opt.addr.port) 1175 [ + - ]: 68 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_PORTADD); 1176 : : } 1177 : : - 1178 [ + + ]: 5479 : if (mp_opt.suboptions & OPTION_MPTCP_RM_ADDR) + 1178 [ + + ]: 5542 : if (mp_opt.suboptions & OPTION_MPTCP_RM_ADDR) 1179 : 106 : mptcp_pm_rm_addr_received(msk, &mp_opt.rm_list); 1180 : : - 1181 [ + + ]: 5479 : if (mp_opt.suboptions & OPTION_MPTCP_PRIO) { + 1181 [ + + ]: 5542 : 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 [ + + ]: 5479 : 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); + 1186 [ + + ]: 5542 : if (mp_opt.suboptions & OPTION_MPTCP_FAIL) { + 1187 : 5 : mptcp_pm_mp_fail_received(sk, mp_opt.fail_seq); + 1188 [ + - ]: 5 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILRX); 1189 : : } 1190 : : - 1191 [ + + ]: 5479 : if (mp_opt.suboptions & OPTION_MPTCP_RST) { - 1192 : 245 : subflow->reset_seen = 1; - 1193 : 245 : subflow->reset_reason = mp_opt.reset_reason; - 1194 : 245 : subflow->reset_transient = mp_opt.reset_transient; - 1195 [ + - ]: 245 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX); + 1191 [ + + ]: 5542 : if (mp_opt.suboptions & OPTION_MPTCP_RST) { + 1192 : 267 : subflow->reset_seen = 1; + 1193 : 267 : subflow->reset_reason = mp_opt.reset_reason; + 1194 : 267 : subflow->reset_transient = mp_opt.reset_transient; + 1195 [ + - ]: 267 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX); 1196 : : } 1197 : : - 1198 [ + + ]: 5479 : if (!(mp_opt.suboptions & OPTION_MPTCP_DSS)) + 1198 [ + + ]: 5542 : 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 [ + + ]: 713775 : if (mp_opt.use_ack) - 1206 : 713146 : ack_update_msk(msk, sk, &mp_opt); + 1205 [ + + ]: 1049736 : if (mp_opt.use_ack) + 1206 : 1049048 : 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 [ + + ]: 713775 : if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { - 1214 [ + + + - : 284692 : if (mp_opt.data_fin && mp_opt.data_len == 1 && - + + ] - 1215 : 6427 : mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) - 1216 : 2088 : mptcp_schedule_work((struct sock *)msk); + 1213 [ + + ]: 1049736 : if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { + 1214 [ + + + - : 397446 : if (mp_opt.data_fin && mp_opt.data_len == 1 && + + + ] + 1215 : 6182 : mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) + 1216 : 2112 : mptcp_schedule_work((struct sock *)msk); 1217 : : - 1218 : 278265 : return true; + 1218 : 391264 : return true; 1219 : : } 1220 : : - 1221 : 435510 : mpext = skb_ext_add(skb, SKB_EXT_MPTCP); - 1222 [ - + ]: 435510 : if (!mpext) + 1221 : 658472 : mpext = skb_ext_add(skb, SKB_EXT_MPTCP); + 1222 [ - + ]: 658472 : if (!mpext) 1223 : : return true; 1224 : : - 1225 : 435510 : memset(mpext, 0, sizeof(*mpext)); + 1225 : 658472 : memset(mpext, 0, sizeof(*mpext)); 1226 : : - 1227 [ + + ]: 435510 : if (likely(mp_opt.use_map)) { - 1228 [ + + ]: 433516 : if (mp_opt.mpc_map) { + 1227 [ + + ]: 658472 : if (likely(mp_opt.use_map)) { + 1228 [ + + ]: 656457 : 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 : : */ - 1232 : 629 : mptcp_crypto_key_sha(subflow->remote_key, NULL, + 1232 : 688 : mptcp_crypto_key_sha(subflow->remote_key, NULL, 1233 : : &mpext->data_seq); - 1234 : 629 : mpext->data_seq++; - 1235 : 629 : mpext->subflow_seq = 1; - 1236 : 629 : mpext->dsn64 = 1; - 1237 : 629 : mpext->mpc_map = 1; - 1238 : 629 : mpext->data_fin = 0; + 1234 : 688 : mpext->data_seq++; + 1235 : 688 : mpext->subflow_seq = 1; + 1236 : 688 : mpext->dsn64 = 1; + 1237 : 688 : mpext->mpc_map = 1; + 1238 : 688 : mpext->data_fin = 0; 1239 : : } else { - 1240 : 432887 : mpext->data_seq = mp_opt.data_seq; - 1241 : 432887 : mpext->subflow_seq = mp_opt.subflow_seq; - 1242 : 432887 : mpext->dsn64 = mp_opt.dsn64; - 1243 : 432887 : mpext->data_fin = mp_opt.data_fin; + 1240 : 655769 : mpext->data_seq = mp_opt.data_seq; + 1241 : 655769 : mpext->subflow_seq = mp_opt.subflow_seq; + 1242 : 655769 : mpext->dsn64 = mp_opt.dsn64; + 1243 : 655769 : mpext->data_fin = mp_opt.data_fin; 1244 : : } - 1245 : 433516 : mpext->data_len = mp_opt.data_len; - 1246 : 433516 : mpext->use_map = 1; - 1247 : 433516 : mpext->csum_reqd = !!(mp_opt.suboptions & OPTION_MPTCP_CSUMREQD); + 1245 : 656457 : mpext->data_len = mp_opt.data_len; + 1246 : 656457 : mpext->use_map = 1; + 1247 : 656457 : mpext->csum_reqd = !!(mp_opt.suboptions & OPTION_MPTCP_CSUMREQD); 1248 : : - 1249 [ + + ]: 433516 : if (mpext->csum_reqd) - 1250 : 1605 : mpext->csum = mp_opt.csum; + 1249 [ + + ]: 656457 : if (mpext->csum_reqd) + 1250 : 1594 : mpext->csum = mp_opt.csum; 1251 : : } 1252 : : 1253 : : return true; 1254 : : } 1255 : : - 1256 : 641130 : static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) + 1256 : 844641 : static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) 1257 : : { - 1258 : 641130 : const struct sock *ssk = (const struct sock *)tp; - 1259 : 641130 : struct mptcp_subflow_context *subflow; - 1260 : 641130 : u64 ack_seq, rcv_wnd_old, rcv_wnd_new; - 1261 : 641130 : struct mptcp_sock *msk; - 1262 : 641130 : u32 new_win; - 1263 : 641130 : u64 win; + 1258 : 844641 : const struct sock *ssk = (const struct sock *)tp; + 1259 : 844641 : struct mptcp_subflow_context *subflow; + 1260 : 844641 : u64 ack_seq, rcv_wnd_old, rcv_wnd_new; + 1261 : 844641 : struct mptcp_sock *msk; + 1262 : 844641 : u32 new_win; + 1263 : 844641 : u64 win; 1264 : : - 1265 [ - + ]: 641130 : subflow = mptcp_subflow_ctx(ssk); - 1266 [ - + ]: 641130 : msk = mptcp_sk(subflow->conn); + 1265 [ - + ]: 844641 : subflow = mptcp_subflow_ctx(ssk); + 1266 [ - + ]: 844641 : msk = mptcp_sk(subflow->conn); 1267 : : - 1268 : 641130 : ack_seq = READ_ONCE(msk->ack_seq); - 1269 : 641130 : rcv_wnd_new = ack_seq + tp->rcv_wnd; + 1268 : 844641 : ack_seq = READ_ONCE(msk->ack_seq); + 1269 : 844641 : rcv_wnd_new = ack_seq + tp->rcv_wnd; 1270 : : - 1271 [ + + ]: 641130 : rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent); - 1272 [ + + ]: 641130 : if (after64(rcv_wnd_new, rcv_wnd_old)) { - 1273 : 37291 : u64 rcv_wnd; + 1271 [ + + ]: 844641 : rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent); + 1272 [ + + ]: 844641 : if (after64(rcv_wnd_new, rcv_wnd_old)) { + 1273 : 36881 : u64 rcv_wnd; 1274 : : - 1275 : 222958 : for (;;) { - 1276 : 260249 : rcv_wnd = atomic64_cmpxchg(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); + 1275 : 310918 : for (;;) { + 1276 : 347799 : rcv_wnd = atomic64_cmpxchg(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); 1277 : : - 1278 [ + + ]: 222958 : if (rcv_wnd == rcv_wnd_old) + 1278 [ + + ]: 310918 : if (rcv_wnd == rcv_wnd_old) 1279 : : break; 1280 : : - 1281 : 9 : rcv_wnd_old = rcv_wnd; - 1282 [ + + ]: 9 : if (before64(rcv_wnd_new, rcv_wnd_old)) { - 1283 [ + - ]: 4 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); - 1284 : 4 : goto raise_win; + 1281 : 2 : rcv_wnd_old = rcv_wnd; + 1282 [ + - ]: 2 : if (before64(rcv_wnd_new, rcv_wnd_old)) { + 1283 [ + - ]: 2 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); + 1284 : 2 : goto raise_win; 1285 : : } - 1286 [ - + ]: 37296 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); + 1286 [ - - ]: 36881 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); 1287 : : } - 1288 : 222949 : goto update_wspace; + 1288 : 310916 : goto update_wspace; 1289 : : } 1290 : : - 1291 [ + + ]: 418177 : if (rcv_wnd_new != rcv_wnd_old) { - 1292 : 61982 : raise_win: - 1293 : 61986 : win = rcv_wnd_old - ack_seq; - 1294 : 61986 : tp->rcv_wnd = min_t(u64, win, U32_MAX); - 1295 : 61986 : new_win = tp->rcv_wnd; + 1291 [ + + ]: 533723 : if (rcv_wnd_new != rcv_wnd_old) { + 1292 : 72379 : raise_win: + 1293 : 72381 : win = rcv_wnd_old - ack_seq; + 1294 : 72381 : tp->rcv_wnd = min_t(u64, win, U32_MAX); + 1295 : 72381 : new_win = tp->rcv_wnd; 1296 : : 1297 : : /* Make sure we do not exceed the maximum possible 1298 : : * scaled window. 1299 : : */ - 1300 [ + + ]: 61986 : if (unlikely(th->syn)) - 1301 : 527 : new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; - 1302 [ - + - - ]: 61986 : if (!tp->rx_opt.rcv_wscale && + 1300 [ + + ]: 72381 : if (unlikely(th->syn)) + 1301 : 523 : new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; + 1302 [ - + - - ]: 72381 : 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 : 61986 : new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); + 1306 : 72381 : new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); 1307 : : 1308 : : /* RFC1323 scaling applied */ - 1309 : 61986 : new_win >>= tp->rx_opt.rcv_wscale; - 1310 : 61986 : th->window = htons(new_win); - 1311 [ + - ]: 61986 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); + 1309 : 72381 : new_win >>= tp->rx_opt.rcv_wscale; + 1310 : 72381 : th->window = htons(new_win); + 1311 [ + - ]: 72381 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); 1312 : : } 1313 : : - 1314 : 356195 : update_wspace: - 1315 : 641130 : WRITE_ONCE(msk->old_wspace, tp->rcv_wnd); - 1316 : 641130 : } + 1314 : 461344 : update_wspace: + 1315 : 844641 : WRITE_ONCE(msk->old_wspace, tp->rcv_wnd); + 1316 : 844641 : } 1317 : : - 1318 : 2045 : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum) + 1318 : 2020 : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum) 1319 : : { - 1320 : 2045 : struct csum_pseudo_header header; - 1321 : 2045 : __wsum csum; + 1320 : 2020 : struct csum_pseudo_header header; + 1321 : 2020 : __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 : 2045 : header.data_seq = cpu_to_be64(data_seq); - 1329 : 2045 : header.subflow_seq = htonl(subflow_seq); - 1330 : 2045 : header.data_len = htons(data_len); - 1331 : 2045 : header.csum = 0; + 1328 : 2020 : header.data_seq = cpu_to_be64(data_seq); + 1329 : 2020 : header.subflow_seq = htonl(subflow_seq); + 1330 : 2020 : header.data_len = htons(data_len); + 1331 : 2020 : header.csum = 0; 1332 : : - 1333 : 2045 : csum = csum_partial(&header, sizeof(header), sum); - 1334 : 2045 : return csum_fold(csum); + 1333 : 2020 : csum = csum_partial(&header, sizeof(header), sum); + 1334 : 2020 : return csum_fold(csum); 1335 : : } 1336 : : - 1337 : 1913 : static __sum16 mptcp_make_csum(const struct mptcp_ext *mpext) + 1337 : 1890 : static __sum16 mptcp_make_csum(const struct mptcp_ext *mpext) 1338 : : { - 1339 : 3826 : return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len, - 1340 : 1913 : ~csum_unfold(mpext->csum)); + 1339 : 3780 : return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len, + 1340 : 1890 : ~csum_unfold(mpext->csum)); 1341 : : } 1342 : : 1343 : 0 : static void put_len_csum(u16 len, __sum16 csum, void *data) 1344 : : { - 1345 : 1919 : __sum16 *sumptr = data + 2; - 1346 : 1919 : __be16 *ptr = data; + 1345 : 1896 : __sum16 *sumptr = data + 2; + 1346 : 1896 : __be16 *ptr = data; 1347 : : - 1348 : 1919 : put_unaligned_be16(len, ptr); + 1348 : 1896 : put_unaligned_be16(len, ptr); 1349 : : - 1350 : 1919 : put_unaligned(csum, sumptr); - 1351 : 1919 : } + 1350 : 1896 : put_unaligned(csum, sumptr); + 1351 : 1896 : } 1352 : : - 1353 : 643272 : void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp, + 1353 : 846816 : void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp, 1354 : : struct mptcp_out_options *opts) 1355 : : { - 1356 : 643272 : const struct sock *ssk = (const struct sock *)tp; - 1357 : 643272 : struct mptcp_subflow_context *subflow; + 1356 : 846816 : const struct sock *ssk = (const struct sock *)tp; + 1357 : 846816 : 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 [ + + ]: 643272 : if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { - 1382 : 636303 : struct mptcp_ext *mpext = &opts->ext_copy; - 1383 : 636303 : u8 len = TCPOLEN_MPTCP_DSS_BASE; - 1384 : 636303 : u8 flags = 0; + 1381 [ + + ]: 846816 : if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { + 1382 : 839776 : struct mptcp_ext *mpext = &opts->ext_copy; + 1383 : 839776 : u8 len = TCPOLEN_MPTCP_DSS_BASE; + 1384 : 839776 : u8 flags = 0; 1385 : : - 1386 [ + - ]: 636303 : if (mpext->use_ack) { - 1387 : 636303 : flags = MPTCP_DSS_HAS_ACK; - 1388 [ + + ]: 636303 : if (mpext->ack64) { + 1386 [ + - ]: 839776 : if (mpext->use_ack) { + 1387 : 839776 : flags = MPTCP_DSS_HAS_ACK; + 1388 [ + + ]: 839776 : if (mpext->ack64) { 1389 : : len += TCPOLEN_MPTCP_DSS_ACK64; 1390 : : flags |= MPTCP_DSS_ACK64; 1391 : : } else { - 1392 : 81917 : len += TCPOLEN_MPTCP_DSS_ACK32; + 1392 : 105901 : len += TCPOLEN_MPTCP_DSS_ACK32; 1393 : : } 1394 : : } 1395 : : - 1396 [ + + ]: 636303 : if (mpext->use_map) { - 1397 : 358777 : len += TCPOLEN_MPTCP_DSS_MAP64; + 1396 [ + + ]: 839776 : if (mpext->use_map) { + 1397 : 448866 : 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 : 358777 : flags |= MPTCP_DSS_HAS_MAP | MPTCP_DSS_DSN64; - 1403 [ + + ]: 358777 : if (mpext->data_fin) - 1404 : 8741 : flags |= MPTCP_DSS_DATA_FIN; + 1402 : 448866 : flags |= MPTCP_DSS_HAS_MAP | MPTCP_DSS_DSN64; + 1403 [ + + ]: 448866 : if (mpext->data_fin) + 1404 : 8528 : flags |= MPTCP_DSS_DATA_FIN; 1405 : : - 1406 [ + + ]: 358777 : if (opts->csum_reqd) - 1407 : 1915 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; + 1406 [ + + ]: 448866 : if (opts->csum_reqd) + 1407 : 1892 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 1408 : : } 1409 : : - 1410 [ + - ]: 636303 : *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags); + 1410 [ + - ]: 839776 : *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags); 1411 : : - 1412 [ + - ]: 636303 : if (mpext->use_ack) { - 1413 [ + + ]: 636303 : if (mpext->ack64) { - 1414 : 554386 : put_unaligned_be64(mpext->data_ack, ptr); - 1415 : 554386 : ptr += 2; + 1412 [ + - ]: 839776 : if (mpext->use_ack) { + 1413 [ + + ]: 839776 : if (mpext->ack64) { + 1414 : 733875 : put_unaligned_be64(mpext->data_ack, ptr); + 1415 : 733875 : ptr += 2; 1416 : : } else { - 1417 : 81917 : put_unaligned_be32(mpext->data_ack32, ptr); - 1418 : 81917 : ptr += 1; + 1417 : 105901 : put_unaligned_be32(mpext->data_ack32, ptr); + 1418 : 105901 : ptr += 1; 1419 : : } 1420 : : } 1421 : : - 1422 [ + + ]: 636303 : if (mpext->use_map) { - 1423 [ + + ]: 358777 : put_unaligned_be64(mpext->data_seq, ptr); - 1424 : 358777 : ptr += 2; - 1425 [ + + ]: 358777 : put_unaligned_be32(mpext->subflow_seq, ptr); - 1426 : 358777 : ptr += 1; - 1427 [ + + ]: 358777 : if (opts->csum_reqd) { + 1422 [ + + ]: 839776 : if (mpext->use_map) { + 1423 [ + + ]: 448866 : put_unaligned_be64(mpext->data_seq, ptr); + 1424 : 448866 : ptr += 2; + 1425 [ + + ]: 448866 : put_unaligned_be32(mpext->subflow_seq, ptr); + 1426 : 448866 : ptr += 1; + 1427 [ + + ]: 448866 : 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 : 1915 : put_len_csum(mpext->data_len, - 1432 [ + + ]: 1915 : (mpext->data_len ? mptcp_make_csum(mpext) : 0), + 1431 : 1892 : put_len_csum(mpext->data_len, + 1432 [ + + ]: 1892 : (mpext->data_len ? mptcp_make_csum(mpext) : 0), 1433 : : ptr); 1434 : : } else { - 1435 : 356862 : put_unaligned_be32(mpext->data_len << 16 | - 1436 : 356862 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); + 1435 : 446974 : put_unaligned_be32(mpext->data_len << 16 | + 1436 : 446974 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); 1437 : : } - 1438 : 358777 : ptr += 1; + 1438 : 448866 : ptr += 1; 1439 : : } 1440 : : 1441 : : /* We might need to add MP_FAIL options in rare cases */ - 1442 [ + + ]: 636303 : if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) - 1443 : 4 : goto mp_fail; - 1444 [ + + ]: 6969 : } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { - 1445 : 4193 : u8 len, flag = MPTCP_CAP_HMAC_SHA256; + 1442 [ + + ]: 839776 : if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) + 1443 : 3 : goto mp_fail; + 1444 [ + + ]: 7040 : } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { + 1445 : 4228 : u8 len, flag = MPTCP_CAP_HMAC_SHA256; 1446 : : - 1447 [ + + ]: 4193 : if (OPTION_MPTCP_MPC_SYN & opts->suboptions) { + 1447 [ + + ]: 4228 : if (OPTION_MPTCP_MPC_SYN & opts->suboptions) { 1448 : : len = TCPOLEN_MPTCP_MPC_SYN; - 1449 [ + + ]: 2905 : } else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) { + 1449 [ + + ]: 2940 : } else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) { 1450 : : len = TCPOLEN_MPTCP_MPC_SYNACK; - 1451 [ + + ]: 1719 : } else if (opts->data_len) { - 1452 : 595 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; - 1453 [ + + ]: 595 : if (opts->csum_reqd) + 1451 [ + + ]: 1754 : } else if (opts->data_len) { + 1452 : 630 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; + 1453 [ + + ]: 630 : if (opts->csum_reqd) 1454 : 4 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 1455 : : } else { 1456 : : len = TCPOLEN_MPTCP_MPC_ACK; 1457 : : } 1458 : : - 1459 [ + + ]: 4193 : if (opts->csum_reqd) + 1459 [ + + ]: 4228 : if (opts->csum_reqd) 1460 : 30 : flag |= MPTCP_CAP_CHECKSUM_REQD; 1461 : : - 1462 [ + + ]: 4193 : if (!opts->allow_join_id0) - 1463 : 19 : flag |= MPTCP_CAP_DENY_JOIN_ID0; + 1462 [ + + ]: 4228 : if (!opts->allow_join_id0) + 1463 : 18 : flag |= MPTCP_CAP_DENY_JOIN_ID0; 1464 : : - 1465 [ + + ]: 4193 : *ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len, + 1465 [ + + ]: 4228 : *ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len, 1466 : : MPTCP_SUPPORTED_VERSION, 1467 : : flag); 1468 : : - 1469 : 4193 : if (!((OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & - 1470 [ + + ]: 4193 : opts->suboptions)) + 1469 : 4228 : if (!((OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & + 1470 [ + + ]: 4228 : opts->suboptions)) 1471 : 1288 : goto mp_capable_done; 1472 : : - 1473 [ + + ]: 2905 : put_unaligned_be64(opts->sndr_key, ptr); - 1474 : 2905 : ptr += 2; - 1475 [ + + ]: 2905 : if (!((OPTION_MPTCP_MPC_ACK) & opts->suboptions)) + 1473 [ + + ]: 2940 : put_unaligned_be64(opts->sndr_key, ptr); + 1474 : 2940 : ptr += 2; + 1475 [ + + ]: 2940 : if (!((OPTION_MPTCP_MPC_ACK) & opts->suboptions)) 1476 : 1186 : goto mp_capable_done; 1477 : : - 1478 [ + + ]: 1719 : put_unaligned_be64(opts->rcvr_key, ptr); - 1479 : 1719 : ptr += 2; - 1480 [ + + ]: 1719 : if (!opts->data_len) + 1478 [ + + ]: 1754 : put_unaligned_be64(opts->rcvr_key, ptr); + 1479 : 1754 : ptr += 2; + 1480 [ + + ]: 1754 : if (!opts->data_len) 1481 : 1124 : goto mp_capable_done; 1482 : : - 1483 [ + + ]: 595 : if (opts->csum_reqd) { + 1483 [ + + ]: 630 : 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 : 591 : put_unaligned_be32(opts->data_len << 16 | - 1492 : 591 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); + 1491 : 626 : put_unaligned_be32(opts->data_len << 16 | + 1492 : 626 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); 1493 : : } - 1494 : 595 : ptr += 1; + 1494 : 630 : ptr += 1; 1495 : : 1496 : : /* MPC is additionally mutually exclusive with MP_PRIO */ - 1497 : 595 : goto mp_capable_done; - 1498 [ + + ]: 2776 : } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { - 1499 [ + + ]: 1582 : if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { - 1500 : 570 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1497 : 630 : goto mp_capable_done; + 1498 [ + + ]: 2812 : } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { + 1499 [ + + ]: 1586 : if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { + 1500 : 569 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1501 : : TCPOLEN_MPTCP_MPJ_SYN, - 1502 : 570 : opts->backup, opts->join_id); - 1503 : 570 : put_unaligned_be32(opts->token, ptr); - 1504 : 570 : ptr += 1; - 1505 : 570 : put_unaligned_be32(opts->nonce, ptr); - 1506 : 570 : ptr += 1; - 1507 [ + + ]: 1012 : } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { - 1508 : 513 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1502 : 569 : opts->backup, opts->join_id); + 1503 : 569 : put_unaligned_be32(opts->token, ptr); + 1504 : 569 : ptr += 1; + 1505 : 569 : put_unaligned_be32(opts->nonce, ptr); + 1506 : 569 : ptr += 1; + 1507 [ + + ]: 1017 : } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { + 1508 : 516 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1509 : : TCPOLEN_MPTCP_MPJ_SYNACK, - 1510 : 513 : opts->backup, opts->join_id); - 1511 : 513 : put_unaligned_be64(opts->thmac, ptr); - 1512 : 513 : ptr += 2; - 1513 : 513 : put_unaligned_be32(opts->nonce, ptr); - 1514 : 513 : ptr += 1; + 1510 : 516 : opts->backup, opts->join_id); + 1511 : 516 : put_unaligned_be64(opts->thmac, ptr); + 1512 : 516 : ptr += 2; + 1513 : 516 : put_unaligned_be32(opts->nonce, ptr); + 1514 : 516 : ptr += 1; 1515 : : } else { - 1516 : 499 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1516 : 501 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1517 : : TCPOLEN_MPTCP_MPJ_ACK, 0, 0); - 1518 : 499 : memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); - 1519 : 499 : ptr += 5; + 1518 : 501 : memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); + 1519 : 501 : ptr += 5; 1520 : : } - 1521 [ + + ]: 1194 : } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { - 1522 : 755 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; - 1523 : 755 : u8 echo = MPTCP_ADDR_ECHO; + 1521 [ + + ]: 1226 : } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { + 1522 : 756 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + 1523 : 756 : u8 echo = MPTCP_ADDR_ECHO; 1524 : : 1525 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1526 [ + + ]: 755 : if (opts->addr.family == AF_INET6) - 1527 : 169 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; + 1526 [ + + ]: 756 : if (opts->addr.family == AF_INET6) + 1527 : 170 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; 1528 : : #endif 1529 : : - 1530 [ + + ]: 755 : if (opts->addr.port) + 1530 [ + + ]: 756 : if (opts->addr.port) 1531 : 68 : len += TCPOLEN_MPTCP_PORT_LEN; 1532 : : - 1533 [ + + ]: 755 : if (opts->ahmac) { + 1533 [ + + ]: 756 : if (opts->ahmac) { 1534 : 404 : len += sizeof(opts->ahmac); 1535 : 404 : echo = 0; 1536 : : } 1537 : : - 1538 : 755 : *ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, - 1539 [ + + ]: 755 : len, echo, opts->addr.id); - 1540 [ + + ]: 755 : if (opts->addr.family == AF_INET) { + 1538 : 756 : *ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, + 1539 [ + + ]: 756 : len, echo, opts->addr.id); + 1540 [ + + ]: 756 : 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 [ + - ]: 169 : else if (opts->addr.family == AF_INET6) { - 1546 : 169 : memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16); - 1547 : 169 : ptr += 4; + 1545 [ + - ]: 170 : else if (opts->addr.family == AF_INET6) { + 1546 : 170 : memcpy((u8 *)ptr, opts->addr.addr6.s6_addr, 16); + 1547 : 170 : ptr += 4; 1548 : : } 1549 : : #endif 1550 : : - 1551 [ + + ]: 755 : if (!opts->addr.port) { - 1552 [ + + ]: 687 : if (opts->ahmac) { + 1551 [ + + ]: 756 : if (!opts->addr.port) { + 1552 [ + + ]: 688 : if (opts->ahmac) { 1553 : 376 : put_unaligned_be64(opts->ahmac, ptr); 1554 : 376 : ptr += 2; 1555 : : } @@ -1658,42 +1658,42 @@ 1574 : 40 : ptr += 1; 1575 : : } 1576 : : } - 1577 [ + + ]: 439 : } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { + 1577 [ + + ]: 470 : } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { 1578 : : /* FASTCLOSE is mutually exclusive with others except RST */ - 1579 : 377 : *ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE, + 1579 : 412 : *ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE, 1580 : : TCPOLEN_MPTCP_FASTCLOSE, 1581 : : 0, 0); - 1582 [ + - ]: 377 : put_unaligned_be64(opts->rcvr_key, ptr); - 1583 : 377 : ptr += 2; + 1582 [ + - ]: 412 : put_unaligned_be64(opts->rcvr_key, ptr); + 1583 : 412 : ptr += 2; 1584 : : - 1585 [ + - ]: 377 : if (OPTION_MPTCP_RST & opts->suboptions) - 1586 : 377 : goto mp_rst; + 1585 [ + - ]: 412 : if (OPTION_MPTCP_RST & opts->suboptions) + 1586 : 412 : goto mp_rst; 1587 : : return; - 1588 [ + + ]: 62 : } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { - 1589 : 2 : mp_fail: + 1588 [ + + ]: 58 : } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { + 1589 : 3 : mp_fail: 1590 : : /* MP_FAIL is mutually exclusive with others except RST */ - 1591 [ + + ]: 6 : subflow = mptcp_subflow_ctx(ssk); + 1591 [ + + ]: 6 : subflow = mptcp_subflow_ctx(ssk); 1592 : 6 : subflow->send_mp_fail = 0; 1593 : : 1594 : 6 : *ptr++ = mptcp_option(MPTCPOPT_MP_FAIL, 1595 : : TCPOLEN_MPTCP_FAIL, 1596 : : 0, 0); - 1597 [ + + ]: 6 : put_unaligned_be64(opts->fail_seq, ptr); + 1597 [ + + ]: 6 : put_unaligned_be64(opts->fail_seq, ptr); 1598 : 6 : ptr += 2; 1599 : : - 1600 [ + + ]: 6 : if (OPTION_MPTCP_RST & opts->suboptions) - 1601 : 2 : goto mp_rst; + 1600 [ + + ]: 6 : if (OPTION_MPTCP_RST & opts->suboptions) + 1601 : 3 : goto mp_rst; 1602 : : return; - 1603 [ + - ]: 60 : } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { - 1604 : 60 : mp_rst: - 1605 : 439 : *ptr++ = mptcp_option(MPTCPOPT_RST, + 1603 [ + - ]: 55 : } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { + 1604 : 55 : mp_rst: + 1605 : 470 : *ptr++ = mptcp_option(MPTCPOPT_RST, 1606 : : TCPOLEN_MPTCP_RST, - 1607 : 439 : opts->reset_transient, - 1608 : 439 : opts->reset_reason); - 1609 : 439 : return; + 1607 : 470 : opts->reset_transient, + 1608 : 470 : opts->reset_reason); + 1609 : 470 : return; 1610 : : } 1611 : : - 1612 [ + + ]: 638636 : if (OPTION_MPTCP_PRIO & opts->suboptions) { + 1612 [ + + ]: 842115 : 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 : 638608 : mp_capable_done: - 1624 [ + + ]: 642829 : if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { + 1623 : 842087 : mp_capable_done: + 1624 [ + + ]: 846343 : 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 [ + + ]: 642829 : if (tp) - 1645 : 641130 : mptcp_set_rwin(tp, th); + 1644 [ + + ]: 846343 : if (tp) + 1645 : 844641 : 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 593e73ea..b67e2134 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -88,7 +88,7 @@ mptcp_pm_mp_fail_received - 6 + 5 @@ -179,7 +179,7 @@ mptcp_pm_add_addr_echoed - 331 + 332 @@ -193,63 +193,63 @@ mptcp_pm_allow_new_subflow - 505 + 506 - mptcp_pm_addr_families_match + mptcp_pm_subflow_chk_stale - 663 + 543 - mptcp_pm_subflow_chk_stale + mptcp_pm_addr_families_match - 674 + 664 mptcp_pm_subflow_check_next - 729 + 754 mptcp_pm_add_addr_signal - 755 + 756 mptcp_pm_announce_addr - 755 + 756 mptcp_pm_get_local_id - 766 + 768 mptcp_pm_is_backup - 766 + 768 mptcp_pm_subflow_established - 996 + 998 diff --git a/html/lcov/export/mptcp/pm.c.func.html b/html/lcov/export/mptcp/pm.c.func.html index eaa37847..2e7fa0ea 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -81,7 +81,7 @@ mptcp_pm_add_addr_echoed - 331 + 332 @@ -102,28 +102,28 @@ mptcp_pm_add_addr_signal - 755 + 756 mptcp_pm_addr_families_match - 663 + 664 mptcp_pm_allow_new_subflow - 505 + 506 mptcp_pm_announce_addr - 755 + 756 @@ -179,7 +179,7 @@ mptcp_pm_get_local_id - 766 + 768 @@ -193,14 +193,14 @@ mptcp_pm_is_backup - 766 + 768 mptcp_pm_mp_fail_received - 6 + 5 @@ -277,21 +277,21 @@ mptcp_pm_subflow_check_next - 729 + 754 mptcp_pm_subflow_chk_stale - 674 + 543 mptcp_pm_subflow_established - 996 + 998 diff --git a/html/lcov/export/mptcp/pm.c.gcov.html b/html/lcov/export/mptcp/pm.c.gcov.html index b667385c..cde1bec4 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -92,32 +92,32 @@ 14 : : 15 : : /* path manager command handlers */ 16 : : - 17 : 755 : int mptcp_pm_announce_addr(struct mptcp_sock *msk, + 17 : 756 : int mptcp_pm_announce_addr(struct mptcp_sock *msk, 18 : : const struct mptcp_addr_info *addr, 19 : : bool echo) 20 : : { - 21 : 755 : u8 add_addr = READ_ONCE(msk->pm.addr_signal); + 21 : 756 : u8 add_addr = READ_ONCE(msk->pm.addr_signal); 22 : : - 23 [ - + ]: 755 : pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo); + 23 [ - + ]: 756 : pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo); 24 : : - 25 [ + - - + ]: 755 : lockdep_assert_held(&msk->pm.lock); + 25 [ + - - + ]: 756 : lockdep_assert_held(&msk->pm.lock); 26 : : - 27 [ - + ]: 755 : if (add_addr & - 28 [ + + ]: 755 : (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { + 27 [ - + ]: 756 : if (add_addr & + 28 [ + + ]: 756 : (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 [ + + ]: 755 : if (echo) { - 35 : 351 : msk->pm.remote = *addr; - 36 : 351 : add_addr |= BIT(MPTCP_ADD_ADDR_ECHO); + 34 [ + + ]: 756 : if (echo) { + 35 : 352 : msk->pm.remote = *addr; + 36 : 352 : 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 : 755 : WRITE_ONCE(msk->pm.addr_signal, add_addr); - 42 : 755 : return 0; + 41 : 756 : WRITE_ONCE(msk->pm.addr_signal, add_addr); + 42 : 756 : 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 : 505 : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) + 76 : 506 : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) 77 : : { - 78 : 505 : struct mptcp_pm_data *pm = &msk->pm; - 79 : 505 : unsigned int subflows_max; - 80 : 505 : int ret = 0; + 78 : 506 : struct mptcp_pm_data *pm = &msk->pm; + 79 : 506 : unsigned int subflows_max; + 80 : 506 : int ret = 0; 81 : : - 82 [ + + ]: 505 : if (mptcp_pm_is_userspace(msk)) { + 82 [ + + ]: 506 : 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,24 +167,24 @@ 89 : : return false; 90 : : } 91 : : - 92 : 483 : subflows_max = mptcp_pm_get_subflows_max(msk); + 92 : 484 : subflows_max = mptcp_pm_get_subflows_max(msk); 93 : : - 94 [ - + - - ]: 483 : pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, + 94 [ - + - - ]: 484 : 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 [ - + - + ]: 483 : if (!READ_ONCE(pm->accept_subflow)) + 98 [ - + - + ]: 484 : if (!READ_ONCE(pm->accept_subflow)) 99 : : return false; 100 : : - 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) + 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) 105 : 182 : WRITE_ONCE(pm->accept_subflow, false); 106 : : } - 107 : 483 : spin_unlock_bh(&pm->lock); + 107 : 484 : spin_unlock_bh(&pm->lock); 108 : : - 109 : 483 : return ret; + 109 : 484 : return ret; 110 : : } 111 : : 112 : : /* return true if the new status bit is currently cleared, that is, this event @@ -195,12 +195,12 @@ 117 : : { 118 [ - + - - ]: 1386 : 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 [ + + + + ]: 1386 : if (msk->pm.status & BIT(new_status)) 121 : : return false; 122 : : - 123 [ - + ]: 1234 : msk->pm.status |= BIT(new_status); - 124 : 1234 : mptcp_schedule_work((struct sock *)msk); - 125 : 1234 : return true; + 123 [ - + ]: 1235 : msk->pm.status |= BIT(new_status); + 124 : 1235 : mptcp_schedule_work((struct sock *)msk); + 125 : 1235 : return true; 126 : : } 127 : : 128 : 2220 : void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) @@ -234,35 +234,35 @@ 156 : : { 157 [ - + ]: 3692 : pr_debug("msk=%p\n", msk); 158 : : - 159 [ + + ]: 3692 : if (msk->token) - 160 : 2284 : mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); + 159 [ + + ]: 3692 : if (msk->token) + 160 : 2295 : mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); 161 : 3692 : } 162 : : - 163 : 996 : void mptcp_pm_subflow_established(struct mptcp_sock *msk) + 163 : 998 : void mptcp_pm_subflow_established(struct mptcp_sock *msk) 164 : : { - 165 : 996 : struct mptcp_pm_data *pm = &msk->pm; + 165 : 998 : struct mptcp_pm_data *pm = &msk->pm; 166 : : - 167 [ - + ]: 996 : pr_debug("msk=%p\n", msk); + 167 [ - + ]: 998 : pr_debug("msk=%p\n", msk); 168 : : - 169 [ + + + + ]: 996 : if (!READ_ONCE(pm->work_pending)) + 169 [ + + + + ]: 998 : if (!READ_ONCE(pm->work_pending)) 170 : : return; 171 : : 172 : 263 : spin_lock_bh(&pm->lock); 173 : : - 174 [ + + + - ]: 263 : if (READ_ONCE(pm->work_pending)) + 174 [ + + + - ]: 263 : if (READ_ONCE(pm->work_pending)) 175 : 263 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 176 : : 177 : 263 : spin_unlock_bh(&pm->lock); 178 : : } 179 : : - 180 : 729 : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, + 180 : 754 : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, 181 : : const struct mptcp_subflow_context *subflow) 182 : : { - 183 : 729 : struct mptcp_pm_data *pm = &msk->pm; - 184 : 729 : bool update_subflows; + 183 : 754 : struct mptcp_pm_data *pm = &msk->pm; + 184 : 754 : bool update_subflows; 185 : : - 186 : 729 : update_subflows = subflow->request_join || subflow->mp_join; - 187 [ + + ]: 729 : if (mptcp_pm_is_userspace(msk)) { + 186 : 754 : update_subflows = subflow->request_join || subflow->mp_join; + 187 [ + + ]: 754 : if (mptcp_pm_is_userspace(msk)) { 188 [ + + ]: 52 : if (update_subflows) { 189 : 40 : spin_lock_bh(&pm->lock); 190 : 40 : pm->subflows--; @@ -271,21 +271,21 @@ 193 : 52 : return; 194 : : } 195 : : - 196 [ + + + + : 677 : if (!READ_ONCE(pm->work_pending) && !update_subflows) - + + ] + 196 [ + + + + : 702 : 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 : 291 : spin_lock_bh(&pm->lock); + 200 [ + - ]: 291 : if (update_subflows) + 201 : 291 : __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)) + 206 [ + + ]: 291 : if (mptcp_pm_nl_check_work_pending(msk)) 207 : 78 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 208 : : - 209 : 295 : spin_unlock_bh(&pm->lock); + 209 : 291 : 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 : 289 : pm->remote = *addr; + 238 [ + + ]: 296 : } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { + 239 : 290 : pm->remote = *addr; 240 : : } else { - 241 [ + - ]: 7 : __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); + 241 [ + - ]: 6 : __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); 242 : : } 243 : : 244 : 360 : spin_unlock_bh(&pm->lock); 245 : 360 : } 246 : : - 247 : 331 : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, + 247 : 332 : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, 248 : : const struct mptcp_addr_info *addr) 249 : : { - 250 : 331 : struct mptcp_pm_data *pm = &msk->pm; + 250 : 332 : struct mptcp_pm_data *pm = &msk->pm; 251 : : - 252 [ - + ]: 331 : pr_debug("msk=%p\n", msk); + 252 [ - + ]: 332 : pr_debug("msk=%p\n", msk); 253 : : - 254 : 331 : spin_lock_bh(&pm->lock); + 254 : 332 : spin_lock_bh(&pm->lock); 255 : : - 256 [ + + + + : 331 : if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) + 256 [ + + + + : 332 : if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) + + ] 257 : 85 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 258 : : - 259 : 331 : spin_unlock_bh(&pm->lock); - 260 : 331 : } + 259 : 332 : spin_unlock_bh(&pm->lock); + 260 : 332 : } 261 : : 262 : 122 : void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk) 263 : : { @@ -381,76 +381,76 @@ 300 : 40 : mptcp_event(MPTCP_EVENT_SUB_PRIORITY, msk, ssk, GFP_ATOMIC); 301 : 40 : } 302 : : - 303 : 6 : void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) + 303 : 5 : void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) 304 : : { - 305 [ - + ]: 6 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 306 [ - + ]: 6 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 305 [ - + ]: 5 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 306 [ - + ]: 5 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 307 : : - 308 [ - + ]: 6 : pr_debug("fail_seq=%llu\n", fail_seq); + 308 [ - + ]: 5 : pr_debug("fail_seq=%llu\n", fail_seq); 309 : : - 310 [ + + + + ]: 6 : if (!READ_ONCE(msk->allow_infinite_fallback)) + 310 [ + + + + ]: 5 : if (!READ_ONCE(msk->allow_infinite_fallback)) 311 : : return; 312 : : - 313 [ + + ]: 4 : if (!subflow->fail_tout) { + 313 [ + + ]: 3 : if (!subflow->fail_tout) { 314 [ - + ]: 2 : pr_debug("send MP_FAIL response and infinite map\n"); 315 : : 316 : 2 : subflow->send_mp_fail = 1; 317 : 2 : subflow->send_infinite_map = 1; 318 : 2 : tcp_send_ack(sk); 319 : : } else { - 320 [ - + ]: 2 : pr_debug("MP_FAIL response received\n"); - 321 : 2 : WRITE_ONCE(subflow->fail_tout, 0); + 320 [ - + ]: 1 : pr_debug("MP_FAIL response received\n"); + 321 : 1 : WRITE_ONCE(subflow->fail_tout, 0); 322 : : } 323 : : } 324 : : 325 : : /* path manager helpers */ 326 : : - 327 : 755 : bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb, + 327 : 756 : 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 : 755 : int ret = false; - 333 : 755 : u8 add_addr; - 334 : 755 : u8 family; - 335 : 755 : bool port; + 332 : 756 : int ret = false; + 333 : 756 : u8 add_addr; + 334 : 756 : u8 family; + 335 : 756 : bool port; 336 : : - 337 : 755 : spin_lock_bh(&msk->pm.lock); + 337 : 756 : spin_lock_bh(&msk->pm.lock); 338 : : 339 : : /* double check after the lock is acquired */ - 340 [ - + ]: 755 : if (!mptcp_pm_should_add_signal(msk)) + 340 [ - + ]: 756 : 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 [ + - + - ]: 755 : if (skb && skb_is_tcp_pure_ack(skb)) { - 348 : 755 : remaining += opt_size; - 349 : 755 : *drop_other_suboptions = true; + 347 [ + - + - ]: 756 : if (skb && skb_is_tcp_pure_ack(skb)) { + 348 : 756 : remaining += opt_size; + 349 : 756 : *drop_other_suboptions = true; 350 : : } 351 : : - 352 [ + + ]: 755 : *echo = mptcp_pm_should_add_signal_echo(msk); - 353 [ + + + + ]: 755 : port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); + 352 [ + + ]: 756 : *echo = mptcp_pm_should_add_signal_echo(msk); + 353 [ + + + + ]: 756 : port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); 354 : : - 355 [ + + + + ]: 755 : family = *echo ? msk->pm.remote.family : msk->pm.local.family; - 356 [ + + + + : 1510 : if (remaining < mptcp_add_addr_len(family, *echo, port)) + 355 [ + + + + ]: 756 : family = *echo ? msk->pm.remote.family : msk->pm.local.family; + 356 [ + + + + : 1512 : if (remaining < mptcp_add_addr_len(family, *echo, port)) - + ] 357 : 0 : goto out_unlock; 358 : : - 359 [ + + + + ]: 755 : if (*echo) { - 360 : 351 : *addr = msk->pm.remote; - 361 : 351 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); + 359 [ + + + + ]: 756 : if (*echo) { + 360 : 352 : *addr = msk->pm.remote; + 361 : 352 : 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 : 755 : WRITE_ONCE(msk->pm.addr_signal, add_addr); - 367 : 755 : ret = true; + 366 : 756 : WRITE_ONCE(msk->pm.addr_signal, add_addr); + 367 : 756 : ret = true; 368 : : - 369 : 755 : out_unlock: - 370 : 755 : spin_unlock_bh(&msk->pm.lock); - 371 : 755 : return ret; + 369 : 756 : out_unlock: + 370 : 756 : spin_unlock_bh(&msk->pm.lock); + 371 : 756 : 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 : 766 : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) + 404 : 768 : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) 405 : : { - 406 : 766 : struct mptcp_addr_info skc_local; - 407 : 766 : struct mptcp_addr_info msk_local; + 406 : 768 : struct mptcp_addr_info skc_local; + 407 : 768 : struct mptcp_addr_info msk_local; 408 : : - 409 [ - + ]: 766 : if (WARN_ON_ONCE(!msk)) + 409 [ - + ]: 768 : 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 : 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)) + 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)) 418 : : return 0; 419 : : - 420 [ + + ]: 384 : if (mptcp_pm_is_userspace(msk)) + 420 [ + + ]: 386 : if (mptcp_pm_is_userspace(msk)) 421 : 22 : return mptcp_userspace_pm_get_local_id(msk, &skc_local); - 422 : 362 : return mptcp_pm_nl_get_local_id(msk, &skc_local); + 422 : 364 : return mptcp_pm_nl_get_local_id(msk, &skc_local); 423 : : } 424 : : - 425 : 766 : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) + 425 : 768 : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) 426 : : { - 427 : 766 : struct mptcp_addr_info skc_local; + 427 : 768 : struct mptcp_addr_info skc_local; 428 : : - 429 : 766 : mptcp_local_address((struct sock_common *)skc, &skc_local); + 429 : 768 : mptcp_local_address((struct sock_common *)skc, &skc_local); 430 : : - 431 [ + + ]: 766 : if (mptcp_pm_is_userspace(msk)) + 431 [ + + ]: 768 : if (mptcp_pm_is_userspace(msk)) 432 : 26 : return mptcp_userspace_pm_is_backup(msk, &skc_local); 433 : : - 434 : 740 : return mptcp_pm_nl_is_backup(msk, &skc_local); + 434 : 742 : 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 : 674 : void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) + 552 : 543 : void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) 553 : : { - 554 [ - + ]: 674 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 555 [ - + ]: 674 : u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp); + 554 [ - + ]: 543 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 555 [ - + ]: 543 : u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp); 556 : : 557 : : /* keep track of rtx periods with no progress */ - 558 [ + + ]: 674 : if (!subflow->stale_count) { - 559 : 263 : subflow->stale_rcv_tstamp = rcv_tstamp; - 560 : 263 : subflow->stale_count++; - 561 [ + + ]: 411 : } else if (subflow->stale_rcv_tstamp == rcv_tstamp) { - 562 [ + - ]: 285 : if (subflow->stale_count < U8_MAX) - 563 : 285 : subflow->stale_count++; - 564 : 285 : mptcp_pm_nl_subflow_chk_stale(msk, ssk); + 558 [ + + ]: 543 : if (!subflow->stale_count) { + 559 : 257 : subflow->stale_rcv_tstamp = rcv_tstamp; + 560 : 257 : subflow->stale_count++; + 561 [ + + ]: 286 : } else if (subflow->stale_rcv_tstamp == rcv_tstamp) { + 562 [ + - ]: 187 : if (subflow->stale_count < U8_MAX) + 563 : 187 : subflow->stale_count++; + 564 : 187 : mptcp_pm_nl_subflow_chk_stale(msk, ssk); 565 : : } else { - 566 : 126 : subflow->stale_count = 0; - 567 : 126 : mptcp_subflow_set_active(subflow); + 566 : 99 : subflow->stale_count = 0; + 567 : 99 : mptcp_subflow_set_active(subflow); 568 : : } - 569 : 674 : } + 569 : 543 : } 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 : 663 : bool mptcp_pm_addr_families_match(const struct sock *sk, + 574 : 664 : 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 : 663 : bool mptcp_is_v4 = sk->sk_family == AF_INET; + 578 : 664 : bool mptcp_is_v4 = sk->sk_family == AF_INET; 579 : : 580 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 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); + 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); 583 : : - 584 [ + + ]: 663 : if (mptcp_is_v4) + 584 [ + + ]: 664 : if (mptcp_is_v4) 585 : 538 : return loc_is_v4 && rem_is_v4; 586 : : - 587 [ - + ]: 125 : if (ipv6_only_sock(sk)) + 587 [ - + ]: 126 : if (ipv6_only_sock(sk)) 588 : 0 : return !loc_is_v4 && !rem_is_v4; 589 : : - 590 : 125 : return loc_is_v4 == rem_is_v4; + 590 : 126 : 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 830e2efa..41c9be63 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 61.5 % + 61.4 % 1026 - 631 + 630 @@ -252,6 +252,13 @@ 188 + + + mptcp_pm_nl_subflow_chk_stale + + 188 + + mptcp_pm_nl_rm_addr_or_subflow @@ -284,28 +291,21 @@ fill_local_addresses_vec - 271 - - - - - mptcp_pm_nl_subflow_chk_stale - - 286 + 272 lookup_subflow_by_daddr - 289 + 290 mptcp_pm_nl_add_addr_received - 289 + 290 @@ -340,7 +340,7 @@ mptcp_pm_nl_get_local_id - 362 + 364 @@ -354,7 +354,7 @@ mptcp_nl_mcast_send - 430 + 434 @@ -368,7 +368,7 @@ mptcp_pm_del_add_timer - 461 + 462 @@ -396,7 +396,7 @@ mptcp_pm_nl_is_backup - 740 + 742 @@ -410,21 +410,21 @@ mptcp_pm_nl_addr_send_ack - 861 + 862 mptcp_pm_send_ack - 865 + 866 __mptcp_pm_send_ack - 887 + 888 @@ -438,7 +438,7 @@ mptcp_pm_nl_check_work_pending - 1086 + 1082 @@ -473,14 +473,14 @@ mptcp_lookup_anno_list_by_saddr - 1136 + 1138 __flush_addrs - 1194 + 1198 @@ -515,7 +515,7 @@ __lookup_addr - 1586 + 1590 @@ -536,84 +536,84 @@ mptcp_event_pm_listener - 2512 + 2516 mptcp_local_address - 3405 + 3412 mptcp_pm_free_anno_list - 3676 + 3680 mptcp_pm_get_add_addr_signal_max - 4353 + 4372 mptcp_pm_get_add_addr_accept_max - 4655 + 4674 mptcp_pm_get_local_addr_max - 4655 + 4674 mptcp_pm_get_subflows_max - 5526 + 5543 mptcp_event - 8142 + 8157 mptcp_addresses_equal - 8889 + 8930 mptcp_pm_nl_work - 9696 + 12823 pm_nl_get_pernet_from_msk - 13229 + 13243 pm_nl_get_pernet - 15956 + 16016 diff --git a/html/lcov/export/mptcp/pm_netlink.c.func.html b/html/lcov/export/mptcp/pm_netlink.c.func.html index 091e8ad1..8c32b513 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 61.5 % + 61.4 % 1026 - 631 + 630 @@ -81,14 +81,14 @@ __flush_addrs - 1194 + 1198 __lookup_addr - 1586 + 1590 @@ -116,14 +116,14 @@ __mptcp_pm_send_ack - 887 + 888 fill_local_addresses_vec - 271 + 272 @@ -144,21 +144,21 @@ lookup_subflow_by_daddr - 289 + 290 mptcp_addresses_equal - 8889 + 8930 mptcp_event - 8142 + 8157 @@ -193,7 +193,7 @@ mptcp_event_pm_listener - 2512 + 2516 @@ -214,14 +214,14 @@ mptcp_local_address - 3405 + 3412 mptcp_lookup_anno_list_by_saddr - 1136 + 1138 @@ -256,7 +256,7 @@ mptcp_nl_mcast_send - 430 + 434 @@ -305,7 +305,7 @@ mptcp_pm_del_add_timer - 461 + 462 @@ -319,35 +319,35 @@ mptcp_pm_free_anno_list - 3676 + 3680 mptcp_pm_get_add_addr_accept_max - 4655 + 4674 mptcp_pm_get_add_addr_signal_max - 4353 + 4372 mptcp_pm_get_local_addr_max - 4655 + 4674 mptcp_pm_get_subflows_max - 5526 + 5543 @@ -368,14 +368,14 @@ mptcp_pm_nl_add_addr_received - 289 + 290 mptcp_pm_nl_addr_send_ack - 861 + 862 @@ -389,7 +389,7 @@ mptcp_pm_nl_check_work_pending - 1086 + 1082 @@ -445,7 +445,7 @@ mptcp_pm_nl_get_local_id - 362 + 364 @@ -459,7 +459,7 @@ mptcp_pm_nl_is_backup - 740 + 742 @@ -501,14 +501,14 @@ mptcp_pm_nl_subflow_chk_stale - 286 + 188 mptcp_pm_nl_work - 9696 + 12823 @@ -543,7 +543,7 @@ mptcp_pm_send_ack - 865 + 866 @@ -585,14 +585,14 @@ pm_nl_get_pernet - 15956 + 16016 pm_nl_get_pernet_from_msk - 13229 + 13243 diff --git a/html/lcov/export/mptcp/pm_netlink.c.gcov.html b/html/lcov/export/mptcp/pm_netlink.c.gcov.html index 4655cdeb..9fb7080b 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 61.5 % + 61.4 % 1026 - 631 + 630 @@ -121,67 +121,67 @@ 43 : : #define MPTCP_PM_ADDR_MAX 8 44 : : #define ADD_ADDR_RETRANS_MAX 3 45 : : - 46 : 15956 : static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) + 46 : 16016 : static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) 47 : : { - 48 : 29779 : return net_generic(net, pm_nl_pernet_id); + 48 : 29853 : return net_generic(net, pm_nl_pernet_id); 49 : : } 50 : : 51 : : static struct pm_nl_pernet * - 52 : 13229 : pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) + 52 : 13243 : pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) 53 : : { - 54 : 25421 : return pm_nl_get_pernet(sock_net((struct sock *)msk)); + 54 : 25491 : return pm_nl_get_pernet(sock_net((struct sock *)msk)); 55 : : } 56 : : - 57 : 8889 : bool mptcp_addresses_equal(const struct mptcp_addr_info *a, + 57 : 8930 : bool mptcp_addresses_equal(const struct mptcp_addr_info *a, 58 : : const struct mptcp_addr_info *b, bool use_port) 59 : : { - 60 : 8889 : bool addr_equals = false; + 60 : 8930 : bool addr_equals = false; 61 : : - 62 [ + + ]: 8889 : if (a->family == b->family) { - 63 [ + + ]: 7507 : if (a->family == AF_INET) - 64 : 6500 : addr_equals = a->addr.s_addr == b->addr.s_addr; + 62 [ + + ]: 8930 : if (a->family == b->family) { + 63 [ + + ]: 7531 : 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 : 1007 : addr_equals = ipv6_addr_equal(&a->addr6, &b->addr6); - 68 [ + + ]: 1382 : } else if (a->family == AF_INET) { - 69 [ + + ]: 976 : if (ipv6_addr_v4mapped(&b->addr6)) - 70 : 680 : 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 : 1029 : addr_equals = ipv6_addr_equal(&a->addr6, &b->addr6); + 68 [ + + ]: 1399 : } else if (a->family == AF_INET) { + 69 [ + + ]: 994 : if (ipv6_addr_v4mapped(&b->addr6)) + 70 : 678 : addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3]; + 71 [ + - ]: 405 : } else if (b->family == AF_INET) { + 72 [ + + ]: 405 : if (ipv6_addr_v4mapped(&a->addr6)) 73 : 182 : addr_equals = a->addr6.s6_addr32[3] == b->addr.s_addr; 74 : : #endif 75 : : } 76 : : - 77 [ + + ]: 8369 : if (!addr_equals) + 77 [ + + ]: 8391 : if (!addr_equals) 78 : : return false; - 79 [ + + ]: 2004 : if (!use_port) + 79 [ + + ]: 2010 : if (!use_port) 80 : : return true; 81 : : - 82 : 836 : return a->port == b->port; + 82 : 838 : return a->port == b->port; 83 : : } 84 : : - 85 : 3405 : void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) + 85 : 3412 : void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) 86 : : { - 87 : 3405 : addr->family = skc->skc_family; - 88 : 3405 : addr->port = htons(skc->skc_num); - 89 [ + + ]: 3405 : if (addr->family == AF_INET) - 90 : 1656 : addr->addr.s_addr = skc->skc_rcv_saddr; + 87 : 3412 : addr->family = skc->skc_family; + 88 : 3412 : addr->port = htons(skc->skc_num); + 89 [ + + ]: 3412 : if (addr->family == AF_INET) + 90 : 1658 : addr->addr.s_addr = skc->skc_rcv_saddr; 91 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 92 [ + - ]: 1749 : else if (addr->family == AF_INET6) - 93 : 1749 : addr->addr6 = skc->skc_v6_rcv_saddr; + 92 [ + - ]: 1754 : else if (addr->family == AF_INET6) + 93 : 1754 : addr->addr6 = skc->skc_v6_rcv_saddr; 94 : : #endif - 95 : 3405 : } + 95 : 3412 : } 96 : : 97 : 0 : static void remote_address(const struct sock_common *skc, 98 : : struct mptcp_addr_info *addr) 99 : : { - 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; + 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; 104 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 105 [ - - - - : 191 : else if (addr->family == AF_INET6) - + - + - + + 105 [ - - - - : 194 : 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 : 289 : static bool lookup_subflow_by_daddr(const struct list_head *list, + 128 : 290 : static bool lookup_subflow_by_daddr(const struct list_head *list, 129 : : const struct mptcp_addr_info *daddr) 130 : : { - 131 : 289 : struct mptcp_subflow_context *subflow; - 132 : 289 : struct mptcp_addr_info cur; + 131 : 290 : struct mptcp_subflow_context *subflow; + 132 : 290 : struct mptcp_addr_info cur; 133 : : - 134 [ + + ]: 766 : list_for_each_entry(subflow, list, node) { - 135 : 495 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 134 [ + + ]: 774 : list_for_each_entry(subflow, list, node) { + 135 : 502 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 136 : : - 137 [ + + + + ]: 495 : if (!((1 << inet_sk_state_load(ssk)) & + 137 [ + + + + ]: 502 : if (!((1 << inet_sk_state_load(ssk)) & 138 : : (TCPF_ESTABLISHED | TCPF_SYN_SENT | TCPF_SYN_RECV))) 139 : 4 : continue; 140 : : - 141 [ + + ]: 491 : remote_address((struct sock_common *)ssk, &cur); - 142 [ + + ]: 491 : if (mptcp_addresses_equal(&cur, daddr, daddr->port)) + 141 [ + + ]: 498 : remote_address((struct sock_common *)ssk, &cur); + 142 [ + + ]: 498 : if (mptcp_addresses_equal(&cur, daddr, daddr->port)) 143 : : return true; 144 : : } 145 : : @@ -294,61 +294,61 @@ 206 : 310 : return found; 207 : : } 208 : : - 209 : 4503 : unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) + 209 : 4522 : unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) 210 : : { - 211 : 4353 : const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 211 : 4372 : const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 212 : : - 213 : 5144 : return READ_ONCE(pernet->add_addr_signal_max); + 213 : 5163 : return READ_ONCE(pernet->add_addr_signal_max); 214 : : } 215 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_signal_max); 216 : : - 217 : 4434 : unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) + 217 : 4452 : unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) 218 : : { - 219 : 4434 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 219 : 4452 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 220 : : - 221 : 4767 : return READ_ONCE(pernet->add_addr_accept_max); + 221 : 4786 : return READ_ONCE(pernet->add_addr_accept_max); 222 : : } 223 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_accept_max); 224 : : - 225 : 5161 : unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) + 225 : 5177 : unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) 226 : : { - 227 : 5161 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 227 : 5177 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 228 : : - 229 : 7504 : return READ_ONCE(pernet->subflows_max); + 229 : 7518 : return READ_ONCE(pernet->subflows_max); 230 : : } 231 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_subflows_max); 232 : : - 233 : 4805 : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) + 233 : 4824 : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) 234 : : { - 235 : 4655 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 235 : 4674 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 236 : : - 237 : 5446 : return READ_ONCE(pernet->local_addr_max); + 237 : 5465 : 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 : 1082 : 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 : 1082 : 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 [ + + + + ]: 1800 : if (msk->pm.subflows == mptcp_pm_get_subflows_max(msk) || + 246 [ + - ]: 892 : (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 : 841 : WRITE_ONCE(msk->pm.work_pending, false); + 249 : 841 : return false; 250 : : } 251 : : return true; 252 : : } 253 : : 254 : : struct mptcp_pm_add_entry * - 255 : 1136 : mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, + 255 : 1138 : mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, 256 : : const struct mptcp_addr_info *addr) 257 : : { - 258 : 1136 : struct mptcp_pm_add_entry *entry; + 258 : 1138 : struct mptcp_pm_add_entry *entry; 259 : : - 260 [ + - - + ]: 1136 : lockdep_assert_held(&msk->pm.lock); + 260 [ + - - + ]: 1138 : 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 : 461 : mptcp_pm_del_add_timer(struct mptcp_sock *msk, + 336 : 462 : mptcp_pm_del_add_timer(struct mptcp_sock *msk, 337 : : const struct mptcp_addr_info *addr, bool check_id) 338 : : { - 339 : 461 : struct mptcp_pm_add_entry *entry; - 340 : 461 : struct sock *sk = (struct sock *)msk; - 341 : 461 : struct timer_list *add_timer = NULL; + 339 : 462 : struct mptcp_pm_add_entry *entry; + 340 : 462 : struct sock *sk = (struct sock *)msk; + 341 : 462 : struct timer_list *add_timer = NULL; 342 : : - 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; + 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; 348 : : } - 349 [ + + ]: 461 : if (!check_id && entry) + 349 [ + + ]: 462 : if (!check_id && entry) 350 : 78 : list_del(&entry->list); - 351 : 461 : spin_unlock_bh(&msk->pm.lock); + 351 : 462 : spin_unlock_bh(&msk->pm.lock); 352 : : 353 : : /* no lock, because sk_stop_timer_sync() is calling del_timer_sync() */ - 354 [ + + ]: 461 : if (add_timer) - 355 : 393 : sk_stop_timer_sync(sk, add_timer); + 354 [ + + ]: 462 : if (add_timer) + 355 : 394 : sk_stop_timer_sync(sk, add_timer); 356 : : - 357 : 461 : return entry; + 357 : 462 : return entry; 358 : : } 359 : : 360 : 344 : bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, @@ -483,23 +483,23 @@ 394 : 344 : return true; 395 : : } 396 : : - 397 : 3676 : void mptcp_pm_free_anno_list(struct mptcp_sock *msk) + 397 : 3680 : void mptcp_pm_free_anno_list(struct mptcp_sock *msk) 398 : : { - 399 : 3676 : struct mptcp_pm_add_entry *entry, *tmp; - 400 : 3676 : struct sock *sk = (struct sock *)msk; - 401 : 3676 : LIST_HEAD(free_list); + 399 : 3680 : struct mptcp_pm_add_entry *entry, *tmp; + 400 : 3680 : struct sock *sk = (struct sock *)msk; + 401 : 3680 : LIST_HEAD(free_list); 402 : : - 403 [ - + ]: 3676 : pr_debug("msk=%p\n", msk); + 403 [ - + ]: 3680 : pr_debug("msk=%p\n", msk); 404 : : - 405 : 3676 : spin_lock_bh(&msk->pm.lock); - 406 [ + + ]: 3676 : list_splice_init(&msk->pm.anno_list, &free_list); - 407 : 3676 : spin_unlock_bh(&msk->pm.lock); + 405 : 3680 : spin_lock_bh(&msk->pm.lock); + 406 [ + + ]: 3680 : list_splice_init(&msk->pm.anno_list, &free_list); + 407 : 3680 : spin_unlock_bh(&msk->pm.lock); 408 : : - 409 [ + + ]: 3942 : list_for_each_entry_safe(entry, tmp, &free_list, list) { + 409 [ + + ]: 3946 : list_for_each_entry_safe(entry, tmp, &free_list, list) { 410 : 266 : sk_stop_timer_sync(sk, &entry->add_timer); 411 : 266 : kfree(entry); 412 : : } - 413 : 3676 : } + 413 : 3680 : } 414 : : 415 : : /* Fill all the remote addresses into the array addrs[], 416 : : * and return the array size. @@ -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 : 1586 : __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) + 524 : 1590 : __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) 525 : : { - 526 : 1586 : struct mptcp_pm_addr_entry *entry; + 526 : 1590 : struct mptcp_pm_addr_entry *entry; 527 : : - 528 [ + + + + : 3100 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list, + 528 [ + + + + : 3132 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list, - + - - - - - - + + ] 529 : : lockdep_is_held(&pernet->lock)) { - 530 [ + + ]: 2144 : if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) + 530 [ + + ]: 2176 : 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 : 271 : static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + 663 : 272 : 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 : 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; + 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; 673 : : - 674 : 271 : pernet = pm_nl_get_pernet_from_msk(msk); - 675 : 271 : subflows_max = mptcp_pm_get_subflows_max(msk); + 674 : 272 : pernet = pm_nl_get_pernet_from_msk(msk); + 675 : 272 : subflows_max = mptcp_pm_get_subflows_max(msk); 676 : : - 677 : 271 : mptcp_local_address((struct sock_common *)msk, &mpc_addr); + 677 : 272 : mptcp_local_address((struct sock_common *)msk, &mpc_addr); 678 : : - 679 : 271 : rcu_read_lock(); - 680 [ + + - + : 777 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { + 679 : 272 : rcu_read_lock(); + 680 [ + + - + : 786 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { - - - - - - + + ] - 681 [ + + ]: 506 : if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) - 682 : 498 : continue; + 681 [ + + ]: 514 : if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) + 682 : 506 : 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 : 271 : rcu_read_unlock(); + 700 : 272 : rcu_read_unlock(); 701 : : 702 : : /* If the array is empty, fill in the single 703 : : * 'IPADDRANY' local address 704 : : */ - 705 [ + + ]: 271 : if (!i) { - 706 : 267 : memset(&locals[i], 0, sizeof(locals[i])); - 707 : 534 : locals[i].addr.family = + 705 [ + + ]: 272 : if (!i) { + 706 : 268 : memset(&locals[i], 0, sizeof(locals[i])); + 707 : 536 : locals[i].addr.family = 708 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 709 [ + + + + ]: 267 : remote->family == AF_INET6 && + 709 [ + + + + ]: 268 : remote->family == AF_INET6 && 710 [ # # ]: 0 : ipv6_addr_v4mapped(&remote->addr6) ? AF_INET : 711 : : #endif 712 : : remote->family; 713 : : - 714 [ + + ]: 267 : if (!mptcp_pm_addr_families_match(sk, &locals[i].addr, remote)) + 714 [ + + ]: 268 : if (!mptcp_pm_addr_families_match(sk, &locals[i].addr, remote)) 715 : : return 0; 716 : : - 717 : 245 : msk->pm.subflows++; - 718 : 245 : i++; + 717 : 246 : msk->pm.subflows++; + 718 : 246 : i++; 719 : : } 720 : : - 721 : 249 : return i; + 721 : 250 : return i; 722 : : } 723 : : - 724 : 289 : static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) + 724 : 290 : static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) 725 : : { - 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; + 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; 733 : : - 734 : 289 : add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); - 735 : 289 : subflows_max = mptcp_pm_get_subflows_max(msk); + 734 : 290 : add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); + 735 : 290 : subflows_max = mptcp_pm_get_subflows_max(msk); 736 : : - 737 [ - + ]: 289 : pr_debug("accepted %d:%d remote family %d\n", + 737 [ - + ]: 290 : 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 : 289 : remote = msk->pm.remote; - 742 : 289 : mptcp_pm_announce_addr(msk, &remote, true); - 743 : 289 : mptcp_pm_nl_addr_send_ack(msk); + 741 : 290 : remote = msk->pm.remote; + 742 : 290 : mptcp_pm_announce_addr(msk, &remote, true); + 743 : 290 : mptcp_pm_nl_addr_send_ack(msk); 744 : : - 745 [ + + ]: 289 : if (lookup_subflow_by_daddr(&msk->conn_list, &remote)) + 745 [ + + ]: 290 : 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 [ + + ]: 271 : if (!remote.port) - 750 : 239 : remote.port = sk->sk_dport; + 749 [ + + ]: 272 : if (!remote.port) + 750 : 240 : 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 : 271 : nr = fill_local_addresses_vec(msk, &remote, locals); - 756 [ + + ]: 271 : if (nr == 0) + 755 : 272 : nr = fill_local_addresses_vec(msk, &remote, locals); + 756 [ + + ]: 272 : if (nr == 0) 757 : : return; 758 : : - 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); + 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); 764 : : - 765 [ + + ]: 249 : if (sf_created) { + 765 [ + + ]: 250 : if (sf_created) { 766 : : /* add_addr_accepted is not decr for ID 0 */ - 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); + 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); 772 : : } 773 : : } 774 : : @@ -884,22 +884,22 @@ 781 : 4 : return mptcp_addresses_equal(&mpc_remote, remote, remote->port); 782 : : } 783 : : - 784 : 861 : void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) + 784 : 862 : void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) 785 : : { - 786 : 861 : struct mptcp_subflow_context *subflow, *alt = NULL; + 786 : 862 : struct mptcp_subflow_context *subflow, *alt = NULL; 787 : : - 788 : 861 : msk_owned_by_me(msk); - 789 [ + - - + ]: 861 : lockdep_assert_held(&msk->pm.lock); + 788 : 862 : msk_owned_by_me(msk); + 789 [ + - - + ]: 862 : lockdep_assert_held(&msk->pm.lock); 790 : : - 791 [ + + + + ]: 861 : if (!mptcp_pm_should_add_signal(msk) && + 791 [ + + + + ]: 862 : 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 : 9696 : void mptcp_pm_nl_work(struct mptcp_sock *msk) + 927 : 12823 : void mptcp_pm_nl_work(struct mptcp_sock *msk) 928 : : { - 929 : 9696 : struct mptcp_pm_data *pm = &msk->pm; + 929 : 12823 : struct mptcp_pm_data *pm = &msk->pm; 930 : : - 931 : 9696 : msk_owned_by_me(msk); + 931 : 12823 : msk_owned_by_me(msk); 932 : : - 933 [ + + ]: 9696 : if (!(pm->status & MPTCP_PM_WORK_MASK)) + 933 [ + + ]: 12823 : 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 : 289 : pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED); - 941 : 289 : mptcp_pm_nl_add_addr_received(msk); + 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); 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 : 362 : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) + 1142 : 364 : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) 1143 : : { - 1144 : 362 : struct mptcp_pm_addr_entry *entry; - 1145 : 362 : struct pm_nl_pernet *pernet; - 1146 : 362 : int ret; + 1144 : 364 : struct mptcp_pm_addr_entry *entry; + 1145 : 364 : struct pm_nl_pernet *pernet; + 1146 : 364 : int ret; 1147 : : - 1148 : 362 : pernet = pm_nl_get_pernet_from_msk(msk); + 1148 : 364 : pernet = pm_nl_get_pernet_from_msk(msk); 1149 : : - 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; + 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; 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 : 740 : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) + 1175 : 742 : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) 1176 : : { - 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; + 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; 1180 : : - 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(); + 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(); 1185 : : - 1186 : 740 : return backup; + 1186 : 742 : return backup; 1187 : : } 1188 : : 1189 : : #define MPTCP_PM_CMD_GRP_OFFSET 0 @@ -1302,40 +1302,40 @@ 1196 : : }, 1197 : : }; 1198 : : - 1199 : 286 : void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) + 1199 : 188 : void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) 1200 : : { - 1201 : 286 : struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk); - 1202 : 286 : struct sock *sk = (struct sock *)msk; - 1203 : 286 : unsigned int active_max_loss_cnt; - 1204 : 286 : struct net *net = sock_net(sk); - 1205 : 286 : unsigned int stale_loss_cnt; - 1206 : 286 : bool slow; + 1201 : 188 : struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk); + 1202 : 188 : struct sock *sk = (struct sock *)msk; + 1203 : 188 : unsigned int active_max_loss_cnt; + 1204 : 188 : struct net *net = sock_net(sk); + 1205 : 188 : unsigned int stale_loss_cnt; + 1206 : 188 : bool slow; 1207 : : - 1208 : 286 : stale_loss_cnt = mptcp_stale_loss_cnt(net); - 1209 [ + + + - : 286 : if (subflow->stale || !stale_loss_cnt || subflow->stale_count <= stale_loss_cnt) - + + ] + 1208 : 188 : stale_loss_cnt = mptcp_stale_loss_cnt(net); + 1209 [ + + + - : 188 : 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 : 169 : active_max_loss_cnt = max_t(int, stale_loss_cnt - 1, 1); - 1214 [ + + ]: 366 : mptcp_for_each_subflow(msk, iter) { - 1215 [ + + + + ]: 214 : if (iter != subflow && mptcp_subflow_active(iter) && - 1216 [ + + ]: 22 : iter->stale_count < active_max_loss_cnt) { + 1213 : 100 : active_max_loss_cnt = max_t(int, stale_loss_cnt - 1, 1); + 1214 [ + + ]: 205 : mptcp_for_each_subflow(msk, iter) { + 1215 [ + + + + ]: 119 : if (iter != subflow && mptcp_subflow_active(iter) && + 1216 [ + + ]: 18 : 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 : 14 : slow = lock_sock_fast(ssk); + 1219 [ - + ]: 14 : if (!tcp_rtx_and_write_queues_empty(ssk)) { + 1220 : 14 : subflow->stale = 1; + 1221 : 14 : __mptcp_retransmit_pending_data(sk); + 1222 [ + - ]: 14 : MPTCP_INC_STATS(net, MPTCP_MIB_SUBFLOWSTALE); 1223 : : } - 1224 : 17 : unlock_sock_fast(ssk, slow); + 1224 : 14 : 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 : 14 : __mptcp_push_pending(sk, 0); + 1231 : 14 : return; 1232 : : } 1233 : : } 1234 : : } @@ -1810,9 +1810,9 @@ 1697 : : } 1698 : : 1699 : : /* caller must ensure the RCU grace period is already elapsed */ - 1700 : 1194 : static void __flush_addrs(struct list_head *list) + 1700 : 1198 : static void __flush_addrs(struct list_head *list) 1701 : : { - 1702 [ + + ]: 1876 : while (!list_empty(list)) { + 1702 [ + + ]: 1880 : while (!list_empty(list)) { 1703 : 682 : struct mptcp_pm_addr_entry *cur; 1704 : : 1705 : 682 : cur = list_entry(list->next, @@ -1820,7 +1820,7 @@ 1707 : 682 : list_del_rcu(&cur->list); 1708 : 682 : __mptcp_pm_release_addr_entry(cur); 1709 : : } - 1710 : 1194 : } + 1710 : 1198 : } 1711 : : 1712 : 6 : static void __reset_counters(struct pm_nl_pernet *pernet) 1713 : : { @@ -2108,11 +2108,11 @@ 1992 : 46 : return 0; 1993 : : } 1994 : : - 1995 : 430 : static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp) + 1995 : 434 : static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp) 1996 : : { - 1997 : 430 : genlmsg_multicast_netns(&mptcp_genl_family, net, + 1997 : 434 : genlmsg_multicast_netns(&mptcp_genl_family, net, 1998 : : nlskb, 0, MPTCP_PM_EV_GRP_OFFSET, gfp); - 1999 : 430 : } + 1999 : 434 : } 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 : 150 : case AF_INET: - 2018 [ - + ]: 150 : 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 [ - + ]: 150 : 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 : 118 : case AF_INET6: { - 2025 [ - + ]: 118 : 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 [ - + ]: 118 : 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 : 2512 : void mptcp_event_pm_listener(const struct sock *ssk, + 2220 : 2516 : void mptcp_event_pm_listener(const struct sock *ssk, 2221 : : enum mptcp_event_type event) 2222 : : { - 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; + 2223 : 2516 : const struct inet_sock *issk = inet_sk(ssk); + 2224 : 2516 : struct net *net = sock_net(ssk); + 2225 : 2516 : struct nlmsghdr *nlh; + 2226 : 2516 : struct sk_buff *skb; 2227 : : - 2228 [ + + ]: 2512 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) + 2228 [ + + ]: 2516 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) 2229 : : return; 2230 : : - 2231 : 54 : skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - 2232 [ + - ]: 54 : if (!skb) + 2231 : 58 : skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); + 2232 [ + - ]: 58 : if (!skb) 2233 : : return; 2234 : : - 2235 : 54 : nlh = genlmsg_put(skb, 0, 0, &mptcp_genl_family, 0, event); - 2236 [ - + ]: 54 : if (!nlh) + 2235 : 58 : nlh = genlmsg_put(skb, 0, 0, &mptcp_genl_family, 0, event); + 2236 [ - + ]: 58 : if (!nlh) 2237 : 0 : goto nla_put_failure; 2238 : : - 2239 [ - + ]: 54 : if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) + 2239 [ - + ]: 58 : if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) 2240 : 0 : goto nla_put_failure; 2241 : : - 2242 [ - + ]: 54 : if (nla_put_be16(skb, MPTCP_ATTR_SPORT, issk->inet_sport)) + 2242 [ - + ]: 58 : if (nla_put_be16(skb, MPTCP_ATTR_SPORT, issk->inet_sport)) 2243 : 0 : goto nla_put_failure; 2244 : : - 2245 [ + + - ]: 54 : switch (ssk->sk_family) { - 2246 : 28 : case AF_INET: - 2247 [ - + ]: 28 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) + 2245 [ + + - ]: 58 : switch (ssk->sk_family) { + 2246 : 30 : case AF_INET: + 2247 [ - + ]: 30 : 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 : 26 : case AF_INET6: { - 2252 [ - + ]: 26 : 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 : 54 : genlmsg_end(skb, nlh); - 2263 : 54 : mptcp_nl_mcast_send(net, skb, GFP_KERNEL); - 2264 : 54 : return; + 2262 : 58 : genlmsg_end(skb, nlh); + 2263 : 58 : mptcp_nl_mcast_send(net, skb, GFP_KERNEL); + 2264 : 58 : return; 2265 : : 2266 : 0 : nla_put_failure: 2267 : 0 : nlmsg_free(skb); 2268 : : } 2269 : : - 2270 : 8142 : 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 : 8142 : struct net *net = sock_net((const struct sock *)msk); - 2274 : 8142 : struct nlmsghdr *nlh; - 2275 : 8142 : 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 [ + + ]: 8142 : 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); @@ -2478,14 +2478,14 @@ 2360 : : { 2361 : 935 : struct net *net; 2362 : : - 2363 [ + + ]: 1951 : list_for_each_entry(net, net_list, exit_list) { - 2364 : 1016 : struct pm_nl_pernet *pernet = pm_nl_get_pernet(net); + 2363 [ + + ]: 1955 : list_for_each_entry(net, net_list, exit_list) { + 2364 : 1020 : struct pm_nl_pernet *pernet = pm_nl_get_pernet(net); 2365 : : 2366 : : /* net is removed from namespace list, can't race with 2367 : : * other modifiers, also netns core already waited for a 2368 : : * RCU grace period. 2369 : : */ - 2370 : 1016 : __flush_addrs(&pernet->local_addr_list); + 2370 : 1020 : __flush_addrs(&pernet->local_addr_list); 2371 : : } 2372 : 935 : } 2373 : : 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 9a024546..5fa603a1 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -193,7 +193,7 @@ mptcp_free_local_addr_list - 3676 + 3680 diff --git a/html/lcov/export/mptcp/pm_userspace.c.func.html b/html/lcov/export/mptcp/pm_userspace.c.func.html index 7ac5bc91..758e77c5 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -81,7 +81,7 @@ mptcp_free_local_addr_list - 3676 + 3680 diff --git a/html/lcov/export/mptcp/pm_userspace.c.gcov.html b/html/lcov/export/mptcp/pm_userspace.c.gcov.html index 384d02a4..ddf7c93d 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -90,14 +90,14 @@ 12 : : list_for_each_entry(__entry, \ 13 : : &((__msk)->pm.userspace_pm_local_addr_list), list) 14 : : - 15 : 3676 : void mptcp_free_local_addr_list(struct mptcp_sock *msk) + 15 : 3680 : void mptcp_free_local_addr_list(struct mptcp_sock *msk) 16 : : { - 17 : 3676 : struct mptcp_pm_addr_entry *entry, *tmp; - 18 : 3676 : struct sock *sk = (struct sock *)msk; - 19 : 3676 : LIST_HEAD(free_list); + 17 : 3680 : struct mptcp_pm_addr_entry *entry, *tmp; + 18 : 3680 : struct sock *sk = (struct sock *)msk; + 19 : 3680 : LIST_HEAD(free_list); 20 : : - 21 [ + + ]: 3676 : if (!mptcp_pm_is_userspace(msk)) - 22 : 3612 : return; + 21 [ + + ]: 3680 : if (!mptcp_pm_is_userspace(msk)) + 22 : 3616 : return; 23 : : 24 : 64 : spin_lock_bh(&msk->pm.lock); 25 [ + + ]: 64 : list_splice_init(&msk->pm.userspace_pm_local_addr_list, &free_list); diff --git a/html/lcov/export/mptcp/protocol.c.func-c.html b/html/lcov/export/mptcp/protocol.c.func-c.html index 6bb61ddb..16c9afa0 100644 --- a/html/lcov/export/mptcp/protocol.c.func-c.html +++ b/html/lcov/export/mptcp/protocol.c.func-c.html @@ -33,11 +33,11 @@ Lines: 91.1 % 2158 - 1966 + 1967 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 95.5 % @@ -123,7 +123,7 @@ mptcp_update_infinite_map - 2 + 1 @@ -165,7 +165,7 @@ __mptcp_flush_join_list - 33 + 31 @@ -198,23 +198,23 @@ - mptcp_tout_timer + mptcp_subflow_set_active - 114 + 99 - mptcp_subflow_set_active + mptcp_tout_timer - 126 + 118 mptcp_do_fastclose - 366 + 397 @@ -235,21 +235,21 @@ schedule_3rdack_retransmission - 499 + 500 __mptcp_finish_join - 505 + 506 __mptcp_close_subflow - 567 + 590 @@ -263,56 +263,56 @@ __mptcp_retransmit_pending_data - 746 + 768 mptcp_close_ssk - 767 + 791 - __mptcp_subflow_disconnect + __mptcp_error_report - 782 + 819 - __mptcp_error_report + mptcp_update_data_checksum - 818 + 819 - mptcp_update_data_checksum + __mptcp_subflow_disconnect - 868 + 842 mptcp_finish_join - 992 + 994 mptcp_subflow_joined - 992 + 994 mptcp_reset_tout_timer - 1065 + 1053 @@ -326,7 +326,7 @@ mptcp_set_datafin_timeout - 1150 + 1139 @@ -347,7 +347,7 @@ mptcp_listen - 1242 + 1244 @@ -368,21 +368,21 @@ mptcp_shutdown - 1459 + 1516 - mptcp_subflow_get_retrans + __mptcp_wr_shutdown - 1767 + 2156 - __mptcp_wr_shutdown + mptcp_subflow_get_retrans - 2143 + 2260 @@ -396,7 +396,7 @@ mptcp_check_listen_stop - 2399 + 2379 @@ -415,51 +415,51 @@ - mptcp_close_state + mptcp_ca_reset - 2542 + 2588 - mptcp_ca_reset + mptcp_close_state - 2588 + 2592 mptcp_cancel_work - 2646 + 2660 mptcp_send_ack - 2831 + 2794 mptcp_subflow_shutdown - 2997 + 3015 __mptcp_destroy_sock - 3614 + 3618 mptcp_destroy - 3618 + 3622 @@ -480,14 +480,14 @@ __mptcp_clear_xmit - 3676 + 3680 mptcp_destroy_common - 3676 + 3680 @@ -501,511 +501,511 @@ mptcp_subflow_send_ack - 3797 + 3721 mptcp_close_wake_up - 4377 + 4379 - mptcp_sock_graft + __mptcp_subflow_send_ack - 4653 + 4609 - __mptcp_subflow_send_ack + mptcp_sock_graft - 4684 + 4654 mptcp_copy_inaddrs - 4928 + 4932 __mptcp_close_ssk - 5409 + 5478 __mptcp_subflow_error_report - 5551 + 5506 - mptcp_check_and_set_pending + __mptcp_nmpc_sk - 6755 + 7160 - __mptcp_nmpc_sk + mptcp_check_and_set_pending - 7158 + 9635 __mptcp_retrans - 7511 + 10458 mptcp_clean_una_wakeup - 7511 + 10458 mptcp_retransmit_timer - 7845 + 10767 mptcp_check_data_fin_ack - 9694 + 12822 mptcp_check_fastclose - 9694 + 12822 mptcp_close_tout_expired - 9694 + 12822 mptcp_worker - 9808 + 12938 mptcp_schedule_work - 11281 + 14503 mptcp_set_state - 16865 + 17031 - mptcp_stop_rtx_timer + __mptcp_clean_una_wakeup - 21690 + 31419 - mptcp_subflow_process_delegated + mptcp_stop_rtx_timer - 28545 + 32002 - __mptcp_clean_una_wakeup + mptcp_subflow_process_delegated - 33175 + 32423 mptcp_napi_poll - 39070 + 41486 mptcp_wnd_end - 50690 + 54992 mptcp_check_data_fin - 50786 + 60573 __mptcp_subflow_push_pending - 67998 + 104049 - mptcp_data_queue_ofo + tcp_can_send_ack - 103296 + 113704 - tcp_can_send_ack + mptcp_data_queue_ofo - 105838 + 118644 __mptcp_first_ready_from - 169634 + 163529 mptcp_subflow_cleanup_rbuf - 173647 + 211665 - mptcp_reset_rtx_timer + __mptcp_move_skbs - 182280 + 247543 - __mptcp_clean_una + mptcp_reset_rtx_timer - 182530 + 260339 - __mptcp_data_acked + __mptcp_clean_una - 191249 + 261257 - mptcp_pending_data_fin_ack + __mptcp_add_ext - 192224 + 263104 - __mptcp_add_ext + __mptcp_alloc_tx_skb - 206284 + 263104 - __mptcp_alloc_tx_skb + __mptcp_do_alloc_tx_skb - 206284 + 263104 - __mptcp_do_alloc_tx_skb + mptcp_pending_data_fin_ack - 206284 + 274079 - __mptcp_move_skbs + __mptcp_data_acked - 218246 + 275593 mptcp_set_timeout - 253124 + 311066 mptcp_check_writeable - 265914 + 352897 - mptcp_try_coalesce + mptcp_check_send_data_fin - 293156 + 397645 mptcp_subflow_get_send - 314646 + 450240 - mptcp_check_send_data_fin + mptcp_try_coalesce - 343329 + 462586 - __mptcp_data_ready + dfrag_clear - 345334 + 467006 - move_skbs_to_msk + mptcp_carve_data_frag - 345334 + 467012 - dfrag_clear + mptcp_page_frag_refill - 395409 + 467012 - mptcp_carve_data_frag + mptcp_push_release - 395415 + 509350 - mptcp_page_frag_refill + mptcp_sendmsg - 395415 + 521353 - mptcp_pending_data_fin + __mptcp_data_ready - 396120 + 528891 - __mptcp_move_skbs_from_subflow + move_skbs_to_msk - 399906 + 528891 - __mptcp_move_skb + mptcp_update_post_push - 416178 + 542578 - mptcp_data_ready + __mptcp_push_pending - 427199 + 542806 mptcp_skb_can_collapse_to - 434118 + 561746 - mptcp_update_post_push + mptcp_pending_data_fin - 435272 + 589464 - mptcp_sendmsg + __mptcp_move_skbs_from_subflow - 442977 + 590666 - mptcp_push_release + do_copy_data_nocache - 445325 + 610594 - __mptcp_push_pending + mptcp_frag_can_collapse_to - 461014 + 610594 - mptcp_poll + mptcp_send_limit - 497289 + 612607 - __subflow_push_pending + __mptcp_move_skb - 498123 + 614930 - do_copy_data_nocache + __subflow_push_pending - 510811 + 621376 - mptcp_frag_can_collapse_to + mptcp_recvmsg - 510811 + 635686 - mptcp_send_limit + mptcp_poll - 512794 + 636666 - mptcp_recvmsg + mptcp_data_ready - 541720 + 644000 - mptcp_check_allowed_size + __mptcp_recvmsg_mskq - 544325 + 657083 - mptcp_sendmsg_frag + mptcp_rcv_space_adjust - 544326 + 657083 - __mptcp_ofo_queue + mptcp_cleanup_rbuf - 563574 + 701364 - __mptcp_recvmsg_mskq + mptcp_check_allowed_size - 565071 + 716483 - mptcp_rcv_space_adjust + mptcp_sendmsg_frag - 565071 + 716484 __mptcp_set_timeout - 567770 + 761306 - mptcp_cleanup_rbuf + __mptcp_ofo_queue - 601347 + 776426 __mptcp_check_push - 701767 + 1014316 - mptcp_subflow_active + mptcp_release_cb - 973316 + 1222176 - mptcp_release_cb + mptcp_subflow_could_cleanup - 1047865 + 1233297 - mptcp_subflow_could_cleanup + mptcp_subflow_active - 1100667 + 1244138 diff --git a/html/lcov/export/mptcp/protocol.c.func.html b/html/lcov/export/mptcp/protocol.c.func.html index 663133b6..76e1df76 100644 --- a/html/lcov/export/mptcp/protocol.c.func.html +++ b/html/lcov/export/mptcp/protocol.c.func.html @@ -33,11 +33,11 @@ Lines: 91.1 % 2158 - 1966 + 1967 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 95.5 % @@ -81,42 +81,42 @@ __mptcp_add_ext - 206284 + 263104 __mptcp_alloc_tx_skb - 206284 + 263104 __mptcp_check_push - 701767 + 1014316 __mptcp_clean_una - 182530 + 261257 __mptcp_clean_una_wakeup - 33175 + 31419 __mptcp_clear_xmit - 3676 + 3680 @@ -130,70 +130,70 @@ __mptcp_close_ssk - 5409 + 5478 __mptcp_close_subflow - 567 + 590 __mptcp_data_acked - 191249 + 275593 __mptcp_data_ready - 345334 + 528891 __mptcp_destroy_sock - 3614 + 3618 __mptcp_do_alloc_tx_skb - 206284 + 263104 __mptcp_error_report - 818 + 819 __mptcp_finish_join - 505 + 506 __mptcp_first_ready_from - 169634 + 163529 __mptcp_flush_join_list - 33 + 31 @@ -207,70 +207,70 @@ __mptcp_move_skb - 416178 + 614930 __mptcp_move_skbs - 218246 + 247543 __mptcp_move_skbs_from_subflow - 399906 + 590666 __mptcp_nmpc_sk - 7158 + 7160 __mptcp_ofo_queue - 563574 + 776426 __mptcp_push_pending - 461014 + 542806 __mptcp_recvmsg_mskq - 565071 + 657083 __mptcp_retrans - 7511 + 10458 __mptcp_retransmit_pending_data - 746 + 768 __mptcp_set_timeout - 567770 + 761306 @@ -284,28 +284,28 @@ __mptcp_subflow_disconnect - 782 + 842 __mptcp_subflow_error_report - 5551 + 5506 __mptcp_subflow_push_pending - 67998 + 104049 __mptcp_subflow_send_ack - 4684 + 4609 @@ -319,35 +319,35 @@ __mptcp_wr_shutdown - 2143 + 2156 __subflow_push_pending - 498123 + 621376 dfrag_clear - 395409 + 467006 do_copy_data_nocache - 510811 + 610594 move_skbs_to_msk - 345334 + 528891 @@ -368,84 +368,84 @@ mptcp_cancel_work - 2646 + 2660 mptcp_carve_data_frag - 395415 + 467012 mptcp_check_allowed_size - 544325 + 716483 mptcp_check_and_set_pending - 6755 + 9635 mptcp_check_data_fin - 50786 + 60573 mptcp_check_data_fin_ack - 9694 + 12822 mptcp_check_fastclose - 9694 + 12822 mptcp_check_listen_stop - 2399 + 2379 mptcp_check_send_data_fin - 343329 + 397645 mptcp_check_writeable - 265914 + 352897 mptcp_clean_una_wakeup - 7511 + 10458 mptcp_cleanup_rbuf - 601347 + 701364 @@ -459,28 +459,28 @@ mptcp_close_ssk - 767 + 791 mptcp_close_state - 2542 + 2592 mptcp_close_tout_expired - 9694 + 12822 mptcp_close_wake_up - 4377 + 4379 @@ -494,7 +494,7 @@ mptcp_copy_inaddrs - 4928 + 4932 @@ -515,28 +515,28 @@ mptcp_data_queue_ofo - 103296 + 118644 mptcp_data_ready - 427199 + 644000 mptcp_destroy - 3618 + 3622 mptcp_destroy_common - 3676 + 3680 @@ -550,7 +550,7 @@ mptcp_do_fastclose - 366 + 397 @@ -585,14 +585,14 @@ mptcp_finish_join - 992 + 994 mptcp_frag_can_collapse_to - 510811 + 610594 @@ -641,7 +641,7 @@ mptcp_listen - 1242 + 1244 @@ -655,35 +655,35 @@ mptcp_napi_poll - 39070 + 41486 mptcp_page_frag_refill - 395415 + 467012 mptcp_pending_data_fin - 396120 + 589464 mptcp_pending_data_fin_ack - 192224 + 274079 mptcp_poll - 497289 + 636666 @@ -704,14 +704,14 @@ mptcp_push_release - 445325 + 509350 mptcp_rcv_space_adjust - 565071 + 657083 @@ -725,63 +725,63 @@ mptcp_recvmsg - 541720 + 635686 mptcp_release_cb - 1047865 + 1222176 mptcp_reset_rtx_timer - 182280 + 260339 mptcp_reset_tout_timer - 1065 + 1053 mptcp_retransmit_timer - 7845 + 10767 mptcp_schedule_work - 11281 + 14503 mptcp_send_ack - 2831 + 2794 mptcp_send_limit - 512794 + 612607 mptcp_sendmsg - 442977 + 521353 @@ -795,35 +795,35 @@ mptcp_sendmsg_frag - 544326 + 716484 mptcp_set_datafin_timeout - 1150 + 1139 mptcp_set_state - 16865 + 17031 mptcp_set_timeout - 253124 + 311066 mptcp_shutdown - 1459 + 1516 @@ -837,21 +837,21 @@ mptcp_skb_can_collapse_to - 434118 + 561746 mptcp_sock_graft - 4653 + 4654 mptcp_stop_rtx_timer - 21690 + 32002 @@ -865,70 +865,70 @@ mptcp_subflow_active - 973316 + 1244138 mptcp_subflow_cleanup_rbuf - 173647 + 211665 mptcp_subflow_could_cleanup - 1100667 + 1233297 mptcp_subflow_get_retrans - 1767 + 2260 mptcp_subflow_get_send - 314646 + 450240 mptcp_subflow_joined - 992 + 994 mptcp_subflow_process_delegated - 28545 + 32423 mptcp_subflow_send_ack - 3797 + 3721 mptcp_subflow_set_active - 126 + 99 mptcp_subflow_shutdown - 2997 + 3015 @@ -942,14 +942,14 @@ mptcp_tout_timer - 114 + 118 mptcp_try_coalesce - 293156 + 462586 @@ -963,49 +963,49 @@ mptcp_update_data_checksum - 868 + 819 mptcp_update_infinite_map - 2 + 1 mptcp_update_post_push - 435272 + 542578 mptcp_wnd_end - 50690 + 54992 mptcp_worker - 9808 + 12938 schedule_3rdack_retransmission - 499 + 500 tcp_can_send_ack - 105838 + 113704 diff --git a/html/lcov/export/mptcp/protocol.c.gcov.html b/html/lcov/export/mptcp/protocol.c.gcov.html index f8453aad..f4a9720c 100644 --- a/html/lcov/export/mptcp/protocol.c.gcov.html +++ b/html/lcov/export/mptcp/protocol.c.gcov.html @@ -33,11 +33,11 @@ Lines: 91.1 % 2158 - 1966 + 1967 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 95.5 % @@ -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 : 336980 : u64 mptcp_wnd_end(const struct mptcp_sock *msk) + 53 : 340508 : u64 mptcp_wnd_end(const struct mptcp_sock *msk) 54 : : { - 55 : 336980 : return READ_ONCE(msk->wnd_end); + 55 : 340508 : 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 : 7158 : struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk) + 98 : 7160 : struct sock *__mptcp_nmpc_sk(struct mptcp_sock *msk) 99 : : { - 100 : 7158 : struct sock *sk = (struct sock *)msk; - 101 : 7158 : int ret; + 100 : 7160 : struct sock *sk = (struct sock *)msk; + 101 : 7160 : int ret; 102 : : - 103 [ + + + + ]: 7158 : if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) + 103 [ + + + + ]: 7160 : if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) 104 : : return ERR_PTR(-EINVAL); 105 : : - 106 [ + + ]: 7140 : if (!msk->first) { + 106 [ + + ]: 7142 : if (!msk->first) { 107 : 2518 : ret = __mptcp_socket_create(msk); 108 [ - + ]: 2518 : if (ret) 109 : 0 : return ERR_PTR(ret); 110 : : } 111 : : - 112 : 7140 : return msk->first; + 112 : 7142 : 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 : 293156 : static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, + 121 : 462586 : static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, 122 : : struct sk_buff *from) 123 : : { - 124 : 293156 : bool fragstolen; - 125 : 293156 : int delta; + 124 : 462586 : bool fragstolen; + 125 : 462586 : int delta; 126 : : - 127 [ + + ]: 293156 : if (unlikely(MPTCP_SKB_CB(to)->cant_coalesce) || - 128 [ + + ]: 293136 : MPTCP_SKB_CB(from)->offset || - 129 [ + + + + ]: 576346 : ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || - 130 : 283232 : !skb_try_coalesce(to, from, &fragstolen, &delta)) - 131 : 86207 : return false; + 127 [ + + ]: 462586 : if (unlikely(MPTCP_SKB_CB(to)->cant_coalesce) || + 128 [ + + ]: 462568 : MPTCP_SKB_CB(from)->offset || + 129 [ + + + + ]: 911039 : ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || + 130 : 448497 : !skb_try_coalesce(to, from, &fragstolen, &delta)) + 131 : 99406 : return false; 132 : : - 133 [ - + ]: 206949 : pr_debug("colesced seq %llx into %llx new len %d new end seq %llx\n", + 133 [ - + ]: 363180 : 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 : 206949 : MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; + 136 : 363180 : 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 : 206949 : atomic_add(delta, &sk->sk_rmem_alloc); - 143 [ + - ]: 206949 : sk_mem_charge(sk, delta); - 144 [ - + ]: 206949 : kfree_skb_partial(from, fragstolen); + 142 : 363180 : atomic_add(delta, &sk->sk_rmem_alloc); + 143 [ + - ]: 363180 : sk_mem_charge(sk, delta); + 144 [ - + ]: 363180 : kfree_skb_partial(from, fragstolen); 145 : : - 146 : 206949 : return true; + 146 : 363180 : return true; 147 : : } 148 : : - 149 : 25938 : static bool mptcp_ooo_try_coalesce(struct mptcp_sock *msk, struct sk_buff *to, + 149 : 28705 : static bool mptcp_ooo_try_coalesce(struct mptcp_sock *msk, struct sk_buff *to, 150 : : struct sk_buff *from) 151 : : { - 152 [ + + ]: 56568 : if (MPTCP_SKB_CB(from)->map_seq != MPTCP_SKB_CB(to)->end_seq) + 152 [ + + ]: 52912 : if (MPTCP_SKB_CB(from)->map_seq != MPTCP_SKB_CB(to)->end_seq) 153 : : return false; 154 : : - 155 : 127741 : return mptcp_try_coalesce((struct sock *)msk, to, from); + 155 : 137439 : 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 : 103296 : static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) + 162 : 118644 : static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) 163 : : { - 164 : 103296 : struct sock *sk = (struct sock *)msk; - 165 : 103296 : struct rb_node **p, *parent; - 166 : 103296 : u64 seq, end_seq, max_seq; - 167 : 103296 : struct sk_buff *skb1; + 164 : 118644 : struct sock *sk = (struct sock *)msk; + 165 : 118644 : struct rb_node **p, *parent; + 166 : 118644 : u64 seq, end_seq, max_seq; + 167 : 118644 : struct sk_buff *skb1; 168 : : - 169 : 103296 : seq = MPTCP_SKB_CB(skb)->map_seq; - 170 : 103296 : end_seq = MPTCP_SKB_CB(skb)->end_seq; - 171 [ - + ]: 103296 : max_seq = atomic64_read(&msk->rcv_wnd_sent); + 169 : 118644 : seq = MPTCP_SKB_CB(skb)->map_seq; + 170 : 118644 : end_seq = MPTCP_SKB_CB(skb)->end_seq; + 171 [ - + ]: 118644 : max_seq = atomic64_read(&msk->rcv_wnd_sent); 172 : : - 173 [ - + ]: 103296 : pr_debug("msk=%p seq=%llx limit=%llx empty=%d\n", msk, seq, max_seq, + 173 [ - + ]: 118644 : 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 [ - + ]: 103296 : if (after64(end_seq, max_seq)) { + 175 [ - + ]: 118644 : 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 : 103296 : p = &msk->out_of_order_queue.rb_node; - 186 [ + - ]: 103296 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE); - 187 [ + + ]: 103296 : if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) { - 188 : 13204 : rb_link_node(&skb->rbnode, NULL, p); - 189 : 13204 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); - 190 : 13204 : msk->ooo_last_skb = skb; - 191 : 13204 : goto end; + 185 : 118644 : p = &msk->out_of_order_queue.rb_node; + 186 [ + - ]: 118644 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE); + 187 [ + + ]: 118644 : if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) { + 188 : 13496 : rb_link_node(&skb->rbnode, NULL, p); + 189 : 13496 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); + 190 : 13496 : msk->ooo_last_skb = skb; + 191 : 13496 : 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 [ + + + + ]: 152360 : if (mptcp_ooo_try_coalesce(msk, msk->ooo_last_skb, skb)) { - 198 [ + - ]: 40920 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); - 199 [ + - ]: 40920 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); - 200 : 40920 : return; + 197 [ + + + + ]: 176016 : if (mptcp_ooo_try_coalesce(msk, msk->ooo_last_skb, skb)) { + 198 [ + - ]: 52728 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); + 199 [ + - ]: 52728 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); + 200 : 52728 : return; 201 : : } 202 : : 203 : : /* Can avoid an rbtree lookup if we are adding skb after ooo_last_skb */ - 204 [ + + ]: 49172 : if (!before64(seq, MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq)) { - 205 [ + - ]: 37232 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); - 206 : 37232 : parent = &msk->ooo_last_skb->rbnode; - 207 : 37232 : p = &parent->rb_right; - 208 : 37232 : goto insert; + 204 [ + + ]: 52420 : if (!before64(seq, MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq)) { + 205 [ + - ]: 35473 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); + 206 : 35473 : parent = &msk->ooo_last_skb->rbnode; + 207 : 35473 : p = &parent->rb_right; + 208 : 35473 : goto insert; 209 : : } 210 : : 211 : : /* Find place to insert this segment. Handle overlaps on the way. */ 212 : : parent = NULL; - 213 [ + + ]: 69822 : while (*p) { - 214 : 63481 : parent = *p; - 215 : 63481 : skb1 = rb_to_skb(parent); - 216 [ + + ]: 63481 : if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { - 217 : 18740 : p = &parent->rb_left; - 218 : 18740 : continue; + 213 [ + + ]: 67596 : while (*p) { + 214 : 63431 : parent = *p; + 215 : 63431 : skb1 = rb_to_skb(parent); + 216 [ + + ]: 63431 : if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { + 217 : 17942 : p = &parent->rb_left; + 218 : 17942 : continue; 219 : : } - 220 [ + + ]: 44741 : if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) { - 221 [ + + ]: 459 : if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) { + 220 [ + + ]: 45489 : if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) { + 221 [ + + ]: 543 : if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) { 222 : : /* All the bits are present. Drop. */ - 223 : 165 : mptcp_drop(sk, skb); - 224 [ + - ]: 165 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 225 : 165 : return; + 223 : 244 : mptcp_drop(sk, skb); + 224 [ + - ]: 244 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 225 : 244 : return; 226 : : } - 227 [ + + ]: 294 : if (after64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { + 227 [ + + ]: 299 : 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 : 15 : rb_replace_node(&skb1->rbnode, &skb->rbnode, + 237 : 9 : rb_replace_node(&skb1->rbnode, &skb->rbnode, 238 : : &msk->out_of_order_queue); - 239 : 15 : mptcp_drop(sk, skb1); - 240 [ + - ]: 15 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 241 : 15 : goto merge_right; + 239 : 9 : mptcp_drop(sk, skb1); + 240 [ + - ]: 9 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 241 : 9 : goto merge_right; 242 : : } - 243 [ + + + + ]: 53913 : } else if (mptcp_ooo_try_coalesce(msk, skb1, skb)) { - 244 [ + - ]: 5419 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); - 245 : 5419 : return; + 243 [ + + + + ]: 59441 : } else if (mptcp_ooo_try_coalesce(msk, skb1, skb)) { + 244 [ + - ]: 12529 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); + 245 : 12529 : return; 246 : : } - 247 : 39142 : p = &parent->rb_right; + 247 : 32707 : p = &parent->rb_right; 248 : : } 249 : : - 250 : 6341 : insert: + 250 : 4165 : insert: 251 : : /* Insert segment into RB tree. */ - 252 : 43573 : rb_link_node(&skb->rbnode, parent, p); - 253 : 43573 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); + 252 : 39638 : rb_link_node(&skb->rbnode, parent, p); + 253 : 39638 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); 254 : : 255 : : merge_right: 256 : : /* Remove other segments covered by skb. */ - 257 [ + + ]: 43730 : while ((skb1 = skb_rb_next(skb)) != NULL) { - 258 [ + + ]: 6497 : if (before64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) + 257 [ + + ]: 39756 : while ((skb1 = skb_rb_next(skb)) != NULL) { + 258 [ + + ]: 4281 : if (before64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) 259 : : break; - 260 : 142 : rb_erase(&skb1->rbnode, &msk->out_of_order_queue); - 261 : 142 : mptcp_drop(sk, skb1); - 262 [ + - ]: 8035 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 260 : 109 : rb_erase(&skb1->rbnode, &msk->out_of_order_queue); + 261 : 109 : mptcp_drop(sk, skb1); + 262 [ + - ]: 9054 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); 263 : : } 264 : : /* If there is no skb after us, we are the last_skb ! */ - 265 [ + + ]: 43588 : if (!skb1) - 266 : 37233 : msk->ooo_last_skb = skb; + 265 [ + + ]: 39647 : if (!skb1) + 266 : 35475 : msk->ooo_last_skb = skb; 267 : : - 268 : 6355 : end: - 269 : 56792 : skb_condense(skb); - 270 : 56792 : skb_set_owner_r(skb, sk); + 268 : 4172 : end: + 269 : 53143 : skb_condense(skb); + 270 : 53143 : skb_set_owner_r(skb, sk); 271 : : } 272 : : - 273 : 416178 : static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, + 273 : 614930 : 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 : 416178 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 278 : 416178 : struct sock *sk = (struct sock *)msk; - 279 : 416178 : struct sk_buff *tail; - 280 : 416178 : bool has_rxtstamp; + 277 : 614930 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 278 : 614930 : struct sock *sk = (struct sock *)msk; + 279 : 614930 : struct sk_buff *tail; + 280 : 614930 : bool has_rxtstamp; 281 : : - 282 : 416178 : __skb_unlink(skb, &ssk->sk_receive_queue); + 282 : 614930 : __skb_unlink(skb, &ssk->sk_receive_queue); 283 : : - 284 : 416178 : skb_ext_reset(skb); - 285 : 416178 : skb_orphan(skb); + 284 : 614930 : skb_ext_reset(skb); + 285 : 614930 : skb_orphan(skb); 286 : : 287 : : /* try to fetch required memory from subflow */ - 288 [ - + ]: 416178 : if (!sk_rmem_schedule(sk, skb, skb->truesize)) { + 288 [ - + ]: 614930 : 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 : 416178 : has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp; + 293 : 614930 : 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 : 416178 : MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow); - 300 : 416178 : MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + copy_len; - 301 : 416178 : MPTCP_SKB_CB(skb)->offset = offset; - 302 : 416178 : MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp; - 303 : 416178 : MPTCP_SKB_CB(skb)->cant_coalesce = 0; + 299 : 614930 : MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow); + 300 : 614930 : MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + copy_len; + 301 : 614930 : MPTCP_SKB_CB(skb)->offset = offset; + 302 : 614930 : MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp; + 303 : 614930 : MPTCP_SKB_CB(skb)->cant_coalesce = 0; 304 : : - 305 [ + + ]: 416178 : if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { + 305 [ + + ]: 614930 : if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { 306 : : /* in sequence */ - 307 : 312837 : msk->bytes_received += copy_len; - 308 : 312837 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); - 309 [ + + ]: 312837 : tail = skb_peek_tail(&sk->sk_receive_queue); - 310 [ + - + + ]: 165415 : if (tail && mptcp_try_coalesce(sk, tail, skb)) + 307 : 496247 : msk->bytes_received += copy_len; + 308 : 496247 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); + 309 [ + + ]: 496247 : tail = skb_peek_tail(&sk->sk_receive_queue); + 310 [ + - + + ]: 325147 : if (tail && mptcp_try_coalesce(sk, tail, skb)) 311 : : return true; 312 : : - 313 : 187681 : skb_set_owner_r(skb, sk); - 314 : 187681 : __skb_queue_tail(&sk->sk_receive_queue, skb); - 315 : 187681 : return true; - 316 [ + + ]: 103341 : } else if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) { - 317 : 103296 : mptcp_data_queue_ofo(msk, skb); - 318 : 103296 : return false; + 313 : 229687 : skb_set_owner_r(skb, sk); + 314 : 229687 : __skb_queue_tail(&sk->sk_receive_queue, skb); + 315 : 229687 : return true; + 316 [ + + ]: 118683 : } else if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) { + 317 : 118644 : mptcp_data_queue_ofo(msk, skb); + 318 : 118644 : 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 [ + - ]: 45 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 325 : 45 : drop: - 326 : 45 : mptcp_drop(sk, skb); - 327 : 45 : return false; + 324 [ + - ]: 39 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 325 : 39 : drop: + 326 : 39 : mptcp_drop(sk, skb); + 327 : 39 : return false; 328 : : } 329 : : - 330 : 21690 : static void mptcp_stop_rtx_timer(struct sock *sk) + 330 : 32002 : static void mptcp_stop_rtx_timer(struct sock *sk) 331 : : { - 332 : 21690 : struct inet_connection_sock *icsk = inet_csk(sk); + 332 : 32002 : struct inet_connection_sock *icsk = inet_csk(sk); 333 : : - 334 : 21690 : sk_stop_timer(sk, &icsk->icsk_retransmit_timer); - 335 [ - + ]: 21690 : mptcp_sk(sk)->timer_ival = 0; - 336 : 21690 : } + 334 : 32002 : sk_stop_timer(sk, &icsk->icsk_retransmit_timer); + 335 [ - + ]: 32002 : mptcp_sk(sk)->timer_ival = 0; + 336 : 32002 : } 337 : : - 338 : 4377 : static void mptcp_close_wake_up(struct sock *sk) + 338 : 4379 : static void mptcp_close_wake_up(struct sock *sk) 339 : : { - 340 [ + + ]: 4377 : if (sock_flag(sk, SOCK_DEAD)) + 340 [ + + ]: 4379 : if (sock_flag(sk, SOCK_DEAD)) 341 : : return; 342 : : - 343 : 3020 : sk->sk_state_change(sk); - 344 [ + + ]: 3020 : if (sk->sk_shutdown == SHUTDOWN_MASK || - 345 [ + + ]: 1535 : sk->sk_state == TCP_CLOSE) - 346 : 1535 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP); + 343 : 3013 : sk->sk_state_change(sk); + 344 [ + + ]: 3013 : if (sk->sk_shutdown == SHUTDOWN_MASK || + 345 [ + + ]: 1448 : sk->sk_state == TCP_CLOSE) + 346 : 1615 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP); 347 : : else - 348 : 1485 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); + 348 : 1398 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); 349 : : } 350 : : 351 : : /* called under the msk socket lock */ - 352 : 192224 : static bool mptcp_pending_data_fin_ack(struct sock *sk) + 352 : 274079 : static bool mptcp_pending_data_fin_ack(struct sock *sk) 353 : : { - 354 [ - + ]: 192224 : struct mptcp_sock *msk = mptcp_sk(sk); + 354 [ - + ]: 274079 : struct mptcp_sock *msk = mptcp_sk(sk); 355 : : - 356 : 78393 : return ((1 << sk->sk_state) & - 357 [ + + + + ]: 192224 : (TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK)) && - 358 [ + + ]: 26822 : msk->write_seq == READ_ONCE(msk->snd_una); + 356 : 158926 : return ((1 << sk->sk_state) & + 357 [ + + + + ]: 274079 : (TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK)) && + 358 [ + + ]: 40489 : msk->write_seq == READ_ONCE(msk->snd_una); 359 : : } 360 : : - 361 : 9694 : static void mptcp_check_data_fin_ack(struct sock *sk) + 361 : 12822 : static void mptcp_check_data_fin_ack(struct sock *sk) 362 : : { - 363 [ - + ]: 9694 : struct mptcp_sock *msk = mptcp_sk(sk); + 363 [ - + ]: 12822 : struct mptcp_sock *msk = mptcp_sk(sk); 364 : : 365 : : /* Look for an acknowledged DATA_FIN */ - 366 [ + + ]: 9694 : if (mptcp_pending_data_fin_ack(sk)) { - 367 : 1786 : WRITE_ONCE(msk->snd_data_fin_enable, 0); + 366 [ + + ]: 12822 : if (mptcp_pending_data_fin_ack(sk)) { + 367 : 1757 : WRITE_ONCE(msk->snd_data_fin_enable, 0); 368 : : - 369 [ + + - ]: 1786 : switch (sk->sk_state) { - 370 : 973 : case TCP_FIN_WAIT1: - 371 : 973 : mptcp_set_state(sk, TCP_FIN_WAIT2); - 372 : 973 : break; - 373 : 813 : case TCP_CLOSING: + 369 [ + + - ]: 1757 : switch (sk->sk_state) { + 370 : 961 : case TCP_FIN_WAIT1: + 371 : 961 : mptcp_set_state(sk, TCP_FIN_WAIT2); + 372 : 961 : break; + 373 : 796 : case TCP_CLOSING: 374 : : case TCP_LAST_ACK: - 375 : 813 : mptcp_set_state(sk, TCP_CLOSE); - 376 : 813 : break; + 375 : 796 : mptcp_set_state(sk, TCP_CLOSE); + 376 : 796 : break; 377 : : } 378 : : - 379 : 1786 : mptcp_close_wake_up(sk); + 379 : 1757 : mptcp_close_wake_up(sk); 380 : : } - 381 : 9694 : } + 381 : 12822 : } 382 : : 383 : : /* can be called with no lock acquired */ - 384 : 396120 : static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq) + 384 : 589464 : static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq) 385 : : { - 386 [ - + ]: 396120 : struct mptcp_sock *msk = mptcp_sk(sk); + 386 [ - + ]: 589464 : struct mptcp_sock *msk = mptcp_sk(sk); 387 : : - 388 [ + + + + : 414313 : if (READ_ONCE(msk->rcv_data_fin) && - + + + + ] - 389 [ + + ]: 157 : ((1 << inet_sk_state_load(sk)) & + 388 [ + + + + : 618472 : if (READ_ONCE(msk->rcv_data_fin) && + + + + + ] + 389 [ + + ]: 143 : ((1 << inet_sk_state_load(sk)) & 390 : : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2))) { - 391 : 17695 : u64 rcv_data_fin_seq = READ_ONCE(msk->rcv_data_fin_seq); + 391 : 28451 : u64 rcv_data_fin_seq = READ_ONCE(msk->rcv_data_fin_seq); 392 : : - 393 [ + + ]: 17695 : if (READ_ONCE(msk->ack_seq) == rcv_data_fin_seq) { - 394 [ + + ]: 2036 : if (seq) - 395 : 1750 : *seq = rcv_data_fin_seq; + 393 [ + + ]: 28451 : if (READ_ONCE(msk->ack_seq) == rcv_data_fin_seq) { + 394 [ + + ]: 1989 : if (seq) + 395 : 1721 : *seq = rcv_data_fin_seq; 396 : : - 397 : 2036 : return true; + 397 : 1989 : return true; 398 : : } 399 : : } 400 : : 401 : : return false; 402 : : } 403 : : - 404 : 1150 : static void mptcp_set_datafin_timeout(struct sock *sk) + 404 : 1139 : static void mptcp_set_datafin_timeout(struct sock *sk) 405 : : { - 406 : 1150 : struct inet_connection_sock *icsk = inet_csk(sk); - 407 : 1150 : u32 retransmits; + 406 : 1139 : struct inet_connection_sock *icsk = inet_csk(sk); + 407 : 1139 : u32 retransmits; 408 : : - 409 : 1150 : retransmits = min_t(u32, icsk->icsk_retransmits, + 409 : 1139 : retransmits = min_t(u32, icsk->icsk_retransmits, 410 : : ilog2(TCP_RTO_MAX / TCP_RTO_MIN)); 411 : : - 412 [ - + ]: 1150 : mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits; - 413 : 1150 : } + 412 [ - + ]: 1139 : mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits; + 413 : 1139 : } 414 : : - 415 : 567770 : static void __mptcp_set_timeout(struct sock *sk, long tout) + 415 : 761306 : static void __mptcp_set_timeout(struct sock *sk, long tout) 416 : : { - 417 [ + + - + ]: 994916 : mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN; - 418 : 567770 : } + 417 [ + + - + ]: 1294563 : mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN; + 418 : 761306 : } 419 : : - 420 : 283283 : static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subflow) + 420 : 298336 : static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subflow) 421 : : { - 422 : 1087710 : const struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 422 : 1337129 : const struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 423 : : - 424 [ + + + + ]: 936369 : return inet_csk(ssk)->icsk_pending && !subflow->stale_count ? - 425 [ + + + + ]: 1871323 : inet_csk(ssk)->icsk_timeout - jiffies : 0; + 424 [ + + + + ]: 1118538 : return inet_csk(ssk)->icsk_pending && !subflow->stale_count ? + 425 [ + + + + ]: 2245426 : inet_csk(ssk)->icsk_timeout - jiffies : 0; 426 : : } 427 : : - 428 : 253124 : void mptcp_set_timeout(struct sock *sk) + 428 : 311066 : void mptcp_set_timeout(struct sock *sk) 429 : : { - 430 : 253124 : struct mptcp_subflow_context *subflow; - 431 : 253124 : long tout = 0; + 430 : 311066 : struct mptcp_subflow_context *subflow; + 431 : 311066 : long tout = 0; 432 : : - 433 [ - + - + : 761064 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) - + + ] - 434 [ + + ]: 955624 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); - 435 : 253124 : __mptcp_set_timeout(sk, tout); - 436 : 253124 : } + 433 [ - + - + : 879034 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) + + + ] + 434 [ + + ]: 1052199 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); + 435 : 311066 : __mptcp_set_timeout(sk, tout); + 436 : 311066 : } 437 : : - 438 : 128330 : static inline bool tcp_can_send_ack(const struct sock *ssk) + 438 : 132754 : static inline bool tcp_can_send_ack(const struct sock *ssk) 439 : : { - 440 [ - + ]: 253278 : return !((1 << inet_sk_state_load(ssk)) & + 440 [ - + ]: 321594 : return !((1 << inet_sk_state_load(ssk)) & 441 : : (TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_TIME_WAIT | TCPF_CLOSE | TCPF_LISTEN)); 442 : : } 443 : : - 444 : 4684 : void __mptcp_subflow_send_ack(struct sock *ssk) + 444 : 4609 : void __mptcp_subflow_send_ack(struct sock *ssk) 445 : : { - 446 [ + + ]: 4684 : if (tcp_can_send_ack(ssk)) - 447 : 4613 : tcp_send_ack(ssk); - 448 : 4684 : } + 446 [ + + ]: 4609 : if (tcp_can_send_ack(ssk)) + 447 : 4531 : tcp_send_ack(ssk); + 448 : 4609 : } 449 : : - 450 : 3797 : static void mptcp_subflow_send_ack(struct sock *ssk) + 450 : 3721 : static void mptcp_subflow_send_ack(struct sock *ssk) 451 : : { - 452 : 3797 : bool slow; + 452 : 3721 : bool slow; 453 : : - 454 : 3797 : slow = lock_sock_fast(ssk); - 455 : 3797 : __mptcp_subflow_send_ack(ssk); - 456 : 3797 : unlock_sock_fast(ssk, slow); - 457 : 3797 : } + 454 : 3721 : slow = lock_sock_fast(ssk); + 455 : 3721 : __mptcp_subflow_send_ack(ssk); + 456 : 3721 : unlock_sock_fast(ssk, slow); + 457 : 3721 : } 458 : : - 459 : 2831 : static void mptcp_send_ack(struct mptcp_sock *msk) + 459 : 2794 : static void mptcp_send_ack(struct mptcp_sock *msk) 460 : : { - 461 : 2831 : struct mptcp_subflow_context *subflow; + 461 : 2794 : struct mptcp_subflow_context *subflow; 462 : : - 463 [ + + ]: 6628 : mptcp_for_each_subflow(msk, subflow) - 464 : 3797 : mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); - 465 : 2831 : } + 463 [ + + ]: 6515 : mptcp_for_each_subflow(msk, subflow) + 464 : 3721 : mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); + 465 : 2794 : } 466 : : - 467 : 173647 : static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) + 467 : 211665 : static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) 468 : : { - 469 : 173647 : bool slow; + 469 : 211665 : bool slow; 470 : : - 471 : 173647 : slow = lock_sock_fast(ssk); - 472 [ + + ]: 173647 : if (tcp_can_send_ack(ssk)) - 473 : 165028 : tcp_cleanup_rbuf(ssk, copied); - 474 : 173647 : unlock_sock_fast(ssk, slow); - 475 : 173647 : } + 471 : 211665 : slow = lock_sock_fast(ssk); + 472 [ + + ]: 211665 : if (tcp_can_send_ack(ssk)) + 473 : 206943 : tcp_cleanup_rbuf(ssk, copied); + 474 : 211665 : unlock_sock_fast(ssk, slow); + 475 : 211665 : } 476 : : - 477 : 1100667 : static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty) + 477 : 1233297 : static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty) 478 : : { - 479 : 1100667 : const struct inet_connection_sock *icsk = inet_csk(ssk); - 480 : 1100667 : u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending); - 481 [ - + ]: 1100667 : const struct tcp_sock *tp = tcp_sk(ssk); + 479 : 1233297 : const struct inet_connection_sock *icsk = inet_csk(ssk); + 480 : 1233297 : u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending); + 481 [ - + ]: 1233297 : const struct tcp_sock *tp = tcp_sk(ssk); 482 : : - 483 [ + + ]: 1100667 : return (ack_pending & ICSK_ACK_SCHED) && - 484 : 498998 : ((READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->rcv_wup) > - 485 [ + + + + ]: 498998 : READ_ONCE(icsk->icsk_ack.rcv_mss)) || - 486 [ + + ]: 50182 : (rx_empty && ack_pending & + 483 [ + + ]: 1233297 : return (ack_pending & ICSK_ACK_SCHED) && + 484 : 556589 : ((READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->rcv_wup) > + 485 [ + + + + ]: 556589 : READ_ONCE(icsk->icsk_ack.rcv_mss)) || + 486 [ + + ]: 53673 : (rx_empty && ack_pending & 487 : : (ICSK_ACK_PUSHED2 | ICSK_ACK_PUSHED))); 488 : : } 489 : : - 490 : 601347 : static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) + 490 : 701364 : static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) 491 : : { - 492 : 601347 : int old_space = READ_ONCE(msk->old_wspace); - 493 : 601347 : struct mptcp_subflow_context *subflow; - 494 : 601347 : struct sock *sk = (struct sock *)msk; - 495 : 601347 : int space = __mptcp_space(sk); - 496 : 601347 : bool cleanup, rx_empty; + 492 : 701364 : int old_space = READ_ONCE(msk->old_wspace); + 493 : 701364 : struct mptcp_subflow_context *subflow; + 494 : 701364 : struct sock *sk = (struct sock *)msk; + 495 : 701364 : int space = __mptcp_space(sk); + 496 : 701364 : bool cleanup, rx_empty; 497 : : - 498 [ + + + + : 601347 : cleanup = (space > 0) && (space >= (old_space << 1)) && copied; - + + ] - 499 [ + + + + ]: 601347 : rx_empty = !sk_rmem_alloc_get(sk) && copied; + 498 [ + + + + : 701364 : cleanup = (space > 0) && (space >= (old_space << 1)) && copied; + + + ] + 499 [ + + + + ]: 701364 : rx_empty = !sk_rmem_alloc_get(sk) && copied; 500 : : - 501 [ + + ]: 1756317 : mptcp_for_each_subflow(msk, subflow) { - 502 [ + + ]: 1154970 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 501 [ + + ]: 1997613 : mptcp_for_each_subflow(msk, subflow) { + 502 [ + + ]: 1296249 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 503 : : - 504 [ + + + + ]: 1154970 : if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) - 505 : 173647 : mptcp_subflow_cleanup_rbuf(ssk, copied); + 504 [ + + + + ]: 1296249 : if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) + 505 : 211665 : mptcp_subflow_cleanup_rbuf(ssk, copied); 506 : : } - 507 : 601347 : } + 507 : 701364 : } 508 : : - 509 : 50786 : static bool mptcp_check_data_fin(struct sock *sk) + 509 : 60573 : static bool mptcp_check_data_fin(struct sock *sk) 510 : : { - 511 [ - + ]: 50786 : struct mptcp_sock *msk = mptcp_sk(sk); - 512 : 50786 : u64 rcv_data_fin_seq; - 513 : 50786 : bool ret = false; + 511 [ - + ]: 60573 : struct mptcp_sock *msk = mptcp_sk(sk); + 512 : 60573 : u64 rcv_data_fin_seq; + 513 : 60573 : 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 [ + + ]: 50786 : 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 [ + + ]: 60573 : if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) { + 529 : 1721 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1); + 530 : 1721 : 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 : 1721 : WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN); + 533 : 1721 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ 534 : : - 535 [ + + + - ]: 1750 : switch (sk->sk_state) { + 535 [ + + + - ]: 1721 : switch (sk->sk_state) { 536 : : case TCP_ESTABLISHED: - 537 : 781 : mptcp_set_state(sk, TCP_CLOSE_WAIT); - 538 : 781 : break; - 539 : 173 : case TCP_FIN_WAIT1: - 540 : 173 : mptcp_set_state(sk, TCP_CLOSING); - 541 : 173 : break; - 542 : 796 : case TCP_FIN_WAIT2: - 543 : 796 : mptcp_set_state(sk, TCP_CLOSE); - 544 : 796 : break; + 537 : 720 : mptcp_set_state(sk, TCP_CLOSE_WAIT); + 538 : 720 : break; + 539 : 242 : case TCP_FIN_WAIT1: + 540 : 242 : mptcp_set_state(sk, TCP_CLOSING); + 541 : 242 : break; + 542 : 759 : case TCP_FIN_WAIT2: + 543 : 759 : mptcp_set_state(sk, TCP_CLOSE); + 544 : 759 : 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 : 1681 : mptcp_send_ack(msk); - 554 : 1750 : mptcp_close_wake_up(sk); + 551 : 1721 : ret = true; + 552 [ + + ]: 1721 : if (!__mptcp_check_fallback(msk)) + 553 : 1655 : mptcp_send_ack(msk); + 554 : 1721 : mptcp_close_wake_up(sk); 555 : : } - 556 : 50786 : return ret; + 556 : 60573 : 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 : 399906 : static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, + 571 : 590666 : static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, 572 : : struct sock *ssk) 573 : : { - 574 [ - + ]: 399906 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 575 : 399906 : struct sock *sk = (struct sock *)msk; - 576 : 399906 : bool more_data_avail; - 577 : 399906 : struct tcp_sock *tp; - 578 : 399906 : bool ret = false; + 574 [ - + ]: 590666 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 575 : 590666 : struct sock *sk = (struct sock *)msk; + 576 : 590666 : bool more_data_avail; + 577 : 590666 : struct tcp_sock *tp; + 578 : 590666 : bool ret = false; 579 : : - 580 [ - + ]: 399906 : pr_debug("msk=%p ssk=%p\n", msk, ssk); - 581 [ - + ]: 399906 : tp = tcp_sk(ssk); - 582 : 417979 : do { - 583 : 417979 : u32 map_remaining, offset; - 584 : 417979 : u32 seq = tp->copied_seq; - 585 : 417979 : struct sk_buff *skb; - 586 : 417979 : bool fin; + 580 [ - + ]: 590666 : pr_debug("msk=%p ssk=%p\n", msk, ssk); + 581 [ - + ]: 590666 : tp = tcp_sk(ssk); + 582 : 617094 : do { + 583 : 617094 : u32 map_remaining, offset; + 584 : 617094 : u32 seq = tp->copied_seq; + 585 : 617094 : struct sk_buff *skb; + 586 : 617094 : bool fin; 587 : : - 588 [ + + ]: 417979 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) + 588 [ + + ]: 617094 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) 589 : : break; 590 : : 591 : : /* try to move as much data as available */ - 592 : 832416 : map_remaining = subflow->map_data_len - - 593 : 416208 : mptcp_subflow_get_map_offset(subflow); + 592 : 1229908 : map_remaining = subflow->map_data_len - + 593 : 614954 : mptcp_subflow_get_map_offset(subflow); 594 : : - 595 [ + - ]: 416208 : skb = skb_peek(&ssk->sk_receive_queue); - 596 [ + - ]: 416208 : if (unlikely(!skb)) + 595 [ + - ]: 614954 : skb = skb_peek(&ssk->sk_receive_queue); + 596 [ + - ]: 614954 : if (unlikely(!skb)) 597 : : break; 598 : : - 599 [ + + ]: 416208 : if (__mptcp_check_fallback(msk)) { + 599 [ + + ]: 614954 : 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 : 2209 : map_remaining = skb->len; - 605 : 2209 : subflow->map_data_len = skb->len; + 604 : 3311 : map_remaining = skb->len; + 605 : 3311 : subflow->map_data_len = skb->len; 606 : : } 607 : : - 608 : 416208 : offset = seq - TCP_SKB_CB(skb)->seq; - 609 : 416208 : fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; - 610 [ + + ]: 416208 : if (fin) - 611 : 70 : seq++; + 608 : 614954 : offset = seq - TCP_SKB_CB(skb)->seq; + 609 : 614954 : fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; + 610 [ + + ]: 614954 : if (fin) + 611 : 67 : seq++; 612 : : - 613 [ + + ]: 416208 : if (offset < skb->len) { - 614 : 416178 : size_t len = skb->len - offset; + 613 [ + + ]: 614954 : if (offset < skb->len) { + 614 : 614930 : size_t len = skb->len - offset; 615 : : - 616 [ + + + + ]: 416178 : ret = __mptcp_move_skb(msk, ssk, skb, offset, len) || ret; - 617 : 416178 : seq += len; + 616 [ + + + + ]: 614930 : ret = __mptcp_move_skb(msk, ssk, skb, offset, len) || ret; + 617 : 614930 : seq += len; 618 : : - 619 [ - + ]: 416178 : if (unlikely(map_remaining < len)) { + 619 [ - + ]: 614930 : if (unlikely(map_remaining < len)) { 620 : 0 : DEBUG_NET_WARN_ON_ONCE(1); 621 : 0 : mptcp_dss_corruption(msk, ssk); 622 : : } 623 : : } else { - 624 [ - + ]: 30 : if (unlikely(!fin)) { + 624 [ - + ]: 24 : if (unlikely(!fin)) { 625 : 0 : DEBUG_NET_WARN_ON_ONCE(1); 626 : 0 : mptcp_dss_corruption(msk, ssk); 627 : : } 628 : : - 629 : 30 : sk_eat_skb(ssk, skb); + 629 : 24 : sk_eat_skb(ssk, skb); 630 : : } 631 : : - 632 : 416208 : WRITE_ONCE(tp->copied_seq, seq); - 633 : 416208 : more_data_avail = mptcp_subflow_data_available(ssk); + 632 : 614954 : WRITE_ONCE(tp->copied_seq, seq); + 633 : 614954 : more_data_avail = mptcp_subflow_data_available(ssk); 634 : : - 635 [ + + ]: 416208 : } while (more_data_avail); + 635 [ + + ]: 614954 : } while (more_data_avail); 636 : : - 637 [ + + ]: 399906 : if (ret) - 638 : 302310 : msk->last_data_recv = tcp_jiffies32; - 639 : 399906 : return ret; + 637 [ + + ]: 590666 : if (ret) + 638 : 478457 : msk->last_data_recv = tcp_jiffies32; + 639 : 590666 : return ret; 640 : : } 641 : : - 642 : 563574 : static bool __mptcp_ofo_queue(struct mptcp_sock *msk) + 642 : 776426 : static bool __mptcp_ofo_queue(struct mptcp_sock *msk) 643 : : { - 644 : 563574 : struct sock *sk = (struct sock *)msk; - 645 : 563574 : struct sk_buff *skb, *tail; - 646 : 563574 : bool moved = false; - 647 : 563574 : struct rb_node *p; - 648 : 563574 : u64 end_seq; + 644 : 776426 : struct sock *sk = (struct sock *)msk; + 645 : 776426 : struct sk_buff *skb, *tail; + 646 : 776426 : bool moved = false; + 647 : 776426 : struct rb_node *p; + 648 : 776426 : u64 end_seq; 649 : : - 650 : 563574 : p = rb_first(&msk->out_of_order_queue); - 651 [ - + ]: 563574 : pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); - 652 [ + + ]: 620209 : while (p) { - 653 : 254804 : skb = rb_to_skb(p); - 654 [ + + ]: 254804 : if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) + 650 : 776426 : p = rb_first(&msk->out_of_order_queue); + 651 [ - + ]: 776426 : pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); + 652 [ + + ]: 829451 : while (p) { + 653 : 269091 : skb = rb_to_skb(p); + 654 [ + + ]: 269091 : if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) 655 : : break; 656 : : - 657 : 56635 : p = rb_next(p); - 658 : 56635 : rb_erase(&skb->rbnode, &msk->out_of_order_queue); + 657 : 53025 : p = rb_next(p); + 658 : 53025 : rb_erase(&skb->rbnode, &msk->out_of_order_queue); 659 : : - 660 [ + + ]: 56635 : if (unlikely(!after64(MPTCP_SKB_CB(skb)->end_seq, + 660 [ + + ]: 53025 : if (unlikely(!after64(MPTCP_SKB_CB(skb)->end_seq, 661 : : msk->ack_seq))) { - 662 : 67 : mptcp_drop(sk, skb); - 663 [ + - ]: 67 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 664 : 67 : continue; + 662 : 113 : mptcp_drop(sk, skb); + 663 [ + - ]: 113 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 664 : 113 : continue; 665 : : } 666 : : - 667 : 56568 : end_seq = MPTCP_SKB_CB(skb)->end_seq; - 668 [ + - ]: 56568 : tail = skb_peek_tail(&sk->sk_receive_queue); - 669 [ + - + + ]: 112410 : if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) { - 670 : 21114 : int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; + 667 : 52912 : end_seq = MPTCP_SKB_CB(skb)->end_seq; + 668 [ + - ]: 52912 : tail = skb_peek_tail(&sk->sk_receive_queue); + 669 [ + - + + ]: 104988 : if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) { + 670 : 21549 : int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; 671 : : 672 : : /* skip overlapping data, if any */ - 673 [ - + ]: 21114 : pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n", + 673 [ - + ]: 21549 : pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n", 674 : : MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq, 675 : : delta); - 676 : 21114 : MPTCP_SKB_CB(skb)->offset += delta; - 677 : 21114 : MPTCP_SKB_CB(skb)->map_seq += delta; - 678 : 21114 : __skb_queue_tail(&sk->sk_receive_queue, skb); + 676 : 21549 : MPTCP_SKB_CB(skb)->offset += delta; + 677 : 21549 : MPTCP_SKB_CB(skb)->map_seq += delta; + 678 : 21549 : __skb_queue_tail(&sk->sk_receive_queue, skb); 679 : : } - 680 : 56568 : msk->bytes_received += end_seq - msk->ack_seq; - 681 : 56568 : WRITE_ONCE(msk->ack_seq, end_seq); - 682 : 56568 : moved = true; + 680 : 52912 : msk->bytes_received += end_seq - msk->ack_seq; + 681 : 52912 : WRITE_ONCE(msk->ack_seq, end_seq); + 682 : 52912 : moved = true; 683 : : } - 684 : 563574 : return moved; + 684 : 776426 : return moved; 685 : : } 686 : : - 687 : 5551 : static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) + 687 : 5506 : static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) 688 : : { - 689 [ + + ]: 5551 : int err = sock_error(ssk); - 690 : 3303 : int ssk_state; + 689 [ + + ]: 5506 : int err = sock_error(ssk); + 690 : 3345 : int ssk_state; 691 : : - 692 [ + + ]: 3180 : if (!err) - 693 : 2371 : return false; + 692 [ + + ]: 3227 : if (!err) + 693 : 2279 : return false; 694 : : 695 : : /* only propagate errors on fallen-back sockets or 696 : : * on MPC connect 697 : : */ - 698 [ + + - + : 869 : if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk))) - + + ] + 698 [ + + - + : 930 : 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 : 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 : 45 : WRITE_ONCE(sk->sk_err, -err); + 706 : 44 : ssk_state = inet_sk_state_load(ssk); + 707 [ + - + + ]: 44 : if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) + 708 : 26 : mptcp_set_state(sk, ssk_state); + 709 : 44 : WRITE_ONCE(sk->sk_err, -err); 710 : : 711 : : /* This barrier is coupled with smp_rmb() in mptcp_poll() */ - 712 : 45 : smp_wmb(); - 713 : 45 : sk_error_report(sk); - 714 : 45 : return true; + 712 : 44 : smp_wmb(); + 713 : 44 : sk_error_report(sk); + 714 : 44 : return true; 715 : : } 716 : : - 717 : 818 : void __mptcp_error_report(struct sock *sk) + 717 : 819 : void __mptcp_error_report(struct sock *sk) 718 : : { - 719 : 818 : struct mptcp_subflow_context *subflow; - 720 [ - + ]: 818 : struct mptcp_sock *msk = mptcp_sk(sk); + 719 : 819 : struct mptcp_subflow_context *subflow; + 720 [ - + ]: 819 : struct mptcp_sock *msk = mptcp_sk(sk); 721 : : - 722 [ + + ]: 1715 : mptcp_for_each_subflow(msk, subflow) - 723 [ + + ]: 924 : if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow))) + 722 [ + + ]: 1663 : mptcp_for_each_subflow(msk, subflow) + 723 [ + + ]: 870 : if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow))) 724 : : break; - 725 : 818 : } + 725 : 819 : } 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 : 345334 : static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) + 730 : 528891 : static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) 731 : : { - 732 : 345334 : struct sock *sk = (struct sock *)msk; - 733 : 345334 : bool moved; + 732 : 528891 : struct sock *sk = (struct sock *)msk; + 733 : 528891 : bool moved; 734 : : - 735 : 345334 : moved = __mptcp_move_skbs_from_subflow(msk, ssk); - 736 : 345334 : __mptcp_ofo_queue(msk); - 737 [ - + ]: 345334 : if (unlikely(ssk->sk_err)) { + 735 : 528891 : moved = __mptcp_move_skbs_from_subflow(msk, ssk); + 736 : 528891 : __mptcp_ofo_queue(msk); + 737 [ - + ]: 528891 : if (unlikely(ssk->sk_err)) { 738 [ # # ]: 0 : if (!sock_owned_by_user(sk)) 739 : 0 : __mptcp_error_report(sk); 740 : : else @@ -829,81 +829,81 @@ 746 : : * this is not a good place to change state. Let the workqueue 747 : : * do it. 748 : : */ - 749 [ + + ]: 345334 : if (mptcp_pending_data_fin(sk, NULL)) - 750 : 286 : mptcp_schedule_work(sk); - 751 : 345334 : return moved; + 749 [ + + ]: 528891 : if (mptcp_pending_data_fin(sk, NULL)) + 750 : 268 : mptcp_schedule_work(sk); + 751 : 528891 : return moved; 752 : : } 753 : : - 754 : 179268 : static void __mptcp_rcvbuf_update(struct sock *sk, struct sock *ssk) + 754 : 178520 : static void __mptcp_rcvbuf_update(struct sock *sk, struct sock *ssk) 755 : : { - 756 : 793553 : if (unlikely(ssk->sk_rcvbuf > sk->sk_rcvbuf)) + 756 : 1034797 : if (unlikely(ssk->sk_rcvbuf > sk->sk_rcvbuf)) 757 : 0 : WRITE_ONCE(sk->sk_rcvbuf, ssk->sk_rcvbuf); 758 : : } 759 : : - 760 : 345334 : static void __mptcp_data_ready(struct sock *sk, struct sock *ssk) + 760 : 528891 : static void __mptcp_data_ready(struct sock *sk, struct sock *ssk) 761 : : { - 762 [ - + ]: 345334 : struct mptcp_sock *msk = mptcp_sk(sk); + 762 [ - + ]: 528891 : struct mptcp_sock *msk = mptcp_sk(sk); 763 : : - 764 [ - + ]: 345334 : __mptcp_rcvbuf_update(sk, ssk); + 764 [ - + ]: 528891 : __mptcp_rcvbuf_update(sk, ssk); 765 : : 766 : : /* Wake-up the reader only for in-sequence data */ - 767 [ + + + - ]: 345334 : if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) - 768 : 255046 : sk->sk_data_ready(sk); - 769 : 345334 : } + 767 [ + + + - ]: 528891 : if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) + 768 : 424022 : sk->sk_data_ready(sk); + 769 : 528891 : } 770 : : - 771 : 427199 : void mptcp_data_ready(struct sock *sk, struct sock *ssk) + 771 : 644000 : void mptcp_data_ready(struct sock *sk, struct sock *ssk) 772 : : { - 773 [ + - ]: 427199 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 773 [ + - ]: 644000 : 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 [ + - ]: 427199 : if (unlikely(subflow->disposable)) + 779 [ + - ]: 644000 : if (unlikely(subflow->disposable)) 780 : : return; 781 : : - 782 : 427199 : mptcp_data_lock(sk); - 783 [ + + ]: 427199 : if (!sock_owned_by_user(sk)) - 784 : 345334 : __mptcp_data_ready(sk, ssk); + 782 : 644000 : mptcp_data_lock(sk); + 783 [ + + ]: 644000 : if (!sock_owned_by_user(sk)) + 784 : 528891 : __mptcp_data_ready(sk, ssk); 785 : : else - 786 [ - + ]: 81865 : __set_bit(MPTCP_DEQUEUE, &mptcp_sk(sk)->cb_flags); - 787 : 427199 : mptcp_data_unlock(sk); + 786 [ - + ]: 115109 : __set_bit(MPTCP_DEQUEUE, &mptcp_sk(sk)->cb_flags); + 787 : 644000 : mptcp_data_unlock(sk); 788 : : } 789 : : - 790 : 992 : static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk) + 790 : 994 : static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk) 791 : : { - 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 : } + 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 : } 796 : : - 797 : 505 : static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk) + 797 : 506 : static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk) 798 : : { - 799 : 505 : struct sock *sk = (struct sock *)msk; + 799 : 506 : struct sock *sk = (struct sock *)msk; 800 : : - 801 [ + - ]: 505 : if (sk->sk_state != TCP_ESTABLISHED) + 801 [ + - ]: 506 : 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 [ + + + - ]: 505 : if (sk->sk_socket && !ssk->sk_socket) - 808 : 475 : mptcp_sock_graft(ssk, sk->sk_socket); + 807 [ + + + - ]: 506 : if (sk->sk_socket && !ssk->sk_socket) + 808 : 471 : mptcp_sock_graft(ssk, sk->sk_socket); 809 : : - 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); + 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); 815 : : return true; 816 : : } 817 : : - 818 : 33 : static void __mptcp_flush_join_list(struct sock *sk, struct list_head *join_list) + 818 : 31 : static void __mptcp_flush_join_list(struct sock *sk, struct list_head *join_list) 819 : : { - 820 : 33 : struct mptcp_subflow_context *tmp, *subflow; - 821 [ - + ]: 33 : struct mptcp_sock *msk = mptcp_sk(sk); + 820 : 31 : struct mptcp_subflow_context *tmp, *subflow; + 821 [ - + ]: 31 : struct mptcp_sock *msk = mptcp_sk(sk); 822 : : - 823 [ + + ]: 66 : list_for_each_entry_safe(subflow, tmp, join_list, node) { + 823 [ + + ]: 64 : list_for_each_entry_safe(subflow, tmp, join_list, node) { 824 : 33 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 825 : 33 : bool slow = lock_sock_fast(ssk); 826 : : @@ -912,51 +912,51 @@ 829 : 0 : mptcp_subflow_reset(ssk); 830 : 33 : unlock_sock_fast(ssk, slow); 831 : : } - 832 : 33 : } + 832 : 31 : } 833 : : - 834 : 268405 : static bool mptcp_rtx_timer_pending(struct sock *sk) + 834 : 268546 : static bool mptcp_rtx_timer_pending(struct sock *sk) 835 : : { - 836 : 517560 : return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); + 836 : 642142 : return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); 837 : : } 838 : : - 839 : 182280 : static void mptcp_reset_rtx_timer(struct sock *sk) + 839 : 260339 : static void mptcp_reset_rtx_timer(struct sock *sk) 840 : : { - 841 : 182280 : struct inet_connection_sock *icsk = inet_csk(sk); - 842 : 182280 : unsigned long tout; + 841 : 260339 : struct inet_connection_sock *icsk = inet_csk(sk); + 842 : 260339 : unsigned long tout; 843 : : 844 : : /* prevent rescheduling on close */ - 845 [ + + ]: 182280 : if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) + 845 [ + + ]: 260339 : if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) 846 : : return; 847 : : - 848 [ - + ]: 182220 : tout = mptcp_sk(sk)->timer_ival; - 849 : 182220 : sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout); + 848 [ - + ]: 260251 : tout = mptcp_sk(sk)->timer_ival; + 849 : 260251 : sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout); 850 : : } 851 : : - 852 : 11281 : bool mptcp_schedule_work(struct sock *sk) + 852 : 14503 : bool mptcp_schedule_work(struct sock *sk) 853 : : { - 854 [ + + + + ]: 21624 : if (inet_sk_state_load(sk) != TCP_CLOSE && - 855 [ - + + + ]: 10950 : schedule_work(&mptcp_sk(sk)->work)) { + 854 [ + + + + ]: 28083 : if (inet_sk_state_load(sk) != TCP_CLOSE && + 855 [ - + + + ]: 14188 : 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 : 9829 : sock_hold(sk); - 860 : 9829 : return true; + 859 : 12972 : sock_hold(sk); + 860 : 12972 : return true; 861 : : } 862 : : return false; 863 : : } 864 : : - 865 : 434118 : static bool mptcp_skb_can_collapse_to(u64 write_seq, + 865 : 561746 : static bool mptcp_skb_can_collapse_to(u64 write_seq, 866 : : const struct sk_buff *skb, 867 : : const struct mptcp_ext *mpext) 868 : : { - 869 [ + + ]: 434118 : if (!tcp_skb_can_collapse_to(skb)) + 869 [ + + ]: 561746 : 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 [ + - + + ]: 842224 : return mpext && mpext->data_seq + mpext->data_len == write_seq && - 876 [ + + ]: 357319 : !mpext->frozen; + 875 [ + - + + ]: 1102718 : return mpext && mpext->data_seq + mpext->data_len == write_seq && + 876 [ + + ]: 482763 : !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 : 510811 : static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk, + 884 : 610594 : 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 [ + - ]: 182181 : return df && pfrag->page == df->page && - 889 [ + + ]: 182181 : pfrag->size - pfrag->offset > 0 && - 890 [ + + + - ]: 626207 : pfrag->offset == (df->offset + df->data_len) && - 891 [ - + ]: 115396 : df->data_seq + df->data_len == msk->write_seq; + 888 [ + - ]: 231964 : return df && pfrag->page == df->page && + 889 [ + + ]: 231964 : pfrag->size - pfrag->offset > 0 && + 890 [ + + + - ]: 754176 : pfrag->offset == (df->offset + df->data_len) && + 891 [ - + ]: 143582 : df->data_seq + df->data_len == msk->write_seq; 892 : : } 893 : : - 894 : 210613 : static void dfrag_uncharge(struct sock *sk, int len) + 894 : 217934 : static void dfrag_uncharge(struct sock *sk, int len) 895 : : { - 896 : 496792 : sk_mem_uncharge(sk, len); - 897 : 496792 : sk_wmem_queued_add(sk, -len); - 898 : 101383 : } + 896 : 626762 : sk_mem_uncharge(sk, len); + 897 : 626762 : sk_wmem_queued_add(sk, -len); + 898 : 159756 : } 899 : : - 900 : 395409 : static void dfrag_clear(struct sock *sk, struct mptcp_data_frag *dfrag) + 900 : 467006 : static void dfrag_clear(struct sock *sk, struct mptcp_data_frag *dfrag) 901 : : { - 902 : 395409 : int len = dfrag->data_len + dfrag->overhead; + 902 : 467006 : int len = dfrag->data_len + dfrag->overhead; 903 : : - 904 : 395409 : list_del(&dfrag->list); - 905 : 395409 : dfrag_uncharge(sk, len); - 906 : 395409 : put_page(dfrag->page); - 907 : 395409 : } + 904 : 467006 : list_del(&dfrag->list); + 905 : 467006 : dfrag_uncharge(sk, len); + 906 : 467006 : put_page(dfrag->page); + 907 : 467006 : } 908 : : 909 : : /* called under both the msk socket lock and the data lock */ - 910 : 182530 : static void __mptcp_clean_una(struct sock *sk) + 910 : 261257 : static void __mptcp_clean_una(struct sock *sk) 911 : : { - 912 [ - + ]: 182530 : struct mptcp_sock *msk = mptcp_sk(sk); - 913 : 182530 : struct mptcp_data_frag *dtmp, *dfrag; - 914 : 182530 : u64 snd_una; + 912 [ - + ]: 261257 : struct mptcp_sock *msk = mptcp_sk(sk); + 913 : 261257 : struct mptcp_data_frag *dtmp, *dfrag; + 914 : 261257 : u64 snd_una; 915 : : - 916 : 182530 : snd_una = msk->snd_una; - 917 [ + + ]: 577892 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) { - 918 [ + + ]: 552714 : if (after64(dfrag->data_seq + dfrag->data_len, snd_una)) + 916 : 261257 : snd_una = msk->snd_una; + 917 [ + + ]: 727447 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) { + 918 [ + + ]: 691360 : if (after64(dfrag->data_seq + dfrag->data_len, snd_una)) 919 : : break; 920 : : - 921 [ - + ]: 395362 : if (unlikely(dfrag == msk->first_pending)) { + 921 [ - + ]: 466190 : 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 : 395362 : dfrag_clear(sk, dfrag); + 929 : 466190 : dfrag_clear(sk, dfrag); 930 : : } 931 : : - 932 : 182530 : dfrag = mptcp_rtx_head(sk); - 933 [ + + + + ]: 182530 : if (dfrag && after64(snd_una, dfrag->data_seq)) { - 934 : 101383 : u64 delta = snd_una - dfrag->data_seq; + 932 : 261257 : dfrag = mptcp_rtx_head(sk); + 933 [ + + + + ]: 261257 : if (dfrag && after64(snd_una, dfrag->data_seq)) { + 934 : 159756 : u64 delta = snd_una - dfrag->data_seq; 935 : : 936 : : /* prevent wrap around in recovery mode */ - 937 [ - + ]: 101383 : if (unlikely(delta > dfrag->already_sent)) { + 937 [ - + ]: 159756 : 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 : 101383 : dfrag->data_seq += delta; - 946 : 101383 : dfrag->offset += delta; - 947 : 101383 : dfrag->data_len -= delta; - 948 : 101383 : dfrag->already_sent -= delta; + 945 : 159756 : dfrag->data_seq += delta; + 946 : 159756 : dfrag->offset += delta; + 947 : 159756 : dfrag->data_len -= delta; + 948 : 159756 : dfrag->already_sent -= delta; 949 : : - 950 : 101383 : dfrag_uncharge(sk, delta); + 950 : 159756 : dfrag_uncharge(sk, delta); 951 : : } 952 : : 953 : : /* all retransmitted data acked, recovery completed */ - 954 [ + + + + : 182530 : if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) - + + ] - 955 : 27 : msk->recovery = false; + 954 [ + + + + : 261257 : if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) + + + ] + 955 : 33 : msk->recovery = false; 956 : : - 957 : 147095 : out: - 958 [ + + + + ]: 182530 : if (snd_una == msk->snd_nxt && snd_una == msk->write_seq) { - 959 [ + + + + ]: 23808 : if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) - 960 : 18018 : mptcp_stop_rtx_timer(sk); + 957 : 226987 : out: + 958 [ + + + + ]: 261257 : if (snd_una == msk->snd_nxt && snd_una == msk->write_seq) { + 959 [ + + + + ]: 34685 : if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) + 960 : 28326 : mptcp_stop_rtx_timer(sk); 961 : : } else { - 962 : 158722 : mptcp_reset_rtx_timer(sk); + 962 : 226572 : mptcp_reset_rtx_timer(sk); 963 : : } 964 : : - 965 [ + + ]: 182530 : if (mptcp_pending_data_fin_ack(sk)) - 966 : 1753 : mptcp_schedule_work(sk); - 967 : 182530 : } + 965 [ + + ]: 261257 : if (mptcp_pending_data_fin_ack(sk)) + 966 : 1715 : mptcp_schedule_work(sk); + 967 : 261257 : } 968 : : - 969 : 48984 : static void __mptcp_clean_una_wakeup(struct sock *sk) + 969 : 46525 : static void __mptcp_clean_una_wakeup(struct sock *sk) 970 : : { - 971 [ + - - + ]: 57241 : lockdep_assert_held_once(&sk->sk_lock.slock); + 971 [ + - - + ]: 62667 : lockdep_assert_held_once(&sk->sk_lock.slock); 972 : : - 973 : 57241 : __mptcp_clean_una(sk); - 974 : 41669 : mptcp_write_space(sk); - 975 : 55230 : } + 973 : 62667 : __mptcp_clean_una(sk); + 974 : 47796 : mptcp_write_space(sk); + 975 : 57488 : } 976 : : - 977 : 7511 : static void mptcp_clean_una_wakeup(struct sock *sk) + 977 : 10458 : static void mptcp_clean_una_wakeup(struct sock *sk) 978 : : { - 979 : 7511 : mptcp_data_lock(sk); - 980 : 7511 : __mptcp_clean_una_wakeup(sk); - 981 : 7511 : mptcp_data_unlock(sk); - 982 : 7511 : } + 979 : 10458 : mptcp_data_lock(sk); + 980 : 10458 : __mptcp_clean_una_wakeup(sk); + 981 : 10458 : mptcp_data_unlock(sk); + 982 : 10458 : } 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 : 395415 : static bool mptcp_page_frag_refill(struct sock *sk, struct page_frag *pfrag) + 1005 : 467012 : static bool mptcp_page_frag_refill(struct sock *sk, struct page_frag *pfrag) 1006 : : { - 1007 [ - + ]: 395415 : if (likely(skb_page_frag_refill(32U + sizeof(struct mptcp_data_frag), + 1007 [ - + ]: 467012 : 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 : 395415 : mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, + 1016 : 467012 : mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, 1017 : : int orig_offset) 1018 : : { - 1019 : 395415 : int offset = ALIGN(orig_offset, sizeof(long)); - 1020 : 395415 : struct mptcp_data_frag *dfrag; + 1019 : 467012 : int offset = ALIGN(orig_offset, sizeof(long)); + 1020 : 467012 : struct mptcp_data_frag *dfrag; 1021 : : - 1022 : 395415 : dfrag = (struct mptcp_data_frag *)(page_to_virt(pfrag->page) + offset); - 1023 : 395415 : dfrag->data_len = 0; - 1024 : 395415 : dfrag->data_seq = msk->write_seq; - 1025 : 395415 : dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); - 1026 : 395415 : dfrag->offset = offset + sizeof(struct mptcp_data_frag); - 1027 : 395415 : dfrag->already_sent = 0; - 1028 : 395415 : dfrag->page = pfrag->page; + 1022 : 467012 : dfrag = (struct mptcp_data_frag *)(page_to_virt(pfrag->page) + offset); + 1023 : 467012 : dfrag->data_len = 0; + 1024 : 467012 : dfrag->data_seq = msk->write_seq; + 1025 : 467012 : dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); + 1026 : 467012 : dfrag->offset = offset + sizeof(struct mptcp_data_frag); + 1027 : 467012 : dfrag->already_sent = 0; + 1028 : 467012 : dfrag->page = pfrag->page; 1029 : : - 1030 : 395415 : return dfrag; + 1030 : 467012 : return dfrag; 1031 : : } 1032 : : 1033 : : struct mptcp_sendmsg_info { @@ -1123,47 +1123,47 @@ 1039 : : bool data_lock_held; 1040 : : }; 1041 : : - 1042 : 544325 : static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, + 1042 : 716483 : static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, 1043 : : u64 data_seq, int avail_size) 1044 : : { - 1045 : 544325 : u64 window_end = mptcp_wnd_end(msk); - 1046 : 544325 : u64 mptcp_snd_wnd; + 1045 : 716483 : u64 window_end = mptcp_wnd_end(msk); + 1046 : 716483 : u64 mptcp_snd_wnd; 1047 : : - 1048 [ + + ]: 544325 : if (__mptcp_check_fallback(msk)) + 1048 [ + + ]: 716483 : if (__mptcp_check_fallback(msk)) 1049 : : return avail_size; 1050 : : - 1051 : 521550 : mptcp_snd_wnd = window_end - data_seq; - 1052 : 521550 : avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); + 1051 : 680560 : mptcp_snd_wnd = window_end - data_seq; + 1052 : 680560 : avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); 1053 : : - 1054 [ - + + + ]: 521550 : if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { - 1055 [ - + ]: 2454 : tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); - 1056 [ + - ]: 2454 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); + 1054 [ - + + + ]: 680560 : if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { + 1055 [ - + ]: 3650 : tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); + 1056 [ + - ]: 3650 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); 1057 : : } 1058 : : 1059 : : return avail_size; 1060 : : } 1061 : : - 1062 : 206284 : static bool __mptcp_add_ext(struct sk_buff *skb, gfp_t gfp) + 1062 : 263104 : static bool __mptcp_add_ext(struct sk_buff *skb, gfp_t gfp) 1063 : : { - 1064 : 206284 : struct skb_ext *mpext = __skb_ext_alloc(gfp); + 1064 : 263104 : struct skb_ext *mpext = __skb_ext_alloc(gfp); 1065 : : - 1066 [ + - ]: 206284 : if (!mpext) + 1066 [ + - ]: 263104 : if (!mpext) 1067 : : return false; - 1068 : 206284 : __skb_ext_set(skb, SKB_EXT_MPTCP, mpext); - 1069 : 206284 : return true; + 1068 : 263104 : __skb_ext_set(skb, SKB_EXT_MPTCP, mpext); + 1069 : 263104 : return true; 1070 : : } 1071 : : - 1072 : 206284 : static struct sk_buff *__mptcp_do_alloc_tx_skb(struct sock *sk, gfp_t gfp) + 1072 : 263104 : static struct sk_buff *__mptcp_do_alloc_tx_skb(struct sock *sk, gfp_t gfp) 1073 : : { - 1074 : 206284 : struct sk_buff *skb; + 1074 : 263104 : struct sk_buff *skb; 1075 : : - 1076 : 206284 : skb = alloc_skb_fclone(MAX_TCP_HEADER, gfp); - 1077 [ + - ]: 206284 : if (likely(skb)) { - 1078 [ + - ]: 206284 : if (likely(__mptcp_add_ext(skb, gfp))) { - 1079 : 206284 : skb_reserve(skb, MAX_TCP_HEADER); - 1080 : 206284 : skb->ip_summed = CHECKSUM_PARTIAL; - 1081 : 206284 : INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); - 1082 : 206284 : return skb; + 1076 : 263104 : skb = alloc_skb_fclone(MAX_TCP_HEADER, gfp); + 1077 [ + - ]: 263104 : if (likely(skb)) { + 1078 [ + - ]: 263104 : if (likely(__mptcp_add_ext(skb, gfp))) { + 1079 : 263104 : skb_reserve(skb, MAX_TCP_HEADER); + 1080 : 263104 : skb->ip_summed = CHECKSUM_PARTIAL; + 1081 : 263104 : INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); + 1082 : 263104 : return skb; 1083 : : } 1084 : 0 : __kfree_skb(skb); 1085 : : } else { @@ -1172,133 +1172,133 @@ 1088 : : return NULL; 1089 : : } 1090 : : - 1091 : 206284 : static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t gfp) + 1091 : 263104 : static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t gfp) 1092 : : { - 1093 : 206284 : struct sk_buff *skb; + 1093 : 263104 : struct sk_buff *skb; 1094 : : - 1095 : 206284 : skb = __mptcp_do_alloc_tx_skb(sk, gfp); - 1096 [ - + ]: 206284 : if (!skb) + 1095 : 263104 : skb = __mptcp_do_alloc_tx_skb(sk, gfp); + 1096 [ - + ]: 263104 : if (!skb) 1097 : : return NULL; 1098 : : - 1099 [ + - ]: 206284 : if (likely(sk_wmem_schedule(ssk, skb->truesize))) { - 1100 : 206284 : tcp_skb_entail(ssk, skb); - 1101 : 206284 : return skb; + 1099 [ + - ]: 263104 : if (likely(sk_wmem_schedule(ssk, skb->truesize))) { + 1100 : 263104 : tcp_skb_entail(ssk, skb); + 1101 : 263104 : return skb; 1102 : : } 1103 : 0 : tcp_skb_tsorted_anchor_cleanup(skb); 1104 : 0 : kfree_skb(skb); 1105 : 0 : return NULL; 1106 : : } 1107 : : - 1108 : 77822 : static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, bool data_lock_held) + 1108 : 79881 : static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, bool data_lock_held) 1109 : : { - 1110 : 186378 : gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation; + 1110 : 233926 : gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation; 1111 : : - 1112 : 206284 : return __mptcp_alloc_tx_skb(sk, ssk, gfp); + 1112 : 263104 : 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 : 819 : 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 [ + - ]: 819 : struct mptcp_ext *mpext = mptcp_get_ext(skb); + 1121 : 819 : __wsum csum = ~csum_unfold(mpext->csum); + 1122 : 819 : 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 [ # # ]: 819 : mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); + 1125 : 819 : } 1126 : : - 1127 : 2 : static void mptcp_update_infinite_map(struct mptcp_sock *msk, + 1127 : 1 : static void mptcp_update_infinite_map(struct mptcp_sock *msk, 1128 : : struct sock *ssk, 1129 : : struct mptcp_ext *mpext) 1130 : : { - 1131 [ + - ]: 2 : if (!mpext) + 1131 [ + - ]: 1 : if (!mpext) 1132 : : return; 1133 : : - 1134 : 2 : mpext->infinite_map = 1; - 1135 : 2 : mpext->data_len = 0; + 1134 : 1 : mpext->infinite_map = 1; + 1135 : 1 : mpext->data_len = 0; 1136 : : - 1137 [ + - ]: 2 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX); - 1138 [ - + ]: 2 : mptcp_subflow_ctx(ssk)->send_infinite_map = 0; - 1139 [ - + ]: 2 : pr_fallback(msk); - 1140 : 2 : mptcp_do_fallback(ssk); + 1137 [ + - ]: 1 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPTX); + 1138 [ - + ]: 1 : mptcp_subflow_ctx(ssk)->send_infinite_map = 0; + 1139 [ - + ]: 1 : pr_fallback(msk); + 1140 : 1 : mptcp_do_fallback(ssk); 1141 : : } 1142 : : 1143 : : #define MPTCP_MAX_GSO_SIZE (GSO_LEGACY_MAX_SIZE - (MAX_TCP_HEADER + 1)) 1144 : : - 1145 : 544326 : static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, + 1145 : 716484 : 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 : 544326 : u64 data_seq = dfrag->data_seq + info->sent; - 1150 : 544326 : int offset = dfrag->offset + info->sent; - 1151 [ - + ]: 544326 : struct mptcp_sock *msk = mptcp_sk(sk); - 1152 : 544326 : bool zero_window_probe = false; - 1153 : 544326 : struct mptcp_ext *mpext = NULL; - 1154 : 544326 : bool can_coalesce = false; - 1155 : 544326 : bool reuse_skb = true; - 1156 : 544326 : struct sk_buff *skb; - 1157 : 544326 : size_t copy; - 1158 : 544326 : int i; + 1149 : 716484 : u64 data_seq = dfrag->data_seq + info->sent; + 1150 : 716484 : int offset = dfrag->offset + info->sent; + 1151 [ - + ]: 716484 : struct mptcp_sock *msk = mptcp_sk(sk); + 1152 : 716484 : bool zero_window_probe = false; + 1153 : 716484 : struct mptcp_ext *mpext = NULL; + 1154 : 716484 : bool can_coalesce = false; + 1155 : 716484 : bool reuse_skb = true; + 1156 : 716484 : struct sk_buff *skb; + 1157 : 716484 : size_t copy; + 1158 : 716484 : int i; 1159 : : - 1160 [ - + ]: 544326 : pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u\n", + 1160 [ - + ]: 716484 : 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 [ + - - + ]: 544326 : if (WARN_ON_ONCE(info->sent > info->limit || + 1163 [ + - - + ]: 716484 : if (WARN_ON_ONCE(info->sent > info->limit || 1164 : : info->limit > dfrag->data_len)) 1165 : 0 : return 0; 1166 : : - 1167 [ + + ]: 544326 : if (unlikely(!__tcp_can_send(ssk))) + 1167 [ + + ]: 716484 : if (unlikely(!__tcp_can_send(ssk))) 1168 : : return -EAGAIN; 1169 : : 1170 : : /* compute send limit */ - 1171 [ - + ]: 544325 : if (unlikely(ssk->sk_gso_max_size > MPTCP_MAX_GSO_SIZE)) + 1171 [ - + ]: 716483 : if (unlikely(ssk->sk_gso_max_size > MPTCP_MAX_GSO_SIZE)) 1172 : 0 : ssk->sk_gso_max_size = MPTCP_MAX_GSO_SIZE; - 1173 : 544325 : info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); - 1174 : 544325 : copy = info->size_goal; + 1173 : 716483 : info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); + 1174 : 716483 : copy = info->size_goal; 1175 : : - 1176 [ + + ]: 544325 : skb = tcp_write_queue_tail(ssk); - 1177 [ + - + + ]: 451841 : if (skb && copy > skb->len) { + 1176 [ + + ]: 716483 : skb = tcp_write_queue_tail(ssk); + 1177 [ + - + + ]: 587765 : 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 [ + - ]: 434118 : mpext = mptcp_get_ext(skb); - 1185 [ + + ]: 434118 : if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { - 1186 : 91034 : TCP_SKB_CB(skb)->eor = 1; - 1187 [ - + ]: 91034 : tcp_mark_push(tcp_sk(ssk), skb); - 1188 : 91034 : goto alloc_skb; + 1184 [ + - ]: 561746 : mpext = mptcp_get_ext(skb); + 1185 [ + + ]: 561746 : if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { + 1186 : 102888 : TCP_SKB_CB(skb)->eor = 1; + 1187 [ - + ]: 102888 : tcp_mark_push(tcp_sk(ssk), skb); + 1188 : 102888 : goto alloc_skb; 1189 : : } 1190 : : - 1191 : 343084 : i = skb_shinfo(skb)->nr_frags; - 1192 : 343084 : can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); - 1193 [ + + + + ]: 343084 : if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) { - 1194 [ - + ]: 5043 : tcp_mark_push(tcp_sk(ssk), skb); - 1195 : 5043 : goto alloc_skb; + 1191 : 458858 : i = skb_shinfo(skb)->nr_frags; + 1192 : 458858 : can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); + 1193 [ + + + + ]: 458858 : if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) { + 1194 [ - + ]: 5479 : tcp_mark_push(tcp_sk(ssk), skb); + 1195 : 5479 : goto alloc_skb; 1196 : : } 1197 : : - 1198 : 338041 : copy -= skb->len; + 1198 : 453379 : copy -= skb->len; 1199 : : } else { - 1200 [ + + ]: 77822 : alloc_skb: - 1201 [ + + + + ]: 206284 : skb = mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); - 1202 [ - + ]: 206284 : if (!skb) + 1200 [ + + ]: 79881 : alloc_skb: + 1201 [ + + + + ]: 263104 : skb = mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); + 1202 [ - + ]: 263104 : if (!skb) 1203 : : return -ENOMEM; 1204 : : - 1205 [ + - ]: 206284 : i = skb_shinfo(skb)->nr_frags; - 1206 : 206284 : reuse_skb = false; - 1207 [ + - ]: 206284 : mpext = mptcp_get_ext(skb); + 1205 [ + - ]: 263104 : i = skb_shinfo(skb)->nr_frags; + 1206 : 263104 : reuse_skb = false; + 1207 [ + - ]: 263104 : mpext = mptcp_get_ext(skb); 1208 : : } 1209 : : 1210 : : /* Zero window and all data acked? Probe. */ - 1211 : 544325 : copy = mptcp_check_allowed_size(msk, ssk, data_seq, copy); - 1212 [ + + ]: 544325 : if (copy == 0) { - 1213 : 105320 : u64 snd_una = READ_ONCE(msk->snd_una); + 1211 : 716483 : copy = mptcp_check_allowed_size(msk, ssk, data_seq, copy); + 1212 [ + + ]: 716483 : if (copy == 0) { + 1213 : 170405 : u64 snd_una = READ_ONCE(msk->snd_una); 1214 : : - 1215 [ + + + - ]: 107967 : if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { - 1216 : 105320 : tcp_remove_empty_skb(ssk); - 1217 : 105320 : return 0; + 1215 [ + + + - ]: 182118 : if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { + 1216 : 170405 : tcp_remove_empty_skb(ssk); + 1217 : 170405 : return 0; 1218 : : } 1219 : : 1220 : 0 : zero_window_probe = true; @@ -1306,47 +1306,47 @@ 1222 : 0 : copy = 1; 1223 : : } 1224 : : - 1225 : 439005 : copy = min_t(size_t, copy, info->limit - info->sent); - 1226 [ - + ]: 439005 : if (!sk_wmem_schedule(ssk, copy)) { + 1225 : 546078 : copy = min_t(size_t, copy, info->limit - info->sent); + 1226 [ - + ]: 546078 : if (!sk_wmem_schedule(ssk, copy)) { 1227 : 0 : tcp_remove_empty_skb(ssk); 1228 : 0 : return -ENOMEM; 1229 : : } 1230 : : - 1231 [ + + ]: 439005 : if (can_coalesce) { - 1232 : 10098 : skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); + 1231 [ + + ]: 546078 : if (can_coalesce) { + 1232 : 31742 : skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); 1233 : : } else { - 1234 : 428907 : get_page(dfrag->page); - 1235 : 428907 : skb_fill_page_desc(skb, i, dfrag->page, offset, copy); + 1234 : 514336 : get_page(dfrag->page); + 1235 : 514336 : skb_fill_page_desc(skb, i, dfrag->page, offset, copy); 1236 : : } 1237 : : - 1238 : 439005 : skb->len += copy; - 1239 : 439005 : skb->data_len += copy; - 1240 : 439005 : skb->truesize += copy; - 1241 [ + - ]: 439005 : sk_wmem_queued_add(ssk, copy); - 1242 [ + - ]: 439005 : sk_mem_charge(ssk, copy); - 1243 [ - + - + ]: 439005 : WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); - 1244 : 439005 : TCP_SKB_CB(skb)->end_seq += copy; - 1245 [ + + ]: 439005 : tcp_skb_pcount_set(skb, 0); + 1238 : 546078 : skb->len += copy; + 1239 : 546078 : skb->data_len += copy; + 1240 : 546078 : skb->truesize += copy; + 1241 [ + - ]: 546078 : sk_wmem_queued_add(ssk, copy); + 1242 [ + - ]: 546078 : sk_mem_charge(ssk, copy); + 1243 [ - + - + ]: 546078 : WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); + 1244 : 546078 : TCP_SKB_CB(skb)->end_seq += copy; + 1245 [ + + ]: 546078 : tcp_skb_pcount_set(skb, 0); 1246 : : 1247 : : /* on skb reuse we just need to update the DSS len */ - 1248 [ + + ]: 439005 : if (reuse_skb) { - 1249 : 264580 : TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; - 1250 : 264580 : mpext->data_len += copy; - 1251 : 264580 : goto out; + 1248 [ + + ]: 546078 : if (reuse_skb) { + 1249 : 331748 : TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; + 1250 : 331748 : mpext->data_len += copy; + 1251 : 331748 : goto out; 1252 : : } 1253 : : - 1254 : 174425 : memset(mpext, 0, sizeof(*mpext)); - 1255 : 174425 : mpext->data_seq = data_seq; - 1256 [ - + ]: 174425 : mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq; - 1257 : 174425 : mpext->data_len = copy; - 1258 : 174425 : mpext->use_map = 1; - 1259 : 174425 : mpext->dsn64 = 1; + 1254 : 214330 : memset(mpext, 0, sizeof(*mpext)); + 1255 : 214330 : mpext->data_seq = data_seq; + 1256 [ - + ]: 214330 : mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq; + 1257 : 214330 : mpext->data_len = copy; + 1258 : 214330 : mpext->use_map = 1; + 1259 : 214330 : mpext->dsn64 = 1; 1260 : : - 1261 [ - + ]: 174425 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d\n", + 1261 [ - + ]: 214330 : 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 [ - + ]: 174425 : if (zero_window_probe) { + 1265 [ - + ]: 214330 : 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 : 174425 : out: - 1274 [ + + + + ]: 439005 : if (READ_ONCE(msk->csum_enabled)) - 1275 : 868 : mptcp_update_data_checksum(skb, copy); - 1276 [ + + ]: 439005 : if (mptcp_subflow_ctx(ssk)->send_infinite_map) - 1277 : 2 : mptcp_update_infinite_map(msk, ssk, mpext); - 1278 : 439005 : trace_mptcp_sendmsg_frag(mpext); - 1279 : 439005 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; - 1280 : 439005 : return copy; + 1273 : 214330 : out: + 1274 [ + + + + ]: 546078 : if (READ_ONCE(msk->csum_enabled)) + 1275 : 819 : mptcp_update_data_checksum(skb, copy); + 1276 [ + + ]: 546078 : if (mptcp_subflow_ctx(ssk)->send_infinite_map) + 1277 : 1 : mptcp_update_infinite_map(msk, ssk, mpext); + 1278 : 546078 : trace_mptcp_sendmsg_frag(mpext); + 1279 : 546078 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; + 1280 : 546078 : return copy; 1281 : : } 1282 : : 1283 : : #define MPTCP_SEND_BURST_SIZE ((1 << 16) - \ @@ -1375,26 +1375,26 @@ 1291 : : u64 linger_time; 1292 : : }; 1293 : : - 1294 : 126 : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow) + 1294 : 99 : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow) 1295 : : { - 1296 [ - + ]: 126 : if (!subflow->stale) + 1296 [ - + ]: 99 : 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 : 973316 : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) + 1303 : 1244138 : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) 1304 : : { - 1305 [ + + ]: 973316 : if (unlikely(subflow->stale)) { - 1306 [ - + ]: 96946 : u32 rcv_tstamp = READ_ONCE(tcp_sk(mptcp_subflow_tcp_sock(subflow))->rcv_tstamp); + 1305 [ + + ]: 1244138 : if (unlikely(subflow->stale)) { + 1306 [ - + ]: 119860 : u32 rcv_tstamp = READ_ONCE(tcp_sk(mptcp_subflow_tcp_sock(subflow))->rcv_tstamp); 1307 : : - 1308 [ - + ]: 96946 : if (subflow->stale_rcv_tstamp == rcv_tstamp) + 1308 [ - + ]: 119860 : if (subflow->stale_rcv_tstamp == rcv_tstamp) 1309 : : return false; 1310 : : 1311 : 0 : mptcp_subflow_set_active(subflow); 1312 : : } - 1313 : 876370 : return __mptcp_subflow_active(subflow); + 1313 : 1124278 : 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 : 314646 : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) + 1324 : 450240 : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) 1325 : : { - 1326 : 314646 : struct subflow_send_info send_info[SSK_MODE_MAX]; - 1327 : 314646 : struct mptcp_subflow_context *subflow; - 1328 : 314646 : struct sock *sk = (struct sock *)msk; - 1329 : 314646 : u32 pace, burst, wmem; - 1330 : 314646 : int i, nr_active = 0; - 1331 : 314646 : struct sock *ssk; - 1332 : 314646 : u64 linger_time; - 1333 : 314646 : long tout = 0; + 1326 : 450240 : struct subflow_send_info send_info[SSK_MODE_MAX]; + 1327 : 450240 : struct mptcp_subflow_context *subflow; + 1328 : 450240 : struct sock *sk = (struct sock *)msk; + 1329 : 450240 : u32 pace, burst, wmem; + 1330 : 450240 : int i, nr_active = 0; + 1331 : 450240 : struct sock *ssk; + 1332 : 450240 : u64 linger_time; + 1333 : 450240 : long tout = 0; 1334 : : 1335 : : /* pick the subflow with the lower wmem/wspace ratio */ - 1336 [ + + ]: 943938 : for (i = 0; i < SSK_MODE_MAX; ++i) { - 1337 : 629292 : send_info[i].ssk = NULL; - 1338 : 629292 : send_info[i].linger_time = -1; + 1336 [ + + ]: 1350720 : for (i = 0; i < SSK_MODE_MAX; ++i) { + 1337 : 900480 : send_info[i].ssk = NULL; + 1338 : 900480 : send_info[i].linger_time = -1; 1339 : : } 1340 : : - 1341 [ + + ]: 992789 : mptcp_for_each_subflow(msk, subflow) { - 1342 : 678143 : bool backup = subflow->backup || subflow->request_bkup; + 1341 [ + + ]: 1341147 : mptcp_for_each_subflow(msk, subflow) { + 1342 : 890907 : bool backup = subflow->backup || subflow->request_bkup; 1343 : : - 1344 : 678143 : trace_mptcp_subflow_get_send(subflow); - 1345 : 678143 : ssk = mptcp_subflow_tcp_sock(subflow); - 1346 [ + + ]: 678143 : if (!mptcp_subflow_active(subflow)) - 1347 : 98373 : continue; + 1344 : 890907 : trace_mptcp_subflow_get_send(subflow); + 1345 : 890907 : ssk = mptcp_subflow_tcp_sock(subflow); + 1346 [ + + ]: 890907 : if (!mptcp_subflow_active(subflow)) + 1347 : 121746 : continue; 1348 : : - 1349 [ + + ]: 579770 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); - 1350 : 579770 : nr_active += !backup; - 1351 : 579770 : pace = subflow->avg_pacing_rate; - 1352 [ + + ]: 579770 : if (unlikely(!pace)) { + 1349 [ + + ]: 769161 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); + 1350 : 769161 : nr_active += !backup; + 1351 : 769161 : pace = subflow->avg_pacing_rate; + 1352 [ + + ]: 769161 : if (unlikely(!pace)) { 1353 : : /* init pacing rate from socket */ - 1354 : 2488 : subflow->avg_pacing_rate = READ_ONCE(ssk->sk_pacing_rate); - 1355 : 2488 : pace = subflow->avg_pacing_rate; - 1356 [ - + ]: 2488 : if (!pace) + 1354 : 2490 : subflow->avg_pacing_rate = READ_ONCE(ssk->sk_pacing_rate); + 1355 : 2490 : pace = subflow->avg_pacing_rate; + 1356 [ - + ]: 2490 : if (!pace) 1357 : 0 : continue; 1358 : : } 1359 : : - 1360 [ + + ]: 579770 : linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); - 1361 [ + + ]: 579770 : if (linger_time < send_info[backup].linger_time) { - 1362 : 431096 : send_info[backup].ssk = ssk; - 1363 : 431096 : send_info[backup].linger_time = linger_time; + 1360 [ + + ]: 769161 : linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); + 1361 [ + + ]: 769161 : if (linger_time < send_info[backup].linger_time) { + 1362 : 595692 : send_info[backup].ssk = ssk; + 1363 : 595692 : send_info[backup].linger_time = linger_time; 1364 : : } 1365 : : } - 1366 : 314646 : __mptcp_set_timeout(sk, tout); + 1366 : 450240 : __mptcp_set_timeout(sk, tout); 1367 : : 1368 : : /* pick the best backup if no other subflow is active */ - 1369 [ + + ]: 314646 : if (!nr_active) - 1370 : 37964 : send_info[SSK_MODE_ACTIVE].ssk = send_info[SSK_MODE_BACKUP].ssk; + 1369 [ + + ]: 450240 : if (!nr_active) + 1370 : 39360 : 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 : 314646 : ssk = send_info[SSK_MODE_ACTIVE].ssk; - 1384 [ + + + + ]: 629279 : if (!ssk || !sk_stream_memory_free(ssk)) - 1385 : 72556 : return NULL; + 1383 : 450240 : ssk = send_info[SSK_MODE_ACTIVE].ssk; + 1384 [ + + + + ]: 900019 : if (!ssk || !sk_stream_memory_free(ssk)) + 1385 : 96012 : return NULL; 1386 : : - 1387 : 242090 : burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); - 1388 : 242090 : wmem = READ_ONCE(ssk->sk_wmem_queued); - 1389 [ + + ]: 242090 : if (!burst) + 1387 : 354228 : burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); + 1388 : 354228 : wmem = READ_ONCE(ssk->sk_wmem_queued); + 1389 [ + + ]: 354228 : if (!burst) 1390 : : return ssk; 1391 : : - 1392 : 162757 : subflow = mptcp_subflow_ctx(ssk); - 1393 : 162757 : subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem + - 1394 : 162757 : READ_ONCE(ssk->sk_pacing_rate) * burst, + 1392 : 240084 : subflow = mptcp_subflow_ctx(ssk); + 1393 : 240084 : subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem + + 1394 : 240084 : READ_ONCE(ssk->sk_pacing_rate) * burst, 1395 : : burst + wmem); - 1396 : 162757 : msk->snd_burst = burst; - 1397 : 162757 : return ssk; + 1396 : 240084 : msk->snd_burst = burst; + 1397 : 240084 : return ssk; 1398 : : } 1399 : : - 1400 : 445325 : static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info) + 1400 : 509350 : static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info) 1401 : : { - 1402 [ - + ]: 445325 : tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); - 1403 : 445325 : release_sock(ssk); - 1404 : 445325 : } + 1402 [ - + ]: 509350 : tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); + 1403 : 509350 : release_sock(ssk); + 1404 : 509350 : } 1405 : : - 1406 : 435272 : static void mptcp_update_post_push(struct mptcp_sock *msk, + 1406 : 542578 : static void mptcp_update_post_push(struct mptcp_sock *msk, 1407 : : struct mptcp_data_frag *dfrag, 1408 : : u32 sent) 1409 : : { - 1410 : 435272 : u64 snd_nxt_new = dfrag->data_seq; + 1410 : 542578 : u64 snd_nxt_new = dfrag->data_seq; 1411 : : - 1412 : 435272 : dfrag->already_sent += sent; + 1412 : 542578 : dfrag->already_sent += sent; 1413 : : - 1414 : 435272 : msk->snd_burst -= sent; + 1414 : 542578 : msk->snd_burst -= sent; 1415 : : - 1416 : 435272 : snd_nxt_new += dfrag->already_sent; + 1416 : 542578 : 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 [ + + ]: 435272 : if (likely(after64(snd_nxt_new, msk->snd_nxt))) { - 1428 : 430643 : msk->bytes_sent += snd_nxt_new - msk->snd_nxt; - 1429 : 430643 : WRITE_ONCE(msk->snd_nxt, snd_nxt_new); + 1427 [ + + ]: 542578 : if (likely(after64(snd_nxt_new, msk->snd_nxt))) { + 1428 : 536614 : msk->bytes_sent += snd_nxt_new - msk->snd_nxt; + 1429 : 536614 : WRITE_ONCE(msk->snd_nxt, snd_nxt_new); 1430 : : } - 1431 : 435272 : } + 1431 : 542578 : } 1432 : : - 1433 : 6755 : void mptcp_check_and_set_pending(struct sock *sk) + 1433 : 9635 : void mptcp_check_and_set_pending(struct sock *sk) 1434 : : { - 1435 [ + + ]: 6755 : if (mptcp_send_head(sk)) { - 1436 : 640 : mptcp_data_lock(sk); - 1437 [ - + ]: 640 : mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); - 1438 : 640 : mptcp_data_unlock(sk); + 1435 [ + + ]: 9635 : if (mptcp_send_head(sk)) { + 1436 : 2144 : mptcp_data_lock(sk); + 1437 [ - + ]: 2144 : mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); + 1438 : 2144 : mptcp_data_unlock(sk); 1439 : : } - 1440 : 6755 : } + 1440 : 9635 : } 1441 : : - 1442 : 498123 : static int __subflow_push_pending(struct sock *sk, struct sock *ssk, + 1442 : 621376 : static int __subflow_push_pending(struct sock *sk, struct sock *ssk, 1443 : : struct mptcp_sendmsg_info *info) 1444 : : { - 1445 [ - + ]: 498123 : struct mptcp_sock *msk = mptcp_sk(sk); - 1446 : 334905 : struct mptcp_data_frag *dfrag; - 1447 : 334905 : int len, copied = 0, err = 0; + 1445 [ - + ]: 621376 : struct mptcp_sock *msk = mptcp_sk(sk); + 1446 : 342398 : struct mptcp_data_frag *dfrag; + 1447 : 342398 : int len, copied = 0, err = 0; 1448 : : - 1449 [ + + ]: 709093 : while ((dfrag = mptcp_send_head(sk))) { - 1450 : 504962 : info->sent = dfrag->already_sent; - 1451 : 504962 : info->limit = dfrag->data_len; - 1452 : 504962 : len = dfrag->data_len - dfrag->already_sent; - 1453 [ + + ]: 940234 : while (len > 0) { - 1454 : 540593 : int ret = 0; + 1449 [ + + ]: 890158 : while ((dfrag = mptcp_send_head(sk))) { + 1450 : 642901 : info->sent = dfrag->already_sent; + 1451 : 642901 : info->limit = dfrag->data_len; + 1452 : 642901 : len = dfrag->data_len - dfrag->already_sent; + 1453 [ + + ]: 1185479 : while (len > 0) { + 1454 : 712984 : int ret = 0; 1455 : : - 1456 : 540593 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info); - 1457 [ + + ]: 540593 : if (ret <= 0) { - 1458 [ + + ]: 105321 : err = copied ? : ret; - 1459 : 105321 : goto out; + 1456 : 712984 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info); + 1457 [ + + ]: 712984 : if (ret <= 0) { + 1458 [ + + ]: 170406 : err = copied ? : ret; + 1459 : 170406 : goto out; 1460 : : } 1461 : : - 1462 : 435272 : info->sent += ret; - 1463 : 435272 : copied += ret; - 1464 : 435272 : len -= ret; + 1462 : 542578 : info->sent += ret; + 1463 : 542578 : copied += ret; + 1464 : 542578 : len -= ret; 1465 : : - 1466 : 435272 : mptcp_update_post_push(msk, dfrag, ret); + 1466 : 542578 : mptcp_update_post_push(msk, dfrag, ret); 1467 : : } - 1468 : 399641 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); + 1468 : 472495 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); 1469 : : - 1470 [ + + + + ]: 559803 : if (msk->snd_burst <= 0 || - 1471 [ + + - + ]: 268243 : !sk_stream_memory_free(ssk) || - 1472 : 210970 : !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { - 1473 : 188671 : err = copied; - 1474 : 188671 : goto out; + 1470 [ + + + + ]: 684910 : if (msk->snd_burst <= 0 || + 1471 [ + + - + ]: 333701 : !sk_stream_memory_free(ssk) || + 1472 : 268782 : !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { + 1473 : 203713 : err = copied; + 1474 : 203713 : goto out; 1475 : : } - 1476 : 210970 : mptcp_set_timeout(sk); + 1476 : 268782 : mptcp_set_timeout(sk); 1477 : : } 1478 : : err = copied; 1479 : : - 1480 : 498123 : out: - 1481 [ + + ]: 498123 : if (err > 0) - 1482 : 370631 : msk->last_data_sent = tcp_jiffies32; - 1483 : 498123 : return err; + 1480 : 621376 : out: + 1481 [ + + ]: 621376 : if (err > 0) + 1482 : 454924 : msk->last_data_sent = tcp_jiffies32; + 1483 : 621376 : return err; 1484 : : } 1485 : : - 1486 : 461014 : void __mptcp_push_pending(struct sock *sk, unsigned int flags) + 1486 : 542806 : void __mptcp_push_pending(struct sock *sk, unsigned int flags) 1487 : : { - 1488 : 461014 : struct sock *prev_ssk = NULL, *ssk = NULL; - 1489 [ - + ]: 461014 : struct mptcp_sock *msk = mptcp_sk(sk); - 1490 : 461014 : struct mptcp_sendmsg_info info = { + 1488 : 542806 : struct sock *prev_ssk = NULL, *ssk = NULL; + 1489 [ - + ]: 542806 : struct mptcp_sock *msk = mptcp_sk(sk); + 1490 : 542806 : struct mptcp_sendmsg_info info = { 1491 : : .flags = flags, 1492 : : }; - 1493 : 461014 : bool do_check_data_fin = false; - 1494 : 461014 : int push_count = 1; + 1493 : 542806 : bool do_check_data_fin = false; + 1494 : 542806 : int push_count = 1; 1495 : : - 1496 [ + + + + ]: 875332 : while (mptcp_send_head(sk) && (push_count > 0)) { - 1497 : 463652 : struct mptcp_subflow_context *subflow; - 1498 : 463652 : int ret = 0; + 1496 [ + + + + ]: 1025486 : while (mptcp_send_head(sk) && (push_count > 0)) { + 1497 : 549269 : struct mptcp_subflow_context *subflow; + 1498 : 549269 : int ret = 0; 1499 : : - 1500 [ + + ]: 463652 : if (mptcp_sched_get_send(msk)) + 1500 [ + + ]: 549269 : if (mptcp_sched_get_send(msk)) 1501 : : break; 1502 : : - 1503 : 414318 : push_count = 0; + 1503 : 482680 : push_count = 0; 1504 : : - 1505 [ + + ]: 1205722 : mptcp_for_each_subflow(msk, subflow) { - 1506 [ + + + + ]: 791404 : if (READ_ONCE(subflow->scheduled)) { - 1507 : 456139 : mptcp_subflow_set_scheduled(subflow, false); + 1505 [ + + ]: 1338408 : mptcp_for_each_subflow(msk, subflow) { + 1506 [ + + + + ]: 855728 : if (READ_ONCE(subflow->scheduled)) { + 1507 : 524502 : mptcp_subflow_set_scheduled(subflow, false); 1508 : : - 1509 : 456139 : prev_ssk = ssk; - 1510 [ + + ]: 456139 : ssk = mptcp_subflow_tcp_sock(subflow); - 1511 [ + + ]: 456139 : if (ssk != prev_ssk) { + 1509 : 524502 : prev_ssk = ssk; + 1510 [ + + ]: 524502 : ssk = mptcp_subflow_tcp_sock(subflow); + 1511 [ + + ]: 524502 : if (ssk != prev_ssk) { 1512 : : /* First check. If the ssk has changed since 1513 : : * the last round, release prev_ssk 1514 : : */ - 1515 [ + + ]: 445325 : if (prev_ssk) - 1516 : 44224 : mptcp_push_release(prev_ssk, &info); + 1515 [ + + ]: 509350 : if (prev_ssk) + 1516 : 44227 : 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 : 445325 : lock_sock(ssk); + 1522 : 509350 : lock_sock(ssk); 1523 : : } 1524 : : - 1525 : 456139 : push_count++; + 1525 : 524502 : push_count++; 1526 : : - 1527 : 456139 : ret = __subflow_push_pending(sk, ssk, &info); - 1528 [ + + ]: 456139 : if (ret <= 0) { - 1529 [ + + + - ]: 112180 : if (ret != -EAGAIN || - 1530 [ - + ]: 1 : (1 << ssk->sk_state) & + 1527 : 524502 : ret = __subflow_push_pending(sk, ssk, &info); + 1528 [ + + ]: 524502 : if (ret <= 0) { + 1529 [ + + - - ]: 126208 : if (ret != -EAGAIN || + 1530 [ + - ]: 1 : (1 << ssk->sk_state) & 1531 : : (TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSE)) - 1532 : 55839 : push_count--; - 1533 : 112179 : continue; + 1532 : 77483 : push_count--; + 1533 : 126208 : 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 [ + + ]: 461014 : if (ssk) - 1542 : 401101 : mptcp_push_release(ssk, &info); + 1541 [ + + ]: 542806 : if (ssk) + 1542 : 465123 : mptcp_push_release(ssk, &info); 1543 : : 1544 : : /* ensure the rtx timer is running */ - 1545 [ + + ]: 461014 : if (!mptcp_rtx_timer_pending(sk)) - 1546 : 21810 : mptcp_reset_rtx_timer(sk); - 1547 [ + + ]: 461014 : if (do_check_data_fin) - 1548 : 331492 : mptcp_check_send_data_fin(sk); - 1549 : 461014 : } + 1545 [ + + ]: 542806 : if (!mptcp_rtx_timer_pending(sk)) + 1546 : 32019 : mptcp_reset_rtx_timer(sk); + 1547 [ + + ]: 542806 : if (do_check_data_fin) + 1548 : 382667 : mptcp_check_send_data_fin(sk); + 1549 : 542806 : } 1550 : : - 1551 : 67998 : static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) + 1551 : 104049 : static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) 1552 : : { - 1553 [ - + ]: 67998 : struct mptcp_sock *msk = mptcp_sk(sk); - 1554 : 67998 : struct mptcp_sendmsg_info info = { + 1553 [ - + ]: 104049 : struct mptcp_sock *msk = mptcp_sk(sk); + 1554 : 104049 : struct mptcp_sendmsg_info info = { 1555 : : .data_lock_held = true, 1556 : : }; - 1557 : 67998 : bool keep_pushing = true; - 1558 : 67998 : struct sock *xmit_ssk; - 1559 : 67998 : int copied = 0; + 1557 : 104049 : bool keep_pushing = true; + 1558 : 104049 : struct sock *xmit_ssk; + 1559 : 104049 : int copied = 0; 1560 : : - 1561 : 67998 : info.flags = 0; - 1562 [ + + + + ]: 112687 : while (mptcp_send_head(sk) && keep_pushing) { - 1563 [ + + ]: 92305 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1564 : 92305 : int ret = 0; + 1561 : 104049 : info.flags = 0; + 1562 [ + + + + ]: 204328 : while (mptcp_send_head(sk) && keep_pushing) { + 1563 [ + + ]: 158046 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1564 : 158046 : int ret = 0; 1565 : : 1566 : : /* check for a different subflow usage only after 1567 : : * spooling the first chunk of data 1568 : : */ - 1569 [ + + ]: 92305 : if (first) { - 1570 : 3722 : mptcp_subflow_set_scheduled(subflow, false); - 1571 : 3722 : ret = __subflow_push_pending(sk, ssk, &info); - 1572 : 3722 : first = false; - 1573 [ + + ]: 3722 : if (ret <= 0) + 1569 [ + + ]: 158046 : if (first) { + 1570 : 4100 : mptcp_subflow_set_scheduled(subflow, false); + 1571 : 4100 : ret = __subflow_push_pending(sk, ssk, &info); + 1572 : 4100 : first = false; + 1573 [ + + ]: 4100 : if (ret <= 0) 1574 : : break; - 1575 : 2025 : copied += ret; - 1576 : 2025 : continue; + 1575 : 2607 : copied += ret; + 1576 : 2607 : continue; 1577 : : } 1578 : : - 1579 [ + + ]: 88583 : if (mptcp_sched_get_send(msk)) - 1580 : 45919 : goto out; + 1579 [ + + ]: 153946 : if (mptcp_sched_get_send(msk)) + 1580 : 56274 : goto out; 1581 : : - 1582 [ + + + + ]: 42664 : if (READ_ONCE(subflow->scheduled)) { - 1583 : 38262 : mptcp_subflow_set_scheduled(subflow, false); - 1584 : 38262 : ret = __subflow_push_pending(sk, ssk, &info); - 1585 [ + + ]: 38262 : if (ret <= 0) - 1586 : 13616 : keep_pushing = false; - 1587 : 38262 : copied += ret; + 1582 [ + + + + ]: 97672 : if (READ_ONCE(subflow->scheduled)) { + 1583 : 92774 : mptcp_subflow_set_scheduled(subflow, false); + 1584 : 92774 : ret = __subflow_push_pending(sk, ssk, &info); + 1585 [ + + ]: 92774 : if (ret <= 0) + 1586 : 38751 : keep_pushing = false; + 1587 : 92774 : copied += ret; 1588 : : } 1589 : : - 1590 [ + + ]: 117170 : mptcp_for_each_subflow(msk, subflow) { - 1591 [ + + + + ]: 74506 : if (READ_ONCE(subflow->scheduled)) { - 1592 [ + - ]: 4402 : xmit_ssk = mptcp_subflow_tcp_sock(subflow); - 1593 [ + - ]: 4402 : if (xmit_ssk != ssk) { - 1594 : 4402 : mptcp_subflow_delegate(subflow, + 1590 [ + + ]: 245833 : mptcp_for_each_subflow(msk, subflow) { + 1591 [ + + + + ]: 148161 : if (READ_ONCE(subflow->scheduled)) { + 1592 [ + - ]: 4898 : xmit_ssk = mptcp_subflow_tcp_sock(subflow); + 1593 [ + - ]: 4898 : if (xmit_ssk != ssk) { + 1594 : 4898 : mptcp_subflow_delegate(subflow, 1595 : : MPTCP_DELEGATE_SEND); - 1596 : 4402 : keep_pushing = false; + 1596 : 4898 : keep_pushing = false; 1597 : : } 1598 : : } 1599 : : } 1600 : : } 1601 : : - 1602 : 22079 : out: + 1602 : 47775 : 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 [ + + ]: 67998 : if (copied) { - 1607 [ - + ]: 23113 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + 1606 [ + + ]: 104049 : if (copied) { + 1607 [ - + ]: 52127 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, 1608 : : info.size_goal); - 1609 [ + + ]: 23113 : if (!mptcp_rtx_timer_pending(sk)) - 1610 : 33 : mptcp_reset_rtx_timer(sk); + 1609 [ + + ]: 52127 : if (!mptcp_rtx_timer_pending(sk)) + 1610 : 64 : mptcp_reset_rtx_timer(sk); 1611 : : - 1612 [ + + + + ]: 23113 : if (msk->snd_data_fin_enable && - 1613 [ + + ]: 4196 : msk->snd_nxt + 1 == msk->write_seq) - 1614 : 242 : mptcp_schedule_work(sk); + 1612 [ + + + + ]: 52127 : if (msk->snd_data_fin_enable && + 1613 [ + + ]: 6217 : msk->snd_nxt + 1 == msk->write_seq) + 1614 : 247 : mptcp_schedule_work(sk); 1615 : : } - 1616 : 67998 : } + 1616 : 104049 : } 1617 : : 1618 : : static int mptcp_disconnect(struct sock *sk, int flags); 1619 : : @@ -1759,13 +1759,13 @@ 1675 : 82 : return ret; 1676 : : } 1677 : : - 1678 : 510811 : static int do_copy_data_nocache(struct sock *sk, int copy, + 1678 : 610594 : static int do_copy_data_nocache(struct sock *sk, int copy, 1679 : : struct iov_iter *from, char *to) 1680 : : { - 1681 [ - + ]: 510811 : if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { + 1681 [ - + ]: 610594 : 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 [ - + ]: 510811 : } else if (!copy_from_iter_full(to, copy, from)) { + 1684 [ - + ]: 610594 : } 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 : 512794 : static u32 mptcp_send_limit(const struct sock *sk) + 1695 : 612607 : static u32 mptcp_send_limit(const struct sock *sk) 1696 : : { - 1697 [ - + ]: 512794 : const struct mptcp_sock *msk = mptcp_sk(sk); - 1698 : 512794 : u32 limit, not_sent; + 1697 [ - + ]: 612607 : const struct mptcp_sock *msk = mptcp_sk(sk); + 1698 : 612607 : u32 limit, not_sent; 1699 : : - 1700 [ + + ]: 512794 : if (sk->sk_wmem_queued >= READ_ONCE(sk->sk_sndbuf)) + 1700 [ + + ]: 612607 : if (sk->sk_wmem_queued >= READ_ONCE(sk->sk_sndbuf)) 1701 : : return 0; 1702 : : - 1703 : 510811 : limit = mptcp_notsent_lowat(sk); - 1704 [ - + ]: 510811 : if (limit == UINT_MAX) + 1703 : 610594 : limit = mptcp_notsent_lowat(sk); + 1704 [ - + ]: 610594 : 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 : 442977 : static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + 1714 : 521353 : static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 1715 : : { - 1716 [ - + ]: 442977 : struct mptcp_sock *msk = mptcp_sk(sk); - 1717 : 442977 : struct page_frag *pfrag; - 1718 : 442977 : size_t copied = 0; - 1719 : 442977 : int ret = 0; - 1720 : 442977 : long timeo; + 1716 [ - + ]: 521353 : struct mptcp_sock *msk = mptcp_sk(sk); + 1717 : 521353 : struct page_frag *pfrag; + 1718 : 521353 : size_t copied = 0; + 1719 : 521353 : int ret = 0; + 1720 : 521353 : long timeo; 1721 : : 1722 : : /* silently ignore everything else */ - 1723 : 442977 : msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_FASTOPEN; + 1723 : 521353 : msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_FASTOPEN; 1724 : : - 1725 : 442977 : lock_sock(sk); + 1725 : 521353 : lock_sock(sk); 1726 : : - 1727 [ + + + + ]: 442977 : if (unlikely(inet_test_bit(DEFER_CONNECT, sk) || + 1727 [ + + + + ]: 521353 : if (unlikely(inet_test_bit(DEFER_CONNECT, sk) || 1728 : : msg->msg_flags & MSG_FASTOPEN)) { 1729 : 88 : int copied_syn = 0; 1730 : : @@ -1820,329 +1820,329 @@ 1736 : 24 : goto do_error; 1737 : : } 1738 : : - 1739 [ + + ]: 442911 : timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); + 1739 [ + + ]: 521287 : timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); 1740 : : - 1741 [ + + + + ]: 442911 : if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { - 1742 : 55 : ret = sk_stream_wait_connect(sk, &timeo); - 1743 [ + - ]: 55 : if (ret) - 1744 : 55 : goto do_error; + 1741 [ + + + + ]: 521287 : if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { + 1742 : 56 : ret = sk_stream_wait_connect(sk, &timeo); + 1743 [ + - ]: 56 : if (ret) + 1744 : 56 : goto do_error; 1745 : : } 1746 : : - 1747 : 442856 : ret = -EPIPE; - 1748 [ + - - + ]: 442856 : if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) + 1747 : 521231 : ret = -EPIPE; + 1748 [ + - - + ]: 521231 : if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) 1749 : 0 : goto do_error; 1750 : : - 1751 [ + - ]: 442856 : pfrag = sk_page_frag(sk); + 1751 [ + - ]: 521231 : pfrag = sk_page_frag(sk); 1752 : : - 1753 [ + + ]: 955650 : while (msg_data_left(msg)) { - 1754 : 512794 : int total_ts, frag_truesize = 0; - 1755 : 512794 : struct mptcp_data_frag *dfrag; - 1756 : 512794 : bool dfrag_collapsed; - 1757 : 512794 : size_t psize, offset; - 1758 : 512794 : u32 copy_limit; + 1753 [ + + ]: 1133838 : while (msg_data_left(msg)) { + 1754 : 612607 : int total_ts, frag_truesize = 0; + 1755 : 612607 : struct mptcp_data_frag *dfrag; + 1756 : 612607 : bool dfrag_collapsed; + 1757 : 612607 : size_t psize, offset; + 1758 : 612607 : u32 copy_limit; 1759 : : 1760 : : /* ensure fitting the notsent_lowat() constraint */ - 1761 : 512794 : copy_limit = mptcp_send_limit(sk); - 1762 [ + + ]: 512794 : if (!copy_limit) - 1763 : 1983 : goto wait_for_memory; + 1761 : 612607 : copy_limit = mptcp_send_limit(sk); + 1762 [ + + ]: 612607 : if (!copy_limit) + 1763 : 2013 : goto wait_for_memory; 1764 : : 1765 : : /* reuse tail pfrag, if possible, or carve a new one from the 1766 : : * page allocator 1767 : : */ - 1768 : 510811 : dfrag = mptcp_pending_tail(sk); - 1769 : 510811 : dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); - 1770 [ + + ]: 510811 : if (!dfrag_collapsed) { - 1771 [ - + ]: 395415 : if (!mptcp_page_frag_refill(sk, pfrag)) + 1768 : 610594 : dfrag = mptcp_pending_tail(sk); + 1769 : 610594 : dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); + 1770 [ + + ]: 610594 : if (!dfrag_collapsed) { + 1771 [ - + ]: 467012 : if (!mptcp_page_frag_refill(sk, pfrag)) 1772 : 0 : goto wait_for_memory; 1773 : : - 1774 : 395415 : dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); - 1775 : 395415 : frag_truesize = dfrag->overhead; + 1774 : 467012 : dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); + 1775 : 467012 : 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 : 510811 : offset = dfrag->offset + dfrag->data_len; - 1783 : 510811 : psize = pfrag->size - offset; - 1784 : 510811 : psize = min_t(size_t, psize, msg_data_left(msg)); - 1785 : 510811 : psize = min_t(size_t, psize, copy_limit); - 1786 : 510811 : total_ts = psize + frag_truesize; + 1782 : 610594 : offset = dfrag->offset + dfrag->data_len; + 1783 : 610594 : psize = pfrag->size - offset; + 1784 : 610594 : psize = min_t(size_t, psize, msg_data_left(msg)); + 1785 : 610594 : psize = min_t(size_t, psize, copy_limit); + 1786 : 610594 : total_ts = psize + frag_truesize; 1787 : : - 1788 [ - + ]: 510811 : if (!sk_wmem_schedule(sk, total_ts)) + 1788 [ - + ]: 610594 : if (!sk_wmem_schedule(sk, total_ts)) 1789 : 0 : goto wait_for_memory; 1790 : : - 1791 : 772541 : ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, - 1792 : 510811 : page_address(dfrag->page) + offset); - 1793 [ - + ]: 510811 : if (ret) + 1791 : 872245 : ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, + 1792 : 610594 : page_address(dfrag->page) + offset); + 1793 [ - + ]: 610594 : if (ret) 1794 : 0 : goto do_error; 1795 : : 1796 : : /* data successfully copied into the write queue */ - 1797 [ + + ]: 510811 : sk_forward_alloc_add(sk, -total_ts); - 1798 : 510811 : copied += psize; - 1799 : 510811 : dfrag->data_len += psize; - 1800 : 510811 : frag_truesize += psize; - 1801 : 510811 : pfrag->offset += frag_truesize; - 1802 : 510811 : WRITE_ONCE(msk->write_seq, msk->write_seq + psize); + 1797 [ + + ]: 610594 : sk_forward_alloc_add(sk, -total_ts); + 1798 : 610594 : copied += psize; + 1799 : 610594 : dfrag->data_len += psize; + 1800 : 610594 : frag_truesize += psize; + 1801 : 610594 : pfrag->offset += frag_truesize; + 1802 : 610594 : 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 [ + + ]: 510811 : sk_wmem_queued_add(sk, frag_truesize); - 1808 [ + + ]: 510811 : if (!dfrag_collapsed) { - 1809 : 395415 : get_page(dfrag->page); - 1810 [ + + ]: 395415 : list_add_tail(&dfrag->list, &msk->rtx_queue); - 1811 [ + + ]: 395415 : if (!msk->first_pending) - 1812 : 328630 : WRITE_ONCE(msk->first_pending, dfrag); + 1807 [ + + ]: 610594 : sk_wmem_queued_add(sk, frag_truesize); + 1808 [ + + ]: 610594 : if (!dfrag_collapsed) { + 1809 : 467012 : get_page(dfrag->page); + 1810 [ + + ]: 467012 : list_add_tail(&dfrag->list, &msk->rtx_queue); + 1811 [ + + ]: 467012 : if (!msk->first_pending) + 1812 : 378630 : WRITE_ONCE(msk->first_pending, dfrag); 1813 : : } - 1814 [ - + ]: 510811 : pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d\n", msk, + 1814 [ - + ]: 610594 : 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 : 510811 : continue; + 1818 : 610594 : continue; 1819 : : - 1820 : 1983 : wait_for_memory: - 1821 : 1983 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - 1822 : 1983 : __mptcp_push_pending(sk, msg->msg_flags); - 1823 : 1983 : ret = sk_stream_wait_memory(sk, &timeo); - 1824 [ - + ]: 1983 : if (ret) + 1820 : 2013 : wait_for_memory: + 1821 : 2013 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + 1822 : 2013 : __mptcp_push_pending(sk, msg->msg_flags); + 1823 : 2013 : ret = sk_stream_wait_memory(sk, &timeo); + 1824 [ - + ]: 2013 : if (ret) 1825 : 0 : goto do_error; 1826 : : } 1827 : : - 1828 [ + + ]: 442856 : if (copied) - 1829 : 442832 : __mptcp_push_pending(sk, msg->msg_flags); + 1828 [ + + ]: 521231 : if (copied) + 1829 : 521206 : __mptcp_push_pending(sk, msg->msg_flags); 1830 : : - 1831 : 24 : out: - 1832 : 442977 : release_sock(sk); - 1833 : 442977 : return copied; + 1831 : 25 : out: + 1832 : 521353 : release_sock(sk); + 1833 : 521353 : return copied; 1834 : : - 1835 : 79 : do_error: - 1836 [ - + ]: 79 : if (copied) + 1835 : 80 : do_error: + 1836 [ - + ]: 80 : if (copied) 1837 : 0 : goto out; 1838 : : - 1839 : 79 : copied = sk_stream_error(sk, msg->msg_flags, ret); - 1840 : 79 : goto out; + 1839 : 80 : copied = sk_stream_error(sk, msg->msg_flags, ret); + 1840 : 80 : goto out; 1841 : : } 1842 : : 1843 : : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied); 1844 : : - 1845 : 565071 : static int __mptcp_recvmsg_mskq(struct sock *sk, + 1845 : 657083 : 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 [ - + ]: 565071 : struct mptcp_sock *msk = mptcp_sk(sk); - 1852 : 565071 : struct sk_buff *skb, *tmp; - 1853 : 565071 : int copied = 0; + 1851 [ - + ]: 657083 : struct mptcp_sock *msk = mptcp_sk(sk); + 1852 : 657083 : struct sk_buff *skb, *tmp; + 1853 : 657083 : int copied = 0; 1854 : : - 1855 [ + + ]: 726041 : skb_queue_walk_safe(&sk->sk_receive_queue, skb, tmp) { - 1856 : 591402 : u32 offset = MPTCP_SKB_CB(skb)->offset; - 1857 : 591402 : u32 data_len = skb->len - offset; - 1858 : 591402 : u32 count = min_t(size_t, len - copied, data_len); - 1859 : 591402 : int err; + 1855 [ + + ]: 851992 : skb_queue_walk_safe(&sk->sk_receive_queue, skb, tmp) { + 1856 : 702340 : u32 offset = MPTCP_SKB_CB(skb)->offset; + 1857 : 702340 : u32 data_len = skb->len - offset; + 1858 : 702340 : u32 count = min_t(size_t, len - copied, data_len); + 1859 : 702340 : int err; 1860 : : - 1861 [ + - ]: 591402 : if (!(flags & MSG_TRUNC)) { - 1862 : 591402 : err = skb_copy_datagram_msg(skb, offset, msg, count); - 1863 [ - + ]: 591402 : if (unlikely(err < 0)) { + 1861 [ + - ]: 702340 : if (!(flags & MSG_TRUNC)) { + 1862 : 702340 : err = skb_copy_datagram_msg(skb, offset, msg, count); + 1863 [ - + ]: 702340 : if (unlikely(err < 0)) { 1864 [ # # ]: 0 : if (!copied) 1865 : : return err; 1866 : : break; 1867 : : } 1868 : : } 1869 : : - 1870 [ + + ]: 591402 : if (MPTCP_SKB_CB(skb)->has_rxtstamp) { + 1870 [ + + ]: 702340 : 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 : 591402 : copied += count; + 1875 : 702340 : copied += count; 1876 : : - 1877 [ + + ]: 591402 : if (count < data_len) { - 1878 [ + + ]: 381371 : if (!(flags & MSG_PEEK)) { - 1879 : 369578 : MPTCP_SKB_CB(skb)->offset += count; - 1880 : 369578 : MPTCP_SKB_CB(skb)->map_seq += count; - 1881 : 369578 : msk->bytes_consumed += count; + 1877 [ + + ]: 702340 : if (count < data_len) { + 1878 [ + + ]: 449175 : if (!(flags & MSG_PEEK)) { + 1879 : 432437 : MPTCP_SKB_CB(skb)->offset += count; + 1880 : 432437 : MPTCP_SKB_CB(skb)->map_seq += count; + 1881 : 432437 : msk->bytes_consumed += count; 1882 : : } 1883 : : break; 1884 : : } 1885 : : - 1886 [ + + ]: 210031 : if (!(flags & MSG_PEEK)) { + 1886 [ + + ]: 253165 : if (!(flags & MSG_PEEK)) { 1887 : : /* avoid the indirect call, we know the destructor is sock_wfree */ - 1888 : 208507 : skb->destructor = NULL; - 1889 : 208507 : atomic_sub(skb->truesize, &sk->sk_rmem_alloc); - 1890 : 208507 : sk_mem_uncharge(sk, skb->truesize); - 1891 : 208507 : __skb_unlink(skb, &sk->sk_receive_queue); - 1892 : 208507 : __kfree_skb(skb); - 1893 : 208507 : msk->bytes_consumed += count; + 1888 : 250946 : skb->destructor = NULL; + 1889 : 250946 : atomic_sub(skb->truesize, &sk->sk_rmem_alloc); + 1890 : 250946 : sk_mem_uncharge(sk, skb->truesize); + 1891 : 250946 : __skb_unlink(skb, &sk->sk_receive_queue); + 1892 : 250946 : __kfree_skb(skb); + 1893 : 250946 : msk->bytes_consumed += count; 1894 : : } 1895 : : - 1896 [ + + ]: 210031 : if (copied >= len) + 1896 [ + + ]: 253165 : if (copied >= len) 1897 : : break; 1898 : : } 1899 : : - 1900 : 565071 : mptcp_rcv_space_adjust(msk, copied); - 1901 : 565071 : return copied; + 1900 : 657083 : mptcp_rcv_space_adjust(msk, copied); + 1901 : 657083 : 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 : 565071 : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) + 1908 : 657083 : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) 1909 : : { - 1910 : 565071 : struct mptcp_subflow_context *subflow; - 1911 : 565071 : struct sock *sk = (struct sock *)msk; - 1912 : 565071 : u8 scaling_ratio = U8_MAX; - 1913 : 565071 : u32 time, advmss = 1; - 1914 : 565071 : u64 rtt_us, mstamp; + 1910 : 657083 : struct mptcp_subflow_context *subflow; + 1911 : 657083 : struct sock *sk = (struct sock *)msk; + 1912 : 657083 : u8 scaling_ratio = U8_MAX; + 1913 : 657083 : u32 time, advmss = 1; + 1914 : 657083 : u64 rtt_us, mstamp; 1915 : : - 1916 : 565071 : msk_owned_by_me(msk); + 1916 : 657083 : msk_owned_by_me(msk); 1917 : : - 1918 [ + + ]: 565071 : if (copied <= 0) + 1918 [ + + ]: 657083 : if (copied <= 0) 1919 : : return; 1920 : : - 1921 [ - + ]: 542389 : if (!msk->rcvspace_init) + 1921 [ - + ]: 635684 : if (!msk->rcvspace_init) 1922 : 0 : mptcp_rcv_space_init(msk, msk->first); 1923 : : - 1924 : 542389 : msk->rcvq_space.copied += copied; + 1924 : 635684 : msk->rcvq_space.copied += copied; 1925 : : - 1926 [ + + ]: 542389 : mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); - 1927 [ + + ]: 542389 : time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); + 1926 [ + + ]: 635684 : mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); + 1927 [ + + ]: 635684 : time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); 1928 : : - 1929 : 542389 : rtt_us = msk->rcvq_space.rtt_us; - 1930 [ + + + + ]: 542389 : if (rtt_us && time < (rtt_us >> 3)) + 1929 : 635684 : rtt_us = msk->rcvq_space.rtt_us; + 1930 [ + + + + ]: 635684 : if (rtt_us && time < (rtt_us >> 3)) 1931 : : return; 1932 : : - 1933 : 58714 : rtt_us = 0; - 1934 [ + + ]: 138635 : mptcp_for_each_subflow(msk, subflow) { - 1935 : 79921 : const struct tcp_sock *tp; - 1936 : 79921 : u64 sf_rtt_us; - 1937 : 79921 : u32 sf_advmss; + 1933 : 82798 : rtt_us = 0; + 1934 [ + + ]: 186460 : mptcp_for_each_subflow(msk, subflow) { + 1935 : 103662 : const struct tcp_sock *tp; + 1936 : 103662 : u64 sf_rtt_us; + 1937 : 103662 : u32 sf_advmss; 1938 : : - 1939 [ - + ]: 79921 : tp = tcp_sk(mptcp_subflow_tcp_sock(subflow)); + 1939 [ - + ]: 103662 : tp = tcp_sk(mptcp_subflow_tcp_sock(subflow)); 1940 : : - 1941 : 79921 : sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us); - 1942 : 79921 : sf_advmss = READ_ONCE(tp->advmss); + 1941 : 103662 : sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us); + 1942 : 103662 : sf_advmss = READ_ONCE(tp->advmss); 1943 : : - 1944 : 79921 : rtt_us = max(sf_rtt_us, rtt_us); - 1945 : 79921 : advmss = max(sf_advmss, advmss); - 1946 : 79921 : scaling_ratio = min(tp->scaling_ratio, scaling_ratio); + 1944 : 103662 : rtt_us = max(sf_rtt_us, rtt_us); + 1945 : 103662 : advmss = max(sf_advmss, advmss); + 1946 : 103662 : scaling_ratio = min(tp->scaling_ratio, scaling_ratio); 1947 : : } 1948 : : - 1949 : 58714 : msk->rcvq_space.rtt_us = rtt_us; - 1950 : 58714 : msk->scaling_ratio = scaling_ratio; - 1951 [ + + + + ]: 58714 : if (time < (rtt_us >> 3) || rtt_us == 0) + 1949 : 82798 : msk->rcvq_space.rtt_us = rtt_us; + 1950 : 82798 : msk->scaling_ratio = scaling_ratio; + 1951 [ + + + + ]: 82798 : if (time < (rtt_us >> 3) || rtt_us == 0) 1952 : : return; 1953 : : - 1954 [ + + ]: 46405 : if (msk->rcvq_space.copied <= msk->rcvq_space.space) - 1955 : 43825 : goto new_measure; + 1954 [ + + ]: 70340 : if (msk->rcvq_space.copied <= msk->rcvq_space.space) + 1955 : 67602 : goto new_measure; 1956 : : - 1957 [ + - ]: 2580 : if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && - 1958 [ + - ]: 2580 : !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { - 1959 : 2580 : u64 rcvwin, grow; - 1960 : 2580 : int rcvbuf; + 1957 [ + - ]: 2738 : if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && + 1958 [ + - ]: 2738 : !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { + 1959 : 2738 : u64 rcvwin, grow; + 1960 : 2738 : int rcvbuf; 1961 : : - 1962 : 2580 : rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss; + 1962 : 2738 : rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss; 1963 : : - 1964 : 2580 : grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space); + 1964 : 2738 : grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space); 1965 : : - 1966 : 2580 : do_div(grow, msk->rcvq_space.space); - 1967 : 2580 : rcvwin += (grow << 1); + 1966 : 2738 : do_div(grow, msk->rcvq_space.space); + 1967 : 2738 : rcvwin += (grow << 1); 1968 : : - 1969 [ + + ]: 2580 : rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin), + 1969 [ + + ]: 2738 : rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin), 1970 : : READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 1971 : : - 1972 [ + + ]: 2580 : if (rcvbuf > sk->sk_rcvbuf) { - 1973 : 1070 : u32 window_clamp; + 1972 [ + + ]: 2738 : if (rcvbuf > sk->sk_rcvbuf) { + 1973 : 1231 : u32 window_clamp; 1974 : : - 1975 : 1070 : window_clamp = mptcp_win_from_space(sk, rcvbuf); - 1976 : 1070 : WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); + 1975 : 1231 : window_clamp = mptcp_win_from_space(sk, rcvbuf); + 1976 : 1231 : 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 [ + + ]: 2297 : mptcp_for_each_subflow(msk, subflow) { - 1984 : 1227 : struct sock *ssk; - 1985 : 1227 : bool slow; + 1983 [ + + ]: 2606 : mptcp_for_each_subflow(msk, subflow) { + 1984 : 1375 : struct sock *ssk; + 1985 : 1375 : bool slow; 1986 : : - 1987 : 1227 : ssk = mptcp_subflow_tcp_sock(subflow); - 1988 : 1227 : slow = lock_sock_fast(ssk); - 1989 : 1227 : WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); - 1990 [ - + ]: 1227 : WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); - 1991 [ + + ]: 1227 : if (tcp_can_send_ack(ssk)) - 1992 : 1223 : tcp_cleanup_rbuf(ssk, 1); - 1993 : 1227 : unlock_sock_fast(ssk, slow); + 1987 : 1375 : ssk = mptcp_subflow_tcp_sock(subflow); + 1988 : 1375 : slow = lock_sock_fast(ssk); + 1989 : 1375 : WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); + 1990 [ - + ]: 1375 : WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); + 1991 [ + + ]: 1375 : if (tcp_can_send_ack(ssk)) + 1992 : 1369 : tcp_cleanup_rbuf(ssk, 1); + 1993 : 1375 : unlock_sock_fast(ssk, slow); 1994 : : } 1995 : : } 1996 : : } 1997 : : - 1998 : 2580 : msk->rcvq_space.space = msk->rcvq_space.copied; - 1999 : 46405 : new_measure: - 2000 : 46405 : msk->rcvq_space.copied = 0; - 2001 : 46405 : msk->rcvq_space.time = mstamp; + 1998 : 2738 : msk->rcvq_space.space = msk->rcvq_space.copied; + 1999 : 70340 : new_measure: + 2000 : 70340 : msk->rcvq_space.copied = 0; + 2001 : 70340 : msk->rcvq_space.time = mstamp; 2002 : : } 2003 : : 2004 : : static struct mptcp_subflow_context * - 2005 : 169634 : __mptcp_first_ready_from(struct mptcp_sock *msk, + 2005 : 163529 : __mptcp_first_ready_from(struct mptcp_sock *msk, 2006 : : struct mptcp_subflow_context *subflow) 2007 : : { - 2008 : 169634 : struct mptcp_subflow_context *start_subflow = subflow; + 2008 : 163529 : struct mptcp_subflow_context *start_subflow = subflow; 2009 : : - 2010 [ + + + + ]: 511346 : while (!READ_ONCE(subflow->data_avail)) { - 2011 [ + + ]: 456774 : subflow = mptcp_next_subflow(msk, subflow); - 2012 [ + + ]: 456774 : if (subflow == start_subflow) + 2010 [ + + + + ]: 572831 : while (!READ_ONCE(subflow->data_avail)) { + 2011 [ + + ]: 511056 : subflow = mptcp_next_subflow(msk, subflow); + 2012 [ + + ]: 511056 : if (subflow == start_subflow) 2013 : : return NULL; 2014 : : } 2015 : : return subflow; 2016 : : } 2017 : : - 2018 : 218246 : static bool __mptcp_move_skbs(struct sock *sk) + 2018 : 247543 : static bool __mptcp_move_skbs(struct sock *sk) 2019 : : { - 2020 : 218246 : struct mptcp_subflow_context *subflow; - 2021 [ - + ]: 218246 : struct mptcp_sock *msk = mptcp_sk(sk); - 2022 : 218246 : bool ret = false; + 2020 : 247543 : struct mptcp_subflow_context *subflow; + 2021 [ - + ]: 247543 : struct mptcp_sock *msk = mptcp_sk(sk); + 2022 : 247543 : bool ret = false; 2023 : : - 2024 [ + + ]: 218246 : if (list_empty(&msk->conn_list)) + 2024 [ + + ]: 247543 : if (list_empty(&msk->conn_list)) 2025 : : return false; 2026 : : 2027 : : /* verify we can move any data from the subflow, eventually updating */ - 2028 [ + - ]: 218240 : if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) - 2029 [ + + ]: 666459 : mptcp_for_each_subflow(msk, subflow) - 2030 [ + + ]: 448219 : __mptcp_rcvbuf_update(sk, subflow->tcp_sock); + 2028 [ + - ]: 247535 : if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) + 2029 [ + + ]: 753441 : mptcp_for_each_subflow(msk, subflow) + 2030 [ + + ]: 505906 : __mptcp_rcvbuf_update(sk, subflow->tcp_sock); 2031 : : - 2032 : 218240 : subflow = list_first_entry(&msk->conn_list, + 2032 : 247535 : subflow = list_first_entry(&msk->conn_list, 2033 : : struct mptcp_subflow_context, node); - 2034 : 272812 : for (;;) { - 2035 : 272812 : struct sock *ssk; - 2036 : 272812 : bool slowpath; + 2034 : 309310 : for (;;) { + 2035 : 309310 : struct sock *ssk; + 2036 : 309310 : 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 [ + + ]: 272812 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) + 2042 [ + + ]: 309310 : if (sk_rmem_alloc_get(sk) > sk->sk_rcvbuf) 2043 : : break; 2044 : : - 2045 : 222765 : subflow = __mptcp_first_ready_from(msk, subflow); - 2046 [ + + ]: 271879 : if (!subflow) + 2045 : 212965 : subflow = __mptcp_first_ready_from(msk, subflow); + 2046 [ + + ]: 305623 : if (!subflow) 2047 : : break; 2048 : : - 2049 : 54572 : ssk = mptcp_subflow_tcp_sock(subflow); - 2050 : 54572 : slowpath = lock_sock_fast(ssk); - 2051 [ + + + + ]: 54572 : ret = __mptcp_move_skbs_from_subflow(msk, ssk) || ret; - 2052 [ - + ]: 54572 : if (unlikely(ssk->sk_err)) - 2053 : 0 : __mptcp_error_report(sk); - 2054 : 54572 : unlock_sock_fast(ssk, slowpath); + 2049 : 61775 : ssk = mptcp_subflow_tcp_sock(subflow); + 2050 : 61775 : slowpath = lock_sock_fast(ssk); + 2051 [ + + + + ]: 61775 : ret = __mptcp_move_skbs_from_subflow(msk, ssk) || ret; + 2052 [ + + ]: 61775 : if (unlikely(ssk->sk_err)) + 2053 : 1 : __mptcp_error_report(sk); + 2054 : 61775 : unlock_sock_fast(ssk, slowpath); 2055 : : - 2056 [ + + ]: 54572 : subflow = mptcp_next_subflow(msk, subflow); + 2056 [ + + ]: 61775 : subflow = mptcp_next_subflow(msk, subflow); 2057 : : } 2058 : : - 2059 : 218240 : __mptcp_ofo_queue(msk); - 2060 [ + + ]: 218240 : if (ret) - 2061 : 41092 : mptcp_check_data_fin((struct sock *)msk); + 2059 : 247535 : __mptcp_ofo_queue(msk); + 2060 [ + + ]: 247535 : if (ret) + 2061 : 47751 : mptcp_check_data_fin((struct sock *)msk); 2062 : : return ret; 2063 : : } 2064 : : @@ -2161,61 +2161,61 @@ 2077 : 0 : return (unsigned int)hint_val; 2078 : : } 2079 : : - 2080 [ + + + + ]: 432 : 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 : 541720 : static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, + 2086 : 635686 : static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 2087 : : int flags, int *addr_len) 2088 : : { - 2089 [ - + ]: 541720 : struct mptcp_sock *msk = mptcp_sk(sk); - 2090 : 541720 : struct scm_timestamping_internal tss; - 2091 : 541720 : int copied = 0, cmsg_flags = 0; - 2092 : 541720 : int target; - 2093 : 541720 : long timeo; + 2089 [ - + ]: 635686 : struct mptcp_sock *msk = mptcp_sk(sk); + 2090 : 635686 : struct scm_timestamping_internal tss; + 2091 : 635686 : int copied = 0, cmsg_flags = 0; + 2092 : 635686 : int target; + 2093 : 635686 : long timeo; 2094 : : 2095 : : /* MSG_ERRQUEUE is really a no-op till we support IP_RECVERR */ - 2096 [ - + ]: 541720 : if (unlikely(flags & MSG_ERRQUEUE)) + 2096 [ - + ]: 635686 : if (unlikely(flags & MSG_ERRQUEUE)) 2097 : 0 : return inet_recv_error(sk, msg, len, addr_len); 2098 : : - 2099 : 541720 : lock_sock(sk); - 2100 [ - + ]: 541720 : if (unlikely(sk->sk_state == TCP_LISTEN)) { + 2099 : 635686 : lock_sock(sk); + 2100 [ - + ]: 635686 : if (unlikely(sk->sk_state == TCP_LISTEN)) { 2101 : 0 : copied = -ENOTCONN; 2102 : 0 : goto out_err; 2103 : : } 2104 : : - 2105 [ + + ]: 541720 : timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); + 2105 [ + + ]: 635686 : timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 2106 : : - 2107 : 541720 : len = min_t(size_t, len, INT_MAX); - 2108 [ + - ]: 541720 : target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); + 2107 : 635686 : len = min_t(size_t, len, INT_MAX); + 2108 [ + - ]: 635686 : target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 2109 : : - 2110 [ + + ]: 541720 : if (unlikely(msk->recvmsg_inq)) + 2110 [ + + ]: 635686 : if (unlikely(msk->recvmsg_inq)) 2111 : 432 : cmsg_flags = MPTCP_CMSG_INQ; 2112 : : - 2113 [ + + ]: 565517 : while (copied < len) { - 2114 : 565071 : int err, bytes_read; + 2113 [ + + ]: 657581 : while (copied < len) { + 2114 : 657083 : int err, bytes_read; 2115 : : - 2116 : 565071 : bytes_read = __mptcp_recvmsg_mskq(sk, msg, len - copied, flags, &tss, &cmsg_flags); - 2117 [ - + ]: 565071 : if (unlikely(bytes_read < 0)) { + 2116 : 657083 : bytes_read = __mptcp_recvmsg_mskq(sk, msg, len - copied, flags, &tss, &cmsg_flags); + 2117 [ - + ]: 657083 : if (unlikely(bytes_read < 0)) { 2118 [ # # ]: 0 : if (!copied) 2119 : 0 : copied = bytes_read; 2120 : 0 : goto out_err; 2121 : : } 2122 : : - 2123 : 565071 : copied += bytes_read; + 2123 : 657083 : copied += bytes_read; 2124 : : - 2125 [ + + + + ]: 565071 : if (skb_queue_empty(&sk->sk_receive_queue) && __mptcp_move_skbs(sk)) - 2126 : 2631 : continue; + 2125 [ + + + + ]: 657083 : if (skb_queue_empty(&sk->sk_receive_queue) && __mptcp_move_skbs(sk)) + 2126 : 1984 : continue; 2127 : : 2128 : : /* only the MPTCP socket status is relevant here. The exit 2129 : : * conditions mirror closely tcp_recvmsg() 2130 : : */ - 2131 [ + + ]: 562440 : if (copied >= target) + 2131 [ + + ]: 655099 : if (copied >= target) 2132 : : break; 2133 : : - 2134 [ - + ]: 22588 : if (copied) { + 2134 [ - + ]: 21333 : if (copied) { 2135 [ # # ]: 0 : if (sk->sk_err || 2136 [ # # ]: 0 : sk->sk_state == TCP_CLOSE || 2137 [ # # ]: 0 : (sk->sk_shutdown & RCV_SHUTDOWN) || @@ -2223,49 +2223,49 @@ 2139 : 0 : signal_pending(current)) 2140 : : break; 2141 : : } else { - 2142 [ + + ]: 22588 : if (sk->sk_err) { - 2143 : 3 : copied = sock_error(sk); - 2144 : 3 : break; + 2142 [ + + ]: 21333 : if (sk->sk_err) { + 2143 : 4 : copied = sock_error(sk); + 2144 : 4 : break; 2145 : : } 2146 : : - 2147 [ + + ]: 22585 : if (sk->sk_shutdown & RCV_SHUTDOWN) { + 2147 [ + + ]: 21329 : if (sk->sk_shutdown & RCV_SHUTDOWN) { 2148 : : /* race breaker: the shutdown could be after the 2149 : : * previous receive queue check 2150 : : */ - 2151 [ - + ]: 1401 : if (__mptcp_move_skbs(sk)) + 2151 [ - + ]: 1400 : if (__mptcp_move_skbs(sk)) 2152 : 0 : continue; 2153 : : break; 2154 : : } 2155 : : - 2156 [ + + ]: 21184 : if (sk->sk_state == TCP_CLOSE) { + 2156 [ + + ]: 19929 : if (sk->sk_state == TCP_CLOSE) { 2157 : : copied = -ENOTCONN; 2158 : : break; 2159 : : } 2160 : : - 2161 [ + - ]: 21166 : if (!timeo) { + 2161 [ + - ]: 19911 : if (!timeo) { 2162 : : copied = -EAGAIN; 2163 : : break; 2164 : : } 2165 : : - 2166 [ - + ]: 21166 : if (signal_pending(current)) { + 2166 [ - + ]: 19911 : if (signal_pending(current)) { 2167 [ # # ]: 0 : copied = sock_intr_errno(timeo); 2168 : : break; 2169 : : } 2170 : : } 2171 : : - 2172 [ - + ]: 21166 : pr_debug("block timeout %ld\n", timeo); - 2173 : 21166 : mptcp_cleanup_rbuf(msk, copied); - 2174 : 21166 : err = sk_wait_data(sk, &timeo, NULL); - 2175 [ - + ]: 21166 : if (err < 0) { + 2172 [ - + ]: 19911 : pr_debug("block timeout %ld\n", timeo); + 2173 : 19911 : mptcp_cleanup_rbuf(msk, copied); + 2174 : 19911 : err = sk_wait_data(sk, &timeo, NULL); + 2175 [ - + ]: 19911 : if (err < 0) { 2176 : 0 : err = copied ? : err; 2177 : 0 : goto out_err; 2178 : : } 2179 : : } 2180 : : - 2181 : 541720 : mptcp_cleanup_rbuf(msk, copied); + 2181 : 635686 : mptcp_cleanup_rbuf(msk, copied); 2182 : : - 2183 : 541720 : out_err: - 2184 [ + + + - ]: 541720 : if (cmsg_flags && copied >= 0) { + 2183 : 635686 : out_err: + 2184 [ + + + - ]: 635686 : if (cmsg_flags && copied >= 0) { 2185 [ + + ]: 582 : if (cmsg_flags & MPTCP_CMSG_TS) 2186 : 574 : tcp_recv_timestamp(msg, sk, &tss); 2187 : : @@ -2276,115 +2276,115 @@ 2192 : : } 2193 : : } 2194 : : - 2195 [ - + ]: 541720 : pr_debug("msk=%p rx queue empty=%d copied=%d\n", + 2195 [ - + ]: 635686 : pr_debug("msk=%p rx queue empty=%d copied=%d\n", 2196 : : msk, skb_queue_empty(&sk->sk_receive_queue), copied); 2197 : : - 2198 : 541720 : release_sock(sk); - 2199 : 541720 : return copied; + 2198 : 635686 : release_sock(sk); + 2199 : 635686 : return copied; 2200 : : } 2201 : : - 2202 : 7845 : static void mptcp_retransmit_timer(struct timer_list *t) + 2202 : 10767 : static void mptcp_retransmit_timer(struct timer_list *t) 2203 : : { - 2204 : 7845 : struct inet_connection_sock *icsk = from_timer(icsk, t, + 2204 : 10767 : struct inet_connection_sock *icsk = from_timer(icsk, t, 2205 : : icsk_retransmit_timer); - 2206 : 7845 : struct sock *sk = &icsk->icsk_inet.sk; - 2207 [ - + ]: 7845 : struct mptcp_sock *msk = mptcp_sk(sk); + 2206 : 10767 : struct sock *sk = &icsk->icsk_inet.sk; + 2207 [ - + ]: 10767 : struct mptcp_sock *msk = mptcp_sk(sk); 2208 : : - 2209 : 7845 : bh_lock_sock(sk); - 2210 [ + + ]: 7845 : if (!sock_owned_by_user(sk)) { + 2209 : 10767 : bh_lock_sock(sk); + 2210 [ + + ]: 10767 : if (!sock_owned_by_user(sk)) { 2211 : : /* we need a process context to retransmit */ - 2212 [ + + ]: 7417 : if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags)) - 2213 : 4511 : mptcp_schedule_work(sk); + 2212 [ + + ]: 10751 : if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags)) + 2213 : 7718 : mptcp_schedule_work(sk); 2214 : : } else { 2215 : : /* delegate our work to tcp_release_cb() */ - 2216 [ - + - - : 3328 : __set_bit(MPTCP_RETRANSMIT, &msk->cb_flags); + 2216 [ - + - - : 3048 : __set_bit(MPTCP_RETRANSMIT, &msk->cb_flags); - - ] 2217 : : } - 2218 : 7845 : bh_unlock_sock(sk); - 2219 : 7845 : sock_put(sk); - 2220 : 7845 : } + 2218 : 10767 : bh_unlock_sock(sk); + 2219 : 10767 : sock_put(sk); + 2220 : 10767 : } 2221 : : - 2222 : 114 : static void mptcp_tout_timer(struct timer_list *t) + 2222 : 118 : static void mptcp_tout_timer(struct timer_list *t) 2223 : : { - 2224 : 114 : struct sock *sk = from_timer(sk, t, sk_timer); + 2224 : 118 : struct sock *sk = from_timer(sk, t, sk_timer); 2225 : : - 2226 : 114 : mptcp_schedule_work(sk); - 2227 : 114 : sock_put(sk); - 2228 : 114 : } + 2226 : 118 : mptcp_schedule_work(sk); + 2227 : 118 : sock_put(sk); + 2228 : 118 : } 2229 : : 2230 : : /* Find an idle subflow. Return NULL if there is unacked data at tcp 2231 : : * level. 2232 : : * 2233 : : * A backup subflow is returned only if that is the only kind available. 2234 : : */ - 2235 : 1767 : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) + 2235 : 2260 : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) 2236 : : { - 2237 : 1767 : struct sock *backup = NULL, *pick = NULL; - 2238 : 1767 : struct mptcp_subflow_context *subflow; - 2239 : 1767 : int min_stale_count = INT_MAX; + 2237 : 2260 : struct sock *backup = NULL, *pick = NULL; + 2238 : 2260 : struct mptcp_subflow_context *subflow; + 2239 : 2260 : int min_stale_count = INT_MAX; 2240 : : - 2241 [ + + ]: 4268 : mptcp_for_each_subflow(msk, subflow) { - 2242 : 2501 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 2241 [ + + ]: 5185 : mptcp_for_each_subflow(msk, subflow) { + 2242 : 2925 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 2243 : : - 2244 [ + + ]: 2501 : if (!__mptcp_subflow_active(subflow)) - 2245 : 123 : continue; + 2244 [ + + ]: 2925 : if (!__mptcp_subflow_active(subflow)) + 2245 : 521 : continue; 2246 : : 2247 : : /* still data outstanding at TCP level? skip this */ - 2248 [ + + ]: 2378 : if (!tcp_rtx_and_write_queues_empty(ssk)) { - 2249 : 673 : mptcp_pm_subflow_chk_stale(msk, ssk); - 2250 : 673 : min_stale_count = min_t(int, min_stale_count, subflow->stale_count); - 2251 : 673 : continue; + 2248 [ + + ]: 2404 : if (!tcp_rtx_and_write_queues_empty(ssk)) { + 2249 : 540 : mptcp_pm_subflow_chk_stale(msk, ssk); + 2250 : 540 : min_stale_count = min_t(int, min_stale_count, subflow->stale_count); + 2251 : 540 : continue; 2252 : : } 2253 : : - 2254 [ + + ]: 1705 : if (subflow->backup || subflow->request_bkup) { - 2255 [ + + ]: 68 : if (!backup) - 2256 : 60 : backup = ssk; - 2257 : 68 : continue; + 2254 [ + + ]: 1864 : if (subflow->backup || subflow->request_bkup) { + 2255 [ + + ]: 80 : if (!backup) + 2256 : 64 : backup = ssk; + 2257 : 80 : continue; 2258 : : } 2259 : : - 2260 [ + + ]: 1637 : if (!pick) - 2261 : 1227 : pick = ssk; + 2260 [ + + ]: 1784 : if (!pick) + 2261 : 1353 : pick = ssk; 2262 : : } 2263 : : - 2264 [ + + ]: 1767 : if (pick) + 2264 [ + + ]: 2260 : if (pick) 2265 : : return pick; 2266 : : 2267 : : /* use backup only if there are no progresses anywhere */ - 2268 [ + + ]: 540 : return min_stale_count > 1 ? backup : NULL; + 2268 [ + + ]: 907 : return min_stale_count > 1 ? backup : NULL; 2269 : : } 2270 : : - 2271 : 746 : bool __mptcp_retransmit_pending_data(struct sock *sk) + 2271 : 768 : bool __mptcp_retransmit_pending_data(struct sock *sk) 2272 : : { - 2273 : 746 : struct mptcp_data_frag *cur, *rtx_head; - 2274 [ - + ]: 746 : struct mptcp_sock *msk = mptcp_sk(sk); + 2273 : 768 : struct mptcp_data_frag *cur, *rtx_head; + 2274 [ - + ]: 768 : struct mptcp_sock *msk = mptcp_sk(sk); 2275 : : - 2276 [ + + ]: 746 : if (__mptcp_check_fallback(msk)) + 2276 [ + + ]: 768 : 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 : 671 : mptcp_data_unlock(sk); - 2288 : 671 : return false; + 2283 : 728 : mptcp_data_lock(sk); + 2284 : 728 : __mptcp_clean_una_wakeup(sk); + 2285 : 728 : rtx_head = mptcp_rtx_head(sk); + 2286 [ + + ]: 728 : if (!rtx_head) { + 2287 : 679 : mptcp_data_unlock(sk); + 2288 : 679 : return false; 2289 : : } 2290 : : - 2291 : 39 : msk->recovery_snd_nxt = msk->snd_nxt; - 2292 : 39 : msk->recovery = true; - 2293 : 39 : mptcp_data_unlock(sk); + 2291 : 49 : msk->recovery_snd_nxt = msk->snd_nxt; + 2292 : 49 : msk->recovery = true; + 2293 : 49 : mptcp_data_unlock(sk); 2294 : : - 2295 : 39 : msk->first_pending = rtx_head; - 2296 : 39 : msk->snd_burst = 0; + 2295 : 49 : msk->first_pending = rtx_head; + 2296 : 49 : msk->snd_burst = 0; 2297 : : 2298 : : /* be sure to clear the "sent status" on all re-injected fragments */ - 2299 [ + + ]: 4280 : list_for_each_entry(cur, &msk->rtx_queue, list) { - 2300 [ + + ]: 4252 : if (!cur->already_sent) + 2299 [ + + ]: 5552 : list_for_each_entry(cur, &msk->rtx_queue, list) { + 2300 [ + + ]: 5515 : if (!cur->already_sent) 2301 : : break; - 2302 : 4241 : cur->already_sent = 0; + 2302 : 5503 : 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 : 782 : static void __mptcp_subflow_disconnect(struct sock *ssk, + 2316 : 842 : static void __mptcp_subflow_disconnect(struct sock *ssk, 2317 : : struct mptcp_subflow_context *subflow, 2318 : : unsigned int flags) 2319 : : { - 2320 [ + + + + : 782 : if (((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) || - + + ] + 2320 [ + + + + : 842 : 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 [ - + ]: 758 : WARN_ON_ONCE(tcp_disconnect(ssk, 0)); - 2326 : 758 : mptcp_subflow_ctx_reset(subflow); + 2325 [ - + ]: 818 : WARN_ON_ONCE(tcp_disconnect(ssk, 0)); + 2326 : 818 : mptcp_subflow_ctx_reset(subflow); 2327 : : } else { 2328 : 24 : tcp_shutdown(ssk, SEND_SHUTDOWN); 2329 : : } - 2330 : 782 : } + 2330 : 842 : } 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 : 5409 : static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, + 2340 : 5478 : static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, 2341 : : struct mptcp_subflow_context *subflow, 2342 : : unsigned int flags) 2343 : : { - 2344 [ - + ]: 5409 : struct mptcp_sock *msk = mptcp_sk(sk); - 2345 : 5409 : bool dispose_it, need_push = false; + 2344 [ - + ]: 5478 : struct mptcp_sock *msk = mptcp_sk(sk); + 2345 : 5478 : 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 [ + + + + : 5451 : if (msk->in_accept_queue && msk->first == ssk && + 2352 [ + + + + : 5520 : 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,96 +2446,96 @@ 2359 : 42 : goto out_release; 2360 : : } 2361 : : - 2362 [ + + + + ]: 5367 : dispose_it = msk->free_first || ssk != msk->first; + 2362 [ + + + + ]: 5436 : dispose_it = msk->free_first || ssk != msk->first; 2363 : : if (dispose_it) - 2364 : 4585 : list_del(&subflow->node); + 2364 : 4594 : list_del(&subflow->node); 2365 : : - 2366 : 5367 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); + 2366 : 5436 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); 2367 : : - 2368 [ + + + + ]: 5367 : if ((flags & MPTCP_CF_FASTCLOSE) && !__mptcp_check_fallback(msk)) { + 2368 [ + + + + ]: 5436 : 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 : 422 : ssk->sk_lingertime = 0; - 2373 : 422 : sock_set_flag(ssk, SOCK_LINGER); - 2374 : 422 : subflow->send_fastclose = 1; + 2372 : 454 : ssk->sk_lingertime = 0; + 2373 : 454 : sock_set_flag(ssk, SOCK_LINGER); + 2374 : 454 : subflow->send_fastclose = 1; 2375 : : } 2376 : : - 2377 [ + + + + ]: 5367 : need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); - 2378 [ + + ]: 5367 : if (!dispose_it) { - 2379 : 782 : __mptcp_subflow_disconnect(ssk, subflow, flags); - 2380 : 782 : release_sock(ssk); + 2377 [ + + + + ]: 5436 : need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); + 2378 [ + + ]: 5436 : if (!dispose_it) { + 2379 : 842 : __mptcp_subflow_disconnect(ssk, subflow, flags); + 2380 : 842 : release_sock(ssk); 2381 : : - 2382 : 782 : goto out; + 2382 : 842 : goto out; 2383 : : } 2384 : : - 2385 : 4585 : subflow->disposable = 1; + 2385 : 4594 : subflow->disposable = 1; 2386 : : 2387 : : /* if ssk hit tcp_done(), tcp_cleanup_ulp() cleared the related ops 2388 : : * the ssk has been already destroyed, we just need to release the 2389 : : * reference owned by msk; 2390 : : */ - 2391 [ - + ]: 4585 : if (!inet_csk(ssk)->icsk_ulp_ops) { + 2391 [ - + ]: 4594 : if (!inet_csk(ssk)->icsk_ulp_ops) { 2392 [ # # ]: 0 : WARN_ON_ONCE(!sock_flag(ssk, SOCK_DEAD)); 2393 [ # # ]: 0 : kfree_rcu(subflow, rcu); 2394 : : } else { 2395 : : /* otherwise tcp will dispose of the ssk and subflow ctx */ - 2396 : 4585 : __tcp_close(ssk, 0); + 2396 : 4594 : __tcp_close(ssk, 0); 2397 : : 2398 : : /* close acquired an extra ref */ - 2399 : 4585 : __sock_put(ssk); + 2399 : 4594 : __sock_put(ssk); 2400 : : } 2401 : : - 2402 : 4627 : out_release: - 2403 : 4627 : __mptcp_subflow_error_report(sk, ssk); - 2404 : 4627 : release_sock(ssk); + 2402 : 4636 : out_release: + 2403 : 4636 : __mptcp_subflow_error_report(sk, ssk); + 2404 : 4636 : release_sock(ssk); 2405 : : - 2406 : 4627 : sock_put(ssk); + 2406 : 4636 : sock_put(ssk); 2407 : : - 2408 [ + + ]: 4627 : if (ssk == msk->first) - 2409 : 3602 : WRITE_ONCE(msk->first, NULL); + 2408 [ + + ]: 4636 : if (ssk == msk->first) + 2409 : 3606 : WRITE_ONCE(msk->first, NULL); 2410 : : - 2411 : 1025 : out: - 2412 : 5409 : __mptcp_sync_sndbuf(sk); - 2413 [ + + ]: 5409 : if (need_push) - 2414 : 22 : __mptcp_push_pending(sk, 0); + 2411 : 1030 : out: + 2412 : 5478 : __mptcp_sync_sndbuf(sk); + 2413 [ + + ]: 5478 : if (need_push) + 2414 : 35 : __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 [ + + + + : 7587 : if (list_is_singular(&msk->conn_list) && msk->first && - + + ] + 2421 [ + + + + : 7768 : if (list_is_singular(&msk->conn_list) && msk->first && + + + ] 2422 [ + - ]: 30 : inet_sk_state_load(msk->first) == TCP_CLOSE) { - 2423 [ + + + - ]: 760 : if (sk->sk_state != TCP_ESTABLISHED || - 2424 [ - + ]: 33 : msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { - 2425 : 727 : mptcp_set_state(sk, TCP_CLOSE); - 2426 : 727 : mptcp_close_wake_up(sk); + 2423 [ + + + - ]: 819 : if (sk->sk_state != TCP_ESTABLISHED || + 2424 [ - + ]: 36 : msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { + 2425 : 783 : mptcp_set_state(sk, TCP_CLOSE); + 2426 : 783 : mptcp_close_wake_up(sk); 2427 : : } else { - 2428 : 33 : mptcp_start_tout_timer(sk); + 2428 : 36 : mptcp_start_tout_timer(sk); 2429 : : } 2430 : : } - 2431 : 5409 : } + 2431 : 5478 : } 2432 : : - 2433 : 767 : void mptcp_close_ssk(struct sock *sk, struct sock *ssk, + 2433 : 791 : 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 [ + + ]: 767 : if (subflow->close_event_done) + 2437 [ + + ]: 791 : if (subflow->close_event_done) 2438 : : return; 2439 : : - 2440 : 729 : subflow->close_event_done = true; + 2440 : 754 : subflow->close_event_done = true; 2441 : : - 2442 [ + + ]: 729 : if (sk->sk_state == TCP_ESTABLISHED) - 2443 [ - + ]: 320 : mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); + 2442 [ + + ]: 754 : 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 [ - + ]: 729 : mptcp_pm_subflow_check_next(mptcp_sk(sk), subflow); + 2448 [ - + ]: 754 : mptcp_pm_subflow_check_next(mptcp_sk(sk), subflow); 2449 : : - 2450 : 729 : __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH); + 2450 : 754 : __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 : 567 : static void __mptcp_close_subflow(struct sock *sk) + 2458 : 590 : static void __mptcp_close_subflow(struct sock *sk) 2459 : : { - 2460 : 567 : struct mptcp_subflow_context *subflow, *tmp; - 2461 [ - + ]: 567 : struct mptcp_sock *msk = mptcp_sk(sk); + 2460 : 590 : struct mptcp_subflow_context *subflow, *tmp; + 2461 [ - + ]: 590 : struct mptcp_sock *msk = mptcp_sk(sk); 2462 : : - 2463 : 567 : might_sleep(); + 2463 : 590 : might_sleep(); 2464 : : - 2465 [ + + ]: 1452 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { - 2466 : 885 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 2467 : 885 : int ssk_state = inet_sk_state_load(ssk); + 2465 [ + + ]: 1494 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { + 2466 : 904 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 2467 : 904 : int ssk_state = inet_sk_state_load(ssk); 2468 : : - 2469 [ + + + + ]: 885 : if (ssk_state != TCP_CLOSE && - 2470 [ + + ]: 72 : (ssk_state != TCP_CLOSE_WAIT || + 2469 [ + + + + ]: 904 : if (ssk_state != TCP_CLOSE && + 2470 [ + + ]: 67 : (ssk_state != TCP_CLOSE_WAIT || 2471 [ # # ]: 0 : inet_sk_state_load(sk) != TCP_ESTABLISHED)) - 2472 : 310 : continue; + 2472 : 305 : continue; 2473 : : 2474 : : /* 'subflow_data_ready' will re-sched once rx queue is empty */ - 2475 [ - + ]: 575 : if (!skb_queue_empty_lockless(&ssk->sk_receive_queue)) + 2475 [ - + ]: 599 : if (!skb_queue_empty_lockless(&ssk->sk_receive_queue)) 2476 : 0 : continue; 2477 : : - 2478 : 575 : mptcp_close_ssk(sk, ssk, subflow); + 2478 : 599 : mptcp_close_ssk(sk, ssk, subflow); 2479 : : } 2480 : : - 2481 : 567 : } + 2481 : 590 : } 2482 : : - 2483 : 9694 : static bool mptcp_close_tout_expired(const struct sock *sk) + 2483 : 12822 : static bool mptcp_close_tout_expired(const struct sock *sk) 2484 : : { - 2485 [ + + ]: 9694 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp || - 2486 [ + + ]: 2742 : sk->sk_state == TCP_CLOSE) + 2485 [ + + ]: 12822 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp || + 2486 [ + + ]: 3015 : sk->sk_state == TCP_CLOSE) 2487 : : return false; 2488 : : - 2489 : 1876 : return time_after32(tcp_jiffies32, + 2489 : 2163 : return time_after32(tcp_jiffies32, 2490 : : inet_csk(sk)->icsk_mtup.probe_timestamp + mptcp_close_timeout(sk)); 2491 : : } 2492 : : - 2493 : 9694 : static void mptcp_check_fastclose(struct mptcp_sock *msk) + 2493 : 12822 : static void mptcp_check_fastclose(struct mptcp_sock *msk) 2494 : : { - 2495 : 9694 : struct mptcp_subflow_context *subflow, *tmp; - 2496 : 9694 : struct sock *sk = (struct sock *)msk; + 2495 : 12822 : struct mptcp_subflow_context *subflow, *tmp; + 2496 : 12822 : struct sock *sk = (struct sock *)msk; 2497 : : - 2498 [ + + + + ]: 9694 : if (likely(!READ_ONCE(msk->rcv_fastclose))) + 2498 [ + + + + ]: 12822 : if (likely(!READ_ONCE(msk->rcv_fastclose))) 2499 : : return; 2500 : : - 2501 : 213 : mptcp_token_destroy(msk); + 2501 : 234 : mptcp_token_destroy(msk); 2502 : : - 2503 [ + + ]: 492 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { - 2504 : 279 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); - 2505 : 279 : bool slow; + 2503 [ + + ]: 531 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { + 2504 : 297 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); + 2505 : 297 : bool slow; 2506 : : - 2507 : 279 : slow = lock_sock_fast(tcp_sk); - 2508 [ + + ]: 279 : if (tcp_sk->sk_state != TCP_CLOSE) { - 2509 : 38 : mptcp_send_active_reset_reason(tcp_sk); - 2510 : 38 : tcp_set_state(tcp_sk, TCP_CLOSE); + 2507 : 297 : slow = lock_sock_fast(tcp_sk); + 2508 [ + + ]: 297 : if (tcp_sk->sk_state != TCP_CLOSE) { + 2509 : 33 : mptcp_send_active_reset_reason(tcp_sk); + 2510 : 33 : tcp_set_state(tcp_sk, TCP_CLOSE); 2511 : : } - 2512 : 279 : unlock_sock_fast(tcp_sk, slow); + 2512 : 297 : unlock_sock_fast(tcp_sk, slow); 2513 : : } 2514 : : 2515 : : /* Mirror the tcp_reset() error propagation */ - 2516 [ - + + - ]: 213 : switch (sk->sk_state) { + 2516 [ - + + - ]: 234 : 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 : 16 : WRITE_ONCE(sk->sk_err, EPIPE); - 2522 : 16 : break; + 2521 : 14 : WRITE_ONCE(sk->sk_err, EPIPE); + 2522 : 14 : break; 2523 : : case TCP_CLOSE: 2524 : : return; 2525 : : default: - 2526 : 197 : WRITE_ONCE(sk->sk_err, ECONNRESET); + 2526 : 220 : WRITE_ONCE(sk->sk_err, ECONNRESET); 2527 : : } 2528 : : - 2529 : 213 : mptcp_set_state(sk, TCP_CLOSE); - 2530 : 213 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); - 2531 : 213 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ - 2532 : 213 : set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); + 2529 : 234 : mptcp_set_state(sk, TCP_CLOSE); + 2530 : 234 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); + 2531 : 234 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ + 2532 : 234 : set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); 2533 : : 2534 : : /* the calling mptcp_worker will properly destroy the socket */ - 2535 [ + + ]: 213 : if (sock_flag(sk, SOCK_DEAD)) + 2535 [ + + ]: 234 : if (sock_flag(sk, SOCK_DEAD)) 2536 : : return; 2537 : : - 2538 : 112 : sk->sk_state_change(sk); - 2539 : 112 : sk_error_report(sk); + 2538 : 101 : sk->sk_state_change(sk); + 2539 : 101 : sk_error_report(sk); 2540 : : } 2541 : : - 2542 : 7511 : static void __mptcp_retrans(struct sock *sk) + 2542 : 10458 : static void __mptcp_retrans(struct sock *sk) 2543 : : { - 2544 [ - + ]: 7511 : struct mptcp_sock *msk = mptcp_sk(sk); - 2545 : 7511 : struct mptcp_subflow_context *subflow; - 2546 : 7511 : struct mptcp_sendmsg_info info = {}; - 2547 : 7511 : struct mptcp_data_frag *dfrag; - 2548 : 7511 : struct sock *ssk; - 2549 : 7511 : int ret, err; - 2550 : 7511 : u16 len = 0; + 2544 [ - + ]: 10458 : struct mptcp_sock *msk = mptcp_sk(sk); + 2545 : 10458 : struct mptcp_subflow_context *subflow; + 2546 : 10458 : struct mptcp_sendmsg_info info = {}; + 2547 : 10458 : struct mptcp_data_frag *dfrag; + 2548 : 10458 : struct sock *ssk; + 2549 : 10458 : int ret, err; + 2550 : 10458 : u16 len = 0; 2551 : : - 2552 : 7511 : mptcp_clean_una_wakeup(sk); + 2552 : 10458 : mptcp_clean_una_wakeup(sk); 2553 : : 2554 : : /* first check ssk: need to kick "stale" logic */ - 2555 : 7511 : err = mptcp_sched_get_retrans(msk); - 2556 : 7511 : dfrag = mptcp_rtx_head(sk); - 2557 [ + + ]: 7511 : if (!dfrag) { - 2558 [ + + ]: 2121 : if (mptcp_data_fin_enabled(msk)) { - 2559 : 1150 : struct inet_connection_sock *icsk = inet_csk(sk); + 2555 : 10458 : err = mptcp_sched_get_retrans(msk); + 2556 : 10458 : dfrag = mptcp_rtx_head(sk); + 2557 [ + + ]: 10458 : if (!dfrag) { + 2558 [ + + ]: 3164 : if (mptcp_data_fin_enabled(msk)) { + 2559 : 1139 : struct inet_connection_sock *icsk = inet_csk(sk); 2560 : : - 2561 : 1150 : icsk->icsk_retransmits++; - 2562 : 1150 : mptcp_set_datafin_timeout(sk); - 2563 : 1150 : mptcp_send_ack(msk); + 2561 : 1139 : icsk->icsk_retransmits++; + 2562 : 1139 : mptcp_set_datafin_timeout(sk); + 2563 : 1139 : mptcp_send_ack(msk); 2564 : : - 2565 : 1150 : goto reset_timer; + 2565 : 1139 : goto reset_timer; 2566 : : } 2567 : : - 2568 [ + + ]: 971 : if (!mptcp_send_head(sk)) - 2569 : 774 : return; + 2568 [ + + ]: 2025 : if (!mptcp_send_head(sk)) + 2569 : 841 : return; 2570 : : - 2571 : 197 : goto reset_timer; + 2571 : 1184 : goto reset_timer; 2572 : : } 2573 : : - 2574 [ + + ]: 5390 : if (err) - 2575 : 2108 : goto reset_timer; + 2574 [ + + ]: 7294 : if (err) + 2575 : 4180 : goto reset_timer; 2576 : : - 2577 [ + + ]: 9632 : mptcp_for_each_subflow(msk, subflow) { - 2578 [ + + + + ]: 6350 : if (READ_ONCE(subflow->scheduled)) { - 2579 : 3729 : u16 copied = 0; + 2577 [ + + ]: 9022 : mptcp_for_each_subflow(msk, subflow) { + 2578 [ + + + + ]: 5908 : if (READ_ONCE(subflow->scheduled)) { + 2579 : 3496 : u16 copied = 0; 2580 : : - 2581 : 3729 : mptcp_subflow_set_scheduled(subflow, false); + 2581 : 3496 : mptcp_subflow_set_scheduled(subflow, false); 2582 : : - 2583 : 3729 : ssk = mptcp_subflow_tcp_sock(subflow); + 2583 : 3496 : ssk = mptcp_subflow_tcp_sock(subflow); 2584 : : - 2585 : 3729 : lock_sock(ssk); + 2585 : 3496 : lock_sock(ssk); 2586 : : 2587 : : /* limit retransmission to the bytes already sent on some subflows */ - 2588 : 3729 : info.sent = 0; - 2589 [ - + - + ]: 3729 : info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len : + 2588 : 3496 : info.sent = 0; + 2589 [ - + + + ]: 3496 : info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len : 2590 : : dfrag->already_sent; - 2591 [ + + ]: 7462 : while (info.sent < info.limit) { - 2592 : 3733 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info); - 2593 [ + - ]: 3733 : if (ret <= 0) + 2591 [ + + ]: 6996 : while (info.sent < info.limit) { + 2592 : 3500 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info); + 2593 [ + - ]: 3500 : if (ret <= 0) 2594 : : break; 2595 : : - 2596 [ + - ]: 3733 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS); - 2597 : 3733 : copied += ret; - 2598 : 3733 : info.sent += ret; + 2596 [ + - ]: 3500 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS); + 2597 : 3500 : copied += ret; + 2598 : 3500 : info.sent += ret; 2599 : : } - 2600 [ + - ]: 3729 : if (copied) { - 2601 : 3729 : len = max(copied, len); - 2602 [ - + ]: 3729 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + 2600 [ + - ]: 3496 : if (copied) { + 2601 : 3496 : len = max(copied, len); + 2602 [ - + ]: 3496 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, 2603 : : info.size_goal); - 2604 : 3729 : WRITE_ONCE(msk->allow_infinite_fallback, false); + 2604 : 3496 : WRITE_ONCE(msk->allow_infinite_fallback, false); 2605 : : } 2606 : : - 2607 : 3729 : release_sock(ssk); + 2607 : 3496 : release_sock(ssk); 2608 : : } 2609 : : } 2610 : : - 2611 : 3282 : msk->bytes_retrans += len; - 2612 : 3282 : dfrag->already_sent = max(dfrag->already_sent, len); + 2611 : 3114 : msk->bytes_retrans += len; + 2612 : 3114 : dfrag->already_sent = max(dfrag->already_sent, len); 2613 : : - 2614 : 6737 : reset_timer: - 2615 : 6737 : mptcp_check_and_set_pending(sk); + 2614 : 9617 : reset_timer: + 2615 : 9617 : mptcp_check_and_set_pending(sk); 2616 : : - 2617 [ + + ]: 6737 : if (!mptcp_rtx_timer_pending(sk)) - 2618 : 77 : mptcp_reset_rtx_timer(sk); + 2617 [ + + ]: 9617 : if (!mptcp_rtx_timer_pending(sk)) + 2618 : 71 : 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 : 1065 : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) + 2624 : 1053 : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) 2625 : : { - 2626 : 1065 : struct sock *sk = (struct sock *)msk; - 2627 : 1065 : unsigned long timeout, close_timeout; + 2626 : 1053 : struct sock *sk = (struct sock *)msk; + 2627 : 1053 : unsigned long timeout, close_timeout; 2628 : : - 2629 [ + + + - ]: 1065 : if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) + 2629 [ + + + - ]: 1053 : if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) 2630 : : return; 2631 : : - 2632 : 2130 : close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - - 2633 : 1065 : tcp_jiffies32 + jiffies + mptcp_close_timeout(sk); + 2632 : 2106 : close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - + 2633 : 1053 : 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 [ + + ]: 1065 : timeout = inet_csk(sk)->icsk_mtup.probe_timestamp ? close_timeout : fail_tout; + 2638 [ + + ]: 1053 : timeout = inet_csk(sk)->icsk_mtup.probe_timestamp ? close_timeout : fail_tout; 2639 : : - 2640 : 1065 : sk_reset_timer(sk, &sk->sk_timer, timeout); + 2640 : 1053 : 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 : 366 : static void mptcp_do_fastclose(struct sock *sk) + 2659 : 397 : static void mptcp_do_fastclose(struct sock *sk) 2660 : : { - 2661 : 366 : struct mptcp_subflow_context *subflow, *tmp; - 2662 [ - + ]: 366 : struct mptcp_sock *msk = mptcp_sk(sk); + 2661 : 397 : struct mptcp_subflow_context *subflow, *tmp; + 2662 [ - + ]: 397 : struct mptcp_sock *msk = mptcp_sk(sk); 2663 : : - 2664 : 366 : mptcp_set_state(sk, TCP_CLOSE); - 2665 [ + + ]: 812 : mptcp_for_each_subflow_safe(msk, subflow, tmp) - 2666 : 446 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), + 2664 : 397 : mptcp_set_state(sk, TCP_CLOSE); + 2665 [ + + ]: 875 : mptcp_for_each_subflow_safe(msk, subflow, tmp) + 2666 : 478 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), 2667 : : subflow, MPTCP_CF_FASTCLOSE); - 2668 : 366 : } + 2668 : 397 : } 2669 : : - 2670 : 9808 : static void mptcp_worker(struct work_struct *work) + 2670 : 12938 : static void mptcp_worker(struct work_struct *work) 2671 : : { - 2672 : 9808 : struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work); - 2673 : 9808 : struct sock *sk = (struct sock *)msk; - 2674 : 9808 : unsigned long fail_tout; - 2675 : 9808 : int state; + 2672 : 12938 : struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work); + 2673 : 12938 : struct sock *sk = (struct sock *)msk; + 2674 : 12938 : unsigned long fail_tout; + 2675 : 12938 : int state; 2676 : : - 2677 : 9808 : lock_sock(sk); - 2678 : 9808 : state = sk->sk_state; - 2679 [ + + + + ]: 9808 : if (unlikely((1 << state) & (TCPF_CLOSE | TCPF_LISTEN))) - 2680 : 114 : goto unlock; + 2677 : 12938 : lock_sock(sk); + 2678 : 12938 : state = sk->sk_state; + 2679 [ + + + + ]: 12938 : if (unlikely((1 << state) & (TCPF_CLOSE | TCPF_LISTEN))) + 2680 : 116 : goto unlock; 2681 : : - 2682 : 9694 : mptcp_check_fastclose(msk); + 2682 : 12822 : mptcp_check_fastclose(msk); 2683 : : - 2684 : 9694 : mptcp_pm_nl_work(msk); + 2684 : 12822 : mptcp_pm_nl_work(msk); 2685 : : - 2686 : 9694 : mptcp_check_send_data_fin(sk); - 2687 : 9694 : mptcp_check_data_fin_ack(sk); - 2688 : 9694 : mptcp_check_data_fin(sk); + 2686 : 12822 : mptcp_check_send_data_fin(sk); + 2687 : 12822 : mptcp_check_data_fin_ack(sk); + 2688 : 12822 : mptcp_check_data_fin(sk); 2689 : : - 2690 [ + + ]: 15077 : if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - 2691 : 567 : __mptcp_close_subflow(sk); + 2690 [ + + ]: 18321 : if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + 2691 : 590 : __mptcp_close_subflow(sk); 2692 : : - 2693 [ + + ]: 9694 : if (mptcp_close_tout_expired(sk)) { - 2694 : 114 : mptcp_do_fastclose(sk); - 2695 : 114 : mptcp_close_wake_up(sk); + 2693 [ + + ]: 12822 : if (mptcp_close_tout_expired(sk)) { + 2694 : 118 : mptcp_do_fastclose(sk); + 2695 : 118 : mptcp_close_wake_up(sk); 2696 : : } 2697 : : - 2698 [ + + + + ]: 9694 : if (sock_flag(sk, SOCK_DEAD) && sk->sk_state == TCP_CLOSE) { - 2699 : 968 : __mptcp_destroy_sock(sk); - 2700 : 968 : goto unlock; + 2698 [ + + + + ]: 12822 : if (sock_flag(sk, SOCK_DEAD) && sk->sk_state == TCP_CLOSE) { + 2699 : 958 : __mptcp_destroy_sock(sk); + 2700 : 958 : goto unlock; 2701 : : } 2702 : : - 2703 [ + + ]: 13605 : if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) - 2704 : 4183 : __mptcp_retrans(sk); + 2703 [ + + ]: 16871 : if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) + 2704 : 7410 : __mptcp_retrans(sk); 2705 : : - 2706 [ + - + - ]: 8726 : fail_tout = msk->first ? READ_ONCE(mptcp_subflow_ctx(msk->first)->fail_tout) : 0; - 2707 [ + - - - ]: 8726 : if (fail_tout && time_after(jiffies, fail_tout)) + 2706 [ + - + - ]: 11864 : fail_tout = msk->first ? READ_ONCE(mptcp_subflow_ctx(msk->first)->fail_tout) : 0; + 2707 [ + - - - ]: 11864 : if (fail_tout && time_after(jiffies, fail_tout)) 2708 : 0 : mptcp_mp_fail_no_response(msk); 2709 : : 2710 : 0 : unlock: - 2711 : 9808 : release_sock(sk); - 2712 : 9808 : sock_put(sk); - 2713 : 9808 : } + 2711 : 12938 : release_sock(sk); + 2712 : 12938 : sock_put(sk); + 2713 : 12938 : } 2714 : : 2715 : 3696 : static void __mptcp_init_sock(struct sock *sk) 2716 : : { @@ -2877,29 +2877,29 @@ 2789 : 2530 : return 0; 2790 : : } 2791 : : - 2792 : 3676 : static void __mptcp_clear_xmit(struct sock *sk) + 2792 : 3680 : static void __mptcp_clear_xmit(struct sock *sk) 2793 : : { - 2794 [ - + ]: 3676 : struct mptcp_sock *msk = mptcp_sk(sk); - 2795 : 3676 : struct mptcp_data_frag *dtmp, *dfrag; + 2794 [ - + ]: 3680 : struct mptcp_sock *msk = mptcp_sk(sk); + 2795 : 3680 : struct mptcp_data_frag *dtmp, *dfrag; 2796 : : - 2797 : 3676 : WRITE_ONCE(msk->first_pending, NULL); - 2798 [ + + ]: 3723 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) - 2799 : 47 : dfrag_clear(sk, dfrag); - 2800 : 3676 : } + 2797 : 3680 : WRITE_ONCE(msk->first_pending, NULL); + 2798 [ + + ]: 4496 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) + 2799 : 816 : dfrag_clear(sk, dfrag); + 2800 : 3680 : } 2801 : : - 2802 : 2646 : void mptcp_cancel_work(struct sock *sk) + 2802 : 2660 : void mptcp_cancel_work(struct sock *sk) 2803 : : { - 2804 [ - + ]: 2646 : struct mptcp_sock *msk = mptcp_sk(sk); + 2804 [ - + ]: 2660 : struct mptcp_sock *msk = mptcp_sk(sk); 2805 : : - 2806 [ + + ]: 2646 : if (cancel_work_sync(&msk->work)) - 2807 : 21 : __sock_put(sk); - 2808 : 2646 : } + 2806 [ + + ]: 2660 : if (cancel_work_sync(&msk->work)) + 2807 : 34 : __sock_put(sk); + 2808 : 2660 : } 2809 : : - 2810 : 2997 : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) + 2810 : 3015 : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) 2811 : : { - 2812 : 2997 : lock_sock(ssk); + 2812 : 3015 : lock_sock(ssk); 2813 : : - 2814 [ - + + ]: 2997 : switch (ssk->sk_state) { + 2814 [ - + + ]: 3015 : 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 : 2981 : default: - 2823 [ - + + + ]: 2981 : 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); + 2822 : 2999 : default: + 2823 [ - + + + ]: 2999 : 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); 2827 : : 2828 : : /* simulate the data_fin ack reception to let the state 2829 : : * machine move forward 2830 : : */ - 2831 [ - + - + ]: 93 : WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); - 2832 : 93 : mptcp_schedule_work(sk); + 2831 [ - + - + ]: 92 : WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); + 2832 : 92 : mptcp_schedule_work(sk); 2833 : : } else { - 2834 [ - + ]: 2888 : pr_debug("Sending DATA_FIN on subflow %p\n", ssk); - 2835 : 2888 : tcp_send_ack(ssk); - 2836 [ + + ]: 2888 : if (!mptcp_rtx_timer_pending(sk)) - 2837 : 1638 : mptcp_reset_rtx_timer(sk); + 2834 [ - + ]: 2907 : pr_debug("Sending DATA_FIN on subflow %p\n", ssk); + 2835 : 2907 : tcp_send_ack(ssk); + 2836 [ + + ]: 2907 : if (!mptcp_rtx_timer_pending(sk)) + 2837 : 1613 : mptcp_reset_rtx_timer(sk); 2838 : : } 2839 : : break; 2840 : : } 2841 : : - 2842 : 2997 : release_sock(ssk); - 2843 : 2997 : } + 2842 : 3015 : release_sock(ssk); + 2843 : 3015 : } 2844 : : - 2845 : 16921 : void mptcp_set_state(struct sock *sk, int state) + 2845 : 17082 : void mptcp_set_state(struct sock *sk, int state) 2846 : : { - 2847 : 17646 : int oldstate = sk->sk_state; + 2847 : 17751 : int oldstate = sk->sk_state; 2848 : : - 2849 [ + + - ]: 16865 : switch (state) { + 2849 [ + + - ]: 17031 : 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 : 14489 : default: - 2861 [ + + ]: 14489 : if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) + 2860 : 14655 : default: + 2861 [ + + ]: 14655 : if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2862 [ + - ]: 2376 : MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2863 : : } 2864 : : - 2865 : 17646 : inet_sk_state_store(sk, state); - 2866 : 781 : } + 2865 : 17751 : inet_sk_state_store(sk, state); + 2866 : 720 : } 2867 : : 2868 : : static const unsigned char new_state[16] = { 2869 : : /* current state: new state: action: */ @@ -2970,77 +2970,77 @@ 2882 : : [TCP_NEW_SYN_RECV] = TCP_CLOSE, /* should not happen ! */ 2883 : : }; 2884 : : - 2885 : 2542 : static int mptcp_close_state(struct sock *sk) + 2885 : 2592 : static int mptcp_close_state(struct sock *sk) 2886 : : { - 2887 : 2542 : int next = (int)new_state[sk->sk_state]; - 2888 : 2542 : int ns = next & TCP_STATE_MASK; + 2887 : 2592 : int next = (int)new_state[sk->sk_state]; + 2888 : 2592 : int ns = next & TCP_STATE_MASK; 2889 : : - 2890 : 2542 : mptcp_set_state(sk, ns); + 2890 : 2592 : mptcp_set_state(sk, ns); 2891 : : - 2892 : 2542 : return next & TCP_ACTION_FIN; + 2892 : 2592 : return next & TCP_ACTION_FIN; 2893 : : } 2894 : : - 2895 : 343329 : static void mptcp_check_send_data_fin(struct sock *sk) + 2895 : 397645 : static void mptcp_check_send_data_fin(struct sock *sk) 2896 : : { - 2897 : 343329 : struct mptcp_subflow_context *subflow; - 2898 [ - + ]: 343329 : struct mptcp_sock *msk = mptcp_sk(sk); + 2897 : 397645 : struct mptcp_subflow_context *subflow; + 2898 [ - + ]: 397645 : struct mptcp_sock *msk = mptcp_sk(sk); 2899 : : - 2900 [ - + - - ]: 343329 : pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu\n", + 2900 [ - + - - ]: 397645 : 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 [ + + + + : 345472 : if (!msk->snd_data_fin_enable || msk->snd_nxt + 1 != msk->write_seq || - + + - + ] - 2908 : 2143 : mptcp_send_head(sk)) - 2909 : 341186 : return; + 2907 [ + + + + : 399798 : if (!msk->snd_data_fin_enable || msk->snd_nxt + 1 != msk->write_seq || + + + - + ] + 2908 : 2153 : mptcp_send_head(sk)) + 2909 : 395492 : return; 2910 : : - 2911 : 2143 : WRITE_ONCE(msk->snd_nxt, msk->write_seq); + 2911 : 2153 : WRITE_ONCE(msk->snd_nxt, msk->write_seq); 2912 : : - 2913 [ + + ]: 4948 : mptcp_for_each_subflow(msk, subflow) { - 2914 : 2805 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); + 2913 [ + + ]: 4976 : mptcp_for_each_subflow(msk, subflow) { + 2914 : 2823 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); 2915 : : - 2916 : 2805 : mptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN); + 2916 : 2823 : mptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN); 2917 : : } 2918 : : } 2919 : : - 2920 : 2143 : static void __mptcp_wr_shutdown(struct sock *sk) + 2920 : 2156 : static void __mptcp_wr_shutdown(struct sock *sk) 2921 : : { - 2922 [ - + ]: 2143 : struct mptcp_sock *msk = mptcp_sk(sk); + 2922 [ - + ]: 2156 : struct mptcp_sock *msk = mptcp_sk(sk); 2923 : : - 2924 [ - + - - ]: 2143 : pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d\n", + 2924 [ - + - - ]: 2156 : 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 : 2143 : WRITE_ONCE(msk->write_seq, msk->write_seq + 1); - 2930 : 2143 : WRITE_ONCE(msk->snd_data_fin_enable, 1); + 2929 : 2156 : WRITE_ONCE(msk->write_seq, msk->write_seq + 1); + 2930 : 2156 : WRITE_ONCE(msk->snd_data_fin_enable, 1); 2931 : : - 2932 : 2143 : mptcp_check_send_data_fin(sk); - 2933 : 2143 : } + 2932 : 2156 : mptcp_check_send_data_fin(sk); + 2933 : 2156 : } 2934 : : - 2935 : 3614 : static void __mptcp_destroy_sock(struct sock *sk) + 2935 : 3618 : static void __mptcp_destroy_sock(struct sock *sk) 2936 : : { - 2937 [ - + ]: 3614 : struct mptcp_sock *msk = mptcp_sk(sk); + 2937 [ - + ]: 3618 : struct mptcp_sock *msk = mptcp_sk(sk); 2938 : : - 2939 [ - + ]: 3614 : pr_debug("msk=%p\n", msk); + 2939 [ - + ]: 3618 : pr_debug("msk=%p\n", msk); 2940 : : - 2941 : 3614 : might_sleep(); + 2941 : 3618 : might_sleep(); 2942 : : - 2943 : 3614 : mptcp_stop_rtx_timer(sk); - 2944 : 3614 : sk_stop_timer(sk, &sk->sk_timer); - 2945 : 3614 : msk->pm.status = 0; - 2946 : 3614 : mptcp_release_sched(msk); + 2943 : 3618 : mptcp_stop_rtx_timer(sk); + 2944 : 3618 : sk_stop_timer(sk, &sk->sk_timer); + 2945 : 3618 : msk->pm.status = 0; + 2946 : 3618 : mptcp_release_sched(msk); 2947 : : - 2948 : 3614 : sk->sk_prot->destroy(sk); + 2948 : 3618 : sk->sk_prot->destroy(sk); 2949 : : - 2950 : 3614 : sk_stream_kill_queues(sk); - 2951 : 3614 : xfrm_sk_free_policy(sk); + 2950 : 3618 : sk_stream_kill_queues(sk); + 2951 : 3618 : xfrm_sk_free_policy(sk); 2952 : : - 2953 : 3614 : sock_put(sk); - 2954 : 3614 : } + 2953 : 3618 : sock_put(sk); + 2954 : 3618 : } 2955 : : 2956 : 42 : void __mptcp_unaccepted_force_close(struct sock *sk) 2957 : : { @@ -3051,27 +3051,27 @@ 2962 : : 2963 : 0 : static __poll_t mptcp_check_readable(struct sock *sk) 2964 : : { - 2965 [ + + ]: 495401 : return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; + 2965 [ + + ]: 634778 : return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; 2966 : : } 2967 : : - 2968 : 2399 : static void mptcp_check_listen_stop(struct sock *sk) + 2968 : 2379 : static void mptcp_check_listen_stop(struct sock *sk) 2969 : : { - 2970 : 2399 : struct sock *ssk; + 2970 : 2379 : struct sock *ssk; 2971 : : - 2972 [ + + ]: 2399 : if (inet_sk_state_load(sk) != TCP_LISTEN) + 2972 [ + + ]: 2379 : if (inet_sk_state_load(sk) != TCP_LISTEN) 2973 : : return; 2974 : : - 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)) + 2975 : 1250 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); + 2976 [ - + ]: 1250 : ssk = mptcp_sk(sk)->first; + 2977 [ + - - + ]: 2500 : if (WARN_ON_ONCE(!ssk || inet_sk_state_load(ssk) != TCP_LISTEN)) 2978 : 0 : return; 2979 : : - 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); + 2980 : 1250 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); + 2981 : 1250 : tcp_set_state(ssk, TCP_CLOSE); + 2982 : 1250 : mptcp_subflow_queue_clean(sk, ssk); + 2983 : 1250 : inet_csk_listen_stop(ssk); + 2984 : 1250 : mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CLOSED); + 2985 : 1250 : 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 : 2341 : mptcp_check_listen_stop(sk); - 2999 : 2341 : mptcp_set_state(sk, TCP_CLOSE); - 3000 : 2341 : goto cleanup; + 2997 [ + + + + ]: 3634 : if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { + 2998 : 2321 : mptcp_check_listen_stop(sk); + 2999 : 2321 : mptcp_set_state(sk, TCP_CLOSE); + 3000 : 2321 : goto cleanup; 3001 : : } 3002 : : - 3003 [ + + - + ]: 1293 : if (mptcp_data_avail(msk) || timeout < 0) { + 3003 [ + + - + ]: 1313 : 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 [ + + ]: 1083 : } else if (mptcp_close_state(sk)) { - 3010 : 777 : __mptcp_wr_shutdown(sk); + 3007 : 237 : mptcp_do_fastclose(sk); + 3008 : 237 : timeout = 0; + 3009 [ + + ]: 1076 : } else if (mptcp_close_state(sk)) { + 3010 : 726 : __mptcp_wr_shutdown(sk); 3011 : : } 3012 : : - 3013 : 1293 : sk_stream_wait_close(sk, timeout); + 3013 : 1313 : sk_stream_wait_close(sk, timeout); 3014 : : 3015 : 3634 : cleanup: 3016 : : /* orphan all the subflows */ - 3017 [ + + ]: 7918 : mptcp_for_each_subflow(msk, subflow) { - 3018 : 4284 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 3019 : 4284 : bool slow = lock_sock_fast_nested(ssk); + 3017 [ + + ]: 7926 : mptcp_for_each_subflow(msk, subflow) { + 3018 : 4292 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3019 : 4292 : bool slow = lock_sock_fast_nested(ssk); 3020 : : - 3021 : 4284 : subflows_alive += ssk->sk_state != TCP_CLOSE; + 3021 : 4292 : 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 [ + + ]: 4284 : if (ssk == msk->first) + 3026 [ + + ]: 4292 : 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 : 4284 : ssk->sk_socket = NULL; - 3033 : 4284 : ssk->sk_wq = NULL; - 3034 : 4284 : unlock_sock_fast(ssk, slow); + 3032 : 4292 : ssk->sk_socket = NULL; + 3033 : 4292 : ssk->sk_wq = NULL; + 3034 : 4292 : 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 : 1688 : mptcp_set_state(sk, TCP_CLOSE); + 3041 [ + + ]: 3634 : if (subflows_alive == 0) + 3042 : 1710 : 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 : 2604 : __mptcp_destroy_sock(sk); - 3050 : 2604 : do_cancel_work = true; + 3048 [ + + ]: 3634 : if (sk->sk_state == TCP_CLOSE) { + 3049 : 2618 : __mptcp_destroy_sock(sk); + 3050 : 2618 : do_cancel_work = true; 3051 : : } else { - 3052 : 1030 : mptcp_start_tout_timer(sk); + 3052 : 1016 : 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 : 2604 : mptcp_cancel_work(sk); + 3066 [ + + ]: 3634 : if (do_cancel_work) + 3067 : 2618 : mptcp_cancel_work(sk); 3068 : : 3069 : 3634 : sock_put(sk); 3070 : 3634 : } 3071 : : - 3072 : 4928 : static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) + 3072 : 4932 : static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) 3073 : : { 3074 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 3075 [ + - ]: 4928 : const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); - 3076 [ + - ]: 4928 : struct ipv6_pinfo *msk6 = inet6_sk(msk); + 3075 [ + - ]: 4932 : const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); + 3076 [ + - ]: 4932 : struct ipv6_pinfo *msk6 = inet6_sk(msk); 3077 : : - 3078 : 4928 : msk->sk_v6_daddr = ssk->sk_v6_daddr; - 3079 : 4928 : msk->sk_v6_rcv_saddr = ssk->sk_v6_rcv_saddr; + 3078 : 4932 : msk->sk_v6_daddr = ssk->sk_v6_daddr; + 3079 : 4932 : msk->sk_v6_rcv_saddr = ssk->sk_v6_rcv_saddr; 3080 : : - 3081 [ + + ]: 4928 : if (msk6 && ssk6) { - 3082 : 1928 : msk6->saddr = ssk6->saddr; - 3083 : 1928 : msk6->flow_label = ssk6->flow_label; + 3081 [ + + ]: 4932 : if (msk6 && ssk6) { + 3082 : 1930 : msk6->saddr = ssk6->saddr; + 3083 : 1930 : msk6->flow_label = ssk6->flow_label; 3084 : : } 3085 : : #endif 3086 : : - 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 : } + 3087 : 4932 : inet_sk(msk)->inet_num = inet_sk(ssk)->inet_num; + 3088 : 4932 : inet_sk(msk)->inet_dport = inet_sk(ssk)->inet_dport; + 3089 : 4932 : inet_sk(msk)->inet_sport = inet_sk(ssk)->inet_sport; + 3090 : 4932 : inet_sk(msk)->inet_daddr = inet_sk(ssk)->inet_daddr; + 3091 : 4932 : inet_sk(msk)->inet_saddr = inet_sk(ssk)->inet_saddr; + 3092 : 4932 : inet_sk(msk)->inet_rcv_saddr = inet_sk(ssk)->inet_rcv_saddr; + 3093 : 4932 : } 3094 : : 3095 : 58 : static int mptcp_disconnect(struct sock *sk, int flags) 3096 : : { @@ -3380,55 +3380,55 @@ 3287 : 0 : msk->rcvq_space.space = TCP_INIT_CWND * TCP_MSS_DEFAULT; 3288 : 2376 : } 3289 : : - 3290 : 3676 : void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags) + 3290 : 3680 : void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags) 3291 : : { - 3292 : 3676 : struct mptcp_subflow_context *subflow, *tmp; - 3293 : 3676 : struct sock *sk = (struct sock *)msk; + 3292 : 3680 : struct mptcp_subflow_context *subflow, *tmp; + 3293 : 3680 : struct sock *sk = (struct sock *)msk; 3294 : : - 3295 : 3676 : __mptcp_clear_xmit(sk); + 3295 : 3680 : __mptcp_clear_xmit(sk); 3296 : : 3297 : : /* join list will be eventually flushed (with rst) at sock lock release time */ - 3298 [ + + ]: 7904 : mptcp_for_each_subflow_safe(msk, subflow, tmp) - 3299 : 4228 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags); + 3298 [ + + ]: 7920 : mptcp_for_each_subflow_safe(msk, subflow, tmp) + 3299 : 4240 : __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); + 3301 : 3680 : __skb_queue_purge(&sk->sk_receive_queue); + 3302 : 3680 : skb_rbtree_purge(&msk->out_of_order_queue); 3303 : : 3304 : : /* move all the rx fwd alloc into the sk_mem_reclaim_final in 3305 : : * inet_sock_destruct() will dispose it 3306 : : */ - 3307 : 3676 : mptcp_token_destroy(msk); - 3308 : 3676 : mptcp_pm_free_anno_list(msk); - 3309 : 3676 : mptcp_free_local_addr_list(msk); - 3310 : 3676 : } + 3307 : 3680 : mptcp_token_destroy(msk); + 3308 : 3680 : mptcp_pm_free_anno_list(msk); + 3309 : 3680 : mptcp_free_local_addr_list(msk); + 3310 : 3680 : } 3311 : : - 3312 : 3618 : static void mptcp_destroy(struct sock *sk) + 3312 : 3622 : static void mptcp_destroy(struct sock *sk) 3313 : : { - 3314 [ - + ]: 3618 : struct mptcp_sock *msk = mptcp_sk(sk); + 3314 [ - + ]: 3622 : struct mptcp_sock *msk = mptcp_sk(sk); 3315 : : 3316 : : /* allow the following to close even the initial subflow */ - 3317 : 3618 : msk->free_first = 1; - 3318 : 3618 : mptcp_destroy_common(msk, 0); - 3319 : 3618 : sk_sockets_allocated_dec(sk); - 3320 : 3618 : } + 3317 : 3622 : msk->free_first = 1; + 3318 : 3622 : mptcp_destroy_common(msk, 0); + 3319 : 3622 : sk_sockets_allocated_dec(sk); + 3320 : 3622 : } 3321 : : - 3322 : 191249 : void __mptcp_data_acked(struct sock *sk) + 3322 : 275593 : void __mptcp_data_acked(struct sock *sk) 3323 : : { - 3324 [ + + ]: 191249 : if (!sock_owned_by_user(sk)) - 3325 : 125289 : __mptcp_clean_una(sk); + 3324 [ + + ]: 275593 : if (!sock_owned_by_user(sk)) + 3325 : 198590 : __mptcp_clean_una(sk); 3326 : : else - 3327 [ - + ]: 65960 : __set_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->cb_flags); - 3328 : 191249 : } + 3327 [ - + ]: 77003 : __set_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->cb_flags); + 3328 : 275593 : } 3329 : : - 3330 : 701767 : void __mptcp_check_push(struct sock *sk, struct sock *ssk) + 3330 : 1014316 : void __mptcp_check_push(struct sock *sk, struct sock *ssk) 3331 : : { - 3332 [ + + ]: 701767 : if (!mptcp_send_head(sk)) + 3332 [ + + ]: 1014316 : if (!mptcp_send_head(sk)) 3333 : : return; 3334 : : - 3335 [ + + ]: 87981 : if (!sock_owned_by_user(sk)) - 3336 : 64249 : __mptcp_subflow_push_pending(sk, ssk, false); + 3335 [ + + ]: 133606 : if (!sock_owned_by_user(sk)) + 3336 : 99904 : __mptcp_subflow_push_pending(sk, ssk, false); 3337 : : else - 3338 [ - + ]: 23732 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); + 3338 [ - + ]: 33702 : __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 : 1047865 : static void mptcp_release_cb(struct sock *sk) + 3347 : 1222176 : static void mptcp_release_cb(struct sock *sk) 3348 : : __must_hold(&sk->sk_lock.slock) 3349 : : { - 3350 [ - + ]: 1047865 : struct mptcp_sock *msk = mptcp_sk(sk); + 3350 [ - + ]: 1222176 : struct mptcp_sock *msk = mptcp_sk(sk); 3351 : : - 3352 : 626562 : for (;;) { - 3353 : 1112515 : unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); - 3354 : 1112515 : struct list_head join_list; + 3352 : 636299 : for (;;) { + 3353 : 1296354 : unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); + 3354 : 1296354 : struct list_head join_list; 3355 : : - 3356 [ + + ]: 1112515 : if (!flags) + 3356 [ + + ]: 1296354 : if (!flags) 3357 : : break; 3358 : : - 3359 [ + + ]: 64650 : INIT_LIST_HEAD(&join_list); - 3360 [ + + ]: 64650 : list_splice_init(&msk->join_list, &join_list); + 3359 [ + + ]: 74178 : INIT_LIST_HEAD(&join_list); + 3360 [ + + ]: 74178 : 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 : 64650 : msk->cb_flags &= ~flags; - 3370 : 64650 : spin_unlock_bh(&sk->sk_lock.slock); + 3369 : 74178 : msk->cb_flags &= ~flags; + 3370 : 74178 : spin_unlock_bh(&sk->sk_lock.slock); 3371 : : - 3372 [ + + ]: 64650 : if (flags & BIT(MPTCP_FLUSH_JOIN_LIST)) - 3373 : 33 : __mptcp_flush_join_list(sk, &join_list); - 3374 [ + + ]: 64650 : if (flags & BIT(MPTCP_PUSH_PENDING)) - 3375 : 16160 : __mptcp_push_pending(sk, 0); - 3376 [ + + ]: 64650 : if (flags & BIT(MPTCP_RETRANSMIT)) - 3377 : 3328 : __mptcp_retrans(sk); - 3378 [ + + + + ]: 64650 : if ((flags & BIT(MPTCP_DEQUEUE)) && __mptcp_move_skbs(sk)) { + 3372 [ + + ]: 74178 : if (flags & BIT(MPTCP_FLUSH_JOIN_LIST)) + 3373 : 31 : __mptcp_flush_join_list(sk, &join_list); + 3374 [ + + ]: 74178 : if (flags & BIT(MPTCP_PUSH_PENDING)) + 3375 : 19538 : __mptcp_push_pending(sk, 0); + 3376 [ + + ]: 74178 : if (flags & BIT(MPTCP_RETRANSMIT)) + 3377 : 3048 : __mptcp_retrans(sk); + 3378 [ + + + + ]: 74178 : if ((flags & BIT(MPTCP_DEQUEUE)) && __mptcp_move_skbs(sk)) { 3379 : : /* notify ack seq update */ - 3380 : 38461 : mptcp_cleanup_rbuf(msk, 0); - 3381 : 38461 : sk->sk_data_ready(sk); + 3380 : 45767 : mptcp_cleanup_rbuf(msk, 0); + 3381 : 45767 : sk->sk_data_ready(sk); 3382 : : } 3383 : : - 3384 : 64650 : cond_resched(); - 3385 : 64650 : spin_lock_bh(&sk->sk_lock.slock); + 3384 : 74178 : cond_resched(); + 3385 : 74178 : spin_lock_bh(&sk->sk_lock.slock); 3386 : : } 3387 : : - 3388 [ - + - - : 1573952 : if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) - - - + + ] - 3389 : 49020 : __mptcp_clean_una_wakeup(sk); - 3390 [ + + ]: 1047865 : if (unlikely(msk->cb_flags)) { + 3388 [ - + - - : 1922509 : if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) + - - + + ] + 3389 : 51481 : __mptcp_clean_una_wakeup(sk); + 3390 [ + + ]: 1222176 : 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 [ - + - - : 6370 : if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) - - - + + + + 3395 [ - + - - : 6467 : if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) + - - + + + - ] - 3396 : 876 : __mptcp_sync_state(sk, msk->pending_state); - 3397 [ - + - - : 6370 : if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) - - - + + ] - 3398 : 425 : __mptcp_error_report(sk); - 3399 [ - + - - : 6370 : if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) - - - + + ] - 3400 : 1941 : __mptcp_sync_sndbuf(sk); + 3396 : 882 : __mptcp_sync_state(sk, msk->pending_state); + 3397 [ - + - - : 6467 : if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) + - - + + ] + 3398 : 452 : __mptcp_error_report(sk); + 3399 [ - + - - : 6467 : if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) + - - + + ] + 3400 : 1956 : __mptcp_sync_sndbuf(sk); 3401 : : } - 3402 : 1047865 : } + 3402 : 1222176 : } 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 : 499 : static void schedule_3rdack_retransmission(struct sock *ssk) + 3408 : 500 : static void schedule_3rdack_retransmission(struct sock *ssk) 3409 : : { - 3410 : 499 : struct inet_connection_sock *icsk = inet_csk(ssk); - 3411 [ - + ]: 499 : struct tcp_sock *tp = tcp_sk(ssk); - 3412 : 499 : unsigned long timeout; + 3410 : 500 : struct inet_connection_sock *icsk = inet_csk(ssk); + 3411 [ - + ]: 500 : struct tcp_sock *tp = tcp_sk(ssk); + 3412 : 500 : unsigned long timeout; 3413 : : - 3414 [ + + + + ]: 499 : if (READ_ONCE(mptcp_subflow_ctx(ssk)->fully_established)) + 3414 [ + + + + ]: 500 : 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 : 28545 : void mptcp_subflow_process_delegated(struct sock *ssk, long status) + 3431 : 32423 : void mptcp_subflow_process_delegated(struct sock *ssk, long status) 3432 : : { - 3433 [ + + ]: 28545 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 3434 : 28545 : struct sock *sk = subflow->conn; + 3433 [ + + ]: 32423 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 3434 : 32423 : struct sock *sk = subflow->conn; 3435 : : - 3436 [ + + ]: 28545 : if (status & BIT(MPTCP_DELEGATE_SEND)) { - 3437 : 4040 : mptcp_data_lock(sk); - 3438 [ + + ]: 4040 : if (!sock_owned_by_user(sk)) - 3439 : 3749 : __mptcp_subflow_push_pending(sk, ssk, true); + 3436 [ + + ]: 32423 : if (status & BIT(MPTCP_DELEGATE_SEND)) { + 3437 : 4520 : mptcp_data_lock(sk); + 3438 [ + + ]: 4520 : if (!sock_owned_by_user(sk)) + 3439 : 4145 : __mptcp_subflow_push_pending(sk, ssk, true); 3440 : : else - 3441 [ - + ]: 291 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); - 3442 : 4040 : mptcp_data_unlock(sk); + 3441 [ - + ]: 375 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); + 3442 : 4520 : mptcp_data_unlock(sk); 3443 : : } - 3444 [ + + ]: 28545 : if (status & BIT(MPTCP_DELEGATE_SNDBUF)) { - 3445 : 23818 : mptcp_data_lock(sk); - 3446 [ + + ]: 23818 : if (!sock_owned_by_user(sk)) - 3447 : 21584 : __mptcp_sync_sndbuf(sk); + 3444 [ + + ]: 32423 : if (status & BIT(MPTCP_DELEGATE_SNDBUF)) { + 3445 : 27146 : mptcp_data_lock(sk); + 3446 [ + + ]: 27146 : if (!sock_owned_by_user(sk)) + 3447 : 24873 : __mptcp_sync_sndbuf(sk); 3448 : : else - 3449 [ - + ]: 2234 : __set_bit(MPTCP_SYNC_SNDBUF, &mptcp_sk(sk)->cb_flags); - 3450 : 23818 : mptcp_data_unlock(sk); + 3449 [ - + ]: 2273 : __set_bit(MPTCP_SYNC_SNDBUF, &mptcp_sk(sk)->cb_flags); + 3450 : 27146 : mptcp_data_unlock(sk); 3451 : : } - 3452 [ + + ]: 28545 : if (status & BIT(MPTCP_DELEGATE_ACK)) - 3453 : 499 : schedule_3rdack_retransmission(ssk); - 3454 : 28545 : } + 3452 [ + + ]: 32423 : if (status & BIT(MPTCP_DELEGATE_ACK)) + 3453 : 500 : schedule_3rdack_retransmission(ssk); + 3454 : 32423 : } 3455 : : 3456 : 0 : static int mptcp_hash(struct sock *sk) 3457 : : { @@ -3599,59 +3599,59 @@ 3501 : 1124 : mptcp_pm_new_connection(msk, ssk, 0); 3502 : 1124 : } 3503 : : - 3504 : 4653 : void mptcp_sock_graft(struct sock *sk, struct socket *parent) + 3504 : 4654 : void mptcp_sock_graft(struct sock *sk, struct socket *parent) 3505 : : { - 3506 : 4653 : write_lock_bh(&sk->sk_callback_lock); - 3507 : 4653 : rcu_assign_pointer(sk->sk_wq, &parent->wq); - 3508 : 4653 : sk_set_socket(sk, parent); - 3509 : 4653 : sk->sk_uid = SOCK_INODE(parent)->i_uid; - 3510 : 4653 : write_unlock_bh(&sk->sk_callback_lock); - 3511 : 4653 : } + 3506 : 4654 : write_lock_bh(&sk->sk_callback_lock); + 3507 : 4654 : rcu_assign_pointer(sk->sk_wq, &parent->wq); + 3508 : 4654 : sk_set_socket(sk, parent); + 3509 : 4654 : sk->sk_uid = SOCK_INODE(parent)->i_uid; + 3510 : 4654 : write_unlock_bh(&sk->sk_callback_lock); + 3511 : 4654 : } 3512 : : - 3513 : 992 : bool mptcp_finish_join(struct sock *ssk) + 3513 : 994 : bool mptcp_finish_join(struct sock *ssk) 3514 : : { - 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; + 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; 3519 : : - 3520 [ - + ]: 992 : pr_debug("msk=%p, subflow=%p\n", msk, subflow); + 3520 [ - + ]: 994 : pr_debug("msk=%p, subflow=%p\n", msk, subflow); 3521 : : 3522 : : /* mptcp socket already closing? */ - 3523 [ - + ]: 992 : if (!mptcp_is_fully_established(parent)) { + 3523 [ - + ]: 994 : 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 [ + + ]: 992 : if (!list_empty(&subflow->node)) { - 3530 : 487 : mptcp_subflow_joined(msk, ssk); - 3531 : 487 : mptcp_propagate_sndbuf(parent, ssk); - 3532 : 487 : return true; + 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; 3533 : : } 3534 : : - 3535 [ - + ]: 505 : if (!mptcp_pm_allow_new_subflow(msk)) + 3535 [ - + ]: 506 : 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 : 505 : mptcp_data_lock(parent); - 3542 [ + + ]: 505 : if (!sock_owned_by_user(parent)) { - 3543 : 472 : ret = __mptcp_finish_join(msk, ssk); - 3544 [ + - ]: 472 : if (ret) { - 3545 : 472 : sock_hold(ssk); - 3546 : 472 : list_add_tail(&subflow->node, &msk->conn_list); + 3541 : 506 : mptcp_data_lock(parent); + 3542 [ + + ]: 506 : if (!sock_owned_by_user(parent)) { + 3543 : 473 : ret = __mptcp_finish_join(msk, ssk); + 3544 [ + - ]: 473 : if (ret) { + 3545 : 473 : sock_hold(ssk); + 3546 : 473 : list_add_tail(&subflow->node, &msk->conn_list); 3547 : : } 3548 : : } else { 3549 : 33 : sock_hold(ssk); - 3550 [ - + ]: 33 : list_add_tail(&subflow->node, &msk->join_list); + 3550 [ - + ]: 33 : list_add_tail(&subflow->node, &msk->join_list); 3551 [ - + - - : 33 : __set_bit(MPTCP_FLUSH_JOIN_LIST, &msk->cb_flags); - - ] 3552 : : } - 3553 : 505 : mptcp_data_unlock(parent); + 3553 : 506 : mptcp_data_unlock(parent); 3554 : : - 3555 [ - + ]: 505 : if (!ret) { + 3555 [ - + ]: 506 : 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 : 1459 : static void mptcp_shutdown(struct sock *sk, int how) + 3564 : 1516 : static void mptcp_shutdown(struct sock *sk, int how) 3565 : : { - 3566 [ - + ]: 1459 : pr_debug("sk=%p, how=%d\n", sk, how); + 3566 [ - + ]: 1516 : pr_debug("sk=%p, how=%d\n", sk, how); 3567 : : - 3568 [ + - + + ]: 1459 : if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) - 3569 : 1366 : __mptcp_wr_shutdown(sk); - 3570 : 1459 : } + 3568 [ + - + + ]: 1516 : if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) + 3569 : 1430 : __mptcp_wr_shutdown(sk); + 3570 : 1516 : } 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 : 1242 : mptcp_copy_inaddrs(sk, ssk); + 3764 [ + + ]: 1246 : if (!err) + 3765 : 1244 : mptcp_copy_inaddrs(sk, ssk); 3766 : : - 3767 : 4 : unlock: + 3767 : 2 : unlock: 3768 : 1246 : release_sock(sk); 3769 : 1246 : return err; 3770 : : } 3771 : : - 3772 : 1242 : static int mptcp_listen(struct socket *sock, int backlog) + 3772 : 1244 : static int mptcp_listen(struct socket *sock, int backlog) 3773 : : { - 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; + 3774 [ - + ]: 1244 : struct mptcp_sock *msk = mptcp_sk(sock->sk); + 3775 : 1244 : struct sock *sk = sock->sk; + 3776 : 1244 : struct sock *ssk; + 3777 : 1244 : int err; 3778 : : - 3779 [ - + ]: 1242 : pr_debug("msk=%p\n", msk); + 3779 [ - + ]: 1244 : pr_debug("msk=%p\n", msk); 3780 : : - 3781 : 1242 : lock_sock(sk); + 3781 : 1244 : lock_sock(sk); 3782 : : - 3783 : 1242 : err = -EINVAL; - 3784 [ - + ]: 1242 : if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM) + 3783 : 1244 : err = -EINVAL; + 3784 [ - + ]: 1244 : if (sock->state != SS_UNCONNECTED || sock->type != SOCK_STREAM) 3785 : 0 : goto unlock; 3786 : : - 3787 : 1242 : ssk = __mptcp_nmpc_sk(msk); - 3788 [ - + ]: 1242 : if (IS_ERR(ssk)) { + 3787 : 1244 : ssk = __mptcp_nmpc_sk(msk); + 3788 [ - + ]: 1244 : if (IS_ERR(ssk)) { 3789 : 0 : err = PTR_ERR(ssk); 3790 : 0 : goto unlock; 3791 : : } 3792 : : - 3793 : 1242 : mptcp_set_state(sk, TCP_LISTEN); - 3794 : 1242 : sock_set_flag(sk, SOCK_RCU_FREE); + 3793 : 1244 : mptcp_set_state(sk, TCP_LISTEN); + 3794 : 1244 : sock_set_flag(sk, SOCK_RCU_FREE); 3795 : : - 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)); + 3796 : 1244 : lock_sock(ssk); + 3797 : 1244 : err = __inet_listen_sk(ssk, backlog); + 3798 : 1244 : release_sock(ssk); + 3799 : 1244 : mptcp_set_state(sk, inet_sk_state_load(ssk)); 3800 : : - 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); + 3801 [ - + ]: 1244 : if (!err) { + 3802 : 1244 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); + 3803 : 1244 : mptcp_copy_inaddrs(sk, ssk); + 3804 : 1244 : mptcp_event_pm_listener(ssk, MPTCP_EVENT_LISTENER_CREATED); 3805 : : } 3806 : : 3807 : 0 : unlock: - 3808 : 1242 : release_sock(sk); - 3809 : 1242 : return err; + 3808 : 1244 : release_sock(sk); + 3809 : 1244 : 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 [ + + ]: 2246 : mptcp_for_each_subflow(msk, subflow) { - 3863 [ + - ]: 1126 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3862 [ + + ]: 2251 : mptcp_for_each_subflow(msk, subflow) { + 3863 [ + - ]: 1131 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 3864 : : - 3865 [ + - ]: 1126 : if (!ssk->sk_socket) - 3866 : 1126 : mptcp_sock_graft(ssk, newsock); + 3865 [ + - ]: 1131 : if (!ssk->sk_socket) + 3866 : 1131 : 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 : 265914 : static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) + 3897 : 352897 : static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) 3898 : : { - 3899 : 265914 : struct sock *sk = (struct sock *)msk; + 3899 : 352897 : struct sock *sk = (struct sock *)msk; 3900 : : - 3901 [ + + ]: 265914 : if (__mptcp_stream_is_writeable(sk, 1)) + 3901 [ + + ]: 352897 : if (__mptcp_stream_is_writeable(sk, 1)) 3902 : : return EPOLLOUT | EPOLLWRNORM; 3903 : : - 3904 : 83990 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - 3905 : 83990 : smp_mb__after_atomic(); /* NOSPACE is changed by mptcp_write_space() */ - 3906 [ + + ]: 83990 : if (__mptcp_stream_is_writeable(sk, 1)) + 3904 : 94915 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + 3905 : 94915 : smp_mb__after_atomic(); /* NOSPACE is changed by mptcp_write_space() */ + 3906 [ - + ]: 94915 : if (__mptcp_stream_is_writeable(sk, 1)) 3907 : : return EPOLLOUT | EPOLLWRNORM; 3908 : : 3909 : : return 0; 3910 : : } 3911 : : - 3912 : 497289 : static __poll_t mptcp_poll(struct file *file, struct socket *sock, + 3912 : 636666 : static __poll_t mptcp_poll(struct file *file, struct socket *sock, 3913 : : struct poll_table_struct *wait) 3914 : : { - 3915 : 497289 : struct sock *sk = sock->sk; - 3916 : 497289 : struct mptcp_sock *msk; - 3917 : 497289 : __poll_t mask = 0; - 3918 : 497289 : u8 shutdown; - 3919 : 497289 : int state; + 3915 : 636666 : struct sock *sk = sock->sk; + 3916 : 636666 : struct mptcp_sock *msk; + 3917 : 636666 : __poll_t mask = 0; + 3918 : 636666 : u8 shutdown; + 3919 : 636666 : int state; 3920 : : - 3921 [ - + ]: 497289 : msk = mptcp_sk(sk); - 3922 : 497289 : sock_poll_wait(file, sock, wait); + 3921 [ - + ]: 636666 : msk = mptcp_sk(sk); + 3922 : 636666 : sock_poll_wait(file, sock, wait); 3923 : : - 3924 : 497289 : state = inet_sk_state_load(sk); - 3925 [ - + ]: 497289 : pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags); - 3926 [ + + ]: 497289 : if (state == TCP_LISTEN) { + 3924 : 636666 : state = inet_sk_state_load(sk); + 3925 [ - + ]: 636666 : pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags); + 3926 [ + + ]: 636666 : 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 : 495401 : shutdown = READ_ONCE(sk->sk_shutdown); - 3936 [ + + ]: 495401 : if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) - 3937 : 14163 : mask |= EPOLLHUP; - 3938 [ + + ]: 495401 : if (shutdown & RCV_SHUTDOWN) - 3939 : 168678 : mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; + 3935 : 634778 : shutdown = READ_ONCE(sk->sk_shutdown); + 3936 [ + + ]: 634778 : if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) + 3937 : 6300 : mask |= EPOLLHUP; + 3938 [ + + ]: 634778 : if (shutdown & RCV_SHUTDOWN) + 3939 : 195999 : mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; 3940 : : - 3941 [ + - ]: 495401 : if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { - 3942 : 495401 : mask |= mptcp_check_readable(sk); - 3943 [ + + ]: 495401 : if (shutdown & SEND_SHUTDOWN) - 3944 : 229487 : mask |= EPOLLOUT | EPOLLWRNORM; + 3941 [ + - ]: 634778 : if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { + 3942 : 634778 : mask |= mptcp_check_readable(sk); + 3943 [ + + ]: 634778 : if (shutdown & SEND_SHUTDOWN) + 3944 : 281881 : mask |= EPOLLOUT | EPOLLWRNORM; 3945 : : else - 3946 : 265914 : mask |= mptcp_check_writeable(msk); + 3946 : 352897 : 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 : 495401 : smp_rmb(); - 3955 [ + + ]: 495401 : if (READ_ONCE(sk->sk_err)) - 3956 : 20 : mask |= EPOLLERR; + 3954 : 634778 : smp_rmb(); + 3955 [ + + ]: 634778 : if (READ_ONCE(sk->sk_err)) + 3956 : 23 : mask |= EPOLLERR; 3957 : : 3958 : : return mask; 3959 : : } @@ -4088,40 +4088,40 @@ 3988 : : .flags = INET_PROTOSW_ICSK, 3989 : : }; 3990 : : - 3991 : 39070 : static int mptcp_napi_poll(struct napi_struct *napi, int budget) + 3991 : 41486 : static int mptcp_napi_poll(struct napi_struct *napi, int budget) 3992 : : { - 3993 : 39070 : struct mptcp_delegated_action *delegated; - 3994 : 39070 : struct mptcp_subflow_context *subflow; - 3995 : 39070 : int work_done = 0; + 3993 : 41486 : struct mptcp_delegated_action *delegated; + 3994 : 41486 : struct mptcp_subflow_context *subflow; + 3995 : 41486 : int work_done = 0; 3996 : : - 3997 : 39070 : delegated = container_of(napi, struct mptcp_delegated_action, napi); - 3998 [ + + ]: 79243 : while ((subflow = mptcp_subflow_delegated_next(delegated)) != NULL) { - 3999 : 40173 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3997 : 41486 : delegated = container_of(napi, struct mptcp_delegated_action, napi); + 3998 [ + + ]: 84227 : while ((subflow = mptcp_subflow_delegated_next(delegated)) != NULL) { + 3999 : 42741 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 4000 : : - 4001 : 40173 : bh_lock_sock_nested(ssk); - 4002 [ + + ]: 40173 : if (!sock_owned_by_user(ssk)) { - 4003 : 26111 : mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0)); + 4001 : 42741 : bh_lock_sock_nested(ssk); + 4002 [ + + ]: 42741 : if (!sock_owned_by_user(ssk)) { + 4003 : 29838 : 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 : 14062 : smp_wmb(); - 4011 : 14062 : clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status); + 4010 : 12903 : smp_wmb(); + 4011 : 12903 : clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status); 4012 : : } - 4013 : 40173 : bh_unlock_sock(ssk); - 4014 : 40173 : sock_put(ssk); + 4013 : 42741 : bh_unlock_sock(ssk); + 4014 : 42741 : sock_put(ssk); 4015 : : - 4016 [ + - ]: 40173 : if (++work_done == budget) + 4016 [ + - ]: 42741 : 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 : 39070 : napi_complete_done(napi, 0); - 4024 : 39070 : return work_done; + 4023 : 41486 : napi_complete_done(napi, 0); + 4024 : 41486 : 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 80a3e241..ec2e702f 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 @@ -88,231 +88,231 @@ mptcp_send_active_reset_reason - 48 + 44 mptcp_do_fallback - 82 + 80 mptcp_pm_close_subflow - 93 + 94 __mptcp_do_fallback - 106 + 104 __mptcp_pm_close_subflow - 388 + 385 __mptcp_has_initial_subflow - 1017 + 1036 mptcp_start_tout_timer - 1063 + 1052 mptcp_stop_tout_timer - 1097 + 1098 mptcp_is_fully_established - 2154 + 2158 mptcp_space_from_win - 2580 + 2738 subflow_simultaneous_connect - 5056 + 4973 __mptcp_sync_sndbuf - 31783 + 35157 mptcp_check_infinite_map - 32579 + 53093 - mptcp_subflow_delegate + mptcp_subflow_delegated_next - 72010 + 84227 - mptcp_subflow_delegated_next + mptcp_subflow_delegate - 79243 + 88279 mptcp_rtx_head - 190751 + 272443 mptcp_propagate_sndbuf - 294292 + 393144 __mptcp_stream_is_writeable - 349904 + 447812 - mptcp_write_space + mptcp_send_next - 382829 + 472495 - mptcp_send_next + mptcp_write_space - 399641 + 490480 - mptcp_check_fallback + mptcp_pending_tail - 418358 + 610594 - mptcp_pending_tail + mptcp_check_fallback - 510811 + 616277 - mptcp_epollin_ready + __tcp_can_send - 750447 + 793587 - __tcp_can_send + mptcp_data_fin_enabled - 793881 + 832217 - mptcp_data_fin_enabled + __mptcp_space - 847802 + 872624 - __mptcp_subflow_active + mptcp_epollin_ready - 879744 + 1058800 - __mptcp_space + __mptcp_subflow_active - 921685 + 1128077 mptcp_stream_memory_free - 1045769 + 1346702 mptcp_notsent_lowat - 1556580 + 1957296 mptcp_subflow_get_map_offset - 1942722 + 2924035 mptcp_send_head - 2408748 + 3148101 mptcp_win_from_space - 2577623 + 3431465 __mptcp_check_fallback - 4608551 + 6475870 diff --git a/html/lcov/export/mptcp/protocol.h.func.html b/html/lcov/export/mptcp/protocol.h.func.html index c6e90315..dcb97a12 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 @@ -81,203 +81,203 @@ __mptcp_check_fallback - 4608551 + 6475870 __mptcp_do_fallback - 106 + 104 __mptcp_has_initial_subflow - 1017 + 1036 __mptcp_pm_close_subflow - 388 + 385 __mptcp_space - 921685 + 872624 __mptcp_stream_is_writeable - 349904 + 447812 __mptcp_subflow_active - 879744 + 1128077 __mptcp_sync_sndbuf - 31783 + 35157 __tcp_can_send - 793881 + 793587 mptcp_check_fallback - 418358 + 616277 mptcp_check_infinite_map - 32579 + 53093 mptcp_data_fin_enabled - 847802 + 832217 mptcp_do_fallback - 82 + 80 mptcp_epollin_ready - 750447 + 1058800 mptcp_is_fully_established - 2154 + 2158 mptcp_notsent_lowat - 1556580 + 1957296 mptcp_pending_tail - 510811 + 610594 mptcp_pm_close_subflow - 93 + 94 mptcp_propagate_sndbuf - 294292 + 393144 mptcp_rtx_head - 190751 + 272443 mptcp_send_active_reset_reason - 48 + 44 mptcp_send_head - 2408748 + 3148101 mptcp_send_next - 399641 + 472495 mptcp_space_from_win - 2580 + 2738 mptcp_start_tout_timer - 1063 + 1052 mptcp_stop_tout_timer - 1097 + 1098 mptcp_stream_memory_free - 1045769 + 1346702 mptcp_subflow_delegate - 72010 + 88279 mptcp_subflow_delegated_next - 79243 + 84227 @@ -291,28 +291,28 @@ mptcp_subflow_get_map_offset - 1942722 + 2924035 mptcp_win_from_space - 2577623 + 3431465 mptcp_write_space - 382829 + 490480 subflow_simultaneous_connect - 5056 + 4973 diff --git a/html/lcov/export/mptcp/protocol.h.gcov.html b/html/lcov/export/mptcp/protocol.h.gcov.html index fe9562cd..4bee4be8 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 71.7 % - 474 - 340 + 72.3 % + 528 + 382 @@ -214,17 +214,23 @@ 136 : : 137 : : #define MPTCP_SKB_CB(__skb) ((struct mptcp_skb_cb *)&((__skb)->cb[0])) 138 : : - 139 : 368640 : static inline bool before64(__u64 seq1, __u64 seq2) + 139 : 386427 : static inline bool before64(__u64 seq1, __u64 seq2) 140 : : { - 141 [ + + ][ + + : 5160132 : return (__s64)(seq1 - seq2) < 0; - + + + + + - + + + + + - + + - + + - + + + + + - + + + + + - + ][ + + + - + + + + + - + + + + ] + 141 [ + + - - : 6981829 : 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 [ + - + + : 642923 : return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) | - + + + - ] + 182 [ + - + + : 846465 : 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 : 268901 : static inline void msk_owned_by_me(const struct mptcp_sock *msk) + 362 : 268143 : static inline void msk_owned_by_me(const struct mptcp_sock *msk) 363 : : { - 364 : 624107 : sock_owned_by_me((const struct sock *)msk); + 364 : 602403 : 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 : 2577623 : static inline int mptcp_win_from_space(const struct sock *sk, int space) + 385 : 3431465 : static inline int mptcp_win_from_space(const struct sock *sk, int space) 386 : : { - 387 [ - + ]: 2577623 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space); + 387 [ - + ]: 3431465 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space); 388 : : } 389 : : - 390 : 2580 : static inline int mptcp_space_from_win(const struct sock *sk, int win) + 390 : 2738 : static inline int mptcp_space_from_win(const struct sock *sk, int win) 391 : : { - 392 [ - + ]: 2580 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win); + 392 [ - + ]: 2738 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win); 393 : : } 394 : : - 395 : 1137925 : static inline int __mptcp_space(const struct sock *sk) + 395 : 1088866 : static inline int __mptcp_space(const struct sock *sk) 396 : : { - 397 : 1588950 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - - 398 : 437444 : sk_rmem_alloc_get(sk)); + 397 : 2065799 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - + 398 : 441956 : sk_rmem_alloc_get(sk)); 399 : : } 400 : : - 401 : 2408748 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk) + 401 : 3148101 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk) 402 : : { - 403 [ - + ]: 2408748 : const struct mptcp_sock *msk = mptcp_sk(sk); + 403 [ - + ]: 3148101 : const struct mptcp_sock *msk = mptcp_sk(sk); 404 : : - 405 : 2408748 : return READ_ONCE(msk->first_pending); + 405 : 3148101 : return READ_ONCE(msk->first_pending); 406 : : } 407 : : - 408 : 399641 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk) + 408 : 472495 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk) 409 : : { - 410 [ - + ]: 399641 : struct mptcp_sock *msk = mptcp_sk(sk); - 411 : 399641 : struct mptcp_data_frag *cur; + 410 [ - + ]: 472495 : struct mptcp_sock *msk = mptcp_sk(sk); + 411 : 472495 : struct mptcp_data_frag *cur; 412 : : - 413 : 399641 : cur = msk->first_pending; - 414 [ + + ]: 399641 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL : - 415 : 70990 : list_next_entry(cur, list); + 413 : 472495 : cur = msk->first_pending; + 414 [ + + ]: 472495 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL : + 415 : 93837 : list_next_entry(cur, list); 416 : : } 417 : : - 418 : 510811 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk) + 418 : 610594 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk) 419 : : { - 420 [ - + ]: 510811 : const struct mptcp_sock *msk = mptcp_sk(sk); + 420 [ - + ]: 610594 : const struct mptcp_sock *msk = mptcp_sk(sk); 421 : : - 422 [ + + ]: 510811 : if (!msk->first_pending) + 422 [ + + ]: 610594 : if (!msk->first_pending) 423 : : return NULL; 424 : : - 425 [ - + + - ]: 182181 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue))) + 425 [ - + + - ]: 231964 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue))) 426 : : return NULL; 427 : : - 428 : 182181 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list); + 428 : 231964 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list); 429 : : } 430 : : - 431 : 190751 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk) + 431 : 272443 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk) 432 : : { - 433 [ - + ]: 190751 : struct mptcp_sock *msk = mptcp_sk(sk); + 433 [ - + ]: 272443 : struct mptcp_sock *msk = mptcp_sk(sk); 434 : : - 435 [ + + ]: 190751 : if (msk->snd_una == msk->snd_nxt) + 435 [ + + ]: 272443 : if (msk->snd_una == msk->snd_nxt) 436 : : return NULL; 437 : : - 438 [ + + ]: 164254 : return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list); + 438 [ + + ]: 229497 : 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 [ - + + - ]: 226458 : const struct inet_connection_sock *icsk = inet_csk(sk); + 577 [ - + + - ]: 349783 : const struct inet_connection_sock *icsk = inet_csk(sk); 578 : : 579 : : /* Use RCU on icsk_ulp_data only for sock diag code */ - 580 [ + + ][ - + : 19998214 : return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data; - + + - + - - + ][ + + + - - + - - + - - + + + + - + + + - + - - + + + + - + - + - - - - + + + + - - + + - + - - + - + + - + + - + - - - + ][ + + - + - - + - - + + + + + - + + + + + - + - + + + - - + + + + - + ][ + + - - + - + - + - + + - + + - - + + - + - - + - + - - + + + ] + 580 [ + + ][ - + : 27921593 : 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 [ + + + + : 3681787 : return subflow->tcp_sock; + 586 [ + + + + : 4410863 : return subflow->tcp_sock; + + ][ + + + + + + ] - [ - + + + ] - [ + - - + - + - + + + - + - + - - - + + + + + - + - - - + [ - + + + ] + [ + - - + + + - + + + + + - + - - + + + + + + + + - - - - ] 587 : : } 588 : : 589 : : static inline void 590 : 30 : mptcp_subflow_ctx_reset(struct mptcp_subflow_context *subflow) 591 : : { - 592 : 758 : memset(&subflow->reset, 0, sizeof(subflow->reset)); - 593 : 758 : subflow->request_mptcp = 1; - 594 : 758 : WRITE_ONCE(subflow->local_id, -1); - 595 : 758 : } + 592 : 818 : memset(&subflow->reset, 0, sizeof(subflow->reset)); + 593 : 818 : subflow->request_mptcp = 1; + 594 : 818 : WRITE_ONCE(subflow->local_id, -1); + 595 : 818 : } 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 : 48 : mptcp_send_active_reset_reason(struct sock *sk) + 625 : 44 : mptcp_send_active_reset_reason(struct sock *sk) 626 : : { - 627 : 48 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 628 : 48 : 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 [ + - ]: 48 : reason = sk_rst_convert_mptcp_reason(subflow->reset_reason); - 631 : 48 : tcp_send_active_reset(sk, GFP_ATOMIC, reason); - 632 : 48 : } + 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 : 1942722 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow) + 635 : 2924035 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow) 636 : : { - 637 [ - + ]: 1942722 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq - - 638 : 1942722 : subflow->ssn_offset - - 639 : 1942722 : subflow->map_subflow_seq; + 637 [ - + ]: 2924035 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq - + 638 : 2924035 : subflow->ssn_offset - + 639 : 2924035 : subflow->map_subflow_seq; 640 : : } 641 : : 642 : : static inline u64 - 643 : 139273 : mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) + 643 : 143697 : mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) 644 : : { - 645 [ + + ]: 829812 : return subflow->map_seq + mptcp_subflow_get_map_offset(subflow); + 645 [ + + ]: 1225490 : 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 : 72010 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action) + 650 : 88279 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action) 651 : : { - 652 [ - + ]: 72010 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action); - 653 : 72010 : struct mptcp_delegated_action *delegated; - 654 : 72010 : bool schedule; + 652 [ - + ]: 88279 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action); + 653 : 88279 : struct mptcp_delegated_action *delegated; + 654 : 88279 : bool schedule; 655 : : 656 : : /* the caller held the subflow bh socket lock */ - 657 [ + - + - : 72010 : lockdep_assert_in_softirq(); - + - + - - - + ] + 657 [ + - + - : 88279 : 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 [ - + - + ]: 72010 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits); - 664 [ + + ]: 72010 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) { - 665 [ - + + - ]: 40173 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node))) + 663 [ - + - + ]: 88279 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits); + 664 [ + + ]: 88279 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) { + 665 [ - + + - ]: 42741 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node))) 666 : : return; 667 : : - 668 : 40173 : delegated = this_cpu_ptr(&mptcp_delegated_actions); - 669 : 40173 : schedule = list_empty(&delegated->head); - 670 : 40173 : list_add_tail(&subflow->delegated_node, &delegated->head); - 671 : 40173 : sock_hold(mptcp_subflow_tcp_sock(subflow)); - 672 [ + + ]: 40173 : if (schedule) - 673 : 39165 : napi_schedule(&delegated->napi); + 668 : 42741 : delegated = this_cpu_ptr(&mptcp_delegated_actions); + 669 : 42741 : schedule = list_empty(&delegated->head); + 670 : 42741 : list_add_tail(&subflow->delegated_node, &delegated->head); + 671 : 42741 : sock_hold(mptcp_subflow_tcp_sock(subflow)); + 672 [ + + ]: 42741 : if (schedule) + 673 : 41564 : napi_schedule(&delegated->napi); 674 : : } 675 : : } 676 : : 677 : : static inline struct mptcp_subflow_context * - 678 : 79243 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) + 678 : 84227 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) 679 : : { - 680 : 79243 : struct mptcp_subflow_context *ret; + 680 : 84227 : struct mptcp_subflow_context *ret; 681 : : - 682 [ + + ]: 79243 : if (list_empty(&delegated->head)) + 682 [ + + ]: 84227 : if (list_empty(&delegated->head)) 683 : : return NULL; 684 : : - 685 : 40173 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node); - 686 : 40173 : list_del_init(&ret->delegated_node); - 687 : 40173 : return ret; + 685 : 42741 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node); + 686 : 42741 : list_del_init(&ret->delegated_node); + 687 : 42741 : 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 : 87760 : static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) + 756 : 90601 : static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) 757 : : { - 758 [ + + ]: 428401 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); + 758 [ + + ]: 645222 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); 759 : : } 760 : : - 761 : 750447 : static inline bool mptcp_epollin_ready(const struct sock *sk) + 761 : 1058800 : static inline bool mptcp_epollin_ready(const struct sock *sk) 762 : : { - 763 [ - + ]: 750447 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk)); + 763 [ - + ]: 1058800 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk)); 764 : : - 765 [ + + ]: 750447 : if (!data_avail) + 765 [ + + ]: 1058800 : 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 : 476408 : return (data_avail >= sk->sk_rcvlowat) || + 771 : 724780 : return (data_avail >= sk->sk_rcvlowat) || 772 : : (mem_cgroup_sockets_enabled && sk->sk_memcg && - 773 [ - + ]: 952816 : mem_cgroup_under_socket_pressure(sk->sk_memcg)) || + 773 [ - + ]: 1449560 : 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 : 1027647 : static inline bool __tcp_can_send(const struct sock *ssk) + 779 : 1029535 : static inline bool __tcp_can_send(const struct sock *ssk) 780 : : { 781 : : /* only send if our side has not closed yet */ - 782 [ + + ]: 1058157 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); + 782 [ + + ]: 1255054 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); 783 : : } 784 : : - 785 : 879744 : static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow) + 785 : 1128077 : 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 [ + + + + : 879744 : if (subflow->request_join && !READ_ONCE(subflow->fully_established)) - + + ] + 788 [ + + + + : 1128077 : if (subflow->request_join && !READ_ONCE(subflow->fully_established)) + + + ] 789 : : return false; 790 : : - 791 : 879328 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); + 791 : 1127709 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); 792 : : } 793 : : 794 : : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow); @@ -946,9 +957,9 @@ 824 : : void __mptcp_sync_state(struct sock *sk, int state); 825 : : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); 826 : : - 827 : 1097 : static inline void mptcp_stop_tout_timer(struct sock *sk) + 827 : 1098 : static inline void mptcp_stop_tout_timer(struct sock *sk) 828 : : { - 829 [ + + ]: 1097 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp) + 829 [ + + ]: 1098 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp) 830 : : return; 831 : : 832 : 4 : sk_stop_timer(sk, &sk->sk_timer); @@ -961,16 +972,16 @@ 839 : 42 : inet_csk(sk)->icsk_mtup.probe_timestamp = tout ? : 1; 840 : : } 841 : : - 842 : 1063 : static inline void mptcp_start_tout_timer(struct sock *sk) + 842 : 1052 : static inline void mptcp_start_tout_timer(struct sock *sk) 843 : : { - 844 : 1063 : mptcp_set_close_tout(sk, tcp_jiffies32); - 845 [ - + ]: 1063 : mptcp_reset_tout_timer(mptcp_sk(sk), 0); - 846 : 1063 : } + 844 : 1052 : mptcp_set_close_tout(sk, tcp_jiffies32); + 845 [ - + ]: 1052 : mptcp_reset_tout_timer(mptcp_sk(sk), 0); + 846 : 1052 : } 847 : : - 848 : 2154 : static inline bool mptcp_is_fully_established(struct sock *sk) + 848 : 2158 : static inline bool mptcp_is_fully_established(struct sock *sk) 849 : : { - 850 [ + - ]: 2154 : return inet_sk_state_load(sk) == TCP_ESTABLISHED && - 851 [ - + - + : 2154 : READ_ONCE(mptcp_sk(sk)->fully_established); + 850 [ + - ]: 2158 : return inet_sk_state_load(sk) == TCP_ESTABLISHED && + 851 [ - + - + : 2158 : 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 : 190843 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit) + 864 : 194837 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit) 865 : : { - 866 [ + + ]: 1128778 : if (use_64bit) - [ + + + + ] + 866 [ + + + + ]: 1661555 : if (use_64bit) + [ + + + + ] 867 : : return cur_seq; 868 : : - 869 : 13282 : return __mptcp_expand_seq(old_seq, cur_seq); + 869 : 129089 : 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 : 1046865 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) + 875 : 1031995 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) 876 : : { - 877 [ + + + + ]: 1481306 : return READ_ONCE(msk->snd_data_fin_enable) && - [ + + ] - 878 [ + + - + ]: 85406 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); - [ + + ] + 877 [ + + + + ]: 2058001 : return READ_ONCE(msk->snd_data_fin_enable) && + [ + + + + ] + 878 [ + + - + ]: 109377 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); + [ + + - + ] 879 : : } 880 : : - 881 : 1556580 : static inline u32 mptcp_notsent_lowat(const struct sock *sk) + 881 : 1957296 : static inline u32 mptcp_notsent_lowat(const struct sock *sk) 882 : : { - 883 [ - + ]: 1556580 : struct net *net = sock_net(sk); - 884 : 1556580 : u32 val; + 883 [ - + ]: 1957296 : struct net *net = sock_net(sk); + 884 : 1957296 : u32 val; 885 : : - 886 [ - + ]: 1556580 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat); - 887 [ + - ]: 1556580 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); + 886 [ - + ]: 1957296 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat); + 887 [ + - ]: 1957296 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); 888 : : } 889 : : - 890 : 1045769 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake) + 890 : 1346702 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake) 891 : : { - 892 [ - + ]: 1045769 : const struct mptcp_sock *msk = mptcp_sk(sk); - 893 : 1045769 : u32 notsent_bytes; + 892 [ - + ]: 1346702 : const struct mptcp_sock *msk = mptcp_sk(sk); + 893 : 1346702 : u32 notsent_bytes; 894 : : - 895 : 1045769 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt); - 896 [ - + ]: 1045769 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk); + 895 : 1346702 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt); + 896 [ - + ]: 1346702 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk); 897 : : } 898 : : - 899 : 349904 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake) + 899 : 447812 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake) 900 : : { - 901 [ + - + + ]: 699808 : return mptcp_stream_memory_free(sk, wake) && - 902 : 349904 : __sk_stream_is_writeable(sk, wake); + 901 [ + - + + ]: 895624 : return mptcp_stream_memory_free(sk, wake) && + 902 : 447812 : __sk_stream_is_writeable(sk, wake); 903 : : } 904 : : - 905 : 382829 : static inline void mptcp_write_space(struct sock *sk) + 905 : 490480 : static inline void mptcp_write_space(struct sock *sk) 906 : : { 907 : : /* pairs with memory barrier in mptcp_poll */ - 908 : 382829 : smp_mb(); - 909 [ + - ]: 382829 : if (mptcp_stream_memory_free(sk, 1)) - 910 : 382829 : sk_stream_write_space(sk); - 911 : 382829 : } + 908 : 490480 : smp_mb(); + 909 [ + - ]: 490480 : if (mptcp_stream_memory_free(sk, 1)) + 910 : 490480 : sk_stream_write_space(sk); + 911 : 490480 : } 912 : : - 913 : 31783 : static inline void __mptcp_sync_sndbuf(struct sock *sk) + 913 : 35157 : static inline void __mptcp_sync_sndbuf(struct sock *sk) 914 : : { - 915 : 31783 : struct mptcp_subflow_context *subflow; - 916 : 31783 : int ssk_sndbuf, new_sndbuf; + 915 : 35157 : struct mptcp_subflow_context *subflow; + 916 : 35157 : int ssk_sndbuf, new_sndbuf; 917 : : - 918 [ + - ]: 31783 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) + 918 [ + - ]: 35157 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) 919 : : return; 920 : : - 921 [ - + ]: 31783 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]); - 922 [ - + - + : 90784 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) { - + + ] - 923 : 59001 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf); + 921 [ - + ]: 35157 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]); + 922 [ - + - + : 105805 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) { + + + ] + 923 : 70648 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf); 924 : : - 925 : 59001 : subflow->cached_sndbuf = ssk_sndbuf; - 926 : 59001 : new_sndbuf += ssk_sndbuf; + 925 : 70648 : subflow->cached_sndbuf = ssk_sndbuf; + 926 : 70648 : new_sndbuf += ssk_sndbuf; 927 : : } 928 : : 929 : : /* the msk max wmem limit is <nr_subflows> * tcp wmem[2] */ - 930 : 31783 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); - 931 : 31783 : mptcp_write_space(sk); + 930 : 35157 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); + 931 : 35157 : 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 : 2881 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 939 : 2882 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 940 : : - 941 [ + + ]: 2881 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf) - [ + - + - ] - 942 : 2849 : __mptcp_sync_sndbuf(sk); + 941 [ + + ]: 2882 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf) + [ + - + - ] + 942 : 2850 : __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 : 294292 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) + 950 : 393144 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) 951 : : { - 952 : 294292 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 952 : 393144 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 953 : : - 954 [ + + ]: 294292 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf)) + 954 [ + + ]: 393144 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf)) 955 : : return; 956 : : - 957 : 67527 : local_bh_disable(); - 958 : 67527 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF); - 959 : 67527 : local_bh_enable(); + 957 : 83298 : local_bh_disable(); + 958 : 83298 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF); + 959 : 83298 : 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 : 1839 : mptcp_subflow_rsk(req)->token_node.pprev = NULL; + 969 : 1840 : 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 : 400984 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) + 1068 : 403356 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) 1069 : : { - 1070 [ + + + - ]: 1461330 : return READ_ONCE(msk->pm.addr_signal) & - [ + + ] + 1070 [ + + + - ]: 2026709 : 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 [ + + ]: 755 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_ECHO); + 1081 [ + + ]: 756 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_ADD_ADDR_ECHO); 1082 : : } 1083 : : - 1084 : 400972 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) + 1084 : 403344 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) 1085 : : { - 1086 [ + + ]: 1459051 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL); + 1086 [ + + ]: 2024427 : 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 [ - + + + ]: 7279 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE; - [ + + + + - + + + + + - + ][ + + ] + 1091 [ - + + + ]: 7314 : 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) + 1094 : 30 : static inline bool mptcp_pm_is_kernel(const struct mptcp_sock *msk) 1095 : : { - 1096 [ + + ]: 1107 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_KERNEL; + 1096 [ + + ]: 1126 : 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 : 1510 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + 1101 : 1512 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; 1102 : : - 1103 [ + + ]: 1510 : if (family == AF_INET6) - 1104 : 338 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; - 1105 [ + + ]: 1510 : if (!echo) + 1103 [ + + ]: 1512 : if (family == AF_INET6) + 1104 : 340 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; + 1105 [ + + ]: 1512 : if (!echo) 1106 : 808 : len += MPTCPOPT_THMAC_LEN; 1107 : : /* account for 2 trailing 'nop' options */ - 1108 [ + + ]: 1510 : if (port) + 1108 [ + + ]: 1512 : if (port) 1109 : 136 : len += TCPOLEN_MPTCP_PORT_LEN + TCPOLEN_MPTCP_PORT_ALIGN; 1110 : : - 1111 [ - + ]: 1510 : return len; + 1111 [ - + ]: 1512 : return len; 1112 : : } 1113 : : 1114 : 0 : static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list) @@ -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 : 385 : 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 [ + - ]: 385 : if (--msk->pm.subflows < mptcp_pm_get_subflows_max(msk)) + 1163 : 385 : WRITE_ONCE(msk->pm.accept_subflow, true); + 1164 : 385 : } 1165 : : - 1166 : 93 : static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk) + 1166 : 94 : 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 : 94 : spin_lock_bh(&msk->pm.lock); + 1169 : 94 : __mptcp_pm_close_subflow(msk); + 1170 : 94 : spin_unlock_bh(&msk->pm.lock); + 1171 : 94 : } 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 [ + + + - : 1716433 : return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP); - + + - - - - - ][ + - + - + + - - - - ][ + - + - + + + + + - + + + - - - - ] + 1177 [ + + + - : 2302544 : 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 : 4608551 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk) + 1182 : 6475870 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk) 1183 : : { - 1184 [ - + - - : 4608551 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags); + 1184 [ - + - - : 6475870 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags); - - ] 1185 : : } 1186 : : - 1187 : 418358 : static inline bool mptcp_check_fallback(const struct sock *sk) + 1187 : 616277 : static inline bool mptcp_check_fallback(const struct sock *sk) 1188 : : { - 1189 : 418358 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1190 [ - + ]: 418358 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1189 : 616277 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1190 [ - + ]: 616277 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 1191 : : - 1192 : 418358 : return __mptcp_check_fallback(msk); + 1192 : 616277 : return __mptcp_check_fallback(msk); 1193 : : } 1194 : : - 1195 : 106 : static inline void __mptcp_do_fallback(struct mptcp_sock *msk) + 1195 : 104 : static inline void __mptcp_do_fallback(struct mptcp_sock *msk) 1196 : : { - 1197 [ - + ]: 106 : if (__mptcp_check_fallback(msk)) { + 1197 [ - + ]: 104 : if (__mptcp_check_fallback(msk)) { 1198 [ # # ]: 0 : pr_debug("TCP fallback already done (msk=%p)\n", msk); 1199 : 0 : return; 1200 : : } - 1201 : 106 : set_bit(MPTCP_FALLBACK_DONE, &msk->flags); + 1201 : 104 : set_bit(MPTCP_FALLBACK_DONE, &msk->flags); 1202 : : } 1203 : : - 1204 : 1017 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) + 1204 : 1036 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) 1205 : : { - 1206 : 1017 : struct sock *ssk = READ_ONCE(msk->first); + 1206 : 1036 : struct sock *ssk = READ_ONCE(msk->first); 1207 : : - 1208 [ + - + + : 2034 : return ssk && ((1 << inet_sk_state_load(ssk)) & - + + ] + 1208 [ + - + + : 2072 : return ssk && ((1 << inet_sk_state_load(ssk)) & + + + ] 1209 : : (TCPF_ESTABLISHED | TCPF_SYN_SENT | 1210 : : TCPF_SYN_RECV | TCPF_LISTEN)); 1211 : : } 1212 : : - 1213 : 82 : static inline void mptcp_do_fallback(struct sock *ssk) + 1213 : 80 : static inline void mptcp_do_fallback(struct sock *ssk) 1214 : : { - 1215 : 82 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1216 : 82 : struct sock *sk = subflow->conn; - 1217 : 82 : struct mptcp_sock *msk; + 1215 : 80 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1216 : 80 : struct sock *sk = subflow->conn; + 1217 : 80 : struct mptcp_sock *msk; 1218 : : - 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)) { + 1219 [ - + ]: 80 : msk = mptcp_sk(sk); + 1220 : 80 : __mptcp_do_fallback(msk); + 1221 [ - + - + : 80 : 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 : 82 : } + 1232 : 80 : } 1233 : : 1234 : : #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)\n", __func__, a) 1235 : : @@ -1384,29 +1395,29 @@ 1241 : 24 : __mptcp_do_fallback(msk); 1242 : 24 : } 1243 : : - 1244 : 32579 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb) + 1244 : 53093 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb) 1245 : : { - 1246 : 32579 : struct mptcp_ext *mpext; + 1246 : 53093 : struct mptcp_ext *mpext; 1247 : : - 1248 [ + + ]: 32579 : mpext = skb ? mptcp_get_ext(skb) : NULL; - 1249 [ + + + + ]: 5457 : if (mpext && mpext->infinite_map) - 1250 : 1 : return true; + 1248 [ + + ]: 53093 : mpext = skb ? mptcp_get_ext(skb) : NULL; + 1249 [ + + + + ]: 9318 : if (mpext && mpext->infinite_map) + 1250 : 2 : return true; 1251 : : 1252 : : return false; 1253 : : } 1254 : : 1255 : 246 : static inline bool is_active_ssk(struct mptcp_subflow_context *subflow) 1256 : : { - 1257 : 3417 : return (subflow->request_mptcp || subflow->request_join); + 1257 : 3418 : return (subflow->request_mptcp || subflow->request_join); 1258 : : } 1259 : : - 1260 : 5056 : static inline bool subflow_simultaneous_connect(struct sock *sk) + 1260 : 4973 : static inline bool subflow_simultaneous_connect(struct sock *sk) 1261 : : { - 1262 : 5056 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1262 : 4973 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1263 : : - 1264 : 2564 : return (1 << sk->sk_state) & - 1265 [ + + ]: 3417 : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && - 1266 [ + + + + : 5056 : is_active_ssk(subflow) && + 1264 : 2487 : return (1 << sk->sk_state) & + 1265 [ + + ]: 3418 : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && + 1266 [ + + + + : 4973 : is_active_ssk(subflow) && + + ] 1267 [ + - ]: 1727 : !subflow->conn_finished; 1268 : : } diff --git a/html/lcov/export/mptcp/sched.c.func-c.html b/html/lcov/export/mptcp/sched.c.func-c.html index ddc74335..e4951bb7 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -116,7 +116,7 @@ mptcp_release_sched - 3614 + 3618 @@ -130,35 +130,35 @@ mptcp_sched_get_retrans - 7513 + 10459 mptcp_sched_data_set_contexts - 196061 + 195917 mptcp_sched_default_get_subflow - 316415 + 452501 mptcp_sched_get_send - 552235 + 703215 mptcp_subflow_set_scheduled - 740187 + 862998 diff --git a/html/lcov/export/mptcp/sched.c.func.html b/html/lcov/export/mptcp/sched.c.func.html index b7b98f68..06f38127 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -102,21 +102,21 @@ mptcp_release_sched - 3614 + 3618 mptcp_sched_data_set_contexts - 196061 + 195917 mptcp_sched_default_get_subflow - 316415 + 452501 @@ -130,14 +130,14 @@ mptcp_sched_get_retrans - 7513 + 10459 mptcp_sched_get_send - 552235 + 703215 @@ -151,7 +151,7 @@ mptcp_subflow_set_scheduled - 740187 + 862998 diff --git a/html/lcov/export/mptcp/sched.c.gcov.html b/html/lcov/export/mptcp/sched.c.gcov.html index 2fe10639..a0e20227 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -94,18 +94,18 @@ 16 : : static DEFINE_SPINLOCK(mptcp_sched_list_lock); 17 : : static LIST_HEAD(mptcp_sched_list); 18 : : - 19 : 316415 : static int mptcp_sched_default_get_subflow(struct mptcp_sock *msk, + 19 : 452501 : static int mptcp_sched_default_get_subflow(struct mptcp_sock *msk, 20 : : struct mptcp_sched_data *data) 21 : : { - 22 : 316415 : struct sock *ssk; + 22 : 452501 : struct sock *ssk; 23 : : - 24 [ + + + + ]: 316415 : ssk = data->reinject ? mptcp_subflow_get_retrans(msk) : - 25 : 314646 : mptcp_subflow_get_send(msk); - 26 [ + + ]: 316415 : if (!ssk) + 24 [ + + + + ]: 452501 : ssk = data->reinject ? mptcp_subflow_get_retrans(msk) : + 25 : 450240 : mptcp_subflow_get_send(msk); + 26 [ + + ]: 452501 : if (!ssk) 27 : : return -EINVAL; 28 : : - 29 : 243342 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true); - 30 : 243342 : return 0; + 29 : 355612 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true); + 30 : 355612 : return 0; 31 : : } 32 : : 33 : : static struct mptcp_sched_ops mptcp_sched_default = { @@ -203,97 +203,97 @@ 121 : : return 0; 122 : : } 123 : : - 124 : 3614 : void mptcp_release_sched(struct mptcp_sock *msk) + 124 : 3618 : void mptcp_release_sched(struct mptcp_sock *msk) 125 : : { - 126 : 3614 : struct mptcp_sched_ops *sched = msk->sched; + 126 : 3618 : struct mptcp_sched_ops *sched = msk->sched; 127 : : - 128 [ + - ]: 3614 : if (!sched) + 128 [ + - ]: 3618 : if (!sched) 129 : : return; 130 : : - 131 : 3614 : msk->sched = NULL; - 132 [ + + ]: 3614 : if (sched->release) + 131 : 3618 : msk->sched = NULL; + 132 [ + + ]: 3618 : if (sched->release) 133 : 90 : sched->release(msk); 134 : : - 135 : 3614 : bpf_module_put(sched, sched->owner); + 135 : 3618 : bpf_module_put(sched, sched->owner); 136 : : } 137 : : - 138 : 221017 : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, + 138 : 344554 : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, 139 : : bool scheduled) 140 : : { 141 : 0 : WRITE_ONCE(subflow->scheduled, scheduled); - 142 : 740187 : } + 142 : 862998 : } 143 : : - 144 : 196061 : static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk, + 144 : 195917 : static void mptcp_sched_data_set_contexts(const struct mptcp_sock *msk, 145 : : struct mptcp_sched_data *data) 146 : : { - 147 : 196061 : struct mptcp_subflow_context *subflow; - 148 : 196061 : int i = 0; + 147 : 195917 : struct mptcp_subflow_context *subflow; + 148 : 195917 : int i = 0; 149 : : - 150 [ + + ]: 587605 : mptcp_for_each_subflow(msk, subflow) { - 151 [ - + ]: 391544 : if (i == MPTCP_SUBFLOWS_MAX) { + 150 [ + + ]: 587164 : mptcp_for_each_subflow(msk, subflow) { + 151 [ - + ]: 391247 : if (i == MPTCP_SUBFLOWS_MAX) { 152 [ # # # # ]: 0 : pr_warn_once("too many subflows"); 153 : : break; 154 : : } - 155 : 391544 : mptcp_subflow_set_scheduled(subflow, false); - 156 : 391544 : data->contexts[i++] = subflow; + 155 : 391247 : mptcp_subflow_set_scheduled(subflow, false); + 156 : 391247 : data->contexts[i++] = subflow; 157 : : } - 158 : 196061 : data->subflows = i; + 158 : 195917 : data->subflows = i; 159 : : - 160 [ + + ]: 1373005 : for (; i < MPTCP_SUBFLOWS_MAX; i++) - 161 : 1176944 : data->contexts[i] = NULL; - 162 : 196061 : } + 160 [ + + ]: 1372006 : for (; i < MPTCP_SUBFLOWS_MAX; i++) + 161 : 1176089 : data->contexts[i] = NULL; + 162 : 195917 : } 163 : : - 164 : 552235 : int mptcp_sched_get_send(struct mptcp_sock *msk) + 164 : 703215 : int mptcp_sched_get_send(struct mptcp_sock *msk) 165 : : { - 166 : 552235 : struct mptcp_subflow_context *subflow; - 167 : 552235 : struct mptcp_sched_data data; + 166 : 703215 : struct mptcp_subflow_context *subflow; + 167 : 703215 : struct mptcp_sched_data data; 168 : : - 169 : 552235 : msk_owned_by_me(msk); + 169 : 703215 : msk_owned_by_me(msk); 170 : : 171 : : /* the following check is moved out of mptcp_subflow_get_send */ - 172 [ + + ]: 552235 : if (__mptcp_check_fallback(msk)) { - 173 [ + - + - ]: 43062 : if (msk->first && - 174 [ + + ]: 36164 : __tcp_can_send(msk->first) && - 175 [ # # ]: 21531 : sk_stream_memory_free(msk->first)) { - 176 : 20818 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(msk->first), true); - 177 : 20818 : return 0; + 172 [ + + ]: 703215 : if (__mptcp_check_fallback(msk)) { + 173 [ + - + - ]: 73082 : if (msk->first && + 174 [ + + ]: 47880 : __tcp_can_send(msk->first) && + 175 [ # # ]: 36541 : sk_stream_memory_free(msk->first)) { + 176 : 31701 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(msk->first), true); + 177 : 31701 : return 0; 178 : : } - 179 : 713 : return -EINVAL; + 179 : 4840 : return -EINVAL; 180 : : } 181 : : - 182 [ + + ]: 1595200 : mptcp_for_each_subflow(msk, subflow) { - 183 [ + + + + ]: 1087488 : if (READ_ONCE(subflow->scheduled)) + 182 [ + + ]: 1944748 : mptcp_for_each_subflow(msk, subflow) { + 183 [ + + + + ]: 1301290 : if (READ_ONCE(subflow->scheduled)) 184 : : return 0; 185 : : } 186 : : - 187 : 507712 : data.reinject = false; - 188 [ + + - + ]: 507712 : if (msk->sched == &mptcp_sched_default || !msk->sched) - 189 : 314646 : return mptcp_sched_default_get_subflow(msk, &data); - 190 : 193066 : mptcp_sched_data_set_contexts(msk, &data); - 191 : 193066 : return msk->sched->get_subflow(msk, &data); + 187 : 643458 : data.reinject = false; + 188 [ + + - + ]: 643458 : if (msk->sched == &mptcp_sched_default || !msk->sched) + 189 : 450240 : return mptcp_sched_default_get_subflow(msk, &data); + 190 : 193218 : mptcp_sched_data_set_contexts(msk, &data); + 191 : 193218 : return msk->sched->get_subflow(msk, &data); 192 : : } 193 : : - 194 : 7513 : int mptcp_sched_get_retrans(struct mptcp_sock *msk) + 194 : 10459 : int mptcp_sched_get_retrans(struct mptcp_sock *msk) 195 : : { - 196 : 7513 : struct mptcp_subflow_context *subflow; - 197 : 7513 : struct mptcp_sched_data data; + 196 : 10459 : struct mptcp_subflow_context *subflow; + 197 : 10459 : struct mptcp_sched_data data; 198 : : - 199 : 7513 : msk_owned_by_me(msk); + 199 : 10459 : msk_owned_by_me(msk); 200 : : 201 : : /* the following check is moved out of mptcp_subflow_get_retrans */ - 202 [ + + ]: 7513 : if (__mptcp_check_fallback(msk)) + 202 [ + + ]: 10459 : if (__mptcp_check_fallback(msk)) 203 : : return -EINVAL; 204 : : - 205 [ + + ]: 14244 : mptcp_for_each_subflow(msk, subflow) { - 206 [ + + + + ]: 9480 : if (READ_ONCE(subflow->scheduled)) + 205 [ + + ]: 14291 : mptcp_for_each_subflow(msk, subflow) { + 206 [ + + + + ]: 9331 : if (READ_ONCE(subflow->scheduled)) 207 : : return 0; 208 : : } 209 : : - 210 : 4764 : data.reinject = true; - 211 [ + + + + ]: 4764 : if (msk->sched == &mptcp_sched_default || !msk->sched) - 212 : 1769 : return mptcp_sched_default_get_subflow(msk, &data); - 213 : 2995 : mptcp_sched_data_set_contexts(msk, &data); - 214 : 2995 : return msk->sched->get_subflow(msk, &data); + 210 : 4960 : data.reinject = true; + 211 [ + + + + ]: 4960 : if (msk->sched == &mptcp_sched_default || !msk->sched) + 212 : 2261 : return mptcp_sched_default_get_subflow(msk, &data); + 213 : 2699 : mptcp_sched_data_set_contexts(msk, &data); + 214 : 2699 : return msk->sched->get_subflow(msk, &data); 215 : : } diff --git a/html/lcov/export/mptcp/sockopt.c.func-c.html b/html/lcov/export/mptcp/sockopt.c.func-c.html index c1062d7f..d1dcadfb 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 90.2 % @@ -214,14 +214,14 @@ mptcp_getsockopt_info - 45 + 46 sync_socket_options - 45 + 46 @@ -298,14 +298,14 @@ mptcp_getsockopt_sol_mptcp - 325 + 326 mptcp_diag_fill_info - 1017 + 1036 @@ -319,7 +319,7 @@ mptcp_sockopt_sync_locked - 3585 + 3586 @@ -340,14 +340,14 @@ mptcp_getsockopt - 6979 + 6980 __mptcp_tcp_fallback - 7203 + 7204 diff --git a/html/lcov/export/mptcp/sockopt.c.func.html b/html/lcov/export/mptcp/sockopt.c.func.html index 7ee7422a..94364b2f 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 90.2 % @@ -102,14 +102,14 @@ __mptcp_tcp_fallback - 7203 + 7204 mptcp_diag_fill_info - 1017 + 1036 @@ -144,7 +144,7 @@ mptcp_getsockopt - 6979 + 6980 @@ -165,14 +165,14 @@ mptcp_getsockopt_info - 45 + 46 mptcp_getsockopt_sol_mptcp - 325 + 326 @@ -326,7 +326,7 @@ mptcp_sockopt_sync_locked - 3585 + 3586 @@ -361,7 +361,7 @@ sync_socket_options - 45 + 46 diff --git a/html/lcov/export/mptcp/sockopt.c.gcov.html b/html/lcov/export/mptcp/sockopt.c.gcov.html index 3b684206..a3f0518f 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 90.2 % @@ -95,11 +95,11 @@ 17 : : #define MIN_INFO_OPTLEN_SIZE 16 18 : : #define MIN_FULL_INFO_OPTLEN_SIZE 40 19 : : - 20 : 7203 : static struct sock *__mptcp_tcp_fallback(struct mptcp_sock *msk) + 20 : 7204 : static struct sock *__mptcp_tcp_fallback(struct mptcp_sock *msk) 21 : : { - 22 : 7203 : msk_owned_by_me(msk); + 22 : 7204 : msk_owned_by_me(msk); 23 : : - 24 [ + + ]: 7203 : if (likely(!__mptcp_check_fallback(msk))) + 24 [ + + ]: 7204 : if (likely(!__mptcp_check_fallback(msk))) 25 : : return NULL; 26 : : 27 : 120 : return msk->first; @@ -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 [ + + ]: 23 : mptcp_for_each_subflow(msk, subflow) { + 161 : 15 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 162 : 15 : bool slow = lock_sock_fast(ssk); 163 : : - 164 : 16 : sock_set_timestamp(sk, optname, !!val); - 165 : 16 : unlock_sock_fast(ssk, slow); + 164 : 15 : sock_set_timestamp(sk, optname, !!val); + 165 : 15 : unlock_sock_fast(ssk, slow); 166 : : } 167 : : 168 : 8 : release_sock(sk); @@ -1015,85 +1015,85 @@ 932 : 6354 : return ret; 933 : : } 934 : : - 935 : 1017 : void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) + 935 : 1036 : void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) 936 : : { - 937 : 1017 : struct sock *sk = (struct sock *)msk; - 938 : 1017 : u32 flags = 0; - 939 : 1017 : bool slow; - 940 : 1017 : u32 now; + 937 : 1036 : struct sock *sk = (struct sock *)msk; + 938 : 1036 : u32 flags = 0; + 939 : 1036 : bool slow; + 940 : 1036 : u32 now; 941 : : - 942 : 1017 : memset(info, 0, sizeof(*info)); + 942 : 1036 : memset(info, 0, sizeof(*info)); 943 : : - 944 : 1017 : info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); - 945 : 1017 : info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); - 946 : 1017 : info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); - 947 : 1017 : info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); + 944 : 1036 : info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); + 945 : 1036 : info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); + 946 : 1036 : info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); + 947 : 1036 : info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); 948 : : - 949 [ + - ]: 1017 : if (inet_sk_state_load(sk) == TCP_LISTEN) + 949 [ + - ]: 1036 : if (inet_sk_state_load(sk) == TCP_LISTEN) 950 : : return; 951 : : 952 : : /* The following limits only make sense for the in-kernel PM */ - 953 [ + + ]: 1017 : if (mptcp_pm_is_kernel(msk)) { - 954 : 1930 : info->mptcpi_subflows_max = - 955 : 965 : mptcp_pm_get_subflows_max(msk); - 956 : 1930 : info->mptcpi_add_addr_signal_max = - 957 : 965 : mptcp_pm_get_add_addr_signal_max(msk); - 958 : 1930 : info->mptcpi_add_addr_accepted_max = - 959 : 965 : mptcp_pm_get_add_addr_accept_max(msk); - 960 : 965 : info->mptcpi_local_addr_max = - 961 : 965 : mptcp_pm_get_local_addr_max(msk); + 953 [ + + ]: 1036 : if (mptcp_pm_is_kernel(msk)) { + 954 : 1968 : info->mptcpi_subflows_max = + 955 : 984 : mptcp_pm_get_subflows_max(msk); + 956 : 1968 : info->mptcpi_add_addr_signal_max = + 957 : 984 : mptcp_pm_get_add_addr_signal_max(msk); + 958 : 1968 : info->mptcpi_add_addr_accepted_max = + 959 : 984 : mptcp_pm_get_add_addr_accept_max(msk); + 960 : 984 : info->mptcpi_local_addr_max = + 961 : 984 : mptcp_pm_get_local_addr_max(msk); 962 : : } 963 : : - 964 [ + + ]: 1017 : if (__mptcp_check_fallback(msk)) + 964 [ + + ]: 1036 : if (__mptcp_check_fallback(msk)) 965 : 2 : flags |= MPTCP_INFO_FLAG_FALLBACK; - 966 [ + + + + ]: 1017 : if (READ_ONCE(msk->can_ack)) - 967 : 1015 : flags |= MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED; - 968 : 1017 : info->mptcpi_flags = flags; + 966 [ + + + + ]: 1036 : if (READ_ONCE(msk->can_ack)) + 967 : 1034 : flags |= MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED; + 968 : 1036 : info->mptcpi_flags = flags; 969 : : - 970 : 1017 : slow = lock_sock_fast(sk); - 971 [ - + ]: 1017 : info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled); - 972 : 1017 : info->mptcpi_token = msk->token; - 973 : 1017 : info->mptcpi_write_seq = msk->write_seq; - 974 : 1017 : info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits; - 975 : 1017 : info->mptcpi_bytes_sent = msk->bytes_sent; - 976 : 1017 : info->mptcpi_bytes_received = msk->bytes_received; - 977 : 1017 : info->mptcpi_bytes_retrans = msk->bytes_retrans; - 978 : 2034 : info->mptcpi_subflows_total = info->mptcpi_subflows + - 979 : 1017 : __mptcp_has_initial_subflow(msk); - 980 : 1017 : now = tcp_jiffies32; - 981 : 1017 : info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); - 982 : 1017 : info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); - 983 : 1017 : unlock_sock_fast(sk, slow); + 970 : 1036 : slow = lock_sock_fast(sk); + 971 [ - + ]: 1036 : info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled); + 972 : 1036 : info->mptcpi_token = msk->token; + 973 : 1036 : info->mptcpi_write_seq = msk->write_seq; + 974 : 1036 : info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits; + 975 : 1036 : info->mptcpi_bytes_sent = msk->bytes_sent; + 976 : 1036 : info->mptcpi_bytes_received = msk->bytes_received; + 977 : 1036 : info->mptcpi_bytes_retrans = msk->bytes_retrans; + 978 : 2072 : info->mptcpi_subflows_total = info->mptcpi_subflows + + 979 : 1036 : __mptcp_has_initial_subflow(msk); + 980 : 1036 : now = tcp_jiffies32; + 981 : 1036 : info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); + 982 : 1036 : info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); + 983 : 1036 : unlock_sock_fast(sk, slow); 984 : : - 985 : 1017 : mptcp_data_lock(sk); - 986 : 1017 : info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); - 987 : 1017 : info->mptcpi_snd_una = msk->snd_una; - 988 : 1017 : info->mptcpi_rcv_nxt = msk->ack_seq; - 989 : 1017 : info->mptcpi_bytes_acked = msk->bytes_acked; - 990 : 1017 : mptcp_data_unlock(sk); + 985 : 1036 : mptcp_data_lock(sk); + 986 : 1036 : info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); + 987 : 1036 : info->mptcpi_snd_una = msk->snd_una; + 988 : 1036 : info->mptcpi_rcv_nxt = msk->ack_seq; + 989 : 1036 : info->mptcpi_bytes_acked = msk->bytes_acked; + 990 : 1036 : mptcp_data_unlock(sk); 991 : : } 992 : : EXPORT_SYMBOL_GPL(mptcp_diag_fill_info); 993 : : - 994 : 45 : static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen) + 994 : 46 : static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen) 995 : : { - 996 : 45 : struct mptcp_info m_info; - 997 : 45 : int len; + 996 : 46 : struct mptcp_info m_info; + 997 : 46 : int len; 998 : : - 999 [ - + ]: 45 : if (get_user(len, optlen)) + 999 [ - + ]: 46 : if (get_user(len, optlen)) 1000 : : return -EFAULT; 1001 : : 1002 : : /* When used only to check if a fallback to TCP happened. */ - 1003 [ - + ]: 45 : if (len == 0) + 1003 [ - + ]: 46 : if (len == 0) 1004 : : return 0; 1005 : : - 1006 : 45 : len = min_t(unsigned int, len, sizeof(struct mptcp_info)); + 1006 : 46 : len = min_t(unsigned int, len, sizeof(struct mptcp_info)); 1007 : : - 1008 : 45 : mptcp_diag_fill_info(msk, &m_info); + 1008 : 46 : mptcp_diag_fill_info(msk, &m_info); 1009 : : - 1010 [ - + ]: 45 : if (put_user(len, optlen)) + 1010 [ - + ]: 46 : if (put_user(len, optlen)) 1011 : : return -EFAULT; 1012 : : - 1013 [ - + ]: 45 : if (copy_to_user(optval, &m_info, len)) + 1013 [ - + ]: 46 : if (copy_to_user(optval, &m_info, len)) 1014 : : return -EFAULT; 1015 : : 1016 : : return 0; @@ -1515,13 +1515,13 @@ 1430 : : return -EOPNOTSUPP; 1431 : : } 1432 : : - 1433 : 325 : static int mptcp_getsockopt_sol_mptcp(struct mptcp_sock *msk, int optname, + 1433 : 326 : static int mptcp_getsockopt_sol_mptcp(struct mptcp_sock *msk, int optname, 1434 : : char __user *optval, int __user *optlen) 1435 : : { - 1436 [ + + + + : 325 : switch (optname) { + 1436 [ + + + + : 326 : switch (optname) { - ] - 1437 : 45 : case MPTCP_INFO: - 1438 : 45 : return mptcp_getsockopt_info(msk, optval, optlen); + 1437 : 46 : case MPTCP_INFO: + 1438 : 46 : return mptcp_getsockopt_info(msk, optval, optlen); 1439 : 8 : case MPTCP_FULL_INFO: 1440 : 8 : return mptcp_getsockopt_full_info(msk, optval, optlen); 1441 : 128 : case MPTCP_TCPINFO: @@ -1533,13 +1533,13 @@ 1447 : : return -EOPNOTSUPP; 1448 : : } 1449 : : - 1450 : 6979 : int mptcp_getsockopt(struct sock *sk, int level, int optname, + 1450 : 6980 : int mptcp_getsockopt(struct sock *sk, int level, int optname, 1451 : : char __user *optval, int __user *option) 1452 : : { - 1453 [ - + ]: 6979 : struct mptcp_sock *msk = mptcp_sk(sk); - 1454 : 6979 : struct sock *ssk; + 1453 [ - + ]: 6980 : struct mptcp_sock *msk = mptcp_sk(sk); + 1454 : 6980 : struct sock *ssk; 1455 : : - 1456 [ - + ]: 6979 : pr_debug("msk=%p\n", msk); + 1456 [ - + ]: 6980 : pr_debug("msk=%p\n", msk); 1457 : : 1458 : : /* @@ the meaning of setsockopt() when the socket is connected and 1459 : : * there are multiple subflows is not yet defined. It is up to the @@ -1547,40 +1547,40 @@ 1461 : : * is in TCP fallback, when socket options are passed through 1462 : : * to the one remaining subflow. 1463 : : */ - 1464 : 6979 : lock_sock(sk); - 1465 : 6979 : ssk = __mptcp_tcp_fallback(msk); - 1466 : 6979 : release_sock(sk); - 1467 [ + + ]: 6979 : if (ssk) + 1464 : 6980 : lock_sock(sk); + 1465 : 6980 : ssk = __mptcp_tcp_fallback(msk); + 1466 : 6980 : release_sock(sk); + 1467 [ + + ]: 6980 : if (ssk) 1468 : 120 : return tcp_getsockopt(ssk, level, optname, optval, option); 1469 : : - 1470 [ + + ]: 6859 : if (level == SOL_IP) + 1470 [ + + ]: 6860 : if (level == SOL_IP) 1471 : 12 : return mptcp_getsockopt_v4(msk, optname, optval, option); - 1472 [ + + ]: 6847 : if (level == SOL_TCP) + 1472 [ + + ]: 6848 : if (level == SOL_TCP) 1473 : 6522 : return mptcp_getsockopt_sol_tcp(msk, optname, optval, option); - 1474 [ + - ]: 325 : if (level == SOL_MPTCP) - 1475 : 325 : return mptcp_getsockopt_sol_mptcp(msk, optname, optval, option); + 1474 [ + - ]: 326 : if (level == SOL_MPTCP) + 1475 : 326 : return mptcp_getsockopt_sol_mptcp(msk, optname, optval, option); 1476 : : return -EOPNOTSUPP; 1477 : : } 1478 : : - 1479 : 45 : static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) + 1479 : 46 : static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) 1480 : : { - 1481 : 45 : static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK; - 1482 : 45 : struct sock *sk = (struct sock *)msk; + 1481 : 46 : static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK; + 1482 : 46 : struct sock *sk = (struct sock *)msk; 1483 : : - 1484 [ + - ]: 45 : if (ssk->sk_prot->keepalive) { - 1485 [ - + ]: 45 : if (sock_flag(sk, SOCK_KEEPOPEN)) + 1484 [ + - ]: 46 : if (ssk->sk_prot->keepalive) { + 1485 [ - + ]: 46 : if (sock_flag(sk, SOCK_KEEPOPEN)) 1486 : 0 : ssk->sk_prot->keepalive(ssk, 1); 1487 : : else - 1488 : 45 : ssk->sk_prot->keepalive(ssk, 0); + 1488 : 46 : ssk->sk_prot->keepalive(ssk, 0); 1489 : : } 1490 : : - 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); + 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); 1496 : : - 1497 [ - + ]: 45 : if (sk->sk_userlocks & tx_rx_locks) { + 1497 [ - + ]: 46 : 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,54 +1590,54 @@ 1504 : 0 : WRITE_ONCE(ssk->sk_rcvbuf, sk->sk_rcvbuf); 1505 : : } 1506 : : - 1507 [ - + ]: 45 : if (sock_flag(sk, SOCK_LINGER)) { + 1507 [ - + ]: 46 : 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 : 45 : sock_reset_flag(ssk, SOCK_LINGER); + 1511 : 46 : sock_reset_flag(ssk, SOCK_LINGER); 1512 : : } 1513 : : - 1514 [ + + ]: 45 : if (sk->sk_mark != ssk->sk_mark) { - 1515 : 29 : ssk->sk_mark = sk->sk_mark; - 1516 : 29 : sk_dst_reset(ssk); + 1514 [ + + ]: 46 : if (sk->sk_mark != ssk->sk_mark) { + 1515 : 30 : ssk->sk_mark = sk->sk_mark; + 1516 : 30 : sk_dst_reset(ssk); 1517 : : } 1518 : : - 1519 : 45 : sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG)); + 1519 : 46 : sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG)); 1520 : : - 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); + 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); 1528 : : - 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 : } + 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 : } 1534 : : - 1535 : 3585 : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) + 1535 : 3586 : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) 1536 : : { - 1537 [ - + ]: 3585 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1537 [ - + ]: 3586 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 1538 : : - 1539 : 3585 : msk_owned_by_me(msk); + 1539 : 3586 : msk_owned_by_me(msk); 1540 : : - 1541 : 3585 : ssk->sk_rcvlowat = 0; + 1541 : 3586 : ssk->sk_rcvlowat = 0; 1542 : : 1543 : : /* subflows must ignore any latency-related settings: will not affect 1544 : : * the user-space - only the msk is relevant - but will foul the 1545 : : * mptcp scheduler 1546 : : */ - 1547 [ - + ]: 3585 : tcp_sk(ssk)->notsent_lowat = UINT_MAX; + 1547 [ - + ]: 3586 : tcp_sk(ssk)->notsent_lowat = UINT_MAX; 1548 : : - 1549 [ + + ]: 3585 : if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { - 1550 : 45 : sync_socket_options(msk, ssk); + 1549 [ + + ]: 3586 : if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { + 1550 : 46 : sync_socket_options(msk, ssk); 1551 : : - 1552 : 45 : subflow->setsockopt_seq = msk->setsockopt_seq; + 1552 : 46 : subflow->setsockopt_seq = msk->setsockopt_seq; 1553 : : } - 1554 : 3585 : } + 1554 : 3586 : } 1555 : : 1556 : : /* unfortunately this is different enough from the tcp version so 1557 : : * that we can't factor it out diff --git a/html/lcov/export/mptcp/subflow.c.func-c.html b/html/lcov/export/mptcp/subflow.c.func-c.html index ede18e71..ca47482b 100644 --- a/html/lcov/export/mptcp/subflow.c.func-c.html +++ b/html/lcov/export/mptcp/subflow.c.func-c.html @@ -31,13 +31,13 @@ export Lines: - 90.3 % + 90.5 % 1135 - 1025 + 1027 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 63.1 % + 63.6 % 854 - 539 + 543 @@ -102,7 +102,7 @@ mptcp_subflow_fail - 2 + 1 @@ -121,14 +121,14 @@ - mptcp_subflow_reset + subflow_can_fallback - 8 + 7 - subflow_can_fallback + mptcp_subflow_reset 8 @@ -184,72 +184,72 @@ - subflow_v6_send_synack + subflow_v6_route_req - 299 + 302 - subflow_v6_route_req + subflow_v6_send_synack - 301 + 302 subflow_v6_req_destructor - 309 + 310 subflow_thmac_valid - 487 + 488 subflow_hmac_valid - 513 + 514 subflow_req_create_thmac - 515 + 516 subflow_token_join_request - 521 + 522 mptcp_can_accept_new_subflow - 535 + 536 __mptcp_subflow_connect - 627 + 628 mptcpv6_handle_mapped - 728 + 727 @@ -263,7 +263,7 @@ subflow_set_local_id - 1081 + 1082 @@ -291,7 +291,7 @@ mptcp_subflow_queue_clean - 1248 + 1250 @@ -317,79 +317,79 @@ - subflow_v6_rebuild_header + subflow_v4_req_destructor - 1485 + 1524 - subflow_v4_req_destructor + subflow_v6_rebuild_header - 1524 + 1526 subflow_syn_recv_sock - 1769 + 1770 subflow_ulp_clone - 1769 + 1770 subflow_prep_synack - 1775 + 1778 subflow_check_req - 1785 + 1786 - subflow_error_report + subflow_init_req - 1794 + 1834 - subflow_init_req + subflow_req_destructor - 1833 + 1834 - subflow_req_destructor + subflow_error_report - 1833 + 1907 subflow_generate_hmac - 2002 + 2006 __mptcp_subflow_fully_established - 2699 + 2700 @@ -403,7 +403,7 @@ mptcp_subflow_create_socket - 3145 + 3146 @@ -417,133 +417,133 @@ subflow_set_remote_key - 3823 + 3824 subflow_ulp_release - 4613 + 4622 subflow_create_ctx - 4773 + 4774 - mptcp_subflow_discard_data + __subflow_state_change - 4895 + 4973 - subflow_finish_connect + subflow_state_change - 4946 + 4973 - __subflow_state_change + subflow_finish_connect - 5056 + 5143 - subflow_state_change + mptcp_subflow_discard_data - 5056 + 5240 subflow_rebuild_header - 5236 + 5417 subflow_chk_local_id - 6721 + 6943 validate_mapping - 170026 + 205564 subflow_write_space - 293805 + 392656 - subflow_sched_work_if_closed + tcp_release_cb_override - 415073 + 527015 - validate_data_csum + subflow_sched_work_if_closed - 415111 + 605523 - subflow_data_ready + validate_data_csum - 435788 + 612029 - tcp_release_cb_override + subflow_data_ready - 463187 + 652816 get_mapping_status - 825864 + 1214430 mptcp_subflow_data_available - 855291 + 1270981 subflow_check_data_avail - 855291 + 1270981 mptcp_space - 987603 + 1364435 diff --git a/html/lcov/export/mptcp/subflow.c.func.html b/html/lcov/export/mptcp/subflow.c.func.html index c2febfc3..f12f3ac0 100644 --- a/html/lcov/export/mptcp/subflow.c.func.html +++ b/html/lcov/export/mptcp/subflow.c.func.html @@ -31,13 +31,13 @@ export Lines: - 90.3 % + 90.5 % 1135 - 1025 + 1027 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 63.1 % + 63.6 % 854 - 539 + 543 @@ -81,14 +81,14 @@ __mptcp_subflow_connect - 627 + 628 __mptcp_subflow_fully_established - 2699 + 2700 @@ -102,7 +102,7 @@ __subflow_state_change - 5056 + 4973 @@ -116,7 +116,7 @@ get_mapping_status - 825864 + 1214430 @@ -130,7 +130,7 @@ mptcp_can_accept_new_subflow - 535 + 536 @@ -158,28 +158,28 @@ mptcp_space - 987603 + 1364435 mptcp_subflow_create_socket - 3145 + 3146 mptcp_subflow_data_available - 855291 + 1270981 mptcp_subflow_discard_data - 4895 + 5240 @@ -193,7 +193,7 @@ mptcp_subflow_fail - 2 + 1 @@ -214,7 +214,7 @@ mptcp_subflow_queue_clean - 1248 + 1250 @@ -235,7 +235,7 @@ mptcpv6_handle_mapped - 728 + 727 @@ -256,77 +256,77 @@ subflow_can_fallback - 8 + 7 subflow_check_data_avail - 855291 + 1270981 subflow_check_req - 1785 + 1786 subflow_chk_local_id - 6721 + 6943 subflow_create_ctx - 4773 + 4774 subflow_data_ready - 435788 + 652816 subflow_error_report - 1794 + 1907 subflow_finish_connect - 4946 + 5143 subflow_generate_hmac - 2002 + 2006 subflow_hmac_valid - 513 + 514 subflow_init_req - 1833 + 1834 @@ -340,28 +340,28 @@ subflow_prep_synack - 1775 + 1778 subflow_rebuild_header - 5236 + 5417 subflow_req_create_thmac - 515 + 516 subflow_req_destructor - 1833 + 1834 @@ -375,56 +375,56 @@ subflow_sched_work_if_closed - 415073 + 605523 subflow_set_local_id - 1081 + 1082 subflow_set_remote_key - 3823 + 3824 subflow_state_change - 5056 + 4973 subflow_syn_recv_sock - 1769 + 1770 subflow_thmac_valid - 487 + 488 subflow_token_join_request - 521 + 522 subflow_ulp_clone - 1769 + 1770 @@ -445,7 +445,7 @@ subflow_ulp_release - 4613 + 4622 @@ -487,35 +487,35 @@ subflow_v6_rebuild_header - 1485 + 1526 subflow_v6_req_destructor - 309 + 310 subflow_v6_route_req - 301 + 302 subflow_v6_send_synack - 299 + 302 subflow_write_space - 293805 + 392656 @@ -529,21 +529,21 @@ tcp_release_cb_override - 463187 + 527015 validate_data_csum - 415111 + 612029 validate_mapping - 170026 + 205564 diff --git a/html/lcov/export/mptcp/subflow.c.gcov.html b/html/lcov/export/mptcp/subflow.c.gcov.html index 3fc44f3f..26d81a3a 100644 --- a/html/lcov/export/mptcp/subflow.c.gcov.html +++ b/html/lcov/export/mptcp/subflow.c.gcov.html @@ -31,13 +31,13 @@ export Lines: - 90.3 % + 90.5 % 1135 - 1025 + 1027 Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 95.5 % @@ -56,9 +56,9 @@ Branches: - 63.1 % + 63.6 % 854 - 539 + 543 @@ -118,91 +118,91 @@ - - - - ] 36 : : } 37 : : - 38 : 1833 : static void subflow_req_destructor(struct request_sock *req) + 38 : 1834 : static void subflow_req_destructor(struct request_sock *req) 39 : : { - 40 : 1833 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 40 : 1834 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 41 : : - 42 [ - + ]: 1833 : pr_debug("subflow_req=%p\n", subflow_req); + 42 [ - + ]: 1834 : pr_debug("subflow_req=%p\n", subflow_req); 43 : : - 44 [ + + ]: 1833 : if (subflow_req->msk) + 44 [ + + ]: 1834 : if (subflow_req->msk) 45 : 30 : sock_put((struct sock *)subflow_req->msk); 46 : : - 47 : 1833 : mptcp_token_destroy_request(req); - 48 : 1833 : } + 47 : 1834 : mptcp_token_destroy_request(req); + 48 : 1834 : } 49 : : - 50 : 2002 : static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, + 50 : 2006 : static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, 51 : : void *hmac) 52 : : { - 53 : 2002 : u8 msg[8]; + 53 : 2006 : u8 msg[8]; 54 : : - 55 : 2002 : put_unaligned_be32(nonce1, &msg[0]); - 56 : 2002 : put_unaligned_be32(nonce2, &msg[4]); + 55 : 2006 : put_unaligned_be32(nonce1, &msg[0]); + 56 : 2006 : put_unaligned_be32(nonce2, &msg[4]); 57 : : - 58 : 2002 : mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac); - 59 : 2002 : } + 58 : 2006 : mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac); + 59 : 2006 : } 60 : : - 61 : 535 : static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk) + 61 : 536 : static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk) 62 : : { - 63 [ + - + + ]: 535 : return mptcp_is_fully_established((void *)msk) && + 63 [ + - + + ]: 536 : return mptcp_is_fully_established((void *)msk) && 64 [ + + - - ]: 86 : ((mptcp_pm_is_userspace(msk) && 65 : 26 : mptcp_userspace_pm_active(msk)) || - 66 [ + + + + ]: 513 : READ_ONCE(msk->pm.accept_subflow)); + 66 [ + + + + ]: 514 : READ_ONCE(msk->pm.accept_subflow)); 67 : : } 68 : : 69 : : /* validate received token and create truncated hmac and nonce for SYN-ACK */ - 70 : 515 : static void subflow_req_create_thmac(struct mptcp_subflow_request_sock *subflow_req) + 70 : 516 : static void subflow_req_create_thmac(struct mptcp_subflow_request_sock *subflow_req) 71 : : { - 72 : 515 : struct mptcp_sock *msk = subflow_req->msk; - 73 : 515 : u8 hmac[SHA256_DIGEST_SIZE]; + 72 : 516 : struct mptcp_sock *msk = subflow_req->msk; + 73 : 516 : u8 hmac[SHA256_DIGEST_SIZE]; 74 : : - 75 : 515 : get_random_bytes(&subflow_req->local_nonce, sizeof(u32)); + 75 : 516 : get_random_bytes(&subflow_req->local_nonce, sizeof(u32)); 76 : : - 77 : 515 : subflow_generate_hmac(READ_ONCE(msk->local_key), - 78 : 515 : READ_ONCE(msk->remote_key), + 77 : 516 : subflow_generate_hmac(READ_ONCE(msk->local_key), + 78 : 516 : READ_ONCE(msk->remote_key), 79 : : subflow_req->local_nonce, 80 : : subflow_req->remote_nonce, hmac); 81 : : - 82 : 515 : subflow_req->thmac = get_unaligned_be64(hmac); - 83 : 515 : } + 82 : 516 : subflow_req->thmac = get_unaligned_be64(hmac); + 83 : 516 : } 84 : : - 85 : 521 : static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) + 85 : 522 : static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) 86 : : { - 87 : 521 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 88 : 521 : struct mptcp_sock *msk; - 89 : 521 : int local_id; + 87 : 522 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 88 : 522 : struct mptcp_sock *msk; + 89 : 522 : int local_id; 90 : : - 91 : 521 : msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); - 92 [ + + ]: 521 : if (!msk) { + 91 : 522 : msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); + 92 [ + + ]: 522 : if (!msk) { 93 [ + - ]: 6 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINNOTOKEN); 94 : 6 : return NULL; 95 : : } 96 : : - 97 : 515 : local_id = mptcp_pm_get_local_id(msk, (struct sock_common *)req); - 98 [ - + ]: 515 : if (local_id < 0) { + 97 : 516 : local_id = mptcp_pm_get_local_id(msk, (struct sock_common *)req); + 98 [ - + ]: 516 : if (local_id < 0) { 99 : 0 : sock_put((struct sock *)msk); 100 : 0 : return NULL; 101 : : } - 102 : 515 : subflow_req->local_id = local_id; - 103 : 515 : subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); + 102 : 516 : subflow_req->local_id = local_id; + 103 : 516 : subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); 104 : : - 105 : 515 : return msk; + 105 : 516 : return msk; 106 : : } 107 : : - 108 : 1833 : static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) + 108 : 1834 : static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) 109 : : { - 110 : 1833 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 110 : 1834 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 111 : : - 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 : } + 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 : } 119 : : 120 : 120 : static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk) 121 : : { - 122 : 1020 : return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport; + 122 : 1022 : 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 : 1785 : static int subflow_check_req(struct request_sock *req, + 147 : 1786 : static int subflow_check_req(struct request_sock *req, 148 : : const struct sock *sk_listener, 149 : : struct sk_buff *skb) 150 : : { - 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; + 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; 155 : : - 156 [ - + ]: 1785 : pr_debug("subflow_req=%p, listener=%p\n", subflow_req, listener); + 156 [ - + ]: 1786 : 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 : 1785 : mptcp_get_options(skb, &mp_opt); + 168 : 1786 : mptcp_get_options(skb, &mp_opt); 169 : : - 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) { + 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) { 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 [ + + ]: 597 : } else if (opt_mp_join) { - 180 [ + - ]: 521 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); + 179 [ + + ]: 598 : } else if (opt_mp_join) { + 180 [ + - ]: 522 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); 181 : : - 182 [ + + ]: 521 : if (mp_opt.backup) + 182 [ + + ]: 522 : 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 [ + + + - ]: 1783 : if (opt_mp_capable && listener->request_mptcp) { + 188 [ + + + - ]: 1784 : 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 [ + + - + ]: 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); + 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); 227 : : 228 : : /* Can't fall back to TCP in this case. */ - 229 [ + + ]: 521 : if (!subflow_req->msk) { + 229 [ + + ]: 522 : if (!subflow_req->msk) { 230 : 6 : subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP); 231 : 6 : return -EPERM; 232 : : } 233 : : - 234 [ + + ]: 515 : if (subflow_use_different_sport(subflow_req->msk, sk_listener)) { + 234 [ + + ]: 516 : 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 : 515 : subflow_req_create_thmac(subflow_req); + 246 : 516 : subflow_req_create_thmac(subflow_req); 247 : : - 248 [ + + ]: 515 : if (unlikely(req->syncookie)) { + 248 [ + + ]: 516 : 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 [ + - ]: 513 : pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token, + 257 [ + - ]: 514 : pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token, 258 : : subflow_req->remote_nonce, subflow_req->msk); 259 : : } 260 : : @@ -422,20 +422,20 @@ 339 : : return NULL; 340 : : } 341 : : - 342 : 1775 : static void subflow_prep_synack(const struct sock *sk, struct request_sock *req, + 342 : 1778 : 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 [ + - ]: 1775 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 347 : 1775 : struct inet_request_sock *ireq = inet_rsk(req); + 346 [ + + ]: 1778 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 347 : 1778 : struct inet_request_sock *ireq = inet_rsk(req); 348 : : 349 : : /* clear tstamp_ok, as needed depending on cookie */ - 350 [ + - + + ]: 1775 : if (foc && foc->len > -1) + 350 [ + + + + ]: 1778 : if (foc && foc->len > -1) 351 : 20 : ireq->tstamp_ok = 0; 352 : : - 353 [ + + ]: 1775 : if (synack_type == TCP_SYNACK_FASTOPEN) + 353 [ + + ]: 1778 : if (synack_type == TCP_SYNACK_FASTOPEN) 354 : 38 : mptcp_fastopen_subflow_synack_set_params(subflow, req); - 355 : 1775 : } + 355 : 1778 : } 356 : : 357 : 1476 : static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst, 358 : : struct flowi *fl, @@ -451,37 +451,37 @@ 368 : : } 369 : : 370 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 371 : 299 : static int subflow_v6_send_synack(const struct sock *sk, struct dst_entry *dst, + 371 : 302 : 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 : 299 : subflow_prep_synack(sk, req, foc, synack_type); + 378 : 302 : subflow_prep_synack(sk, req, foc, synack_type); 379 : : - 380 : 299 : return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc, + 380 : 302 : return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc, 381 : : synack_type, syn_skb); 382 : : } 383 : : - 384 : 301 : static struct dst_entry *subflow_v6_route_req(const struct sock *sk, + 384 : 302 : 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 : 301 : struct dst_entry *dst; - 391 : 301 : int err; + 390 : 302 : struct dst_entry *dst; + 391 : 302 : int err; 392 : : - 393 : 301 : tcp_rsk(req)->is_mptcp = 1; - 394 : 301 : subflow_init_req(req, sk); + 393 : 302 : tcp_rsk(req)->is_mptcp = 1; + 394 : 302 : subflow_init_req(req, sk); 395 : : - 396 : 301 : dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req, tw_isn); - 397 [ - + ]: 301 : if (!dst) + 396 : 302 : dst = tcp_request_sock_ipv6_ops.route_req(sk, skb, fl, req, tw_isn); + 397 [ - + ]: 302 : if (!dst) 398 : : return NULL; 399 : : - 400 : 301 : err = subflow_check_req(req, sk, skb); - 401 [ + + ]: 301 : if (err == 0) + 400 : 302 : err = subflow_check_req(req, sk, skb); + 401 [ + + ]: 302 : 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 : 487 : static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) + 413 : 488 : static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) 414 : : { - 415 : 487 : u8 hmac[SHA256_DIGEST_SIZE]; - 416 : 487 : u64 thmac; + 415 : 488 : u8 hmac[SHA256_DIGEST_SIZE]; + 416 : 488 : u64 thmac; 417 : : - 418 : 487 : subflow_generate_hmac(subflow->remote_key, subflow->local_key, + 418 : 488 : subflow_generate_hmac(subflow->remote_key, subflow->local_key, 419 : : subflow->remote_nonce, subflow->local_nonce, 420 : : hmac); 421 : : - 422 [ - + ]: 487 : thmac = get_unaligned_be64(hmac); - 423 [ - + ]: 487 : pr_debug("subflow=%p, token=%u, thmac=%llu, subflow->thmac=%llu\n", + 422 [ - + ]: 488 : thmac = get_unaligned_be64(hmac); + 423 [ - + ]: 488 : pr_debug("subflow=%p, token=%u, thmac=%llu, subflow->thmac=%llu\n", 424 : : subflow, subflow->token, thmac, subflow->thmac); 425 : : - 426 : 487 : return thmac == subflow->thmac; + 426 : 488 : 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 : 487 : return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; + 453 : 488 : 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 : 3823 : static void subflow_set_remote_key(struct mptcp_sock *msk, + 478 : 3824 : 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 [ + + ]: 3823 : if (subflow->remote_key_valid) + 485 [ + + ]: 3824 : 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 : 4946 : static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) + 524 : 5143 : static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) 525 : : { - 526 : 4946 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 527 : 4946 : struct mptcp_options_received mp_opt; - 528 : 4946 : struct sock *parent = subflow->conn; - 529 : 4946 : struct mptcp_sock *msk; + 526 : 5143 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 527 : 5143 : struct mptcp_options_received mp_opt; + 528 : 5143 : struct sock *parent = subflow->conn; + 529 : 5143 : struct mptcp_sock *msk; 530 : : - 531 : 4946 : subflow->icsk_af_ops->sk_rx_dst_set(sk, skb); + 531 : 5143 : 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 [ + + ]: 4946 : if (subflow->conn_finished) - 535 : 4946 : return; + 534 [ + + ]: 5143 : if (subflow->conn_finished) + 535 : 5143 : return; 536 : : - 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); + 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); 542 : : - 543 : 1701 : mptcp_get_options(skb, &mp_opt); - 544 [ + + ]: 1701 : if (subflow->request_mptcp) { + 543 : 1702 : mptcp_get_options(skb, &mp_opt); + 544 [ + + ]: 1702 : 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 [ + + ]: 505 : } else if (subflow->request_join) { - 563 : 487 : u8 hmac[SHA256_DIGEST_SIZE]; + 562 [ + + ]: 506 : } else if (subflow->request_join) { + 563 : 488 : u8 hmac[SHA256_DIGEST_SIZE]; 564 : : - 565 [ - + ]: 487 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { + 565 [ - + ]: 488 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { 566 : 0 : subflow->reset_reason = MPTCP_RST_EMPTCP; 567 : 0 : goto do_reset; 568 : : } 569 : : - 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", + 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", 575 : : subflow, subflow->thmac, subflow->remote_nonce, 576 : : subflow->backup); 577 : : - 578 [ - + ]: 487 : if (!subflow_thmac_valid(subflow)) { + 578 [ - + ]: 488 : 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 [ - + ]: 487 : if (!mptcp_finish_join(sk)) + 584 [ - + ]: 488 : if (!mptcp_finish_join(sk)) 585 : 0 : goto do_reset; 586 : : - 587 : 487 : subflow_generate_hmac(subflow->local_key, subflow->remote_key, + 587 : 488 : subflow_generate_hmac(subflow->local_key, subflow->remote_key, 588 : : subflow->local_nonce, 589 : : subflow->remote_nonce, 590 : : hmac); - 591 : 487 : memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN); + 591 : 488 : memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN); 592 : : - 593 : 487 : subflow->mp_join = 1; - 594 [ + - ]: 487 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); + 593 : 488 : subflow->mp_join = 1; + 594 [ + - ]: 488 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); 595 : : - 596 [ + + ]: 487 : if (subflow->backup) + 596 [ + + ]: 488 : if (subflow->backup) 597 [ + - ]: 6 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX); 598 : : - 599 [ + + ]: 487 : if (subflow_use_different_dport(msk, sk)) { + 599 [ + + ]: 488 : 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)); @@ -700,50 +700,50 @@ 616 : 0 : mptcp_subflow_reset(sk); 617 : : } 618 : : - 619 : 1147 : static void subflow_set_local_id(struct mptcp_subflow_context *subflow, int local_id) + 619 : 1148 : static void subflow_set_local_id(struct mptcp_subflow_context *subflow, int local_id) 620 : : { - 621 [ - + ]: 1081 : WARN_ON_ONCE(local_id < 0 || local_id > 255); - 622 : 2261 : WRITE_ONCE(subflow->local_id, local_id); - 623 : 2261 : } + 621 [ - + ]: 1082 : WARN_ON_ONCE(local_id < 0 || local_id > 255); + 622 : 2262 : WRITE_ONCE(subflow->local_id, local_id); + 623 : 2262 : } 624 : : - 625 : 6721 : static int subflow_chk_local_id(struct sock *sk) + 625 : 6943 : static int subflow_chk_local_id(struct sock *sk) 626 : : { - 627 [ - + ]: 6721 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 628 [ - + ]: 6721 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 629 : 6721 : int err; + 627 [ - + ]: 6943 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 628 [ - + ]: 6943 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 629 : 6943 : int err; 630 : : - 631 [ + + ]: 6721 : if (likely(subflow->local_id >= 0)) + 631 [ + + ]: 6943 : if (likely(subflow->local_id >= 0)) 632 : : return 0; 633 : : - 634 : 251 : err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); - 635 [ + - ]: 251 : if (err < 0) + 634 : 252 : err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); + 635 [ + - ]: 252 : if (err < 0) 636 : : return err; 637 : : - 638 : 251 : subflow_set_local_id(subflow, err); - 639 : 251 : subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); + 638 : 252 : subflow_set_local_id(subflow, err); + 639 : 252 : subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); 640 : : - 641 : 251 : return 0; + 641 : 252 : return 0; 642 : : } 643 : : - 644 : 5236 : static int subflow_rebuild_header(struct sock *sk) + 644 : 5417 : static int subflow_rebuild_header(struct sock *sk) 645 : : { - 646 : 5236 : int err = subflow_chk_local_id(sk); + 646 : 5417 : int err = subflow_chk_local_id(sk); 647 : : - 648 [ + - ]: 5236 : if (unlikely(err < 0)) + 648 [ + - ]: 5417 : if (unlikely(err < 0)) 649 : : return err; 650 : : - 651 : 5236 : return inet_sk_rebuild_header(sk); + 651 : 5417 : return inet_sk_rebuild_header(sk); 652 : : } 653 : : 654 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 655 : 1485 : static int subflow_v6_rebuild_header(struct sock *sk) + 655 : 1526 : static int subflow_v6_rebuild_header(struct sock *sk) 656 : : { - 657 : 1485 : int err = subflow_chk_local_id(sk); + 657 : 1526 : int err = subflow_chk_local_id(sk); 658 : : - 659 [ + - ]: 1485 : if (unlikely(err < 0)) + 659 [ + - ]: 1526 : if (unlikely(err < 0)) 660 : : return err; 661 : : - 662 : 1485 : return inet6_sk_rebuild_header(sk); + 662 : 1526 : return inet6_sk_rebuild_header(sk); 663 : : } 664 : : #endif 665 : : @@ -787,18 +787,18 @@ 703 : : 704 [ - + ]: 939 : pr_debug("subflow=%p\n", subflow); 705 : : - 706 [ + + ]: 939 : if (skb->protocol == htons(ETH_P_IP)) - 707 : 638 : return subflow_v4_conn_request(sk, skb); + 706 [ + + ]: 939 : if (skb->protocol == htons(ETH_P_IP)) + 707 : 637 : return subflow_v4_conn_request(sk, skb); 708 : : - 709 [ - + ]: 301 : if (!ipv6_unicast_destination(skb)) + 709 [ - + ]: 302 : if (!ipv6_unicast_destination(skb)) 710 : 0 : goto drop; 711 : : - 712 [ - + ]: 301 : if (ipv6_addr_v4mapped(&ipv6_hdr(skb)->saddr)) { + 712 [ - + ]: 302 : 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 : 301 : return tcp_conn_request(&mptcp_subflow_v6_request_sock_ops, + 717 : 302 : 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 : 309 : static void subflow_v6_req_destructor(struct request_sock *req) + 725 : 310 : static void subflow_v6_req_destructor(struct request_sock *req) 726 : : { - 727 : 309 : subflow_req_destructor(req); - 728 : 309 : tcp6_request_sock_ops.destructor(req); - 729 : 309 : } + 727 : 310 : subflow_req_destructor(req); + 728 : 310 : tcp6_request_sock_ops.destructor(req); + 729 : 310 : } 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 : 513 : static bool subflow_hmac_valid(const struct request_sock *req, + 748 : 514 : static bool subflow_hmac_valid(const struct request_sock *req, 749 : : const struct mptcp_options_received *mp_opt) 750 : : { - 751 : 513 : const struct mptcp_subflow_request_sock *subflow_req; - 752 : 513 : u8 hmac[SHA256_DIGEST_SIZE]; - 753 : 513 : struct mptcp_sock *msk; + 751 : 514 : const struct mptcp_subflow_request_sock *subflow_req; + 752 : 514 : u8 hmac[SHA256_DIGEST_SIZE]; + 753 : 514 : struct mptcp_sock *msk; 754 : : - 755 : 513 : subflow_req = mptcp_subflow_rsk(req); - 756 : 513 : msk = subflow_req->msk; - 757 [ + - ]: 513 : if (!msk) + 755 : 514 : subflow_req = mptcp_subflow_rsk(req); + 756 : 514 : msk = subflow_req->msk; + 757 [ + - ]: 514 : if (!msk) 758 : : return false; 759 : : - 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); + 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); 764 : : - 765 : 513 : return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); + 765 : 514 : 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 : 2699 : void __mptcp_subflow_fully_established(struct mptcp_sock *msk, + 798 : 2700 : 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 : 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 : } + 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 : } 806 : : - 807 : 1769 : static struct sock *subflow_syn_recv_sock(const struct sock *sk, + 807 : 1770 : 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 [ - + ]: 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; + 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; 821 : : - 822 [ - + ]: 1769 : pr_debug("listener=%p, req=%p, conn=%p\n", listener, req, listener->conn); + 822 [ - + ]: 1770 : 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 : 1769 : mp_opt.suboptions = 0; + 827 : 1770 : mp_opt.suboptions = 0; 828 : : 829 : : /* hopefully temporary handling for MP_JOIN+syncookie */ - 830 : 1769 : subflow_req = mptcp_subflow_rsk(req); - 831 [ + + + + : 1769 : fallback_is_fatal = tcp_rsk(req)->is_mptcp && subflow_req->mp_join; + 830 : 1770 : subflow_req = mptcp_subflow_rsk(req); + 831 [ + + + + : 1770 : fallback_is_fatal = tcp_rsk(req)->is_mptcp && subflow_req->mp_join; + + ] - 832 [ - + ]: 1769 : fallback = !tcp_rsk(req)->is_mptcp; - 833 [ - + ]: 1769 : if (fallback) + 832 [ - + ]: 1770 : fallback = !tcp_rsk(req)->is_mptcp; + 833 [ - + ]: 1770 : if (fallback) 834 : 0 : goto create_child; 835 : : 836 : : /* if the sk is MP_CAPABLE, we try to fetch the client key */ - 837 [ + + ]: 1769 : if (subflow_req->mp_capable) { + 837 [ + + ]: 1770 : 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 [ + + ]: 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)) { + 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)) { 856 [ - + ]: 8 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); 857 : : fallback = true; 858 : : } 859 : : } 860 : : - 861 : 521 : create_child: - 862 : 1769 : child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst, + 861 : 522 : create_child: + 862 : 1770 : child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst, 863 : : req_unhash, own_req); 864 : : - 865 [ + - + + : 1769 : if (child && *own_req) { + 865 [ + - + + : 1770 : if (child && *own_req) { + - ] - 866 [ + + ]: 1769 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); + 866 [ + + ]: 1770 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); 867 : : - 868 : 1769 : tcp_rsk(req)->drop_req = false; + 868 : 1770 : 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 [ + + ]: 1769 : if (!ctx || fallback) { + 874 [ + + ]: 1770 : 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 : 1667 : ctx->setsockopt_seq = listener->setsockopt_seq; + 883 : 1668 : ctx->setsockopt_seq = listener->setsockopt_seq; 884 : : - 885 [ + + ]: 1667 : if (ctx->mp_capable) { + 885 [ + + ]: 1668 : 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 [ + - ]: 505 : } else if (ctx->mp_join) { - 902 : 505 : owner = subflow_req->msk; - 903 [ - + ]: 505 : if (!owner) { + 901 [ + - ]: 506 : } else if (ctx->mp_join) { + 902 : 506 : owner = subflow_req->msk; + 903 [ - + ]: 506 : 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 : 505 : subflow_req->msk = NULL; - 910 : 505 : ctx->conn = (struct sock *)owner; + 909 : 506 : subflow_req->msk = NULL; + 910 : 506 : ctx->conn = (struct sock *)owner; 911 : : - 912 [ + + ]: 505 : if (subflow_use_different_sport(owner, sk)) { + 912 [ + + ]: 506 : 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 [ - + ]: 505 : if (!mptcp_finish_join(child)) { + 924 [ - + ]: 506 : 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 [ + - ]: 505 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX); - 932 : 505 : tcp_rsk(req)->drop_req = true; + 931 [ + - ]: 506 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX); + 932 : 506 : 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 [ + + + + : 1667 : WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp && - + + + + + - + + - - + 939 [ + + + + : 1668 : WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp && + + + + + + + + + - - + ] 940 : : (!mptcp_subflow_ctx(child) || 941 : : !mptcp_subflow_ctx(child)->conn)); - 942 : 1667 : return child; + 942 : 1668 : 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 : 170026 : static bool validate_mapping(struct sock *ssk, struct sk_buff *skb) + 996 : 205564 : static bool validate_mapping(struct sock *ssk, struct sk_buff *skb) 997 : : { - 998 [ - + ]: 170026 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 999 [ - + ]: 170026 : u32 ssn = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + 998 [ - + ]: 205564 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 999 [ - + ]: 205564 : u32 ssn = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; 1000 : : - 1001 [ - + ]: 170026 : if (unlikely(before(ssn, subflow->map_subflow_seq))) { + 1001 [ - + ]: 205564 : 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 [ - + ]: 170026 : if (unlikely(!before(ssn, subflow->map_subflow_seq + + 1008 [ - + ]: 205564 : 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 : 415111 : static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *skb, + 1017 : 612029 : static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *skb, 1018 : : bool csum_reqd) 1019 : : { - 1020 [ + + ]: 415111 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1021 : 415111 : u32 offset, seq, delta; - 1022 : 415111 : __sum16 csum; - 1023 : 415111 : int len; + 1020 [ + + ]: 612029 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1021 : 612029 : u32 offset, seq, delta; + 1022 : 612029 : __sum16 csum; + 1023 : 612029 : int len; 1024 : : - 1025 [ + + ]: 415111 : if (!csum_reqd) + 1025 [ + + ]: 612029 : if (!csum_reqd) 1026 : : return MAPPING_OK; 1027 : : 1028 : : /* mapping already validated on previous traversal */ - 1029 [ + + ]: 1607 : if (subflow->map_csum_len == subflow->map_data_len) + 1029 [ + + ]: 1598 : 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 : 1601 : delta = subflow->map_data_len - subflow->map_csum_len; - 1038 : 10437 : for (;;) { - 1039 [ - + ]: 10437 : seq = tcp_sk(ssk)->copied_seq + subflow->map_csum_len; - 1040 : 10437 : offset = seq - TCP_SKB_CB(skb)->seq; + 1037 : 1591 : delta = subflow->map_data_len - subflow->map_csum_len; + 1038 : 10505 : for (;;) { + 1039 [ - + ]: 10505 : seq = tcp_sk(ssk)->copied_seq + subflow->map_csum_len; + 1040 : 10505 : 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 [ + + ]: 10437 : if (offset < skb->len) { - 1046 : 1603 : __wsum csum; + 1045 [ + + ]: 10505 : if (offset < skb->len) { + 1046 : 1593 : __wsum csum; 1047 : : - 1048 : 1603 : len = min(skb->len - offset, delta); - 1049 : 1603 : csum = skb_checksum(skb, offset, len, 0); - 1050 : 3206 : subflow->map_data_csum = csum_block_add(subflow->map_data_csum, csum, - 1051 [ - + ]: 1603 : subflow->map_csum_len); + 1048 : 1593 : len = min(skb->len - offset, delta); + 1049 : 1593 : csum = skb_checksum(skb, offset, len, 0); + 1050 : 3186 : subflow->map_data_csum = csum_block_add(subflow->map_data_csum, csum, + 1051 [ - + ]: 1593 : subflow->map_csum_len); 1052 : : - 1053 : 1603 : delta -= len; - 1054 : 1603 : subflow->map_csum_len += len; + 1053 : 1593 : delta -= len; + 1054 : 1593 : subflow->map_csum_len += len; 1055 : : } - 1056 [ + + ]: 10437 : if (delta == 0) + 1056 [ + + ]: 10505 : if (delta == 0) 1057 : : break; 1058 : : - 1059 [ + + ]: 10309 : if (skb_queue_is_last(&ssk->sk_receive_queue, skb)) { + 1059 [ + + ]: 10379 : 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 [ - + ]: 1473 : if (unlikely(ssk->sk_state == TCP_CLOSE)) - 1065 [ # # # # ]: 0 : while ((skb = skb_peek(&ssk->sk_receive_queue))) - 1066 : 0 : sk_eat_skb(ssk, skb); + 1064 [ + + ]: 1465 : if (unlikely(ssk->sk_state == TCP_CLOSE)) + 1065 [ + + + - ]: 2 : while ((skb = skb_peek(&ssk->sk_receive_queue))) + 1066 : 1 : sk_eat_skb(ssk, skb); 1067 : : 1068 : : /* not enough data to validate the csum */ - 1069 : 1473 : return MAPPING_EMPTY; + 1069 : 1465 : 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 : 128 : csum = __mptcp_make_csum(subflow->map_seq, + 1083 : 126 : csum = __mptcp_make_csum(subflow->map_seq, 1084 : : subflow->map_subflow_seq, - 1085 : 128 : subflow->map_data_len + subflow->map_data_fin, + 1085 : 126 : subflow->map_data_len + subflow->map_data_fin, 1086 : : subflow->map_data_csum); - 1087 [ + + ]: 128 : 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 : 124 : subflow->valid_csum_seen = 1; - 1093 : 124 : return MAPPING_OK; + 1092 : 122 : subflow->valid_csum_seen = 1; + 1093 : 122 : return MAPPING_OK; 1094 : : } 1095 : : - 1096 : 825864 : static enum mapping_status get_mapping_status(struct sock *ssk, + 1096 : 1214430 : static enum mapping_status get_mapping_status(struct sock *ssk, 1097 : : struct mptcp_sock *msk) 1098 : : { - 1099 [ + + ]: 825864 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1100 [ - + ]: 825864 : bool csum_reqd = READ_ONCE(msk->csum_enabled); - 1101 : 825864 : struct mptcp_ext *mpext; - 1102 : 825864 : struct sk_buff *skb; - 1103 : 825864 : u16 data_len; - 1104 : 825864 : u64 map_seq; + 1099 [ + + ]: 1214430 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1100 [ - + ]: 1214430 : bool csum_reqd = READ_ONCE(msk->csum_enabled); + 1101 : 1214430 : struct mptcp_ext *mpext; + 1102 : 1214430 : struct sk_buff *skb; + 1103 : 1214430 : u16 data_len; + 1104 : 1214430 : u64 map_seq; 1105 : : - 1106 [ + + ]: 825936 : skb = skb_peek(&ssk->sk_receive_queue); - 1107 [ - + ]: 418340 : if (!skb) + 1106 [ + + ]: 1214502 : skb = skb_peek(&ssk->sk_receive_queue); + 1107 [ - + ]: 616259 : if (!skb) 1108 : : return MAPPING_EMPTY; 1109 : : - 1110 [ + + ]: 418340 : if (mptcp_check_fallback(ssk)) + 1110 [ + + ]: 616259 : if (mptcp_check_fallback(ssk)) 1111 : : return MAPPING_DUMMY; 1112 : : - 1113 [ + + ]: 416139 : mpext = mptcp_get_ext(skb); - 1114 [ + + + + ]: 415356 : if (!mpext || !mpext->use_map) { - 1115 [ + + + + ]: 2677 : if (!subflow->map_valid && !skb->len) { + 1113 [ + + ]: 612950 : mpext = mptcp_get_ext(skb); + 1114 [ + + + + ]: 612098 : if (!mpext || !mpext->use_map) { + 1115 [ + + + + ]: 2635 : 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 [ - + ]: 1008 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) + 1120 [ - + ]: 902 : 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 : 1008 : sk_eat_skb(ssk, skb); - 1126 : 1008 : return MAPPING_EMPTY; + 1125 : 902 : sk_eat_skb(ssk, skb); + 1126 : 902 : return MAPPING_EMPTY; 1127 : : } 1128 : : 1129 : : /* If the required DSS has likely been dropped by a middlebox */ - 1130 [ + + ]: 1669 : if (!subflow->map_valid) + 1130 [ + + ]: 1733 : if (!subflow->map_valid) 1131 : : return MAPPING_NODSS; 1132 : : - 1133 : 1663 : goto validate_seq; + 1133 : 1727 : goto validate_seq; 1134 : : } 1135 : : - 1136 : 413462 : trace_get_mapping_status(mpext); + 1136 : 610315 : trace_get_mapping_status(mpext); 1137 : : - 1138 : 413462 : data_len = mpext->data_len; - 1139 [ + + ]: 413462 : 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; + 1138 : 610315 : data_len = mpext->data_len; + 1139 [ + + ]: 610315 : 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; 1144 : : } 1145 : : - 1146 [ + + ]: 413460 : if (mpext->data_fin == 1) { - 1147 : 897 : u64 data_fin_seq; + 1146 [ + + ]: 610314 : if (mpext->data_fin == 1) { + 1147 : 1360 : u64 data_fin_seq; 1148 : : - 1149 [ + + ]: 897 : if (data_len == 1) { + 1149 [ + + ]: 1360 : 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 : 885 : data_fin_seq = mpext->data_seq + data_len - 1; + 1169 : 1348 : 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 [ - + ]: 885 : if (!mpext->dsn64) + 1174 [ - + ]: 1348 : if (!mpext->dsn64) 1175 : 0 : data_fin_seq &= GENMASK_ULL(31, 0); 1176 : : - 1177 : 885 : mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); - 1178 [ - + ]: 885 : pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d\n", + 1177 : 1348 : mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); + 1178 [ - + ]: 1348 : 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 : 885 : data_len--; + 1182 : 1348 : data_len--; 1183 : : } 1184 : : - 1185 [ + + ]: 413448 : map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64); - 1186 [ - + ]: 413448 : WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64); + 1185 [ + + ]: 610302 : map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64); + 1186 [ - + ]: 610302 : WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64); 1187 : : - 1188 [ + + ]: 413448 : if (subflow->map_valid) { + 1188 [ + + ]: 610302 : if (subflow->map_valid) { 1189 : : /* Allow replacing only with an identical map */ - 1190 [ + - ]: 245085 : if (subflow->map_seq == map_seq && - 1191 [ + - ]: 245085 : subflow->map_subflow_seq == mpext->subflow_seq && - 1192 [ + - ]: 245085 : subflow->map_data_len == data_len && - 1193 [ + - ]: 245085 : subflow->map_csum_reqd == mpext->csum_reqd) { - 1194 : 245085 : skb_ext_del(skb, SKB_EXT_MPTCP); - 1195 : 245085 : goto validate_csum; + 1190 [ + - ]: 406465 : if (subflow->map_seq == map_seq && + 1191 [ + - ]: 406465 : subflow->map_subflow_seq == mpext->subflow_seq && + 1192 [ + - ]: 406465 : subflow->map_data_len == data_len && + 1193 [ + - ]: 406465 : subflow->map_csum_reqd == mpext->csum_reqd) { + 1194 : 406465 : skb_ext_del(skb, SKB_EXT_MPTCP); + 1195 : 406465 : goto validate_csum; 1196 : : } 1197 : : 1198 : : /* If this skb data are fully covered by the current mapping, @@ -1296,206 +1296,206 @@ 1207 : 0 : goto validate_csum; 1208 : : } 1209 : : - 1210 : 168363 : subflow->map_seq = map_seq; - 1211 : 168363 : subflow->map_subflow_seq = mpext->subflow_seq; - 1212 : 168363 : subflow->map_data_len = data_len; - 1213 : 168363 : subflow->map_valid = 1; - 1214 : 168363 : subflow->map_data_fin = mpext->data_fin; - 1215 : 168363 : subflow->mpc_map = mpext->mpc_map; - 1216 : 168363 : subflow->map_csum_reqd = mpext->csum_reqd; - 1217 : 168363 : subflow->map_csum_len = 0; - 1218 [ - + ]: 168363 : subflow->map_data_csum = csum_unfold(mpext->csum); + 1210 : 203837 : subflow->map_seq = map_seq; + 1211 : 203837 : subflow->map_subflow_seq = mpext->subflow_seq; + 1212 : 203837 : subflow->map_data_len = data_len; + 1213 : 203837 : subflow->map_valid = 1; + 1214 : 203837 : subflow->map_data_fin = mpext->data_fin; + 1215 : 203837 : subflow->mpc_map = mpext->mpc_map; + 1216 : 203837 : subflow->map_csum_reqd = mpext->csum_reqd; + 1217 : 203837 : subflow->map_csum_len = 0; + 1218 [ - + ]: 203837 : subflow->map_data_csum = csum_unfold(mpext->csum); 1219 : : 1220 : : /* Cfr RFC 8684 Section 3.3.0 */ - 1221 [ - + ]: 168363 : if (unlikely(subflow->map_csum_reqd != csum_reqd)) + 1221 [ - + ]: 203837 : if (unlikely(subflow->map_csum_reqd != csum_reqd)) 1222 : : return MAPPING_INVALID; 1223 : : - 1224 [ - + ]: 168363 : pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", + 1224 [ - + ]: 203837 : 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 : 170026 : validate_seq: + 1229 : 205564 : 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 [ - + ]: 170026 : if (!validate_mapping(ssk, skb)) { + 1233 [ - + ]: 205564 : if (!validate_mapping(ssk, skb)) { 1234 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DSSTCPMISMATCH); 1235 : 0 : return MAPPING_INVALID; 1236 : : } 1237 : : - 1238 : 170026 : skb_ext_del(skb, SKB_EXT_MPTCP); + 1238 : 205564 : skb_ext_del(skb, SKB_EXT_MPTCP); 1239 : : - 1240 : 415111 : validate_csum: - 1241 : 415111 : return validate_data_csum(ssk, skb, csum_reqd); + 1240 : 612029 : validate_csum: + 1241 : 612029 : return validate_data_csum(ssk, skb, csum_reqd); 1242 : : } 1243 : : - 1244 : 4895 : static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, + 1244 : 5240 : static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, 1245 : : u64 limit) 1246 : : { - 1247 [ - + ]: 4895 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1248 : 4895 : bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; - 1249 [ - + ]: 4895 : struct tcp_sock *tp = tcp_sk(ssk); - 1250 : 4895 : u32 offset, incr, avail_len; + 1247 [ - + ]: 5240 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1248 : 5240 : bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; + 1249 [ - + ]: 5240 : struct tcp_sock *tp = tcp_sk(ssk); + 1250 : 5240 : u32 offset, incr, avail_len; 1251 : : - 1252 : 4895 : offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; - 1253 [ - + - + ]: 4895 : if (WARN_ON_ONCE(offset > skb->len)) + 1252 : 5240 : offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; + 1253 [ - + - + ]: 5240 : if (WARN_ON_ONCE(offset > skb->len)) 1254 : 0 : goto out; 1255 : : - 1256 : 4895 : avail_len = skb->len - offset; - 1257 [ + + ]: 4895 : incr = limit >= avail_len ? avail_len + fin : limit; + 1256 : 5240 : avail_len = skb->len - offset; + 1257 [ + + ]: 5240 : incr = limit >= avail_len ? avail_len + fin : limit; 1258 : : - 1259 [ - + ]: 4895 : pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len, + 1259 [ - + ]: 5240 : pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len, 1260 : : offset, subflow->map_subflow_seq); - 1261 [ + - ]: 4895 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); - 1262 [ - + ]: 4895 : tcp_sk(ssk)->copied_seq += incr; + 1261 [ + - ]: 5240 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); + 1262 [ - + ]: 5240 : tcp_sk(ssk)->copied_seq += incr; 1263 : : - 1264 : 4895 : out: - 1265 [ - + + + ]: 4895 : if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) - 1266 : 4705 : sk_eat_skb(ssk, skb); - 1267 [ + + ]: 4895 : if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) - 1268 : 3844 : subflow->map_valid = 0; - 1269 : 4895 : } + 1264 : 5240 : out: + 1265 [ - + + + ]: 5240 : if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) + 1266 : 4977 : sk_eat_skb(ssk, skb); + 1267 [ + + ]: 5240 : if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) + 1268 : 3696 : subflow->map_valid = 0; + 1269 : 5240 : } 1270 : : 1271 : 0 : static bool subflow_is_done(const struct sock *sk) 1272 : : { - 1273 [ - + - - ]: 243 : return sk->sk_shutdown & RCV_SHUTDOWN || sk->sk_state == TCP_CLOSE; + 1273 [ - + - - ]: 229 : 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 : 415073 : static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) + 1277 : 605523 : static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) 1278 : : { - 1279 : 415073 : struct sock *sk = (struct sock *)msk; + 1279 : 605523 : struct sock *sk = (struct sock *)msk; 1280 : : - 1281 [ + + + + : 418125 : if (likely(ssk->sk_state != TCP_CLOSE && - + + ] + 1281 [ + + + + : 608250 : if (likely(ssk->sk_state != TCP_CLOSE && + + + ] 1282 : : (ssk->sk_state != TCP_CLOSE_WAIT || 1283 : : inet_sk_state_load(sk) != TCP_ESTABLISHED))) - 1284 : 413393 : return; + 1284 : 603802 : return; 1285 : : - 1286 [ + + ]: 1680 : if (!skb_queue_empty(&ssk->sk_receive_queue)) + 1286 [ + + ]: 1721 : if (!skb_queue_empty(&ssk->sk_receive_queue)) 1287 : : return; 1288 : : - 1289 [ + + ]: 2437 : if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - 1290 : 630 : mptcp_schedule_work(sk); + 1289 [ + + ]: 2470 : if (!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + 1290 : 649 : 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 [ + + ]: 1611 : if (__mptcp_check_fallback(msk) && subflow_is_done(ssk) && - 1296 [ + - + + ]: 486 : msk->first == ssk && - 1297 : 243 : mptcp_update_rcv_data_fin(msk, READ_ONCE(msk->ack_seq), true)) - 1298 : 87 : mptcp_schedule_work(sk); + 1295 [ + + ]: 1648 : if (__mptcp_check_fallback(msk) && subflow_is_done(ssk) && + 1296 [ + - + + ]: 458 : msk->first == ssk && + 1297 : 229 : mptcp_update_rcv_data_fin(msk, READ_ONCE(msk->ack_seq), true)) + 1298 : 82 : mptcp_schedule_work(sk); 1299 : : } 1300 : : - 1301 : 8 : static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) + 1301 : 7 : static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) 1302 : : { - 1303 [ - + ]: 8 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1303 [ - + ]: 7 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 1304 : : - 1305 [ + - ]: 8 : if (subflow->mp_join) + 1305 [ + - ]: 7 : if (subflow->mp_join) 1306 : : return false; - 1307 [ + + + + ]: 8 : else if (READ_ONCE(msk->csum_enabled)) - 1308 : 2 : return !subflow->valid_csum_seen; + 1307 [ + + - + ]: 7 : else if (READ_ONCE(msk->csum_enabled)) + 1308 : 1 : return !subflow->valid_csum_seen; 1309 : : else 1310 [ - + ]: 6 : return READ_ONCE(msk->allow_infinite_fallback); 1311 : : } 1312 : : - 1313 : 2 : static void mptcp_subflow_fail(struct mptcp_sock *msk, struct sock *ssk) + 1313 : 1 : static void mptcp_subflow_fail(struct mptcp_sock *msk, struct sock *ssk) 1314 : : { - 1315 [ - + ]: 2 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1316 : 2 : unsigned long fail_tout; + 1315 [ - + ]: 1 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1316 : 1 : unsigned long fail_tout; 1317 : : 1318 : : /* graceful failure can happen only on the MPC subflow */ - 1319 [ - + + - ]: 2 : if (WARN_ON_ONCE(ssk != READ_ONCE(msk->first))) + 1319 [ - + + - ]: 1 : if (WARN_ON_ONCE(ssk != READ_ONCE(msk->first))) 1320 : : return; 1321 : : 1322 : : /* since the close timeout take precedence on the fail one, 1323 : : * no need to start the latter when the first is already set 1324 : : */ - 1325 [ + - ]: 2 : if (sock_flag((struct sock *)msk, SOCK_DEAD)) + 1325 [ + - ]: 1 : if (sock_flag((struct sock *)msk, SOCK_DEAD)) 1326 : : return; 1327 : : 1328 : : /* we don't need extreme accuracy here, use a zero fail_tout as special 1329 : : * value meaning no fail timeout at all; 1330 : : */ - 1331 : 2 : fail_tout = jiffies + TCP_RTO_MAX; - 1332 : 2 : if (!fail_tout) + 1331 : 1 : fail_tout = jiffies + TCP_RTO_MAX; + 1332 : 1 : if (!fail_tout) 1333 : : fail_tout = 1; - 1334 : 2 : WRITE_ONCE(subflow->fail_tout, fail_tout); - 1335 : 2 : tcp_send_ack(ssk); + 1334 : 1 : WRITE_ONCE(subflow->fail_tout, fail_tout); + 1335 : 1 : tcp_send_ack(ssk); 1336 : : - 1337 : 2 : mptcp_reset_tout_timer(msk, subflow->fail_tout); + 1337 : 1 : mptcp_reset_tout_timer(msk, subflow->fail_tout); 1338 : : } 1339 : : - 1340 : 855291 : static bool subflow_check_data_avail(struct sock *ssk) + 1340 : 1270981 : static bool subflow_check_data_avail(struct sock *ssk) 1341 : : { - 1342 [ + + ]: 855291 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1343 : 855291 : enum mapping_status status; - 1344 : 855291 : struct mptcp_sock *msk; - 1345 : 855291 : struct sk_buff *skb; + 1342 [ + + ]: 1270981 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1343 : 1270981 : enum mapping_status status; + 1344 : 1270981 : struct mptcp_sock *msk; + 1345 : 1270981 : struct sk_buff *skb; 1346 : : - 1347 [ + + - + ]: 855291 : if (!skb_peek(&ssk->sk_receive_queue)) - 1348 : 402911 : WRITE_ONCE(subflow->data_avail, false); - 1349 [ + + + + ]: 855291 : if (subflow->data_avail) + 1347 [ + + - + ]: 1270981 : if (!skb_peek(&ssk->sk_receive_queue)) + 1348 : 593255 : WRITE_ONCE(subflow->data_avail, false); + 1349 [ + + + + ]: 1270981 : if (subflow->data_avail) 1350 : : return true; 1351 : : - 1352 [ - + ]: 820969 : msk = mptcp_sk(subflow->conn); - 1353 : 830759 : for (;;) { - 1354 : 825864 : u64 ack_seq; - 1355 : 825864 : u64 old_ack; + 1352 [ - + ]: 1209190 : msk = mptcp_sk(subflow->conn); + 1353 : 1219670 : for (;;) { + 1354 : 1214430 : u64 ack_seq; + 1355 : 1214430 : u64 old_ack; 1356 : : - 1357 : 825864 : status = get_mapping_status(ssk, msk); - 1358 [ + + ]: 1234396 : trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); - 1359 [ + + + + ]: 825864 : if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY || + 1357 : 1214430 : status = get_mapping_status(ssk, msk); + 1358 [ + + ]: 1813504 : trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); + 1359 [ + + + + ]: 1214430 : if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY || 1360 : : status == MAPPING_BAD_CSUM || status == MAPPING_NODSS)) - 1361 : 2213 : goto fallback; + 1361 : 3320 : goto fallback; 1362 : : - 1363 [ + + ]: 823651 : if (status != MAPPING_OK) - 1364 : 410017 : goto no_data; + 1363 [ + + ]: 1211110 : if (status != MAPPING_OK) + 1364 : 600550 : goto no_data; 1365 : : - 1366 [ + - ]: 413634 : skb = skb_peek(&ssk->sk_receive_queue); - 1367 [ - + ]: 413634 : if (WARN_ON_ONCE(!skb)) + 1366 [ + - ]: 610560 : skb = skb_peek(&ssk->sk_receive_queue); + 1367 [ - + ]: 610560 : if (WARN_ON_ONCE(!skb)) 1368 : 0 : goto no_data; 1369 : : - 1370 [ - + - + ]: 413634 : if (unlikely(!READ_ONCE(msk->can_ack))) + 1370 [ - + - + ]: 610560 : if (unlikely(!READ_ONCE(msk->can_ack))) 1371 : 0 : goto fallback; 1372 : : - 1373 : 413634 : old_ack = READ_ONCE(msk->ack_seq); - 1374 : 413634 : ack_seq = mptcp_subflow_get_mapped_dsn(subflow); - 1375 [ - + ]: 413634 : pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack, + 1373 : 610560 : old_ack = READ_ONCE(msk->ack_seq); + 1374 : 610560 : ack_seq = mptcp_subflow_get_mapped_dsn(subflow); + 1375 [ - + ]: 610560 : pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack, 1376 : : ack_seq); - 1377 [ + + ]: 413634 : if (unlikely(before64(ack_seq, old_ack))) { - 1378 : 4895 : mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); - 1379 : 4895 : continue; + 1377 [ + + ]: 610560 : if (unlikely(before64(ack_seq, old_ack))) { + 1378 : 5240 : mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); + 1379 : 5240 : continue; 1380 : : } 1381 : : - 1382 : 408739 : WRITE_ONCE(subflow->data_avail, true); - 1383 : 408739 : break; + 1382 : 605320 : WRITE_ONCE(subflow->data_avail, true); + 1383 : 605320 : break; 1384 : : } - 1385 : 408739 : return true; + 1385 : 605320 : return true; 1386 : : - 1387 : 410017 : no_data: - 1388 : 410017 : subflow_sched_work_if_closed(msk, ssk); - 1389 : 410017 : return false; + 1387 : 600550 : no_data: + 1388 : 600550 : subflow_sched_work_if_closed(msk, ssk); + 1389 : 600550 : return false; 1390 : : - 1391 : 2213 : fallback: - 1392 [ + + ]: 2213 : if (!__mptcp_check_fallback(msk)) { + 1391 : 3320 : fallback: + 1392 [ + + ]: 3320 : if (!__mptcp_check_fallback(msk)) { 1393 : : /* RFC 8684 section 3.7. */ - 1394 [ + + ]: 12 : if (status == MAPPING_BAD_CSUM && + 1394 [ + + ]: 11 : if (status == MAPPING_BAD_CSUM && 1395 [ + - ]: 4 : (subflow->mp_join || subflow->valid_csum_seen)) { 1396 : 4 : subflow->send_mp_fail = 1; 1397 : : - 1398 [ + + + + ]: 4 : if (!READ_ONCE(msk->allow_infinite_fallback)) { - 1399 : 2 : subflow->reset_transient = 0; - 1400 : 2 : subflow->reset_reason = MPTCP_RST_EMIDDLEBOX; - 1401 : 2 : goto reset; + 1398 [ + + + - ]: 4 : if (!READ_ONCE(msk->allow_infinite_fallback)) { + 1399 : 3 : subflow->reset_transient = 0; + 1400 : 3 : subflow->reset_reason = MPTCP_RST_EMIDDLEBOX; + 1401 : 3 : goto reset; 1402 : : } - 1403 : 2 : mptcp_subflow_fail(msk, ssk); - 1404 : 2 : WRITE_ONCE(subflow->data_avail, true); - 1405 : 2 : return true; + 1403 : 1 : mptcp_subflow_fail(msk, ssk); + 1404 : 1 : WRITE_ONCE(subflow->data_avail, true); + 1405 : 1 : return true; 1406 : : } 1407 : : - 1408 [ + + - + ]: 8 : if (!subflow_can_fallback(subflow) && subflow->map_data_len) { + 1408 [ + + - + ]: 7 : 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 : : */ @@ -1504,44 +1504,44 @@ 1414 [ # # ]: 0 : MPTCP_RST_EMIDDLEBOX : 1415 : : MPTCP_RST_EMPTCP; 1416 : : - 1417 : 2 : reset: - 1418 : 2 : WRITE_ONCE(ssk->sk_err, EBADMSG); - 1419 : 2 : tcp_set_state(ssk, TCP_CLOSE); - 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; + 1417 : 3 : reset: + 1418 : 3 : WRITE_ONCE(ssk->sk_err, EBADMSG); + 1419 : 3 : tcp_set_state(ssk, TCP_CLOSE); + 1420 [ + + + - ]: 9 : while ((skb = skb_peek(&ssk->sk_receive_queue))) + 1421 : 6 : sk_eat_skb(ssk, skb); + 1422 : 3 : mptcp_send_active_reset_reason(ssk); + 1423 : 3 : WRITE_ONCE(subflow->data_avail, false); + 1424 : 3 : return false; 1425 : : } 1426 : : - 1427 : 8 : mptcp_do_fallback(ssk); + 1427 : 7 : mptcp_do_fallback(ssk); 1428 : : } 1429 : : - 1430 [ - + ]: 2209 : skb = skb_peek(&ssk->sk_receive_queue); - 1431 : 2209 : subflow->map_valid = 1; - 1432 : 2209 : subflow->map_seq = READ_ONCE(msk->ack_seq); - 1433 : 2209 : subflow->map_data_len = skb->len; - 1434 [ - + ]: 2209 : subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; - 1435 : 2209 : WRITE_ONCE(subflow->data_avail, true); - 1436 : 2209 : return true; + 1430 [ - + ]: 3316 : skb = skb_peek(&ssk->sk_receive_queue); + 1431 : 3316 : subflow->map_valid = 1; + 1432 : 3316 : subflow->map_seq = READ_ONCE(msk->ack_seq); + 1433 : 3316 : subflow->map_data_len = skb->len; + 1434 [ - + ]: 3316 : subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + 1435 : 3316 : WRITE_ONCE(subflow->data_avail, true); + 1436 : 3316 : return true; 1437 : : } 1438 : : - 1439 : 855291 : bool mptcp_subflow_data_available(struct sock *sk) + 1439 : 1270981 : bool mptcp_subflow_data_available(struct sock *sk) 1440 : : { - 1441 [ + + ]: 855291 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1441 [ + + ]: 1270981 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1442 : : 1443 : : /* check if current mapping is still valid */ - 1444 [ + + ]: 855291 : if (subflow->map_valid && - 1445 [ + + ]: 691807 : mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { - 1446 : 166725 : subflow->map_valid = 0; - 1447 : 166725 : WRITE_ONCE(subflow->data_avail, false); + 1444 [ + + ]: 1270981 : if (subflow->map_valid && + 1445 [ + + ]: 1078351 : mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { + 1446 : 203449 : subflow->map_valid = 0; + 1447 : 203449 : WRITE_ONCE(subflow->data_avail, false); 1448 : : - 1449 [ - + ]: 166725 : pr_debug("Done with mapping: seq=%u data_len=%u\n", + 1449 [ - + ]: 203449 : pr_debug("Done with mapping: seq=%u data_len=%u\n", 1450 : : subflow->map_subflow_seq, 1451 : : subflow->map_data_len); 1452 : : } 1453 : : - 1454 : 855291 : return subflow_check_data_avail(sk); + 1454 : 1270981 : 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 : 987603 : void mptcp_space(const struct sock *ssk, int *space, int *full_space) + 1466 : 1364435 : void mptcp_space(const struct sock *ssk, int *space, int *full_space) 1467 : : { - 1468 : 987603 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1469 : 987603 : const struct sock *sk = subflow->conn; + 1468 : 1364435 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1469 : 1364435 : const struct sock *sk = subflow->conn; 1470 : : - 1471 : 987603 : *space = __mptcp_space(sk); - 1472 : 987603 : *full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); - 1473 : 987603 : } + 1471 : 1364435 : *space = __mptcp_space(sk); + 1472 : 1364435 : *full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); + 1473 : 1364435 : } 1474 : : - 1475 : 1794 : static void subflow_error_report(struct sock *ssk) + 1475 : 1907 : static void subflow_error_report(struct sock *ssk) 1476 : : { - 1477 [ + + ]: 1794 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; + 1477 [ + + ]: 1907 : 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 [ + + ]: 1794 : if (!sk->sk_socket) + 1483 [ + + ]: 1907 : if (!sk->sk_socket) 1484 : : return; 1485 : : 1486 : 964 : mptcp_data_lock(sk); - 1487 [ + + ]: 964 : if (!sock_owned_by_user(sk)) - 1488 : 393 : __mptcp_error_report(sk); + 1487 [ + + ]: 964 : if (!sock_owned_by_user(sk)) + 1488 : 366 : __mptcp_error_report(sk); 1489 : : else - 1490 [ - + ]: 571 : __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); + 1490 [ - + ]: 598 : __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); 1491 : 964 : mptcp_data_unlock(sk); 1492 : : } 1493 : : - 1494 : 435788 : static void subflow_data_ready(struct sock *sk) + 1494 : 652816 : static void subflow_data_ready(struct sock *sk) 1495 : : { - 1496 : 435788 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1497 [ - + ]: 435788 : u16 state = 1 << inet_sk_state_load(sk); - 1498 : 435788 : struct sock *parent = subflow->conn; - 1499 : 435788 : struct mptcp_sock *msk; + 1496 : 652816 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1497 [ - + ]: 652816 : u16 state = 1 << inet_sk_state_load(sk); + 1498 : 652816 : struct sock *parent = subflow->conn; + 1499 : 652816 : struct mptcp_sock *msk; 1500 : : - 1501 : 435788 : trace_sk_data_ready(sk); + 1501 : 652816 : trace_sk_data_ready(sk); 1502 : : - 1503 [ - + ]: 435788 : msk = mptcp_sk(parent); - 1504 [ + + ]: 435788 : if (state & TCPF_LISTEN) { + 1503 [ - + ]: 652816 : msk = mptcp_sk(parent); + 1504 [ + + ]: 652816 : if (state & TCPF_LISTEN) { 1505 : : /* MPJ subflow are removed from accept queue before reaching here, 1506 : : * avoid stray wakeups 1507 : : */ - 1508 [ + + ]: 1761 : if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue)) + 1508 [ + + ]: 1762 : if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue)) 1509 : : return; 1510 : : - 1511 : 1283 : parent->sk_data_ready(parent); - 1512 : 1283 : return; + 1511 : 1288 : parent->sk_data_ready(parent); + 1512 : 1288 : return; 1513 : : } 1514 : : - 1515 [ + + - + : 434027 : WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && + 1515 [ + + - + : 651054 : WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && - - ] 1516 : : !subflow->mp_join && !(state & TCPF_CLOSE)); 1517 : : - 1518 [ + + ]: 434027 : if (mptcp_subflow_data_available(sk)) { - 1519 : 427108 : mptcp_data_ready(parent, sk); + 1518 [ + + ]: 651054 : if (mptcp_subflow_data_available(sk)) { + 1519 : 643909 : 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 [ + + ]: 427108 : if (mptcp_data_avail(msk) < parent->sk_rcvlowat && - 1525 [ - + - + : 99120 : (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) - + + ] - 1526 : 58640 : inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; - 1527 [ + + ]: 6919 : } else if (unlikely(sk->sk_err)) { - 1528 : 2 : subflow_error_report(sk); + 1524 [ + + ]: 643909 : if (mptcp_data_avail(msk) < parent->sk_rcvlowat && + 1525 [ - + - + : 112845 : (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) + + + ] + 1526 : 69475 : inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; + 1527 [ + + ]: 7145 : } else if (unlikely(sk->sk_err)) { + 1528 : 3 : subflow_error_report(sk); 1529 : : } 1530 : : } 1531 : : - 1532 : 293805 : static void subflow_write_space(struct sock *ssk) + 1532 : 392656 : static void subflow_write_space(struct sock *ssk) 1533 : : { - 1534 : 293805 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; + 1534 : 392656 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; 1535 : : - 1536 : 293805 : mptcp_propagate_sndbuf(sk, ssk); - 1537 : 293805 : mptcp_write_space(sk); - 1538 : 293805 : } + 1536 : 392656 : mptcp_propagate_sndbuf(sk, ssk); + 1537 : 392656 : mptcp_write_space(sk); + 1538 : 392656 : } 1539 : : 1540 : : static const struct inet_connection_sock_af_ops * 1541 : 0 : subflow_default_af_ops(struct sock *sk) @@ -1640,22 +1640,22 @@ 1548 : : } 1549 : : 1550 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1551 : 728 : void mptcpv6_handle_mapped(struct sock *sk, bool mapped) + 1551 : 727 : void mptcpv6_handle_mapped(struct sock *sk, bool mapped) 1552 : : { - 1553 [ - + ]: 728 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1554 : 728 : struct inet_connection_sock *icsk = inet_csk(sk); - 1555 : 728 : 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 [ - + ]: 728 : target = mapped ? &subflow_v6m_specific : subflow_default_af_ops(sk); + 1557 [ - + ]: 727 : target = mapped ? &subflow_v6m_specific : subflow_default_af_ops(sk); 1558 : : - 1559 [ - + ]: 728 : 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 [ + - ]: 728 : if (likely(icsk->icsk_af_ops == target)) + 1562 [ + - ]: 727 : if (likely(icsk->icsk_af_ops == target)) 1563 : : return; 1564 : : - 1565 : 728 : subflow->icsk_af_ops = icsk->icsk_af_ops; - 1566 : 728 : 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 : : @@ -1665,55 +1665,55 @@ 1573 : : { 1574 : 1144 : memset(addr, 0, sizeof(*addr)); 1575 : 1144 : addr->ss_family = family; - 1576 [ + + ]: 1144 : if (addr->ss_family == AF_INET) { - 1577 : 1026 : struct sockaddr_in *in_addr = (struct sockaddr_in *)addr; + 1576 [ + + ]: 1144 : if (addr->ss_family == AF_INET) { + 1577 : 1024 : 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 [ + + ]: 1024 : if (info->family == AF_INET) + 1580 : 1006 : 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 [ + - ]: 18 : else if (ipv6_addr_v4mapped(&info->addr6)) + 1583 : 18 : in_addr->sin_addr.s_addr = info->addr6.s6_addr32[3]; 1584 : : #endif - 1585 : 1026 : in_addr->sin_port = info->port; + 1585 : 1024 : in_addr->sin_port = info->port; 1586 : : } 1587 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1588 [ + - ]: 118 : else if (addr->ss_family == AF_INET6) { - 1589 : 118 : struct sockaddr_in6 *in6_addr = (struct sockaddr_in6 *)addr; + 1588 [ + - ]: 120 : else if (addr->ss_family == AF_INET6) { + 1589 : 120 : struct sockaddr_in6 *in6_addr = (struct sockaddr_in6 *)addr; 1590 : : - 1591 [ + + ]: 118 : if (info->family == AF_INET) + 1591 [ + + ]: 120 : if (info->family == AF_INET) 1592 [ - + ]: 2 : ipv6_addr_set_v4mapped(info->addr.s_addr, 1593 : : &in6_addr->sin6_addr); 1594 : : else - 1595 : 116 : in6_addr->sin6_addr = info->addr6; - 1596 : 118 : in6_addr->sin6_port = info->port; + 1595 : 118 : in6_addr->sin6_addr = info->addr6; + 1596 : 120 : in6_addr->sin6_port = info->port; 1597 : : } 1598 : : #endif 1599 : 1144 : } 1600 : : - 1601 : 627 : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, + 1601 : 628 : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, 1602 : : const struct mptcp_addr_info *remote) 1603 : : { - 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; + 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; 1614 : : 1615 : : /* The userspace PM sent the request too early? */ - 1616 [ - + ]: 627 : if (!mptcp_is_fully_established(sk)) + 1616 [ - + ]: 628 : if (!mptcp_is_fully_established(sk)) 1617 : 0 : goto err_out; 1618 : : - 1619 : 627 : err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); - 1620 [ + + ]: 627 : 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 : 628 : err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); + 1620 [ + + ]: 628 : if (err) { + 1621 [ + - ]: 66 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); + 1622 [ - + ]: 66 : 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 : 66 : goto err_out; 1625 : : } 1626 : : 1627 : 562 : ssk = sf->sk; @@ -1723,18 +1723,18 @@ 1631 [ - + ]: 562 : } while (!subflow->local_nonce); 1632 : : 1633 : : /* if 'IPADDRANY', the ID will be set later, after the routing */ - 1634 [ + + ]: 562 : if (local->addr.family == AF_INET) { - 1635 [ + + ]: 503 : if (!local->addr.addr.s_addr) + 1634 [ + + ]: 562 : if (local->addr.family == AF_INET) { + 1635 [ + + ]: 502 : if (!local->addr.addr.s_addr) 1636 : : local_id = -1; 1637 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1638 [ + + ]: 59 : } else if (sk->sk_family == AF_INET6) { - 1639 [ + + ]: 57 : if (ipv6_addr_any(&local->addr.addr6)) + 1638 [ + + ]: 60 : } else if (sk->sk_family == AF_INET6) { + 1639 [ + + ]: 58 : 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 : 316 : if (local_id >= 0) + 1645 : 316 : subflow_set_local_id(subflow, local_id); 1646 : : 1647 : 562 : subflow->remote_key_valid = 1; 1648 : 562 : subflow->remote_key = READ_ONCE(msk->remote_key); @@ -1744,8 +1744,8 @@ 1652 : : 1653 : 562 : addrlen = sizeof(struct sockaddr_in); 1654 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1655 [ + + ]: 562 : if (addr.ss_family == AF_INET6) - 1656 : 59 : addrlen = sizeof(struct sockaddr_in6); + 1655 [ + + ]: 562 : if (addr.ss_family == AF_INET6) + 1656 : 60 : addrlen = sizeof(struct sockaddr_in6); 1657 : : #endif 1658 : 562 : ssk->sk_bound_dev_if = local->ifindex; 1659 : 562 : err = kernel_bind(sf, (struct sockaddr *)&addr, addrlen); @@ -1776,7 +1776,7 @@ 1684 : 26 : goto failed_unlink; 1685 : : } 1686 : : - 1687 [ + - ]: 534 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); + 1687 [ + - ]: 534 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); 1688 : : 1689 : : /* discard the subflow socket */ 1690 : 534 : mptcp_sock_graft(ssk, sk->sk_socket); @@ -1793,12 +1793,12 @@ 1701 : 28 : subflow->disposable = 1; 1702 : 28 : sock_release(sf); 1703 : : - 1704 : 93 : err_out: + 1704 : 94 : 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 : 94 : mptcp_pm_close_subflow(msk); + 1709 : 94 : return err; 1710 : : } 1711 : : 1712 : 3080 : static void mptcp_attach_cgroup(struct sock *parent, struct sock *child) @@ -1829,34 +1829,34 @@ 1737 : : { 1738 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 1739 : 3080 : if (ssk->sk_prot == &tcpv6_prot) - 1740 : 937 : ssk->sk_prot = &tcpv6_prot_override; + 1740 : 938 : ssk->sk_prot = &tcpv6_prot_override; 1741 : : else 1742 : : #endif - 1743 : 2143 : ssk->sk_prot = &tcp_prot_override; + 1743 : 2142 : 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 : 1818 : ssk->sk_prot = &tcpv6_prot; 1751 : : else 1752 : : #endif - 1753 : 2934 : ssk->sk_prot = &tcp_prot; + 1753 : 2940 : ssk->sk_prot = &tcp_prot; 1754 : : } 1755 : : - 1756 : 3145 : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, + 1756 : 3146 : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, 1757 : : struct socket **new_sock) 1758 : : { - 1759 : 3145 : struct mptcp_subflow_context *subflow; - 1760 [ + + ]: 3145 : struct net *net = sock_net(sk); - 1761 : 3145 : struct socket *sf; - 1762 : 3145 : int err; + 1759 : 3146 : struct mptcp_subflow_context *subflow; + 1760 [ + + ]: 3146 : struct net *net = sock_net(sk); + 1761 : 3146 : struct socket *sf; + 1762 : 3146 : int err; 1763 : : 1764 : : /* un-accepted server sockets can reach here - on bad configuration 1765 : : * bail early to avoid greater trouble later 1766 : : */ - 1767 [ + + ]: 3145 : if (unlikely(!sk->sk_socket)) + 1767 [ + + ]: 3146 : if (unlikely(!sk->sk_socket)) 1768 : : return -EINVAL; 1769 : : 1770 : 3080 : err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf); @@ -1903,7 +1903,7 @@ 1811 : 3080 : *new_sock = sf; 1812 : 3080 : sock_hold(sk); 1813 : 3080 : subflow->conn = sk; - 1814 [ + + ]: 3080 : mptcp_subflow_ops_override(sf->sk); + 1814 [ + + ]: 3080 : mptcp_subflow_ops_override(sf->sk); 1815 : : 1816 : : return 0; 1817 : : @@ -1913,51 +1913,51 @@ 1821 : 0 : return err; 1822 : : } 1823 : : - 1824 : 4773 : static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk, + 1824 : 4774 : static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk, 1825 : : gfp_t priority) 1826 : : { - 1827 : 4773 : struct inet_connection_sock *icsk = inet_csk(sk); - 1828 : 4773 : struct mptcp_subflow_context *ctx; + 1827 : 4774 : struct inet_connection_sock *icsk = inet_csk(sk); + 1828 : 4774 : struct mptcp_subflow_context *ctx; 1829 : : - 1830 : 4773 : ctx = kzalloc(sizeof(*ctx), priority); - 1831 [ + - ]: 4773 : if (!ctx) + 1830 : 4774 : ctx = kzalloc(sizeof(*ctx), priority); + 1831 [ + - ]: 4774 : if (!ctx) 1832 : : return NULL; 1833 : : - 1834 : 4773 : rcu_assign_pointer(icsk->icsk_ulp_data, ctx); - 1835 [ - + ]: 4773 : INIT_LIST_HEAD(&ctx->node); - 1836 : 4773 : INIT_LIST_HEAD(&ctx->delegated_node); + 1834 : 4774 : rcu_assign_pointer(icsk->icsk_ulp_data, ctx); + 1835 [ - + ]: 4774 : INIT_LIST_HEAD(&ctx->node); + 1836 : 4774 : INIT_LIST_HEAD(&ctx->delegated_node); 1837 : : - 1838 [ - + ]: 4773 : pr_debug("subflow=%p\n", ctx); + 1838 [ - + ]: 4774 : pr_debug("subflow=%p\n", ctx); 1839 : : - 1840 : 4773 : ctx->tcp_sock = sk; - 1841 : 4773 : WRITE_ONCE(ctx->local_id, -1); + 1840 : 4774 : ctx->tcp_sock = sk; + 1841 : 4774 : WRITE_ONCE(ctx->local_id, -1); 1842 : : - 1843 : 4773 : return ctx; + 1843 : 4774 : return ctx; 1844 : : } 1845 : : - 1846 : 5056 : static void __subflow_state_change(struct sock *sk) + 1846 : 4973 : static void __subflow_state_change(struct sock *sk) 1847 : : { - 1848 : 5056 : struct socket_wq *wq; + 1848 : 4973 : struct socket_wq *wq; 1849 : : - 1850 : 5056 : rcu_read_lock(); - 1851 [ + - - + : 5056 : wq = rcu_dereference(sk->sk_wq); + 1850 : 4973 : rcu_read_lock(); + 1851 [ + - - + : 4973 : wq = rcu_dereference(sk->sk_wq); - - - - - - ] - 1852 [ + + ]: 5056 : if (skwq_has_sleeper(wq)) - 1853 : 367 : wake_up_interruptible_all(&wq->wait); - 1854 : 5056 : rcu_read_unlock(); - 1855 : 5056 : } + 1852 [ + + ]: 4973 : if (skwq_has_sleeper(wq)) + 1853 : 385 : wake_up_interruptible_all(&wq->wait); + 1854 : 4973 : rcu_read_unlock(); + 1855 : 4973 : } 1856 : : - 1857 : 5056 : static void subflow_state_change(struct sock *sk) + 1857 : 4973 : static void subflow_state_change(struct sock *sk) 1858 : : { - 1859 : 5056 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1860 : 5056 : struct sock *parent = subflow->conn; - 1861 : 5056 : struct mptcp_sock *msk; + 1859 : 4973 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1860 : 4973 : struct sock *parent = subflow->conn; + 1861 : 4973 : struct mptcp_sock *msk; 1862 : : - 1863 : 5056 : __subflow_state_change(sk); + 1863 : 4973 : __subflow_state_change(sk); 1864 : : - 1865 [ - + ]: 5056 : msk = mptcp_sk(parent); - 1866 [ - + ]: 5056 : if (subflow_simultaneous_connect(sk)) { + 1865 [ - + ]: 4973 : msk = mptcp_sk(parent); + 1866 [ - + ]: 4973 : 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 [ + + ]: 5056 : if (mptcp_subflow_data_available(sk)) + 1877 [ + + ]: 4973 : if (mptcp_subflow_data_available(sk)) 1878 : 91 : mptcp_data_ready(parent, sk); - 1879 [ + + ]: 4965 : else if (unlikely(sk->sk_err)) - 1880 : 461 : subflow_error_report(sk); + 1879 [ + + ]: 4882 : else if (unlikely(sk->sk_err)) + 1880 : 485 : subflow_error_report(sk); 1881 : : - 1882 [ - + ]: 5056 : subflow_sched_work_if_closed(mptcp_sk(parent), sk); - 1883 : 5056 : } + 1882 [ - + ]: 4973 : subflow_sched_work_if_closed(mptcp_sk(parent), sk); + 1883 : 4973 : } 1884 : : - 1885 : 1248 : void mptcp_subflow_queue_clean(struct sock *listener_sk, struct sock *listener_ssk) + 1885 : 1250 : void mptcp_subflow_queue_clean(struct sock *listener_sk, struct sock *listener_ssk) 1886 : : { - 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; + 1887 : 1250 : struct request_sock_queue *queue = &inet_csk(listener_ssk)->icsk_accept_queue; + 1888 : 1250 : struct request_sock *req, *head, *tail; + 1889 : 1250 : struct mptcp_subflow_context *subflow; + 1890 : 1250 : 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 : 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); + 1896 : 1250 : spin_lock_bh(&queue->rskq_lock); + 1897 : 1250 : head = queue->rskq_accept_head; + 1898 : 1250 : tail = queue->rskq_accept_tail; + 1899 : 1250 : queue->rskq_accept_head = NULL; + 1900 : 1250 : queue->rskq_accept_tail = NULL; + 1901 : 1250 : spin_unlock_bh(&queue->rskq_lock); 1902 : : - 1903 [ + + ]: 1248 : if (!head) + 1903 [ + + ]: 1250 : if (!head) 1904 : : return; 1905 : : 1906 : : /* can't acquire the msk socket lock under the subflow one, @@ -2072,7 +2072,7 @@ 1978 : : 1979 : 3080 : tp->is_mptcp = 1; 1980 : 3080 : ctx->icsk_af_ops = icsk->icsk_af_ops; - 1981 [ + + ]: 3080 : icsk->icsk_af_ops = subflow_default_af_ops(sk); + 1981 [ + + ]: 3080 : icsk->icsk_af_ops = subflow_default_af_ops(sk); 1982 : 3080 : ctx->tcp_state_change = sk->sk_state_change; 1983 : 3080 : ctx->tcp_error_report = sk->sk_error_report; 1984 : : @@ -2087,22 +2087,22 @@ 1993 : 3392 : return err; 1994 : : } 1995 : : - 1996 : 4613 : static void subflow_ulp_release(struct sock *ssk) + 1996 : 4622 : static void subflow_ulp_release(struct sock *ssk) 1997 : : { - 1998 [ + - ]: 4613 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(ssk); - 1999 : 4613 : bool release = true; - 2000 : 4613 : struct sock *sk; + 1998 [ + - ]: 4622 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(ssk); + 1999 : 4622 : bool release = true; + 2000 : 4622 : struct sock *sk; 2001 : : - 2002 [ + - ]: 4613 : if (!ctx) + 2002 [ + - ]: 4622 : if (!ctx) 2003 : : return; 2004 : : - 2005 : 4613 : sk = ctx->conn; - 2006 [ + - ]: 4613 : if (sk) { + 2005 : 4622 : sk = ctx->conn; + 2006 [ + - ]: 4622 : if (sk) { 2007 : : /* if the msk has been orphaned, keep the ctx 2008 : : * alive, will be freed by __mptcp_close_ssk(), 2009 : : * when the subflow is still unaccepted 2010 : : */ - 2011 [ - + - - ]: 4613 : release = ctx->disposable || list_empty(&ctx->node); + 2011 [ - + - - ]: 4622 : release = ctx->disposable || list_empty(&ctx->node); 2012 : : 2013 : : /* inet_child_forget() does not call sk_state_change(), 2014 : : * explicitly trigger the socket close machinery @@ -2110,41 +2110,41 @@ 2016 [ # # ]: 0 : if (!release && !test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, 2017 [ # # ]: 0 : &mptcp_sk(sk)->flags)) 2018 : 0 : mptcp_schedule_work(sk); - 2019 : 4613 : sock_put(sk); + 2019 : 4622 : sock_put(sk); 2020 : : } 2021 : : - 2022 [ + + ]: 4613 : mptcp_subflow_ops_undo_override(ssk); - 2023 [ + - ]: 4613 : if (release) - 2024 : 4613 : kfree_rcu(ctx, rcu); + 2022 [ + + ]: 4622 : mptcp_subflow_ops_undo_override(ssk); + 2023 [ + - ]: 4622 : if (release) + 2024 : 4622 : kfree_rcu(ctx, rcu); 2025 : : } 2026 : : - 2027 : 1769 : static void subflow_ulp_clone(const struct request_sock *req, + 2027 : 1770 : static void subflow_ulp_clone(const struct request_sock *req, 2028 : : struct sock *newsk, 2029 : : const gfp_t priority) 2030 : : { - 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; + 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; 2034 : : - 2035 [ + + + - ]: 1769 : if (!tcp_rsk(req)->is_mptcp || - 2036 [ + + ]: 1769 : (!subflow_req->mp_capable && !subflow_req->mp_join)) { + 2035 [ + + + - ]: 1770 : if (!tcp_rsk(req)->is_mptcp || + 2036 [ + + ]: 1770 : (!subflow_req->mp_capable && !subflow_req->mp_join)) { 2037 : 76 : subflow_ulp_fallback(newsk, old_ctx); 2038 : 76 : return; 2039 : : } 2040 : : - 2041 : 1693 : new_ctx = subflow_create_ctx(newsk, priority); - 2042 [ - + ]: 1693 : if (!new_ctx) { + 2041 : 1694 : new_ctx = subflow_create_ctx(newsk, priority); + 2042 [ - + ]: 1694 : if (!new_ctx) { 2043 : 0 : subflow_ulp_fallback(newsk, old_ctx); 2044 : 0 : return; 2045 : : } 2046 : : - 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; + 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; 2052 : : - 2053 [ + + ]: 1693 : if (subflow_req->mp_capable) { + 2053 [ + + ]: 1694 : 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 [ + - ]: 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; + 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; 2075 : : 2076 : : /* the subflow req id is valid, fetched via subflow_check_req() 2077 : : * and subflow_token_join_request() 2078 : : */ - 2079 : 513 : subflow_set_local_id(new_ctx, subflow_req->local_id); + 2079 : 514 : subflow_set_local_id(new_ctx, subflow_req->local_id); 2080 : : } 2081 : : } 2082 : : - 2083 : 463187 : static void tcp_release_cb_override(struct sock *ssk) + 2083 : 527015 : static void tcp_release_cb_override(struct sock *ssk) 2084 : : { - 2085 : 463187 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 2086 : 463187 : long status; + 2085 : 527015 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 2086 : 527015 : 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 [ - + - + ]: 463187 : status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0); - 2093 [ + + ]: 463187 : if (status) - 2094 : 2434 : mptcp_subflow_process_delegated(ssk, status); + 2092 [ - + - + ]: 527015 : status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0); + 2093 [ + + ]: 527015 : if (status) + 2094 : 2585 : mptcp_subflow_process_delegated(ssk, status); 2095 : : - 2096 : 463187 : tcp_release_cb(ssk); - 2097 : 463187 : } + 2096 : 527015 : tcp_release_cb(ssk); + 2097 : 527015 : } 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 745e9735..873a6111 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/syncookies.c.func.html b/html/lcov/export/mptcp/syncookies.c.func.html index dc7c4957..dbd87a5c 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % diff --git a/html/lcov/export/mptcp/syncookies.c.gcov.html b/html/lcov/export/mptcp/syncookies.c.gcov.html index 93902e70..d59b0cf6 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 69661fc5..56ca413a 100644 --- a/html/lcov/export/mptcp/token.c.func-c.html +++ b/html/lcov/export/mptcp/token.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -95,7 +95,7 @@ mptcp_token_get_sock - 693 + 694 @@ -130,7 +130,7 @@ mptcp_token_destroy_request - 1837 + 1838 @@ -144,21 +144,21 @@ mptcp_token_destroy - 3895 + 3920 __token_lookup_msk - 4855 + 4859 mptcp_token_iter_next - 5607 + 5701 diff --git a/html/lcov/export/mptcp/token.c.func.html b/html/lcov/export/mptcp/token.c.func.html index 8fa9ca92..e6302bc3 100644 --- a/html/lcov/export/mptcp/token.c.func.html +++ b/html/lcov/export/mptcp/token.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -88,7 +88,7 @@ __token_lookup_msk - 4855 + 4859 @@ -109,14 +109,14 @@ mptcp_token_destroy - 3895 + 3920 mptcp_token_destroy_request - 1837 + 1838 @@ -130,7 +130,7 @@ mptcp_token_get_sock - 693 + 694 @@ -144,7 +144,7 @@ mptcp_token_iter_next - 5607 + 5701 diff --git a/html/lcov/export/mptcp/token.c.gcov.html b/html/lcov/export/mptcp/token.c.gcov.html index 7fb40acd..542239ba 100644 --- a/html/lcov/export/mptcp/token.c.gcov.html +++ b/html/lcov/export/mptcp/token.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 % @@ -125,7 +125,7 @@ 47 : : 48 : 0 : static struct token_bucket *token_bucket(u32 token) 49 : : { - 50 : 6390 : return &token_hash[token & token_mask]; + 50 : 6395 : return &token_hash[token & token_mask]; 51 : : } 52 : : 53 : : /* called with bucket lock held */ @@ -145,14 +145,14 @@ 65 : : 66 : : /* called with bucket lock held */ 67 : : static struct mptcp_sock * - 68 : 4855 : __token_lookup_msk(struct token_bucket *t, u32 token) + 68 : 4859 : __token_lookup_msk(struct token_bucket *t, u32 token) 69 : : { - 70 : 4855 : struct hlist_nulls_node *pos; - 71 : 4855 : struct sock *sk; + 70 : 4859 : struct hlist_nulls_node *pos; + 71 : 4859 : struct sock *sk; 72 : : - 73 [ + + ]: 4871 : sk_nulls_for_each_rcu(sk, pos, &t->msk_chain) - 74 [ + + - + ]: 2401 : if (mptcp_sk(sk)->token == token) - 75 [ - + ]: 2385 : return mptcp_sk(sk); + 73 [ + + ]: 4884 : sk_nulls_for_each_rcu(sk, pos, &t->msk_chain) + 74 [ + + - + ]: 2414 : if (mptcp_sk(sk)->token == token) + 75 [ - + ]: 2389 : return mptcp_sk(sk); 76 : : return NULL; 77 : : } 78 : : @@ -324,32 +324,32 @@ 243 : : * 244 : : * returns NULL if no connection with the given token value exists. 245 : : */ - 246 : 693 : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) + 246 : 694 : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) 247 : : { - 248 : 693 : struct hlist_nulls_node *pos; - 249 : 693 : struct token_bucket *bucket; - 250 : 693 : struct mptcp_sock *msk; - 251 : 693 : struct sock *sk; + 248 : 694 : struct hlist_nulls_node *pos; + 249 : 694 : struct token_bucket *bucket; + 250 : 694 : struct mptcp_sock *msk; + 251 : 694 : struct sock *sk; 252 : : - 253 : 693 : rcu_read_lock(); - 254 : 693 : bucket = token_bucket(token); + 253 : 694 : rcu_read_lock(); + 254 : 694 : bucket = token_bucket(token); 255 : : 256 : : again: - 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 || + 257 [ + + ]: 694 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + 258 [ - + ]: 680 : msk = mptcp_sk(sk); + 259 [ + - - + ]: 990 : if (READ_ONCE(msk->token) != token || 260 [ - + ]: 60 : !net_eq(sock_net(sk), net)) 261 : 0 : continue; 262 : : - 263 [ + + ]: 679 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 263 [ + + ]: 680 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 264 : 2 : goto not_found; 265 : : - 266 [ + - - + ]: 986 : if (READ_ONCE(msk->token) != token || + 266 [ + - - + ]: 987 : 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 : 677 : goto found; + 271 : 678 : 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 : 693 : found: - 280 : 693 : rcu_read_unlock(); - 281 : 693 : return msk; + 279 : 694 : found: + 280 : 694 : rcu_read_unlock(); + 281 : 694 : 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 : 5607 : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, + 297 : 5701 : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, 298 : : long *s_num) 299 : : { - 300 : 5607 : struct mptcp_sock *ret = NULL; - 301 : 5607 : struct hlist_nulls_node *pos; - 302 : 5607 : int slot, num = 0; + 300 : 5701 : struct mptcp_sock *ret = NULL; + 301 : 5701 : struct hlist_nulls_node *pos; + 302 : 5701 : int slot, num = 0; 303 : : - 304 [ + + ]: 9598439 : for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { - 305 : 9595864 : struct token_bucket *bucket = &token_hash[slot]; - 306 : 9595864 : struct sock *sk; + 304 [ + + ]: 9688645 : for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { + 305 : 9686040 : struct token_bucket *bucket = &token_hash[slot]; + 306 : 9686040 : struct sock *sk; 307 : : - 308 : 9595864 : num = 0; + 308 : 9686040 : num = 0; 309 : : - 310 [ + + ]: 9595864 : if (hlist_nulls_empty(&bucket->msk_chain)) - 311 : 9588199 : continue; + 310 [ + + ]: 9686040 : if (hlist_nulls_empty(&bucket->msk_chain)) + 311 : 9678279 : continue; 312 : : - 313 : 7665 : rcu_read_lock(); - 314 [ + + ]: 12371 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { - 315 : 7738 : ++num; - 316 [ + + ]: 7738 : if (!net_eq(sock_net(sk), net)) - 317 : 1650 : continue; + 313 : 7761 : rcu_read_lock(); + 314 [ + + ]: 12566 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + 315 : 7901 : ++num; + 316 [ + + ]: 7901 : if (!net_eq(sock_net(sk), net)) + 317 : 1651 : continue; 318 : : - 319 [ + + ]: 6088 : if (num <= *s_num) - 320 : 3056 : continue; + 319 [ + + ]: 6250 : if (num <= *s_num) + 320 : 3154 : continue; 321 : : - 322 [ - + ]: 3032 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 322 [ - + ]: 3096 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 323 : 0 : continue; 324 : : - 325 [ - + ]: 3032 : if (!net_eq(sock_net(sk), net)) { + 325 [ - + ]: 3096 : if (!net_eq(sock_net(sk), net)) { 326 : 0 : sock_put(sk); 327 : 0 : continue; 328 : : } 329 : : - 330 [ - + ]: 3032 : ret = mptcp_sk(sk); - 331 : 3032 : rcu_read_unlock(); - 332 : 3032 : goto out; + 330 [ - + ]: 3096 : ret = mptcp_sk(sk); + 331 : 3096 : rcu_read_unlock(); + 332 : 3096 : goto out; 333 : : } - 334 : 4633 : rcu_read_unlock(); + 334 : 4665 : rcu_read_unlock(); 335 : : } 336 : : - 337 : 2575 : out: - 338 : 5607 : *s_slot = slot; - 339 : 5607 : *s_num = num; - 340 : 5607 : return ret; + 337 : 2605 : out: + 338 : 5701 : *s_slot = slot; + 339 : 5701 : *s_num = num; + 340 : 5701 : 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 : 1837 : void mptcp_token_destroy_request(struct request_sock *req) + 350 : 1838 : void mptcp_token_destroy_request(struct request_sock *req) 351 : : { - 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; + 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; 355 : : - 356 [ + + ]: 1837 : if (hlist_nulls_unhashed(&subflow_req->token_node)) + 356 [ + + ]: 1838 : if (hlist_nulls_unhashed(&subflow_req->token_node)) 357 : : return; 358 : : 359 : 26 : bucket = token_bucket(subflow_req->token); @@ -453,25 +453,25 @@ 372 : : * 373 : : * Remove the token associated to @msk 374 : : */ - 375 : 3895 : void mptcp_token_destroy(struct mptcp_sock *msk) + 375 : 3920 : void mptcp_token_destroy(struct mptcp_sock *msk) 376 : : { - 377 : 3895 : struct sock *sk = (struct sock *)msk; - 378 : 3895 : struct token_bucket *bucket; - 379 : 3895 : struct mptcp_sock *pos; + 377 : 3920 : struct sock *sk = (struct sock *)msk; + 378 : 3920 : struct token_bucket *bucket; + 379 : 3920 : struct mptcp_sock *pos; 380 : : - 381 [ + + ]: 3895 : if (sk_unhashed((struct sock *)msk)) + 381 [ + + ]: 3920 : if (sk_unhashed((struct sock *)msk)) 382 : : return; 383 : : - 384 : 2385 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); - 385 : 2385 : bucket = token_bucket(msk->token); - 386 : 2385 : spin_lock_bh(&bucket->lock); - 387 : 2385 : pos = __token_lookup_msk(bucket, msk->token); - 388 [ - + + - ]: 2385 : if (!WARN_ON_ONCE(pos != msk)) { - 389 [ + - ]: 2385 : __sk_nulls_del_node_init_rcu((struct sock *)pos); - 390 : 2385 : bucket->chain_len--; + 384 : 2389 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); + 385 : 2389 : bucket = token_bucket(msk->token); + 386 : 2389 : spin_lock_bh(&bucket->lock); + 387 : 2389 : pos = __token_lookup_msk(bucket, msk->token); + 388 [ - + + - ]: 2389 : if (!WARN_ON_ONCE(pos != msk)) { + 389 [ + - ]: 2389 : __sk_nulls_del_node_init_rcu((struct sock *)pos); + 390 : 2389 : bucket->chain_len--; 391 : : } - 392 : 2385 : spin_unlock_bh(&bucket->lock); - 393 : 2385 : WRITE_ONCE(msk->token, 0); + 392 : 2389 : spin_unlock_bh(&bucket->lock); + 393 : 2389 : WRITE_ONCE(msk->token, 0); 394 : : } 395 : : 396 : 4 : void __init mptcp_token_init(void) 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 2020083b..6e462cd5 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 d6b59939..d1f2e2ce 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-01-29 18:33:50 + 2025-01-30 06:41:23 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 ad53935f..5a47538d 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-01-29 18:33:50 + 2025-01-30 06:41:23 Functions: 100.0 %