From e28d6d3ec195e032a388bc10a3f4b6a1b44d2f3c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 06:48:20 +0000 Subject: [PATCH] lcov: new: export-net/20250204T055041 --- html/lcov/export-net/index-sort-b.html | 68 +- html/lcov/export-net/index-sort-f.html | 44 +- html/lcov/export-net/index-sort-l.html | 44 +- html/lcov/export-net/index.html | 44 +- html/lcov/export-net/mptcp/bpf.c.func-c.html | 2 +- html/lcov/export-net/mptcp/bpf.c.func.html | 2 +- html/lcov/export-net/mptcp/bpf.c.gcov.html | 2 +- .../export-net/mptcp/crypto.c.func-c.html | 6 +- html/lcov/export-net/mptcp/crypto.c.func.html | 6 +- html/lcov/export-net/mptcp/crypto.c.gcov.html | 62 +- .../mptcp/crypto_test.c.func-c.html | 2 +- .../export-net/mptcp/crypto_test.c.func.html | 2 +- .../export-net/mptcp/crypto_test.c.gcov.html | 2 +- html/lcov/export-net/mptcp/ctrl.c.func-c.html | 12 +- html/lcov/export-net/mptcp/ctrl.c.func.html | 12 +- html/lcov/export-net/mptcp/ctrl.c.gcov.html | 44 +- html/lcov/export-net/mptcp/diag.c.func-c.html | 2 +- html/lcov/export-net/mptcp/diag.c.func.html | 2 +- html/lcov/export-net/mptcp/diag.c.gcov.html | 2 +- .../export-net/mptcp/fastopen.c.func-c.html | 2 +- .../export-net/mptcp/fastopen.c.func.html | 2 +- .../export-net/mptcp/fastopen.c.gcov.html | 2 +- html/lcov/export-net/mptcp/mib.c.func-c.html | 4 +- html/lcov/export-net/mptcp/mib.c.func.html | 4 +- html/lcov/export-net/mptcp/mib.c.gcov.html | 34 +- html/lcov/export-net/mptcp/mib.h.func-c.html | 6 +- html/lcov/export-net/mptcp/mib.h.func.html | 6 +- html/lcov/export-net/mptcp/mib.h.gcov.html | 100 +- .../export-net/mptcp/mptcp_diag.c.func-c.html | 10 +- .../export-net/mptcp/mptcp_diag.c.func.html | 10 +- .../export-net/mptcp/mptcp_diag.c.gcov.html | 158 +- .../export-net/mptcp/options.c.func-c.html | 58 +- .../lcov/export-net/mptcp/options.c.func.html | 58 +- .../lcov/export-net/mptcp/options.c.gcov.html | 1366 ++++---- html/lcov/export-net/mptcp/pm.c.func-c.html | 34 +- html/lcov/export-net/mptcp/pm.c.func.html | 24 +- html/lcov/export-net/mptcp/pm.c.gcov.html | 246 +- .../export-net/mptcp/pm_netlink.c.func-c.html | 60 +- .../export-net/mptcp/pm_netlink.c.func.html | 56 +- .../export-net/mptcp/pm_netlink.c.gcov.html | 534 +-- .../mptcp/pm_userspace.c.func-c.html | 2 +- .../export-net/mptcp/pm_userspace.c.func.html | 2 +- .../export-net/mptcp/pm_userspace.c.gcov.html | 2 +- .../export-net/mptcp/protocol.c.func-c.html | 358 +- .../export-net/mptcp/protocol.c.func.html | 214 +- .../export-net/mptcp/protocol.c.gcov.html | 3042 ++++++++--------- .../export-net/mptcp/protocol.h.func-c.html | 96 +- .../export-net/mptcp/protocol.h.func.html | 72 +- .../export-net/mptcp/protocol.h.gcov.html | 501 +-- .../lcov/export-net/mptcp/sched.c.func-c.html | 10 +- html/lcov/export-net/mptcp/sched.c.func.html | 10 +- html/lcov/export-net/mptcp/sched.c.gcov.html | 74 +- .../export-net/mptcp/sockopt.c.func-c.html | 16 +- .../lcov/export-net/mptcp/sockopt.c.func.html | 16 +- .../lcov/export-net/mptcp/sockopt.c.gcov.html | 234 +- .../export-net/mptcp/subflow.c.func-c.html | 104 +- .../lcov/export-net/mptcp/subflow.c.func.html | 90 +- .../lcov/export-net/mptcp/subflow.c.gcov.html | 1132 +++--- .../export-net/mptcp/syncookies.c.func-c.html | 2 +- .../export-net/mptcp/syncookies.c.func.html | 2 +- .../export-net/mptcp/syncookies.c.gcov.html | 2 +- .../lcov/export-net/mptcp/token.c.func-c.html | 10 +- html/lcov/export-net/mptcp/token.c.func.html | 10 +- html/lcov/export-net/mptcp/token.c.gcov.html | 114 +- .../export-net/mptcp/token_test.c.func-c.html | 2 +- .../export-net/mptcp/token_test.c.func.html | 2 +- .../export-net/mptcp/token_test.c.gcov.html | 2 +- 67 files changed, 4628 insertions(+), 4627 deletions(-) diff --git a/html/lcov/export-net/index-sort-b.html b/html/lcov/export-net/index-sort-b.html index d6fda969..c9b54d55 100644 --- a/html/lcov/export-net/index-sort-b.html +++ b/html/lcov/export-net/index-sort-b.html @@ -33,11 +33,11 @@ Lines: 88.8 % 8196 - 7275 + 7277 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 96.5 % @@ -53,9 +53,9 @@ Branches: - 64.1 % - 6470 - 4148 + 64.6 % + 6472 + 4181 @@ -107,9 +107,9 @@ 84.6 % 13 11 - 41.1 % + 43.9 % 280 - 115 + 123 100.0 % 1 1 @@ -242,9 +242,9 @@ 89.3 % 1314 1173 - 61.5 % + 61.6 % 1032 - 635 + 636 100.0 % 80 80 @@ -279,32 +279,17 @@ 7 5 - - mptcp/protocol.h - -
94.1%94.1%
- - 94.1 % - 236 - 222 - 68.4 % - 526 - 360 - 100.0 % - 35 - 35 - mptcp/protocol.c -
91.1%91.1%
+
91.3%91.3%
- 91.1 % + 91.3 % 2231 - 2032 - 68.9 % + 2036 + 68.5 % 1631 - 1123 + 1118 95.7 % 140 134 @@ -324,6 +309,21 @@ 27 27 + + mptcp/protocol.h + +
94.1%94.1%
+ + 94.1 % + 236 + 222 + 73.3 % + 528 + 387 + 100.0 % + 35 + 35 + mptcp/crypto_test.c @@ -357,14 +357,14 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 - 77.5 % + 859 + 77.8 % 689 - 534 + 536 100.0 % 27 27 diff --git a/html/lcov/export-net/index-sort-f.html b/html/lcov/export-net/index-sort-f.html index 7e493349..369963f4 100644 --- a/html/lcov/export-net/index-sort-f.html +++ b/html/lcov/export-net/index-sort-f.html @@ -33,11 +33,11 @@ Lines: 88.8 % 8196 - 7275 + 7277 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 96.5 % @@ -53,9 +53,9 @@ Branches: - 64.1 % - 6470 - 4148 + 64.6 % + 6472 + 4181 @@ -177,14 +177,14 @@ mptcp/protocol.c -
91.1%91.1%
+
91.3%91.3%
- 91.1 % + 91.3 % 2231 - 2032 - 68.9 % + 2036 + 68.5 % 1631 - 1123 + 1118 95.7 % 140 134 @@ -227,9 +227,9 @@ 84.6 % 13 11 - 41.1 % + 43.9 % 280 - 115 + 123 100.0 % 1 1 @@ -357,14 +357,14 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 - 77.5 % + 859 + 77.8 % 689 - 534 + 536 100.0 % 27 27 @@ -392,9 +392,9 @@ 94.1 % 236 222 - 68.4 % - 526 - 360 + 73.3 % + 528 + 387 100.0 % 35 35 @@ -407,9 +407,9 @@ 89.3 % 1314 1173 - 61.5 % + 61.6 % 1032 - 635 + 636 100.0 % 80 80 diff --git a/html/lcov/export-net/index-sort-l.html b/html/lcov/export-net/index-sort-l.html index 29d6c43d..a3b548c3 100644 --- a/html/lcov/export-net/index-sort-l.html +++ b/html/lcov/export-net/index-sort-l.html @@ -33,11 +33,11 @@ Lines: 88.8 % 8196 - 7275 + 7277 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 96.5 % @@ -53,9 +53,9 @@ Branches: - 64.1 % - 6470 - 4148 + 64.6 % + 6472 + 4181 @@ -167,9 +167,9 @@ 84.6 % 13 11 - 41.1 % + 43.9 % 280 - 115 + 123 100.0 % 1 1 @@ -227,9 +227,9 @@ 89.3 % 1314 1173 - 61.5 % + 61.6 % 1032 - 635 + 636 100.0 % 80 80 @@ -267,14 +267,14 @@ mptcp/protocol.c -
91.1%91.1%
+
91.3%91.3%
- 91.1 % + 91.3 % 2231 - 2032 - 68.9 % + 2036 + 68.5 % 1631 - 1123 + 1118 95.7 % 140 134 @@ -287,9 +287,9 @@ 94.1 % 236 222 - 68.4 % - 526 - 360 + 73.3 % + 528 + 387 100.0 % 35 35 @@ -357,14 +357,14 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 - 77.5 % + 859 + 77.8 % 689 - 534 + 536 100.0 % 27 27 diff --git a/html/lcov/export-net/index.html b/html/lcov/export-net/index.html index 0f3ade07..2532276c 100644 --- a/html/lcov/export-net/index.html +++ b/html/lcov/export-net/index.html @@ -33,11 +33,11 @@ Lines: 88.8 % 8196 - 7275 + 7277 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 96.5 % @@ -53,9 +53,9 @@ Branches: - 64.1 % - 6470 - 4148 + 64.6 % + 6472 + 4181 @@ -212,9 +212,9 @@ 84.6 % 13 11 - 41.1 % + 43.9 % 280 - 115 + 123 100.0 % 1 1 @@ -237,14 +237,14 @@ mptcp/options.c -
98.3%98.3%
+
98.1%98.1%
- 98.3 % + 98.1 % 876 - 861 - 77.5 % + 859 + 77.8 % 689 - 534 + 536 100.0 % 27 27 @@ -272,9 +272,9 @@ 89.3 % 1314 1173 - 61.5 % + 61.6 % 1032 - 635 + 636 100.0 % 80 80 @@ -297,14 +297,14 @@ mptcp/protocol.c -
91.1%91.1%
+
91.3%91.3%
- 91.1 % + 91.3 % 2231 - 2032 - 68.9 % + 2036 + 68.5 % 1631 - 1123 + 1118 95.7 % 140 134 @@ -317,9 +317,9 @@ 94.1 % 236 222 - 68.4 % - 526 - 360 + 73.3 % + 528 + 387 100.0 % 35 35 diff --git a/html/lcov/export-net/mptcp/bpf.c.func-c.html b/html/lcov/export-net/mptcp/bpf.c.func-c.html index 8363eb17..56a2a652 100644 --- a/html/lcov/export-net/mptcp/bpf.c.func-c.html +++ b/html/lcov/export-net/mptcp/bpf.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/bpf.c.func.html b/html/lcov/export-net/mptcp/bpf.c.func.html index 486c539d..ac72d333 100644 --- a/html/lcov/export-net/mptcp/bpf.c.func.html +++ b/html/lcov/export-net/mptcp/bpf.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/bpf.c.gcov.html b/html/lcov/export-net/mptcp/bpf.c.gcov.html index 86af7c04..a6fd0b7c 100644 --- a/html/lcov/export-net/mptcp/bpf.c.gcov.html +++ b/html/lcov/export-net/mptcp/bpf.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/crypto.c.func-c.html b/html/lcov/export-net/mptcp/crypto.c.func-c.html index b41e0406..5e34c3c7 100644 --- a/html/lcov/export-net/mptcp/crypto.c.func-c.html +++ b/html/lcov/export-net/mptcp/crypto.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -81,14 +81,14 @@ mptcp_crypto_hmac_sha - 2552 + 2560 mptcp_crypto_key_sha - 5755 + 5705 diff --git a/html/lcov/export-net/mptcp/crypto.c.func.html b/html/lcov/export-net/mptcp/crypto.c.func.html index efa7adaa..b51488e2 100644 --- a/html/lcov/export-net/mptcp/crypto.c.func.html +++ b/html/lcov/export-net/mptcp/crypto.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -81,14 +81,14 @@ mptcp_crypto_hmac_sha - 2552 + 2560 mptcp_crypto_key_sha - 5755 + 5705 diff --git a/html/lcov/export-net/mptcp/crypto.c.gcov.html b/html/lcov/export-net/mptcp/crypto.c.gcov.html index fc3744bf..1e70e778 100644 --- a/html/lcov/export-net/mptcp/crypto.c.gcov.html +++ b/html/lcov/export-net/mptcp/crypto.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -106,55 +106,55 @@ 28 : : 29 : : #define SHA256_DIGEST_WORDS (SHA256_DIGEST_SIZE / 4) 30 : : - 31 : 5755 : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) + 31 : 5705 : void mptcp_crypto_key_sha(u64 key, u32 *token, u64 *idsn) 32 : : { - 33 : 5755 : __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS]; - 34 : 5755 : __be64 input = cpu_to_be64(key); + 33 : 5705 : __be32 mptcp_hashed_key[SHA256_DIGEST_WORDS]; + 34 : 5705 : __be64 input = cpu_to_be64(key); 35 : : - 36 : 5755 : sha256((__force u8 *)&input, sizeof(input), (u8 *)mptcp_hashed_key); + 36 : 5705 : sha256((__force u8 *)&input, sizeof(input), (u8 *)mptcp_hashed_key); 37 : : - 38 [ + + ]: 5755 : if (token) + 38 [ + + ]: 5705 : if (token) 39 : 2921 : *token = be32_to_cpu(mptcp_hashed_key[0]); - 40 [ + + ]: 5755 : if (idsn) - 41 : 5248 : *idsn = be64_to_cpu(*((__be64 *)&mptcp_hashed_key[6])); - 42 : 5755 : } + 40 [ + + ]: 5705 : if (idsn) + 41 : 5198 : *idsn = be64_to_cpu(*((__be64 *)&mptcp_hashed_key[6])); + 42 : 5705 : } 43 : : - 44 : 2552 : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) + 44 : 2560 : void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u8 *msg, int len, void *hmac) 45 : : { - 46 : 2552 : u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE]; - 47 : 2552 : u8 key1be[8]; - 48 : 2552 : u8 key2be[8]; - 49 : 2552 : int i; + 46 : 2560 : u8 input[SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE]; + 47 : 2560 : u8 key1be[8]; + 48 : 2560 : u8 key2be[8]; + 49 : 2560 : int i; 50 : : - 51 [ - + ]: 2552 : if (WARN_ON_ONCE(len > SHA256_DIGEST_SIZE)) + 51 [ - + ]: 2560 : if (WARN_ON_ONCE(len > SHA256_DIGEST_SIZE)) 52 : 0 : len = SHA256_DIGEST_SIZE; 53 : : - 54 : 2552 : put_unaligned_be64(key1, key1be); - 55 : 2552 : put_unaligned_be64(key2, key2be); + 54 : 2560 : put_unaligned_be64(key1, key1be); + 55 : 2560 : put_unaligned_be64(key2, key2be); 56 : : 57 : : /* Generate key xored with ipad */ - 58 : 2552 : memset(input, 0x36, SHA256_BLOCK_SIZE); - 59 [ + + ]: 22968 : for (i = 0; i < 8; i++) - 60 : 20416 : input[i] ^= key1be[i]; - 61 [ + + ]: 22968 : for (i = 0; i < 8; i++) - 62 : 20416 : input[i + 8] ^= key2be[i]; + 58 : 2560 : memset(input, 0x36, SHA256_BLOCK_SIZE); + 59 [ + + ]: 23040 : for (i = 0; i < 8; i++) + 60 : 20480 : input[i] ^= key1be[i]; + 61 [ + + ]: 23040 : for (i = 0; i < 8; i++) + 62 : 20480 : input[i + 8] ^= key2be[i]; 63 : : - 64 : 2552 : memcpy(&input[SHA256_BLOCK_SIZE], msg, len); + 64 : 2560 : 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 : 2552 : sha256(input, SHA256_BLOCK_SIZE + len, &input[SHA256_BLOCK_SIZE]); + 69 : 2560 : sha256(input, SHA256_BLOCK_SIZE + len, &input[SHA256_BLOCK_SIZE]); 70 : : 71 : : /* Prepare second part of hmac */ - 72 : 2552 : memset(input, 0x5C, SHA256_BLOCK_SIZE); - 73 [ + + ]: 22968 : for (i = 0; i < 8; i++) - 74 : 20416 : input[i] ^= key1be[i]; - 75 [ + + ]: 22968 : for (i = 0; i < 8; i++) - 76 : 20416 : input[i + 8] ^= key2be[i]; + 72 : 2560 : memset(input, 0x5C, SHA256_BLOCK_SIZE); + 73 [ + + ]: 23040 : for (i = 0; i < 8; i++) + 74 : 20480 : input[i] ^= key1be[i]; + 75 [ + + ]: 23040 : for (i = 0; i < 8; i++) + 76 : 20480 : input[i + 8] ^= key2be[i]; 77 : : - 78 : 2552 : sha256(input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE, hmac); - 79 : 2552 : } + 78 : 2560 : sha256(input, SHA256_BLOCK_SIZE + SHA256_DIGEST_SIZE, hmac); + 79 : 2560 : } 80 : : 81 : : #if IS_MODULE(CONFIG_MPTCP_KUNIT_TEST) 82 : : EXPORT_SYMBOL_GPL(mptcp_crypto_hmac_sha); diff --git a/html/lcov/export-net/mptcp/crypto_test.c.func-c.html b/html/lcov/export-net/mptcp/crypto_test.c.func-c.html index b3345b37..e293c70e 100644 --- a/html/lcov/export-net/mptcp/crypto_test.c.func-c.html +++ b/html/lcov/export-net/mptcp/crypto_test.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/crypto_test.c.func.html b/html/lcov/export-net/mptcp/crypto_test.c.func.html index 860b7542..a5d499d6 100644 --- a/html/lcov/export-net/mptcp/crypto_test.c.func.html +++ b/html/lcov/export-net/mptcp/crypto_test.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/crypto_test.c.gcov.html b/html/lcov/export-net/mptcp/crypto_test.c.gcov.html index a1573f37..0f61679a 100644 --- a/html/lcov/export-net/mptcp/crypto_test.c.gcov.html +++ b/html/lcov/export-net/mptcp/crypto_test.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/ctrl.c.func-c.html b/html/lcov/export-net/mptcp/ctrl.c.func-c.html index cf98261b..ca0f541c 100644 --- a/html/lcov/export-net/mptcp/ctrl.c.func-c.html +++ b/html/lcov/export-net/mptcp/ctrl.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.8 % @@ -144,7 +144,7 @@ mptcp_active_detect_blackhole - 820 + 825 @@ -214,7 +214,7 @@ mptcp_close_timeout - 2907 + 3080 @@ -228,21 +228,21 @@ mptcp_allow_join_id0 - 4623 + 4652 mptcp_is_checksum_enabled - 6610 + 6613 mptcp_get_pernet - 12467 + 12408 diff --git a/html/lcov/export-net/mptcp/ctrl.c.func.html b/html/lcov/export-net/mptcp/ctrl.c.func.html index 9340c81a..5a1dcb1e 100644 --- a/html/lcov/export-net/mptcp/ctrl.c.func.html +++ b/html/lcov/export-net/mptcp/ctrl.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.8 % @@ -81,7 +81,7 @@ mptcp_active_detect_blackhole - 820 + 825 @@ -109,14 +109,14 @@ mptcp_allow_join_id0 - 4623 + 4652 mptcp_close_timeout - 2907 + 3080 @@ -130,7 +130,7 @@ mptcp_get_pernet - 12467 + 12408 @@ -158,7 +158,7 @@ mptcp_is_checksum_enabled - 6610 + 6613 diff --git a/html/lcov/export-net/mptcp/ctrl.c.gcov.html b/html/lcov/export-net/mptcp/ctrl.c.gcov.html index 8db3df9c..dffedbc0 100644 --- a/html/lcov/export-net/mptcp/ctrl.c.gcov.html +++ b/html/lcov/export-net/mptcp/ctrl.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.8 % @@ -119,9 +119,9 @@ 41 : : char scheduler[MPTCP_SCHED_NAME_MAX]; 42 : : }; 43 : : - 44 : 12467 : static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) + 44 : 12408 : static struct mptcp_pernet *mptcp_get_pernet(const struct net *net) 45 : : { - 46 : 13179 : return net_generic(net, mptcp_pernet_id); + 46 : 13124 : return net_generic(net, mptcp_pernet_id); 47 : : } 48 : : 49 : 2450 : int mptcp_is_enabled(const struct net *net) @@ -134,14 +134,14 @@ 56 : 392 : return mptcp_get_pernet(net)->add_addr_timeout; 57 : : } 58 : : - 59 : 6610 : int mptcp_is_checksum_enabled(const struct net *net) + 59 : 6613 : int mptcp_is_checksum_enabled(const struct net *net) 60 : : { - 61 : 6610 : return mptcp_get_pernet(net)->checksum_enabled; + 61 : 6613 : return mptcp_get_pernet(net)->checksum_enabled; 62 : : } 63 : : - 64 : 4623 : int mptcp_allow_join_id0(const struct net *net) + 64 : 4652 : int mptcp_allow_join_id0(const struct net *net) 65 : : { - 66 : 4623 : return mptcp_get_pernet(net)->allow_join_initial_addr_port; + 66 : 4652 : return mptcp_get_pernet(net)->allow_join_initial_addr_port; 67 : : } 68 : : 69 : 277 : unsigned int mptcp_stale_loss_cnt(const struct net *net) @@ -149,11 +149,11 @@ 71 : 277 : return mptcp_get_pernet(net)->stale_loss_cnt; 72 : : } 73 : : - 74 : 2907 : unsigned int mptcp_close_timeout(const struct sock *sk) + 74 : 3080 : unsigned int mptcp_close_timeout(const struct sock *sk) 75 : : { - 76 [ + + ]: 2907 : if (sock_flag(sk, SOCK_DEAD)) + 76 [ + + ]: 3080 : if (sock_flag(sk, SOCK_DEAD)) 77 : : return TCP_TIMEWAIT_LEN; - 78 : 398 : return mptcp_get_pernet(sock_net(sk))->close_timeout; + 78 : 406 : return mptcp_get_pernet(sock_net(sk))->close_timeout; 79 : : } 80 : : 81 : 3628 : int mptcp_get_pm_type(const struct net *net) @@ -477,29 +477,29 @@ 398 : 1082 : } 399 : : 400 : : /* Check the number of retransmissions, and fallback to TCP if needed */ - 401 : 820 : void mptcp_active_detect_blackhole(struct sock *ssk, bool expired) + 401 : 825 : void mptcp_active_detect_blackhole(struct sock *ssk, bool expired) 402 : : { - 403 : 820 : struct mptcp_subflow_context *subflow; + 403 : 825 : struct mptcp_subflow_context *subflow; 404 : : - 405 [ + + + - ]: 820 : if (!sk_is_mptcp(ssk)) + 405 [ + + + - ]: 825 : if (!sk_is_mptcp(ssk)) 406 : : return; 407 : : - 408 [ + + ]: 820 : subflow = mptcp_subflow_ctx(ssk); + 408 [ + + ]: 825 : subflow = mptcp_subflow_ctx(ssk); 409 : : - 410 [ + + + + ]: 820 : if (subflow->request_mptcp && ssk->sk_state == TCP_SYN_SENT) { - 411 : 36 : struct net *net = sock_net(ssk); - 412 : 36 : u8 timeouts, to_max; + 410 [ + + + + ]: 825 : if (subflow->request_mptcp && ssk->sk_state == TCP_SYN_SENT) { + 411 : 37 : struct net *net = sock_net(ssk); + 412 : 37 : u8 timeouts, to_max; 413 : : - 414 : 36 : timeouts = inet_csk(ssk)->icsk_retransmits; - 415 : 36 : to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback; + 414 : 37 : timeouts = inet_csk(ssk)->icsk_retransmits; + 415 : 37 : to_max = mptcp_get_pernet(net)->syn_retrans_before_tcp_fallback; 416 : : - 417 [ + + + + ]: 36 : if (timeouts == to_max || (timeouts < to_max && expired)) { + 417 [ + + + + ]: 37 : if (timeouts == to_max || (timeouts < to_max && expired)) { 418 [ + - ]: 18 : MPTCP_INC_STATS(net, MPTCP_MIB_MPCAPABLEACTIVEDROP); 419 : 18 : subflow->mpc_drop = 1; 420 [ - + ]: 18 : mptcp_subflow_early_fallback(mptcp_sk(subflow->conn), subflow); 421 : : } - 422 [ + + ]: 784 : } else if (ssk->sk_state == TCP_SYN_SENT) { - 423 : 46 : subflow->mpc_drop = 0; + 422 [ + + ]: 788 : } else if (ssk->sk_state == TCP_SYN_SENT) { + 423 : 42 : subflow->mpc_drop = 0; 424 : : } 425 : : } 426 : : diff --git a/html/lcov/export-net/mptcp/diag.c.func-c.html b/html/lcov/export-net/mptcp/diag.c.func-c.html index eec8ccc6..1007bdf4 100644 --- a/html/lcov/export-net/mptcp/diag.c.func-c.html +++ b/html/lcov/export-net/mptcp/diag.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 66.7 % diff --git a/html/lcov/export-net/mptcp/diag.c.func.html b/html/lcov/export-net/mptcp/diag.c.func.html index 6c521523..3e8c37eb 100644 --- a/html/lcov/export-net/mptcp/diag.c.func.html +++ b/html/lcov/export-net/mptcp/diag.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 66.7 % diff --git a/html/lcov/export-net/mptcp/diag.c.gcov.html b/html/lcov/export-net/mptcp/diag.c.gcov.html index 22b527b7..85fd8d2f 100644 --- a/html/lcov/export-net/mptcp/diag.c.gcov.html +++ b/html/lcov/export-net/mptcp/diag.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 66.7 % diff --git a/html/lcov/export-net/mptcp/fastopen.c.func-c.html b/html/lcov/export-net/mptcp/fastopen.c.func-c.html index 33ab3658..ea253a54 100644 --- a/html/lcov/export-net/mptcp/fastopen.c.func-c.html +++ b/html/lcov/export-net/mptcp/fastopen.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/fastopen.c.func.html b/html/lcov/export-net/mptcp/fastopen.c.func.html index c2b760ff..4a66338f 100644 --- a/html/lcov/export-net/mptcp/fastopen.c.func.html +++ b/html/lcov/export-net/mptcp/fastopen.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/fastopen.c.gcov.html b/html/lcov/export-net/mptcp/fastopen.c.gcov.html index a68f6398..a2048cd4 100644 --- a/html/lcov/export-net/mptcp/fastopen.c.gcov.html +++ b/html/lcov/export-net/mptcp/fastopen.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/mib.c.func-c.html b/html/lcov/export-net/mptcp/mib.c.func-c.html index 6860f944..0bdfde6f 100644 --- a/html/lcov/export-net/mptcp/mib.c.func-c.html +++ b/html/lcov/export-net/mptcp/mib.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -88,7 +88,7 @@ mptcp_seq_show - 8608 + 8604 diff --git a/html/lcov/export-net/mptcp/mib.c.func.html b/html/lcov/export-net/mptcp/mib.c.func.html index f71b8bb9..32619380 100644 --- a/html/lcov/export-net/mptcp/mib.c.func.html +++ b/html/lcov/export-net/mptcp/mib.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -88,7 +88,7 @@ mptcp_seq_show - 8608 + 8604 diff --git a/html/lcov/export-net/mptcp/mib.c.gcov.html b/html/lcov/export-net/mptcp/mib.c.gcov.html index f023bcdd..23f46ab2 100644 --- a/html/lcov/export-net/mptcp/mib.c.gcov.html +++ b/html/lcov/export-net/mptcp/mib.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -178,29 +178,29 @@ 100 : : return true; 101 : : } 102 : : - 103 : 8608 : void mptcp_seq_show(struct seq_file *seq) + 103 : 8604 : void mptcp_seq_show(struct seq_file *seq) 104 : : { - 105 : 8608 : unsigned long sum[ARRAY_SIZE(mptcp_snmp_list) - 1]; - 106 : 8608 : struct net *net = seq->private; - 107 : 8608 : int i; + 105 : 8604 : unsigned long sum[ARRAY_SIZE(mptcp_snmp_list) - 1]; + 106 : 8604 : struct net *net = seq->private; + 107 : 8604 : int i; 108 : : - 109 : 8608 : seq_puts(seq, "MPTcpExt:"); - 110 [ + + ]: 619776 : for (i = 0; mptcp_snmp_list[i].name; i++) - 111 : 602560 : seq_printf(seq, " %s", mptcp_snmp_list[i].name); + 109 : 8604 : seq_puts(seq, "MPTcpExt:"); + 110 [ + + ]: 619488 : for (i = 0; mptcp_snmp_list[i].name; i++) + 111 : 602280 : seq_printf(seq, " %s", mptcp_snmp_list[i].name); 112 : : - 113 : 8608 : seq_puts(seq, "\nMPTcpExt:"); + 113 : 8604 : seq_puts(seq, "\nMPTcpExt:"); 114 : : - 115 : 8608 : memset(sum, 0, sizeof(sum)); - 116 [ + + ]: 8608 : if (net->mib.mptcp_statistics) - 117 [ + + + - : 2268315 : snmp_get_cpu_field_batch(sum, mptcp_snmp_list, - + - ] + 115 : 8604 : memset(sum, 0, sizeof(sum)); + 116 [ + + ]: 8604 : if (net->mib.mptcp_statistics) + 117 [ + + + - : 2267460 : snmp_get_cpu_field_batch(sum, mptcp_snmp_list, + + - ] 118 : : net->mib.mptcp_statistics); 119 : : - 120 [ + + ]: 611168 : for (i = 0; mptcp_snmp_list[i].name; i++) - 121 : 602560 : seq_printf(seq, " %lu", sum[i]); + 120 [ + + ]: 610884 : for (i = 0; mptcp_snmp_list[i].name; i++) + 121 : 602280 : seq_printf(seq, " %lu", sum[i]); 122 : : - 123 : 8608 : seq_putc(seq, '\n'); - 124 : 8608 : } + 123 : 8604 : seq_putc(seq, '\n'); + 124 : 8604 : } diff --git a/html/lcov/export-net/mptcp/mib.h.func-c.html b/html/lcov/export-net/mptcp/mib.h.func-c.html index c9ef33cf..83bf92bc 100644 --- a/html/lcov/export-net/mptcp/mib.h.func-c.html +++ b/html/lcov/export-net/mptcp/mib.h.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 41.1 % + 43.9 % 280 - 115 + 123 diff --git a/html/lcov/export-net/mptcp/mib.h.func.html b/html/lcov/export-net/mptcp/mib.h.func.html index 11803191..13dca03f 100644 --- a/html/lcov/export-net/mptcp/mib.h.func.html +++ b/html/lcov/export-net/mptcp/mib.h.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 41.1 % + 43.9 % 280 - 115 + 123 diff --git a/html/lcov/export-net/mptcp/mib.h.gcov.html b/html/lcov/export-net/mptcp/mib.h.gcov.html index cacaaeb5..b0276fad 100644 --- a/html/lcov/export-net/mptcp/mib.h.gcov.html +++ b/html/lcov/export-net/mptcp/mib.h.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 41.1 % + 43.9 % 280 - 115 + 123 @@ -178,68 +178,68 @@ 99 : 0 : static inline void MPTCP_INC_STATS(struct net *net, 100 : : enum linux_mptcp_mib_field field) 101 : : { - 102 [ + - # # ]: 266224 : if (likely(net->mib.mptcp_statistics)) + 102 [ + - # # ]: 319832 : if (likely(net->mib.mptcp_statistics)) [ + - + - - + - + - + + + - + - + - + - - - - - + - - + - - + - - + - + - + + + - + - + - + - - - - + - + - + - - + - + - + + - + - + + - + - + - + - - - - - - - + - + - + - ] - [ + - + - - + - + - + - - + - + - - + - + - + - + + - + - - + - + - + - - + - + - - + - + - + - - + - + - - + - - - - - - - - + - - + - + - ] - [ + - + - - - - + - + - - + - - - - + - + - + - - - - - - - + - - - - - - + - + - - + - + - + - - + - + - - + - - - - + [ + - + - + - + + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - - - - - - - - - - - - - ] - [ + - + - - - + + - + - - + - + - - + - + - + - - + - + - - + - + - + - - + - - - - - - - - - - - - - - - - - - ] - 103 [ - + - + : 216440 : SNMP_INC_STATS(net->mib.mptcp_statistics, field); - - + - + + - + - + + - + ][ - + - - + + + - + - + + + + + - + ][ - + + - + + - ] + [ + - + - + + - + - + + - + - - - + - - + - - + + - - + - + + - + - + + - + - - - + + - + - + + - + - + - + + - - - - + - - - + - + + - + - ] + [ + - + - + - + + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - + - + + - + - + - + + - ] + 103 [ - + - + : 227950 : 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 [ - - + - : 214 : 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-net/mptcp/mptcp_diag.c.func-c.html b/html/lcov/export-net/mptcp/mptcp_diag.c.func-c.html index 7f0c0898..af2d6b3d 100644 --- a/html/lcov/export-net/mptcp/mptcp_diag.c.func-c.html +++ b/html/lcov/export-net/mptcp/mptcp_diag.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 71.4 % @@ -102,28 +102,28 @@ mptcp_diag_dump_listeners - 70 + 71 mptcp_diag_dump - 833 + 830 mptcp_diag_get_info - 1264 + 1243 sk_diag_dump - 1296 + 1274 diff --git a/html/lcov/export-net/mptcp/mptcp_diag.c.func.html b/html/lcov/export-net/mptcp/mptcp_diag.c.func.html index f001dfd9..5ccdf8df 100644 --- a/html/lcov/export-net/mptcp/mptcp_diag.c.func.html +++ b/html/lcov/export-net/mptcp/mptcp_diag.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 71.4 % @@ -81,14 +81,14 @@ mptcp_diag_dump - 833 + 830 mptcp_diag_dump_listeners - 70 + 71 @@ -109,7 +109,7 @@ mptcp_diag_get_info - 1264 + 1243 @@ -123,7 +123,7 @@ sk_diag_dump - 1296 + 1274 diff --git a/html/lcov/export-net/mptcp/mptcp_diag.c.gcov.html b/html/lcov/export-net/mptcp/mptcp_diag.c.gcov.html index 6fbf26b0..6b55eda4 100644 --- a/html/lcov/export-net/mptcp/mptcp_diag.c.gcov.html +++ b/html/lcov/export-net/mptcp/mptcp_diag.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 71.4 % @@ -90,15 +90,15 @@ 12 : : #include <net/netlink.h> 13 : : #include "protocol.h" 14 : : - 15 : 1296 : static int sk_diag_dump(struct sock *sk, struct sk_buff *skb, + 15 : 1274 : 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 [ + + ]: 1296 : if (!inet_diag_bc_sk(bc, sk)) + 20 [ + + ]: 1274 : if (!inet_diag_bc_sk(bc, sk)) 21 : : return 0; 22 : : - 23 : 1282 : return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, req, NLM_F_MULTI, + 23 : 1260 : return inet_sk_diag_fill(sk, inet_csk(sk), skb, cb, req, NLM_F_MULTI, 24 : : net_admin); 25 : : } 26 : : @@ -150,20 +150,20 @@ 72 : : unsigned int l_num; 73 : : }; 74 : : - 75 : 70 : static void mptcp_diag_dump_listeners(struct sk_buff *skb, struct netlink_callback *cb, + 75 : 71 : 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 : 70 : struct inet_diag_dump_data *cb_data = cb->data; - 80 : 70 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; - 81 : 70 : struct nlattr *bc = cb_data->inet_diag_nla_bc; - 82 : 70 : struct net *net = sock_net(skb->sk); - 83 : 70 : struct inet_hashinfo *hinfo; - 84 : 70 : int i; + 79 : 71 : struct inet_diag_dump_data *cb_data = cb->data; + 80 : 71 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + 81 : 71 : struct nlattr *bc = cb_data->inet_diag_nla_bc; + 82 : 71 : struct net *net = sock_net(skb->sk); + 83 : 71 : struct inet_hashinfo *hinfo; + 84 : 71 : int i; 85 : : - 86 : 70 : hinfo = net->ipv4.tcp_death_row.hashinfo; + 86 : 71 : hinfo = net->ipv4.tcp_death_row.hashinfo; 87 : : - 88 [ + + ]: 110662 : for (i = diag_ctx->l_slot; i <= hinfo->lhash2_mask; i++) { + 88 [ + + ]: 110663 : for (i = diag_ctx->l_slot; i <= hinfo->lhash2_mask; i++) { 89 : 110598 : struct inet_listen_hashbucket *ilb; 90 : 110598 : struct hlist_nulls_node *node; 91 : 110598 : struct sock *sk; @@ -173,47 +173,47 @@ 95 : : 96 : 110598 : rcu_read_lock(); 97 : 110598 : spin_lock(&ilb->lock); - 98 [ + + ]: 111216 : sk_nulls_for_each(sk, node, &ilb->nulls_head) { - 99 [ - + ]: 624 : const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); - 100 : 624 : struct inet_sock *inet = inet_sk(sk); - 101 : 624 : int ret; + 98 [ + + ]: 111246 : sk_nulls_for_each(sk, node, &ilb->nulls_head) { + 99 [ - + ]: 654 : const struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk); + 100 : 654 : struct inet_sock *inet = inet_sk(sk); + 101 : 654 : int ret; 102 : : - 103 [ - + ]: 624 : if (num < diag_ctx->l_num) + 103 [ - + ]: 654 : if (num < diag_ctx->l_num) 104 : 0 : goto next_listen; 105 : : - 106 [ + - - + ]: 624 : if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) + 106 [ + - - + ]: 654 : if (!ctx || strcmp(inet_csk(sk)->icsk_ulp_ops->name, "mptcp")) 107 : 0 : goto next_listen; 108 : : - 109 : 624 : sk = ctx->conn; - 110 [ + - + + ]: 950 : if (!sk || !net_eq(sock_net(sk), net)) + 109 : 654 : sk = ctx->conn; + 110 [ + - + + ]: 992 : if (!sk || !net_eq(sock_net(sk), net)) 111 : 36 : goto next_listen; 112 : : - 113 [ + - ]: 588 : if (r->sdiag_family != AF_UNSPEC && - 114 [ + + ]: 588 : sk->sk_family != r->sdiag_family) - 115 : 290 : goto next_listen; + 113 [ + - ]: 618 : if (r->sdiag_family != AF_UNSPEC && + 114 [ + + ]: 618 : sk->sk_family != r->sdiag_family) + 115 : 305 : goto next_listen; 116 : : - 117 [ + - - + ]: 298 : if (r->id.idiag_sport != inet->inet_sport && + 117 [ + - - + ]: 313 : if (r->id.idiag_sport != inet->inet_sport && 118 : : r->id.idiag_sport) 119 : 0 : goto next_listen; 120 : : - 121 [ - + ]: 298 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 121 [ - + ]: 313 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 122 : 0 : goto next_listen; 123 : : - 124 : 298 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + 124 : 313 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); 125 : : - 126 : 298 : sock_put(sk); + 126 : 313 : sock_put(sk); 127 : : - 128 [ + + ]: 298 : if (ret < 0) { + 128 [ + + ]: 313 : 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 : 292 : diag_ctx->l_num = num + 1; - 136 : 292 : num = 0; - 137 : 618 : next_listen: - 138 : 618 : ++num; + 135 : 307 : diag_ctx->l_num = num + 1; + 136 : 307 : num = 0; + 137 : 648 : next_listen: + 138 : 648 : ++num; 139 : : } 140 : 110592 : spin_unlock(&ilb->lock); 141 : 110592 : rcu_read_unlock(); @@ -222,83 +222,83 @@ 144 : 110592 : diag_ctx->l_num = 0; 145 : : } 146 : : - 147 : 64 : diag_ctx->l_num = 0; - 148 : 64 : diag_ctx->l_slot = i; + 147 : 65 : diag_ctx->l_num = 0; + 148 : 65 : diag_ctx->l_slot = i; 149 : : } 150 : : - 151 : 833 : static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, + 151 : 830 : static void mptcp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, 152 : : const struct inet_diag_req_v2 *r) 153 : : { - 154 : 833 : bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); - 155 : 833 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; - 156 : 833 : struct net *net = sock_net(skb->sk); - 157 : 833 : struct inet_diag_dump_data *cb_data; - 158 : 833 : struct mptcp_sock *msk; - 159 : 833 : struct nlattr *bc; + 154 : 830 : bool net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN); + 155 : 830 : struct mptcp_diag_ctx *diag_ctx = (void *)cb->ctx; + 156 : 830 : struct net *net = sock_net(skb->sk); + 157 : 830 : struct inet_diag_dump_data *cb_data; + 158 : 830 : struct mptcp_sock *msk; + 159 : 830 : struct nlattr *bc; 160 : : - 161 : 833 : BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); + 161 : 830 : BUILD_BUG_ON(sizeof(cb->ctx) < sizeof(*diag_ctx)); 162 : : - 163 : 833 : cb_data = cb->data; - 164 : 833 : bc = cb_data->inet_diag_nla_bc; + 163 : 830 : cb_data = cb->data; + 164 : 830 : bc = cb_data->inet_diag_nla_bc; 165 : : - 166 : 833 : while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, - 167 [ + + ]: 3681 : &diag_ctx->s_num)) != NULL) { - 168 : 2860 : struct inet_sock *inet = (struct inet_sock *)msk; - 169 : 2860 : struct sock *sk = (struct sock *)msk; - 170 : 2860 : int ret = 0; + 166 : 830 : while ((msk = mptcp_token_iter_next(net, &diag_ctx->s_slot, + 167 [ + + ]: 3610 : &diag_ctx->s_num)) != NULL) { + 168 : 2791 : struct inet_sock *inet = (struct inet_sock *)msk; + 169 : 2791 : struct sock *sk = (struct sock *)msk; + 170 : 2791 : int ret = 0; 171 : : - 172 [ + + + + ]: 2860 : if (!(r->idiag_states & (1 << sk->sk_state))) - 173 : 876 : goto next; - 174 [ + - ]: 1984 : if (r->sdiag_family != AF_UNSPEC && - 175 [ + + ]: 1984 : sk->sk_family != r->sdiag_family) - 176 : 986 : goto next; - 177 [ + - - + ]: 998 : if (r->id.idiag_sport != inet->inet_sport && + 172 [ + + + + ]: 2791 : if (!(r->idiag_states & (1 << sk->sk_state))) + 173 : 878 : goto next; + 174 [ + - ]: 1913 : if (r->sdiag_family != AF_UNSPEC && + 175 [ + + ]: 1913 : sk->sk_family != r->sdiag_family) + 176 : 952 : goto next; + 177 [ + - - + ]: 961 : if (r->id.idiag_sport != inet->inet_sport && 178 : : r->id.idiag_sport) 179 : 0 : goto next; - 180 [ + - - + ]: 998 : if (r->id.idiag_dport != inet->inet_dport && + 180 [ + - - + ]: 961 : if (r->id.idiag_dport != inet->inet_dport && 181 : : r->id.idiag_dport) 182 : 0 : goto next; 183 : : - 184 : 998 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); - 185 : 2860 : next: - 186 : 2860 : sock_put(sk); - 187 [ + + ]: 2860 : if (ret < 0) { + 184 : 961 : ret = sk_diag_dump(sk, skb, cb, r, bc, net_admin); + 185 : 2791 : next: + 186 : 2791 : sock_put(sk); + 187 [ + + ]: 2791 : if (ret < 0) { 188 : : /* will retry on the same position */ - 189 : 12 : diag_ctx->s_num--; - 190 : 12 : break; + 189 : 11 : diag_ctx->s_num--; + 190 : 11 : break; 191 : : } - 192 : 2848 : cond_resched(); + 192 : 2780 : cond_resched(); 193 : : } 194 : : - 195 [ + + + - ]: 833 : if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) - 196 : 70 : mptcp_diag_dump_listeners(skb, cb, r, net_admin); - 197 : 833 : } + 195 [ + + + - ]: 830 : if ((r->idiag_states & TCPF_LISTEN) && r->id.idiag_dport == 0) + 196 : 71 : mptcp_diag_dump_listeners(skb, cb, r, net_admin); + 197 : 830 : } 198 : : - 199 : 1264 : static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, + 199 : 1243 : static void mptcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, 200 : : void *_info) 201 : : { - 202 [ - + ]: 1264 : struct mptcp_sock *msk = mptcp_sk(sk); - 203 : 1264 : struct mptcp_info *info = _info; + 202 [ - + ]: 1243 : struct mptcp_sock *msk = mptcp_sk(sk); + 203 : 1243 : struct mptcp_info *info = _info; 204 : : - 205 : 1264 : r->idiag_rqueue = sk_rmem_alloc_get(sk); - 206 : 1264 : r->idiag_wqueue = sk_wmem_alloc_get(sk); + 205 : 1243 : r->idiag_rqueue = sk_rmem_alloc_get(sk); + 206 : 1243 : r->idiag_wqueue = sk_wmem_alloc_get(sk); 207 : : - 208 [ + + ]: 1264 : if (inet_sk_state_load(sk) == TCP_LISTEN) { - 209 : 290 : struct sock *lsk = READ_ONCE(msk->first); + 208 [ + + ]: 1243 : if (inet_sk_state_load(sk) == TCP_LISTEN) { + 209 : 305 : struct sock *lsk = READ_ONCE(msk->first); 210 : : - 211 [ + - ]: 290 : if (lsk) { + 211 [ + - ]: 305 : if (lsk) { 212 : : /* override with settings from tcp listener, 213 : : * so Send-Q will show accept queue. 214 : : */ - 215 : 290 : r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); - 216 : 290 : r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); + 215 : 305 : r->idiag_rqueue = READ_ONCE(lsk->sk_ack_backlog); + 216 : 305 : r->idiag_wqueue = READ_ONCE(lsk->sk_max_ack_backlog); 217 : : } 218 : : } 219 : : - 220 [ + + ]: 1264 : if (!info) + 220 [ + + ]: 1243 : if (!info) 221 : : return; 222 : : - 223 : 972 : mptcp_diag_fill_info(msk, info); + 223 : 938 : mptcp_diag_fill_info(msk, info); 224 : : } 225 : : 226 : : static const struct inet_diag_handler mptcp_diag_handler = { diff --git a/html/lcov/export-net/mptcp/options.c.func-c.html b/html/lcov/export-net/mptcp/options.c.func-c.html index d933ecd7..4ba2f75b 100644 --- a/html/lcov/export-net/mptcp/options.c.func-c.html +++ b/html/lcov/export-net/mptcp/options.c.func-c.html @@ -31,13 +31,13 @@ export-net Lines: - 98.3 % + 98.1 % 876 - 861 + 859 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 77.5 % + 77.8 % 689 - 534 + 536 @@ -88,21 +88,21 @@ mptcp_established_options_fastclose - 435 + 424 mptcp_established_options_rst - 435 + 424 add_addr_hmac_valid - 690 + 692 @@ -116,7 +116,7 @@ clear_3rdack_retransmission - 874 + 878 @@ -130,140 +130,140 @@ mptcp_syn_options - 1791 + 1788 mptcp_make_csum - 1877 + 1870 __mptcp_make_csum - 2008 + 2006 mptcp_update_rcv_data_fin - 6594 + 8890 mptcp_write_data_fin - 20177 + 27624 __mptcp_expand_seq - 154009 + 28275 mptcp_set_rwin - 597858 + 740674 mptcp_write_options - 599907 + 742712 ack_update_msk - 836085 + 823170 check_fully_established - 839447 + 826468 mptcp_get_options - 844383 + 831410 mptcp_parse_option - 844445 + 831469 mptcp_incoming_options - 849947 + 836808 mptcp_established_options_dss - 1294689 + 1678559 mptcp_established_options_mp_fail - 1294743 + 1678616 mptcp_established_options_rm_addr - 1296020 + 1679914 mptcp_established_options_add_addr - 1296774 + 1680670 mptcp_established_options_mp_prio - 1296774 + 1680670 mptcp_established_options_mp - 1296778 + 1680674 mptcp_established_options - 1336543 + 1734112 diff --git a/html/lcov/export-net/mptcp/options.c.func.html b/html/lcov/export-net/mptcp/options.c.func.html index 6e711455..5de4c61c 100644 --- a/html/lcov/export-net/mptcp/options.c.func.html +++ b/html/lcov/export-net/mptcp/options.c.func.html @@ -31,13 +31,13 @@ export-net Lines: - 98.3 % + 98.1 % 876 - 861 + 859 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 77.5 % + 77.8 % 689 - 534 + 536 @@ -81,21 +81,21 @@ __mptcp_expand_seq - 154009 + 28275 __mptcp_make_csum - 2008 + 2006 ack_update_msk - 836085 + 823170 @@ -109,91 +109,91 @@ add_addr_hmac_valid - 690 + 692 check_fully_established - 839447 + 826468 clear_3rdack_retransmission - 874 + 878 mptcp_established_options - 1336543 + 1734112 mptcp_established_options_add_addr - 1296774 + 1680670 mptcp_established_options_dss - 1294689 + 1678559 mptcp_established_options_fastclose - 435 + 424 mptcp_established_options_mp - 1296778 + 1680674 mptcp_established_options_mp_fail - 1294743 + 1678616 mptcp_established_options_mp_prio - 1296774 + 1680670 mptcp_established_options_rm_addr - 1296020 + 1679914 mptcp_established_options_rst - 435 + 424 mptcp_get_options - 844383 + 831410 @@ -207,35 +207,35 @@ mptcp_incoming_options - 849947 + 836808 mptcp_make_csum - 1877 + 1870 mptcp_parse_option - 844445 + 831469 mptcp_set_rwin - 597858 + 740674 mptcp_syn_options - 1791 + 1788 @@ -249,21 +249,21 @@ mptcp_update_rcv_data_fin - 6594 + 8890 mptcp_write_data_fin - 20177 + 27624 mptcp_write_options - 599907 + 742712 diff --git a/html/lcov/export-net/mptcp/options.c.gcov.html b/html/lcov/export-net/mptcp/options.c.gcov.html index 7c7ca96d..6874be14 100644 --- a/html/lcov/export-net/mptcp/options.c.gcov.html +++ b/html/lcov/export-net/mptcp/options.c.gcov.html @@ -31,13 +31,13 @@ export-net Lines: - 98.3 % + 98.1 % 876 - 861 + 859 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 77.5 % + 77.8 % 689 - 534 + 536 @@ -98,27 +98,27 @@ 20 : : return (flags & MPTCP_CAP_FLAG_MASK) == MPTCP_CAP_HMAC_SHA256; 21 : : } 22 : : - 23 : 844445 : static void mptcp_parse_option(const struct sk_buff *skb, + 23 : 831469 : 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 : 844445 : u8 subtype = *ptr >> 4; - 28 : 844445 : int expected_opsize; - 29 : 844445 : u16 subopt; - 30 : 844445 : u8 version; - 31 : 844445 : u8 flags; - 32 : 844445 : u8 i; + 27 : 831469 : u8 subtype = *ptr >> 4; + 28 : 831469 : int expected_opsize; + 29 : 831469 : u16 subopt; + 30 : 831469 : u8 version; + 31 : 831469 : u8 flags; + 32 : 831469 : u8 i; 33 : : - 34 [ + + + + : 844445 : switch (subtype) { - + + + + + + 34 [ + + + + : 831469 : switch (subtype) { + + + + + + - ] - 35 : 5175 : case MPTCPOPT_MP_CAPABLE: + 35 : 5127 : case MPTCPOPT_MP_CAPABLE: 36 : : /* strict size checking */ - 37 [ + + ]: 5175 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) { - 38 [ + + ]: 2873 : if (skb->len > tcp_hdr(skb)->doff << 2) + 37 [ + + ]: 5127 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN)) { + 38 [ + + ]: 2825 : if (skb->len > tcp_hdr(skb)->doff << 2) 39 : : expected_opsize = TCPOLEN_MPTCP_MPC_ACK_DATA; 40 : : else - 41 : 2222 : expected_opsize = TCPOLEN_MPTCP_MPC_ACK; + 41 : 2225 : expected_opsize = TCPOLEN_MPTCP_MPC_ACK; 42 : : subopt = OPTION_MPTCP_MPC_ACK; 43 : : } else { 44 [ + + ]: 2302 : if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_ACK) { @@ -140,22 +140,22 @@ 60 : : * We parse even option with mismatching csum presence, so that 61 : : * later in subflow_data_ready we can trigger the reset. 62 : : */ - 63 [ + + ]: 5175 : if (opsize != expected_opsize && + 63 [ + + ]: 5127 : if (opsize != expected_opsize && 64 : 17 : (expected_opsize != TCPOLEN_MPTCP_MPC_ACK_DATA || 65 [ + + ]: 17 : opsize != TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM)) 66 : : break; 67 : : 68 : : /* try to be gentle vs future versions on the initial syn */ - 69 : 5163 : version = *ptr++ & MPTCP_VERSION_MASK; - 70 [ + + ]: 5163 : if (opsize != TCPOLEN_MPTCP_MPC_SYN) { - 71 [ + + ]: 3967 : if (version != MPTCP_SUPPORTED_VERSION) + 69 : 5115 : version = *ptr++ & MPTCP_VERSION_MASK; + 70 [ + + ]: 5115 : if (opsize != TCPOLEN_MPTCP_MPC_SYN) { + 71 [ + + ]: 3919 : if (version != MPTCP_SUPPORTED_VERSION) 72 : : break; 73 [ + - ]: 1196 : } else if (version < MPTCP_SUPPORTED_VERSION) { 74 : : break; 75 : : } 76 : : - 77 : 5157 : flags = *ptr++; - 78 [ + + + + ]: 5157 : if (!mptcp_cap_flag_sha256(flags) || + 77 : 5109 : flags = *ptr++; + 78 [ + + + + ]: 5109 : 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 [ + + ]: 5121 : if (flags & MPTCP_CAP_CHECKSUM_REQD) + 88 [ + + ]: 5073 : if (flags & MPTCP_CAP_CHECKSUM_REQD) 89 : 41 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; 90 : : - 91 : 5121 : mp_opt->deny_join_id0 = !!(flags & MPTCP_CAP_DENY_JOIN_ID0); + 91 : 5073 : mp_opt->deny_join_id0 = !!(flags & MPTCP_CAP_DENY_JOIN_ID0); 92 : : - 93 : 5121 : mp_opt->suboptions |= subopt; - 94 [ + + ]: 5121 : if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) { - 95 [ + + ]: 3937 : mp_opt->sndr_key = get_unaligned_be64(ptr); - 96 : 3937 : ptr += 8; + 93 : 5073 : mp_opt->suboptions |= subopt; + 94 [ + + ]: 5073 : if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) { + 95 [ + + ]: 3889 : mp_opt->sndr_key = get_unaligned_be64(ptr); + 96 : 3889 : ptr += 8; 97 : : } - 98 [ + + ]: 3937 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK) { - 99 : 2855 : mp_opt->rcvr_key = get_unaligned_be64(ptr); - 100 : 2855 : ptr += 8; + 98 [ + + ]: 3889 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK) { + 99 : 2807 : mp_opt->rcvr_key = get_unaligned_be64(ptr); + 100 : 2807 : ptr += 8; 101 : : } - 102 [ + + ]: 4039 : if (opsize >= TCPOLEN_MPTCP_MPC_ACK_DATA) { + 102 [ + + ]: 3991 : 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 : 651 : mp_opt->suboptions |= OPTION_MPTCP_DSS; - 109 : 651 : mp_opt->use_map = 1; - 110 : 651 : mp_opt->mpc_map = 1; - 111 [ + + ]: 651 : mp_opt->data_len = get_unaligned_be16(ptr); - 112 : 651 : ptr += 2; + 108 : 600 : mp_opt->suboptions |= OPTION_MPTCP_DSS; + 109 : 600 : mp_opt->use_map = 1; + 110 : 600 : mp_opt->mpc_map = 1; + 111 [ + + ]: 600 : mp_opt->data_len = get_unaligned_be16(ptr); + 112 : 600 : ptr += 2; 113 : : } - 114 [ + + ]: 651 : if (opsize == TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM) { + 114 [ + + ]: 600 : if (opsize == TCPOLEN_MPTCP_MPC_ACK_DATA_CSUM) { 115 : 5 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); 116 : 5 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; 117 : 5 : ptr += 2; 118 : : } - 119 [ - + ]: 5121 : pr_debug("MP_CAPABLE version=%x, flags=%x, optlen=%d sndr=%llu, rcvr=%llu len=%d csum=%u\n", + 119 [ - + ]: 5073 : 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 : 1830 : case MPTCPOPT_MP_JOIN: - 125 [ + + ]: 1830 : if (opsize == TCPOLEN_MPTCP_MPJ_SYN) { - 126 : 466 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYN; - 127 : 466 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; - 128 : 466 : mp_opt->join_id = *ptr++; - 129 [ - + ]: 466 : mp_opt->token = get_unaligned_be32(ptr); - 130 : 466 : ptr += 4; - 131 : 466 : mp_opt->nonce = get_unaligned_be32(ptr); - 132 : 466 : ptr += 4; - 133 [ - + ]: 466 : pr_debug("MP_JOIN bkup=%u, id=%u, token=%u, nonce=%u\n", + 124 : 1836 : case MPTCPOPT_MP_JOIN: + 125 [ + + ]: 1836 : if (opsize == TCPOLEN_MPTCP_MPJ_SYN) { + 126 : 468 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYN; + 127 : 468 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; + 128 : 468 : mp_opt->join_id = *ptr++; + 129 [ - + ]: 468 : mp_opt->token = get_unaligned_be32(ptr); + 130 : 468 : ptr += 4; + 131 : 468 : mp_opt->nonce = get_unaligned_be32(ptr); + 132 : 468 : ptr += 4; + 133 [ - + ]: 468 : 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 [ + + ]: 1364 : } else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) { - 137 : 432 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYNACK; - 138 : 432 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; - 139 : 432 : mp_opt->join_id = *ptr++; - 140 [ - + ]: 432 : mp_opt->thmac = get_unaligned_be64(ptr); - 141 : 432 : ptr += 8; - 142 [ - + ]: 432 : mp_opt->nonce = get_unaligned_be32(ptr); - 143 : 432 : ptr += 4; - 144 [ - + ]: 432 : pr_debug("MP_JOIN bkup=%u, id=%u, thmac=%llu, nonce=%u\n", + 136 [ + + ]: 1368 : } else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) { + 137 : 434 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYNACK; + 138 : 434 : mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP; + 139 : 434 : mp_opt->join_id = *ptr++; + 140 [ - + ]: 434 : mp_opt->thmac = get_unaligned_be64(ptr); + 141 : 434 : ptr += 8; + 142 [ - + ]: 434 : mp_opt->nonce = get_unaligned_be32(ptr); + 143 : 434 : ptr += 4; + 144 [ - + ]: 434 : 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 [ + - ]: 932 : } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { - 148 : 932 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; - 149 : 932 : ptr += 2; - 150 : 932 : memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); - 151 [ - + ]: 932 : pr_debug("MP_JOIN hmac\n"); + 147 [ + - ]: 934 : } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { + 148 : 934 : mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; + 149 : 934 : ptr += 2; + 150 : 934 : memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); + 151 [ - + ]: 934 : pr_debug("MP_JOIN hmac\n"); 152 : : } 153 : : break; 154 : : 155 : : case MPTCPOPT_DSS: - 156 [ - + ]: 836085 : pr_debug("DSS\n"); - 157 : 836085 : ptr++; + 156 [ - + ]: 823170 : pr_debug("DSS\n"); + 157 : 823170 : ptr++; 158 : : - 159 : 836085 : flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; - 160 : 836085 : mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; - 161 : 836085 : mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; - 162 : 836085 : mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; - 163 : 836085 : mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; - 164 : 836085 : mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); + 159 : 823170 : flags = (*ptr++) & MPTCP_DSS_FLAG_MASK; + 160 : 823170 : mp_opt->data_fin = (flags & MPTCP_DSS_DATA_FIN) != 0; + 161 : 823170 : mp_opt->dsn64 = (flags & MPTCP_DSS_DSN64) != 0; + 162 : 823170 : mp_opt->use_map = (flags & MPTCP_DSS_HAS_MAP) != 0; + 163 : 823170 : mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; + 164 : 823170 : mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); 165 : : - 166 [ - + ]: 836085 : pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n", + 166 [ - + ]: 823170 : 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 : 836085 : expected_opsize = TCPOLEN_MPTCP_DSS_BASE; + 171 : 823170 : expected_opsize = TCPOLEN_MPTCP_DSS_BASE; 172 : : - 173 [ + - ]: 836085 : if (mp_opt->use_ack) { - 174 [ + + ]: 836085 : if (mp_opt->ack64) + 173 [ + - ]: 823170 : if (mp_opt->use_ack) { + 174 [ + + ]: 823170 : if (mp_opt->ack64) 175 : : expected_opsize += TCPOLEN_MPTCP_DSS_ACK64; 176 : : else - 177 : 153967 : expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; + 177 : 28233 : expected_opsize += TCPOLEN_MPTCP_DSS_ACK32; 178 : : } 179 : : - 180 [ + + ]: 836085 : if (mp_opt->use_map) { - 181 [ + + ]: 544459 : if (mp_opt->dsn64) - 182 : 544417 : expected_opsize += TCPOLEN_MPTCP_DSS_MAP64; + 180 [ + + ]: 823170 : if (mp_opt->use_map) { + 181 [ + + ]: 520899 : if (mp_opt->dsn64) + 182 : 520857 : 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 [ + + ]: 836085 : if (opsize != expected_opsize && - 191 [ + - ]: 1877 : opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) + 190 [ + + ]: 823170 : if (opsize != expected_opsize && + 191 [ + - ]: 1872 : opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) 192 : : break; 193 : : - 194 : 836085 : mp_opt->suboptions |= OPTION_MPTCP_DSS; - 195 [ + - ]: 836085 : if (mp_opt->use_ack) { - 196 [ + + ]: 836085 : if (mp_opt->ack64) { - 197 : 682118 : mp_opt->data_ack = get_unaligned_be64(ptr); - 198 : 682118 : ptr += 8; + 194 : 823170 : mp_opt->suboptions |= OPTION_MPTCP_DSS; + 195 [ + - ]: 823170 : if (mp_opt->use_ack) { + 196 [ + + ]: 823170 : if (mp_opt->ack64) { + 197 : 794937 : mp_opt->data_ack = get_unaligned_be64(ptr); + 198 : 794937 : ptr += 8; 199 : : } else { - 200 : 153967 : mp_opt->data_ack = get_unaligned_be32(ptr); - 201 : 153967 : ptr += 4; + 200 : 28233 : mp_opt->data_ack = get_unaligned_be32(ptr); + 201 : 28233 : ptr += 4; 202 : : } 203 : : - 204 [ - + ]: 836085 : pr_debug("data_ack=%llu\n", mp_opt->data_ack); + 204 [ - + ]: 823170 : pr_debug("data_ack=%llu\n", mp_opt->data_ack); 205 : : } 206 : : - 207 [ + + ]: 836085 : if (mp_opt->use_map) { - 208 [ + + ]: 544459 : if (mp_opt->dsn64) { - 209 : 544417 : mp_opt->data_seq = get_unaligned_be64(ptr); - 210 : 544417 : ptr += 8; + 207 [ + + ]: 823170 : if (mp_opt->use_map) { + 208 [ + + ]: 520899 : if (mp_opt->dsn64) { + 209 : 520857 : mp_opt->data_seq = get_unaligned_be64(ptr); + 210 : 520857 : ptr += 8; 211 : : } else { 212 : 42 : mp_opt->data_seq = get_unaligned_be32(ptr); 213 : 42 : ptr += 4; 214 : : } 215 : : - 216 [ + + ]: 544459 : mp_opt->subflow_seq = get_unaligned_be32(ptr); - 217 : 544459 : ptr += 4; + 216 [ + + ]: 520899 : mp_opt->subflow_seq = get_unaligned_be32(ptr); + 217 : 520899 : ptr += 4; 218 : : - 219 [ + + ]: 544459 : mp_opt->data_len = get_unaligned_be16(ptr); - 220 : 544459 : ptr += 2; + 219 [ + + ]: 520899 : mp_opt->data_len = get_unaligned_be16(ptr); + 220 : 520899 : ptr += 2; 221 : : - 222 [ + + ]: 544459 : if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) { - 223 : 1877 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; - 224 : 1877 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); - 225 : 1877 : ptr += 2; + 222 [ + + ]: 520899 : if (opsize == expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM) { + 223 : 1872 : mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; + 224 : 1872 : mp_opt->csum = get_unaligned((__force __sum16 *)ptr); + 225 : 1872 : ptr += 2; 226 : : } 227 : : - 228 [ - + ]: 544459 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", + 228 [ - + ]: 520899 : 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 : 690 : case MPTCPOPT_ADD_ADDR: - 237 : 690 : mp_opt->echo = (*ptr++) & MPTCP_ADDR_ECHO; - 238 [ + + ]: 690 : 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,47 +327,47 @@ 247 : : else 248 : : break; 249 : : } else { - 250 : 330 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE || - 251 [ + + ]: 330 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) - 252 : 257 : mp_opt->addr.family = AF_INET; + 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 : 690 : mp_opt->suboptions |= OPTION_MPTCP_ADD_ADDR; - 263 : 690 : mp_opt->addr.id = *ptr++; - 264 : 690 : mp_opt->addr.port = 0; - 265 : 690 : mp_opt->ahmac = 0; - 266 [ + + ]: 690 : if (mp_opt->addr.family == AF_INET) { - 267 : 537 : memcpy((u8 *)&mp_opt->addr.addr.s_addr, (u8 *)ptr, 4); - 268 : 537 : ptr += 4; - 269 : 537 : if (opsize == TCPOLEN_MPTCP_ADD_ADDR_PORT || - 270 [ + + ]: 537 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) { + 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 || + 270 [ + + ]: 538 : opsize == TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT) { 271 : 62 : mp_opt->addr.port = htons(get_unaligned_be16(ptr)); 272 : 62 : ptr += 2; 273 : : } 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 [ + + ]: 690 : 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 [ - + - - ]: 690 : 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,29 +395,29 @@ 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 : 236 : case MPTCPOPT_MP_FASTCLOSE: + 319 [ + - ]: 236 : 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 : 236 : ptr += 2; + 323 [ - + ]: 236 : mp_opt->rcvr_key = get_unaligned_be64(ptr); + 324 : 236 : ptr += 8; + 325 : 236 : mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE; + 326 [ - + ]: 236 : pr_debug("MP_FASTCLOSE: recv_key=%llu\n", mp_opt->rcvr_key); 327 : : break; 328 : : - 329 : 260 : case MPTCPOPT_RST: - 330 [ + - ]: 260 : if (opsize != TCPOLEN_MPTCP_RST) + 329 : 250 : case MPTCPOPT_RST: + 330 [ + - ]: 250 : if (opsize != TCPOLEN_MPTCP_RST) 331 : : break; 332 : : - 333 [ + + ]: 260 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) + 333 [ + + ]: 250 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) 334 : : break; 335 : : - 336 : 248 : mp_opt->suboptions |= OPTION_MPTCP_RST; - 337 : 248 : flags = *ptr++; - 338 : 248 : mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; - 339 : 248 : mp_opt->reset_reason = *ptr; - 340 [ - + ]: 248 : pr_debug("MP_RST: transient=%u reason=%u\n", + 336 : 238 : mp_opt->suboptions |= OPTION_MPTCP_RST; + 337 : 238 : flags = *ptr++; + 338 : 238 : mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; + 339 : 238 : mp_opt->reset_reason = *ptr; + 340 [ - + ]: 238 : pr_debug("MP_RST: transient=%u reason=%u\n", 341 : : mp_opt->reset_transient, mp_opt->reset_reason); 342 : : break; 343 : : @@ -434,99 +434,99 @@ 354 : : default: 355 : : break; 356 : : } - 357 : 844445 : } + 357 : 831469 : } 358 : : - 359 : 844383 : void mptcp_get_options(const struct sk_buff *skb, + 359 : 831410 : void mptcp_get_options(const struct sk_buff *skb, 360 : : struct mptcp_options_received *mp_opt) 361 : : { - 362 : 844383 : const struct tcphdr *th = tcp_hdr(skb); - 363 : 844383 : const unsigned char *ptr; - 364 : 844383 : int length; + 362 : 831410 : const struct tcphdr *th = tcp_hdr(skb); + 363 : 831410 : const unsigned char *ptr; + 364 : 831410 : int length; 365 : : 366 : : /* Ensure that casting the whole status to u32 is efficient and safe */ - 367 : 844383 : BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); - 368 : 844383 : BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status), + 367 : 831410 : BUILD_BUG_ON(sizeof_field(struct mptcp_options_received, status) != sizeof(u32)); + 368 : 831410 : BUILD_BUG_ON(!IS_ALIGNED(offsetof(struct mptcp_options_received, status), 369 : : sizeof(u32))); - 370 : 844383 : *(u32 *)&mp_opt->status = 0; + 370 : 831410 : *(u32 *)&mp_opt->status = 0; 371 : : - 372 : 844383 : length = (th->doff * 4) - sizeof(struct tcphdr); - 373 : 844383 : ptr = (const unsigned char *)(th + 1); + 372 : 831410 : length = (th->doff * 4) - sizeof(struct tcphdr); + 373 : 831410 : ptr = (const unsigned char *)(th + 1); 374 : : - 375 [ + + ]: 5323798 : while (length > 0) { - 376 : 4479415 : int opcode = *ptr++; - 377 : 4479415 : int opsize; + 375 [ + + ]: 5196741 : while (length > 0) { + 376 : 4365331 : int opcode = *ptr++; + 377 : 4365331 : int opsize; 378 : : - 379 [ + + - ]: 4479415 : switch (opcode) { + 379 [ + + - ]: 4365331 : switch (opcode) { 380 : : case TCPOPT_EOL: 381 : : return; - 382 : 2778008 : case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */ - 383 : 2778008 : length--; - 384 : 2778008 : continue; - 385 : 1701407 : default: - 386 [ + - ]: 1701407 : if (length < 2) + 382 : 2694856 : case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */ + 383 : 2694856 : length--; + 384 : 2694856 : continue; + 385 : 1670475 : default: + 386 [ + - ]: 1670475 : if (length < 2) 387 : : return; - 388 : 1701407 : opsize = *ptr++; - 389 [ + - ]: 1701407 : if (opsize < 2) /* "silly options" */ + 388 : 1670475 : opsize = *ptr++; + 389 [ + - ]: 1670475 : if (opsize < 2) /* "silly options" */ 390 : : return; - 391 [ + - ]: 1701407 : if (opsize > length) + 391 [ + - ]: 1670475 : if (opsize > length) 392 : : return; /* don't parse partial options */ - 393 [ + + ]: 1701407 : if (opcode == TCPOPT_MPTCP) - 394 : 844445 : mptcp_parse_option(skb, ptr, opsize, mp_opt); - 395 : 1701407 : ptr += opsize - 2; - 396 : 1701407 : length -= opsize; + 393 [ + + ]: 1670475 : if (opcode == TCPOPT_MPTCP) + 394 : 831469 : mptcp_parse_option(skb, ptr, opsize, mp_opt); + 395 : 1670475 : ptr += opsize - 2; + 396 : 1670475 : length -= opsize; 397 : : } 398 : : } 399 : : } 400 : : - 401 : 1791 : bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, + 401 : 1788 : bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, 402 : : unsigned int *size, struct mptcp_out_options *opts) 403 : : { - 404 [ + + ]: 1791 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 404 [ + + ]: 1788 : 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 : 1791 : subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; - 410 [ + + ]: 1791 : if (subflow->request_mptcp) { - 411 : 1246 : opts->suboptions = OPTION_MPTCP_MPC_SYN; - 412 : 1246 : opts->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk)); - 413 : 1246 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); - 414 : 1246 : *size = TCPOLEN_MPTCP_MPC_SYN; - 415 : 1246 : return true; - 416 [ + + ]: 545 : } else if (subflow->request_join) { - 417 [ - + ]: 521 : pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token, + 409 : 1788 : subflow->snd_isn = TCP_SKB_CB(skb)->end_seq; + 410 [ + + ]: 1788 : if (subflow->request_mptcp) { + 411 : 1247 : opts->suboptions = OPTION_MPTCP_MPC_SYN; + 412 : 1247 : opts->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk)); + 413 : 1247 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); + 414 : 1247 : *size = TCPOLEN_MPTCP_MPC_SYN; + 415 : 1247 : return true; + 416 [ + + ]: 541 : } else if (subflow->request_join) { + 417 [ - + ]: 517 : pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token, 418 : : subflow->local_nonce); - 419 : 521 : opts->suboptions = OPTION_MPTCP_MPJ_SYN; - 420 : 521 : opts->join_id = subflow->local_id; - 421 : 521 : opts->token = subflow->remote_token; - 422 : 521 : opts->nonce = subflow->local_nonce; - 423 : 521 : opts->backup = subflow->request_bkup; - 424 : 521 : *size = TCPOLEN_MPTCP_MPJ_SYN; - 425 : 521 : return true; + 419 : 517 : opts->suboptions = OPTION_MPTCP_MPJ_SYN; + 420 : 517 : opts->join_id = subflow->local_id; + 421 : 517 : opts->token = subflow->remote_token; + 422 : 517 : opts->nonce = subflow->local_nonce; + 423 : 517 : opts->backup = subflow->request_bkup; + 424 : 517 : *size = TCPOLEN_MPTCP_MPJ_SYN; + 425 : 517 : return true; 426 : : } 427 : : return false; 428 : : } 429 : : - 430 : 874 : static void clear_3rdack_retransmission(struct sock *sk) + 430 : 878 : static void clear_3rdack_retransmission(struct sock *sk) 431 : : { - 432 : 874 : struct inet_connection_sock *icsk = inet_csk(sk); + 432 : 878 : struct inet_connection_sock *icsk = inet_csk(sk); 433 : : - 434 : 874 : sk_stop_timer(sk, &icsk->icsk_delack_timer); - 435 : 874 : icsk->icsk_ack.timeout = 0; - 436 : 874 : icsk->icsk_ack.ato = 0; - 437 : 874 : icsk->icsk_ack.pending &= ~(ICSK_ACK_SCHED | ICSK_ACK_TIMER); - 438 : 874 : } + 434 : 878 : sk_stop_timer(sk, &icsk->icsk_delack_timer); + 435 : 878 : icsk->icsk_ack.timeout = 0; + 436 : 878 : icsk->icsk_ack.ato = 0; + 437 : 878 : icsk->icsk_ack.pending &= ~(ICSK_ACK_SCHED | ICSK_ACK_TIMER); + 438 : 878 : } 439 : : - 440 : 1296778 : static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, + 440 : 1680674 : 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 [ - + ]: 1296778 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 446 [ - + ]: 1296778 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 447 : 1296778 : struct mptcp_ext *mpext; - 448 : 1296778 : unsigned int data_len; - 449 : 1296778 : u8 len; + 445 [ - + ]: 1680674 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 446 [ - + ]: 1680674 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 447 : 1680674 : struct mptcp_ext *mpext; + 448 : 1680674 : unsigned int data_len; + 449 : 1680674 : 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,56 +534,56 @@ 454 : : * tell the caller to defer the estimate to 455 : : * mptcp_established_options_dss(), which will reserve enough space. 456 : : */ - 457 [ + + ]: 1296778 : if (!skb) + 457 [ + + ]: 1680674 : if (!skb) 458 : : return false; 459 : : 460 : : /* MPC/MPJ needed only on 3rd ack packet, DATA_FIN and TCP shutdown take precedence */ - 461 [ + + + + : 596095 : if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable || - + + ] - 462 [ + + ]: 2447 : subflow->snd_isn != TCP_SKB_CB(skb)->seq || - 463 [ + + ]: 2089 : sk->sk_state != TCP_ESTABLISHED) + 461 [ + + + + : 738914 : if (READ_ONCE(subflow->fully_established) || snd_data_fin_enable || + + + ] + 462 [ + + ]: 2630 : subflow->snd_isn != TCP_SKB_CB(skb)->seq || + 463 [ + + ]: 2115 : sk->sk_state != TCP_ESTABLISHED) 464 : : return false; 465 : : - 466 [ + + ]: 2089 : if (subflow->mp_capable) { - 467 [ + + ]: 1641 : mpext = mptcp_get_ext(skb); - 468 [ + + ]: 1100 : data_len = mpext ? mpext->data_len : 0; + 466 [ + + ]: 2115 : if (subflow->mp_capable) { + 467 [ + + ]: 1667 : mpext = mptcp_get_ext(skb); + 468 [ + + ]: 1126 : 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 : 1641 : opts->data_len = data_len; - 475 : 1641 : opts->suboptions = OPTION_MPTCP_MPC_ACK; - 476 : 1641 : opts->sndr_key = subflow->local_key; - 477 : 1641 : opts->rcvr_key = subflow->remote_key; - 478 [ - + ]: 1641 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); - 479 : 1641 : opts->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk)); + 474 : 1667 : opts->data_len = data_len; + 475 : 1667 : opts->suboptions = OPTION_MPTCP_MPC_ACK; + 476 : 1667 : opts->sndr_key = subflow->local_key; + 477 : 1667 : opts->rcvr_key = subflow->remote_key; + 478 [ - + ]: 1667 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); + 479 : 1667 : 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 [ + + ]: 1641 : if (data_len > 0) { - 487 : 559 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; - 488 [ + + ]: 559 : if (opts->csum_reqd) { + 486 [ + + ]: 1667 : if (data_len > 0) { + 487 : 584 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; + 488 [ + + ]: 584 : if (opts->csum_reqd) { 489 : : /* we need to propagate more info to csum the pseudo hdr */ 490 : 5 : opts->data_seq = mpext->data_seq; 491 : 5 : opts->subflow_seq = mpext->subflow_seq; 492 : 5 : opts->csum = mpext->csum; 493 : 5 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 494 : : } - 495 : 559 : *size = ALIGN(len, 4); + 495 : 584 : *size = ALIGN(len, 4); 496 : : } else { - 497 : 1082 : *size = TCPOLEN_MPTCP_MPC_ACK; + 497 : 1083 : *size = TCPOLEN_MPTCP_MPC_ACK; 498 : : } 499 : : - 500 [ - + ]: 1641 : pr_debug("subflow=%p, local_key=%llu, remote_key=%llu map_len=%d\n", + 500 [ - + ]: 1667 : 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 : 1641 : return true; - 505 [ + + ]: 448 : } else if (subflow->mp_join) { + 504 : 1667 : return true; + 505 [ + + ]: 448 : } else if (subflow->mp_join) { 506 : 448 : opts->suboptions = OPTION_MPTCP_MPJ_ACK; 507 : 448 : memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN); 508 : 448 : *size = TCPOLEN_MPTCP_MPJ_ACK; @@ -594,107 +594,107 @@ 513 : : * socket lock release time - just set the appropriate flag, will 514 : : * be handled by the release callback 515 : : */ - 516 [ + + ]: 448 : if (sock_owned_by_user(sk)) - 517 : 359 : set_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status); + 516 [ + + ]: 448 : if (sock_owned_by_user(sk)) + 517 : 363 : set_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status); 518 : : else - 519 : 89 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_ACK); + 519 : 85 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_ACK); 520 : 448 : return true; 521 : : } 522 : : return false; 523 : : } 524 : : - 525 : 20177 : static void mptcp_write_data_fin(struct mptcp_subflow_context *subflow, + 525 : 27624 : 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 [ - + ]: 20177 : u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; + 531 [ - + ]: 27624 : u64 data_fin_tx_seq = READ_ONCE(mptcp_sk(subflow->conn)->write_seq) - 1; 532 : : - 533 [ + + - + ]: 20177 : if (!ext->use_map || !skb->len) { + 533 [ + + - + ]: 27624 : 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 : 7181 : ext->data_fin = 1; - 538 : 7181 : ext->use_map = 1; - 539 : 7181 : ext->dsn64 = 1; - 540 : 7181 : ext->data_seq = data_fin_tx_seq; - 541 : 7181 : ext->subflow_seq = 0; - 542 : 7181 : ext->data_len = 1; - 543 [ + + ]: 12996 : } else if (ext->data_seq + ext->data_len == data_fin_tx_seq) { + 537 : 9252 : ext->data_fin = 1; + 538 : 9252 : ext->use_map = 1; + 539 : 9252 : ext->dsn64 = 1; + 540 : 9252 : ext->data_seq = data_fin_tx_seq; + 541 : 9252 : ext->subflow_seq = 0; + 542 : 9252 : ext->data_len = 1; + 543 [ + + ]: 18372 : } 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 : 473 : ext->data_fin = 1; - 549 : 473 : ext->data_len++; + 548 : 1060 : ext->data_fin = 1; + 549 : 1060 : ext->data_len++; 550 : : } - 551 : 20177 : } + 551 : 27624 : } 552 : : - 553 : 1294689 : static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb, + 553 : 1678559 : 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 [ - + ]: 1294689 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 559 [ - + ]: 1294689 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 560 : 1294689 : unsigned int dss_size = 0; - 561 : 1294689 : struct mptcp_ext *mpext; - 562 : 1294689 : unsigned int ack_size; - 563 : 1294689 : bool ret = false; - 564 : 1294689 : u64 ack_seq; + 558 [ - + ]: 1678559 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 559 [ - + ]: 1678559 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 560 : 1678559 : unsigned int dss_size = 0; + 561 : 1678559 : struct mptcp_ext *mpext; + 562 : 1678559 : unsigned int ack_size; + 563 : 1678559 : bool ret = false; + 564 : 1678559 : u64 ack_seq; 565 : : - 566 [ - + ]: 1294689 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); - 567 [ + + ]: 1294689 : mpext = skb ? mptcp_get_ext(skb) : NULL; + 566 [ - + ]: 1678559 : opts->csum_reqd = READ_ONCE(msk->csum_enabled); + 567 [ + + ]: 1678559 : mpext = skb ? mptcp_get_ext(skb) : NULL; 568 : : - 569 [ + + - + : 594006 : if (!skb || (mpext && mpext->use_map) || snd_data_fin_enable) { - + + ] - 570 : 999565 : unsigned int map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64; + 569 [ + + - + : 736799 : if (!skb || (mpext && mpext->use_map) || snd_data_fin_enable) { + + + ] + 570 : 1373281 : unsigned int map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64; 571 : : - 572 [ + + ]: 999565 : if (mpext) { - 573 [ + + ]: 291701 : if (opts->csum_reqd) - 574 : 1598 : map_size += TCPOLEN_MPTCP_DSS_CHECKSUM; + 572 [ + + ]: 1373281 : if (mpext) { + 573 [ + + ]: 422269 : if (opts->csum_reqd) + 574 : 1600 : map_size += TCPOLEN_MPTCP_DSS_CHECKSUM; 575 : : - 576 : 291701 : opts->ext_copy = *mpext; + 576 : 422269 : opts->ext_copy = *mpext; 577 : : } 578 : : - 579 : 999565 : dss_size = map_size; - 580 [ + + ]: 999565 : if (skb && snd_data_fin_enable) - 581 : 20177 : mptcp_write_data_fin(subflow, skb, &opts->ext_copy); - 582 : 999565 : opts->suboptions = OPTION_MPTCP_DSS; - 583 : 999565 : ret = true; + 579 : 1373281 : dss_size = map_size; + 580 [ + + ]: 1373281 : if (skb && snd_data_fin_enable) + 581 : 27624 : mptcp_write_data_fin(subflow, skb, &opts->ext_copy); + 582 : 1373281 : opts->suboptions = OPTION_MPTCP_DSS; + 583 : 1373281 : 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 : 1294689 : opts->ext_copy.use_ack = 0; - 590 [ + + + + ]: 1294689 : if (!READ_ONCE(msk->can_ack)) { - 591 : 18 : *size = ALIGN(dss_size, 4); - 592 : 18 : return ret; + 589 : 1678559 : opts->ext_copy.use_ack = 0; + 590 [ + + + + ]: 1678559 : if (!READ_ONCE(msk->can_ack)) { + 591 : 19 : *size = ALIGN(dss_size, 4); + 592 : 19 : return ret; 593 : : } 594 : : - 595 : 1294671 : ack_seq = READ_ONCE(msk->ack_seq); - 596 [ + + + + ]: 1294671 : if (READ_ONCE(msk->use_64bit_ack)) { - 597 : 1131887 : ack_size = TCPOLEN_MPTCP_DSS_ACK64; - 598 : 1131887 : opts->ext_copy.data_ack = ack_seq; - 599 : 1131887 : opts->ext_copy.ack64 = 1; + 595 : 1678540 : ack_seq = READ_ONCE(msk->ack_seq); + 596 [ + + + + ]: 1678540 : if (READ_ONCE(msk->use_64bit_ack)) { + 597 : 1589582 : ack_size = TCPOLEN_MPTCP_DSS_ACK64; + 598 : 1589582 : opts->ext_copy.data_ack = ack_seq; + 599 : 1589582 : opts->ext_copy.ack64 = 1; 600 : : } else { - 601 : 162784 : ack_size = TCPOLEN_MPTCP_DSS_ACK32; - 602 : 162784 : opts->ext_copy.data_ack32 = (uint32_t)ack_seq; - 603 : 162784 : opts->ext_copy.ack64 = 0; + 601 : 88958 : ack_size = TCPOLEN_MPTCP_DSS_ACK32; + 602 : 88958 : opts->ext_copy.data_ack32 = (uint32_t)ack_seq; + 603 : 88958 : opts->ext_copy.ack64 = 0; 604 : : } - 605 : 1294671 : opts->ext_copy.use_ack = 1; - 606 : 1294671 : opts->suboptions = OPTION_MPTCP_DSS; + 605 : 1678540 : opts->ext_copy.use_ack = 1; + 606 : 1678540 : opts->suboptions = OPTION_MPTCP_DSS; 607 : : 608 : : /* Add kind/length/subtype/flag overhead if mapping is not populated */ - 609 [ + + ]: 1294671 : if (dss_size == 0) - 610 : 295124 : ack_size += TCPOLEN_MPTCP_DSS_BASE; + 609 [ + + ]: 1678540 : if (dss_size == 0) + 610 : 305278 : ack_size += TCPOLEN_MPTCP_DSS_BASE; 611 : : - 612 : 1294671 : dss_size += ack_size; + 612 : 1678540 : dss_size += ack_size; 613 : : - 614 : 1294671 : *size = ALIGN(dss_size, 4); - 615 : 1294671 : return true; + 614 : 1678540 : *size = ALIGN(dss_size, 4); + 615 : 1678540 : 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 : 1296774 : static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *skb, + 645 : 1680670 : 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 [ - + ]: 1296774 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 651 [ - + ]: 1296774 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 652 : 1296774 : bool drop_other_suboptions = false; - 653 : 1296774 : unsigned int opt_size = *size; - 654 : 1296774 : bool echo; - 655 : 1296774 : int len; + 650 [ - + ]: 1680670 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 651 [ - + ]: 1680670 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 652 : 1680670 : bool drop_other_suboptions = false; + 653 : 1680670 : unsigned int opt_size = *size; + 654 : 1680670 : bool echo; + 655 : 1680670 : int len; 656 : : 657 : : /* add addr will strip the existing options, be sure to avoid breaking 658 : : * MPC/MPJ handshakes 659 : : */ - 660 [ + + ]: 1296774 : if (!mptcp_pm_should_add_signal(msk) || - 661 [ + - - + ]: 1508 : (opts->suboptions & (OPTION_MPTCP_MPJ_ACK | OPTION_MPTCP_MPC_ACK)) || - 662 : 754 : !mptcp_pm_add_addr_signal(msk, skb, opt_size, remaining, &opts->addr, + 660 [ + + ]: 1680670 : 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 : 1296020 : return false; + 664 : 1679914 : 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 [ + + + - ]: 754 : if (drop_other_suboptions) - 671 : 754 : 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 [ + + + + ]: 754 : len = mptcp_add_addr_len(opts->addr.family, echo, !!opts->addr.port); - 676 [ - + ]: 754 : 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 : 754 : *size = len; - 680 [ + + + - ]: 754 : if (drop_other_suboptions) { - 681 [ - + ]: 754 : pr_debug("drop other suboptions\n"); - 682 : 754 : 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 : 754 : opts->ahmac = 0; - 690 : 754 : *size -= opt_size; + 689 : 756 : opts->ahmac = 0; + 690 : 756 : *size -= opt_size; 691 : : } - 692 : 754 : opts->suboptions |= OPTION_MPTCP_ADD_ADDR; - 693 [ + + + + ]: 754 : 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 [ + - ]: 350 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); + 699 [ + - ]: 352 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); 700 : : } - 701 [ - + - - ]: 754 : 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 : 1296020 : static bool mptcp_established_options_rm_addr(struct sock *sk, + 707 : 1679914 : 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 [ - + ]: 1296020 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 713 [ - + ]: 1296020 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 714 : 1296020 : struct mptcp_rm_list rm_list; - 715 : 1296020 : int i, len; + 712 [ - + ]: 1679914 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 713 [ - + ]: 1679914 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 714 : 1679914 : struct mptcp_rm_list rm_list; + 715 : 1679914 : int i, len; 716 : : - 717 [ + + - + ]: 1296126 : if (!mptcp_pm_should_rm_signal(msk) || + 717 [ + + - + ]: 1680020 : if (!mptcp_pm_should_rm_signal(msk) || 718 : 106 : !(mptcp_pm_rm_addr_signal(msk, remaining, &rm_list))) - 719 : 1295914 : return false; + 719 : 1679808 : return false; 720 : : - 721 [ - + ]: 229 : len = mptcp_rm_addr_len(&rm_list); + 721 [ - + ]: 225 : 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 : 1296774 : static bool mptcp_established_options_mp_prio(struct sock *sk, + 737 : 1680670 : 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 [ + + ]: 1296774 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 742 [ + + ]: 1680670 : 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 [ + + + - ]: 1296774 : if (!subflow->send_mp_prio || (opts->suboptions & OPTIONS_MPTCP_MPC)) + 747 [ + + + - ]: 1680670 : 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 : 435 : static noinline bool mptcp_established_options_rst(struct sock *sk, struct sk_buff *skb, + 763 : 424 : 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 [ + - ]: 435 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 768 [ + - ]: 424 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 769 : : - 770 [ + - ]: 435 : if (remaining < TCPOLEN_MPTCP_RST) + 770 [ + - ]: 424 : if (remaining < TCPOLEN_MPTCP_RST) 771 : : return false; 772 : : - 773 : 435 : *size = TCPOLEN_MPTCP_RST; - 774 : 435 : opts->suboptions |= OPTION_MPTCP_RST; - 775 : 435 : opts->reset_transient = subflow->reset_transient; - 776 : 435 : opts->reset_reason = subflow->reset_reason; - 777 [ + - ]: 435 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX); + 773 : 424 : *size = TCPOLEN_MPTCP_RST; + 774 : 424 : opts->suboptions |= OPTION_MPTCP_RST; + 775 : 424 : opts->reset_transient = subflow->reset_transient; + 776 : 424 : opts->reset_reason = subflow->reset_reason; + 777 [ + - ]: 424 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTTX); 778 : : 779 : : return true; 780 : : } 781 : : - 782 : 435 : static bool mptcp_established_options_fastclose(struct sock *sk, + 782 : 424 : 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 [ - + ]: 435 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 788 [ - + ]: 435 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 787 [ - + ]: 424 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 788 [ - + ]: 424 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 789 : : - 790 [ + + ]: 435 : if (likely(!subflow->send_fastclose)) + 790 [ + + ]: 424 : if (likely(!subflow->send_fastclose)) 791 : : return false; 792 : : - 793 [ + - ]: 381 : if (remaining < TCPOLEN_MPTCP_FASTCLOSE) + 793 [ + - ]: 367 : if (remaining < TCPOLEN_MPTCP_FASTCLOSE) 794 : : return false; 795 : : - 796 : 381 : *size = TCPOLEN_MPTCP_FASTCLOSE; - 797 : 381 : opts->suboptions |= OPTION_MPTCP_FASTCLOSE; - 798 : 381 : opts->rcvr_key = READ_ONCE(msk->remote_key); + 796 : 367 : *size = TCPOLEN_MPTCP_FASTCLOSE; + 797 : 367 : opts->suboptions |= OPTION_MPTCP_FASTCLOSE; + 798 : 367 : opts->rcvr_key = READ_ONCE(msk->remote_key); 799 : : - 800 [ - + ]: 381 : pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key); - 801 [ + - ]: 381 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); + 800 [ - + ]: 367 : pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key); + 801 [ + - ]: 367 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); 802 : : return true; 803 : : } 804 : : - 805 : 1294743 : static bool mptcp_established_options_mp_fail(struct sock *sk, + 805 : 1678616 : 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 [ + + ]: 1294743 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 810 [ + + ]: 1678616 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 811 : : - 812 [ + + ]: 1294743 : if (likely(!subflow->send_mp_fail)) + 812 [ + + ]: 1678616 : if (likely(!subflow->send_mp_fail)) 813 : : return false; 814 : : 815 [ + - ]: 6 : if (remaining < TCPOLEN_MPTCP_FAIL) @@ -907,43 +907,43 @@ 825 : : return true; 826 : : } 827 : : - 828 : 1336543 : bool mptcp_established_options(struct sock *sk, struct sk_buff *skb, + 828 : 1734112 : 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 [ - + ]: 1336543 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 833 [ - + ]: 1336543 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 834 : 1336543 : unsigned int opt_size = 0; - 835 : 1336543 : bool snd_data_fin; - 836 : 1336543 : bool ret = false; + 832 [ - + ]: 1734112 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 833 [ - + ]: 1734112 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 834 : 1734112 : unsigned int opt_size = 0; + 835 : 1734112 : bool snd_data_fin; + 836 : 1734112 : bool ret = false; 837 : : - 838 : 1336543 : opts->suboptions = 0; + 838 : 1734112 : opts->suboptions = 0; 839 : : - 840 [ + + + + ]: 1336543 : if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) + 840 [ + + + + ]: 1734112 : if (unlikely(__mptcp_check_fallback(msk) && !mptcp_check_infinite_map(skb))) 841 : : return false; 842 : : - 843 [ + + + + ]: 1297213 : if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { - 844 [ + + + + ]: 489 : if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) || - 845 : 54 : mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { - 846 : 383 : *size += opt_size; - 847 : 383 : remaining -= opt_size; + 843 [ + + + + ]: 1681098 : if (unlikely(skb && TCP_SKB_CB(skb)->tcp_flags & TCPHDR_RST)) { + 844 [ + + + + ]: 481 : if (mptcp_established_options_fastclose(sk, &opt_size, remaining, opts) || + 845 : 57 : mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) { + 846 : 369 : *size += opt_size; + 847 : 369 : remaining -= opt_size; 848 : : } 849 : : /* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */ - 850 [ + - ]: 435 : if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { - 851 : 435 : *size += opt_size; - 852 : 435 : remaining -= opt_size; + 850 [ + - ]: 424 : if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) { + 851 : 424 : *size += opt_size; + 852 : 424 : remaining -= opt_size; 853 : : } - 854 : 435 : return true; + 854 : 424 : return true; 855 : : } 856 : : - 857 [ + + ]: 1296778 : snd_data_fin = mptcp_data_fin_enabled(msk); - 858 [ + + ]: 1296778 : if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, opts)) + 857 [ + + ]: 1680674 : snd_data_fin = mptcp_data_fin_enabled(msk); + 858 [ + + ]: 1680674 : if (mptcp_established_options_mp(sk, skb, snd_data_fin, &opt_size, opts)) 859 : : ret = true; - 860 [ + - ]: 1294689 : else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, opts)) { - 861 : 1294689 : unsigned int mp_fail_size; + 860 [ + - ]: 1678559 : else if (mptcp_established_options_dss(sk, skb, snd_data_fin, &opt_size, opts)) { + 861 : 1678559 : unsigned int mp_fail_size; 862 : : - 863 : 1294689 : ret = true; - 864 [ + + ]: 1294689 : if (mptcp_established_options_mp_fail(sk, &mp_fail_size, + 863 : 1678559 : ret = true; + 864 [ + + ]: 1678559 : if (mptcp_established_options_mp_fail(sk, &mp_fail_size, 865 : : remaining - opt_size, opts)) { 866 : 4 : *size += opt_size + mp_fail_size; 867 : 4 : remaining -= opt_size - mp_fail_size; @@ -954,22 +954,22 @@ 872 : : /* we reserved enough space for the above options, and exceeding the 873 : : * TCP option space would be fatal 874 : : */ - 875 [ - + - + ]: 1296774 : if (WARN_ON_ONCE(opt_size > remaining)) + 875 [ - + - + ]: 1680670 : if (WARN_ON_ONCE(opt_size > remaining)) 876 : : return false; 877 : : - 878 : 1296774 : *size += opt_size; - 879 : 1296774 : remaining -= opt_size; - 880 [ + + ]: 1296774 : if (mptcp_established_options_add_addr(sk, skb, &opt_size, remaining, opts)) { - 881 : 754 : *size += opt_size; - 882 : 754 : remaining -= opt_size; - 883 : 754 : ret = true; - 884 [ + + ]: 1296020 : } else if (mptcp_established_options_rm_addr(sk, &opt_size, remaining, opts)) { + 878 : 1680670 : *size += opt_size; + 879 : 1680670 : remaining -= opt_size; + 880 [ + + ]: 1680670 : 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 [ + + ]: 1679914 : } 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 [ + + ]: 1296774 : if (mptcp_established_options_mp_prio(sk, &opt_size, remaining, opts)) { + 890 [ + + ]: 1680670 : 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; @@ -983,31 +983,31 @@ 901 : : { 902 : 1686 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 903 : : - 904 [ + + ]: 1686 : if (subflow_req->mp_capable) { - 905 : 1144 : opts->suboptions = OPTION_MPTCP_MPC_SYNACK; - 906 : 1144 : opts->sndr_key = subflow_req->local_key; - 907 : 1144 : opts->csum_reqd = subflow_req->csum_reqd; - 908 : 1144 : opts->allow_join_id0 = subflow_req->allow_join_id0; - 909 : 1144 : *size = TCPOLEN_MPTCP_MPC_SYNACK; - 910 [ - + ]: 1144 : pr_debug("subflow_req=%p, local_key=%llu\n", + 904 [ + + ]: 1686 : if (subflow_req->mp_capable) { + 905 : 1146 : opts->suboptions = OPTION_MPTCP_MPC_SYNACK; + 906 : 1146 : opts->sndr_key = subflow_req->local_key; + 907 : 1146 : opts->csum_reqd = subflow_req->csum_reqd; + 908 : 1146 : opts->allow_join_id0 = subflow_req->allow_join_id0; + 909 : 1146 : *size = TCPOLEN_MPTCP_MPC_SYNACK; + 910 [ - + ]: 1146 : pr_debug("subflow_req=%p, local_key=%llu\n", 911 : : subflow_req, subflow_req->local_key); - 912 : 1144 : return true; - 913 [ + + ]: 542 : } else if (subflow_req->mp_join) { - 914 : 466 : opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; - 915 : 466 : opts->backup = subflow_req->request_bkup; - 916 : 466 : opts->join_id = subflow_req->local_id; - 917 : 466 : opts->thmac = subflow_req->thmac; - 918 : 466 : opts->nonce = subflow_req->local_nonce; - 919 [ - + ]: 466 : pr_debug("req=%p, bkup=%u, id=%u, thmac=%llu, nonce=%u\n", + 912 : 1146 : return true; + 913 [ + + ]: 540 : } else if (subflow_req->mp_join) { + 914 : 464 : opts->suboptions = OPTION_MPTCP_MPJ_SYNACK; + 915 : 464 : opts->backup = subflow_req->request_bkup; + 916 : 464 : opts->join_id = subflow_req->local_id; + 917 : 464 : opts->thmac = subflow_req->thmac; + 918 : 464 : opts->nonce = subflow_req->local_nonce; + 919 [ - + ]: 464 : 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 : 466 : *size = TCPOLEN_MPTCP_MPJ_SYNACK; - 923 : 466 : return true; + 922 : 464 : *size = TCPOLEN_MPTCP_MPJ_SYNACK; + 923 : 464 : return true; 924 : : } 925 : : return false; 926 : : } 927 : : - 928 : 839447 : static bool check_fully_established(struct mptcp_sock *msk, struct sock *ssk, + 928 : 826468 : 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 [ + + + + ]: 839447 : if (likely(READ_ONCE(subflow->fully_established))) { + 936 [ + + + + ]: 826468 : 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 [ + + ]: 837910 : if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 && - 942 [ + + + + ]: 98768 : TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq && - 943 [ + + ]: 45839 : subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) && + 941 [ + + ]: 824931 : if (TCP_SKB_CB(skb)->seq == subflow->ssn_offset + 1 && + 942 [ + + + + ]: 76773 : TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(skb)->seq && + 943 [ + + ]: 52236 : subflow->mp_join && (mp_opt->suboptions & OPTIONS_MPTCP_MPJ) && 944 [ + - ]: 454 : !subflow->request_join) 945 : 454 : tcp_send_ack(ssk); - 946 : 837910 : goto check_notify; + 946 : 824931 : 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 [ + + ]: 1537 : if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1) { - 955 [ - + ]: 51 : if (subflow->mp_join) + 954 [ + + ]: 1537 : if (TCP_SKB_CB(skb)->seq != subflow->ssn_offset + 1) { + 955 [ - + ]: 49 : if (subflow->mp_join) 956 : 0 : goto reset; - 957 [ - + - - ]: 51 : if (subflow->is_mptfo && mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) + 957 [ - + - - ]: 49 : if (subflow->is_mptfo && mp_opt->suboptions & OPTION_MPTCP_MPC_ACK) 958 : 0 : goto set_fully_established; - 959 : 51 : return subflow->mp_capable; + 959 : 49 : return subflow->mp_capable; 960 : : } 961 : : - 962 [ + + ]: 1486 : if (subflow->remote_key_valid && - 963 [ + + - + : 1460 : (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) || - + + ] - 964 : 139 : ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && - 965 [ + + + - ]: 139 : (!mp_opt->echo || subflow->mp_join)))) { + 962 [ + + ]: 1488 : if (subflow->remote_key_valid && + 963 [ + + - + : 1462 : (((mp_opt->suboptions & OPTION_MPTCP_DSS) && mp_opt->use_ack) || + + + ] + 964 : 142 : ((mp_opt->suboptions & OPTION_MPTCP_ADD_ADDR) && + 965 [ + + + - ]: 142 : (!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 : 1452 : goto set_fully_established; + 969 : 1454 : 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 : 1478 : mptcp_data_lock((struct sock *)msk); - 994 : 1478 : __mptcp_subflow_fully_established(msk, subflow, mp_opt); - 995 : 1478 : mptcp_data_unlock((struct sock *)msk); + 993 : 1480 : mptcp_data_lock((struct sock *)msk); + 994 : 1480 : __mptcp_subflow_fully_established(msk, subflow, mp_opt); + 995 : 1480 : mptcp_data_unlock((struct sock *)msk); 996 : : - 997 : 839388 : check_notify: + 997 : 826411 : 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 [ + + + - ]: 839388 : if (likely(subflow->pm_notified) || list_empty(&subflow->node)) + 1003 [ + + + - ]: 826411 : if (likely(subflow->pm_notified) || list_empty(&subflow->node)) 1004 : : return true; 1005 : : - 1006 : 1928 : subflow->pm_notified = 1; - 1007 [ + + ]: 1928 : if (subflow->mp_join) { - 1008 : 874 : clear_3rdack_retransmission(ssk); - 1009 : 874 : mptcp_pm_subflow_established(msk); + 1006 : 1932 : subflow->pm_notified = 1; + 1007 [ + + ]: 1932 : if (subflow->mp_join) { + 1008 : 878 : clear_3rdack_retransmission(ssk); + 1009 : 878 : mptcp_pm_subflow_established(msk); 1010 : : } else { 1011 : 1054 : mptcp_pm_fully_established(msk, ssk); 1012 : : } @@ -1100,93 +1100,93 @@ 1017 : 8 : return false; 1018 : : } 1019 : : - 1020 : 154009 : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq) + 1020 : 28275 : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq) 1021 : : { - 1022 : 154009 : u32 old_seq32, cur_seq32; + 1022 : 28275 : u32 old_seq32, cur_seq32; 1023 : : - 1024 : 154009 : old_seq32 = (u32)old_seq; - 1025 : 154009 : cur_seq32 = (u32)cur_seq; - 1026 : 154009 : cur_seq = (old_seq & GENMASK_ULL(63, 32)) + cur_seq32; - 1027 [ - + - - ]: 154009 : if (unlikely(cur_seq32 < old_seq32 && before(old_seq32, cur_seq32))) + 1024 : 28275 : old_seq32 = (u32)old_seq; + 1025 : 28275 : cur_seq32 = (u32)cur_seq; + 1026 : 28275 : cur_seq = (old_seq & GENMASK_ULL(63, 32)) + cur_seq32; + 1027 [ + + - + ]: 28275 : 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 [ + + - + ]: 154009 : if (unlikely(cur_seq32 > old_seq32 && after(old_seq32, cur_seq32))) + 1031 [ + + - + ]: 28275 : 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 : 213953 : msk->bytes_acked += new_snd_una - msk->snd_una; - 1039 : 213953 : WRITE_ONCE(msk->snd_una, new_snd_una); + 1038 : 240081 : msk->bytes_acked += new_snd_una - msk->snd_una; + 1039 : 240081 : WRITE_ONCE(msk->snd_una, new_snd_una); 1040 : : } 1041 : : - 1042 : 836085 : static void ack_update_msk(struct mptcp_sock *msk, + 1042 : 823170 : static void ack_update_msk(struct mptcp_sock *msk, 1043 : : struct sock *ssk, 1044 : : struct mptcp_options_received *mp_opt) 1045 : : { - 1046 : 836085 : u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt); - 1047 : 836085 : struct sock *sk = (struct sock *)msk; - 1048 : 836085 : u64 old_snd_una; + 1046 : 823170 : u64 new_wnd_end, new_snd_una, snd_nxt = READ_ONCE(msk->snd_nxt); + 1047 : 823170 : struct sock *sk = (struct sock *)msk; + 1048 : 823170 : u64 old_snd_una; 1049 : : - 1050 : 836085 : mptcp_data_lock(sk); + 1050 : 823170 : 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 : 836085 : old_snd_una = msk->snd_una; - 1057 [ + + ]: 836085 : new_snd_una = mptcp_expand_seq(old_snd_una, mp_opt->data_ack, mp_opt->ack64); + 1056 : 823170 : old_snd_una = msk->snd_una; + 1057 [ + + ]: 823170 : 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 [ + + ]: 836085 : if (unlikely(after64(new_snd_una, snd_nxt))) - 1061 : 36 : new_snd_una = old_snd_una; + 1060 [ + + ]: 823170 : if (unlikely(after64(new_snd_una, snd_nxt))) + 1061 : 41 : new_snd_una = old_snd_una; 1062 : : - 1063 [ - + ]: 836085 : new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd; + 1063 [ - + ]: 823170 : new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd; 1064 : : - 1065 [ + + ]: 836085 : if (after64(new_wnd_end, msk->wnd_end)) - 1066 : 210658 : WRITE_ONCE(msk->wnd_end, new_wnd_end); + 1065 [ + + ]: 823170 : if (after64(new_wnd_end, msk->wnd_end)) + 1066 : 240742 : WRITE_ONCE(msk->wnd_end, new_wnd_end); 1067 : : 1068 : : /* this assumes mptcp_incoming_options() is invoked after tcp_ack() */ - 1069 [ + + ]: 836085 : if (after64(msk->wnd_end, snd_nxt)) - 1070 : 803729 : __mptcp_check_push(sk, ssk); + 1069 [ + + ]: 823170 : if (after64(msk->wnd_end, snd_nxt)) + 1070 : 769522 : __mptcp_check_push(sk, ssk); 1071 : : - 1072 [ + + ]: 836085 : if (after64(new_snd_una, old_snd_una)) { - 1073 : 203480 : __mptcp_snd_una_update(msk, new_snd_una); - 1074 : 203480 : __mptcp_data_acked(sk); + 1072 [ + + ]: 823170 : if (after64(new_snd_una, old_snd_una)) { + 1073 : 229766 : __mptcp_snd_una_update(msk, new_snd_una); + 1074 : 229766 : __mptcp_data_acked(sk); 1075 : : } - 1076 : 836085 : msk->last_ack_recv = tcp_jiffies32; - 1077 : 836085 : mptcp_data_unlock(sk); + 1076 : 823170 : msk->last_ack_recv = tcp_jiffies32; + 1077 : 823170 : mptcp_data_unlock(sk); 1078 : : - 1079 : 836085 : trace_ack_update_msk(mp_opt->data_ack, + 1079 : 823170 : trace_ack_update_msk(mp_opt->data_ack, 1080 : : old_snd_una, new_snd_una, - 1081 : 836085 : new_wnd_end, READ_ONCE(msk->wnd_end)); - 1082 : 836085 : } + 1081 : 823170 : new_wnd_end, READ_ONCE(msk->wnd_end)); + 1082 : 823170 : } 1083 : : - 1084 : 6594 : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit) + 1084 : 8890 : 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 [ + + + + ]: 6594 : if (READ_ONCE(msk->rcv_data_fin)) + 1091 [ + + + + ]: 8890 : if (READ_ONCE(msk->rcv_data_fin)) 1092 : : return false; 1093 : : - 1094 [ + + ]: 2102 : WRITE_ONCE(msk->rcv_data_fin_seq, + 1094 [ + + ]: 2105 : WRITE_ONCE(msk->rcv_data_fin_seq, 1095 : : mptcp_expand_seq(READ_ONCE(msk->ack_seq), data_fin_seq, use_64bit)); - 1096 : 2102 : WRITE_ONCE(msk->rcv_data_fin, 1); + 1096 : 2105 : WRITE_ONCE(msk->rcv_data_fin, 1); 1097 : : - 1098 : 2102 : return true; + 1098 : 2105 : return true; 1099 : : } 1100 : : - 1101 : 690 : 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 : 690 : u64 hmac = 0; + 1104 : 692 : u64 hmac = 0; 1105 : : - 1106 [ + + ]: 690 : 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 : 849947 : bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) + 1120 : 836808 : bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) 1121 : : { - 1122 [ - + ]: 849947 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1123 [ - + ]: 849947 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 1124 : 849947 : struct mptcp_options_received mp_opt; - 1125 : 849947 : struct mptcp_ext *mpext; + 1122 [ - + ]: 836808 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1123 [ - + ]: 836808 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1124 : 836808 : struct mptcp_options_received mp_opt; + 1125 : 836808 : struct mptcp_ext *mpext; 1126 : : - 1127 [ + + ]: 849947 : if (__mptcp_check_fallback(msk)) { + 1127 [ + + ]: 836808 : 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 : 10500 : mptcp_data_lock(subflow->conn); - 1134 [ + - ]: 10500 : if (sk_stream_memory_free(sk)) - 1135 : 10500 : __mptcp_check_push(subflow->conn, sk); + 1133 : 10340 : mptcp_data_lock(subflow->conn); + 1134 [ + + ]: 10340 : if (sk_stream_memory_free(sk)) + 1135 : 10132 : __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 : 10500 : __mptcp_snd_una_update(msk, READ_ONCE(msk->snd_nxt)); + 1140 : 10340 : __mptcp_snd_una_update(msk, READ_ONCE(msk->snd_nxt)); 1141 : : - 1142 : 10500 : __mptcp_data_acked(subflow->conn); - 1143 : 10500 : mptcp_data_unlock(subflow->conn); - 1144 : 10500 : return true; + 1142 : 10340 : __mptcp_data_acked(subflow->conn); + 1143 : 10340 : mptcp_data_unlock(subflow->conn); + 1144 : 10340 : return true; 1145 : : } 1146 : : - 1147 : 839447 : mptcp_get_options(skb, &mp_opt); + 1147 : 826468 : 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 [ + + ]: 839447 : if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) - 1153 : 53 : return sk->sk_state != TCP_CLOSE; + 1152 [ + + ]: 826468 : if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) + 1153 : 51 : return sk->sk_state != TCP_CLOSE; 1154 : : - 1155 [ + + ]: 839394 : if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) { - 1156 [ + + ]: 5358 : 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 [ + + ]: 826417 : if (unlikely(mp_opt.suboptions != OPTION_MPTCP_DSS)) { + 1156 [ + + ]: 5291 : if ((mp_opt.suboptions & OPTION_MPTCP_FASTCLOSE) && + 1157 [ + + ]: 236 : READ_ONCE(msk->local_key) == mp_opt.rcvr_key) { + 1158 : 226 : WRITE_ONCE(msk->rcv_fastclose, true); + 1159 : 226 : mptcp_schedule_work((struct sock *)msk); + 1160 [ + - ]: 226 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX); 1161 : : } 1162 : : - 1163 [ + + + - ]: 6048 : if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) && - 1164 : 690 : add_addr_hmac_valid(msk, &mp_opt)) { - 1165 [ + + ]: 690 : if (!mp_opt.echo) { + 1163 [ + + + - ]: 5983 : 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 : 330 : mptcp_pm_add_addr_echoed(msk, &mp_opt.addr); - 1170 : 330 : mptcp_pm_del_add_timer(msk, &mp_opt.addr, true); - 1171 [ + - ]: 330 : 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 [ + + ]: 690 : 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 [ + + ]: 5358 : if (mp_opt.suboptions & OPTION_MPTCP_RM_ADDR) + 1178 [ + + ]: 5291 : if (mp_opt.suboptions & OPTION_MPTCP_RM_ADDR) 1179 : 106 : mptcp_pm_rm_addr_received(msk, &mp_opt.rm_list); 1180 : : - 1181 [ + + ]: 5358 : if (mp_opt.suboptions & OPTION_MPTCP_PRIO) { + 1181 [ + + ]: 5291 : 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 [ + + ]: 5358 : if (mp_opt.suboptions & OPTION_MPTCP_FAIL) { + 1186 [ + + ]: 5291 : if (mp_opt.suboptions & OPTION_MPTCP_FAIL) { 1187 : 6 : mptcp_pm_mp_fail_received(sk, mp_opt.fail_seq); 1188 [ + - ]: 6 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILRX); 1189 : : } 1190 : : - 1191 [ + + ]: 5358 : if (mp_opt.suboptions & OPTION_MPTCP_RST) { - 1192 : 238 : subflow->reset_seen = 1; - 1193 : 238 : subflow->reset_reason = mp_opt.reset_reason; - 1194 : 238 : subflow->reset_transient = mp_opt.reset_transient; - 1195 [ + - ]: 238 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX); + 1191 [ + + ]: 5291 : if (mp_opt.suboptions & OPTION_MPTCP_RST) { + 1192 : 228 : subflow->reset_seen = 1; + 1193 : 228 : subflow->reset_reason = mp_opt.reset_reason; + 1194 : 228 : subflow->reset_transient = mp_opt.reset_transient; + 1195 [ + - ]: 228 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPRSTRX); 1196 : : } 1197 : : - 1198 [ + + ]: 5358 : if (!(mp_opt.suboptions & OPTION_MPTCP_DSS)) + 1198 [ + + ]: 5291 : 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 [ + + ]: 836729 : if (mp_opt.use_ack) - 1206 : 836085 : ack_update_msk(msk, sk, &mp_opt); + 1205 [ + + ]: 823764 : if (mp_opt.use_ack) + 1206 : 823170 : 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 [ + + ]: 836729 : if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { - 1214 [ + + + - : 301103 : if (mp_opt.data_fin && mp_opt.data_len == 1 && - + + ] - 1215 : 5661 : mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) - 1216 : 2011 : mptcp_schedule_work((struct sock *)msk); + 1213 [ + + ]: 823764 : if (TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq) { + 1214 [ + + + - : 315771 : if (mp_opt.data_fin && mp_opt.data_len == 1 && + + + ] + 1215 : 7673 : mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64)) + 1216 : 2016 : mptcp_schedule_work((struct sock *)msk); 1217 : : - 1218 : 295442 : return true; + 1218 : 308098 : return true; 1219 : : } 1220 : : - 1221 : 541287 : mpext = skb_ext_add(skb, SKB_EXT_MPTCP); - 1222 [ - + ]: 541287 : if (!mpext) + 1221 : 515666 : mpext = skb_ext_add(skb, SKB_EXT_MPTCP); + 1222 [ - + ]: 515666 : if (!mpext) 1223 : : return true; 1224 : : - 1225 : 541287 : memset(mpext, 0, sizeof(*mpext)); + 1225 : 515666 : memset(mpext, 0, sizeof(*mpext)); 1226 : : - 1227 [ + + ]: 541287 : if (likely(mp_opt.use_map)) { - 1228 [ + + ]: 539406 : if (mp_opt.mpc_map) { + 1227 [ + + ]: 515666 : if (likely(mp_opt.use_map)) { + 1228 [ + + ]: 513784 : 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 : 644 : mptcp_crypto_key_sha(subflow->remote_key, NULL, + 1232 : 594 : mptcp_crypto_key_sha(subflow->remote_key, NULL, 1233 : : &mpext->data_seq); - 1234 : 644 : mpext->data_seq++; - 1235 : 644 : mpext->subflow_seq = 1; - 1236 : 644 : mpext->dsn64 = 1; - 1237 : 644 : mpext->mpc_map = 1; - 1238 : 644 : mpext->data_fin = 0; + 1234 : 594 : mpext->data_seq++; + 1235 : 594 : mpext->subflow_seq = 1; + 1236 : 594 : mpext->dsn64 = 1; + 1237 : 594 : mpext->mpc_map = 1; + 1238 : 594 : mpext->data_fin = 0; 1239 : : } else { - 1240 : 538762 : mpext->data_seq = mp_opt.data_seq; - 1241 : 538762 : mpext->subflow_seq = mp_opt.subflow_seq; - 1242 : 538762 : mpext->dsn64 = mp_opt.dsn64; - 1243 : 538762 : mpext->data_fin = mp_opt.data_fin; + 1240 : 513190 : mpext->data_seq = mp_opt.data_seq; + 1241 : 513190 : mpext->subflow_seq = mp_opt.subflow_seq; + 1242 : 513190 : mpext->dsn64 = mp_opt.dsn64; + 1243 : 513190 : mpext->data_fin = mp_opt.data_fin; 1244 : : } - 1245 : 539406 : mpext->data_len = mp_opt.data_len; - 1246 : 539406 : mpext->use_map = 1; - 1247 : 539406 : mpext->csum_reqd = !!(mp_opt.suboptions & OPTION_MPTCP_CSUMREQD); + 1245 : 513784 : mpext->data_len = mp_opt.data_len; + 1246 : 513784 : mpext->use_map = 1; + 1247 : 513784 : mpext->csum_reqd = !!(mp_opt.suboptions & OPTION_MPTCP_CSUMREQD); 1248 : : - 1249 [ + + ]: 539406 : if (mpext->csum_reqd) - 1250 : 1602 : mpext->csum = mp_opt.csum; + 1249 [ + + ]: 513784 : if (mpext->csum_reqd) + 1250 : 1605 : mpext->csum = mp_opt.csum; 1251 : : } 1252 : : 1253 : : return true; 1254 : : } 1255 : : - 1256 : 597858 : static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) + 1256 : 740674 : static void mptcp_set_rwin(struct tcp_sock *tp, struct tcphdr *th) 1257 : : { - 1258 : 597858 : const struct sock *ssk = (const struct sock *)tp; - 1259 : 597858 : struct mptcp_subflow_context *subflow; - 1260 : 597858 : u64 ack_seq, rcv_wnd_old, rcv_wnd_new; - 1261 : 597858 : struct mptcp_sock *msk; - 1262 : 597858 : u32 new_win; - 1263 : 597858 : u64 win; + 1258 : 740674 : const struct sock *ssk = (const struct sock *)tp; + 1259 : 740674 : struct mptcp_subflow_context *subflow; + 1260 : 740674 : u64 ack_seq, rcv_wnd_old, rcv_wnd_new; + 1261 : 740674 : struct mptcp_sock *msk; + 1262 : 740674 : u32 new_win; + 1263 : 740674 : u64 win; 1264 : : - 1265 [ - + ]: 597858 : subflow = mptcp_subflow_ctx(ssk); - 1266 [ - + ]: 597858 : msk = mptcp_sk(subflow->conn); + 1265 [ - + ]: 740674 : subflow = mptcp_subflow_ctx(ssk); + 1266 [ - + ]: 740674 : msk = mptcp_sk(subflow->conn); 1267 : : - 1268 : 597858 : ack_seq = READ_ONCE(msk->ack_seq); - 1269 : 597858 : rcv_wnd_new = ack_seq + tp->rcv_wnd; + 1268 : 740674 : ack_seq = READ_ONCE(msk->ack_seq); + 1269 : 740674 : rcv_wnd_new = ack_seq + tp->rcv_wnd; 1270 : : - 1271 [ + + ]: 597858 : rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent); - 1272 [ + + ]: 597858 : if (after64(rcv_wnd_new, rcv_wnd_old)) { - 1273 : 75 : u64 rcv_wnd; + 1271 [ + + ]: 740674 : rcv_wnd_old = atomic64_read(&msk->rcv_wnd_sent); + 1272 [ + + ]: 740674 : if (after64(rcv_wnd_new, rcv_wnd_old)) { + 1273 : 73 : u64 rcv_wnd; 1274 : : - 1275 : 238836 : for (;;) { - 1276 : 238911 : rcv_wnd = atomic64_cmpxchg(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); + 1275 : 263517 : for (;;) { + 1276 : 263590 : rcv_wnd = atomic64_cmpxchg(&msk->rcv_wnd_sent, rcv_wnd_old, rcv_wnd_new); 1277 : : - 1278 [ + + ]: 238836 : if (rcv_wnd == rcv_wnd_old) + 1278 [ + + ]: 263517 : if (rcv_wnd == rcv_wnd_old) 1279 : : break; 1280 : : - 1281 : 7 : rcv_wnd_old = rcv_wnd; - 1282 [ + + ]: 7 : if (before64(rcv_wnd_new, rcv_wnd_old)) { - 1283 [ # # ]: 2 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); - 1284 : 2 : goto raise_win; + 1281 : 5 : rcv_wnd_old = rcv_wnd; + 1282 [ - + ]: 5 : if (before64(rcv_wnd_new, rcv_wnd_old)) { + 1283 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICTUPDATE); + 1284 : 0 : goto raise_win; 1285 : : } - 1286 [ - + ]: 80 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); + 1286 [ - + ]: 78 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDCONFLICT); 1287 : : } - 1288 : 238829 : goto update_wspace; + 1288 : 263512 : goto update_wspace; 1289 : : } 1290 : : - 1291 [ + + ]: 359027 : if (rcv_wnd_new != rcv_wnd_old) { - 1292 : 54031 : raise_win: - 1293 : 54033 : win = rcv_wnd_old - ack_seq; - 1294 : 54033 : tp->rcv_wnd = min_t(u64, win, U32_MAX); - 1295 : 54033 : new_win = tp->rcv_wnd; + 1291 [ + + ]: 477162 : if (rcv_wnd_new != rcv_wnd_old) { + 1292 : 67747 : raise_win: + 1293 : 67747 : win = rcv_wnd_old - ack_seq; + 1294 : 67747 : tp->rcv_wnd = min_t(u64, win, U32_MAX); + 1295 : 67747 : new_win = tp->rcv_wnd; 1296 : : 1297 : : /* Make sure we do not exceed the maximum possible 1298 : : * scaled window. 1299 : : */ - 1300 [ + + ]: 54033 : if (unlikely(th->syn)) - 1301 : 477 : new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; - 1302 [ - + - - ]: 54033 : if (!tp->rx_opt.rcv_wscale && + 1300 [ + + ]: 67747 : if (unlikely(th->syn)) + 1301 : 480 : new_win = min(new_win, 65535U) << tp->rx_opt.rcv_wscale; + 1302 [ - + - - ]: 67747 : 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 : 54033 : new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); + 1306 : 67747 : new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale)); 1307 : : 1308 : : /* RFC1323 scaling applied */ - 1309 : 54033 : new_win >>= tp->rx_opt.rcv_wscale; - 1310 : 54033 : th->window = htons(new_win); - 1311 [ + - ]: 54033 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); + 1309 : 67747 : new_win >>= tp->rx_opt.rcv_wscale; + 1310 : 67747 : th->window = htons(new_win); + 1311 [ + - ]: 67747 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_RCVWNDSHARED); 1312 : : } 1313 : : - 1314 : 304996 : update_wspace: - 1315 : 597858 : WRITE_ONCE(msk->old_wspace, tp->rcv_wnd); - 1316 : 597858 : } + 1314 : 409415 : update_wspace: + 1315 : 740674 : WRITE_ONCE(msk->old_wspace, tp->rcv_wnd); + 1316 : 740674 : } 1317 : : - 1318 : 2008 : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum) + 1318 : 2006 : __sum16 __mptcp_make_csum(u64 data_seq, u32 subflow_seq, u16 data_len, __wsum sum) 1319 : : { - 1320 : 2008 : struct csum_pseudo_header header; - 1321 : 2008 : __wsum csum; + 1320 : 2006 : struct csum_pseudo_header header; + 1321 : 2006 : __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 : 2008 : header.data_seq = cpu_to_be64(data_seq); - 1329 : 2008 : header.subflow_seq = htonl(subflow_seq); - 1330 : 2008 : header.data_len = htons(data_len); - 1331 : 2008 : header.csum = 0; + 1328 : 2006 : header.data_seq = cpu_to_be64(data_seq); + 1329 : 2006 : header.subflow_seq = htonl(subflow_seq); + 1330 : 2006 : header.data_len = htons(data_len); + 1331 : 2006 : header.csum = 0; 1332 : : - 1333 : 2008 : csum = csum_partial(&header, sizeof(header), sum); - 1334 : 2008 : return csum_fold(csum); + 1333 : 2006 : csum = csum_partial(&header, sizeof(header), sum); + 1334 : 2006 : return csum_fold(csum); 1335 : : } 1336 : : - 1337 : 1877 : static __sum16 mptcp_make_csum(const struct mptcp_ext *mpext) + 1337 : 1870 : static __sum16 mptcp_make_csum(const struct mptcp_ext *mpext) 1338 : : { - 1339 : 3754 : return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len, - 1340 : 1877 : ~csum_unfold(mpext->csum)); + 1339 : 3740 : return __mptcp_make_csum(mpext->data_seq, mpext->subflow_seq, mpext->data_len, + 1340 : 1870 : ~csum_unfold(mpext->csum)); 1341 : : } 1342 : : 1343 : 0 : static void put_len_csum(u16 len, __sum16 csum, void *data) 1344 : : { - 1345 : 1884 : __sum16 *sumptr = data + 2; - 1346 : 1884 : __be16 *ptr = data; + 1345 : 1877 : __sum16 *sumptr = data + 2; + 1346 : 1877 : __be16 *ptr = data; 1347 : : - 1348 : 1884 : put_unaligned_be16(len, ptr); + 1348 : 1877 : put_unaligned_be16(len, ptr); 1349 : : - 1350 : 1884 : put_unaligned(csum, sumptr); - 1351 : 1884 : } + 1350 : 1877 : put_unaligned(csum, sumptr); + 1351 : 1877 : } 1352 : : - 1353 : 599907 : void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp, + 1353 : 742712 : void mptcp_write_options(struct tcphdr *th, __be32 *ptr, struct tcp_sock *tp, 1354 : : struct mptcp_out_options *opts) 1355 : : { - 1356 : 599907 : const struct sock *ssk = (const struct sock *)tp; - 1357 : 599907 : struct mptcp_subflow_context *subflow; + 1356 : 742712 : const struct sock *ssk = (const struct sock *)tp; + 1357 : 742712 : 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 [ + + ]: 599907 : if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { - 1382 : 593252 : struct mptcp_ext *mpext = &opts->ext_copy; - 1383 : 593252 : u8 len = TCPOLEN_MPTCP_DSS_BASE; - 1384 : 593252 : u8 flags = 0; + 1381 [ + + ]: 742712 : if (likely(OPTION_MPTCP_DSS & opts->suboptions)) { + 1382 : 736043 : struct mptcp_ext *mpext = &opts->ext_copy; + 1383 : 736043 : u8 len = TCPOLEN_MPTCP_DSS_BASE; + 1384 : 736043 : u8 flags = 0; 1385 : : - 1386 [ + - ]: 593252 : if (mpext->use_ack) { - 1387 : 593252 : flags = MPTCP_DSS_HAS_ACK; - 1388 [ + + ]: 593252 : if (mpext->ack64) { + 1386 [ + - ]: 736043 : if (mpext->use_ack) { + 1387 : 736043 : flags = MPTCP_DSS_HAS_ACK; + 1388 [ + + ]: 736043 : if (mpext->ack64) { 1389 : : len += TCPOLEN_MPTCP_DSS_ACK64; 1390 : : flags |= MPTCP_DSS_ACK64; 1391 : : } else { - 1392 : 30175 : len += TCPOLEN_MPTCP_DSS_ACK32; + 1392 : 29662 : len += TCPOLEN_MPTCP_DSS_ACK32; 1393 : : } 1394 : : } 1395 : : - 1396 [ + + ]: 593252 : if (mpext->use_map) { - 1397 : 298882 : len += TCPOLEN_MPTCP_DSS_MAP64; + 1396 [ + + ]: 736043 : if (mpext->use_map) { + 1397 : 431521 : 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 : 298882 : flags |= MPTCP_DSS_HAS_MAP | MPTCP_DSS_DSN64; - 1403 [ + + ]: 298882 : if (mpext->data_fin) - 1404 : 7654 : flags |= MPTCP_DSS_DATA_FIN; + 1402 : 431521 : flags |= MPTCP_DSS_HAS_MAP | MPTCP_DSS_DSN64; + 1403 [ + + ]: 431521 : if (mpext->data_fin) + 1404 : 10312 : flags |= MPTCP_DSS_DATA_FIN; 1405 : : - 1406 [ + + ]: 298882 : if (opts->csum_reqd) - 1407 : 1879 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; + 1406 [ + + ]: 431521 : if (opts->csum_reqd) + 1407 : 1872 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 1408 : : } 1409 : : - 1410 [ + - ]: 593252 : *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags); + 1410 [ + - ]: 736043 : *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags); 1411 : : - 1412 [ + - ]: 593252 : if (mpext->use_ack) { - 1413 [ + + ]: 593252 : if (mpext->ack64) { - 1414 : 563077 : put_unaligned_be64(mpext->data_ack, ptr); - 1415 : 563077 : ptr += 2; + 1412 [ + - ]: 736043 : if (mpext->use_ack) { + 1413 [ + + ]: 736043 : if (mpext->ack64) { + 1414 : 706381 : put_unaligned_be64(mpext->data_ack, ptr); + 1415 : 706381 : ptr += 2; 1416 : : } else { - 1417 : 30175 : put_unaligned_be32(mpext->data_ack32, ptr); - 1418 : 30175 : ptr += 1; + 1417 : 29662 : put_unaligned_be32(mpext->data_ack32, ptr); + 1418 : 29662 : ptr += 1; 1419 : : } 1420 : : } 1421 : : - 1422 [ + + ]: 593252 : if (mpext->use_map) { - 1423 [ + + ]: 298882 : put_unaligned_be64(mpext->data_seq, ptr); - 1424 : 298882 : ptr += 2; - 1425 [ + + ]: 298882 : put_unaligned_be32(mpext->subflow_seq, ptr); - 1426 : 298882 : ptr += 1; - 1427 [ + + ]: 298882 : if (opts->csum_reqd) { + 1422 [ + + ]: 736043 : if (mpext->use_map) { + 1423 [ + + ]: 431521 : put_unaligned_be64(mpext->data_seq, ptr); + 1424 : 431521 : ptr += 2; + 1425 [ + + ]: 431521 : put_unaligned_be32(mpext->subflow_seq, ptr); + 1426 : 431521 : ptr += 1; + 1427 [ + + ]: 431521 : 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 : 1879 : put_len_csum(mpext->data_len, - 1432 [ + + ]: 1879 : (mpext->data_len ? mptcp_make_csum(mpext) : 0), + 1431 : 1872 : put_len_csum(mpext->data_len, + 1432 [ + + ]: 1872 : (mpext->data_len ? mptcp_make_csum(mpext) : 0), 1433 : : ptr); 1434 : : } else { - 1435 : 297003 : put_unaligned_be32(mpext->data_len << 16 | - 1436 : 297003 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); + 1435 : 429649 : put_unaligned_be32(mpext->data_len << 16 | + 1436 : 429649 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); 1437 : : } - 1438 : 298882 : ptr += 1; + 1438 : 431521 : ptr += 1; 1439 : : } 1440 : : 1441 : : /* We might need to add MP_FAIL options in rare cases */ - 1442 [ + + ]: 593252 : if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) + 1442 [ + + ]: 736043 : if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) 1443 : 4 : goto mp_fail; - 1444 [ + + ]: 6655 : } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { - 1445 : 4031 : u8 len, flag = MPTCP_CAP_HMAC_SHA256; + 1444 [ + + ]: 6669 : } else if (OPTIONS_MPTCP_MPC & opts->suboptions) { + 1445 : 4060 : u8 len, flag = MPTCP_CAP_HMAC_SHA256; 1446 : : - 1447 [ + + ]: 4031 : if (OPTION_MPTCP_MPC_SYN & opts->suboptions) { + 1447 [ + + ]: 4060 : if (OPTION_MPTCP_MPC_SYN & opts->suboptions) { 1448 : : len = TCPOLEN_MPTCP_MPC_SYN; - 1449 [ + + ]: 2785 : } else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) { + 1449 [ + + ]: 2813 : } else if (OPTION_MPTCP_MPC_SYNACK & opts->suboptions) { 1450 : : len = TCPOLEN_MPTCP_MPC_SYNACK; - 1451 [ + + ]: 1641 : } else if (opts->data_len) { - 1452 : 559 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; - 1453 [ + + ]: 559 : if (opts->csum_reqd) + 1451 [ + + ]: 1667 : } else if (opts->data_len) { + 1452 : 584 : len = TCPOLEN_MPTCP_MPC_ACK_DATA; + 1453 [ + + ]: 584 : if (opts->csum_reqd) 1454 : 5 : len += TCPOLEN_MPTCP_DSS_CHECKSUM; 1455 : : } else { 1456 : : len = TCPOLEN_MPTCP_MPC_ACK; 1457 : : } 1458 : : - 1459 [ + + ]: 4031 : if (opts->csum_reqd) + 1459 [ + + ]: 4060 : if (opts->csum_reqd) 1460 : 31 : flag |= MPTCP_CAP_CHECKSUM_REQD; 1461 : : - 1462 [ + + ]: 4031 : if (!opts->allow_join_id0) + 1462 [ + + ]: 4060 : if (!opts->allow_join_id0) 1463 : 18 : flag |= MPTCP_CAP_DENY_JOIN_ID0; 1464 : : - 1465 [ + + ]: 4031 : *ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len, + 1465 [ + + ]: 4060 : *ptr++ = mptcp_option(MPTCPOPT_MP_CAPABLE, len, 1466 : : MPTCP_SUPPORTED_VERSION, 1467 : : flag); 1468 : : - 1469 : 4031 : if (!((OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & - 1470 [ + + ]: 4031 : opts->suboptions)) - 1471 : 1246 : goto mp_capable_done; + 1469 : 4060 : if (!((OPTION_MPTCP_MPC_SYNACK | OPTION_MPTCP_MPC_ACK) & + 1470 [ + + ]: 4060 : opts->suboptions)) + 1471 : 1247 : goto mp_capable_done; 1472 : : - 1473 [ + + ]: 2785 : put_unaligned_be64(opts->sndr_key, ptr); - 1474 : 2785 : ptr += 2; - 1475 [ + + ]: 2785 : if (!((OPTION_MPTCP_MPC_ACK) & opts->suboptions)) - 1476 : 1144 : goto mp_capable_done; + 1473 [ + + ]: 2813 : put_unaligned_be64(opts->sndr_key, ptr); + 1474 : 2813 : ptr += 2; + 1475 [ + + ]: 2813 : if (!((OPTION_MPTCP_MPC_ACK) & opts->suboptions)) + 1476 : 1146 : goto mp_capable_done; 1477 : : - 1478 [ + + ]: 1641 : put_unaligned_be64(opts->rcvr_key, ptr); - 1479 : 1641 : ptr += 2; - 1480 [ + + ]: 1641 : if (!opts->data_len) - 1481 : 1082 : goto mp_capable_done; + 1478 [ + + ]: 1667 : put_unaligned_be64(opts->rcvr_key, ptr); + 1479 : 1667 : ptr += 2; + 1480 [ + + ]: 1667 : if (!opts->data_len) + 1481 : 1083 : goto mp_capable_done; 1482 : : - 1483 [ + + ]: 559 : if (opts->csum_reqd) { + 1483 [ + + ]: 584 : if (opts->csum_reqd) { 1484 : 5 : put_len_csum(opts->data_len, 1485 : 5 : __mptcp_make_csum(opts->data_seq, 1486 : : opts->subflow_seq, @@ -1572,68 +1572,68 @@ 1488 : 5 : ~csum_unfold(opts->csum)), 1489 : : ptr); 1490 : : } else { - 1491 : 554 : put_unaligned_be32(opts->data_len << 16 | - 1492 : 554 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); + 1491 : 579 : put_unaligned_be32(opts->data_len << 16 | + 1492 : 579 : TCPOPT_NOP << 8 | TCPOPT_NOP, ptr); 1493 : : } - 1494 : 559 : ptr += 1; + 1494 : 584 : ptr += 1; 1495 : : 1496 : : /* MPC is additionally mutually exclusive with MP_PRIO */ - 1497 : 559 : goto mp_capable_done; - 1498 [ + + ]: 2624 : } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { - 1499 [ + + ]: 1435 : if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { - 1500 : 521 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1497 : 584 : goto mp_capable_done; + 1498 [ + + ]: 2609 : } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) { + 1499 [ + + ]: 1429 : if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { + 1500 : 517 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1501 : : TCPOLEN_MPTCP_MPJ_SYN, - 1502 : 521 : opts->backup, opts->join_id); - 1503 : 521 : put_unaligned_be32(opts->token, ptr); - 1504 : 521 : ptr += 1; - 1505 : 521 : put_unaligned_be32(opts->nonce, ptr); - 1506 : 521 : ptr += 1; - 1507 [ + + ]: 914 : } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { - 1508 : 466 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, + 1502 : 517 : opts->backup, opts->join_id); + 1503 : 517 : put_unaligned_be32(opts->token, ptr); + 1504 : 517 : ptr += 1; + 1505 : 517 : put_unaligned_be32(opts->nonce, ptr); + 1506 : 517 : ptr += 1; + 1507 [ + + ]: 912 : } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { + 1508 : 464 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1509 : : TCPOLEN_MPTCP_MPJ_SYNACK, - 1510 : 466 : opts->backup, opts->join_id); - 1511 : 466 : put_unaligned_be64(opts->thmac, ptr); - 1512 : 466 : ptr += 2; - 1513 : 466 : put_unaligned_be32(opts->nonce, ptr); - 1514 : 466 : ptr += 1; + 1510 : 464 : opts->backup, opts->join_id); + 1511 : 464 : put_unaligned_be64(opts->thmac, ptr); + 1512 : 464 : ptr += 2; + 1513 : 464 : put_unaligned_be32(opts->nonce, ptr); + 1514 : 464 : ptr += 1; 1515 : : } else { 1516 : 448 : *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, 1517 : : TCPOLEN_MPTCP_MPJ_ACK, 0, 0); 1518 : 448 : memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); 1519 : 448 : ptr += 5; 1520 : : } - 1521 [ + + ]: 1189 : } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { - 1522 : 754 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; - 1523 : 754 : u8 echo = MPTCP_ADDR_ECHO; + 1521 [ + + ]: 1180 : } 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 [ + + ]: 754 : 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 [ + + ]: 754 : if (opts->addr.port) + 1530 [ + + ]: 756 : if (opts->addr.port) 1531 : 68 : len += TCPOLEN_MPTCP_PORT_LEN; 1532 : : - 1533 [ + + ]: 754 : if (opts->ahmac) { + 1533 [ + + ]: 756 : if (opts->ahmac) { 1534 : 404 : len += sizeof(opts->ahmac); 1535 : 404 : echo = 0; 1536 : : } 1537 : : - 1538 : 754 : *ptr++ = mptcp_option(MPTCPOPT_ADD_ADDR, - 1539 [ + + ]: 754 : len, echo, opts->addr.id); - 1540 [ + + ]: 754 : if (opts->addr.family == AF_INET) { - 1541 : 585 : memcpy((u8 *)ptr, (u8 *)&opts->addr.addr.s_addr, 4); - 1542 : 585 : ptr += 1; + 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 [ + + ]: 754 : if (!opts->addr.port) { - 1552 [ + + ]: 686 : 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,18 +1658,18 @@ 1574 : 40 : ptr += 1; 1575 : : } 1576 : : } - 1577 [ + + ]: 435 : } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { + 1577 [ + + ]: 424 : } else if (unlikely(OPTION_MPTCP_FASTCLOSE & opts->suboptions)) { 1578 : : /* FASTCLOSE is mutually exclusive with others except RST */ - 1579 : 381 : *ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE, + 1579 : 367 : *ptr++ = mptcp_option(MPTCPOPT_MP_FASTCLOSE, 1580 : : TCPOLEN_MPTCP_FASTCLOSE, 1581 : : 0, 0); - 1582 [ + - ]: 381 : put_unaligned_be64(opts->rcvr_key, ptr); - 1583 : 381 : ptr += 2; + 1582 [ + - ]: 367 : put_unaligned_be64(opts->rcvr_key, ptr); + 1583 : 367 : ptr += 2; 1584 : : - 1585 [ + - ]: 381 : if (OPTION_MPTCP_RST & opts->suboptions) - 1586 : 381 : goto mp_rst; + 1585 [ + - ]: 367 : if (OPTION_MPTCP_RST & opts->suboptions) + 1586 : 367 : goto mp_rst; 1587 : : return; - 1588 [ + + ]: 54 : } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { + 1588 [ + + ]: 57 : } else if (unlikely(OPTION_MPTCP_FAIL & opts->suboptions)) { 1589 : 2 : mp_fail: 1590 : : /* MP_FAIL is mutually exclusive with others except RST */ 1591 [ + + ]: 6 : subflow = mptcp_subflow_ctx(ssk); @@ -1684,16 +1684,16 @@ 1600 [ + + ]: 6 : if (OPTION_MPTCP_RST & opts->suboptions) 1601 : 2 : goto mp_rst; 1602 : : return; - 1603 [ + - ]: 52 : } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { - 1604 : 52 : mp_rst: - 1605 : 435 : *ptr++ = mptcp_option(MPTCPOPT_RST, + 1603 [ + - ]: 55 : } else if (unlikely(OPTION_MPTCP_RST & opts->suboptions)) { + 1604 : 55 : mp_rst: + 1605 : 424 : *ptr++ = mptcp_option(MPTCPOPT_RST, 1606 : : TCPOLEN_MPTCP_RST, - 1607 : 435 : opts->reset_transient, - 1608 : 435 : opts->reset_reason); - 1609 : 435 : return; + 1607 : 424 : opts->reset_transient, + 1608 : 424 : opts->reset_reason); + 1609 : 424 : return; 1610 : : } 1611 : : - 1612 [ + + ]: 595437 : if (OPTION_MPTCP_PRIO & opts->suboptions) { + 1612 [ + + ]: 738224 : 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 : 595409 : mp_capable_done: - 1624 [ + + ]: 599468 : if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { + 1623 : 738196 : mp_capable_done: + 1624 [ + + ]: 742284 : 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 [ + + ]: 599468 : if (tp) - 1645 : 597858 : mptcp_set_rwin(tp, th); + 1644 [ + + ]: 742284 : if (tp) + 1645 : 740674 : 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-net/mptcp/pm.c.func-c.html b/html/lcov/export-net/mptcp/pm.c.func-c.html index aa327b53..f62a6a36 100644 --- a/html/lcov/export-net/mptcp/pm.c.func-c.html +++ b/html/lcov/export-net/mptcp/pm.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -151,7 +151,7 @@ mptcp_pm_add_addr_echoed - 330 + 332 @@ -165,54 +165,54 @@ mptcp_pm_allow_new_subflow - 450 + 452 mptcp_pm_addr_families_match - 554 + 556 - mptcp_pm_subflow_chk_stale + mptcp_pm_get_local_id - 679 + 713 - mptcp_pm_get_local_id + mptcp_pm_is_backup - 710 + 713 - mptcp_pm_is_backup + mptcp_pm_subflow_check_next - 710 + 733 - mptcp_pm_add_addr_signal + mptcp_pm_subflow_chk_stale - 754 + 737 - mptcp_pm_announce_addr + mptcp_pm_add_addr_signal - 754 + 756 - mptcp_pm_subflow_check_next + mptcp_pm_announce_addr 756 @@ -221,14 +221,14 @@ mptcp_pm_subflow_established - 886 + 890 mptcp_pm_schedule_work - 1242 + 1245 diff --git a/html/lcov/export-net/mptcp/pm.c.func.html b/html/lcov/export-net/mptcp/pm.c.func.html index 3e97eaa8..96c55d4f 100644 --- a/html/lcov/export-net/mptcp/pm.c.func.html +++ b/html/lcov/export-net/mptcp/pm.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -81,7 +81,7 @@ mptcp_pm_add_addr_echoed - 330 + 332 @@ -102,28 +102,28 @@ mptcp_pm_add_addr_signal - 754 + 756 mptcp_pm_addr_families_match - 554 + 556 mptcp_pm_allow_new_subflow - 450 + 452 mptcp_pm_announce_addr - 754 + 756 @@ -172,7 +172,7 @@ mptcp_pm_get_local_id - 710 + 713 @@ -186,7 +186,7 @@ mptcp_pm_is_backup - 710 + 713 @@ -235,7 +235,7 @@ mptcp_pm_schedule_work - 1242 + 1245 @@ -249,21 +249,21 @@ mptcp_pm_subflow_check_next - 756 + 733 mptcp_pm_subflow_chk_stale - 679 + 737 mptcp_pm_subflow_established - 886 + 890 diff --git a/html/lcov/export-net/mptcp/pm.c.gcov.html b/html/lcov/export-net/mptcp/pm.c.gcov.html index 992f9331..e3084191 100644 --- a/html/lcov/export-net/mptcp/pm.c.gcov.html +++ b/html/lcov/export-net/mptcp/pm.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -91,32 +91,32 @@ 13 : : 14 : : /* path manager command handlers */ 15 : : - 16 : 754 : int mptcp_pm_announce_addr(struct mptcp_sock *msk, + 16 : 756 : int mptcp_pm_announce_addr(struct mptcp_sock *msk, 17 : : const struct mptcp_addr_info *addr, 18 : : bool echo) 19 : : { - 20 : 754 : u8 add_addr = READ_ONCE(msk->pm.addr_signal); + 20 : 756 : u8 add_addr = READ_ONCE(msk->pm.addr_signal); 21 : : - 22 [ - + ]: 754 : pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo); + 22 [ - + ]: 756 : pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo); 23 : : - 24 [ + - - + ]: 754 : lockdep_assert_held(&msk->pm.lock); + 24 [ + - - + ]: 756 : lockdep_assert_held(&msk->pm.lock); 25 : : - 26 [ - + ]: 754 : if (add_addr & - 27 [ + + ]: 754 : (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { + 26 [ - + ]: 756 : if (add_addr & + 27 [ + + ]: 756 : (echo ? BIT(MPTCP_ADD_ADDR_ECHO) : BIT(MPTCP_ADD_ADDR_SIGNAL))) { 28 [ # # # # ]: 0 : MPTCP_INC_STATS(sock_net((struct sock *)msk), 29 : : echo ? MPTCP_MIB_ECHOADDTXDROP : MPTCP_MIB_ADDADDRTXDROP); 30 : 0 : return -EINVAL; 31 : : } 32 : : - 33 [ + + ]: 754 : if (echo) { - 34 : 350 : msk->pm.remote = *addr; - 35 : 350 : add_addr |= BIT(MPTCP_ADD_ADDR_ECHO); + 33 [ + + ]: 756 : if (echo) { + 34 : 352 : msk->pm.remote = *addr; + 35 : 352 : add_addr |= BIT(MPTCP_ADD_ADDR_ECHO); 36 : : } else { 37 : 404 : msk->pm.local = *addr; 38 : 404 : add_addr |= BIT(MPTCP_ADD_ADDR_SIGNAL); 39 : : } - 40 : 754 : WRITE_ONCE(msk->pm.addr_signal, add_addr); - 41 : 754 : return 0; + 40 : 756 : WRITE_ONCE(msk->pm.addr_signal, add_addr); + 41 : 756 : return 0; 42 : : } 43 : : 44 : 106 : int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list) @@ -150,13 +150,13 @@ 72 : 2202 : mptcp_event(MPTCP_EVENT_CREATED, msk, ssk, GFP_ATOMIC); 73 : 2202 : } 74 : : - 75 : 450 : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) + 75 : 452 : bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) 76 : : { - 77 : 450 : struct mptcp_pm_data *pm = &msk->pm; - 78 : 450 : unsigned int subflows_max; - 79 : 450 : int ret = 0; + 77 : 452 : struct mptcp_pm_data *pm = &msk->pm; + 78 : 452 : unsigned int subflows_max; + 79 : 452 : int ret = 0; 80 : : - 81 [ + + ]: 450 : if (mptcp_pm_is_userspace(msk)) { + 81 [ + + ]: 452 : if (mptcp_pm_is_userspace(msk)) { 82 [ + - ]: 22 : if (mptcp_userspace_pm_active(msk)) { 83 : 22 : spin_lock_bh(&pm->lock); 84 : 22 : pm->subflows++; @@ -166,40 +166,40 @@ 88 : : return false; 89 : : } 90 : : - 91 : 428 : subflows_max = mptcp_pm_get_subflows_max(msk); + 91 : 430 : subflows_max = mptcp_pm_get_subflows_max(msk); 92 : : - 93 [ - + - - ]: 428 : pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, + 93 [ - + - - ]: 430 : pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows, 94 : : subflows_max, READ_ONCE(pm->accept_subflow)); 95 : : 96 : : /* try to avoid acquiring the lock below */ - 97 [ - + - + ]: 428 : if (!READ_ONCE(pm->accept_subflow)) + 97 [ - + - + ]: 430 : if (!READ_ONCE(pm->accept_subflow)) 98 : : return false; 99 : : - 100 : 428 : spin_lock_bh(&pm->lock); - 101 [ + + + - ]: 428 : if (READ_ONCE(pm->accept_subflow)) { - 102 : 428 : ret = pm->subflows < subflows_max; - 103 [ - + + + ]: 428 : if (ret && ++pm->subflows == subflows_max) + 100 : 430 : spin_lock_bh(&pm->lock); + 101 [ + + + - ]: 430 : if (READ_ONCE(pm->accept_subflow)) { + 102 : 430 : ret = pm->subflows < subflows_max; + 103 [ - + + + ]: 430 : if (ret && ++pm->subflows == subflows_max) 104 : 182 : WRITE_ONCE(pm->accept_subflow, false); 105 : : } - 106 : 428 : spin_unlock_bh(&pm->lock); + 106 : 430 : spin_unlock_bh(&pm->lock); 107 : : - 108 : 428 : return ret; + 108 : 430 : return ret; 109 : : } 110 : : 111 : : /* return true if the new status bit is currently cleared, that is, this event 112 : : * can be server, eventually by an already scheduled work 113 : : */ - 114 : 1242 : static bool mptcp_pm_schedule_work(struct mptcp_sock *msk, + 114 : 1245 : static bool mptcp_pm_schedule_work(struct mptcp_sock *msk, 115 : : enum mptcp_pm_status new_status) 116 : : { - 117 [ - + - - ]: 1242 : pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status, + 117 [ - + - - ]: 1245 : pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status, 118 : : BIT(new_status)); - 119 [ + + + + ]: 1242 : if (msk->pm.status & BIT(new_status)) + 119 [ + + + + ]: 1245 : if (msk->pm.status & BIT(new_status)) 120 : : return false; 121 : : - 122 [ - + ]: 1105 : msk->pm.status |= BIT(new_status); - 123 : 1105 : mptcp_schedule_work((struct sock *)msk); - 124 : 1105 : return true; + 122 [ - + ]: 1108 : msk->pm.status |= BIT(new_status); + 123 : 1108 : mptcp_schedule_work((struct sock *)msk); + 124 : 1108 : return true; 125 : : } 126 : : 127 : 2136 : void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) @@ -233,58 +233,58 @@ 155 : : { 156 [ - + ]: 3572 : pr_debug("msk=%p\n", msk); 157 : : - 158 [ + + ]: 3572 : if (msk->token) - 159 : 2207 : mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); + 158 [ + + ]: 3572 : if (msk->token) + 159 : 2211 : mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); 160 : 3572 : } 161 : : - 162 : 886 : void mptcp_pm_subflow_established(struct mptcp_sock *msk) + 162 : 890 : void mptcp_pm_subflow_established(struct mptcp_sock *msk) 163 : : { - 164 : 886 : struct mptcp_pm_data *pm = &msk->pm; + 164 : 890 : struct mptcp_pm_data *pm = &msk->pm; 165 : : - 166 [ - + ]: 886 : pr_debug("msk=%p\n", msk); + 166 [ - + ]: 890 : pr_debug("msk=%p\n", msk); 167 : : - 168 [ + + + + ]: 886 : if (!READ_ONCE(pm->work_pending)) + 168 [ + + + + ]: 890 : if (!READ_ONCE(pm->work_pending)) 169 : : return; 170 : : - 171 : 204 : spin_lock_bh(&pm->lock); + 171 : 210 : spin_lock_bh(&pm->lock); 172 : : - 173 [ + + + - ]: 204 : if (READ_ONCE(pm->work_pending)) - 174 : 204 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); + 173 [ + + + - ]: 210 : if (READ_ONCE(pm->work_pending)) + 174 : 210 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 175 : : - 176 : 204 : spin_unlock_bh(&pm->lock); + 176 : 210 : spin_unlock_bh(&pm->lock); 177 : : } 178 : : - 179 : 756 : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, + 179 : 733 : void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, 180 : : const struct mptcp_subflow_context *subflow) 181 : : { - 182 : 756 : struct mptcp_pm_data *pm = &msk->pm; - 183 : 756 : bool update_subflows; + 182 : 733 : struct mptcp_pm_data *pm = &msk->pm; + 183 : 733 : bool update_subflows; 184 : : - 185 : 756 : update_subflows = subflow->request_join || subflow->mp_join; - 186 [ + + ]: 756 : if (mptcp_pm_is_userspace(msk)) { - 187 [ + + ]: 51 : if (update_subflows) { + 185 : 733 : update_subflows = subflow->request_join || subflow->mp_join; + 186 [ + + ]: 733 : if (mptcp_pm_is_userspace(msk)) { + 187 [ + + ]: 50 : if (update_subflows) { 188 : 39 : spin_lock_bh(&pm->lock); 189 : 39 : pm->subflows--; 190 : 39 : spin_unlock_bh(&pm->lock); 191 : : } - 192 : 51 : return; + 192 : 50 : return; 193 : : } 194 : : - 195 [ + + + + : 705 : if (!READ_ONCE(pm->work_pending) && !update_subflows) - + + ] + 195 [ + + + + : 683 : if (!READ_ONCE(pm->work_pending) && !update_subflows) + + + ] 196 : : return; 197 : : - 198 : 279 : spin_lock_bh(&pm->lock); - 199 [ + - ]: 279 : if (update_subflows) - 200 : 279 : __mptcp_pm_close_subflow(msk); + 198 : 274 : spin_lock_bh(&pm->lock); + 199 [ + - ]: 274 : if (update_subflows) + 200 : 274 : __mptcp_pm_close_subflow(msk); 201 : : 202 : : /* Even if this subflow is not really established, tell the PM to try 203 : : * to pick the next ones, if possible. 204 : : */ - 205 [ + + ]: 279 : if (mptcp_pm_nl_check_work_pending(msk)) - 206 : 78 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); + 205 [ + + ]: 274 : if (mptcp_pm_nl_check_work_pending(msk)) + 206 : 74 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 207 : : - 208 : 279 : spin_unlock_bh(&pm->lock); + 208 : 274 : spin_unlock_bh(&pm->lock); 209 : : } 210 : : 211 : 360 : void mptcp_pm_add_addr_received(const struct sock *ssk, @@ -314,30 +314,30 @@ + + ] 235 : 34 : mptcp_pm_announce_addr(msk, addr, true); 236 : 34 : mptcp_pm_add_addr_send_ack(msk); - 237 [ + + ]: 296 : } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { - 238 : 288 : pm->remote = *addr; + 237 [ + + ]: 296 : } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) { + 238 : 290 : pm->remote = *addr; 239 : : } else { - 240 [ + - ]: 8 : __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); + 240 [ + - ]: 6 : __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP); 241 : : } 242 : : 243 : 360 : spin_unlock_bh(&pm->lock); 244 : 360 : } 245 : : - 246 : 330 : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, + 246 : 332 : void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, 247 : : const struct mptcp_addr_info *addr) 248 : : { - 249 : 330 : struct mptcp_pm_data *pm = &msk->pm; + 249 : 332 : struct mptcp_pm_data *pm = &msk->pm; 250 : : - 251 [ - + ]: 330 : pr_debug("msk=%p\n", msk); + 251 [ - + ]: 332 : pr_debug("msk=%p\n", msk); 252 : : - 253 : 330 : spin_lock_bh(&pm->lock); + 253 : 332 : spin_lock_bh(&pm->lock); 254 : : - 255 [ + + + + : 330 : if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) - + + ] - 256 : 84 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); + 255 [ + + + + : 332 : if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) + + + ] + 256 : 85 : mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); 257 : : - 258 : 330 : spin_unlock_bh(&pm->lock); - 259 : 330 : } + 258 : 332 : spin_unlock_bh(&pm->lock); + 259 : 332 : } 260 : : 261 : 122 : void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk) 262 : : { @@ -404,52 +404,52 @@ 323 : : 324 : : /* path manager helpers */ 325 : : - 326 : 754 : bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb, + 326 : 756 : bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, const struct sk_buff *skb, 327 : : unsigned int opt_size, unsigned int remaining, 328 : : struct mptcp_addr_info *addr, bool *echo, 329 : : bool *drop_other_suboptions) 330 : : { - 331 : 754 : int ret = false; - 332 : 754 : u8 add_addr; - 333 : 754 : u8 family; - 334 : 754 : bool port; + 331 : 756 : int ret = false; + 332 : 756 : u8 add_addr; + 333 : 756 : u8 family; + 334 : 756 : bool port; 335 : : - 336 : 754 : spin_lock_bh(&msk->pm.lock); + 336 : 756 : spin_lock_bh(&msk->pm.lock); 337 : : 338 : : /* double check after the lock is acquired */ - 339 [ - + ]: 754 : if (!mptcp_pm_should_add_signal(msk)) + 339 [ - + ]: 756 : if (!mptcp_pm_should_add_signal(msk)) 340 : 0 : goto out_unlock; 341 : : 342 : : /* always drop every other options for pure ack ADD_ADDR; this is a 343 : : * plain dup-ack from TCP perspective. The other MPTCP-relevant info, 344 : : * if any, will be carried by the 'original' TCP ack 345 : : */ - 346 [ + - + - ]: 754 : if (skb && skb_is_tcp_pure_ack(skb)) { - 347 : 754 : remaining += opt_size; - 348 : 754 : *drop_other_suboptions = true; + 346 [ + - + - ]: 756 : if (skb && skb_is_tcp_pure_ack(skb)) { + 347 : 756 : remaining += opt_size; + 348 : 756 : *drop_other_suboptions = true; 349 : : } 350 : : - 351 [ + + ]: 754 : *echo = mptcp_pm_should_add_signal_echo(msk); - 352 [ + + + + ]: 754 : port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); + 351 [ + + ]: 756 : *echo = mptcp_pm_should_add_signal_echo(msk); + 352 [ + + + + ]: 756 : port = !!(*echo ? msk->pm.remote.port : msk->pm.local.port); 353 : : - 354 [ + + + + ]: 754 : family = *echo ? msk->pm.remote.family : msk->pm.local.family; - 355 [ + + + + : 1508 : if (remaining < mptcp_add_addr_len(family, *echo, port)) - - + ] + 354 [ + + + + ]: 756 : family = *echo ? msk->pm.remote.family : msk->pm.local.family; + 355 [ + + + + : 1512 : if (remaining < mptcp_add_addr_len(family, *echo, port)) + - + ] 356 : 0 : goto out_unlock; 357 : : - 358 [ + + + + ]: 754 : if (*echo) { - 359 : 350 : *addr = msk->pm.remote; - 360 : 350 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); + 358 [ + + + + ]: 756 : if (*echo) { + 359 : 352 : *addr = msk->pm.remote; + 360 : 352 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_ECHO); 361 : : } else { 362 : 404 : *addr = msk->pm.local; 363 : 404 : add_addr = msk->pm.addr_signal & ~BIT(MPTCP_ADD_ADDR_SIGNAL); 364 : : } - 365 : 754 : WRITE_ONCE(msk->pm.addr_signal, add_addr); - 366 : 754 : ret = true; + 365 : 756 : WRITE_ONCE(msk->pm.addr_signal, add_addr); + 366 : 756 : ret = true; 367 : : - 368 : 754 : out_unlock: - 369 : 754 : spin_unlock_bh(&msk->pm.lock); - 370 : 754 : return ret; + 368 : 756 : out_unlock: + 369 : 756 : spin_unlock_bh(&msk->pm.lock); + 370 : 756 : return ret; 371 : : } 372 : : 373 : 106 : bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, @@ -482,37 +482,37 @@ 400 : 106 : return ret; 401 : : } 402 : : - 403 : 710 : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) + 403 : 713 : int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) 404 : : { - 405 : 710 : struct mptcp_addr_info skc_local; - 406 : 710 : struct mptcp_addr_info msk_local; + 405 : 713 : struct mptcp_addr_info skc_local; + 406 : 713 : struct mptcp_addr_info msk_local; 407 : : - 408 [ - + ]: 710 : if (WARN_ON_ONCE(!msk)) + 408 [ - + ]: 713 : if (WARN_ON_ONCE(!msk)) 409 : 0 : return -1; 410 : : 411 : : /* The 0 ID mapping is defined by the first subflow, copied into the msk 412 : : * addr 413 : : */ - 414 : 710 : mptcp_local_address((struct sock_common *)msk, &msk_local); - 415 : 710 : mptcp_local_address((struct sock_common *)skc, &skc_local); - 416 [ + + ]: 710 : if (mptcp_addresses_equal(&msk_local, &skc_local, false)) + 414 : 713 : mptcp_local_address((struct sock_common *)msk, &msk_local); + 415 : 713 : mptcp_local_address((struct sock_common *)skc, &skc_local); + 416 [ + + ]: 713 : if (mptcp_addresses_equal(&msk_local, &skc_local, false)) 417 : : return 0; 418 : : - 419 [ + + ]: 382 : if (mptcp_pm_is_userspace(msk)) + 419 [ + + ]: 385 : if (mptcp_pm_is_userspace(msk)) 420 : 22 : return mptcp_userspace_pm_get_local_id(msk, &skc_local); - 421 : 360 : return mptcp_pm_nl_get_local_id(msk, &skc_local); + 421 : 363 : return mptcp_pm_nl_get_local_id(msk, &skc_local); 422 : : } 423 : : - 424 : 710 : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) + 424 : 713 : bool mptcp_pm_is_backup(struct mptcp_sock *msk, struct sock_common *skc) 425 : : { - 426 : 710 : struct mptcp_addr_info skc_local; + 426 : 713 : struct mptcp_addr_info skc_local; 427 : : - 428 : 710 : mptcp_local_address((struct sock_common *)skc, &skc_local); + 428 : 713 : mptcp_local_address((struct sock_common *)skc, &skc_local); 429 : : - 430 [ + + ]: 710 : if (mptcp_pm_is_userspace(msk)) + 430 [ + + ]: 713 : if (mptcp_pm_is_userspace(msk)) 431 : 26 : return mptcp_userspace_pm_is_backup(msk, &skc_local); 432 : : - 433 : 684 : return mptcp_pm_nl_is_backup(msk, &skc_local); + 433 : 687 : return mptcp_pm_nl_is_backup(msk, &skc_local); 434 : : } 435 : : 436 : 28 : int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) @@ -538,45 +538,45 @@ 456 : 46 : return mptcp_pm_nl_set_flags(skb, info); 457 : : } 458 : : - 459 : 679 : void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) + 459 : 737 : void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) 460 : : { - 461 [ - + ]: 679 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 462 [ - + ]: 679 : u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp); + 461 [ - + ]: 737 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 462 [ - + ]: 737 : u32 rcv_tstamp = READ_ONCE(tcp_sk(ssk)->rcv_tstamp); 463 : : 464 : : /* keep track of rtx periods with no progress */ - 465 [ + + ]: 679 : if (!subflow->stale_count) { - 466 : 270 : subflow->stale_rcv_tstamp = rcv_tstamp; - 467 : 270 : subflow->stale_count++; - 468 [ + + ]: 409 : } else if (subflow->stale_rcv_tstamp == rcv_tstamp) { + 465 [ + + ]: 737 : if (!subflow->stale_count) { + 466 : 289 : subflow->stale_rcv_tstamp = rcv_tstamp; + 467 : 289 : subflow->stale_count++; + 468 [ + + ]: 448 : } else if (subflow->stale_rcv_tstamp == rcv_tstamp) { 469 [ + - ]: 277 : if (subflow->stale_count < U8_MAX) 470 : 277 : subflow->stale_count++; 471 : 277 : mptcp_pm_nl_subflow_chk_stale(msk, ssk); 472 : : } else { - 473 : 132 : subflow->stale_count = 0; - 474 : 132 : mptcp_subflow_set_active(subflow); + 473 : 171 : subflow->stale_count = 0; + 474 : 171 : mptcp_subflow_set_active(subflow); 475 : : } - 476 : 679 : } + 476 : 737 : } 477 : : 478 : : /* if sk is ipv4 or ipv6_only allows only same-family local and remote addresses, 479 : : * otherwise allow any matching local/remote pair 480 : : */ - 481 : 554 : bool mptcp_pm_addr_families_match(const struct sock *sk, + 481 : 556 : bool mptcp_pm_addr_families_match(const struct sock *sk, 482 : : const struct mptcp_addr_info *loc, 483 : : const struct mptcp_addr_info *rem) 484 : : { - 485 : 554 : bool mptcp_is_v4 = sk->sk_family == AF_INET; + 485 : 556 : bool mptcp_is_v4 = sk->sk_family == AF_INET; 486 : : 487 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 488 [ + + + + ]: 554 : bool loc_is_v4 = loc->family == AF_INET || ipv6_addr_v4mapped(&loc->addr6); - 489 [ + + + + ]: 554 : bool rem_is_v4 = rem->family == AF_INET || ipv6_addr_v4mapped(&rem->addr6); + 488 [ + + + + ]: 556 : bool loc_is_v4 = loc->family == AF_INET || ipv6_addr_v4mapped(&loc->addr6); + 489 [ + + + + ]: 556 : bool rem_is_v4 = rem->family == AF_INET || ipv6_addr_v4mapped(&rem->addr6); 490 : : - 491 [ + + ]: 554 : if (mptcp_is_v4) + 491 [ + + ]: 556 : if (mptcp_is_v4) 492 : 430 : return loc_is_v4 && rem_is_v4; 493 : : - 494 [ - + ]: 124 : if (ipv6_only_sock(sk)) + 494 [ - + ]: 126 : if (ipv6_only_sock(sk)) 495 : 0 : return !loc_is_v4 && !rem_is_v4; 496 : : - 497 : 124 : return loc_is_v4 == rem_is_v4; + 497 : 126 : return loc_is_v4 == rem_is_v4; 498 : : #else 499 : : return mptcp_is_v4 && loc->family == AF_INET && rem->family == AF_INET; 500 : : #endif diff --git a/html/lcov/export-net/mptcp/pm_netlink.c.func-c.html b/html/lcov/export-net/mptcp/pm_netlink.c.func-c.html index cace49d2..9a2d1444 100644 --- a/html/lcov/export-net/mptcp/pm_netlink.c.func-c.html +++ b/html/lcov/export-net/mptcp/pm_netlink.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 61.5 % + 61.6 % 1032 - 635 + 636 @@ -319,28 +319,28 @@ fill_local_addresses_vec - 270 + 272 mptcp_pm_nl_subflow_chk_stale - 279 + 277 lookup_subflow_by_daddr - 288 + 290 mptcp_pm_nl_add_addr_received - 288 + 290 @@ -368,7 +368,7 @@ mptcp_pm_nl_get_local_id - 360 + 363 @@ -389,7 +389,7 @@ mptcp_pm_del_add_timer - 460 + 462 @@ -417,49 +417,49 @@ mptcp_pm_create_subflow_or_signal_addr - 663 + 665 mptcp_pm_nl_is_backup - 684 + 687 mptcp_pm_nl_addr_send_ack - 860 + 862 mptcp_pm_send_ack - 861 + 867 - __mptcp_pm_send_ack + pm_nl_exit_net - 883 + 885 - pm_nl_exit_net + __mptcp_pm_send_ack - 893 + 889 mptcp_pm_nl_check_work_pending - 942 + 939 @@ -494,7 +494,7 @@ mptcp_lookup_anno_list_by_saddr - 1134 + 1138 @@ -536,7 +536,7 @@ __lookup_addr - 1444 + 1450 @@ -564,7 +564,7 @@ mptcp_local_address - 3153 + 3163 @@ -578,63 +578,63 @@ mptcp_pm_get_add_addr_signal_max - 4349 + 4314 mptcp_pm_get_add_addr_accept_max - 4525 + 4490 mptcp_pm_get_local_addr_max - 4525 + 4490 mptcp_pm_get_subflows_max - 5269 + 5233 mptcp_event - 7792 + 7797 mptcp_addresses_equal - 8589 + 8651 mptcp_pm_nl_work - 9341 + 11654 pm_nl_get_pernet_from_msk - 12530 + 12516 pm_nl_get_pernet - 15136 + 15023 diff --git a/html/lcov/export-net/mptcp/pm_netlink.c.func.html b/html/lcov/export-net/mptcp/pm_netlink.c.func.html index 764fb49b..8f230526 100644 --- a/html/lcov/export-net/mptcp/pm_netlink.c.func.html +++ b/html/lcov/export-net/mptcp/pm_netlink.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 61.5 % + 61.6 % 1032 - 635 + 636 @@ -88,7 +88,7 @@ __lookup_addr - 1444 + 1450 @@ -116,14 +116,14 @@ __mptcp_pm_send_ack - 883 + 889 fill_local_addresses_vec - 270 + 272 @@ -144,21 +144,21 @@ lookup_subflow_by_daddr - 288 + 290 mptcp_addresses_equal - 8589 + 8651 mptcp_event - 7792 + 7797 @@ -214,14 +214,14 @@ mptcp_local_address - 3153 + 3163 mptcp_lookup_anno_list_by_saddr - 1134 + 1138 @@ -298,14 +298,14 @@ mptcp_pm_create_subflow_or_signal_addr - 663 + 665 mptcp_pm_del_add_timer - 460 + 462 @@ -326,28 +326,28 @@ mptcp_pm_get_add_addr_accept_max - 4525 + 4490 mptcp_pm_get_add_addr_signal_max - 4349 + 4314 mptcp_pm_get_local_addr_max - 4525 + 4490 mptcp_pm_get_subflows_max - 5269 + 5233 @@ -368,14 +368,14 @@ mptcp_pm_nl_add_addr_received - 288 + 290 mptcp_pm_nl_addr_send_ack - 860 + 862 @@ -389,7 +389,7 @@ mptcp_pm_nl_check_work_pending - 942 + 939 @@ -459,7 +459,7 @@ mptcp_pm_nl_get_local_id - 360 + 363 @@ -473,7 +473,7 @@ mptcp_pm_nl_is_backup - 684 + 687 @@ -522,14 +522,14 @@ mptcp_pm_nl_subflow_chk_stale - 279 + 277 mptcp_pm_nl_work - 9341 + 11654 @@ -564,7 +564,7 @@ mptcp_pm_send_ack - 861 + 867 @@ -599,21 +599,21 @@ pm_nl_exit_net - 893 + 885 pm_nl_get_pernet - 15136 + 15023 pm_nl_get_pernet_from_msk - 12530 + 12516 diff --git a/html/lcov/export-net/mptcp/pm_netlink.c.gcov.html b/html/lcov/export-net/mptcp/pm_netlink.c.gcov.html index 23ec7d4e..0bcc07ac 100644 --- a/html/lcov/export-net/mptcp/pm_netlink.c.gcov.html +++ b/html/lcov/export-net/mptcp/pm_netlink.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 61.5 % + 61.6 % 1032 - 635 + 636 @@ -121,67 +121,67 @@ 43 : : #define MPTCP_PM_ADDR_MAX 8 44 : : #define ADD_ADDR_RETRANS_MAX 3 45 : : - 46 : 15136 : static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) + 46 : 15023 : static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) 47 : : { - 48 : 28948 : return net_generic(net, pm_nl_pernet_id); + 48 : 28823 : return net_generic(net, pm_nl_pernet_id); 49 : : } 50 : : 51 : : static struct pm_nl_pernet * - 52 : 12530 : pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) + 52 : 12516 : pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) 53 : : { - 54 : 24748 : return pm_nl_get_pernet(sock_net((struct sock *)msk)); + 54 : 24625 : return pm_nl_get_pernet(sock_net((struct sock *)msk)); 55 : : } 56 : : - 57 : 8589 : bool mptcp_addresses_equal(const struct mptcp_addr_info *a, + 57 : 8651 : bool mptcp_addresses_equal(const struct mptcp_addr_info *a, 58 : : const struct mptcp_addr_info *b, bool use_port) 59 : : { - 60 : 8589 : bool addr_equals = false; + 60 : 8651 : bool addr_equals = false; 61 : : - 62 [ + + ]: 8589 : if (a->family == b->family) { - 63 [ + + ]: 7220 : if (a->family == AF_INET) - 64 : 6221 : addr_equals = a->addr.s_addr == b->addr.s_addr; + 62 [ + + ]: 8651 : if (a->family == b->family) { + 63 [ + + ]: 7257 : if (a->family == AF_INET) + 64 : 6234 : addr_equals = a->addr.s_addr == b->addr.s_addr; 65 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 66 : : else - 67 : 999 : addr_equals = !ipv6_addr_cmp(&a->addr6, &b->addr6); - 68 [ + + ]: 1369 : } else if (a->family == AF_INET) { - 69 [ + + ]: 970 : if (ipv6_addr_v4mapped(&b->addr6)) - 70 : 672 : addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3]; - 71 [ + - ]: 399 : } else if (b->family == AF_INET) { - 72 [ + + ]: 399 : if (ipv6_addr_v4mapped(&a->addr6)) + 67 : 1023 : addr_equals = !ipv6_addr_cmp(&a->addr6, &b->addr6); + 68 [ + + ]: 1394 : } else if (a->family == AF_INET) { + 69 [ + + ]: 988 : if (ipv6_addr_v4mapped(&b->addr6)) + 70 : 676 : addr_equals = a->addr.s_addr == b->addr6.s6_addr32[3]; + 71 [ + - ]: 406 : } else if (b->family == AF_INET) { + 72 [ + + ]: 406 : if (ipv6_addr_v4mapped(&a->addr6)) 73 : 182 : addr_equals = a->addr6.s6_addr32[3] == b->addr.s_addr; 74 : : #endif 75 : : } 76 : : - 77 [ + + ]: 8074 : if (!addr_equals) + 77 [ + + ]: 8115 : if (!addr_equals) 78 : : return false; - 79 [ + + ]: 1944 : if (!use_port) + 79 [ + + ]: 1954 : if (!use_port) 80 : : return true; 81 : : - 82 : 834 : return a->port == b->port; + 82 : 838 : return a->port == b->port; 83 : : } 84 : : - 85 : 3153 : void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) + 85 : 3163 : void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) 86 : : { - 87 : 3153 : addr->family = skc->skc_family; - 88 : 3153 : addr->port = htons(skc->skc_num); - 89 [ + + ]: 3153 : if (addr->family == AF_INET) - 90 : 1410 : addr->addr.s_addr = skc->skc_rcv_saddr; + 87 : 3163 : addr->family = skc->skc_family; + 88 : 3163 : addr->port = htons(skc->skc_num); + 89 [ + + ]: 3163 : if (addr->family == AF_INET) + 90 : 1414 : addr->addr.s_addr = skc->skc_rcv_saddr; 91 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 92 [ + - ]: 1743 : else if (addr->family == AF_INET6) - 93 : 1743 : addr->addr6 = skc->skc_v6_rcv_saddr; + 92 [ + - ]: 1749 : else if (addr->family == AF_INET6) + 93 : 1749 : addr->addr6 = skc->skc_v6_rcv_saddr; 94 : : #endif - 95 : 3153 : } + 95 : 3163 : } 96 : : 97 : 0 : static void remote_address(const struct sock_common *skc, 98 : : struct mptcp_addr_info *addr) 99 : : { - 100 : 778 : addr->family = skc->skc_family; - 101 : 778 : addr->port = skc->skc_dport; - 102 : 778 : if (addr->family == AF_INET) - 103 : 593 : 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 [ - - - - : 185 : else if (addr->family == AF_INET6) - + - + - + + 105 [ - - - - : 194 : else if (addr->family == AF_INET6) + + - + - + - ] 106 : 0 : addr->addr6 = skc->skc_v6_daddr; 107 : : #endif @@ -194,32 +194,32 @@ 114 : 102 : struct mptcp_addr_info cur; 115 : 102 : struct sock_common *skc; 116 : : - 117 [ + + ]: 223 : list_for_each_entry(subflow, list, node) { - 118 : 199 : skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow); + 117 [ + + ]: 222 : list_for_each_entry(subflow, list, node) { + 118 : 198 : skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow); 119 : : - 120 : 199 : mptcp_local_address(skc, &cur); - 121 [ + + ]: 199 : if (mptcp_addresses_equal(&cur, saddr, saddr->port)) + 120 : 198 : mptcp_local_address(skc, &cur); + 121 [ + + ]: 198 : if (mptcp_addresses_equal(&cur, saddr, saddr->port)) 122 : : return true; 123 : : } 124 : : 125 : : return false; 126 : : } 127 : : - 128 : 288 : 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 : 288 : struct mptcp_subflow_context *subflow; - 132 : 288 : struct mptcp_addr_info cur; + 131 : 290 : struct mptcp_subflow_context *subflow; + 132 : 290 : struct mptcp_addr_info cur; 133 : : - 134 [ + + ]: 758 : list_for_each_entry(subflow, list, node) { - 135 : 488 : 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 [ + + + + ]: 488 : 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 [ + + ]: 484 : remote_address((struct sock_common *)ssk, &cur); - 142 [ + + ]: 484 : 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 : 4373 : unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) + 209 : 4338 : unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) 210 : : { - 211 : 4349 : const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 211 : 4314 : const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 212 : : - 213 : 5012 : return READ_ONCE(pernet->add_addr_signal_max); + 213 : 4979 : return READ_ONCE(pernet->add_addr_signal_max); 214 : : } 215 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_signal_max); 216 : : - 217 : 4442 : unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) + 217 : 4408 : unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) 218 : : { - 219 : 4442 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 219 : 4408 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 220 : : - 221 : 4774 : return READ_ONCE(pernet->add_addr_accept_max); + 221 : 4742 : return READ_ONCE(pernet->add_addr_accept_max); 222 : : } 223 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_accept_max); 224 : : - 225 : 5168 : unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) + 225 : 5133 : unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) 226 : : { - 227 : 5168 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 227 : 5133 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 228 : : - 229 : 7507 : return READ_ONCE(pernet->subflows_max); + 229 : 7475 : return READ_ONCE(pernet->subflows_max); 230 : : } 231 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_subflows_max); 232 : : - 233 : 4549 : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) + 233 : 4514 : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) 234 : : { - 235 : 4525 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 235 : 4490 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 236 : : - 237 : 5188 : return READ_ONCE(pernet->local_addr_max); + 237 : 5155 : return READ_ONCE(pernet->local_addr_max); 238 : : } 239 : : EXPORT_SYMBOL_GPL(mptcp_pm_get_local_addr_max); 240 : : - 241 : 942 : bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) + 241 : 939 : bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) 242 : : { - 243 : 942 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 243 : 939 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); 244 : : - 245 [ + + + + ]: 1666 : if (msk->pm.subflows == mptcp_pm_get_subflows_max(msk) || - 246 [ + - ]: 754 : (find_next_and_bit(pernet->id_bitmap, msk->pm.id_avail_bitmap, + 245 [ + + + + ]: 1658 : if (msk->pm.subflows == mptcp_pm_get_subflows_max(msk) || + 246 [ + - ]: 749 : (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 : 704 : WRITE_ONCE(msk->pm.work_pending, false); - 249 : 704 : return false; + 248 : 702 : WRITE_ONCE(msk->pm.work_pending, false); + 249 : 702 : return false; 250 : : } 251 : : return true; 252 : : } 253 : : 254 : : struct mptcp_pm_add_entry * - 255 : 1134 : 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 : 1134 : struct mptcp_pm_add_entry *entry; + 258 : 1138 : struct mptcp_pm_add_entry *entry; 259 : : - 260 [ + - - + ]: 1134 : 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 : 460 : 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 : 460 : struct mptcp_pm_add_entry *entry; - 340 : 460 : struct sock *sk = (struct sock *)msk; - 341 : 460 : 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 : 460 : spin_lock_bh(&msk->pm.lock); - 344 : 460 : entry = mptcp_lookup_anno_list_by_saddr(msk, addr); - 345 [ + + + + : 460 : if (entry && (!check_id || entry->addr.id == addr->id)) { - + + ] - 346 : 392 : entry->retrans_times = ADD_ADDR_RETRANS_MAX; - 347 : 392 : 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 [ + + ]: 460 : if (!check_id && entry) + 349 [ + + ]: 462 : if (!check_id && entry) 350 : 78 : list_del(&entry->list); - 351 : 460 : 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 [ + + ]: 460 : if (add_timer) - 355 : 392 : sk_stop_timer_sync(sk, add_timer); + 354 [ + + ]: 462 : if (add_timer) + 355 : 394 : sk_stop_timer_sync(sk, add_timer); 356 : : - 357 : 460 : return entry; + 357 : 462 : return entry; 358 : : } 359 : : 360 : 344 : bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, @@ -570,33 +570,33 @@ 480 : 232 : return i; 481 : : } 482 : : - 483 : 883 : static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, + 483 : 889 : static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, 484 : : bool prio, bool backup) 485 : : { - 486 [ - + ]: 883 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 487 : 883 : bool slow; + 486 [ - + ]: 889 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 487 : 889 : bool slow; 488 : : - 489 [ - + - - : 883 : pr_debug("send ack for %s\n", + 489 [ - + - - : 889 : pr_debug("send ack for %s\n", - - ] 490 : : prio ? "mp_prio" : (mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr")); 491 : : - 492 : 883 : slow = lock_sock_fast(ssk); - 493 [ + + ]: 883 : if (prio) { + 492 : 889 : slow = lock_sock_fast(ssk); + 493 [ + + ]: 889 : if (prio) { 494 : 28 : subflow->send_mp_prio = 1; 495 : 28 : subflow->request_bkup = backup; 496 : : } 497 : : - 498 : 883 : __mptcp_subflow_send_ack(ssk); - 499 : 883 : unlock_sock_fast(ssk, slow); - 500 : 883 : } + 498 : 889 : __mptcp_subflow_send_ack(ssk); + 499 : 889 : unlock_sock_fast(ssk, slow); + 500 : 889 : } 501 : : - 502 : 861 : static void mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, + 502 : 867 : static void mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_context *subflow, 503 : : bool prio, bool backup) 504 : : { - 505 : 861 : spin_unlock_bh(&msk->pm.lock); - 506 : 861 : __mptcp_pm_send_ack(msk, subflow, prio, backup); - 507 : 861 : spin_lock_bh(&msk->pm.lock); - 508 : 861 : } + 505 : 867 : spin_unlock_bh(&msk->pm.lock); + 506 : 867 : __mptcp_pm_send_ack(msk, subflow, prio, backup); + 507 : 867 : spin_lock_bh(&msk->pm.lock); + 508 : 867 : } 509 : : 510 : : static struct mptcp_pm_addr_entry * 511 : 450 : __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) @@ -616,39 +616,39 @@ 521 : : } 522 : : 523 : : static struct mptcp_pm_addr_entry * - 524 : 1444 : __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) + 524 : 1450 : __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) 525 : : { - 526 : 1444 : struct mptcp_pm_addr_entry *entry; + 526 : 1450 : struct mptcp_pm_addr_entry *entry; 527 : : - 528 [ + + + + : 2742 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list, - - + - - - - - - - + + 528 [ + + + + : 2788 : list_for_each_entry_rcu(entry, &pernet->local_addr_list, list, + - + - - - + - - - + + ] 529 : : lockdep_is_held(&pernet->lock)) { - 530 [ + + ]: 1924 : if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) + 530 [ + + ]: 1970 : if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) 531 : : return entry; 532 : : } 533 : : return NULL; 534 : : } 535 : : - 536 : 663 : static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) + 536 : 665 : static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) 537 : : { - 538 : 663 : struct sock *sk = (struct sock *)msk; - 539 : 663 : unsigned int add_addr_signal_max; - 540 : 663 : bool signal_and_subflow = false; - 541 : 663 : unsigned int local_addr_max; - 542 : 663 : struct pm_nl_pernet *pernet; - 543 : 663 : struct mptcp_pm_local local; - 544 : 663 : unsigned int subflows_max; + 538 : 665 : struct sock *sk = (struct sock *)msk; + 539 : 665 : unsigned int add_addr_signal_max; + 540 : 665 : bool signal_and_subflow = false; + 541 : 665 : unsigned int local_addr_max; + 542 : 665 : struct pm_nl_pernet *pernet; + 543 : 665 : struct mptcp_pm_local local; + 544 : 665 : unsigned int subflows_max; 545 : : - 546 : 663 : pernet = pm_nl_get_pernet(sock_net(sk)); + 546 : 665 : pernet = pm_nl_get_pernet(sock_net(sk)); 547 : : - 548 : 663 : add_addr_signal_max = mptcp_pm_get_add_addr_signal_max(msk); - 549 : 663 : local_addr_max = mptcp_pm_get_local_addr_max(msk); - 550 : 663 : subflows_max = mptcp_pm_get_subflows_max(msk); + 548 : 665 : add_addr_signal_max = mptcp_pm_get_add_addr_signal_max(msk); + 549 : 665 : local_addr_max = mptcp_pm_get_local_addr_max(msk); + 550 : 665 : subflows_max = mptcp_pm_get_subflows_max(msk); 551 : : 552 : : /* do lazy endpoint usage accounting for the MPC subflows */ - 553 [ + + + - ]: 663 : if (unlikely(!(msk->pm.status & BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED))) && msk->first) { + 553 [ + + + - ]: 665 : if (unlikely(!(msk->pm.status & BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED))) && msk->first) { 554 : 396 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(msk->first); 555 : 396 : struct mptcp_pm_addr_entry *entry; 556 : 396 : struct mptcp_addr_info mpc_addr; @@ -671,13 +671,13 @@ 572 : 396 : msk->pm.status |= BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED); 573 : : } 574 : : - 575 [ - + ]: 663 : pr_debug("local %d:%d signal %d:%d subflows %d:%d\n", + 575 [ - + ]: 665 : pr_debug("local %d:%d signal %d:%d subflows %d:%d\n", 576 : : msk->pm.local_addr_used, local_addr_max, 577 : : msk->pm.add_addr_signaled, add_addr_signal_max, 578 : : msk->pm.subflows, subflows_max); 579 : : 580 : : /* check first for announce */ - 581 [ + + ]: 663 : if (msk->pm.add_addr_signaled < add_addr_signal_max) { + 581 [ + + ]: 665 : if (msk->pm.add_addr_signaled < add_addr_signal_max) { 582 : : /* due to racing events on both ends we can reach here while 583 : : * previous add address is still running: if we invoke now 584 : : * mptcp_pm_announce_addr(), that will fail and the @@ -712,9 +712,9 @@ 612 : 24 : signal_and_subflow = true; 613 : : } 614 : : - 615 : 655 : subflow: + 615 : 657 : subflow: 616 : : /* check if should create a new subflow */ - 617 [ + + ]: 905 : while (msk->pm.local_addr_used < local_addr_max && + 617 [ + + ]: 907 : while (msk->pm.local_addr_used < local_addr_max && 618 [ + + ]: 282 : msk->pm.subflows < subflows_max) { 619 : 270 : struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; 620 : 270 : bool fullmesh; @@ -745,7 +745,7 @@ 644 : 246 : __mptcp_subflow_connect(sk, &local, &addrs[i]); 645 : 232 : spin_lock_bh(&msk->pm.lock); 646 : : } - 647 : 663 : mptcp_pm_nl_check_work_pending(msk); + 647 : 665 : mptcp_pm_nl_check_work_pending(msk); 648 : : } 649 : : 650 : 18 : static void mptcp_pm_nl_fully_established(struct mptcp_sock *msk) @@ -755,34 +755,34 @@ 654 : : 655 : 6 : static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk) 656 : : { - 657 : 233 : mptcp_pm_create_subflow_or_signal_addr(msk); - 658 : 233 : } + 657 : 235 : mptcp_pm_create_subflow_or_signal_addr(msk); + 658 : 235 : } 659 : : 660 : : /* Fill all the local addresses into the array addrs[], 661 : : * and return the array size. 662 : : */ - 663 : 270 : 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 : 270 : struct sock *sk = (struct sock *)msk; - 668 : 270 : struct mptcp_pm_addr_entry *entry; - 669 : 270 : struct mptcp_addr_info mpc_addr; - 670 : 270 : struct pm_nl_pernet *pernet; - 671 : 270 : unsigned int subflows_max; - 672 : 270 : 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 : 270 : pernet = pm_nl_get_pernet_from_msk(msk); - 675 : 270 : 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 : 270 : mptcp_local_address((struct sock_common *)msk, &mpc_addr); + 677 : 272 : mptcp_local_address((struct sock_common *)msk, &mpc_addr); 678 : : - 679 : 270 : rcu_read_lock(); - 680 [ + + - + : 768 : 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 [ + + ]: 498 : if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) - 682 : 490 : 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 : 270 : 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 [ + + ]: 270 : if (!i) { - 706 : 266 : memset(&locals[i], 0, sizeof(locals[i])); - 707 : 532 : 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 [ + + + + ]: 266 : 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 [ + + ]: 266 : 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 : 244 : msk->pm.subflows++; - 718 : 244 : i++; + 717 : 246 : msk->pm.subflows++; + 718 : 246 : i++; 719 : : } 720 : : - 721 : 248 : return i; + 721 : 250 : return i; 722 : : } 723 : : - 724 : 288 : 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 : 288 : struct mptcp_pm_local locals[MPTCP_PM_ADDR_MAX]; - 727 : 288 : struct sock *sk = (struct sock *)msk; - 728 : 288 : unsigned int add_addr_accept_max; - 729 : 288 : struct mptcp_addr_info remote; - 730 : 288 : unsigned int subflows_max; - 731 : 288 : bool sf_created = false; - 732 : 288 : 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 : 288 : add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); - 735 : 288 : 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 [ - + ]: 288 : 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 : 288 : remote = msk->pm.remote; - 742 : 288 : mptcp_pm_announce_addr(msk, &remote, true); - 743 : 288 : 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 [ + + ]: 288 : 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 [ + + ]: 270 : if (!remote.port) - 750 : 238 : 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 : 270 : nr = fill_local_addresses_vec(msk, &remote, locals); - 756 [ + + ]: 270 : if (nr == 0) + 755 : 272 : nr = fill_local_addresses_vec(msk, &remote, locals); + 756 [ + + ]: 272 : if (nr == 0) 757 : : return; 758 : : - 759 : 248 : spin_unlock_bh(&msk->pm.lock); - 760 [ + + ]: 746 : for (i = 0; i < nr; i++) - 761 [ + + ]: 250 : if (__mptcp_subflow_connect(sk, &locals[i], &remote) == 0) - 762 : 224 : sf_created = true; - 763 : 248 : 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 : 225 : sf_created = true; + 763 : 250 : spin_lock_bh(&msk->pm.lock); 764 : : - 765 [ + + ]: 248 : if (sf_created) { + 765 [ + + ]: 250 : if (sf_created) { 766 : : /* add_addr_accepted is not decr for ID 0 */ - 767 [ + + ]: 222 : if (remote.id) - 768 : 218 : msk->pm.add_addr_accepted++; - 769 [ + + ]: 222 : if (msk->pm.add_addr_accepted >= add_addr_accept_max || - 770 [ + + ]: 108 : msk->pm.subflows >= subflows_max) - 771 : 248 : WRITE_ONCE(msk->pm.accept_addr, false); + 767 [ + + ]: 223 : if (remote.id) + 768 : 219 : msk->pm.add_addr_accepted++; + 769 [ + + ]: 223 : if (msk->pm.add_addr_accepted >= add_addr_accept_max || + 770 [ + + ]: 109 : msk->pm.subflows >= subflows_max) + 771 : 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 : 860 : 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 : 860 : struct mptcp_subflow_context *subflow, *alt = NULL; + 786 : 862 : struct mptcp_subflow_context *subflow, *alt = NULL; 787 : : - 788 : 860 : msk_owned_by_me(msk); - 789 [ + - - + ]: 860 : lockdep_assert_held(&msk->pm.lock); + 788 : 862 : msk_owned_by_me(msk); + 789 [ + - - + ]: 862 : lockdep_assert_held(&msk->pm.lock); 790 : : - 791 [ + + + + ]: 860 : 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 [ + - ]: 869 : mptcp_for_each_subflow(msk, subflow) { - 796 [ + + ]: 869 : if (__mptcp_subflow_active(subflow)) { - 797 [ + - ]: 855 : if (!subflow->stale) { - 798 : 855 : mptcp_pm_send_ack(msk, subflow, false, false); - 799 : 855 : return; + 795 [ + - ]: 875 : mptcp_for_each_subflow(msk, subflow) { + 796 [ + + ]: 875 : if (__mptcp_subflow_active(subflow)) { + 797 [ + - ]: 861 : if (!subflow->stale) { + 798 : 861 : mptcp_pm_send_ack(msk, subflow, false, false); + 799 : 861 : return; 800 : : } 801 : : 802 [ # # ]: 0 : if (!alt) @@ -1027,40 +1027,40 @@ 924 : 86 : mptcp_pm_nl_rm_addr_or_subflow(msk, rm_list, MPTCP_MIB_RMSUBFLOW); 925 : 12 : } 926 : : - 927 : 9341 : void mptcp_pm_nl_work(struct mptcp_sock *msk) + 927 : 11654 : void mptcp_pm_nl_work(struct mptcp_sock *msk) 928 : : { - 929 : 9341 : struct mptcp_pm_data *pm = &msk->pm; + 929 : 11654 : struct mptcp_pm_data *pm = &msk->pm; 930 : : - 931 : 9341 : msk_owned_by_me(msk); + 931 : 11654 : msk_owned_by_me(msk); 932 : : - 933 [ + + ]: 9341 : if (!(pm->status & MPTCP_PM_WORK_MASK)) + 933 [ + + ]: 11654 : if (!(pm->status & MPTCP_PM_WORK_MASK)) 934 : : return; 935 : : - 936 : 875 : spin_lock_bh(&msk->pm.lock); + 936 : 873 : spin_lock_bh(&msk->pm.lock); 937 : : - 938 [ - + ]: 875 : pr_debug("msk=%p status=%x\n", msk, pm->status); - 939 [ + + ]: 875 : if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) { - 940 : 288 : pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED); - 941 : 288 : mptcp_pm_nl_add_addr_received(msk); + 938 [ - + ]: 873 : pr_debug("msk=%p status=%x\n", msk, pm->status); + 939 [ + + ]: 873 : 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 [ + + ]: 875 : if (pm->status & BIT(MPTCP_PM_ADD_ADDR_SEND_ACK)) { + 943 [ + + ]: 873 : if (pm->status & BIT(MPTCP_PM_ADD_ADDR_SEND_ACK)) { 944 : 122 : pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_SEND_ACK); 945 : 122 : mptcp_pm_nl_addr_send_ack(msk); 946 : : } - 947 [ + + ]: 875 : if (pm->status & BIT(MPTCP_PM_RM_ADDR_RECEIVED)) { + 947 [ + + ]: 873 : if (pm->status & BIT(MPTCP_PM_RM_ADDR_RECEIVED)) { 948 : 106 : pm->status &= ~BIT(MPTCP_PM_RM_ADDR_RECEIVED); 949 : 106 : mptcp_pm_nl_rm_addr_received(msk); 950 : : } - 951 [ + + ]: 875 : if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) { + 951 [ + + ]: 873 : if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) { 952 : 352 : pm->status &= ~BIT(MPTCP_PM_ESTABLISHED); 953 : 352 : mptcp_pm_nl_fully_established(msk); 954 : : } - 955 [ + + ]: 875 : if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) { - 956 : 233 : pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED); - 957 : 233 : mptcp_pm_nl_subflow_established(msk); + 955 [ + + ]: 873 : if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) { + 956 : 235 : pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED); + 957 : 235 : mptcp_pm_nl_subflow_established(msk); 958 : : } 959 : : - 960 : 875 : spin_unlock_bh(&msk->pm.lock); + 960 : 873 : spin_unlock_bh(&msk->pm.lock); 961 : : } 962 : : 963 : 0 : static bool address_use_port(struct mptcp_pm_addr_entry *entry) @@ -1245,20 +1245,20 @@ 1139 : 22 : return err; 1140 : : } 1141 : : - 1142 : 360 : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) + 1142 : 363 : int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) 1143 : : { - 1144 : 360 : struct mptcp_pm_addr_entry *entry; - 1145 : 360 : struct pm_nl_pernet *pernet; - 1146 : 360 : int ret; + 1144 : 363 : struct mptcp_pm_addr_entry *entry; + 1145 : 363 : struct pm_nl_pernet *pernet; + 1146 : 363 : int ret; 1147 : : - 1148 : 360 : pernet = pm_nl_get_pernet_from_msk(msk); + 1148 : 363 : pernet = pm_nl_get_pernet_from_msk(msk); 1149 : : - 1150 : 360 : rcu_read_lock(); - 1151 : 360 : entry = __lookup_addr(pernet, skc); - 1152 [ + + ]: 360 : ret = entry ? entry->addr.id : -1; - 1153 : 250 : rcu_read_unlock(); - 1154 : 360 : if (ret >= 0) - 1155 : 220 : return ret; + 1150 : 363 : rcu_read_lock(); + 1151 : 363 : entry = __lookup_addr(pernet, skc); + 1152 [ + + ]: 363 : ret = entry ? entry->addr.id : -1; + 1153 : 251 : rcu_read_unlock(); + 1154 : 363 : if (ret >= 0) + 1155 : 223 : 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 : 684 : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) + 1175 : 687 : bool mptcp_pm_nl_is_backup(struct mptcp_sock *msk, struct mptcp_addr_info *skc) 1176 : : { - 1177 : 684 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - 1178 : 684 : struct mptcp_pm_addr_entry *entry; - 1179 : 684 : bool backup; + 1177 : 687 : struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + 1178 : 687 : struct mptcp_pm_addr_entry *entry; + 1179 : 687 : bool backup; 1180 : : - 1181 : 684 : rcu_read_lock(); - 1182 : 684 : entry = __lookup_addr(pernet, skc); - 1183 [ + + + + ]: 684 : backup = entry && !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); - 1184 : 684 : rcu_read_unlock(); + 1181 : 687 : rcu_read_lock(); + 1182 : 687 : entry = __lookup_addr(pernet, skc); + 1183 [ + + + + ]: 687 : backup = entry && !!(entry->flags & MPTCP_PM_ADDR_FLAG_BACKUP); + 1184 : 687 : rcu_read_unlock(); 1185 : : - 1186 : 684 : return backup; + 1186 : 687 : return backup; 1187 : : } 1188 : : 1189 : : #define MPTCP_PM_CMD_GRP_OFFSET 0 @@ -1302,40 +1302,40 @@ 1196 : : }, 1197 : : }; 1198 : : - 1199 : 279 : void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) + 1199 : 277 : void mptcp_pm_nl_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) 1200 : : { - 1201 : 279 : struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk); - 1202 : 279 : struct sock *sk = (struct sock *)msk; - 1203 : 279 : unsigned int active_max_loss_cnt; - 1204 : 279 : struct net *net = sock_net(sk); - 1205 : 279 : unsigned int stale_loss_cnt; - 1206 : 279 : bool slow; + 1201 : 277 : struct mptcp_subflow_context *iter, *subflow = mptcp_subflow_ctx(ssk); + 1202 : 277 : struct sock *sk = (struct sock *)msk; + 1203 : 277 : unsigned int active_max_loss_cnt; + 1204 : 277 : struct net *net = sock_net(sk); + 1205 : 277 : unsigned int stale_loss_cnt; + 1206 : 277 : bool slow; 1207 : : - 1208 : 279 : stale_loss_cnt = mptcp_stale_loss_cnt(net); - 1209 [ + + + - : 279 : if (subflow->stale || !stale_loss_cnt || subflow->stale_count <= stale_loss_cnt) - + + ] + 1208 : 277 : stale_loss_cnt = mptcp_stale_loss_cnt(net); + 1209 [ + + + - : 277 : 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 : 194 : active_max_loss_cnt = max_t(int, stale_loss_cnt - 1, 1); - 1214 [ + + ]: 391 : mptcp_for_each_subflow(msk, iter) { - 1215 [ + + + + ]: 211 : if (iter != subflow && mptcp_subflow_active(iter) && - 1216 [ + + ]: 17 : iter->stale_count < active_max_loss_cnt) { + 1213 : 153 : active_max_loss_cnt = max_t(int, stale_loss_cnt - 1, 1); + 1214 [ + + ]: 315 : mptcp_for_each_subflow(msk, iter) { + 1215 [ + + + + ]: 180 : if (iter != subflow && mptcp_subflow_active(iter) && + 1216 [ + + ]: 23 : iter->stale_count < active_max_loss_cnt) { 1217 : : /* we have some alternatives, try to mark this subflow as idle ...*/ - 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); + 1218 : 18 : slow = lock_sock_fast(ssk); + 1219 [ + + ]: 18 : if (!tcp_rtx_and_write_queues_empty(ssk)) { + 1220 : 18 : subflow->stale = 1; + 1221 : 18 : __mptcp_retransmit_pending_data(sk); + 1222 [ + - ]: 18 : MPTCP_INC_STATS(net, MPTCP_MIB_SUBFLOWSTALE); 1223 : : } - 1224 : 14 : unlock_sock_fast(ssk, slow); + 1224 : 18 : 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 : 14 : __mptcp_push_pending(sk, 0); - 1231 : 14 : return; + 1230 : 18 : __mptcp_push_pending(sk, 0); + 1231 : 18 : return; 1232 : : } 1233 : : } 1234 : : } @@ -2177,20 +2177,20 @@ 2062 [ - + ]: 268 : if (nla_put_u16(skb, MPTCP_ATTR_FAMILY, ssk->sk_family)) 2063 : : return -EMSGSIZE; 2064 : : - 2065 [ + + - ]: 268 : switch (ssk->sk_family) { - 2066 : 152 : case AF_INET: - 2067 [ - + ]: 152 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) + 2065 [ + + - ]: 268 : switch (ssk->sk_family) { + 2066 : 154 : case AF_INET: + 2067 [ - + ]: 154 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) 2068 : : return -EMSGSIZE; - 2069 [ - + ]: 152 : if (nla_put_in_addr(skb, MPTCP_ATTR_DADDR4, issk->inet_daddr)) + 2069 [ - + ]: 154 : if (nla_put_in_addr(skb, MPTCP_ATTR_DADDR4, issk->inet_daddr)) 2070 : : return -EMSGSIZE; 2071 : : break; 2072 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 2073 : : case AF_INET6: { - 2074 [ + - ]: 116 : const struct ipv6_pinfo *np = inet6_sk(ssk); + 2074 [ + - ]: 114 : const struct ipv6_pinfo *np = inet6_sk(ssk); 2075 : : - 2076 [ - + ]: 116 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr)) + 2076 [ - + ]: 114 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr)) 2077 : : return -EMSGSIZE; - 2078 [ - + ]: 116 : if (nla_put_in6_addr(skb, MPTCP_ATTR_DADDR6, &ssk->sk_v6_daddr)) + 2078 [ - + ]: 114 : if (nla_put_in6_addr(skb, MPTCP_ATTR_DADDR6, &ssk->sk_v6_daddr)) 2079 : : return -EMSGSIZE; 2080 : : break; 2081 : : } @@ -2409,16 +2409,16 @@ 2293 [ - + ]: 58 : if (nla_put_be16(skb, MPTCP_ATTR_SPORT, issk->inet_sport)) 2294 : 0 : goto nla_put_failure; 2295 : : - 2296 [ + + - ]: 58 : switch (ssk->sk_family) { - 2297 : 30 : case AF_INET: - 2298 [ - + ]: 30 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) + 2296 [ + + - ]: 58 : switch (ssk->sk_family) { + 2297 : 28 : case AF_INET: + 2298 [ - + ]: 28 : if (nla_put_in_addr(skb, MPTCP_ATTR_SADDR4, issk->inet_saddr)) 2299 : 0 : goto nla_put_failure; 2300 : : break; 2301 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 2302 : : case AF_INET6: { - 2303 [ + - ]: 28 : const struct ipv6_pinfo *np = inet6_sk(ssk); + 2303 [ + - ]: 30 : const struct ipv6_pinfo *np = inet6_sk(ssk); 2304 : : - 2305 [ - + ]: 28 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr)) + 2305 [ - + ]: 30 : if (nla_put_in6_addr(skb, MPTCP_ATTR_SADDR6, &np->saddr)) 2306 : 0 : goto nla_put_failure; 2307 : : break; 2308 : : } @@ -2436,14 +2436,14 @@ 2320 : 0 : nlmsg_free(skb); 2321 : : } 2322 : : - 2323 : 7792 : void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, + 2323 : 7797 : void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, 2324 : : const struct sock *ssk, gfp_t gfp) 2325 : : { - 2326 : 7792 : struct net *net = sock_net((const struct sock *)msk); - 2327 : 7792 : struct nlmsghdr *nlh; - 2328 : 7792 : struct sk_buff *skb; + 2326 : 7797 : struct net *net = sock_net((const struct sock *)msk); + 2327 : 7797 : struct nlmsghdr *nlh; + 2328 : 7797 : struct sk_buff *skb; 2329 : : - 2330 [ + + ]: 7792 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) + 2330 [ + + ]: 7797 : if (!genl_has_listeners(&mptcp_genl_family, net, MPTCP_PM_EV_GRP_OFFSET)) 2331 : : return; 2332 : : 2333 : 280 : skb = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); @@ -2526,11 +2526,11 @@ 2409 : 1052 : return 0; 2410 : : } 2411 : : - 2412 : 893 : static void __net_exit pm_nl_exit_net(struct list_head *net_list) + 2412 : 885 : static void __net_exit pm_nl_exit_net(struct list_head *net_list) 2413 : : { - 2414 : 893 : struct net *net; + 2414 : 885 : struct net *net; 2415 : : - 2416 [ + + ]: 1867 : list_for_each_entry(net, net_list, exit_list) { + 2416 [ + + ]: 1859 : list_for_each_entry(net, net_list, exit_list) { 2417 : 974 : struct pm_nl_pernet *pernet = pm_nl_get_pernet(net); 2418 : : 2419 : : /* net is removed from namespace list, can't race with @@ -2539,7 +2539,7 @@ 2422 : : */ 2423 : 974 : __flush_addrs(&pernet->local_addr_list); 2424 : : } - 2425 : 893 : } + 2425 : 885 : } 2426 : : 2427 : : static struct pernet_operations mptcp_pm_pernet_ops = { 2428 : : .init = pm_nl_init_net, diff --git a/html/lcov/export-net/mptcp/pm_userspace.c.func-c.html b/html/lcov/export-net/mptcp/pm_userspace.c.func-c.html index b0cea005..57fe37e7 100644 --- a/html/lcov/export-net/mptcp/pm_userspace.c.func-c.html +++ b/html/lcov/export-net/mptcp/pm_userspace.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/pm_userspace.c.func.html b/html/lcov/export-net/mptcp/pm_userspace.c.func.html index aaf6e4e5..a613c8c7 100644 --- a/html/lcov/export-net/mptcp/pm_userspace.c.func.html +++ b/html/lcov/export-net/mptcp/pm_userspace.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/pm_userspace.c.gcov.html b/html/lcov/export-net/mptcp/pm_userspace.c.gcov.html index cf1d915e..e77a76e8 100644 --- a/html/lcov/export-net/mptcp/pm_userspace.c.gcov.html +++ b/html/lcov/export-net/mptcp/pm_userspace.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/protocol.c.func-c.html b/html/lcov/export-net/mptcp/protocol.c.func-c.html index 238f10ba..bda16eb8 100644 --- a/html/lcov/export-net/mptcp/protocol.c.func-c.html +++ b/html/lcov/export-net/mptcp/protocol.c.func-c.html @@ -31,13 +31,13 @@ export-net Lines: - 91.1 % + 91.3 % 2231 - 2032 + 2036 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.7 % @@ -56,9 +56,9 @@ Branches: - 68.9 % + 68.5 % 1631 - 1123 + 1118 @@ -149,23 +149,23 @@ - __mptcp_flush_join_list + mptcp_ioctl - 14 + 16 - mptcp_ioctl + mptcp_ioctl_outq 16 - mptcp_ioctl_outq + __mptcp_flush_join_list - 16 + 20 @@ -207,35 +207,35 @@ mptcp_subflow_set_active - 132 + 171 mptcp_do_fastclose - 379 + 368 mptcp_inq_hint - 432 + 433 schedule_3rdack_retransmission - 444 + 446 __mptcp_finish_join - 450 + 452 @@ -249,7 +249,7 @@ __mptcp_close_subflow - 601 + 584 @@ -263,56 +263,56 @@ __mptcp_retransmit_pending_data - 770 + 751 mptcp_close_ssk - 793 + 769 __mptcp_subflow_disconnect - 845 + 816 - mptcp_update_data_checksum + __mptcp_error_report - 847 + 831 - __mptcp_error_report + mptcp_update_data_checksum - 870 + 843 mptcp_finish_join - 882 + 886 mptcp_subflow_joined - 882 + 886 mptcp_reset_tout_timer - 979 + 994 @@ -333,7 +333,7 @@ mptcp_set_datafin_timeout - 1152 + 1133 @@ -368,21 +368,21 @@ mptcp_shutdown - 1465 + 1459 mptcp_subflow_get_retrans - 1497 + 1473 __mptcp_wr_shutdown - 2066 + 2073 @@ -396,7 +396,7 @@ mptcp_check_listen_stop - 2343 + 2344 @@ -417,7 +417,7 @@ mptcp_close_state - 2465 + 2469 @@ -431,21 +431,21 @@ mptcp_cancel_work - 2605 + 2593 mptcp_send_ack - 2745 + 2732 mptcp_subflow_shutdown - 2829 + 2846 @@ -501,84 +501,84 @@ mptcp_subflow_send_ack - 3605 + 3598 - mptcp_check_and_set_pending + mptcp_close_wake_up - 3880 + 4246 - mptcp_close_wake_up + mptcp_sock_graft - 4259 + 4445 - mptcp_sock_graft + __mptcp_subflow_send_ack - 4443 + 4487 - __mptcp_retrans + mptcp_copy_inaddrs - 4470 + 4764 - mptcp_clean_una_wakeup + __mptcp_close_ssk - 4470 + 5211 - __mptcp_subflow_send_ack + __mptcp_subflow_error_report - 4488 + 5298 - mptcp_copy_inaddrs + mptcp_forward_alloc_get - 4764 + 5344 - mptcp_retransmit_timer + mptcp_check_and_set_pending - 4765 + 6014 - __mptcp_close_ssk + __mptcp_retrans - 5238 + 6691 - __mptcp_subflow_error_report + mptcp_clean_una_wakeup - 5340 + 6691 - mptcp_forward_alloc_get + mptcp_retransmit_timer - 5412 + 6997 @@ -592,469 +592,469 @@ mptcp_check_data_fin_ack - 9339 + 11653 mptcp_check_fastclose - 9339 + 11653 mptcp_close_tout_expired - 9339 + 11653 - mptcp_check_data_fin + mptcp_worker - 9371 + 11740 - mptcp_worker + mptcp_check_data_fin - 9425 + 11763 mptcp_schedule_work - 10860 + 13139 - __mptcp_clean_una_wakeup + mptcp_set_state - 12920 + 16435 - mptcp_set_state + __mptcp_clean_una_wakeup - 16487 + 20042 - mptcp_stop_rtx_timer + mptcp_rfree - 18940 + 26011 - mptcp_rfree + mptcp_stop_rtx_timer - 21853 + 28859 mptcp_subflow_process_delegated - 26786 + 30160 mptcp_napi_poll - 48569 + 31438 - mptcp_data_queue_ofo + __mptcp_subflow_push_pending - 81803 + 88870 - __mptcp_subflow_push_pending + mptcp_data_queue_ofo - 98660 + 100554 tcp_can_send_ack - 118760 + 121399 - mptcp_check_send_data_fin + mptcp_subflow_recv_lookup - 121336 + 187794 - mptcp_subflow_recv_lookup + __mptcp_add_ext - 138810 + 203568 - mptcp_set_timeout + __mptcp_alloc_tx_skb - 161287 + 203568 - __mptcp_add_ext + __mptcp_do_alloc_tx_skb - 162148 + 203568 - __mptcp_alloc_tx_skb + mptcp_check_send_data_fin - 162148 + 207130 - __mptcp_do_alloc_tx_skb + __mptcp_splice_receive_queue - 162148 + 209661 - mptcp_push_release + mptcp_subflow_cleanup_rbuf - 165669 + 217051 - __mptcp_splice_receive_queue + __mptcp_rmem_reclaim - 174590 + 218356 - __mptcp_rmem_reclaim + mptcp_reset_rtx_timer - 180984 + 231907 - mptcp_reset_rtx_timer + mptcp_set_timeout - 182152 + 233412 __mptcp_clean_una - 186643 + 236435 - mptcp_sendmsg + __mptcp_data_acked - 188130 + 240106 + + + + + mptcp_rmem_uncharge + + 242748 mptcp_pending_data_fin_ack - 195982 + 248088 - dfrag_clear + mptcp_push_release - 196609 + 266240 - mptcp_carve_data_frag + mptcp_set_owner_r - 196615 + 269875 - mptcp_page_frag_refill + dfrag_clear - 196615 + 277838 - __mptcp_push_pending + mptcp_carve_data_frag - 198776 + 277844 - mptcp_subflow_cleanup_rbuf + mptcp_page_frag_refill - 200201 + 277844 - mptcp_rmem_uncharge + mptcp_sendmsg - 202041 + 289978 - __mptcp_data_acked + __mptcp_push_pending - 213980 + 301444 - mptcp_set_owner_r + __mptcp_move_skbs - 214773 + 324390 - mptcp_check_writeable + mptcp_update_post_push - 245200 + 347807 - __mptcp_move_skbs + mptcp_try_coalesce - 248417 + 358154 - do_copy_data_nocache + __subflow_push_pending - 277201 + 363277 - mptcp_frag_can_collapse_to + do_copy_data_nocache - 277201 + 378738 - mptcp_update_post_push + mptcp_frag_can_collapse_to - 281365 + 378738 mptcp_send_limit - 281445 + 381520 - __subflow_push_pending + mptcp_skb_can_collapse_to - 297156 + 389744 - mptcp_subflow_get_send + mptcp_check_writeable - 346420 + 396765 - mptcp_skb_can_collapse_to + mptcp_subflow_get_send - 348779 + 405889 mptcp_recvmsg - 369063 + 432638 mptcp_cleanup_rbuf - 374227 + 442376 - mptcp_try_coalesce + move_skbs_to_msk - 418197 + 497112 mptcp_check_allowed_size - 444201 + 497851 mptcp_sendmsg_frag - 444202 + 497851 - __mptcp_recvmsg_mskq + __mptcp_move_skbs_from_subflow - 503310 + 497927 - mptcp_rcv_space_adjust + mptcp_data_ready - 503310 + 500937 - mptcp_poll + __mptcp_move_skb - 505045 + 505189 - __mptcp_set_timeout + mptcp_rmem_schedule - 507707 + 505189 - mptcp_subflow_could_cleanup + mptcp_pending_data_fin - 518491 + 508875 - move_skbs_to_msk + __mptcp_recvmsg_mskq - 535644 + 607094 - mptcp_data_ready + mptcp_rcv_space_adjust - 535791 + 607094 - __mptcp_move_skbs_from_subflow + __mptcp_set_timeout - 537069 + 639301 - __mptcp_move_skb + mptcp_subflow_could_cleanup - 537350 + 643815 - mptcp_rmem_schedule + mptcp_poll - 537350 + 676434 - mptcp_pending_data_fin + __mptcp_ofo_queue - 545015 + 706773 mptcp_release_cb - 605585 + 776428 - __mptcp_ofo_queue + __mptcp_check_push - 710234 + 779654 __mptcp_update_rmem - 781600 + 986904 mptcp_subflow_active - 798214 - - - - - __mptcp_check_push - - 814229 + 1013204 mptcp_rmem_fwd_alloc_add - 1282074 + 1376078 diff --git a/html/lcov/export-net/mptcp/protocol.c.func.html b/html/lcov/export-net/mptcp/protocol.c.func.html index 63bf57aa..0cf810aa 100644 --- a/html/lcov/export-net/mptcp/protocol.c.func.html +++ b/html/lcov/export-net/mptcp/protocol.c.func.html @@ -31,13 +31,13 @@ export-net Lines: - 91.1 % + 91.3 % 2231 - 2032 + 2036 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.7 % @@ -56,9 +56,9 @@ Branches: - 68.9 % + 68.5 % 1631 - 1123 + 1118 @@ -81,35 +81,35 @@ __mptcp_add_ext - 162148 + 203568 __mptcp_alloc_tx_skb - 162148 + 203568 __mptcp_check_push - 814229 + 779654 __mptcp_clean_una - 186643 + 236435 __mptcp_clean_una_wakeup - 12920 + 20042 @@ -130,21 +130,21 @@ __mptcp_close_ssk - 5238 + 5211 __mptcp_close_subflow - 601 + 584 __mptcp_data_acked - 213980 + 240106 @@ -158,28 +158,28 @@ __mptcp_do_alloc_tx_skb - 162148 + 203568 __mptcp_error_report - 870 + 831 __mptcp_finish_join - 450 + 452 __mptcp_flush_join_list - 14 + 20 @@ -193,21 +193,21 @@ __mptcp_move_skb - 537350 + 505189 __mptcp_move_skbs - 248417 + 324390 __mptcp_move_skbs_from_subflow - 537069 + 497927 @@ -221,49 +221,49 @@ __mptcp_ofo_queue - 710234 + 706773 __mptcp_push_pending - 198776 + 301444 __mptcp_recvmsg_mskq - 503310 + 607094 __mptcp_retrans - 4470 + 6691 __mptcp_retransmit_pending_data - 770 + 751 __mptcp_rmem_reclaim - 180984 + 218356 __mptcp_set_timeout - 507707 + 639301 @@ -277,35 +277,35 @@ __mptcp_splice_receive_queue - 174590 + 209661 __mptcp_subflow_disconnect - 845 + 816 __mptcp_subflow_error_report - 5340 + 5298 __mptcp_subflow_push_pending - 98660 + 88870 __mptcp_subflow_send_ack - 4488 + 4487 @@ -319,42 +319,42 @@ __mptcp_update_rmem - 781600 + 986904 __mptcp_wr_shutdown - 2066 + 2073 __subflow_push_pending - 297156 + 363277 dfrag_clear - 196609 + 277838 do_copy_data_nocache - 277201 + 378738 move_skbs_to_msk - 535644 + 497112 @@ -375,84 +375,84 @@ mptcp_cancel_work - 2605 + 2593 mptcp_carve_data_frag - 196615 + 277844 mptcp_check_allowed_size - 444201 + 497851 mptcp_check_and_set_pending - 3880 + 6014 mptcp_check_data_fin - 9371 + 11763 mptcp_check_data_fin_ack - 9339 + 11653 mptcp_check_fastclose - 9339 + 11653 mptcp_check_listen_stop - 2343 + 2344 mptcp_check_send_data_fin - 121336 + 207130 mptcp_check_writeable - 245200 + 396765 mptcp_clean_una_wakeup - 4470 + 6691 mptcp_cleanup_rbuf - 374227 + 442376 @@ -466,28 +466,28 @@ mptcp_close_ssk - 793 + 769 mptcp_close_state - 2465 + 2469 mptcp_close_tout_expired - 9339 + 11653 mptcp_close_wake_up - 4259 + 4246 @@ -522,14 +522,14 @@ mptcp_data_queue_ofo - 81803 + 100554 mptcp_data_ready - 535791 + 500937 @@ -557,7 +557,7 @@ mptcp_do_fastclose - 379 + 368 @@ -592,21 +592,21 @@ mptcp_finish_join - 882 + 886 mptcp_forward_alloc_get - 5412 + 5344 mptcp_frag_can_collapse_to - 277201 + 378738 @@ -634,7 +634,7 @@ mptcp_inq_hint - 432 + 433 @@ -669,35 +669,35 @@ mptcp_napi_poll - 48569 + 31438 mptcp_page_frag_refill - 196615 + 277844 mptcp_pending_data_fin - 545015 + 508875 mptcp_pending_data_fin_ack - 195982 + 248088 mptcp_poll - 505045 + 676434 @@ -718,14 +718,14 @@ mptcp_push_release - 165669 + 266240 mptcp_rcv_space_adjust - 503310 + 607094 @@ -739,91 +739,91 @@ mptcp_recvmsg - 369063 + 432638 mptcp_release_cb - 605585 + 776428 mptcp_reset_rtx_timer - 182152 + 231907 mptcp_reset_tout_timer - 979 + 994 mptcp_retransmit_timer - 4765 + 6997 mptcp_rfree - 21853 + 26011 mptcp_rmem_fwd_alloc_add - 1282074 + 1376078 mptcp_rmem_schedule - 537350 + 505189 mptcp_rmem_uncharge - 202041 + 242748 mptcp_schedule_work - 10860 + 13139 mptcp_send_ack - 2745 + 2732 mptcp_send_limit - 281445 + 381520 mptcp_sendmsg - 188130 + 289978 @@ -837,42 +837,42 @@ mptcp_sendmsg_frag - 444202 + 497851 mptcp_set_datafin_timeout - 1152 + 1133 mptcp_set_owner_r - 214773 + 269875 mptcp_set_state - 16487 + 16435 mptcp_set_timeout - 161287 + 233412 mptcp_shutdown - 1465 + 1459 @@ -886,21 +886,21 @@ mptcp_skb_can_collapse_to - 348779 + 389744 mptcp_sock_graft - 4443 + 4445 mptcp_stop_rtx_timer - 18940 + 28859 @@ -914,77 +914,77 @@ mptcp_subflow_active - 798214 + 1013204 mptcp_subflow_cleanup_rbuf - 200201 + 217051 mptcp_subflow_could_cleanup - 518491 + 643815 mptcp_subflow_get_retrans - 1497 + 1473 mptcp_subflow_get_send - 346420 + 405889 mptcp_subflow_joined - 882 + 886 mptcp_subflow_process_delegated - 26786 + 30160 mptcp_subflow_recv_lookup - 138810 + 187794 mptcp_subflow_send_ack - 3605 + 3598 mptcp_subflow_set_active - 132 + 171 mptcp_subflow_shutdown - 2829 + 2846 @@ -1005,7 +1005,7 @@ mptcp_try_coalesce - 418197 + 358154 @@ -1019,7 +1019,7 @@ mptcp_update_data_checksum - 847 + 843 @@ -1033,28 +1033,28 @@ mptcp_update_post_push - 281365 + 347807 mptcp_worker - 9425 + 11740 schedule_3rdack_retransmission - 444 + 446 tcp_can_send_ack - 118760 + 121399 diff --git a/html/lcov/export-net/mptcp/protocol.c.gcov.html b/html/lcov/export-net/mptcp/protocol.c.gcov.html index 313f56ce..99bb8056 100644 --- a/html/lcov/export-net/mptcp/protocol.c.gcov.html +++ b/html/lcov/export-net/mptcp/protocol.c.gcov.html @@ -31,13 +31,13 @@ export-net Lines: - 91.1 % + 91.3 % 2231 - 2032 + 2036 Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.7 % @@ -56,9 +56,9 @@ Branches: - 68.9 % + 68.5 % 1631 - 1123 + 1118 @@ -130,7 +130,7 @@ 52 : : /* Returns end sequence number of the receiver's advertised window */ 53 : 24 : static u64 mptcp_wnd_end(const struct mptcp_sock *msk) 54 : : { - 55 : 722086 : return READ_ONCE(msk->wnd_end); + 55 : 828614 : return READ_ONCE(msk->wnd_end); 56 : : } 57 : : 58 : 94 : static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *sk) @@ -178,7 +178,7 @@ 100 : 7034 : struct sock *sk = (struct sock *)msk; 101 : 7034 : int ret; 102 : : - 103 [ + + + + ]: 7034 : if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) + 103 [ + + + + ]: 7034 : if (!((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) 104 : : return ERR_PTR(-EINVAL); 105 : : 106 [ + + ]: 7016 : if (!msk->first) { @@ -196,109 +196,109 @@ 118 : 0 : __kfree_skb(skb); 119 : : } 120 : : - 121 : 1282074 : static void mptcp_rmem_fwd_alloc_add(struct sock *sk, int size) + 121 : 1376078 : static void mptcp_rmem_fwd_alloc_add(struct sock *sk, int size) 122 : : { - 123 [ - + - + ]: 1282074 : WRITE_ONCE(mptcp_sk(sk)->rmem_fwd_alloc, + 123 [ - + - + ]: 1376078 : WRITE_ONCE(mptcp_sk(sk)->rmem_fwd_alloc, 124 : : mptcp_sk(sk)->rmem_fwd_alloc + size); - 125 : 1282074 : } + 125 : 1376078 : } 126 : : 127 : 0 : static void mptcp_rmem_charge(struct sock *sk, int size) 128 : : { - 129 : 739471 : mptcp_rmem_fwd_alloc_add(sk, -size); + 129 : 748690 : mptcp_rmem_fwd_alloc_add(sk, -size); 130 : : } 131 : : - 132 : 418197 : static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, + 132 : 358154 : static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, 133 : : struct sk_buff *from) 134 : : { - 135 : 418197 : bool fragstolen; - 136 : 418197 : int delta; + 135 : 358154 : bool fragstolen; + 136 : 358154 : int delta; 137 : : - 138 [ + + ]: 418197 : if (MPTCP_SKB_CB(from)->offset || - 139 [ + + + + ]: 815691 : ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || - 140 : 397496 : !skb_try_coalesce(to, from, &fragstolen, &delta)) - 141 : 74447 : return false; + 138 [ + + ]: 358154 : if (MPTCP_SKB_CB(from)->offset || + 139 [ + + + + ]: 700313 : ((to->len + from->len) > (sk->sk_rcvbuf >> 3)) || + 140 : 342169 : !skb_try_coalesce(to, from, &fragstolen, &delta)) + 141 : 97659 : return false; 142 : : - 143 [ - + ]: 343750 : pr_debug("colesced seq %llx into %llx new len %d new end seq %llx\n", + 143 [ - + ]: 260495 : pr_debug("colesced seq %llx into %llx new len %d new end seq %llx\n", 144 : : MPTCP_SKB_CB(from)->map_seq, MPTCP_SKB_CB(to)->map_seq, 145 : : to->len, MPTCP_SKB_CB(from)->end_seq); - 146 : 343750 : MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; + 146 : 260495 : MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; 147 : : 148 : : /* note the fwd memory can reach a negative value after accounting 149 : : * for the delta, but the later skb free will restore a non 150 : : * negative one 151 : : */ - 152 : 343750 : atomic_add(delta, &sk->sk_rmem_alloc); - 153 : 343750 : mptcp_rmem_charge(sk, delta); - 154 [ - + ]: 343750 : kfree_skb_partial(from, fragstolen); + 152 : 260495 : atomic_add(delta, &sk->sk_rmem_alloc); + 153 : 260495 : mptcp_rmem_charge(sk, delta); + 154 [ - + ]: 260495 : kfree_skb_partial(from, fragstolen); 155 : : - 156 : 343750 : return true; + 156 : 260495 : return true; 157 : : } 158 : : 159 : 0 : static bool mptcp_ooo_try_coalesce(struct mptcp_sock *msk, struct sk_buff *to, 160 : : struct sk_buff *from) 161 : : { - 162 [ + + ]: 31839 : if (MPTCP_SKB_CB(from)->map_seq != MPTCP_SKB_CB(to)->end_seq) + 162 [ + + ]: 43571 : if (MPTCP_SKB_CB(from)->map_seq != MPTCP_SKB_CB(to)->end_seq) 163 : : return false; 164 : : - 165 : 92366 : return mptcp_try_coalesce((struct sock *)msk, to, from); + 165 : 119248 : return mptcp_try_coalesce((struct sock *)msk, to, from); 166 : : } 167 : : - 168 : 180984 : static void __mptcp_rmem_reclaim(struct sock *sk, int amount) + 168 : 218356 : static void __mptcp_rmem_reclaim(struct sock *sk, int amount) 169 : : { - 170 : 180984 : amount >>= PAGE_SHIFT; - 171 : 180984 : mptcp_rmem_charge(sk, amount << PAGE_SHIFT); - 172 : 180984 : __sk_mem_reduce_allocated(sk, amount); - 173 : 180984 : } + 170 : 218356 : amount >>= PAGE_SHIFT; + 171 : 218356 : mptcp_rmem_charge(sk, amount << PAGE_SHIFT); + 172 : 218356 : __sk_mem_reduce_allocated(sk, amount); + 173 : 218356 : } 174 : : - 175 : 202041 : static void mptcp_rmem_uncharge(struct sock *sk, int size) + 175 : 242748 : static void mptcp_rmem_uncharge(struct sock *sk, int size) 176 : : { - 177 [ - + ]: 202041 : struct mptcp_sock *msk = mptcp_sk(sk); - 178 : 202041 : int reclaimable; + 177 [ - + ]: 242748 : struct mptcp_sock *msk = mptcp_sk(sk); + 178 : 242748 : int reclaimable; 179 : : - 180 : 202041 : mptcp_rmem_fwd_alloc_add(sk, size); - 181 [ - + ]: 202041 : reclaimable = msk->rmem_fwd_alloc - sk_unused_reserved_mem(sk); + 180 : 242748 : mptcp_rmem_fwd_alloc_add(sk, size); + 181 [ - + ]: 242748 : reclaimable = msk->rmem_fwd_alloc - sk_unused_reserved_mem(sk); 182 : : 183 : : /* see sk_mem_uncharge() for the rationale behind the following schema */ - 184 [ + + ]: 202041 : if (unlikely(reclaimable >= PAGE_SIZE)) - 185 : 180984 : __mptcp_rmem_reclaim(sk, reclaimable); - 186 : 202041 : } + 184 [ + + ]: 242748 : if (unlikely(reclaimable >= PAGE_SIZE)) + 185 : 218356 : __mptcp_rmem_reclaim(sk, reclaimable); + 186 : 242748 : } 187 : : - 188 : 21853 : static void mptcp_rfree(struct sk_buff *skb) + 188 : 26011 : static void mptcp_rfree(struct sk_buff *skb) 189 : : { - 190 : 21853 : unsigned int len = skb->truesize; - 191 : 21853 : struct sock *sk = skb->sk; + 190 : 26011 : unsigned int len = skb->truesize; + 191 : 26011 : struct sock *sk = skb->sk; 192 : : - 193 : 21853 : atomic_sub(len, &sk->sk_rmem_alloc); - 194 : 21853 : mptcp_rmem_uncharge(sk, len); - 195 : 21853 : } + 193 : 26011 : atomic_sub(len, &sk->sk_rmem_alloc); + 194 : 26011 : mptcp_rmem_uncharge(sk, len); + 195 : 26011 : } 196 : : - 197 : 214773 : void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk) + 197 : 269875 : void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk) 198 : : { - 199 : 214773 : skb_orphan(skb); - 200 : 214773 : skb->sk = sk; - 201 : 214773 : skb->destructor = mptcp_rfree; - 202 : 214773 : atomic_add(skb->truesize, &sk->sk_rmem_alloc); - 203 : 214773 : mptcp_rmem_charge(sk, skb->truesize); - 204 : 214773 : } + 199 : 269875 : skb_orphan(skb); + 200 : 269875 : skb->sk = sk; + 201 : 269875 : skb->destructor = mptcp_rfree; + 202 : 269875 : atomic_add(skb->truesize, &sk->sk_rmem_alloc); + 203 : 269875 : mptcp_rmem_charge(sk, skb->truesize); + 204 : 269875 : } 205 : : 206 : : /* "inspired" by tcp_data_queue_ofo(), main differences: 207 : : * - use mptcp seqs 208 : : * - don't cope with sacks 209 : : */ - 210 : 81803 : static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) + 210 : 100554 : static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) 211 : : { - 212 : 81803 : struct sock *sk = (struct sock *)msk; - 213 : 81803 : struct rb_node **p, *parent; - 214 : 81803 : u64 seq, end_seq, max_seq; - 215 : 81803 : struct sk_buff *skb1; + 212 : 100554 : struct sock *sk = (struct sock *)msk; + 213 : 100554 : struct rb_node **p, *parent; + 214 : 100554 : u64 seq, end_seq, max_seq; + 215 : 100554 : struct sk_buff *skb1; 216 : : - 217 : 81803 : seq = MPTCP_SKB_CB(skb)->map_seq; - 218 : 81803 : end_seq = MPTCP_SKB_CB(skb)->end_seq; - 219 [ - + ]: 81803 : max_seq = atomic64_read(&msk->rcv_wnd_sent); + 217 : 100554 : seq = MPTCP_SKB_CB(skb)->map_seq; + 218 : 100554 : end_seq = MPTCP_SKB_CB(skb)->end_seq; + 219 [ - + ]: 100554 : max_seq = atomic64_read(&msk->rcv_wnd_sent); 220 : : - 221 [ - + ]: 81803 : pr_debug("msk=%p seq=%llx limit=%llx empty=%d\n", msk, seq, max_seq, + 221 [ - + ]: 100554 : pr_debug("msk=%p seq=%llx limit=%llx empty=%d\n", msk, seq, max_seq, 222 : : RB_EMPTY_ROOT(&msk->out_of_order_queue)); - 223 [ - + ]: 81803 : if (after64(end_seq, max_seq)) { + 223 [ - + ]: 100554 : if (after64(end_seq, max_seq)) { 224 : : /* out of window */ 225 : 0 : mptcp_drop(sk, skb); 226 [ # # ]: 0 : pr_debug("oow by %lld, rcv_wnd_sent %llu\n", @@ -308,49 +308,49 @@ 230 : 0 : return; 231 : : } 232 : : - 233 : 81803 : p = &msk->out_of_order_queue.rb_node; - 234 [ + - ]: 81803 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE); - 235 [ + + ]: 81803 : if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) { - 236 : 4638 : rb_link_node(&skb->rbnode, NULL, p); - 237 : 4638 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); - 238 : 4638 : msk->ooo_last_skb = skb; - 239 : 4638 : goto end; + 233 : 100554 : p = &msk->out_of_order_queue.rb_node; + 234 [ + - ]: 100554 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUE); + 235 [ + + ]: 100554 : if (RB_EMPTY_ROOT(&msk->out_of_order_queue)) { + 236 : 4230 : rb_link_node(&skb->rbnode, NULL, p); + 237 : 4230 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); + 238 : 4230 : msk->ooo_last_skb = skb; + 239 : 4230 : goto end; 240 : : } 241 : : 242 : : /* with 2 subflows, adding at end of ooo queue is quite likely 243 : : * Use of ooo_last_skb avoids the O(Log(N)) rbtree lookup. 244 : : */ - 245 [ + + + + ]: 129029 : if (mptcp_ooo_try_coalesce(msk, msk->ooo_last_skb, skb)) { - 246 [ + - ]: 42397 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); - 247 [ + - ]: 42397 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); - 248 : 42397 : return; + 245 [ + + + + ]: 157472 : if (mptcp_ooo_try_coalesce(msk, msk->ooo_last_skb, skb)) { + 246 [ + - ]: 45894 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); + 247 [ + - ]: 45894 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); + 248 : 45894 : return; 249 : : } 250 : : 251 : : /* Can avoid an rbtree lookup if we are adding skb after ooo_last_skb */ - 252 [ + + ]: 34768 : if (!before64(seq, MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq)) { - 253 [ + - ]: 23559 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); - 254 : 23559 : parent = &msk->ooo_last_skb->rbnode; - 255 : 23559 : p = &parent->rb_right; - 256 : 23559 : goto insert; + 252 [ + + ]: 50430 : if (!before64(seq, MPTCP_SKB_CB(msk->ooo_last_skb)->end_seq)) { + 253 [ + - ]: 32264 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOQUEUETAIL); + 254 : 32264 : parent = &msk->ooo_last_skb->rbnode; + 255 : 32264 : p = &parent->rb_right; + 256 : 32264 : goto insert; 257 : : } 258 : : 259 : : /* Find place to insert this segment. Handle overlaps on the way. */ 260 : : parent = NULL; - 261 [ + + ]: 51454 : while (*p) { - 262 : 47651 : parent = *p; - 263 : 47651 : skb1 = rb_to_skb(parent); - 264 [ + + ]: 47651 : if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { - 265 : 12286 : p = &parent->rb_left; - 266 : 12286 : continue; + 261 [ + + ]: 110115 : while (*p) { + 262 : 102890 : parent = *p; + 263 : 102890 : skb1 = rb_to_skb(parent); + 264 [ + + ]: 102890 : if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { + 265 : 29727 : p = &parent->rb_left; + 266 : 29727 : continue; 267 : : } - 268 [ + + ]: 35365 : if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) { - 269 [ + + ]: 434 : if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) { + 268 [ + + ]: 73163 : if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) { + 269 [ + + ]: 574 : if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) { 270 : : /* All the bits are present. Drop. */ - 271 : 225 : mptcp_drop(sk, skb); - 272 [ + - ]: 225 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 273 : 225 : return; + 271 : 369 : mptcp_drop(sk, skb); + 272 [ + - ]: 369 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 273 : 369 : return; 274 : : } - 275 [ + + ]: 209 : if (after64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { + 275 [ + + ]: 205 : if (after64(seq, MPTCP_SKB_CB(skb1)->map_seq)) { 276 : : /* partial overlap: 277 : : * | skb | 278 : : * | skb1 | @@ -360,303 +360,303 @@ 282 : : /* skb's seq == skb1's seq and skb covers skb1. 283 : : * Replace skb1 with skb. 284 : : */ - 285 : 9 : rb_replace_node(&skb1->rbnode, &skb->rbnode, + 285 : 12 : rb_replace_node(&skb1->rbnode, &skb->rbnode, 286 : : &msk->out_of_order_queue); - 287 : 9 : mptcp_drop(sk, skb1); - 288 [ + - ]: 9 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 289 : 9 : goto merge_right; + 287 : 12 : mptcp_drop(sk, skb1); + 288 [ + - ]: 12 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 289 : 12 : goto merge_right; 290 : : } - 291 [ + + + + ]: 44155 : } else if (mptcp_ooo_try_coalesce(msk, skb1, skb)) { - 292 [ + - ]: 7172 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); - 293 : 7172 : return; + 291 [ + + + + ]: 87693 : } else if (mptcp_ooo_try_coalesce(msk, skb1, skb)) { + 292 [ + - ]: 10560 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_OFOMERGE); + 293 : 10560 : return; 294 : : } - 295 : 27959 : p = &parent->rb_right; + 295 : 62222 : p = &parent->rb_right; 296 : : } 297 : : - 298 : 3803 : insert: + 298 : 7225 : insert: 299 : : /* Insert segment into RB tree. */ - 300 : 27362 : rb_link_node(&skb->rbnode, parent, p); - 301 : 27362 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); + 300 : 39489 : rb_link_node(&skb->rbnode, parent, p); + 301 : 39489 : rb_insert_color(&skb->rbnode, &msk->out_of_order_queue); 302 : : 303 : : merge_right: 304 : : /* Remove other segments covered by skb. */ - 305 [ + + ]: 27461 : while ((skb1 = skb_rb_next(skb)) != NULL) { - 306 [ + + ]: 3901 : if (before64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) + 305 [ + + ]: 39575 : while ((skb1 = skb_rb_next(skb)) != NULL) { + 306 [ + + ]: 7309 : if (before64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) 307 : : break; - 308 : 90 : rb_erase(&skb1->rbnode, &msk->out_of_order_queue); - 309 : 90 : mptcp_drop(sk, skb1); - 310 [ + - ]: 90 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 308 : 74 : rb_erase(&skb1->rbnode, &msk->out_of_order_queue); + 309 : 74 : mptcp_drop(sk, skb1); + 310 [ + - ]: 74 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); 311 : : } 312 : : /* If there is no skb after us, we are the last_skb ! */ - 313 [ + + ]: 27371 : if (!skb1) - 314 : 23560 : msk->ooo_last_skb = skb; + 313 [ + + ]: 39501 : if (!skb1) + 314 : 32266 : msk->ooo_last_skb = skb; 315 : : - 316 : 3811 : end: - 317 : 32009 : skb_condense(skb); - 318 : 32009 : mptcp_set_owner_r(skb, sk); + 316 : 7235 : end: + 317 : 43731 : skb_condense(skb); + 318 : 43731 : mptcp_set_owner_r(skb, sk); 319 : : } 320 : : - 321 : 537350 : static bool mptcp_rmem_schedule(struct sock *sk, struct sock *ssk, int size) + 321 : 505189 : static bool mptcp_rmem_schedule(struct sock *sk, struct sock *ssk, int size) 322 : : { - 323 [ - + ]: 537350 : struct mptcp_sock *msk = mptcp_sk(sk); - 324 : 537350 : int amt, amount; + 323 [ - + ]: 505189 : struct mptcp_sock *msk = mptcp_sk(sk); + 324 : 505189 : int amt, amount; 325 : : - 326 [ + + ]: 537350 : if (size <= msk->rmem_fwd_alloc) + 326 [ + + ]: 505189 : if (size <= msk->rmem_fwd_alloc) 327 : : return true; 328 : : - 329 : 340526 : size -= msk->rmem_fwd_alloc; - 330 : 340526 : amt = sk_mem_pages(size); - 331 : 340526 : amount = amt << PAGE_SHIFT; - 332 [ + - ]: 340526 : if (!__sk_mem_raise_allocated(sk, size, amt, SK_MEM_RECV)) + 329 : 384604 : size -= msk->rmem_fwd_alloc; + 330 : 384604 : amt = sk_mem_pages(size); + 331 : 384604 : amount = amt << PAGE_SHIFT; + 332 [ + - ]: 384604 : if (!__sk_mem_raise_allocated(sk, size, amt, SK_MEM_RECV)) 333 : : return false; 334 : : - 335 : 340526 : mptcp_rmem_fwd_alloc_add(sk, amount); - 336 : 340526 : return true; + 335 : 384604 : mptcp_rmem_fwd_alloc_add(sk, amount); + 336 : 384604 : return true; 337 : : } 338 : : - 339 : 537350 : static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, + 339 : 505189 : static bool __mptcp_move_skb(struct mptcp_sock *msk, struct sock *ssk, 340 : : struct sk_buff *skb, unsigned int offset, 341 : : size_t copy_len) 342 : : { - 343 : 537350 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 344 : 537350 : struct sock *sk = (struct sock *)msk; - 345 : 537350 : struct sk_buff *tail; - 346 : 537350 : bool has_rxtstamp; + 343 : 505189 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 344 : 505189 : struct sock *sk = (struct sock *)msk; + 345 : 505189 : struct sk_buff *tail; + 346 : 505189 : bool has_rxtstamp; 347 : : - 348 : 537350 : __skb_unlink(skb, &ssk->sk_receive_queue); + 348 : 505189 : __skb_unlink(skb, &ssk->sk_receive_queue); 349 : : - 350 : 537350 : skb_ext_reset(skb); - 351 : 537350 : skb_orphan(skb); + 350 : 505189 : skb_ext_reset(skb); + 351 : 505189 : skb_orphan(skb); 352 : : 353 : : /* try to fetch required memory from subflow */ - 354 [ - + ]: 537350 : if (!mptcp_rmem_schedule(sk, ssk, skb->truesize)) { + 354 [ - + ]: 505189 : if (!mptcp_rmem_schedule(sk, ssk, skb->truesize)) { 355 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RCVPRUNED); 356 : 0 : goto drop; 357 : : } 358 : : - 359 : 537350 : has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp; + 359 : 505189 : has_rxtstamp = TCP_SKB_CB(skb)->has_rxtstamp; 360 : : 361 : : /* the skb map_seq accounts for the skb offset: 362 : : * mptcp_subflow_get_mapped_dsn() is based on the current tp->copied_seq 363 : : * value 364 : : */ - 365 : 537350 : MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow); - 366 : 537350 : MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + copy_len; - 367 : 537350 : MPTCP_SKB_CB(skb)->offset = offset; - 368 : 537350 : MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp; + 365 : 505189 : MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow); + 366 : 505189 : MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + copy_len; + 367 : 505189 : MPTCP_SKB_CB(skb)->offset = offset; + 368 : 505189 : MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp; 369 : : - 370 [ + + ]: 537350 : if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { + 370 [ + + ]: 505189 : if (MPTCP_SKB_CB(skb)->map_seq == msk->ack_seq) { 371 : : /* in sequence */ - 372 : 455547 : msk->bytes_received += copy_len; - 373 : 455547 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); - 374 [ + + ]: 455547 : tail = skb_peek_tail(&sk->sk_receive_queue); - 375 [ + - + + ]: 325831 : if (tail && mptcp_try_coalesce(sk, tail, skb)) + 372 : 404630 : msk->bytes_received += copy_len; + 373 : 404630 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + copy_len); + 374 [ + + ]: 404630 : tail = skb_peek_tail(&sk->sk_receive_queue); + 375 [ + - + + ]: 238906 : if (tail && mptcp_try_coalesce(sk, tail, skb)) 376 : : return true; 377 : : - 378 : 182726 : mptcp_set_owner_r(skb, sk); - 379 : 182726 : __skb_queue_tail(&sk->sk_receive_queue, skb); - 380 : 182726 : return true; - 381 [ + - ]: 81803 : } else if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) { - 382 : 81803 : mptcp_data_queue_ofo(msk, skb); - 383 : 81803 : return false; + 378 : 226106 : mptcp_set_owner_r(skb, sk); + 379 : 226106 : __skb_queue_tail(&sk->sk_receive_queue, skb); + 380 : 226106 : return true; + 381 [ + + ]: 100559 : } else if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) { + 382 : 100554 : mptcp_data_queue_ofo(msk, skb); + 383 : 100554 : return false; 384 : : } 385 : : 386 : : /* old data, keep it simple and drop the whole pkt, sender 387 : : * will retransmit as needed, if needed. 388 : : */ - 389 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 390 : 0 : drop: - 391 : 0 : mptcp_drop(sk, skb); - 392 : 0 : return false; + 389 [ # # ]: 5 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 390 : 5 : drop: + 391 : 5 : mptcp_drop(sk, skb); + 392 : 5 : return false; 393 : : } 394 : : - 395 : 18940 : static void mptcp_stop_rtx_timer(struct sock *sk) + 395 : 28859 : static void mptcp_stop_rtx_timer(struct sock *sk) 396 : : { - 397 : 18940 : struct inet_connection_sock *icsk = inet_csk(sk); + 397 : 28859 : struct inet_connection_sock *icsk = inet_csk(sk); 398 : : - 399 : 18940 : sk_stop_timer(sk, &icsk->icsk_retransmit_timer); - 400 [ - + ]: 18940 : mptcp_sk(sk)->timer_ival = 0; - 401 : 18940 : } + 399 : 28859 : sk_stop_timer(sk, &icsk->icsk_retransmit_timer); + 400 [ - + ]: 28859 : mptcp_sk(sk)->timer_ival = 0; + 401 : 28859 : } 402 : : - 403 : 4259 : static void mptcp_close_wake_up(struct sock *sk) + 403 : 4246 : static void mptcp_close_wake_up(struct sock *sk) 404 : : { - 405 [ + + ]: 4259 : if (sock_flag(sk, SOCK_DEAD)) + 405 [ + + ]: 4246 : if (sock_flag(sk, SOCK_DEAD)) 406 : : return; 407 : : - 408 : 3038 : sk->sk_state_change(sk); - 409 [ + + ]: 3038 : if (sk->sk_shutdown == SHUTDOWN_MASK || - 410 [ + + ]: 1491 : sk->sk_state == TCP_CLOSE) - 411 : 1604 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP); + 408 : 3009 : sk->sk_state_change(sk); + 409 [ + + ]: 3009 : if (sk->sk_shutdown == SHUTDOWN_MASK || + 410 [ + + ]: 1475 : sk->sk_state == TCP_CLOSE) + 411 : 1584 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP); 412 : : else - 413 : 1434 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); + 413 : 1425 : sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); 414 : : } 415 : : 416 : : /* called under the msk socket lock */ - 417 : 195982 : static bool mptcp_pending_data_fin_ack(struct sock *sk) + 417 : 248088 : static bool mptcp_pending_data_fin_ack(struct sock *sk) 418 : : { - 419 [ - + ]: 195982 : struct mptcp_sock *msk = mptcp_sk(sk); + 419 [ - + ]: 248088 : struct mptcp_sock *msk = mptcp_sk(sk); 420 : : - 421 : 104898 : return ((1 << sk->sk_state) & - 422 [ + + + + ]: 195982 : (TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK)) && - 423 [ + + ]: 34258 : msk->write_seq == READ_ONCE(msk->snd_una); + 421 : 121990 : return ((1 << sk->sk_state) & + 422 [ + + + + ]: 248088 : (TCPF_FIN_WAIT1 | TCPF_CLOSING | TCPF_LAST_ACK)) && + 423 [ + + ]: 35307 : msk->write_seq == READ_ONCE(msk->snd_una); 424 : : } 425 : : - 426 : 9339 : static void mptcp_check_data_fin_ack(struct sock *sk) + 426 : 11653 : static void mptcp_check_data_fin_ack(struct sock *sk) 427 : : { - 428 [ - + ]: 9339 : struct mptcp_sock *msk = mptcp_sk(sk); + 428 [ - + ]: 11653 : struct mptcp_sock *msk = mptcp_sk(sk); 429 : : 430 : : /* Look for an acknowledged DATA_FIN */ - 431 [ + + ]: 9339 : if (mptcp_pending_data_fin_ack(sk)) { - 432 : 1693 : WRITE_ONCE(msk->snd_data_fin_enable, 0); + 431 [ + + ]: 11653 : if (mptcp_pending_data_fin_ack(sk)) { + 432 : 1707 : WRITE_ONCE(msk->snd_data_fin_enable, 0); 433 : : - 434 [ + + - ]: 1693 : switch (sk->sk_state) { - 435 : 942 : case TCP_FIN_WAIT1: - 436 : 942 : mptcp_set_state(sk, TCP_FIN_WAIT2); - 437 : 942 : break; - 438 : 751 : case TCP_CLOSING: + 434 [ + + - ]: 1707 : switch (sk->sk_state) { + 435 : 939 : case TCP_FIN_WAIT1: + 436 : 939 : mptcp_set_state(sk, TCP_FIN_WAIT2); + 437 : 939 : break; + 438 : 768 : case TCP_CLOSING: 439 : : case TCP_LAST_ACK: - 440 : 751 : mptcp_set_state(sk, TCP_CLOSE); - 441 : 751 : break; + 440 : 768 : mptcp_set_state(sk, TCP_CLOSE); + 441 : 768 : break; 442 : : } 443 : : - 444 : 1693 : mptcp_close_wake_up(sk); + 444 : 1707 : mptcp_close_wake_up(sk); 445 : : } - 446 : 9339 : } + 446 : 11653 : } 447 : : 448 : : /* can be called with no lock acquired */ - 449 : 545015 : static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq) + 449 : 508875 : static bool mptcp_pending_data_fin(struct sock *sk, u64 *seq) 450 : : { - 451 [ - + ]: 545015 : struct mptcp_sock *msk = mptcp_sk(sk); + 451 [ - + ]: 508875 : struct mptcp_sock *msk = mptcp_sk(sk); 452 : : - 453 [ + + + + : 570848 : if (READ_ONCE(msk->rcv_data_fin) && - + + + + ] - 454 [ + + ]: 17 : ((1 << inet_sk_state_load(sk)) & + 453 [ + + + + : 534260 : if (READ_ONCE(msk->rcv_data_fin) && + - + + + ] + 454 [ + + ]: 16 : ((1 << inet_sk_state_load(sk)) & 455 : : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2))) { - 456 : 25217 : u64 rcv_data_fin_seq = READ_ONCE(msk->rcv_data_fin_seq); + 456 : 24806 : u64 rcv_data_fin_seq = READ_ONCE(msk->rcv_data_fin_seq); 457 : : - 458 [ + + ]: 25217 : if (READ_ONCE(msk->ack_seq) == rcv_data_fin_seq) { - 459 [ + + ]: 1883 : if (seq) - 460 : 1662 : *seq = rcv_data_fin_seq; + 458 [ + + ]: 24806 : if (READ_ONCE(msk->ack_seq) == rcv_data_fin_seq) { + 459 [ + + ]: 1943 : if (seq) + 460 : 1668 : *seq = rcv_data_fin_seq; 461 : : - 462 : 1883 : return true; + 462 : 1943 : return true; 463 : : } 464 : : } 465 : : 466 : : return false; 467 : : } 468 : : - 469 : 1152 : static void mptcp_set_datafin_timeout(struct sock *sk) + 469 : 1133 : static void mptcp_set_datafin_timeout(struct sock *sk) 470 : : { - 471 : 1152 : struct inet_connection_sock *icsk = inet_csk(sk); - 472 : 1152 : u32 retransmits; + 471 : 1133 : struct inet_connection_sock *icsk = inet_csk(sk); + 472 : 1133 : u32 retransmits; 473 : : - 474 : 1152 : retransmits = min_t(u32, icsk->icsk_retransmits, + 474 : 1133 : retransmits = min_t(u32, icsk->icsk_retransmits, 475 : : ilog2(TCP_RTO_MAX / TCP_RTO_MIN)); 476 : : - 477 [ - + ]: 1152 : mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits; - 478 : 1152 : } + 477 [ - + ]: 1133 : mptcp_sk(sk)->timer_ival = TCP_RTO_MIN << retransmits; + 478 : 1133 : } 479 : : - 480 : 507707 : static void __mptcp_set_timeout(struct sock *sk, long tout) + 480 : 639301 : static void __mptcp_set_timeout(struct sock *sk, long tout) 481 : : { - 482 [ + + - + ]: 815163 : mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN; - 483 : 507707 : } + 482 [ + + - + ]: 1076992 : mptcp_sk(sk)->timer_ival = tout > 0 ? tout : TCP_RTO_MIN; + 483 : 639301 : } 484 : : 485 : 24 : static long mptcp_timeout_from_subflow(const struct mptcp_subflow_context *subflow) 486 : : { - 487 : 855850 : const struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 487 : 1071757 : const struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 488 : : - 489 [ + + + + ]: 658606 : return inet_csk(ssk)->icsk_pending && !subflow->stale_count ? - 490 [ + + + + ]: 1352079 : inet_csk(ssk)->icsk_timeout - jiffies : 0; + 489 [ + + + + ]: 855137 : return inet_csk(ssk)->icsk_pending && !subflow->stale_count ? + 490 [ + + + + ]: 1793122 : inet_csk(ssk)->icsk_timeout - jiffies : 0; 491 : : } 492 : : - 493 : 161287 : static void mptcp_set_timeout(struct sock *sk) + 493 : 233412 : static void mptcp_set_timeout(struct sock *sk) 494 : : { - 495 : 161287 : struct mptcp_subflow_context *subflow; - 496 : 161287 : long tout = 0; + 495 : 233412 : struct mptcp_subflow_context *subflow; + 496 : 233412 : long tout = 0; 497 : : - 498 [ - + - + : 462759 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) - + + ] - 499 [ + + ]: 527279 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); - 500 : 161287 : __mptcp_set_timeout(sk, tout); - 501 : 161287 : } + 498 [ - + - + : 635922 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) + + + ] + 499 [ + + ]: 727108 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); + 500 : 233412 : __mptcp_set_timeout(sk, tout); + 501 : 233412 : } 502 : : - 503 : 118760 : static inline bool tcp_can_send_ack(const struct sock *ssk) + 503 : 121399 : static inline bool tcp_can_send_ack(const struct sock *ssk) 504 : : { - 505 [ - + ]: 292700 : return !((1 << inet_sk_state_load(ssk)) & + 505 [ - + ]: 324329 : return !((1 << inet_sk_state_load(ssk)) & 506 : : (TCPF_SYN_SENT | TCPF_SYN_RECV | TCPF_TIME_WAIT | TCPF_CLOSE | TCPF_LISTEN)); 507 : : } 508 : : - 509 : 4488 : void __mptcp_subflow_send_ack(struct sock *ssk) + 509 : 4487 : void __mptcp_subflow_send_ack(struct sock *ssk) 510 : : { - 511 [ + + ]: 4488 : if (tcp_can_send_ack(ssk)) - 512 : 4412 : tcp_send_ack(ssk); - 513 : 4488 : } + 511 [ + + ]: 4487 : if (tcp_can_send_ack(ssk)) + 512 : 4409 : tcp_send_ack(ssk); + 513 : 4487 : } 514 : : - 515 : 3605 : static void mptcp_subflow_send_ack(struct sock *ssk) + 515 : 3598 : static void mptcp_subflow_send_ack(struct sock *ssk) 516 : : { - 517 : 3605 : bool slow; + 517 : 3598 : bool slow; 518 : : - 519 : 3605 : slow = lock_sock_fast(ssk); - 520 : 3605 : __mptcp_subflow_send_ack(ssk); - 521 : 3605 : unlock_sock_fast(ssk, slow); - 522 : 3605 : } + 519 : 3598 : slow = lock_sock_fast(ssk); + 520 : 3598 : __mptcp_subflow_send_ack(ssk); + 521 : 3598 : unlock_sock_fast(ssk, slow); + 522 : 3598 : } 523 : : - 524 : 2745 : static void mptcp_send_ack(struct mptcp_sock *msk) + 524 : 2732 : static void mptcp_send_ack(struct mptcp_sock *msk) 525 : : { - 526 : 2745 : struct mptcp_subflow_context *subflow; + 526 : 2732 : struct mptcp_subflow_context *subflow; 527 : : - 528 [ + + ]: 6350 : mptcp_for_each_subflow(msk, subflow) - 529 : 3605 : mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); - 530 : 2745 : } + 528 [ + + ]: 6330 : mptcp_for_each_subflow(msk, subflow) + 529 : 3598 : mptcp_subflow_send_ack(mptcp_subflow_tcp_sock(subflow)); + 530 : 2732 : } 531 : : - 532 : 200201 : static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) + 532 : 217051 : static void mptcp_subflow_cleanup_rbuf(struct sock *ssk, int copied) 533 : : { - 534 : 200201 : bool slow; + 534 : 217051 : bool slow; 535 : : - 536 : 200201 : slow = lock_sock_fast(ssk); - 537 [ + + ]: 200201 : if (tcp_can_send_ack(ssk)) - 538 : 192228 : tcp_cleanup_rbuf(ssk, copied); - 539 : 200201 : unlock_sock_fast(ssk, slow); - 540 : 200201 : } + 536 : 217051 : slow = lock_sock_fast(ssk); + 537 [ + + ]: 217051 : if (tcp_can_send_ack(ssk)) + 538 : 211271 : tcp_cleanup_rbuf(ssk, copied); + 539 : 217051 : unlock_sock_fast(ssk, slow); + 540 : 217051 : } 541 : : - 542 : 518491 : static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty) + 542 : 643815 : static bool mptcp_subflow_could_cleanup(const struct sock *ssk, bool rx_empty) 543 : : { - 544 : 518491 : const struct inet_connection_sock *icsk = inet_csk(ssk); - 545 : 518491 : u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending); - 546 [ - + ]: 518491 : const struct tcp_sock *tp = tcp_sk(ssk); + 544 : 643815 : const struct inet_connection_sock *icsk = inet_csk(ssk); + 545 : 643815 : u8 ack_pending = READ_ONCE(icsk->icsk_ack.pending); + 546 [ - + ]: 643815 : const struct tcp_sock *tp = tcp_sk(ssk); 547 : : - 548 [ + + ]: 518491 : return (ack_pending & ICSK_ACK_SCHED) && - 549 : 134740 : ((READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->rcv_wup) > - 550 [ + + + + ]: 134740 : READ_ONCE(icsk->icsk_ack.rcv_mss)) || - 551 [ + + ]: 6423 : (rx_empty && ack_pending & + 548 [ + + ]: 643815 : return (ack_pending & ICSK_ACK_SCHED) && + 549 : 174688 : ((READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->rcv_wup) > + 550 [ + + + + ]: 174688 : READ_ONCE(icsk->icsk_ack.rcv_mss)) || + 551 [ + + ]: 11438 : (rx_empty && ack_pending & 552 : : (ICSK_ACK_PUSHED2 | ICSK_ACK_PUSHED))); 553 : : } 554 : : - 555 : 374227 : static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) + 555 : 442376 : static void mptcp_cleanup_rbuf(struct mptcp_sock *msk, int copied) 556 : : { - 557 : 374227 : int old_space = READ_ONCE(msk->old_wspace); - 558 : 374227 : struct mptcp_subflow_context *subflow; - 559 : 374227 : struct sock *sk = (struct sock *)msk; - 560 : 374227 : int space = __mptcp_space(sk); - 561 : 374227 : bool cleanup, rx_empty; + 557 : 442376 : int old_space = READ_ONCE(msk->old_wspace); + 558 : 442376 : struct mptcp_subflow_context *subflow; + 559 : 442376 : struct sock *sk = (struct sock *)msk; + 560 : 442376 : int space = __mptcp_space(sk); + 561 : 442376 : bool cleanup, rx_empty; 562 : : - 563 [ + + + + : 374227 : cleanup = (space > 0) && (space >= (old_space << 1)) && copied; - + + ] - 564 [ + + + + ]: 374227 : rx_empty = !__mptcp_rmem(sk) && copied; + 563 [ + + + + : 442376 : cleanup = (space > 0) && (space >= (old_space << 1)) && copied; + + + ] + 564 [ + + + + ]: 442376 : rx_empty = !__mptcp_rmem(sk) && copied; 565 : : - 566 [ + + ]: 992791 : mptcp_for_each_subflow(msk, subflow) { - 567 [ + + ]: 618564 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 566 [ + + ]: 1179002 : mptcp_for_each_subflow(msk, subflow) { + 567 [ + + ]: 736626 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 568 : : - 569 [ + + + + ]: 618564 : if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) - 570 : 200201 : mptcp_subflow_cleanup_rbuf(ssk, copied); + 569 [ + + + + ]: 736626 : if (cleanup || mptcp_subflow_could_cleanup(ssk, rx_empty)) + 570 : 217051 : mptcp_subflow_cleanup_rbuf(ssk, copied); 571 : : } - 572 : 374227 : } + 572 : 442376 : } 573 : : - 574 : 9371 : static bool mptcp_check_data_fin(struct sock *sk) + 574 : 11763 : static bool mptcp_check_data_fin(struct sock *sk) 575 : : { - 576 [ - + ]: 9371 : struct mptcp_sock *msk = mptcp_sk(sk); - 577 : 9371 : u64 rcv_data_fin_seq; - 578 : 9371 : bool ret = false; + 576 [ - + ]: 11763 : struct mptcp_sock *msk = mptcp_sk(sk); + 577 : 11763 : u64 rcv_data_fin_seq; + 578 : 11763 : bool ret = false; 579 : : 580 : : /* Need to ack a DATA_FIN received from a peer while this side 581 : : * of the connection is in ESTABLISHED, FIN_WAIT1, or FIN_WAIT2. @@ -671,35 +671,35 @@ 590 : : * when catching up. 591 : : */ 592 : : - 593 [ + + ]: 9371 : if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) { - 594 : 1662 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1); - 595 : 1662 : WRITE_ONCE(msk->rcv_data_fin, 0); + 593 [ + + ]: 11763 : if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) { + 594 : 1668 : WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1); + 595 : 1668 : WRITE_ONCE(msk->rcv_data_fin, 0); 596 : : - 597 : 1662 : WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN); - 598 : 1662 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ + 597 : 1668 : WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN); + 598 : 1668 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ 599 : : - 600 [ + + + - ]: 1662 : switch (sk->sk_state) { + 600 [ + + + - ]: 1668 : switch (sk->sk_state) { 601 : : case TCP_ESTABLISHED: 602 : 710 : mptcp_set_state(sk, TCP_CLOSE_WAIT); 603 : 710 : break; - 604 : 203 : case TCP_FIN_WAIT1: - 605 : 203 : mptcp_set_state(sk, TCP_CLOSING); - 606 : 203 : break; - 607 : 749 : case TCP_FIN_WAIT2: - 608 : 749 : mptcp_set_state(sk, TCP_CLOSE); - 609 : 749 : break; + 604 : 204 : case TCP_FIN_WAIT1: + 605 : 204 : mptcp_set_state(sk, TCP_CLOSING); + 606 : 204 : break; + 607 : 754 : case TCP_FIN_WAIT2: + 608 : 754 : mptcp_set_state(sk, TCP_CLOSE); + 609 : 754 : break; 610 : : default: 611 : : /* Other states not expected */ 612 : 0 : WARN_ON_ONCE(1); 613 : 0 : break; 614 : : } 615 : : - 616 : 1662 : ret = true; - 617 [ + + ]: 1662 : if (!__mptcp_check_fallback(msk)) - 618 : 1593 : mptcp_send_ack(msk); - 619 : 1662 : mptcp_close_wake_up(sk); + 616 : 1668 : ret = true; + 617 [ + + ]: 1668 : if (!__mptcp_check_fallback(msk)) + 618 : 1599 : mptcp_send_ack(msk); + 619 : 1668 : mptcp_close_wake_up(sk); 620 : : } - 621 : 9371 : return ret; + 621 : 11763 : return ret; 622 : : } 623 : : 624 : 0 : static void mptcp_dss_corruption(struct mptcp_sock *msk, struct sock *ssk) @@ -714,165 +714,165 @@ 633 : : } 634 : 0 : } 635 : : - 636 : 537069 : static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, + 636 : 497927 : static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, 637 : : struct sock *ssk, 638 : : unsigned int *bytes) 639 : : { - 640 [ + - ]: 537069 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 641 : 537069 : struct sock *sk = (struct sock *)msk; - 642 : 537069 : unsigned int moved = 0; - 643 : 537069 : bool more_data_avail; - 644 : 537069 : struct tcp_sock *tp; - 645 : 537069 : bool done = false; - 646 : 537069 : int sk_rbuf; + 640 [ + - ]: 497927 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 641 : 497927 : struct sock *sk = (struct sock *)msk; + 642 : 497927 : unsigned int moved = 0; + 643 : 497927 : bool more_data_avail; + 644 : 497927 : struct tcp_sock *tp; + 645 : 497927 : bool done = false; + 646 : 497927 : int sk_rbuf; 647 : : - 648 : 537069 : sk_rbuf = READ_ONCE(sk->sk_rcvbuf); + 648 : 497927 : sk_rbuf = READ_ONCE(sk->sk_rcvbuf); 649 : : - 650 [ + - ]: 537069 : if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { - 651 : 537069 : int ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf); + 650 [ + - ]: 497927 : if (!(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { + 651 : 497927 : int ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf); 652 : : - 653 [ + + ]: 537069 : if (unlikely(ssk_rbuf > sk_rbuf)) { - 654 : 2 : WRITE_ONCE(sk->sk_rcvbuf, ssk_rbuf); - 655 : 2 : sk_rbuf = ssk_rbuf; + 653 [ - + ]: 497927 : if (unlikely(ssk_rbuf > sk_rbuf)) { + 654 : 0 : WRITE_ONCE(sk->sk_rcvbuf, ssk_rbuf); + 655 : 0 : sk_rbuf = ssk_rbuf; 656 : : } 657 : : } 658 : : - 659 [ - + ]: 537069 : pr_debug("msk=%p ssk=%p\n", msk, ssk); - 660 [ - + ]: 537069 : tp = tcp_sk(ssk); - 661 : 538765 : do { - 662 : 538765 : u32 map_remaining, offset; - 663 : 538765 : u32 seq = tp->copied_seq; - 664 : 538765 : struct sk_buff *skb; - 665 : 538765 : bool fin; + 659 [ - + ]: 497927 : pr_debug("msk=%p ssk=%p\n", msk, ssk); + 660 [ - + ]: 497927 : tp = tcp_sk(ssk); + 661 : 505916 : do { + 662 : 505916 : u32 map_remaining, offset; + 663 : 505916 : u32 seq = tp->copied_seq; + 664 : 505916 : struct sk_buff *skb; + 665 : 505916 : bool fin; 666 : : 667 : : /* try to move as much data as available */ - 668 : 1077530 : map_remaining = subflow->map_data_len - - 669 : 538765 : mptcp_subflow_get_map_offset(subflow); + 668 : 1011832 : map_remaining = subflow->map_data_len - + 669 : 505916 : mptcp_subflow_get_map_offset(subflow); 670 : : - 671 [ + + ]: 538765 : skb = skb_peek(&ssk->sk_receive_queue); - 672 [ - + ]: 537372 : if (!skb) { + 671 [ + + ]: 505916 : skb = skb_peek(&ssk->sk_receive_queue); + 672 [ - + ]: 505215 : if (!skb) { 673 : : /* With racing move_skbs_to_msk() and __mptcp_move_skbs(), 674 : : * a different CPU can have already processed the pending 675 : : * data, stop here or we can enter an infinite loop 676 : : */ - 677 [ - + ]: 1393 : if (!moved) + 677 [ - + ]: 701 : if (!moved) 678 : : done = true; 679 : : break; 680 : : } 681 : : - 682 [ + + ]: 537372 : if (__mptcp_check_fallback(msk)) { + 682 [ + + ]: 505215 : if (__mptcp_check_fallback(msk)) { 683 : : /* Under fallback skbs have no MPTCP extension and TCP could 684 : : * collapse them between the dummy map creation and the 685 : : * current dequeue. Be sure to adjust the map size. 686 : : */ - 687 : 4359 : map_remaining = skb->len; - 688 : 4359 : subflow->map_data_len = skb->len; + 687 : 4757 : map_remaining = skb->len; + 688 : 4757 : subflow->map_data_len = skb->len; 689 : : } 690 : : - 691 : 537372 : offset = seq - TCP_SKB_CB(skb)->seq; - 692 : 537372 : fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; - 693 [ + + ]: 537372 : if (fin) { + 691 : 505215 : offset = seq - TCP_SKB_CB(skb)->seq; + 692 : 505215 : fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; + 693 [ + + ]: 505215 : if (fin) { 694 : 70 : done = true; 695 : 70 : seq++; 696 : : } 697 : : - 698 [ + + ]: 537372 : if (offset < skb->len) { - 699 : 537350 : size_t len = skb->len - offset; + 698 [ + + ]: 505215 : if (offset < skb->len) { + 699 : 505189 : size_t len = skb->len - offset; 700 : : - 701 [ - + ]: 537350 : if (tp->urg_data) + 701 [ - + ]: 505189 : if (tp->urg_data) 702 : 0 : done = true; 703 : : - 704 [ + + ]: 537350 : if (__mptcp_move_skb(msk, ssk, skb, offset, len)) - 705 : 455547 : moved += len; - 706 : 537350 : seq += len; + 704 [ + + ]: 505189 : if (__mptcp_move_skb(msk, ssk, skb, offset, len)) + 705 : 404630 : moved += len; + 706 : 505189 : seq += len; 707 : : - 708 [ - + ]: 537350 : if (unlikely(map_remaining < len)) { + 708 [ - + ]: 505189 : if (unlikely(map_remaining < len)) { 709 : 0 : DEBUG_NET_WARN_ON_ONCE(1); 710 : 0 : mptcp_dss_corruption(msk, ssk); 711 : : } 712 : : } else { - 713 [ - + ]: 22 : if (unlikely(!fin)) { + 713 [ - + ]: 26 : if (unlikely(!fin)) { 714 : 0 : DEBUG_NET_WARN_ON_ONCE(1); 715 : 0 : mptcp_dss_corruption(msk, ssk); 716 : : } 717 : : - 718 : 22 : sk_eat_skb(ssk, skb); - 719 : 22 : done = true; + 718 : 26 : sk_eat_skb(ssk, skb); + 719 : 26 : done = true; 720 : : } 721 : : - 722 : 537372 : WRITE_ONCE(tp->copied_seq, seq); - 723 : 537372 : more_data_avail = mptcp_subflow_data_available(ssk); + 722 : 505215 : WRITE_ONCE(tp->copied_seq, seq); + 723 : 505215 : more_data_avail = mptcp_subflow_data_available(ssk); 724 : : - 725 [ + + ]: 537372 : if (atomic_read(&sk->sk_rmem_alloc) > sk_rbuf) { + 725 [ + + ]: 505215 : if (atomic_read(&sk->sk_rmem_alloc) > sk_rbuf) { 726 : : done = true; 727 : : break; 728 : : } - 729 [ + + ]: 522677 : } while (more_data_avail); + 729 [ + + ]: 490429 : } while (more_data_avail); 730 : : - 731 [ + + ]: 535676 : if (moved > 0) - 732 : 453854 : msk->last_data_recv = tcp_jiffies32; - 733 : 537069 : *bytes += moved; - 734 : 537069 : return done; + 731 [ + + ]: 497226 : if (moved > 0) + 732 : 399659 : msk->last_data_recv = tcp_jiffies32; + 733 : 497927 : *bytes += moved; + 734 : 497927 : return done; 735 : : } 736 : : - 737 : 710234 : static bool __mptcp_ofo_queue(struct mptcp_sock *msk) + 737 : 706773 : static bool __mptcp_ofo_queue(struct mptcp_sock *msk) 738 : : { - 739 : 710234 : struct sock *sk = (struct sock *)msk; - 740 : 710234 : struct sk_buff *skb, *tail; - 741 : 710234 : bool moved = false; - 742 : 710234 : struct rb_node *p; - 743 : 710234 : u64 end_seq; + 739 : 706773 : struct sock *sk = (struct sock *)msk; + 740 : 706773 : struct sk_buff *skb, *tail; + 741 : 706773 : bool moved = false; + 742 : 706773 : struct rb_node *p; + 743 : 706773 : u64 end_seq; 744 : : - 745 : 710234 : p = rb_first(&msk->out_of_order_queue); - 746 [ - + ]: 710234 : pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); - 747 [ + + ]: 742144 : while (p) { - 748 : 257818 : skb = rb_to_skb(p); - 749 [ + + ]: 257818 : if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) + 745 : 706773 : p = rb_first(&msk->out_of_order_queue); + 746 [ - + ]: 706773 : pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); + 747 [ + + ]: 750418 : while (p) { + 748 : 285920 : skb = rb_to_skb(p); + 749 [ + + ]: 285920 : if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) 750 : : break; 751 : : - 752 : 31910 : p = rb_next(p); - 753 : 31910 : rb_erase(&skb->rbnode, &msk->out_of_order_queue); + 752 : 43645 : p = rb_next(p); + 753 : 43645 : rb_erase(&skb->rbnode, &msk->out_of_order_queue); 754 : : - 755 [ + + ]: 31910 : if (unlikely(!after64(MPTCP_SKB_CB(skb)->end_seq, + 755 [ + + ]: 43645 : if (unlikely(!after64(MPTCP_SKB_CB(skb)->end_seq, 756 : : msk->ack_seq))) { - 757 : 71 : mptcp_drop(sk, skb); - 758 [ + - ]: 71 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); - 759 : 71 : continue; + 757 : 74 : mptcp_drop(sk, skb); + 758 [ + - ]: 74 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA); + 759 : 74 : continue; 760 : : } 761 : : - 762 : 31839 : end_seq = MPTCP_SKB_CB(skb)->end_seq; - 763 [ + - ]: 31839 : tail = skb_peek_tail(&sk->sk_receive_queue); - 764 [ + - + + ]: 63117 : if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) { - 765 : 10479 : int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; + 762 : 43571 : end_seq = MPTCP_SKB_CB(skb)->end_seq; + 763 [ + - ]: 43571 : tail = skb_peek_tail(&sk->sk_receive_queue); + 764 [ + - + + ]: 86567 : if (!tail || !mptcp_ooo_try_coalesce(msk, tail, skb)) { + 765 : 18054 : int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; 766 : : 767 : : /* skip overlapping data, if any */ - 768 [ - + ]: 10479 : pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n", + 768 [ - + ]: 18054 : pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n", 769 : : MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq, 770 : : delta); - 771 : 10479 : MPTCP_SKB_CB(skb)->offset += delta; - 772 : 10479 : MPTCP_SKB_CB(skb)->map_seq += delta; - 773 : 10479 : __skb_queue_tail(&sk->sk_receive_queue, skb); + 771 : 18054 : MPTCP_SKB_CB(skb)->offset += delta; + 772 : 18054 : MPTCP_SKB_CB(skb)->map_seq += delta; + 773 : 18054 : __skb_queue_tail(&sk->sk_receive_queue, skb); 774 : : } - 775 : 31839 : msk->bytes_received += end_seq - msk->ack_seq; - 776 : 31839 : WRITE_ONCE(msk->ack_seq, end_seq); - 777 : 31839 : moved = true; + 775 : 43571 : msk->bytes_received += end_seq - msk->ack_seq; + 776 : 43571 : WRITE_ONCE(msk->ack_seq, end_seq); + 777 : 43571 : moved = true; 778 : : } - 779 : 710234 : return moved; + 779 : 706773 : return moved; 780 : : } 781 : : - 782 : 5340 : static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) + 782 : 5298 : static bool __mptcp_subflow_error_report(struct sock *sk, struct sock *ssk) 783 : : { - 784 [ + + ]: 5340 : int err = sock_error(ssk); - 785 : 3087 : int ssk_state; + 784 [ + + ]: 5298 : int err = sock_error(ssk); + 785 : 3096 : int ssk_state; 786 : : - 787 [ + + ]: 3065 : if (!err) - 788 : 2275 : return false; + 787 [ + + ]: 3072 : if (!err) + 788 : 2226 : return false; 789 : : 790 : : /* only propagate errors on fallen-back sockets or 791 : : * on MPC connect 792 : : */ - 793 [ + + - + : 874 : if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk))) - + + ] + 793 [ + + - + : 842 : if (sk->sk_state != TCP_SYN_SENT && !__mptcp_check_fallback(mptcp_sk(sk))) + + + ] 794 : : return false; 795 : : 796 : : /* We need to propagate only transition to CLOSE state. @@ -880,38 +880,38 @@ 798 : : * subflow_sched_work_if_closed() and that path will properly 799 : : * destroy the msk as needed. 800 : : */ - 801 : 44 : ssk_state = inet_sk_state_load(ssk); - 802 [ + - + + ]: 44 : if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) - 803 : 26 : mptcp_set_state(sk, ssk_state); - 804 : 44 : WRITE_ONCE(sk->sk_err, -err); + 801 : 45 : ssk_state = inet_sk_state_load(ssk); + 802 [ + - + + ]: 45 : if (ssk_state == TCP_CLOSE && !sock_flag(sk, SOCK_DEAD)) + 803 : 27 : mptcp_set_state(sk, ssk_state); + 804 : 45 : WRITE_ONCE(sk->sk_err, -err); 805 : : 806 : : /* This barrier is coupled with smp_rmb() in mptcp_poll() */ - 807 : 44 : smp_wmb(); - 808 : 44 : sk_error_report(sk); - 809 : 44 : return true; + 807 : 45 : smp_wmb(); + 808 : 45 : sk_error_report(sk); + 809 : 45 : return true; 810 : : } 811 : : - 812 : 870 : void __mptcp_error_report(struct sock *sk) + 812 : 831 : void __mptcp_error_report(struct sock *sk) 813 : : { - 814 : 870 : struct mptcp_subflow_context *subflow; - 815 [ - + ]: 870 : struct mptcp_sock *msk = mptcp_sk(sk); + 814 : 831 : struct mptcp_subflow_context *subflow; + 815 [ - + ]: 831 : struct mptcp_sock *msk = mptcp_sk(sk); 816 : : - 817 [ + + ]: 1791 : mptcp_for_each_subflow(msk, subflow) - 818 [ + + ]: 947 : if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow))) + 817 [ + + ]: 1707 : mptcp_for_each_subflow(msk, subflow) + 818 [ + + ]: 903 : if (__mptcp_subflow_error_report(sk, mptcp_subflow_tcp_sock(subflow))) 819 : : break; - 820 : 870 : } + 820 : 831 : } 821 : : 822 : : /* In most cases we will be able to lock the mptcp socket. If its already 823 : : * owned, we need to defer to the work queue to avoid ABBA deadlock. 824 : : */ - 825 : 535644 : static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) + 825 : 497112 : static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk) 826 : : { - 827 : 535644 : struct sock *sk = (struct sock *)msk; - 828 : 535644 : unsigned int moved = 0; + 827 : 497112 : struct sock *sk = (struct sock *)msk; + 828 : 497112 : unsigned int moved = 0; 829 : : - 830 : 535644 : __mptcp_move_skbs_from_subflow(msk, ssk, &moved); - 831 : 535644 : __mptcp_ofo_queue(msk); - 832 [ - + ]: 535644 : if (unlikely(ssk->sk_err)) { + 830 : 497112 : __mptcp_move_skbs_from_subflow(msk, ssk, &moved); + 831 : 497112 : __mptcp_ofo_queue(msk); + 832 [ - + ]: 497112 : if (unlikely(ssk->sk_err)) { 833 [ # # ]: 0 : if (!sock_owned_by_user(sk)) 834 : 0 : __mptcp_error_report(sk); 835 : : else @@ -924,141 +924,141 @@ 841 : : * this is not a good place to change state. Let the workqueue 842 : : * do it. 843 : : */ - 844 [ + + ]: 535644 : if (mptcp_pending_data_fin(sk, NULL)) - 845 : 221 : mptcp_schedule_work(sk); - 846 : 535644 : return moved > 0; + 844 [ + + ]: 497112 : if (mptcp_pending_data_fin(sk, NULL)) + 845 : 275 : mptcp_schedule_work(sk); + 846 : 497112 : return moved > 0; 847 : : } 848 : : - 849 : 535791 : void mptcp_data_ready(struct sock *sk, struct sock *ssk) + 849 : 500937 : void mptcp_data_ready(struct sock *sk, struct sock *ssk) 850 : : { - 851 [ - + ]: 535791 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 852 [ - + ]: 535791 : struct mptcp_sock *msk = mptcp_sk(sk); - 853 : 535791 : int sk_rbuf, ssk_rbuf; + 851 [ - + ]: 500937 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 852 [ - + ]: 500937 : struct mptcp_sock *msk = mptcp_sk(sk); + 853 : 500937 : int sk_rbuf, ssk_rbuf; 854 : : 855 : : /* The peer can send data while we are shutting down this 856 : : * subflow at msk destruction time, but we must avoid enqueuing 857 : : * more data to the msk receive queue 858 : : */ - 859 [ + - ]: 535791 : if (unlikely(subflow->disposable)) + 859 [ + - ]: 500937 : if (unlikely(subflow->disposable)) 860 : : return; 861 : : - 862 : 535791 : ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf); - 863 : 535791 : sk_rbuf = READ_ONCE(sk->sk_rcvbuf); - 864 [ + + ]: 535791 : if (unlikely(ssk_rbuf > sk_rbuf)) - 865 : 4 : sk_rbuf = ssk_rbuf; + 862 : 500937 : ssk_rbuf = READ_ONCE(ssk->sk_rcvbuf); + 863 : 500937 : sk_rbuf = READ_ONCE(sk->sk_rcvbuf); + 864 [ - + ]: 500937 : if (unlikely(ssk_rbuf > sk_rbuf)) + 865 : 0 : sk_rbuf = ssk_rbuf; 866 : : 867 : : /* over limit? can't append more skbs to msk, Also, no need to wake-up*/ - 868 [ + + ]: 535791 : if (__mptcp_rmem(sk) > sk_rbuf) + 868 [ + + ]: 500937 : if (__mptcp_rmem(sk) > sk_rbuf) 869 : : return; 870 : : 871 : : /* Wake-up the reader only for in-sequence data */ - 872 : 535644 : mptcp_data_lock(sk); - 873 [ + + + - ]: 535644 : if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) - 874 : 453822 : sk->sk_data_ready(sk); - 875 : 535644 : mptcp_data_unlock(sk); + 872 : 497112 : mptcp_data_lock(sk); + 873 [ + + + - ]: 497112 : if (move_skbs_to_msk(msk, ssk) && mptcp_epollin_ready(sk)) + 874 : 399549 : sk->sk_data_ready(sk); + 875 : 497112 : mptcp_data_unlock(sk); 876 : : } 877 : : - 878 : 882 : static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk) + 878 : 886 : static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk) 879 : : { - 880 : 882 : mptcp_subflow_ctx(ssk)->map_seq = READ_ONCE(msk->ack_seq); - 881 : 882 : WRITE_ONCE(msk->allow_infinite_fallback, false); - 882 : 882 : mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC); - 883 : 882 : } + 880 : 886 : mptcp_subflow_ctx(ssk)->map_seq = READ_ONCE(msk->ack_seq); + 881 : 886 : WRITE_ONCE(msk->allow_infinite_fallback, false); + 882 : 886 : mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC); + 883 : 886 : } 884 : : - 885 : 450 : static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk) + 885 : 452 : static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk) 886 : : { - 887 : 450 : struct sock *sk = (struct sock *)msk; + 887 : 452 : struct sock *sk = (struct sock *)msk; 888 : : - 889 [ + - ]: 450 : if (sk->sk_state != TCP_ESTABLISHED) + 889 [ + - ]: 452 : if (sk->sk_state != TCP_ESTABLISHED) 890 : : return false; 891 : : 892 : : /* attach to msk socket only after we are sure we will deal with it 893 : : * at close time 894 : : */ - 895 [ + + + - ]: 450 : if (sk->sk_socket && !ssk->sk_socket) - 896 : 436 : mptcp_sock_graft(ssk, sk->sk_socket); + 895 [ + + + - ]: 452 : if (sk->sk_socket && !ssk->sk_socket) + 896 : 437 : mptcp_sock_graft(ssk, sk->sk_socket); 897 : : - 898 : 450 : mptcp_subflow_ctx(ssk)->subflow_id = msk->subflow_id++; - 899 : 450 : mptcp_sockopt_sync_locked(msk, ssk); - 900 : 450 : mptcp_subflow_joined(msk, ssk); - 901 : 450 : mptcp_stop_tout_timer(sk); - 902 [ + - ]: 450 : __mptcp_propagate_sndbuf(sk, ssk); + 898 : 452 : mptcp_subflow_ctx(ssk)->subflow_id = msk->subflow_id++; + 899 : 452 : mptcp_sockopt_sync_locked(msk, ssk); + 900 : 452 : mptcp_subflow_joined(msk, ssk); + 901 : 452 : mptcp_stop_tout_timer(sk); + 902 [ + - ]: 452 : __mptcp_propagate_sndbuf(sk, ssk); 903 : : return true; 904 : : } 905 : : - 906 : 14 : static void __mptcp_flush_join_list(struct sock *sk, struct list_head *join_list) + 906 : 20 : static void __mptcp_flush_join_list(struct sock *sk, struct list_head *join_list) 907 : : { - 908 : 14 : struct mptcp_subflow_context *tmp, *subflow; - 909 [ - + ]: 14 : struct mptcp_sock *msk = mptcp_sk(sk); + 908 : 20 : struct mptcp_subflow_context *tmp, *subflow; + 909 [ - + ]: 20 : struct mptcp_sock *msk = mptcp_sk(sk); 910 : : - 911 [ + + ]: 28 : list_for_each_entry_safe(subflow, tmp, join_list, node) { - 912 : 14 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 913 : 14 : bool slow = lock_sock_fast(ssk); + 911 [ + + ]: 44 : list_for_each_entry_safe(subflow, tmp, join_list, node) { + 912 : 24 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 913 : 24 : bool slow = lock_sock_fast(ssk); 914 : : - 915 : 14 : list_move_tail(&subflow->node, &msk->conn_list); - 916 [ - + ]: 14 : if (!__mptcp_finish_join(msk, ssk)) + 915 : 24 : list_move_tail(&subflow->node, &msk->conn_list); + 916 [ - + ]: 24 : if (!__mptcp_finish_join(msk, ssk)) 917 : 0 : mptcp_subflow_reset(ssk); - 918 : 14 : unlock_sock_fast(ssk, slow); + 918 : 24 : unlock_sock_fast(ssk, slow); 919 : : } - 920 : 14 : } + 920 : 20 : } 921 : : 922 : 0 : static bool mptcp_rtx_timer_pending(struct sock *sk) 923 : : { - 924 : 289734 : return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); + 924 : 386500 : return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); 925 : : } 926 : : - 927 : 182152 : static void mptcp_reset_rtx_timer(struct sock *sk) + 927 : 231907 : static void mptcp_reset_rtx_timer(struct sock *sk) 928 : : { - 929 : 182152 : struct inet_connection_sock *icsk = inet_csk(sk); - 930 : 182152 : unsigned long tout; + 929 : 231907 : struct inet_connection_sock *icsk = inet_csk(sk); + 930 : 231907 : unsigned long tout; 931 : : 932 : : /* prevent rescheduling on close */ - 933 [ + + ]: 182152 : if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) + 933 [ + + ]: 231907 : if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) 934 : : return; 935 : : - 936 [ - + ]: 182086 : tout = mptcp_sk(sk)->timer_ival; - 937 : 182086 : sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout); + 936 [ - + ]: 231850 : tout = mptcp_sk(sk)->timer_ival; + 937 : 231850 : sk_reset_timer(sk, &icsk->icsk_retransmit_timer, jiffies + tout); 938 : : } 939 : : - 940 : 10860 : bool mptcp_schedule_work(struct sock *sk) + 940 : 13139 : bool mptcp_schedule_work(struct sock *sk) 941 : : { - 942 [ + + + + ]: 21330 : if (inet_sk_state_load(sk) != TCP_CLOSE && - 943 [ - + + + ]: 10567 : schedule_work(&mptcp_sk(sk)->work)) { + 942 [ + + + + ]: 25864 : if (inet_sk_state_load(sk) != TCP_CLOSE && + 943 [ - + + + ]: 12817 : schedule_work(&mptcp_sk(sk)->work)) { 944 : : /* each subflow already holds a reference to the sk, and the 945 : : * workqueue is invoked by a subflow, so sk can't go away here. 946 : : */ - 947 : 9446 : sock_hold(sk); - 948 : 9446 : return true; + 947 : 11761 : sock_hold(sk); + 948 : 11761 : return true; 949 : : } 950 : : return false; 951 : : } 952 : : - 953 : 138816 : static struct sock *mptcp_subflow_recv_lookup(const struct mptcp_sock *msk) + 953 : 187800 : static struct sock *mptcp_subflow_recv_lookup(const struct mptcp_sock *msk) 954 : : { - 955 : 248447 : struct mptcp_subflow_context *subflow; + 955 : 324499 : struct mptcp_subflow_context *subflow; 956 : : - 957 : 248447 : msk_owned_by_me(msk); + 957 : 324499 : msk_owned_by_me(msk); 958 : : - 959 [ + + ]: 779430 : mptcp_for_each_subflow(msk, subflow) { - 960 [ + + + + ]: 532408 : if (READ_ONCE(subflow->data_avail)) - 961 : 1425 : return mptcp_subflow_tcp_sock(subflow); + 959 [ + + ]: 964976 : mptcp_for_each_subflow(msk, subflow) { + 960 [ + + + + ]: 641292 : if (READ_ONCE(subflow->data_avail)) + 961 : 815 : return mptcp_subflow_tcp_sock(subflow); 962 : : } 963 : : 964 : : return NULL; 965 : : } 966 : : - 967 : 348779 : static bool mptcp_skb_can_collapse_to(u64 write_seq, + 967 : 389744 : static bool mptcp_skb_can_collapse_to(u64 write_seq, 968 : : const struct sk_buff *skb, 969 : : const struct mptcp_ext *mpext) 970 : : { - 971 [ + + ]: 348779 : if (!tcp_skb_can_collapse_to(skb)) + 971 [ + + ]: 389744 : if (!tcp_skb_can_collapse_to(skb)) 972 : : return false; 973 : : 974 : : /* can collapse only if MPTCP level sequence is in order and this 975 : : * mapping has not been xmitted yet 976 : : */ - 977 [ + - + + ]: 670868 : return mpext && mpext->data_seq + mpext->data_len == write_seq && - 978 [ + + ]: 297462 : !mpext->frozen; + 977 [ + - + + ]: 749230 : return mpext && mpext->data_seq + mpext->data_len == write_seq && + 978 [ + + ]: 329724 : !mpext->frozen; 979 : : } 980 : : 981 : : /* we can append data to the given data frag if: @@ -1066,44 +1066,44 @@ 983 : : * - the data frag tail matches the current page_frag free offset 984 : : * - the data frag end sequence number matches the current write seq 985 : : */ - 986 : 277201 : static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk, + 986 : 378738 : static bool mptcp_frag_can_collapse_to(const struct mptcp_sock *msk, 987 : : const struct page_frag *pfrag, 988 : : const struct mptcp_data_frag *df) 989 : : { - 990 [ + - ]: 168486 : return df && pfrag->page == df->page && - 991 [ + + ]: 168486 : pfrag->size - pfrag->offset > 0 && - 992 [ + + + - ]: 357787 : pfrag->offset == (df->offset + df->data_len) && - 993 [ - + ]: 80586 : df->data_seq + df->data_len == msk->write_seq; + 990 [ + - ]: 188411 : return df && pfrag->page == df->page && + 991 [ + + ]: 188411 : pfrag->size - pfrag->offset > 0 && + 992 [ + + + - ]: 479632 : pfrag->offset == (df->offset + df->data_len) && + 993 [ - + ]: 100894 : df->data_seq + df->data_len == msk->write_seq; 994 : : } 995 : : 996 : 0 : static void dfrag_uncharge(struct sock *sk, int len) 997 : : { - 998 : 321109 : sk_mem_uncharge(sk, len); - 999 : 321109 : sk_wmem_queued_add(sk, -len); - 1000 : 124512 : } + 998 : 438430 : sk_mem_uncharge(sk, len); + 999 : 438430 : sk_wmem_queued_add(sk, -len); + 1000 : 160604 : } 1001 : : - 1002 : 196609 : static void dfrag_clear(struct sock *sk, struct mptcp_data_frag *dfrag) + 1002 : 277838 : static void dfrag_clear(struct sock *sk, struct mptcp_data_frag *dfrag) 1003 : : { - 1004 : 196609 : int len = dfrag->data_len + dfrag->overhead; + 1004 : 277838 : int len = dfrag->data_len + dfrag->overhead; 1005 : : - 1006 : 196609 : list_del(&dfrag->list); - 1007 : 196609 : dfrag_uncharge(sk, len); - 1008 : 196609 : put_page(dfrag->page); - 1009 : 196609 : } + 1006 : 277838 : list_del(&dfrag->list); + 1007 : 277838 : dfrag_uncharge(sk, len); + 1008 : 277838 : put_page(dfrag->page); + 1009 : 277838 : } 1010 : : 1011 : : /* called under both the msk socket lock and the data lock */ - 1012 : 186643 : static void __mptcp_clean_una(struct sock *sk) + 1012 : 236435 : static void __mptcp_clean_una(struct sock *sk) 1013 : : { - 1014 [ - + ]: 186643 : struct mptcp_sock *msk = mptcp_sk(sk); - 1015 : 186643 : struct mptcp_data_frag *dtmp, *dfrag; - 1016 : 186643 : u64 snd_una; + 1014 [ - + ]: 236435 : struct mptcp_sock *msk = mptcp_sk(sk); + 1015 : 236435 : struct mptcp_data_frag *dtmp, *dfrag; + 1016 : 236435 : u64 snd_una; 1017 : : - 1018 : 186643 : snd_una = msk->snd_una; - 1019 [ + + ]: 383198 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) { - 1020 [ + + ]: 359542 : if (after64(dfrag->data_seq + dfrag->data_len, snd_una)) + 1018 : 236435 : snd_una = msk->snd_una; + 1019 [ + + ]: 513739 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) { + 1020 [ + + ]: 479875 : if (after64(dfrag->data_seq + dfrag->data_len, snd_una)) 1021 : : break; 1022 : : - 1023 [ - + ]: 196555 : if (unlikely(dfrag == msk->first_pending)) { + 1023 [ - + ]: 277304 : if (unlikely(dfrag == msk->first_pending)) { 1024 : : /* in recovery mode can see ack after the current snd head */ 1025 [ # # # # ]: 0 : if (WARN_ON_ONCE(!msk->recovery)) 1026 : : break; @@ -1111,15 +1111,15 @@ 1028 : 0 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); 1029 : : } 1030 : : - 1031 : 196555 : dfrag_clear(sk, dfrag); + 1031 : 277304 : dfrag_clear(sk, dfrag); 1032 : : } 1033 : : - 1034 : 186643 : dfrag = mptcp_rtx_head(sk); - 1035 [ + + + + ]: 186643 : if (dfrag && after64(snd_una, dfrag->data_seq)) { - 1036 : 124512 : u64 delta = snd_una - dfrag->data_seq; + 1034 : 236435 : dfrag = mptcp_rtx_head(sk); + 1035 [ + + + + ]: 236435 : if (dfrag && after64(snd_una, dfrag->data_seq)) { + 1036 : 160604 : u64 delta = snd_una - dfrag->data_seq; 1037 : : 1038 : : /* prevent wrap around in recovery mode */ - 1039 [ - + ]: 124512 : if (unlikely(delta > dfrag->already_sent)) { + 1039 [ - + ]: 160604 : if (unlikely(delta > dfrag->already_sent)) { 1040 [ # # # # ]: 0 : if (WARN_ON_ONCE(!msk->recovery)) 1041 : 0 : goto out; 1042 [ # # # # ]: 0 : if (WARN_ON_ONCE(delta > dfrag->data_len)) @@ -1127,45 +1127,45 @@ 1044 : 0 : dfrag->already_sent += delta - dfrag->already_sent; 1045 : : } 1046 : : - 1047 : 124512 : dfrag->data_seq += delta; - 1048 : 124512 : dfrag->offset += delta; - 1049 : 124512 : dfrag->data_len -= delta; - 1050 : 124512 : dfrag->already_sent -= delta; + 1047 : 160604 : dfrag->data_seq += delta; + 1048 : 160604 : dfrag->offset += delta; + 1049 : 160604 : dfrag->data_len -= delta; + 1050 : 160604 : dfrag->already_sent -= delta; 1051 : : - 1052 : 124512 : dfrag_uncharge(sk, delta); + 1052 : 160604 : dfrag_uncharge(sk, delta); 1053 : : } 1054 : : 1055 : : /* all retransmitted data acked, recovery completed */ - 1056 [ + + + + : 186643 : if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) - + + ] - 1057 : 18 : msk->recovery = false; + 1056 [ + + + + : 236435 : if (unlikely(msk->recovery) && after64(msk->snd_una, msk->recovery_snd_nxt)) + + + ] + 1057 : 20 : msk->recovery = false; 1058 : : - 1059 : 186567 : out: - 1060 [ + + + + ]: 186643 : if (snd_una == msk->snd_nxt && snd_una == msk->write_seq) { - 1061 [ + + + + ]: 22339 : if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) - 1062 : 15394 : mptcp_stop_rtx_timer(sk); + 1059 : 236358 : out: + 1060 [ + + + + ]: 236435 : if (snd_una == msk->snd_nxt && snd_una == msk->write_seq) { + 1061 [ + + + + ]: 32490 : if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) + 1062 : 25313 : mptcp_stop_rtx_timer(sk); 1063 : : } else { - 1064 : 164304 : mptcp_reset_rtx_timer(sk); + 1064 : 203945 : mptcp_reset_rtx_timer(sk); 1065 : : } 1066 : : - 1067 [ + + ]: 186643 : if (mptcp_pending_data_fin_ack(sk)) - 1068 : 1649 : mptcp_schedule_work(sk); - 1069 : 186643 : } + 1067 [ + + ]: 236435 : if (mptcp_pending_data_fin_ack(sk)) + 1068 : 1663 : mptcp_schedule_work(sk); + 1069 : 236435 : } 1070 : : - 1071 : 12920 : static void __mptcp_clean_una_wakeup(struct sock *sk) + 1071 : 20042 : static void __mptcp_clean_una_wakeup(struct sock *sk) 1072 : : { - 1073 [ + - - + ]: 20513 : lockdep_assert_held_once(&sk->sk_lock.slock); + 1073 [ + - - + ]: 36451 : lockdep_assert_held_once(&sk->sk_lock.slock); 1074 : : - 1075 : 20513 : __mptcp_clean_una(sk); - 1076 : 20513 : mptcp_write_space(sk); - 1077 : 18311 : } + 1075 : 36451 : __mptcp_clean_una(sk); + 1076 : 36451 : mptcp_write_space(sk); + 1077 : 32077 : } 1078 : : - 1079 : 4470 : static void mptcp_clean_una_wakeup(struct sock *sk) + 1079 : 6691 : static void mptcp_clean_una_wakeup(struct sock *sk) 1080 : : { - 1081 : 4470 : mptcp_data_lock(sk); - 1082 : 4470 : __mptcp_clean_una_wakeup(sk); - 1083 : 4470 : mptcp_data_unlock(sk); - 1084 : 4470 : } + 1081 : 6691 : mptcp_data_lock(sk); + 1082 : 6691 : __mptcp_clean_una_wakeup(sk); + 1083 : 6691 : mptcp_data_unlock(sk); + 1084 : 6691 : } 1085 : : 1086 : 0 : static void mptcp_enter_memory_pressure(struct sock *sk) 1087 : : { @@ -1188,9 +1188,9 @@ 1104 : : /* ensure we get enough memory for the frag hdr, beyond some minimal amount of 1105 : : * data 1106 : : */ - 1107 : 196615 : static bool mptcp_page_frag_refill(struct sock *sk, struct page_frag *pfrag) + 1107 : 277844 : static bool mptcp_page_frag_refill(struct sock *sk, struct page_frag *pfrag) 1108 : : { - 1109 [ - + ]: 196615 : if (likely(skb_page_frag_refill(32U + sizeof(struct mptcp_data_frag), + 1109 [ - + ]: 277844 : if (likely(skb_page_frag_refill(32U + sizeof(struct mptcp_data_frag), 1110 : : pfrag, sk->sk_allocation))) 1111 : : return true; 1112 : : @@ -1199,21 +1199,21 @@ 1115 : : } 1116 : : 1117 : : static struct mptcp_data_frag * - 1118 : 196615 : mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, + 1118 : 277844 : mptcp_carve_data_frag(const struct mptcp_sock *msk, struct page_frag *pfrag, 1119 : : int orig_offset) 1120 : : { - 1121 : 196615 : int offset = ALIGN(orig_offset, sizeof(long)); - 1122 : 196615 : struct mptcp_data_frag *dfrag; + 1121 : 277844 : int offset = ALIGN(orig_offset, sizeof(long)); + 1122 : 277844 : struct mptcp_data_frag *dfrag; 1123 : : - 1124 : 196615 : dfrag = (struct mptcp_data_frag *)(page_to_virt(pfrag->page) + offset); - 1125 : 196615 : dfrag->data_len = 0; - 1126 : 196615 : dfrag->data_seq = msk->write_seq; - 1127 : 196615 : dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); - 1128 : 196615 : dfrag->offset = offset + sizeof(struct mptcp_data_frag); - 1129 : 196615 : dfrag->already_sent = 0; - 1130 : 196615 : dfrag->page = pfrag->page; + 1124 : 277844 : dfrag = (struct mptcp_data_frag *)(page_to_virt(pfrag->page) + offset); + 1125 : 277844 : dfrag->data_len = 0; + 1126 : 277844 : dfrag->data_seq = msk->write_seq; + 1127 : 277844 : dfrag->overhead = offset - orig_offset + sizeof(struct mptcp_data_frag); + 1128 : 277844 : dfrag->offset = offset + sizeof(struct mptcp_data_frag); + 1129 : 277844 : dfrag->already_sent = 0; + 1130 : 277844 : dfrag->page = pfrag->page; 1131 : : - 1132 : 196615 : return dfrag; + 1132 : 277844 : return dfrag; 1133 : : } 1134 : : 1135 : : struct mptcp_sendmsg_info { @@ -1225,47 +1225,47 @@ 1141 : : bool data_lock_held; 1142 : : }; 1143 : : - 1144 : 444201 : static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, + 1144 : 497851 : static int mptcp_check_allowed_size(const struct mptcp_sock *msk, struct sock *ssk, 1145 : : u64 data_seq, int avail_size) 1146 : : { - 1147 : 444201 : u64 window_end = mptcp_wnd_end(msk); - 1148 : 444201 : u64 mptcp_snd_wnd; + 1147 : 497851 : u64 window_end = mptcp_wnd_end(msk); + 1148 : 497851 : u64 mptcp_snd_wnd; 1149 : : - 1150 [ + + ]: 444201 : if (__mptcp_check_fallback(msk)) + 1150 [ + + ]: 497851 : if (__mptcp_check_fallback(msk)) 1151 : : return avail_size; 1152 : : - 1153 : 420332 : mptcp_snd_wnd = window_end - data_seq; - 1154 : 420332 : avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); + 1153 : 461562 : mptcp_snd_wnd = window_end - data_seq; + 1154 : 461562 : avail_size = min_t(unsigned int, mptcp_snd_wnd, avail_size); 1155 : : - 1156 [ - + + + ]: 420332 : if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { - 1157 [ - + ]: 1236 : tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); - 1158 [ + - ]: 1236 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); + 1156 [ - + + + ]: 461562 : if (unlikely(tcp_sk(ssk)->snd_wnd < mptcp_snd_wnd)) { + 1157 [ - + ]: 2223 : tcp_sk(ssk)->snd_wnd = min_t(u64, U32_MAX, mptcp_snd_wnd); + 1158 [ + - ]: 2223 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_SNDWNDSHARED); 1159 : : } 1160 : : 1161 : : return avail_size; 1162 : : } 1163 : : - 1164 : 162148 : static bool __mptcp_add_ext(struct sk_buff *skb, gfp_t gfp) + 1164 : 203568 : static bool __mptcp_add_ext(struct sk_buff *skb, gfp_t gfp) 1165 : : { - 1166 : 162148 : struct skb_ext *mpext = __skb_ext_alloc(gfp); + 1166 : 203568 : struct skb_ext *mpext = __skb_ext_alloc(gfp); 1167 : : - 1168 [ + - ]: 162148 : if (!mpext) + 1168 [ + - ]: 203568 : if (!mpext) 1169 : : return false; - 1170 : 162148 : __skb_ext_set(skb, SKB_EXT_MPTCP, mpext); - 1171 : 162148 : return true; + 1170 : 203568 : __skb_ext_set(skb, SKB_EXT_MPTCP, mpext); + 1171 : 203568 : return true; 1172 : : } 1173 : : - 1174 : 162148 : static struct sk_buff *__mptcp_do_alloc_tx_skb(struct sock *sk, gfp_t gfp) + 1174 : 203568 : static struct sk_buff *__mptcp_do_alloc_tx_skb(struct sock *sk, gfp_t gfp) 1175 : : { - 1176 : 162148 : struct sk_buff *skb; + 1176 : 203568 : struct sk_buff *skb; 1177 : : - 1178 : 162148 : skb = alloc_skb_fclone(MAX_TCP_HEADER, gfp); - 1179 [ + - ]: 162148 : if (likely(skb)) { - 1180 [ + - ]: 162148 : if (likely(__mptcp_add_ext(skb, gfp))) { - 1181 : 162148 : skb_reserve(skb, MAX_TCP_HEADER); - 1182 : 162148 : skb->ip_summed = CHECKSUM_PARTIAL; - 1183 : 162148 : INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); - 1184 : 162148 : return skb; + 1178 : 203568 : skb = alloc_skb_fclone(MAX_TCP_HEADER, gfp); + 1179 [ + - ]: 203568 : if (likely(skb)) { + 1180 [ + - ]: 203568 : if (likely(__mptcp_add_ext(skb, gfp))) { + 1181 : 203568 : skb_reserve(skb, MAX_TCP_HEADER); + 1182 : 203568 : skb->ip_summed = CHECKSUM_PARTIAL; + 1183 : 203568 : INIT_LIST_HEAD(&skb->tcp_tsorted_anchor); + 1184 : 203568 : return skb; 1185 : : } 1186 : 0 : __kfree_skb(skb); 1187 : : } else { @@ -1274,17 +1274,17 @@ 1190 : : return NULL; 1191 : : } 1192 : : - 1193 : 162148 : static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t gfp) + 1193 : 203568 : static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gfp_t gfp) 1194 : : { - 1195 : 162148 : struct sk_buff *skb; + 1195 : 203568 : struct sk_buff *skb; 1196 : : - 1197 : 162148 : skb = __mptcp_do_alloc_tx_skb(sk, gfp); - 1198 [ - + ]: 162148 : if (!skb) + 1197 : 203568 : skb = __mptcp_do_alloc_tx_skb(sk, gfp); + 1198 [ - + ]: 203568 : if (!skb) 1199 : : return NULL; 1200 : : - 1201 [ + - ]: 162148 : if (likely(sk_wmem_schedule(ssk, skb->truesize))) { - 1202 : 162148 : tcp_skb_entail(ssk, skb); - 1203 : 162148 : return skb; + 1201 [ + - ]: 203568 : if (likely(sk_wmem_schedule(ssk, skb->truesize))) { + 1202 : 203568 : tcp_skb_entail(ssk, skb); + 1203 : 203568 : return skb; 1204 : : } 1205 : 0 : tcp_skb_tsorted_anchor_cleanup(skb); 1206 : 0 : kfree_skb(skb); @@ -1293,22 +1293,22 @@ 1209 : : 1210 : 12 : static struct sk_buff *mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, bool data_lock_held) 1211 : : { - 1212 : 117386 : gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation; + 1212 : 166973 : gfp_t gfp = data_lock_held ? GFP_ATOMIC : sk->sk_allocation; 1213 : : - 1214 : 162148 : return __mptcp_alloc_tx_skb(sk, ssk, gfp); + 1214 : 203568 : return __mptcp_alloc_tx_skb(sk, ssk, gfp); 1215 : : } 1216 : : 1217 : : /* note: this always recompute the csum on the whole skb, even 1218 : : * if we just appended a single frag. More status info needed 1219 : : */ - 1220 : 847 : static void mptcp_update_data_checksum(struct sk_buff *skb, int added) + 1220 : 843 : static void mptcp_update_data_checksum(struct sk_buff *skb, int added) 1221 : : { - 1222 [ + - ]: 847 : struct mptcp_ext *mpext = mptcp_get_ext(skb); - 1223 : 847 : __wsum csum = ~csum_unfold(mpext->csum); - 1224 : 847 : int offset = skb->len - added; + 1222 [ + - ]: 843 : struct mptcp_ext *mpext = mptcp_get_ext(skb); + 1223 : 843 : __wsum csum = ~csum_unfold(mpext->csum); + 1224 : 843 : int offset = skb->len - added; 1225 : : - 1226 [ # # ]: 847 : mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); - 1227 : 847 : } + 1226 [ # # ]: 843 : mpext->csum = csum_fold(csum_block_add(csum, skb_checksum(skb, offset, added, 0), offset)); + 1227 : 843 : } 1228 : : 1229 : 2 : static void mptcp_update_infinite_map(struct mptcp_sock *msk, 1230 : : struct sock *ssk, @@ -1328,79 +1328,79 @@ 1244 : : 1245 : : #define MPTCP_MAX_GSO_SIZE (GSO_LEGACY_MAX_SIZE - (MAX_TCP_HEADER + 1)) 1246 : : - 1247 : 444202 : static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, + 1247 : 497851 : static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, 1248 : : struct mptcp_data_frag *dfrag, 1249 : : struct mptcp_sendmsg_info *info) 1250 : : { - 1251 : 444202 : u64 data_seq = dfrag->data_seq + info->sent; - 1252 : 444202 : int offset = dfrag->offset + info->sent; - 1253 [ - + ]: 444202 : struct mptcp_sock *msk = mptcp_sk(sk); - 1254 : 444202 : bool zero_window_probe = false; - 1255 : 444202 : struct mptcp_ext *mpext = NULL; - 1256 : 444202 : bool can_coalesce = false; - 1257 : 444202 : bool reuse_skb = true; - 1258 : 444202 : struct sk_buff *skb; - 1259 : 444202 : size_t copy; - 1260 : 444202 : int i; + 1251 : 497851 : u64 data_seq = dfrag->data_seq + info->sent; + 1252 : 497851 : int offset = dfrag->offset + info->sent; + 1253 [ - + ]: 497851 : struct mptcp_sock *msk = mptcp_sk(sk); + 1254 : 497851 : bool zero_window_probe = false; + 1255 : 497851 : struct mptcp_ext *mpext = NULL; + 1256 : 497851 : bool can_coalesce = false; + 1257 : 497851 : bool reuse_skb = true; + 1258 : 497851 : struct sk_buff *skb; + 1259 : 497851 : size_t copy; + 1260 : 497851 : int i; 1261 : : - 1262 [ - + ]: 444202 : pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u\n", + 1262 [ - + ]: 497851 : pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u\n", 1263 : : msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent); 1264 : : - 1265 [ + - - + ]: 444202 : if (WARN_ON_ONCE(info->sent > info->limit || + 1265 [ + - - + ]: 497851 : if (WARN_ON_ONCE(info->sent > info->limit || 1266 : : info->limit > dfrag->data_len)) 1267 : 0 : return 0; 1268 : : - 1269 [ + + ]: 444202 : if (unlikely(!__tcp_can_send(ssk))) + 1269 [ + - ]: 497851 : if (unlikely(!__tcp_can_send(ssk))) 1270 : : return -EAGAIN; 1271 : : 1272 : : /* compute send limit */ - 1273 [ - + ]: 444201 : if (unlikely(ssk->sk_gso_max_size > MPTCP_MAX_GSO_SIZE)) + 1273 [ - + ]: 497851 : if (unlikely(ssk->sk_gso_max_size > MPTCP_MAX_GSO_SIZE)) 1274 : 0 : ssk->sk_gso_max_size = MPTCP_MAX_GSO_SIZE; - 1275 : 444201 : info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); - 1276 : 444201 : copy = info->size_goal; + 1275 : 497851 : info->mss_now = tcp_send_mss(ssk, &info->size_goal, info->flags); + 1276 : 497851 : copy = info->size_goal; 1277 : : - 1278 [ + + ]: 444201 : skb = tcp_write_queue_tail(ssk); - 1279 [ + - + + ]: 375561 : if (skb && copy > skb->len) { + 1278 [ + + ]: 497851 : skb = tcp_write_queue_tail(ssk); + 1279 [ + - + + ]: 415415 : if (skb && copy > skb->len) { 1280 : : /* Limit the write to the size available in the 1281 : : * current skb, if any, so that we create at most a new skb. 1282 : : * Explicitly tells TCP internals to avoid collapsing on later 1283 : : * queue management operation, to avoid breaking the ext <-> 1284 : : * SSN association set here 1285 : : */ - 1286 [ + - ]: 348779 : mpext = mptcp_get_ext(skb); - 1287 [ + + ]: 348779 : if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { - 1288 : 66531 : TCP_SKB_CB(skb)->eor = 1; - 1289 [ - + ]: 66531 : tcp_mark_push(tcp_sk(ssk), skb); - 1290 : 66531 : goto alloc_skb; + 1286 [ + - ]: 389744 : mpext = mptcp_get_ext(skb); + 1287 [ + + ]: 389744 : if (!mptcp_skb_can_collapse_to(data_seq, skb, mpext)) { + 1288 : 95186 : TCP_SKB_CB(skb)->eor = 1; + 1289 [ - + ]: 95186 : tcp_mark_push(tcp_sk(ssk), skb); + 1290 : 95186 : goto alloc_skb; 1291 : : } 1292 : : - 1293 : 282248 : i = skb_shinfo(skb)->nr_frags; - 1294 : 282248 : can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); - 1295 [ + + + + ]: 282248 : if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) { - 1296 [ - + ]: 195 : tcp_mark_push(tcp_sk(ssk), skb); - 1297 : 195 : goto alloc_skb; + 1293 : 294558 : i = skb_shinfo(skb)->nr_frags; + 1294 : 294558 : can_coalesce = skb_can_coalesce(skb, i, dfrag->page, offset); + 1295 [ + + + + ]: 294558 : if (!can_coalesce && i >= READ_ONCE(net_hotdata.sysctl_max_skb_frags)) { + 1296 [ - + ]: 275 : tcp_mark_push(tcp_sk(ssk), skb); + 1297 : 275 : goto alloc_skb; 1298 : : } 1299 : : - 1300 : 282053 : copy -= skb->len; + 1300 : 294283 : copy -= skb->len; 1301 : : } else { 1302 [ + + ]: 12 : alloc_skb: - 1303 [ + + + + ]: 162148 : skb = mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); - 1304 [ - + ]: 162148 : if (!skb) + 1303 [ + + + + ]: 203568 : skb = mptcp_alloc_tx_skb(sk, ssk, info->data_lock_held); + 1304 [ - + ]: 203568 : if (!skb) 1305 : : return -ENOMEM; 1306 : : - 1307 [ + - ]: 162148 : i = skb_shinfo(skb)->nr_frags; - 1308 : 162148 : reuse_skb = false; - 1309 [ + - ]: 162148 : mpext = mptcp_get_ext(skb); + 1307 [ + - ]: 203568 : i = skb_shinfo(skb)->nr_frags; + 1308 : 203568 : reuse_skb = false; + 1309 [ + - ]: 203568 : mpext = mptcp_get_ext(skb); 1310 : : } 1311 : : 1312 : : /* Zero window and all data acked? Probe. */ - 1313 : 444201 : copy = mptcp_check_allowed_size(msk, ssk, data_seq, copy); - 1314 [ + + ]: 444201 : if (copy == 0) { - 1315 : 162796 : u64 snd_una = READ_ONCE(msk->snd_una); + 1313 : 497851 : copy = mptcp_check_allowed_size(msk, ssk, data_seq, copy); + 1314 [ + + ]: 497851 : if (copy == 0) { + 1315 : 149955 : u64 snd_una = READ_ONCE(msk->snd_una); 1316 : : - 1317 [ + + + - ]: 176456 : if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { - 1318 : 162796 : tcp_remove_empty_skb(ssk); - 1319 : 162796 : return 0; + 1317 [ + + + - ]: 169698 : if (snd_una != msk->snd_nxt || tcp_write_queue_tail(ssk)) { + 1318 : 149955 : tcp_remove_empty_skb(ssk); + 1319 : 149955 : return 0; 1320 : : } 1321 : : 1322 : 0 : zero_window_probe = true; @@ -1408,47 +1408,47 @@ 1324 : 0 : copy = 1; 1325 : : } 1326 : : - 1327 : 281405 : copy = min_t(size_t, copy, info->limit - info->sent); - 1328 [ - + ]: 281405 : if (!sk_wmem_schedule(ssk, copy)) { + 1327 : 347896 : copy = min_t(size_t, copy, info->limit - info->sent); + 1328 [ - + ]: 347896 : if (!sk_wmem_schedule(ssk, copy)) { 1329 : 0 : tcp_remove_empty_skb(ssk); 1330 : 0 : return -ENOMEM; 1331 : : } 1332 : : - 1333 [ + + ]: 281405 : if (can_coalesce) { - 1334 : 27628 : skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); + 1333 [ + + ]: 347896 : if (can_coalesce) { + 1334 : 18286 : skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy); 1335 : : } else { - 1336 : 253777 : get_page(dfrag->page); - 1337 : 253777 : skb_fill_page_desc(skb, i, dfrag->page, offset, copy); + 1336 : 329610 : get_page(dfrag->page); + 1337 : 329610 : skb_fill_page_desc(skb, i, dfrag->page, offset, copy); 1338 : : } 1339 : : - 1340 : 281405 : skb->len += copy; - 1341 : 281405 : skb->data_len += copy; - 1342 : 281405 : skb->truesize += copy; - 1343 [ + - ]: 281405 : sk_wmem_queued_add(ssk, copy); - 1344 [ + - ]: 281405 : sk_mem_charge(ssk, copy); - 1345 [ - + - + ]: 281405 : WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); - 1346 : 281405 : TCP_SKB_CB(skb)->end_seq += copy; - 1347 [ + + ]: 281405 : tcp_skb_pcount_set(skb, 0); + 1340 : 347896 : skb->len += copy; + 1341 : 347896 : skb->data_len += copy; + 1342 : 347896 : skb->truesize += copy; + 1343 [ + - ]: 347896 : sk_wmem_queued_add(ssk, copy); + 1344 [ + - ]: 347896 : sk_mem_charge(ssk, copy); + 1345 [ - + - + ]: 347896 : WRITE_ONCE(tcp_sk(ssk)->write_seq, tcp_sk(ssk)->write_seq + copy); + 1346 : 347896 : TCP_SKB_CB(skb)->end_seq += copy; + 1347 [ + + ]: 347896 : tcp_skb_pcount_set(skb, 0); 1348 : : 1349 : : /* on skb reuse we just need to update the DSS len */ - 1350 [ + + ]: 281405 : if (reuse_skb) { - 1351 : 158613 : TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; - 1352 : 158613 : mpext->data_len += copy; - 1353 : 158613 : goto out; + 1350 [ + + ]: 347896 : if (reuse_skb) { + 1351 : 191810 : TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; + 1352 : 191810 : mpext->data_len += copy; + 1353 : 191810 : goto out; 1354 : : } 1355 : : - 1356 : 122792 : memset(mpext, 0, sizeof(*mpext)); - 1357 : 122792 : mpext->data_seq = data_seq; - 1358 [ - + ]: 122792 : mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq; - 1359 : 122792 : mpext->data_len = copy; - 1360 : 122792 : mpext->use_map = 1; - 1361 : 122792 : mpext->dsn64 = 1; + 1356 : 156086 : memset(mpext, 0, sizeof(*mpext)); + 1357 : 156086 : mpext->data_seq = data_seq; + 1358 [ - + ]: 156086 : mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq; + 1359 : 156086 : mpext->data_len = copy; + 1360 : 156086 : mpext->use_map = 1; + 1361 : 156086 : mpext->dsn64 = 1; 1362 : : - 1363 [ - + ]: 122792 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d\n", + 1363 [ - + ]: 156086 : pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d\n", 1364 : : mpext->data_seq, mpext->subflow_seq, mpext->data_len, 1365 : : mpext->dsn64); 1366 : : - 1367 [ - + ]: 122792 : if (zero_window_probe) { + 1367 [ - + ]: 156086 : if (zero_window_probe) { 1368 [ # # ]: 0 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; 1369 : 0 : mpext->frozen = 1; 1370 [ # # # # ]: 0 : if (READ_ONCE(msk->csum_enabled)) @@ -1456,14 +1456,14 @@ 1372 : 0 : tcp_push_pending_frames(ssk); 1373 : 0 : return 0; 1374 : : } - 1375 : 122792 : out: - 1376 [ + + + + ]: 281405 : if (READ_ONCE(msk->csum_enabled)) - 1377 : 847 : mptcp_update_data_checksum(skb, copy); - 1378 [ + + ]: 281405 : if (mptcp_subflow_ctx(ssk)->send_infinite_map) + 1375 : 156086 : out: + 1376 [ + + + + ]: 347896 : if (READ_ONCE(msk->csum_enabled)) + 1377 : 843 : mptcp_update_data_checksum(skb, copy); + 1378 [ + + ]: 347896 : if (mptcp_subflow_ctx(ssk)->send_infinite_map) 1379 : 2 : mptcp_update_infinite_map(msk, ssk, mpext); - 1380 : 281405 : trace_mptcp_sendmsg_frag(mpext); - 1381 : 281405 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; - 1382 : 281405 : return copy; + 1380 : 347896 : trace_mptcp_sendmsg_frag(mpext); + 1381 : 347896 : mptcp_subflow_ctx(ssk)->rel_write_seq += copy; + 1382 : 347896 : return copy; 1383 : : } 1384 : : 1385 : : #define MPTCP_SEND_BURST_SIZE ((1 << 16) - \ @@ -1477,26 +1477,26 @@ 1393 : : u64 linger_time; 1394 : : }; 1395 : : - 1396 : 132 : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow) + 1396 : 171 : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow) 1397 : : { - 1398 [ - + ]: 132 : if (!subflow->stale) + 1398 [ - + ]: 171 : if (!subflow->stale) 1399 : : return; 1400 : : 1401 : 0 : subflow->stale = 0; 1402 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(mptcp_subflow_tcp_sock(subflow)), MPTCP_MIB_SUBFLOWRECOVER); 1403 : : } 1404 : : - 1405 : 798214 : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) + 1405 : 1013204 : bool mptcp_subflow_active(struct mptcp_subflow_context *subflow) 1406 : : { - 1407 [ + + ]: 798214 : if (unlikely(subflow->stale)) { - 1408 [ - + ]: 80961 : u32 rcv_tstamp = READ_ONCE(tcp_sk(mptcp_subflow_tcp_sock(subflow))->rcv_tstamp); + 1407 [ + + ]: 1013204 : if (unlikely(subflow->stale)) { + 1408 [ - + ]: 108960 : u32 rcv_tstamp = READ_ONCE(tcp_sk(mptcp_subflow_tcp_sock(subflow))->rcv_tstamp); 1409 : : - 1410 [ - + ]: 80961 : if (subflow->stale_rcv_tstamp == rcv_tstamp) + 1410 [ - + ]: 108960 : if (subflow->stale_rcv_tstamp == rcv_tstamp) 1411 : : return false; 1412 : : 1413 : 0 : mptcp_subflow_set_active(subflow); 1414 : : } - 1415 : 717253 : return __mptcp_subflow_active(subflow); + 1415 : 904244 : return __mptcp_subflow_active(subflow); 1416 : : } 1417 : : 1418 : : #define SSK_MODE_ACTIVE 0 @@ -1507,53 +1507,53 @@ 1423 : : * returns the subflow that will transmit the next DSS 1424 : : * additionally updates the rtx timeout 1425 : : */ - 1426 : 346420 : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) + 1426 : 405889 : struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk) 1427 : : { - 1428 : 346420 : struct subflow_send_info send_info[SSK_MODE_MAX]; - 1429 : 346420 : struct mptcp_subflow_context *subflow; - 1430 : 346420 : struct sock *sk = (struct sock *)msk; - 1431 : 346420 : u32 pace, burst, wmem; - 1432 : 346420 : int i, nr_active = 0; - 1433 : 346420 : struct sock *ssk; - 1434 : 346420 : u64 linger_time; - 1435 : 346420 : long tout = 0; + 1428 : 405889 : struct subflow_send_info send_info[SSK_MODE_MAX]; + 1429 : 405889 : struct mptcp_subflow_context *subflow; + 1430 : 405889 : struct sock *sk = (struct sock *)msk; + 1431 : 405889 : u32 pace, burst, wmem; + 1432 : 405889 : int i, nr_active = 0; + 1433 : 405889 : struct sock *ssk; + 1434 : 405889 : u64 linger_time; + 1435 : 405889 : long tout = 0; 1436 : : 1437 : : /* pick the subflow with the lower wmem/wspace ratio */ - 1438 [ + + ]: 1039260 : for (i = 0; i < SSK_MODE_MAX; ++i) { - 1439 : 692840 : send_info[i].ssk = NULL; - 1440 : 692840 : send_info[i].linger_time = -1; + 1438 [ + + ]: 1217667 : for (i = 0; i < SSK_MODE_MAX; ++i) { + 1439 : 811778 : send_info[i].ssk = NULL; + 1440 : 811778 : send_info[i].linger_time = -1; 1441 : : } 1442 : : - 1443 [ + + ]: 983326 : mptcp_for_each_subflow(msk, subflow) { - 1444 : 636906 : bool backup = subflow->backup || subflow->request_bkup; + 1443 [ + + ]: 1185653 : mptcp_for_each_subflow(msk, subflow) { + 1444 : 779764 : bool backup = subflow->backup || subflow->request_bkup; 1445 : : - 1446 : 636906 : trace_mptcp_subflow_get_send(subflow); - 1447 : 636906 : ssk = mptcp_subflow_tcp_sock(subflow); - 1448 [ + + ]: 636906 : if (!mptcp_subflow_active(subflow)) - 1449 : 82528 : continue; + 1446 : 779764 : trace_mptcp_subflow_get_send(subflow); + 1447 : 779764 : ssk = mptcp_subflow_tcp_sock(subflow); + 1448 [ + + ]: 779764 : if (!mptcp_subflow_active(subflow)) + 1449 : 110517 : continue; 1450 : : - 1451 [ + + ]: 554378 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); - 1452 : 554378 : nr_active += !backup; - 1453 : 554378 : pace = subflow->avg_pacing_rate; - 1454 [ + + ]: 554378 : if (unlikely(!pace)) { + 1451 [ + + ]: 669247 : tout = max(tout, mptcp_timeout_from_subflow(subflow)); + 1452 : 669247 : nr_active += !backup; + 1453 : 669247 : pace = subflow->avg_pacing_rate; + 1454 [ + + ]: 669247 : if (unlikely(!pace)) { 1455 : : /* init pacing rate from socket */ - 1456 : 2468 : subflow->avg_pacing_rate = READ_ONCE(ssk->sk_pacing_rate); - 1457 : 2468 : pace = subflow->avg_pacing_rate; - 1458 [ - + ]: 2468 : if (!pace) + 1456 : 2472 : subflow->avg_pacing_rate = READ_ONCE(ssk->sk_pacing_rate); + 1457 : 2472 : pace = subflow->avg_pacing_rate; + 1458 [ - + ]: 2472 : if (!pace) 1459 : 0 : continue; 1460 : : } 1461 : : - 1462 [ + + ]: 554378 : linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); - 1463 [ + + ]: 554378 : if (linger_time < send_info[backup].linger_time) { - 1464 : 431873 : send_info[backup].ssk = ssk; - 1465 : 431873 : send_info[backup].linger_time = linger_time; + 1462 [ + + ]: 669247 : linger_time = div_u64((u64)READ_ONCE(ssk->sk_wmem_queued) << 32, pace); + 1463 [ + + ]: 669247 : if (linger_time < send_info[backup].linger_time) { + 1464 : 533326 : send_info[backup].ssk = ssk; + 1465 : 533326 : send_info[backup].linger_time = linger_time; 1466 : : } 1467 : : } - 1468 : 346420 : __mptcp_set_timeout(sk, tout); + 1468 : 405889 : __mptcp_set_timeout(sk, tout); 1469 : : 1470 : : /* pick the best backup if no other subflow is active */ - 1471 [ + + ]: 346420 : if (!nr_active) - 1472 : 29070 : send_info[SSK_MODE_ACTIVE].ssk = send_info[SSK_MODE_BACKUP].ssk; + 1471 [ + + ]: 405889 : if (!nr_active) + 1472 : 36856 : send_info[SSK_MODE_ACTIVE].ssk = send_info[SSK_MODE_BACKUP].ssk; 1473 : : 1474 : : /* According to the blest algorithm, to avoid HoL blocking for the 1475 : : * faster flow, we need to: @@ -1566,40 +1566,40 @@ 1482 : : * the queued mem, which basically ensure the above. We just need 1483 : : * to check that subflow has a non empty cwin. 1484 : : */ - 1485 : 346420 : ssk = send_info[SSK_MODE_ACTIVE].ssk; - 1486 [ + + + + ]: 692680 : if (!ssk || !sk_stream_memory_free(ssk)) - 1487 : 68535 : return NULL; + 1485 : 405889 : ssk = send_info[SSK_MODE_ACTIVE].ssk; + 1486 [ + + + + ]: 811619 : if (!ssk || !sk_stream_memory_free(ssk)) + 1487 : 75126 : return NULL; 1488 : : - 1489 : 277885 : burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); - 1490 : 277885 : wmem = READ_ONCE(ssk->sk_wmem_queued); - 1491 [ + + ]: 277885 : if (!burst) + 1489 : 330763 : burst = min_t(int, MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt); + 1490 : 330763 : wmem = READ_ONCE(ssk->sk_wmem_queued); + 1491 [ + + ]: 330763 : if (!burst) 1492 : : return ssk; 1493 : : - 1494 : 168885 : subflow = mptcp_subflow_ctx(ssk); - 1495 : 168885 : subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem + - 1496 : 168885 : READ_ONCE(ssk->sk_pacing_rate) * burst, + 1494 : 219491 : subflow = mptcp_subflow_ctx(ssk); + 1495 : 219491 : subflow->avg_pacing_rate = div_u64((u64)subflow->avg_pacing_rate * wmem + + 1496 : 219491 : READ_ONCE(ssk->sk_pacing_rate) * burst, 1497 : : burst + wmem); - 1498 : 168885 : msk->snd_burst = burst; - 1499 : 168885 : return ssk; + 1498 : 219491 : msk->snd_burst = burst; + 1499 : 219491 : return ssk; 1500 : : } 1501 : : - 1502 : 165669 : static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info) + 1502 : 266240 : static void mptcp_push_release(struct sock *ssk, struct mptcp_sendmsg_info *info) 1503 : : { - 1504 [ - + ]: 165669 : tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); - 1505 : 165669 : release_sock(ssk); - 1506 : 165669 : } + 1504 [ - + ]: 266240 : tcp_push(ssk, 0, info->mss_now, tcp_sk(ssk)->nonagle, info->size_goal); + 1505 : 266240 : release_sock(ssk); + 1506 : 266240 : } 1507 : : - 1508 : 281365 : static void mptcp_update_post_push(struct mptcp_sock *msk, + 1508 : 347807 : static void mptcp_update_post_push(struct mptcp_sock *msk, 1509 : : struct mptcp_data_frag *dfrag, 1510 : : u32 sent) 1511 : : { - 1512 : 281365 : u64 snd_nxt_new = dfrag->data_seq; + 1512 : 347807 : u64 snd_nxt_new = dfrag->data_seq; 1513 : : - 1514 : 281365 : dfrag->already_sent += sent; + 1514 : 347807 : dfrag->already_sent += sent; 1515 : : - 1516 : 281365 : msk->snd_burst -= sent; + 1516 : 347807 : msk->snd_burst -= sent; 1517 : : - 1518 : 281365 : snd_nxt_new += dfrag->already_sent; + 1518 : 347807 : snd_nxt_new += dfrag->already_sent; 1519 : : 1520 : : /* snd_nxt_new can be smaller than snd_nxt in case mptcp 1521 : : * is recovering after a failover. In that event, this re-sends @@ -1610,113 +1610,113 @@ 1526 : : * that has been handed to the subflow for transmission 1527 : : * and skip update in case it was old dfrag. 1528 : : */ - 1529 [ + + ]: 281365 : if (likely(after64(snd_nxt_new, msk->snd_nxt))) { - 1530 : 276854 : msk->bytes_sent += snd_nxt_new - msk->snd_nxt; - 1531 : 276854 : WRITE_ONCE(msk->snd_nxt, snd_nxt_new); + 1529 [ + + ]: 347807 : if (likely(after64(snd_nxt_new, msk->snd_nxt))) { + 1530 : 342313 : msk->bytes_sent += snd_nxt_new - msk->snd_nxt; + 1531 : 342313 : WRITE_ONCE(msk->snd_nxt, snd_nxt_new); 1532 : : } - 1533 : 281365 : } + 1533 : 347807 : } 1534 : : - 1535 : 3880 : void mptcp_check_and_set_pending(struct sock *sk) + 1535 : 6014 : void mptcp_check_and_set_pending(struct sock *sk) 1536 : : { - 1537 [ + + ]: 3880 : if (mptcp_send_head(sk)) { - 1538 : 1596 : mptcp_data_lock(sk); - 1539 [ - + ]: 1596 : mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); - 1540 : 1596 : mptcp_data_unlock(sk); + 1537 [ + + ]: 6014 : if (mptcp_send_head(sk)) { + 1538 : 1221 : mptcp_data_lock(sk); + 1539 [ - + ]: 1221 : mptcp_sk(sk)->cb_flags |= BIT(MPTCP_PUSH_PENDING); + 1540 : 1221 : mptcp_data_unlock(sk); 1541 : : } - 1542 : 3880 : } + 1542 : 6014 : } 1543 : : - 1544 : 297156 : static int __subflow_push_pending(struct sock *sk, struct sock *ssk, + 1544 : 363277 : static int __subflow_push_pending(struct sock *sk, struct sock *ssk, 1545 : : struct mptcp_sendmsg_info *info) 1546 : : { - 1547 [ - + ]: 297156 : struct mptcp_sock *msk = mptcp_sk(sk); + 1547 [ - + ]: 363277 : struct mptcp_sock *msk = mptcp_sk(sk); 1548 : 24 : struct mptcp_data_frag *dfrag; 1549 : 24 : int len, copied = 0, err = 0; 1550 : : - 1551 [ + + ]: 458443 : while ((dfrag = mptcp_send_head(sk))) { - 1552 : 363562 : info->sent = dfrag->already_sent; - 1553 : 363562 : info->limit = dfrag->data_len; - 1554 : 363562 : len = dfrag->data_len - dfrag->already_sent; - 1555 [ + + ]: 644927 : while (len > 0) { - 1556 : 444162 : int ret = 0; + 1551 [ + + ]: 596689 : while ((dfrag = mptcp_send_head(sk))) { + 1552 : 432851 : info->sent = dfrag->already_sent; + 1553 : 432851 : info->limit = dfrag->data_len; + 1554 : 432851 : len = dfrag->data_len - dfrag->already_sent; + 1555 [ + + ]: 780658 : while (len > 0) { + 1556 : 497762 : int ret = 0; 1557 : : - 1558 : 444162 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info); - 1559 [ + + ]: 444162 : if (ret <= 0) { - 1560 [ + + ]: 162797 : err = copied ? : ret; - 1561 : 162797 : goto out; + 1558 : 497762 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, info); + 1559 [ + + ]: 497762 : if (ret <= 0) { + 1560 [ + + ]: 149955 : err = copied ? : ret; + 1561 : 149955 : goto out; 1562 : : } 1563 : : - 1564 : 281365 : info->sent += ret; - 1565 : 281365 : copied += ret; - 1566 : 281365 : len -= ret; + 1564 : 347807 : info->sent += ret; + 1565 : 347807 : copied += ret; + 1566 : 347807 : len -= ret; 1567 : : - 1568 : 281365 : mptcp_update_post_push(msk, dfrag, ret); + 1568 : 347807 : mptcp_update_post_push(msk, dfrag, ret); 1569 : : } - 1570 : 200765 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); + 1570 : 282896 : WRITE_ONCE(msk->first_pending, mptcp_send_next(sk)); 1571 : : - 1572 [ + + + + ]: 369102 : if (msk->snd_burst <= 0 || - 1573 [ + + - + ]: 161299 : !sk_stream_memory_free(ssk) || - 1574 : 161287 : !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { - 1575 : 39478 : err = copied; - 1576 : 39478 : goto out; + 1572 [ + + + + ]: 523167 : if (msk->snd_burst <= 0 || + 1573 [ + + - + ]: 233424 : !sk_stream_memory_free(ssk) || + 1574 : 233412 : !mptcp_subflow_active(mptcp_subflow_ctx(ssk))) { + 1575 : 49484 : err = copied; + 1576 : 49484 : goto out; 1577 : : } - 1578 : 161287 : mptcp_set_timeout(sk); + 1578 : 233412 : mptcp_set_timeout(sk); 1579 : : } 1580 : : err = copied; 1581 : : - 1582 : 297156 : out: - 1583 [ + + ]: 297156 : if (err > 0) - 1584 : 188266 : msk->last_data_sent = tcp_jiffies32; - 1585 : 297156 : return err; + 1582 : 363277 : out: + 1583 [ + + ]: 363277 : if (err > 0) + 1584 : 252625 : msk->last_data_sent = tcp_jiffies32; + 1585 : 363277 : return err; 1586 : : } 1587 : : - 1588 : 198776 : void __mptcp_push_pending(struct sock *sk, unsigned int flags) + 1588 : 301444 : void __mptcp_push_pending(struct sock *sk, unsigned int flags) 1589 : : { - 1590 : 198776 : struct sock *prev_ssk = NULL, *ssk = NULL; - 1591 [ - + ]: 198776 : struct mptcp_sock *msk = mptcp_sk(sk); - 1592 : 198776 : struct mptcp_sendmsg_info info = { + 1590 : 301444 : struct sock *prev_ssk = NULL, *ssk = NULL; + 1591 [ - + ]: 301444 : struct mptcp_sock *msk = mptcp_sk(sk); + 1592 : 301444 : struct mptcp_sendmsg_info info = { 1593 : : .flags = flags, 1594 : : }; - 1595 : 198776 : bool do_check_data_fin = false; - 1596 : 198776 : int push_count = 1; + 1595 : 301444 : bool do_check_data_fin = false; + 1596 : 301444 : int push_count = 1; 1597 : : - 1598 [ + + + + ]: 376614 : while (mptcp_send_head(sk) && (push_count > 0)) { - 1599 : 209787 : struct mptcp_subflow_context *subflow; - 1600 : 209787 : int ret = 0; + 1598 [ + + + + ]: 580788 : while (mptcp_send_head(sk) && (push_count > 0)) { + 1599 : 313096 : struct mptcp_subflow_context *subflow; + 1600 : 313096 : int ret = 0; 1601 : : - 1602 [ + + ]: 209787 : if (mptcp_sched_get_send(msk)) + 1602 [ + + ]: 313096 : if (mptcp_sched_get_send(msk)) 1603 : : break; 1604 : : - 1605 : 177838 : push_count = 0; + 1605 : 279344 : push_count = 0; 1606 : : - 1607 [ + + ]: 483783 : mptcp_for_each_subflow(msk, subflow) { - 1608 [ + + + + ]: 305945 : if (READ_ONCE(subflow->scheduled)) { - 1609 : 177838 : mptcp_subflow_set_scheduled(subflow, false); + 1607 [ + + ]: 730540 : mptcp_for_each_subflow(msk, subflow) { + 1608 [ + + + + ]: 451196 : if (READ_ONCE(subflow->scheduled)) { + 1609 : 279344 : mptcp_subflow_set_scheduled(subflow, false); 1610 : : - 1611 : 177838 : prev_ssk = ssk; - 1612 [ + + ]: 177838 : ssk = mptcp_subflow_tcp_sock(subflow); - 1613 [ + + ]: 177838 : if (ssk != prev_ssk) { + 1611 : 279344 : prev_ssk = ssk; + 1612 [ + + ]: 279344 : ssk = mptcp_subflow_tcp_sock(subflow); + 1613 [ + + ]: 279344 : if (ssk != prev_ssk) { 1614 : : /* First check. If the ssk has changed since 1615 : : * the last round, release prev_ssk 1616 : : */ - 1617 [ + + ]: 165669 : if (prev_ssk) - 1618 : 465 : mptcp_push_release(prev_ssk, &info); + 1617 [ + + ]: 266240 : if (prev_ssk) + 1618 : 1131 : mptcp_push_release(prev_ssk, &info); 1619 : : 1620 : : /* Need to lock the new subflow only if different 1621 : : * from the previous one, otherwise we are still 1622 : : * helding the relevant lock 1623 : : */ - 1624 : 331326 : lock_sock(ssk); + 1624 : 532468 : lock_sock(ssk); 1625 : : } 1626 : : - 1627 : 177838 : push_count++; + 1627 : 279344 : push_count++; 1628 : : - 1629 : 177838 : ret = __subflow_push_pending(sk, ssk, &info); - 1630 [ + + ]: 177838 : if (ret <= 0) { - 1631 [ + + - - ]: 57886 : if (ret != -EAGAIN || - 1632 [ + - ]: 1 : (1 << ssk->sk_state) & + 1629 : 279344 : ret = __subflow_push_pending(sk, ssk, &info); + 1630 [ + + ]: 279344 : if (ret <= 0) { + 1631 [ - + - - ]: 75918 : if (ret != -EAGAIN || + 1632 [ # # ]: 0 : (1 << ssk->sk_state) & 1633 : : (TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSE)) - 1634 : 32469 : push_count--; - 1635 : 57886 : continue; + 1634 : 40209 : push_count--; + 1635 : 75918 : continue; 1636 : : } 1637 : : do_check_data_fin = true; 1638 : : } @@ -1724,82 +1724,82 @@ 1640 : : } 1641 : : 1642 : : /* at this point we held the socket lock for the last subflow we used */ - 1643 [ + + ]: 198776 : if (ssk) - 1644 : 165204 : mptcp_push_release(ssk, &info); + 1643 [ + + ]: 301444 : if (ssk) + 1644 : 265109 : mptcp_push_release(ssk, &info); 1645 : : 1646 : : /* ensure the rtx timer is running */ - 1647 [ + + ]: 198776 : if (!mptcp_rtx_timer_pending(sk)) - 1648 : 16121 : mptcp_reset_rtx_timer(sk); - 1649 [ + + ]: 198776 : if (do_check_data_fin) - 1650 : 109931 : mptcp_check_send_data_fin(sk); - 1651 : 198776 : } + 1647 [ + + ]: 301444 : if (!mptcp_rtx_timer_pending(sk)) + 1648 : 26277 : mptcp_reset_rtx_timer(sk); + 1649 [ + + ]: 301444 : if (do_check_data_fin) + 1650 : 193404 : mptcp_check_send_data_fin(sk); + 1651 : 301444 : } 1652 : : - 1653 : 98660 : static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) + 1653 : 88870 : static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool first) 1654 : : { - 1655 [ - + ]: 98660 : struct mptcp_sock *msk = mptcp_sk(sk); - 1656 : 98660 : struct mptcp_sendmsg_info info = { + 1655 [ - + ]: 88870 : struct mptcp_sock *msk = mptcp_sk(sk); + 1656 : 88870 : struct mptcp_sendmsg_info info = { 1657 : : .data_lock_held = true, 1658 : : }; - 1659 : 98660 : bool keep_pushing = true; - 1660 : 98660 : struct sock *xmit_ssk; - 1661 : 98660 : int copied = 0; + 1659 : 88870 : bool keep_pushing = true; + 1660 : 88870 : struct sock *xmit_ssk; + 1661 : 88870 : int copied = 0; 1662 : : - 1663 : 98660 : info.flags = 0; - 1664 [ + + + + ]: 220526 : while (mptcp_send_head(sk) && keep_pushing) { - 1665 [ + + ]: 164421 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1666 : 164421 : int ret = 0; + 1663 : 88870 : info.flags = 0; + 1664 [ + + + + ]: 176621 : while (mptcp_send_head(sk) && keep_pushing) { + 1665 [ + + ]: 135641 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1666 : 135641 : int ret = 0; 1667 : : 1668 : : /* check for a different subflow usage only after 1669 : : * spooling the first chunk of data 1670 : : */ - 1671 [ + + ]: 164421 : if (first) { - 1672 : 3402 : mptcp_subflow_set_scheduled(subflow, false); - 1673 : 3402 : ret = __subflow_push_pending(sk, ssk, &info); - 1674 : 3402 : first = false; - 1675 [ + + ]: 3402 : if (ret <= 0) + 1671 [ + + ]: 135641 : if (first) { + 1672 : 5149 : mptcp_subflow_set_scheduled(subflow, false); + 1673 : 5149 : ret = __subflow_push_pending(sk, ssk, &info); + 1674 : 5149 : first = false; + 1675 [ + + ]: 5149 : if (ret <= 0) 1676 : : break; - 1677 : 2002 : copied += ret; - 1678 : 2002 : continue; + 1677 : 2962 : copied += ret; + 1678 : 2962 : continue; 1679 : : } 1680 : : - 1681 [ + + ]: 161019 : if (mptcp_sched_get_send(msk)) - 1682 : 41155 : goto out; + 1681 [ + + ]: 130492 : if (mptcp_sched_get_send(msk)) + 1682 : 45703 : goto out; 1683 : : - 1684 [ + + + + ]: 119864 : if (READ_ONCE(subflow->scheduled)) { - 1685 : 115916 : mptcp_subflow_set_scheduled(subflow, false); - 1686 : 115916 : ret = __subflow_push_pending(sk, ssk, &info); - 1687 [ + + ]: 115916 : if (ret <= 0) - 1688 : 49604 : keep_pushing = false; - 1689 : 115916 : copied += ret; + 1684 [ + + + + ]: 84789 : if (READ_ONCE(subflow->scheduled)) { + 1685 : 78784 : mptcp_subflow_set_scheduled(subflow, false); + 1686 : 78784 : ret = __subflow_push_pending(sk, ssk, &info); + 1687 [ + + ]: 78784 : if (ret <= 0) + 1688 : 32547 : keep_pushing = false; + 1689 : 78784 : copied += ret; 1690 : : } 1691 : : - 1692 [ + + ]: 270193 : mptcp_for_each_subflow(msk, subflow) { - 1693 [ + + + + ]: 150329 : if (READ_ONCE(subflow->scheduled)) { - 1694 [ + - ]: 3948 : xmit_ssk = mptcp_subflow_tcp_sock(subflow); - 1695 [ + - ]: 3948 : if (xmit_ssk != ssk) { - 1696 : 3948 : mptcp_subflow_delegate(subflow, + 1692 [ + + ]: 224540 : mptcp_for_each_subflow(msk, subflow) { + 1693 [ + + + + ]: 139751 : if (READ_ONCE(subflow->scheduled)) { + 1694 [ + - ]: 6005 : xmit_ssk = mptcp_subflow_tcp_sock(subflow); + 1695 [ + - ]: 6005 : if (xmit_ssk != ssk) { + 1696 : 6005 : mptcp_subflow_delegate(subflow, 1697 : : MPTCP_DELEGATE_SEND); - 1698 : 3948 : keep_pushing = false; + 1698 : 6005 : keep_pushing = false; 1699 : : } 1700 : : } 1701 : : } 1702 : : } 1703 : : - 1704 : 57505 : out: + 1704 : 43167 : out: 1705 : : /* __mptcp_alloc_tx_skb could have released some wmem and we are 1706 : : * not going to flush it via release_sock() 1707 : : */ - 1708 [ + + ]: 98660 : if (copied) { - 1709 [ - + ]: 62128 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + 1708 [ + + ]: 88870 : if (copied) { + 1709 [ - + ]: 43918 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, 1710 : : info.size_goal); - 1711 [ + + ]: 62128 : if (!mptcp_rtx_timer_pending(sk)) - 1712 : 49 : mptcp_reset_rtx_timer(sk); + 1711 [ + + ]: 43918 : if (!mptcp_rtx_timer_pending(sk)) + 1712 : 5 : mptcp_reset_rtx_timer(sk); 1713 : : - 1714 [ + + + + ]: 62128 : if (msk->snd_data_fin_enable && - 1715 [ + + ]: 7902 : msk->snd_nxt + 1 == msk->write_seq) - 1716 : 346 : mptcp_schedule_work(sk); + 1714 [ + + + + ]: 43918 : if (msk->snd_data_fin_enable && + 1715 [ + + ]: 5846 : msk->snd_nxt + 1 == msk->write_seq) + 1716 : 317 : mptcp_schedule_work(sk); 1717 : : } - 1718 : 98660 : } + 1718 : 88870 : } 1719 : : 1720 : : static int mptcp_disconnect(struct sock *sk, int flags); 1721 : : @@ -1861,13 +1861,13 @@ 1777 : 82 : return ret; 1778 : : } 1779 : : - 1780 : 277201 : static int do_copy_data_nocache(struct sock *sk, int copy, + 1780 : 378738 : static int do_copy_data_nocache(struct sock *sk, int copy, 1781 : : struct iov_iter *from, char *to) 1782 : : { - 1783 [ - + ]: 277201 : if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { + 1783 [ - + ]: 378738 : if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { 1784 [ # # ]: 0 : if (!copy_from_iter_full_nocache(to, copy, from)) 1785 : 0 : return -EFAULT; - 1786 [ - + ]: 277201 : } else if (!copy_from_iter_full(to, copy, from)) { + 1786 [ - + ]: 378738 : } else if (!copy_from_iter_full(to, copy, from)) { 1787 : 0 : return -EFAULT; 1788 : : } 1789 : : return 0; @@ -1878,16 +1878,16 @@ 1794 : : * Called under the msk socket lock, so we can avoid a bunch of ONCE 1795 : : * annotations. 1796 : : */ - 1797 : 281445 : static u32 mptcp_send_limit(const struct sock *sk) + 1797 : 381520 : static u32 mptcp_send_limit(const struct sock *sk) 1798 : : { - 1799 [ - + ]: 281445 : const struct mptcp_sock *msk = mptcp_sk(sk); - 1800 : 281445 : u32 limit, not_sent; + 1799 [ - + ]: 381520 : const struct mptcp_sock *msk = mptcp_sk(sk); + 1800 : 381520 : u32 limit, not_sent; 1801 : : - 1802 [ + + ]: 281445 : if (sk->sk_wmem_queued >= READ_ONCE(sk->sk_sndbuf)) + 1802 [ + + ]: 381520 : if (sk->sk_wmem_queued >= READ_ONCE(sk->sk_sndbuf)) 1803 : : return 0; 1804 : : - 1805 : 277201 : limit = mptcp_notsent_lowat(sk); - 1806 [ - + ]: 277201 : if (limit == UINT_MAX) + 1805 : 378738 : limit = mptcp_notsent_lowat(sk); + 1806 [ - + ]: 378738 : if (limit == UINT_MAX) 1807 : : return UINT_MAX; 1808 : : 1809 : 0 : not_sent = msk->write_seq - msk->snd_nxt; @@ -1897,20 +1897,20 @@ 1813 : 0 : return limit - not_sent; 1814 : : } 1815 : : - 1816 : 188130 : static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) + 1816 : 289978 : static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 1817 : : { - 1818 [ - + ]: 188130 : struct mptcp_sock *msk = mptcp_sk(sk); - 1819 : 188130 : struct page_frag *pfrag; - 1820 : 188130 : size_t copied = 0; - 1821 : 188130 : int ret = 0; - 1822 : 188130 : long timeo; + 1818 [ - + ]: 289978 : struct mptcp_sock *msk = mptcp_sk(sk); + 1819 : 289978 : struct page_frag *pfrag; + 1820 : 289978 : size_t copied = 0; + 1821 : 289978 : int ret = 0; + 1822 : 289978 : long timeo; 1823 : : 1824 : : /* silently ignore everything else */ - 1825 : 188130 : msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_FASTOPEN; + 1825 : 289978 : msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_FASTOPEN; 1826 : : - 1827 : 188130 : lock_sock(sk); + 1827 : 289978 : lock_sock(sk); 1828 : : - 1829 [ + + + + ]: 188130 : if (unlikely(inet_test_bit(DEFER_CONNECT, sk) || + 1829 [ + + + + ]: 289978 : if (unlikely(inet_test_bit(DEFER_CONNECT, sk) || 1830 : : msg->msg_flags & MSG_FASTOPEN)) { 1831 : 88 : int copied_syn = 0; 1832 : : @@ -1922,401 +1922,401 @@ 1838 : 24 : goto do_error; 1839 : : } 1840 : : - 1841 [ + + ]: 188064 : timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); + 1841 [ + + ]: 289912 : timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); 1842 : : - 1843 [ + + + + ]: 188064 : if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { - 1844 : 59 : ret = sk_stream_wait_connect(sk, &timeo); - 1845 [ + - ]: 59 : if (ret) - 1846 : 59 : goto do_error; + 1843 [ + + + + ]: 289912 : if ((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) { + 1844 : 55 : ret = sk_stream_wait_connect(sk, &timeo); + 1845 [ + - ]: 55 : if (ret) + 1846 : 55 : goto do_error; 1847 : : } 1848 : : - 1849 : 188005 : ret = -EPIPE; - 1850 [ + - - + ]: 188005 : if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) + 1849 : 289857 : ret = -EPIPE; + 1850 [ + - - + ]: 289857 : if (unlikely(sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))) 1851 : 0 : goto do_error; 1852 : : - 1853 [ + - ]: 188005 : pfrag = sk_page_frag(sk); + 1853 [ + - ]: 289857 : pfrag = sk_page_frag(sk); 1854 : : - 1855 [ + + ]: 469450 : while (msg_data_left(msg)) { - 1856 : 281445 : int total_ts, frag_truesize = 0; - 1857 : 281445 : struct mptcp_data_frag *dfrag; - 1858 : 281445 : bool dfrag_collapsed; - 1859 : 281445 : size_t psize, offset; - 1860 : 281445 : u32 copy_limit; + 1855 [ + + ]: 671377 : while (msg_data_left(msg)) { + 1856 : 381520 : int total_ts, frag_truesize = 0; + 1857 : 381520 : struct mptcp_data_frag *dfrag; + 1858 : 381520 : bool dfrag_collapsed; + 1859 : 381520 : size_t psize, offset; + 1860 : 381520 : u32 copy_limit; 1861 : : 1862 : : /* ensure fitting the notsent_lowat() constraint */ - 1863 : 281445 : copy_limit = mptcp_send_limit(sk); - 1864 [ + + ]: 281445 : if (!copy_limit) - 1865 : 4244 : goto wait_for_memory; + 1863 : 381520 : copy_limit = mptcp_send_limit(sk); + 1864 [ + + ]: 381520 : if (!copy_limit) + 1865 : 2782 : goto wait_for_memory; 1866 : : 1867 : : /* reuse tail pfrag, if possible, or carve a new one from the 1868 : : * page allocator 1869 : : */ - 1870 : 277201 : dfrag = mptcp_pending_tail(sk); - 1871 : 277201 : dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); - 1872 [ + + ]: 277201 : if (!dfrag_collapsed) { - 1873 [ - + ]: 196615 : if (!mptcp_page_frag_refill(sk, pfrag)) + 1870 : 378738 : dfrag = mptcp_pending_tail(sk); + 1871 : 378738 : dfrag_collapsed = mptcp_frag_can_collapse_to(msk, pfrag, dfrag); + 1872 [ + + ]: 378738 : if (!dfrag_collapsed) { + 1873 [ - + ]: 277844 : if (!mptcp_page_frag_refill(sk, pfrag)) 1874 : 0 : goto wait_for_memory; 1875 : : - 1876 : 196615 : dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); - 1877 : 196615 : frag_truesize = dfrag->overhead; + 1876 : 277844 : dfrag = mptcp_carve_data_frag(msk, pfrag, pfrag->offset); + 1877 : 277844 : frag_truesize = dfrag->overhead; 1878 : : } 1879 : : 1880 : : /* we do not bound vs wspace, to allow a single packet. 1881 : : * memory accounting will prevent execessive memory usage 1882 : : * anyway 1883 : : */ - 1884 : 277201 : offset = dfrag->offset + dfrag->data_len; - 1885 : 277201 : psize = pfrag->size - offset; - 1886 : 277201 : psize = min_t(size_t, psize, msg_data_left(msg)); - 1887 : 277201 : psize = min_t(size_t, psize, copy_limit); - 1888 : 277201 : total_ts = psize + frag_truesize; + 1884 : 378738 : offset = dfrag->offset + dfrag->data_len; + 1885 : 378738 : psize = pfrag->size - offset; + 1886 : 378738 : psize = min_t(size_t, psize, msg_data_left(msg)); + 1887 : 378738 : psize = min_t(size_t, psize, copy_limit); + 1888 : 378738 : total_ts = psize + frag_truesize; 1889 : : - 1890 [ - + ]: 277201 : if (!sk_wmem_schedule(sk, total_ts)) + 1890 [ - + ]: 378738 : if (!sk_wmem_schedule(sk, total_ts)) 1891 : 0 : goto wait_for_memory; 1892 : : - 1893 : 277213 : ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, - 1894 : 277201 : page_address(dfrag->page) + offset); - 1895 [ - + ]: 277201 : if (ret) + 1893 : 378750 : ret = do_copy_data_nocache(sk, psize, &msg->msg_iter, + 1894 : 378738 : page_address(dfrag->page) + offset); + 1895 [ - + ]: 378738 : if (ret) 1896 : 0 : goto do_error; 1897 : : 1898 : : /* data successfully copied into the write queue */ - 1899 [ + + ]: 277201 : sk_forward_alloc_add(sk, -total_ts); - 1900 : 277201 : copied += psize; - 1901 : 277201 : dfrag->data_len += psize; - 1902 : 277201 : frag_truesize += psize; - 1903 : 277201 : pfrag->offset += frag_truesize; - 1904 : 277201 : WRITE_ONCE(msk->write_seq, msk->write_seq + psize); + 1899 [ + + ]: 378738 : sk_forward_alloc_add(sk, -total_ts); + 1900 : 378738 : copied += psize; + 1901 : 378738 : dfrag->data_len += psize; + 1902 : 378738 : frag_truesize += psize; + 1903 : 378738 : pfrag->offset += frag_truesize; + 1904 : 378738 : WRITE_ONCE(msk->write_seq, msk->write_seq + psize); 1905 : : 1906 : : /* charge data on mptcp pending queue to the msk socket 1907 : : * Note: we charge such data both to sk and ssk 1908 : : */ - 1909 [ + + ]: 277201 : sk_wmem_queued_add(sk, frag_truesize); - 1910 [ + + ]: 277201 : if (!dfrag_collapsed) { - 1911 : 196615 : get_page(dfrag->page); - 1912 [ + + ]: 196615 : list_add_tail(&dfrag->list, &msk->rtx_queue); - 1913 [ + + ]: 196615 : if (!msk->first_pending) - 1914 : 108715 : WRITE_ONCE(msk->first_pending, dfrag); + 1909 [ + + ]: 378738 : sk_wmem_queued_add(sk, frag_truesize); + 1910 [ + + ]: 378738 : if (!dfrag_collapsed) { + 1911 : 277844 : get_page(dfrag->page); + 1912 [ + + ]: 277844 : list_add_tail(&dfrag->list, &msk->rtx_queue); + 1913 [ + + ]: 277844 : if (!msk->first_pending) + 1914 : 190327 : WRITE_ONCE(msk->first_pending, dfrag); 1915 : : } - 1916 [ - + ]: 277201 : pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d\n", msk, + 1916 [ - + ]: 378738 : pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d\n", msk, 1917 : : dfrag->data_seq, dfrag->data_len, dfrag->already_sent, 1918 : : !dfrag_collapsed); 1919 : : - 1920 : 277201 : continue; + 1920 : 378738 : continue; 1921 : : - 1922 : 4244 : wait_for_memory: - 1923 : 4244 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - 1924 : 4244 : __mptcp_push_pending(sk, msg->msg_flags); - 1925 : 4244 : ret = sk_stream_wait_memory(sk, &timeo); - 1926 [ - + ]: 4244 : if (ret) + 1922 : 2782 : wait_for_memory: + 1923 : 2782 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + 1924 : 2782 : __mptcp_push_pending(sk, msg->msg_flags); + 1925 : 2782 : ret = sk_stream_wait_memory(sk, &timeo); + 1926 [ - + ]: 2782 : if (ret) 1927 : 0 : goto do_error; 1928 : : } 1929 : : - 1930 [ + + ]: 188005 : if (copied) - 1931 : 187980 : __mptcp_push_pending(sk, msg->msg_flags); + 1930 [ + + ]: 289857 : if (copied) + 1931 : 289832 : __mptcp_push_pending(sk, msg->msg_flags); 1932 : : 1933 : 25 : out: - 1934 : 188130 : release_sock(sk); - 1935 : 188130 : return copied; + 1934 : 289978 : release_sock(sk); + 1935 : 289978 : return copied; 1936 : : - 1937 : 83 : do_error: - 1938 [ - + ]: 83 : if (copied) + 1937 : 79 : do_error: + 1938 [ - + ]: 79 : if (copied) 1939 : 0 : goto out; 1940 : : - 1941 : 83 : copied = sk_stream_error(sk, msg->msg_flags, ret); - 1942 : 83 : goto out; + 1941 : 79 : copied = sk_stream_error(sk, msg->msg_flags, ret); + 1942 : 79 : goto out; 1943 : : } 1944 : : 1945 : : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied); 1946 : : - 1947 : 503310 : static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, + 1947 : 607094 : static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, 1948 : : struct msghdr *msg, 1949 : : size_t len, int flags, 1950 : : struct scm_timestamping_internal *tss, 1951 : : int *cmsg_flags) 1952 : : { - 1953 : 503310 : struct sk_buff *skb, *tmp; - 1954 : 503310 : int copied = 0; + 1953 : 607094 : struct sk_buff *skb, *tmp; + 1954 : 607094 : int copied = 0; 1955 : : - 1956 [ + + ]: 695206 : skb_queue_walk_safe(&msk->receive_queue, skb, tmp) { - 1957 : 451164 : u32 offset = MPTCP_SKB_CB(skb)->offset; - 1958 : 451164 : u32 data_len = skb->len - offset; - 1959 : 451164 : u32 count = min_t(size_t, len - copied, data_len); - 1960 : 451164 : int err; + 1956 [ + + ]: 842426 : skb_queue_walk_safe(&msk->receive_queue, skb, tmp) { + 1957 : 528933 : u32 offset = MPTCP_SKB_CB(skb)->offset; + 1958 : 528933 : u32 data_len = skb->len - offset; + 1959 : 528933 : u32 count = min_t(size_t, len - copied, data_len); + 1960 : 528933 : int err; 1961 : : - 1962 [ + - ]: 451164 : if (!(flags & MSG_TRUNC)) { - 1963 : 451164 : err = skb_copy_datagram_msg(skb, offset, msg, count); - 1964 [ - + ]: 451164 : if (unlikely(err < 0)) { + 1962 [ + - ]: 528933 : if (!(flags & MSG_TRUNC)) { + 1963 : 528933 : err = skb_copy_datagram_msg(skb, offset, msg, count); + 1964 [ - + ]: 528933 : if (unlikely(err < 0)) { 1965 [ # # ]: 0 : if (!copied) 1966 : : return err; 1967 : : break; 1968 : : } 1969 : : } 1970 : : - 1971 [ + + ]: 451164 : if (MPTCP_SKB_CB(skb)->has_rxtstamp) { - 1972 : 598 : tcp_update_recv_tstamps(skb, tss); - 1973 : 598 : *cmsg_flags |= MPTCP_CMSG_TS; + 1971 [ + + ]: 528933 : if (MPTCP_SKB_CB(skb)->has_rxtstamp) { + 1972 : 599 : tcp_update_recv_tstamps(skb, tss); + 1973 : 599 : *cmsg_flags |= MPTCP_CMSG_TS; 1974 : : } 1975 : : - 1976 : 451164 : copied += count; + 1976 : 528933 : copied += count; 1977 : : - 1978 [ + + ]: 451164 : if (count < data_len) { - 1979 [ + + ]: 255280 : if (!(flags & MSG_PEEK)) { - 1980 : 235224 : MPTCP_SKB_CB(skb)->offset += count; - 1981 : 235224 : MPTCP_SKB_CB(skb)->map_seq += count; - 1982 : 235224 : msk->bytes_consumed += count; + 1978 [ + + ]: 528933 : if (count < data_len) { + 1979 [ + + ]: 281955 : if (!(flags & MSG_PEEK)) { + 1980 : 260907 : MPTCP_SKB_CB(skb)->offset += count; + 1981 : 260907 : MPTCP_SKB_CB(skb)->map_seq += count; + 1982 : 260907 : msk->bytes_consumed += count; 1983 : : } 1984 : : break; 1985 : : } 1986 : : - 1987 [ + + ]: 195884 : if (!(flags & MSG_PEEK)) { + 1987 [ + + ]: 246978 : if (!(flags & MSG_PEEK)) { 1988 : : /* we will bulk release the skb memory later */ - 1989 : 192920 : skb->destructor = NULL; - 1990 : 192920 : WRITE_ONCE(msk->rmem_released, msk->rmem_released + skb->truesize); - 1991 : 192920 : __skb_unlink(skb, &msk->receive_queue); - 1992 : 192920 : __kfree_skb(skb); - 1993 : 192920 : msk->bytes_consumed += count; + 1989 : 243864 : skb->destructor = NULL; + 1990 : 243864 : WRITE_ONCE(msk->rmem_released, msk->rmem_released + skb->truesize); + 1991 : 243864 : __skb_unlink(skb, &msk->receive_queue); + 1992 : 243864 : __kfree_skb(skb); + 1993 : 243864 : msk->bytes_consumed += count; 1994 : : } 1995 : : - 1996 [ + + ]: 195884 : if (copied >= len) + 1996 [ + + ]: 246978 : if (copied >= len) 1997 : : break; 1998 : : } 1999 : : - 2000 : 503310 : mptcp_rcv_space_adjust(msk, copied); - 2001 : 503310 : return copied; + 2000 : 607094 : mptcp_rcv_space_adjust(msk, copied); + 2001 : 607094 : return copied; 2002 : : } 2003 : : 2004 : : /* receive buffer autotuning. See tcp_rcv_space_adjust for more information. 2005 : : * 2006 : : * Only difference: Use highest rtt estimate of the subflows in use. 2007 : : */ - 2008 : 503310 : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) + 2008 : 607094 : static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) 2009 : : { - 2010 : 503310 : struct mptcp_subflow_context *subflow; - 2011 : 503310 : struct sock *sk = (struct sock *)msk; - 2012 : 503310 : u8 scaling_ratio = U8_MAX; - 2013 : 503310 : u32 time, advmss = 1; - 2014 : 503310 : u64 rtt_us, mstamp; + 2010 : 607094 : struct mptcp_subflow_context *subflow; + 2011 : 607094 : struct sock *sk = (struct sock *)msk; + 2012 : 607094 : u8 scaling_ratio = U8_MAX; + 2013 : 607094 : u32 time, advmss = 1; + 2014 : 607094 : u64 rtt_us, mstamp; 2015 : : - 2016 : 503310 : msk_owned_by_me(msk); + 2016 : 607094 : msk_owned_by_me(msk); 2017 : : - 2018 [ + + ]: 503310 : if (copied <= 0) + 2018 [ + + ]: 607094 : if (copied <= 0) 2019 : : return; 2020 : : - 2021 [ - + ]: 385752 : if (!msk->rcvspace_init) + 2021 [ - + ]: 449567 : if (!msk->rcvspace_init) 2022 : 0 : mptcp_rcv_space_init(msk, msk->first); 2023 : : - 2024 : 385752 : msk->rcvq_space.copied += copied; + 2024 : 449567 : msk->rcvq_space.copied += copied; 2025 : : - 2026 [ - + ]: 385752 : mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); - 2027 [ + + ]: 385752 : time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); + 2026 [ - + ]: 449567 : mstamp = div_u64(tcp_clock_ns(), NSEC_PER_USEC); + 2027 [ + + ]: 449567 : time = tcp_stamp_us_delta(mstamp, msk->rcvq_space.time); 2028 : : - 2029 : 385752 : rtt_us = msk->rcvq_space.rtt_us; - 2030 [ + + + + ]: 385752 : if (rtt_us && time < (rtt_us >> 3)) + 2029 : 449567 : rtt_us = msk->rcvq_space.rtt_us; + 2030 [ + + + + ]: 449567 : if (rtt_us && time < (rtt_us >> 3)) 2031 : : return; 2032 : : - 2033 : 68839 : rtt_us = 0; - 2034 [ + + ]: 153508 : mptcp_for_each_subflow(msk, subflow) { - 2035 : 84669 : const struct tcp_sock *tp; - 2036 : 84669 : u64 sf_rtt_us; - 2037 : 84669 : u32 sf_advmss; + 2033 : 71097 : rtt_us = 0; + 2034 [ + + ]: 158527 : mptcp_for_each_subflow(msk, subflow) { + 2035 : 87430 : const struct tcp_sock *tp; + 2036 : 87430 : u64 sf_rtt_us; + 2037 : 87430 : u32 sf_advmss; 2038 : : - 2039 [ - + ]: 84669 : tp = tcp_sk(mptcp_subflow_tcp_sock(subflow)); + 2039 [ - + ]: 87430 : tp = tcp_sk(mptcp_subflow_tcp_sock(subflow)); 2040 : : - 2041 : 84669 : sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us); - 2042 : 84669 : sf_advmss = READ_ONCE(tp->advmss); + 2041 : 87430 : sf_rtt_us = READ_ONCE(tp->rcv_rtt_est.rtt_us); + 2042 : 87430 : sf_advmss = READ_ONCE(tp->advmss); 2043 : : - 2044 : 84669 : rtt_us = max(sf_rtt_us, rtt_us); - 2045 : 84669 : advmss = max(sf_advmss, advmss); - 2046 : 84669 : scaling_ratio = min(tp->scaling_ratio, scaling_ratio); + 2044 : 87430 : rtt_us = max(sf_rtt_us, rtt_us); + 2045 : 87430 : advmss = max(sf_advmss, advmss); + 2046 : 87430 : scaling_ratio = min(tp->scaling_ratio, scaling_ratio); 2047 : : } 2048 : : - 2049 : 68839 : msk->rcvq_space.rtt_us = rtt_us; - 2050 : 68839 : msk->scaling_ratio = scaling_ratio; - 2051 [ + + + + ]: 68839 : if (time < (rtt_us >> 3) || rtt_us == 0) + 2049 : 71097 : msk->rcvq_space.rtt_us = rtt_us; + 2050 : 71097 : msk->scaling_ratio = scaling_ratio; + 2051 [ + + + + ]: 71097 : if (time < (rtt_us >> 3) || rtt_us == 0) 2052 : : return; 2053 : : - 2054 [ + + ]: 55198 : if (msk->rcvq_space.copied <= msk->rcvq_space.space) - 2055 : 52317 : goto new_measure; + 2054 [ + + ]: 57870 : if (msk->rcvq_space.copied <= msk->rcvq_space.space) + 2055 : 54922 : goto new_measure; 2056 : : - 2057 [ + - ]: 2881 : if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && - 2058 [ + - ]: 2881 : !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { - 2059 : 2881 : u64 rcvwin, grow; - 2060 : 2881 : int rcvbuf; + 2057 [ + - ]: 2948 : if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_moderate_rcvbuf) && + 2058 [ + - ]: 2948 : !(sk->sk_userlocks & SOCK_RCVBUF_LOCK)) { + 2059 : 2948 : u64 rcvwin, grow; + 2060 : 2948 : int rcvbuf; 2061 : : - 2062 : 2881 : rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss; + 2062 : 2948 : rcvwin = ((u64)msk->rcvq_space.copied << 1) + 16 * advmss; 2063 : : - 2064 : 2881 : grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space); + 2064 : 2948 : grow = rcvwin * (msk->rcvq_space.copied - msk->rcvq_space.space); 2065 : : - 2066 : 2881 : do_div(grow, msk->rcvq_space.space); - 2067 : 2881 : rcvwin += (grow << 1); + 2066 : 2948 : do_div(grow, msk->rcvq_space.space); + 2067 : 2948 : rcvwin += (grow << 1); 2068 : : - 2069 [ # # ]: 2881 : rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin), + 2069 [ # # ]: 2948 : rcvbuf = min_t(u64, mptcp_space_from_win(sk, rcvwin), 2070 : : READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); 2071 : : - 2072 [ + + ]: 2881 : if (rcvbuf > sk->sk_rcvbuf) { - 2073 : 977 : u32 window_clamp; + 2072 [ + + ]: 2948 : if (rcvbuf > sk->sk_rcvbuf) { + 2073 : 1249 : u32 window_clamp; 2074 : : - 2075 : 977 : window_clamp = mptcp_win_from_space(sk, rcvbuf); - 2076 : 977 : WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); + 2075 : 1249 : window_clamp = mptcp_win_from_space(sk, rcvbuf); + 2076 : 1249 : WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); 2077 : : 2078 : : /* Make subflows follow along. If we do not do this, we 2079 : : * get drops at subflow level if skbs can't be moved to 2080 : : * the mptcp rx queue fast enough (announced rcv_win can 2081 : : * exceed ssk->sk_rcvbuf). 2082 : : */ - 2083 [ + + ]: 2033 : mptcp_for_each_subflow(msk, subflow) { - 2084 : 1056 : struct sock *ssk; - 2085 : 1056 : bool slow; + 2083 [ + + ]: 2590 : mptcp_for_each_subflow(msk, subflow) { + 2084 : 1341 : struct sock *ssk; + 2085 : 1341 : bool slow; 2086 : : - 2087 : 1056 : ssk = mptcp_subflow_tcp_sock(subflow); - 2088 : 1056 : slow = lock_sock_fast(ssk); - 2089 : 1056 : WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); - 2090 [ - + ]: 1056 : WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); - 2091 [ + + ]: 1056 : if (tcp_can_send_ack(ssk)) - 2092 : 1054 : tcp_cleanup_rbuf(ssk, 1); - 2093 : 1056 : unlock_sock_fast(ssk, slow); + 2087 : 1341 : ssk = mptcp_subflow_tcp_sock(subflow); + 2088 : 1341 : slow = lock_sock_fast(ssk); + 2089 : 1341 : WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf); + 2090 [ - + ]: 1341 : WRITE_ONCE(tcp_sk(ssk)->window_clamp, window_clamp); + 2091 [ + + ]: 1341 : if (tcp_can_send_ack(ssk)) + 2092 : 1337 : tcp_cleanup_rbuf(ssk, 1); + 2093 : 1341 : unlock_sock_fast(ssk, slow); 2094 : : } 2095 : : } 2096 : : } 2097 : : - 2098 : 2881 : msk->rcvq_space.space = msk->rcvq_space.copied; - 2099 : 55198 : new_measure: - 2100 : 55198 : msk->rcvq_space.copied = 0; - 2101 : 55198 : msk->rcvq_space.time = mstamp; + 2098 : 2948 : msk->rcvq_space.space = msk->rcvq_space.copied; + 2099 : 57870 : new_measure: + 2100 : 57870 : msk->rcvq_space.copied = 0; + 2101 : 57870 : msk->rcvq_space.time = mstamp; 2102 : : } 2103 : : - 2104 : 781600 : static void __mptcp_update_rmem(struct sock *sk) + 2104 : 986904 : static void __mptcp_update_rmem(struct sock *sk) 2105 : : { - 2106 [ - + ]: 781600 : struct mptcp_sock *msk = mptcp_sk(sk); + 2106 [ - + ]: 986904 : struct mptcp_sock *msk = mptcp_sk(sk); 2107 : : - 2108 [ + + ]: 781600 : if (!msk->rmem_released) + 2108 [ + + ]: 986904 : if (!msk->rmem_released) 2109 : : return; 2110 : : - 2111 : 180188 : atomic_sub(msk->rmem_released, &sk->sk_rmem_alloc); - 2112 : 180188 : mptcp_rmem_uncharge(sk, msk->rmem_released); - 2113 : 180188 : WRITE_ONCE(msk->rmem_released, 0); + 2111 : 216737 : atomic_sub(msk->rmem_released, &sk->sk_rmem_alloc); + 2112 : 216737 : mptcp_rmem_uncharge(sk, msk->rmem_released); + 2113 : 216737 : WRITE_ONCE(msk->rmem_released, 0); 2114 : : } 2115 : : - 2116 : 174590 : static void __mptcp_splice_receive_queue(struct sock *sk) + 2116 : 209661 : static void __mptcp_splice_receive_queue(struct sock *sk) 2117 : : { - 2118 [ - + ]: 174590 : struct mptcp_sock *msk = mptcp_sk(sk); + 2118 [ - + ]: 209661 : struct mptcp_sock *msk = mptcp_sk(sk); 2119 : : - 2120 : 174590 : skb_queue_splice_tail_init(&sk->sk_receive_queue, &msk->receive_queue); - 2121 : 174590 : } + 2120 : 209661 : skb_queue_splice_tail_init(&sk->sk_receive_queue, &msk->receive_queue); + 2121 : 209661 : } 2122 : : - 2123 : 248417 : static bool __mptcp_move_skbs(struct mptcp_sock *msk) + 2123 : 324390 : static bool __mptcp_move_skbs(struct mptcp_sock *msk) 2124 : : { - 2125 : 248417 : struct sock *sk = (struct sock *)msk; - 2126 : 248417 : unsigned int moved = 0; - 2127 : 248417 : bool ret, done; + 2125 : 324390 : struct sock *sk = (struct sock *)msk; + 2126 : 324390 : unsigned int moved = 0; + 2127 : 324390 : bool ret, done; 2128 : : - 2129 : 248447 : do { - 2130 : 248447 : struct sock *ssk = mptcp_subflow_recv_lookup(msk); - 2131 : 248447 : bool slowpath; + 2129 : 324499 : do { + 2130 : 324499 : struct sock *ssk = mptcp_subflow_recv_lookup(msk); + 2131 : 324499 : bool slowpath; 2132 : : 2133 : : /* we can have data pending in the subflows only if the msk 2134 : : * receive buffer was full at subflow_data_ready() time, 2135 : : * that is an unlikely slow path. 2136 : : */ - 2137 [ + + ]: 248447 : if (likely(!ssk)) + 2137 [ + + ]: 324499 : if (likely(!ssk)) 2138 : : break; 2139 : : - 2140 : 1425 : slowpath = lock_sock_fast(ssk); - 2141 : 1425 : mptcp_data_lock(sk); - 2142 : 1425 : __mptcp_update_rmem(sk); - 2143 : 1425 : done = __mptcp_move_skbs_from_subflow(msk, ssk, &moved); - 2144 : 1425 : mptcp_data_unlock(sk); + 2140 : 815 : slowpath = lock_sock_fast(ssk); + 2141 : 815 : mptcp_data_lock(sk); + 2142 : 815 : __mptcp_update_rmem(sk); + 2143 : 815 : done = __mptcp_move_skbs_from_subflow(msk, ssk, &moved); + 2144 : 815 : mptcp_data_unlock(sk); 2145 : : - 2146 [ - + ]: 1425 : if (unlikely(ssk->sk_err)) + 2146 [ - + ]: 815 : if (unlikely(ssk->sk_err)) 2147 : 0 : __mptcp_error_report(sk); - 2148 : 1425 : unlock_sock_fast(ssk, slowpath); - 2149 [ + + ]: 1425 : } while (!done); + 2148 : 815 : unlock_sock_fast(ssk, slowpath); + 2149 [ + + ]: 815 : } while (!done); 2150 : : 2151 : : /* acquire the data lock only if some input data is pending */ - 2152 : 248417 : ret = moved > 0; - 2153 [ + + + + ]: 248417 : if (!RB_EMPTY_ROOT(&msk->out_of_order_queue) || - 2154 [ + + ]: 156604 : !skb_queue_empty_lockless(&sk->sk_receive_queue)) { - 2155 : 174590 : mptcp_data_lock(sk); - 2156 : 174590 : __mptcp_update_rmem(sk); - 2157 : 174590 : ret |= __mptcp_ofo_queue(msk); - 2158 : 174590 : __mptcp_splice_receive_queue(sk); - 2159 : 174590 : mptcp_data_unlock(sk); + 2152 : 324390 : ret = moved > 0; + 2153 [ + + + + ]: 324390 : if (!RB_EMPTY_ROOT(&msk->out_of_order_queue) || + 2154 [ + + ]: 234206 : !skb_queue_empty_lockless(&sk->sk_receive_queue)) { + 2155 : 209661 : mptcp_data_lock(sk); + 2156 : 209661 : __mptcp_update_rmem(sk); + 2157 : 209661 : ret |= __mptcp_ofo_queue(msk); + 2158 : 209661 : __mptcp_splice_receive_queue(sk); + 2159 : 209661 : mptcp_data_unlock(sk); 2160 : : } - 2161 [ + + ]: 248417 : if (ret) - 2162 : 32 : mptcp_check_data_fin((struct sock *)msk); - 2163 : 248417 : return !skb_queue_empty(&msk->receive_queue); + 2161 [ + + ]: 324390 : if (ret) + 2162 : 110 : mptcp_check_data_fin((struct sock *)msk); + 2163 : 324390 : return !skb_queue_empty(&msk->receive_queue); 2164 : : } 2165 : : - 2166 : 432 : static unsigned int mptcp_inq_hint(const struct sock *sk) + 2166 : 433 : static unsigned int mptcp_inq_hint(const struct sock *sk) 2167 : : { - 2168 [ - + ]: 432 : const struct mptcp_sock *msk = mptcp_sk(sk); - 2169 : 432 : const struct sk_buff *skb; + 2168 [ - + ]: 433 : const struct mptcp_sock *msk = mptcp_sk(sk); + 2169 : 433 : const struct sk_buff *skb; 2170 : : - 2171 [ - + ]: 432 : skb = skb_peek(&msk->receive_queue); - 2172 [ # # ]: 0 : if (skb) { - 2173 : 0 : u64 hint_val = READ_ONCE(msk->ack_seq) - MPTCP_SKB_CB(skb)->map_seq; + 2171 [ + + ]: 433 : skb = skb_peek(&msk->receive_queue); + 2172 [ + - ]: 1 : if (skb) { + 2173 : 1 : u64 hint_val = READ_ONCE(msk->ack_seq) - MPTCP_SKB_CB(skb)->map_seq; 2174 : : - 2175 [ # # ]: 0 : if (hint_val >= INT_MAX) + 2175 [ + - ]: 1 : if (hint_val >= INT_MAX) 2176 : : return INT_MAX; 2177 : : - 2178 : 0 : return (unsigned int)hint_val; + 2178 : 1 : return (unsigned int)hint_val; 2179 : : } 2180 : : - 2181 [ + + + + ]: 432 : if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN)) - 2182 : 8 : return 1; + 2181 [ + + + + ]: 432 : if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN)) + 2182 : 9 : return 1; 2183 : : 2184 : : return 0; 2185 : : } 2186 : : - 2187 : 369063 : static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, + 2187 : 432638 : static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 2188 : : int flags, int *addr_len) 2189 : : { - 2190 [ - + ]: 369063 : struct mptcp_sock *msk = mptcp_sk(sk); - 2191 : 369063 : struct scm_timestamping_internal tss; - 2192 : 369063 : int copied = 0, cmsg_flags = 0; - 2193 : 369063 : int target; - 2194 : 369063 : long timeo; + 2190 [ - + ]: 432638 : struct mptcp_sock *msk = mptcp_sk(sk); + 2191 : 432638 : struct scm_timestamping_internal tss; + 2192 : 432638 : int copied = 0, cmsg_flags = 0; + 2193 : 432638 : int target; + 2194 : 432638 : long timeo; 2195 : : 2196 : : /* MSG_ERRQUEUE is really a no-op till we support IP_RECVERR */ - 2197 [ - + ]: 369063 : if (unlikely(flags & MSG_ERRQUEUE)) + 2197 [ - + ]: 432638 : if (unlikely(flags & MSG_ERRQUEUE)) 2198 : 0 : return inet_recv_error(sk, msg, len, addr_len); 2199 : : - 2200 : 369063 : lock_sock(sk); - 2201 [ - + ]: 369063 : if (unlikely(sk->sk_state == TCP_LISTEN)) { + 2200 : 432638 : lock_sock(sk); + 2201 [ - + ]: 432638 : if (unlikely(sk->sk_state == TCP_LISTEN)) { 2202 : 0 : copied = -ENOTCONN; 2203 : 0 : goto out_err; 2204 : : } 2205 : : - 2206 [ + + ]: 369063 : timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); + 2206 [ + + ]: 432638 : timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 2207 : : - 2208 : 369063 : len = min_t(size_t, len, INT_MAX); - 2209 [ + - ]: 369063 : target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); + 2208 : 432638 : len = min_t(size_t, len, INT_MAX); + 2209 [ + - ]: 432638 : target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 2210 : : - 2211 [ + + ]: 369063 : if (unlikely(msk->recvmsg_inq)) - 2212 : 432 : cmsg_flags = MPTCP_CMSG_INQ; + 2211 [ + + ]: 432638 : if (unlikely(msk->recvmsg_inq)) + 2212 : 433 : cmsg_flags = MPTCP_CMSG_INQ; 2213 : : - 2214 [ + + ]: 503687 : while (copied < len) { - 2215 : 503310 : int err, bytes_read; + 2214 [ + + ]: 607840 : while (copied < len) { + 2215 : 607094 : int err, bytes_read; 2216 : : - 2217 : 503310 : bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied, flags, &tss, &cmsg_flags); - 2218 [ - + ]: 503310 : if (unlikely(bytes_read < 0)) { + 2217 : 607094 : bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied, flags, &tss, &cmsg_flags); + 2218 [ - + ]: 607094 : if (unlikely(bytes_read < 0)) { 2219 [ # # ]: 0 : if (!copied) 2220 : 0 : copied = bytes_read; 2221 : 0 : goto out_err; 2222 : : } 2223 : : - 2224 : 503310 : copied += bytes_read; + 2224 : 607094 : copied += bytes_read; 2225 : : - 2226 [ + + + + ]: 503310 : if (skb_queue_empty(&msk->receive_queue) && __mptcp_move_skbs(msk)) - 2227 : 129460 : continue; + 2226 [ + + + + ]: 607094 : if (skb_queue_empty(&msk->receive_queue) && __mptcp_move_skbs(msk)) + 2227 : 165464 : continue; 2228 : : 2229 : : /* only the MPTCP socket status is relevant here. The exit 2230 : : * conditions mirror closely tcp_recvmsg() 2231 : : */ - 2232 [ + + ]: 373850 : if (copied >= target) + 2232 [ + + ]: 441630 : if (copied >= target) 2233 : : break; 2234 : : - 2235 [ - + ]: 6586 : if (copied) { + 2235 [ - + ]: 11162 : if (copied) { 2236 [ # # ]: 0 : if (sk->sk_err || 2237 [ # # ]: 0 : sk->sk_state == TCP_CLOSE || 2238 [ # # ]: 0 : (sk->sk_shutdown & RCV_SHUTDOWN) || @@ -2324,12 +2324,12 @@ 2240 : 0 : signal_pending(current)) 2241 : : break; 2242 : : } else { - 2243 [ + + ]: 6586 : if (sk->sk_err) { - 2244 : 1 : copied = sock_error(sk); - 2245 : 1 : break; + 2243 [ + + ]: 11162 : if (sk->sk_err) { + 2244 : 3 : copied = sock_error(sk); + 2245 : 3 : break; 2246 : : } 2247 : : - 2248 [ + + ]: 6585 : if (sk->sk_shutdown & RCV_SHUTDOWN) { + 2248 [ + + ]: 11159 : if (sk->sk_shutdown & RCV_SHUTDOWN) { 2249 : : /* race breaker: the shutdown could be after the 2250 : : * previous receive queue check 2251 : : */ @@ -2338,73 +2338,73 @@ 2254 : : break; 2255 : : } 2256 : : - 2257 [ + + ]: 5182 : if (sk->sk_state == TCP_CLOSE) { + 2257 [ + + ]: 9756 : if (sk->sk_state == TCP_CLOSE) { 2258 : : copied = -ENOTCONN; 2259 : : break; 2260 : : } 2261 : : - 2262 [ + - ]: 5164 : if (!timeo) { + 2262 [ + - ]: 9738 : if (!timeo) { 2263 : : copied = -EAGAIN; 2264 : : break; 2265 : : } 2266 : : - 2267 [ - + ]: 5164 : if (signal_pending(current)) { + 2267 [ - + ]: 9738 : if (signal_pending(current)) { 2268 [ # # ]: 0 : copied = sock_intr_errno(timeo); 2269 : : break; 2270 : : } 2271 : : } 2272 : : - 2273 [ - + ]: 5164 : pr_debug("block timeout %ld\n", timeo); - 2274 : 5164 : mptcp_cleanup_rbuf(msk, copied); - 2275 : 5164 : err = sk_wait_data(sk, &timeo, NULL); - 2276 [ - + ]: 5164 : if (err < 0) { + 2273 [ - + ]: 9738 : pr_debug("block timeout %ld\n", timeo); + 2274 : 9738 : mptcp_cleanup_rbuf(msk, copied); + 2275 : 9738 : err = sk_wait_data(sk, &timeo, NULL); + 2276 [ - + ]: 9738 : if (err < 0) { 2277 : 0 : err = copied ? : err; 2278 : 0 : goto out_err; 2279 : : } 2280 : : } 2281 : : - 2282 : 369063 : mptcp_cleanup_rbuf(msk, copied); + 2282 : 432638 : mptcp_cleanup_rbuf(msk, copied); 2283 : : - 2284 : 369063 : out_err: - 2285 [ + + + - ]: 369063 : if (cmsg_flags && copied >= 0) { - 2286 [ + + ]: 582 : if (cmsg_flags & MPTCP_CMSG_TS) - 2287 : 574 : tcp_recv_timestamp(msg, sk, &tss); + 2284 : 432638 : out_err: + 2285 [ + + + - ]: 432638 : if (cmsg_flags && copied >= 0) { + 2286 [ + + ]: 583 : if (cmsg_flags & MPTCP_CMSG_TS) + 2287 : 575 : tcp_recv_timestamp(msg, sk, &tss); 2288 : : - 2289 [ + + ]: 582 : if (cmsg_flags & MPTCP_CMSG_INQ) { - 2290 : 432 : unsigned int inq = mptcp_inq_hint(sk); + 2289 [ + + ]: 583 : if (cmsg_flags & MPTCP_CMSG_INQ) { + 2290 : 433 : unsigned int inq = mptcp_inq_hint(sk); 2291 : : - 2292 : 432 : put_cmsg(msg, SOL_TCP, TCP_CM_INQ, sizeof(inq), &inq); + 2292 : 433 : put_cmsg(msg, SOL_TCP, TCP_CM_INQ, sizeof(inq), &inq); 2293 : : } 2294 : : } 2295 : : - 2296 [ - + ]: 369063 : pr_debug("msk=%p rx queue empty=%d:%d copied=%d\n", + 2296 [ - + ]: 432638 : pr_debug("msk=%p rx queue empty=%d:%d copied=%d\n", 2297 : : msk, skb_queue_empty_lockless(&sk->sk_receive_queue), 2298 : : skb_queue_empty(&msk->receive_queue), copied); 2299 : : - 2300 : 369063 : release_sock(sk); - 2301 : 369063 : return copied; + 2300 : 432638 : release_sock(sk); + 2301 : 432638 : return copied; 2302 : : } 2303 : : - 2304 : 4765 : static void mptcp_retransmit_timer(struct timer_list *t) + 2304 : 6997 : static void mptcp_retransmit_timer(struct timer_list *t) 2305 : : { - 2306 : 4765 : struct inet_connection_sock *icsk = from_timer(icsk, t, + 2306 : 6997 : struct inet_connection_sock *icsk = from_timer(icsk, t, 2307 : : icsk_retransmit_timer); - 2308 : 4765 : struct sock *sk = &icsk->icsk_inet.sk; - 2309 [ - + ]: 4765 : struct mptcp_sock *msk = mptcp_sk(sk); + 2308 : 6997 : struct sock *sk = &icsk->icsk_inet.sk; + 2309 [ - + ]: 6997 : struct mptcp_sock *msk = mptcp_sk(sk); 2310 : : - 2311 : 4765 : bh_lock_sock(sk); - 2312 [ + + ]: 4765 : if (!sock_owned_by_user(sk)) { + 2311 : 6997 : bh_lock_sock(sk); + 2312 [ + + ]: 6997 : if (!sock_owned_by_user(sk)) { 2313 : : /* we need a process context to retransmit */ - 2314 [ + - ]: 6711 : if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags)) - 2315 : 4353 : mptcp_schedule_work(sk); + 2314 [ + + ]: 9100 : if (!test_and_set_bit(MPTCP_WORK_RTX, &msk->flags)) + 2315 : 6617 : mptcp_schedule_work(sk); 2316 : : } else { 2317 : : /* delegate our work to tcp_release_cb() */ - 2318 [ - + - - : 412 : __set_bit(MPTCP_RETRANSMIT, &msk->cb_flags); + 2318 [ - + - - : 379 : __set_bit(MPTCP_RETRANSMIT, &msk->cb_flags); - - ] 2319 : : } - 2320 : 4765 : bh_unlock_sock(sk); - 2321 : 4765 : sock_put(sk); - 2322 : 4765 : } + 2320 : 6997 : bh_unlock_sock(sk); + 2321 : 6997 : sock_put(sk); + 2322 : 6997 : } 2323 : : 2324 : 114 : static void mptcp_tout_timer(struct timer_list *t) 2325 : : { @@ -2419,60 +2419,60 @@ 2334 : : * 2335 : : * A backup subflow is returned only if that is the only kind available. 2336 : : */ - 2337 : 1497 : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) + 2337 : 1473 : struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) 2338 : : { - 2339 : 1497 : struct sock *backup = NULL, *pick = NULL; - 2340 : 1497 : struct mptcp_subflow_context *subflow; - 2341 : 1497 : int min_stale_count = INT_MAX; + 2339 : 1473 : struct sock *backup = NULL, *pick = NULL; + 2340 : 1473 : struct mptcp_subflow_context *subflow; + 2341 : 1473 : int min_stale_count = INT_MAX; 2342 : : - 2343 [ + + ]: 3410 : mptcp_for_each_subflow(msk, subflow) { - 2344 : 1913 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 2343 [ + + ]: 3575 : mptcp_for_each_subflow(msk, subflow) { + 2344 : 2102 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 2345 : : - 2346 [ + + ]: 1913 : if (!__mptcp_subflow_active(subflow)) - 2347 : 225 : continue; + 2346 [ + + ]: 2102 : if (!__mptcp_subflow_active(subflow)) + 2347 : 218 : continue; 2348 : : 2349 : : /* still data outstanding at TCP level? skip this */ - 2350 [ + + ]: 1688 : if (!tcp_rtx_and_write_queues_empty(ssk)) { - 2351 : 679 : mptcp_pm_subflow_chk_stale(msk, ssk); - 2352 : 679 : min_stale_count = min_t(int, min_stale_count, subflow->stale_count); - 2353 : 679 : continue; + 2350 [ + + ]: 1884 : if (!tcp_rtx_and_write_queues_empty(ssk)) { + 2351 : 736 : mptcp_pm_subflow_chk_stale(msk, ssk); + 2352 : 736 : min_stale_count = min_t(int, min_stale_count, subflow->stale_count); + 2353 : 736 : continue; 2354 : : } 2355 : : - 2356 [ + + ]: 1009 : if (subflow->backup || subflow->request_bkup) { - 2357 [ + + ]: 46 : if (!backup) - 2358 : 44 : backup = ssk; - 2359 : 46 : continue; + 2356 [ + + ]: 1148 : if (subflow->backup || subflow->request_bkup) { + 2357 [ + - ]: 45 : if (!backup) + 2358 : 45 : backup = ssk; + 2359 : 45 : continue; 2360 : : } 2361 : : - 2362 [ + + ]: 963 : if (!pick) - 2363 : 770 : pick = ssk; + 2362 [ + + ]: 1103 : if (!pick) + 2363 : 804 : pick = ssk; 2364 : : } 2365 : : - 2366 [ + + ]: 1497 : if (pick) + 2366 [ + + ]: 1473 : if (pick) 2367 : : return pick; 2368 : : 2369 : : /* use backup only if there are no progresses anywhere */ - 2370 [ + + ]: 727 : return min_stale_count > 1 ? backup : NULL; + 2370 [ + + ]: 669 : return min_stale_count > 1 ? backup : NULL; 2371 : : } 2372 : : - 2373 : 770 : bool __mptcp_retransmit_pending_data(struct sock *sk) + 2373 : 751 : bool __mptcp_retransmit_pending_data(struct sock *sk) 2374 : : { - 2375 : 770 : struct mptcp_data_frag *cur, *rtx_head; - 2376 [ - + ]: 770 : struct mptcp_sock *msk = mptcp_sk(sk); + 2375 : 751 : struct mptcp_data_frag *cur, *rtx_head; + 2376 [ - + ]: 751 : struct mptcp_sock *msk = mptcp_sk(sk); 2377 : : - 2378 [ + + ]: 770 : if (__mptcp_check_fallback(msk)) + 2378 [ + + ]: 751 : if (__mptcp_check_fallback(msk)) 2379 : : return false; 2380 : : 2381 : : /* the closing socket has some data untransmitted and/or unacked: 2382 : : * some data in the mptcp rtx queue has not really xmitted yet. 2383 : : * keep it simple and re-inject the whole mptcp level rtx queue 2384 : : */ - 2385 : 706 : mptcp_data_lock(sk); - 2386 : 706 : __mptcp_clean_una_wakeup(sk); - 2387 : 706 : rtx_head = mptcp_rtx_head(sk); - 2388 [ + + ]: 706 : if (!rtx_head) { - 2389 : 673 : mptcp_data_unlock(sk); - 2390 : 673 : return false; + 2385 : 694 : mptcp_data_lock(sk); + 2386 : 694 : __mptcp_clean_una_wakeup(sk); + 2387 : 694 : rtx_head = mptcp_rtx_head(sk); + 2388 [ + + ]: 694 : if (!rtx_head) { + 2389 : 661 : mptcp_data_unlock(sk); + 2390 : 661 : return false; 2391 : : } 2392 : : 2393 : 33 : msk->recovery_snd_nxt = msk->snd_nxt; @@ -2483,10 +2483,10 @@ 2398 : 33 : msk->snd_burst = 0; 2399 : : 2400 : : /* be sure to clear the "sent status" on all re-injected fragments */ - 2401 [ + + ]: 4203 : list_for_each_entry(cur, &msk->rtx_queue, list) { - 2402 [ + + ]: 4181 : if (!cur->already_sent) + 2401 [ + + ]: 5104 : list_for_each_entry(cur, &msk->rtx_queue, list) { + 2402 [ + + ]: 5084 : if (!cur->already_sent) 2403 : : break; - 2404 : 4170 : cur->already_sent = 0; + 2404 : 5071 : cur->already_sent = 0; 2405 : : } 2406 : : 2407 : : return true; @@ -2500,22 +2500,22 @@ 2415 : : * clean completely the subflow status when the subflow reaches 2416 : : * TCP_CLOSE state 2417 : : */ - 2418 : 845 : static void __mptcp_subflow_disconnect(struct sock *ssk, + 2418 : 816 : static void __mptcp_subflow_disconnect(struct sock *ssk, 2419 : : struct mptcp_subflow_context *subflow, 2420 : : unsigned int flags) 2421 : : { - 2422 [ + + + + : 845 : if (((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) || - + + ] + 2422 [ + + + + : 816 : if (((1 << ssk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) || + + + ] 2423 : : (flags & MPTCP_CF_FASTCLOSE)) { 2424 : : /* The MPTCP code never wait on the subflow sockets, TCP-level 2425 : : * disconnect should never fail 2426 : : */ - 2427 [ - + ]: 821 : WARN_ON_ONCE(tcp_disconnect(ssk, 0)); - 2428 : 821 : mptcp_subflow_ctx_reset(subflow); + 2427 [ - + ]: 792 : WARN_ON_ONCE(tcp_disconnect(ssk, 0)); + 2428 : 792 : mptcp_subflow_ctx_reset(subflow); 2429 : : } else { 2430 : 24 : tcp_shutdown(ssk, SEND_SHUTDOWN); 2431 : : } - 2432 : 845 : } + 2432 : 816 : } 2433 : : 2434 : : /* subflow sockets can be either outgoing (connect) or incoming 2435 : : * (accept). @@ -2525,21 +2525,21 @@ 2439 : : * so we need to use tcp_close() after detaching them from the mptcp 2440 : : * parent socket. 2441 : : */ - 2442 : 5238 : static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, + 2442 : 5211 : static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, 2443 : : struct mptcp_subflow_context *subflow, 2444 : : unsigned int flags) 2445 : : { - 2446 [ - + ]: 5238 : struct mptcp_sock *msk = mptcp_sk(sk); - 2447 : 5238 : bool dispose_it, need_push = false; + 2446 [ - + ]: 5211 : struct mptcp_sock *msk = mptcp_sk(sk); + 2447 : 5211 : bool dispose_it, need_push = false; 2448 : : 2449 : : /* If the first subflow moved to a close state before accept, e.g. due 2450 : : * to an incoming reset or listener shutdown, the subflow socket is 2451 : : * already deleted by inet_child_forget() and the mptcp socket can't 2452 : : * survive too. 2453 : : */ - 2454 [ + + + + : 5276 : if (msk->in_accept_queue && msk->first == ssk && - + + ] - 2455 [ - + ]: 40 : (sock_flag(sk, SOCK_DEAD) || sock_flag(ssk, SOCK_DEAD))) { + 2454 [ + + + + : 5247 : if (msk->in_accept_queue && msk->first == ssk && + - + ] + 2455 [ - - ]: 36 : (sock_flag(sk, SOCK_DEAD) || sock_flag(ssk, SOCK_DEAD))) { 2456 : : /* ensure later check in mptcp_worker() will dispose the msk */ 2457 : 36 : sock_set_flag(sk, SOCK_DEAD); 2458 : 36 : mptcp_set_close_tout(sk, tcp_jiffies32 - (mptcp_close_timeout(sk) + 1)); @@ -2548,96 +2548,96 @@ 2461 : 36 : goto out_release; 2462 : : } 2463 : : - 2464 [ + + + + ]: 5202 : dispose_it = msk->free_first || ssk != msk->first; + 2464 [ + + + + ]: 5175 : dispose_it = msk->free_first || ssk != msk->first; 2465 : : if (dispose_it) - 2466 : 4357 : list_del(&subflow->node); + 2466 : 4359 : list_del(&subflow->node); 2467 : : - 2468 : 5202 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); + 2468 : 5175 : lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); 2469 : : - 2470 [ + + + + ]: 5202 : if ((flags & MPTCP_CF_FASTCLOSE) && !__mptcp_check_fallback(msk)) { + 2470 [ + + + + ]: 5175 : if ((flags & MPTCP_CF_FASTCLOSE) && !__mptcp_check_fallback(msk)) { 2471 : : /* be sure to force the tcp_close path 2472 : : * to generate the egress reset 2473 : : */ - 2474 : 422 : ssk->sk_lingertime = 0; - 2475 : 422 : sock_set_flag(ssk, SOCK_LINGER); - 2476 : 422 : subflow->send_fastclose = 1; + 2474 : 408 : ssk->sk_lingertime = 0; + 2475 : 408 : sock_set_flag(ssk, SOCK_LINGER); + 2476 : 408 : subflow->send_fastclose = 1; 2477 : : } 2478 : : - 2479 [ + + + + ]: 5202 : need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); - 2480 [ + + ]: 5202 : if (!dispose_it) { - 2481 : 845 : __mptcp_subflow_disconnect(ssk, subflow, flags); - 2482 : 845 : release_sock(ssk); + 2479 [ + + + + ]: 5175 : need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); + 2480 [ + + ]: 5175 : if (!dispose_it) { + 2481 : 816 : __mptcp_subflow_disconnect(ssk, subflow, flags); + 2482 : 816 : release_sock(ssk); 2483 : : - 2484 : 845 : goto out; + 2484 : 816 : goto out; 2485 : : } 2486 : : - 2487 : 4357 : subflow->disposable = 1; + 2487 : 4359 : subflow->disposable = 1; 2488 : : 2489 : : /* if ssk hit tcp_done(), tcp_cleanup_ulp() cleared the related ops 2490 : : * the ssk has been already destroyed, we just need to release the 2491 : : * reference owned by msk; 2492 : : */ - 2493 [ - + ]: 4357 : if (!inet_csk(ssk)->icsk_ulp_ops) { + 2493 [ - + ]: 4359 : if (!inet_csk(ssk)->icsk_ulp_ops) { 2494 [ # # ]: 0 : WARN_ON_ONCE(!sock_flag(ssk, SOCK_DEAD)); 2495 [ # # ]: 0 : kfree_rcu(subflow, rcu); 2496 : : } else { 2497 : : /* otherwise tcp will dispose of the ssk and subflow ctx */ - 2498 : 4357 : __tcp_close(ssk, 0); + 2498 : 4359 : __tcp_close(ssk, 0); 2499 : : 2500 : : /* close acquired an extra ref */ - 2501 : 4357 : __sock_put(ssk); + 2501 : 4359 : __sock_put(ssk); 2502 : : } 2503 : : - 2504 : 4393 : out_release: - 2505 : 4393 : __mptcp_subflow_error_report(sk, ssk); - 2506 : 4393 : release_sock(ssk); + 2504 : 4395 : out_release: + 2505 : 4395 : __mptcp_subflow_error_report(sk, ssk); + 2506 : 4395 : release_sock(ssk); 2507 : : - 2508 : 4393 : sock_put(ssk); + 2508 : 4395 : sock_put(ssk); 2509 : : - 2510 [ + + ]: 4393 : if (ssk == msk->first) + 2510 [ + + ]: 4395 : if (ssk == msk->first) 2511 : 3476 : WRITE_ONCE(msk->first, NULL); 2512 : : - 2513 : 917 : out: - 2514 : 5238 : __mptcp_sync_sndbuf(sk); - 2515 [ + + ]: 5238 : if (need_push) - 2516 : 19 : __mptcp_push_pending(sk, 0); + 2513 : 919 : out: + 2514 : 5211 : __mptcp_sync_sndbuf(sk); + 2515 [ + + ]: 5211 : if (need_push) + 2516 : 15 : __mptcp_push_pending(sk, 0); 2517 : : 2518 : : /* Catch every 'all subflows closed' scenario, including peers silently 2519 : : * closing them, e.g. due to timeout. 2520 : : * For established sockets, allow an additional timeout before closing, 2521 : : * as the protocol can still create more subflows. 2522 : : */ - 2523 [ + + + + : 7476 : if (list_is_singular(&msk->conn_list) && msk->first && - + + ] + 2523 [ + + + + : 7385 : if (list_is_singular(&msk->conn_list) && msk->first && + + + ] 2524 [ + - ]: 24 : inet_sk_state_load(msk->first) == TCP_CLOSE) { - 2525 [ + + + + ]: 822 : if (sk->sk_state != TCP_ESTABLISHED || - 2526 [ - + ]: 32 : msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { - 2527 : 790 : mptcp_set_state(sk, TCP_CLOSE); - 2528 : 790 : mptcp_close_wake_up(sk); + 2525 [ + + + - ]: 792 : if (sk->sk_state != TCP_ESTABLISHED || + 2526 [ - + ]: 35 : msk->in_accept_queue || sock_flag(sk, SOCK_DEAD)) { + 2527 : 757 : mptcp_set_state(sk, TCP_CLOSE); + 2528 : 757 : mptcp_close_wake_up(sk); 2529 : : } else { - 2530 : 32 : mptcp_start_tout_timer(sk); + 2530 : 35 : mptcp_start_tout_timer(sk); 2531 : : } 2532 : : } - 2533 : 5238 : } + 2533 : 5211 : } 2534 : : - 2535 : 793 : void mptcp_close_ssk(struct sock *sk, struct sock *ssk, + 2535 : 769 : void mptcp_close_ssk(struct sock *sk, struct sock *ssk, 2536 : : struct mptcp_subflow_context *subflow) 2537 : : { 2538 : : /* The first subflow can already be closed and still in the list */ - 2539 [ + + ]: 793 : if (subflow->close_event_done) + 2539 [ + + ]: 769 : if (subflow->close_event_done) 2540 : : return; 2541 : : - 2542 : 756 : subflow->close_event_done = true; + 2542 : 733 : subflow->close_event_done = true; 2543 : : - 2544 [ + + ]: 756 : if (sk->sk_state == TCP_ESTABLISHED) - 2545 [ - + ]: 325 : mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); + 2544 [ + + ]: 733 : if (sk->sk_state == TCP_ESTABLISHED) + 2545 [ - + ]: 322 : mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL); 2546 : : 2547 : : /* subflow aborted before reaching the fully_established status 2548 : : * attempt the creation of the next subflow 2549 : : */ - 2550 [ - + ]: 756 : mptcp_pm_subflow_check_next(mptcp_sk(sk), subflow); + 2550 [ - + ]: 733 : mptcp_pm_subflow_check_next(mptcp_sk(sk), subflow); 2551 : : - 2552 : 756 : __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH); + 2552 : 733 : __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH); 2553 : : } 2554 : : 2555 : 0 : static unsigned int mptcp_sync_mss(struct sock *sk, u32 pmtu) @@ -2645,189 +2645,189 @@ 2557 : 0 : return 0; 2558 : : } 2559 : : - 2560 : 601 : static void __mptcp_close_subflow(struct sock *sk) + 2560 : 584 : static void __mptcp_close_subflow(struct sock *sk) 2561 : : { - 2562 : 601 : struct mptcp_subflow_context *subflow, *tmp; - 2563 [ - + ]: 601 : struct mptcp_sock *msk = mptcp_sk(sk); + 2562 : 584 : struct mptcp_subflow_context *subflow, *tmp; + 2563 [ - + ]: 584 : struct mptcp_sock *msk = mptcp_sk(sk); 2564 : : - 2565 : 601 : might_sleep(); + 2565 : 584 : might_sleep(); 2566 : : - 2567 [ + + ]: 1495 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { - 2568 : 894 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 2569 : 894 : int ssk_state = inet_sk_state_load(ssk); + 2567 [ + + ]: 1463 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { + 2568 : 879 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 2569 : 879 : int ssk_state = inet_sk_state_load(ssk); 2570 : : - 2571 [ + + + + ]: 894 : if (ssk_state != TCP_CLOSE && - 2572 [ + + ]: 63 : (ssk_state != TCP_CLOSE_WAIT || + 2571 [ + + + + ]: 879 : if (ssk_state != TCP_CLOSE && + 2572 [ + + ]: 65 : (ssk_state != TCP_CLOSE_WAIT || 2573 [ # # ]: 0 : inet_sk_state_load(sk) != TCP_ESTABLISHED)) - 2574 : 293 : continue; + 2574 : 302 : continue; 2575 : : 2576 : : /* 'subflow_data_ready' will re-sched once rx queue is empty */ - 2577 [ - + ]: 601 : if (!skb_queue_empty_lockless(&ssk->sk_receive_queue)) + 2577 [ - + ]: 577 : if (!skb_queue_empty_lockless(&ssk->sk_receive_queue)) 2578 : 0 : continue; 2579 : : - 2580 : 601 : mptcp_close_ssk(sk, ssk, subflow); + 2580 : 577 : mptcp_close_ssk(sk, ssk, subflow); 2581 : : } 2582 : : - 2583 : 601 : } + 2583 : 584 : } 2584 : : - 2585 : 9339 : static bool mptcp_close_tout_expired(const struct sock *sk) + 2585 : 11653 : static bool mptcp_close_tout_expired(const struct sock *sk) 2586 : : { - 2587 [ + + ]: 9339 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp || - 2588 [ + + ]: 2673 : sk->sk_state == TCP_CLOSE) + 2587 [ + + ]: 11653 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp || + 2588 [ + + ]: 2842 : sk->sk_state == TCP_CLOSE) 2589 : : return false; 2590 : : - 2591 : 1892 : return time_after32(tcp_jiffies32, + 2591 : 2049 : return time_after32(tcp_jiffies32, 2592 : : inet_csk(sk)->icsk_mtup.probe_timestamp + mptcp_close_timeout(sk)); 2593 : : } 2594 : : - 2595 : 9339 : static void mptcp_check_fastclose(struct mptcp_sock *msk) + 2595 : 11653 : static void mptcp_check_fastclose(struct mptcp_sock *msk) 2596 : : { - 2597 : 9339 : struct mptcp_subflow_context *subflow, *tmp; - 2598 : 9339 : struct sock *sk = (struct sock *)msk; + 2597 : 11653 : struct mptcp_subflow_context *subflow, *tmp; + 2598 : 11653 : struct sock *sk = (struct sock *)msk; 2599 : : - 2600 [ + + + + ]: 9339 : if (likely(!READ_ONCE(msk->rcv_fastclose))) + 2600 [ + + + + ]: 11653 : if (likely(!READ_ONCE(msk->rcv_fastclose))) 2601 : : return; 2602 : : - 2603 : 221 : mptcp_token_destroy(msk); + 2603 : 214 : mptcp_token_destroy(msk); 2604 : : - 2605 [ + + ]: 489 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { - 2606 : 268 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); - 2607 : 268 : bool slow; + 2605 [ + + ]: 472 : mptcp_for_each_subflow_safe(msk, subflow, tmp) { + 2606 : 258 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); + 2607 : 258 : bool slow; 2608 : : - 2609 : 268 : slow = lock_sock_fast(tcp_sk); - 2610 [ + + ]: 268 : if (tcp_sk->sk_state != TCP_CLOSE) { - 2611 : 30 : mptcp_send_active_reset_reason(tcp_sk); - 2612 : 30 : tcp_set_state(tcp_sk, TCP_CLOSE); + 2609 : 258 : slow = lock_sock_fast(tcp_sk); + 2610 [ + + ]: 258 : if (tcp_sk->sk_state != TCP_CLOSE) { + 2611 : 33 : mptcp_send_active_reset_reason(tcp_sk); + 2612 : 33 : tcp_set_state(tcp_sk, TCP_CLOSE); 2613 : : } - 2614 : 268 : unlock_sock_fast(tcp_sk, slow); + 2614 : 258 : unlock_sock_fast(tcp_sk, slow); 2615 : : } 2616 : : 2617 : : /* Mirror the tcp_reset() error propagation */ - 2618 [ - + + - ]: 221 : switch (sk->sk_state) { + 2618 [ - + + - ]: 214 : switch (sk->sk_state) { 2619 : : case TCP_SYN_SENT: 2620 : 0 : WRITE_ONCE(sk->sk_err, ECONNREFUSED); 2621 : 0 : break; 2622 : : case TCP_CLOSE_WAIT: - 2623 : 26 : WRITE_ONCE(sk->sk_err, EPIPE); - 2624 : 26 : break; + 2623 : 17 : WRITE_ONCE(sk->sk_err, EPIPE); + 2624 : 17 : break; 2625 : : case TCP_CLOSE: 2626 : : return; 2627 : : default: - 2628 : 195 : WRITE_ONCE(sk->sk_err, ECONNRESET); + 2628 : 197 : WRITE_ONCE(sk->sk_err, ECONNRESET); 2629 : : } 2630 : : - 2631 : 221 : mptcp_set_state(sk, TCP_CLOSE); - 2632 : 221 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); - 2633 : 221 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ - 2634 : 221 : set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); + 2631 : 214 : mptcp_set_state(sk, TCP_CLOSE); + 2632 : 214 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); + 2633 : 214 : smp_mb__before_atomic(); /* SHUTDOWN must be visible first */ + 2634 : 214 : set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags); 2635 : : 2636 : : /* the calling mptcp_worker will properly destroy the socket */ - 2637 [ + + ]: 221 : if (sock_flag(sk, SOCK_DEAD)) + 2637 [ + + ]: 214 : if (sock_flag(sk, SOCK_DEAD)) 2638 : : return; 2639 : : - 2640 : 111 : sk->sk_state_change(sk); - 2641 : 111 : sk_error_report(sk); + 2640 : 107 : sk->sk_state_change(sk); + 2641 : 107 : sk_error_report(sk); 2642 : : } 2643 : : - 2644 : 4470 : static void __mptcp_retrans(struct sock *sk) + 2644 : 6691 : static void __mptcp_retrans(struct sock *sk) 2645 : : { - 2646 [ - + ]: 4470 : struct mptcp_sock *msk = mptcp_sk(sk); - 2647 : 4470 : struct mptcp_subflow_context *subflow; - 2648 : 4470 : struct mptcp_sendmsg_info info = {}; - 2649 : 4470 : struct mptcp_data_frag *dfrag; - 2650 : 4470 : struct sock *ssk; - 2651 : 4470 : int ret, err; - 2652 : 4470 : u16 len = 0; + 2646 [ - + ]: 6691 : struct mptcp_sock *msk = mptcp_sk(sk); + 2647 : 6691 : struct mptcp_subflow_context *subflow; + 2648 : 6691 : struct mptcp_sendmsg_info info = {}; + 2649 : 6691 : struct mptcp_data_frag *dfrag; + 2650 : 6691 : struct sock *ssk; + 2651 : 6691 : int ret, err; + 2652 : 6691 : u16 len = 0; 2653 : : - 2654 : 4470 : mptcp_clean_una_wakeup(sk); + 2654 : 6691 : mptcp_clean_una_wakeup(sk); 2655 : : 2656 : : /* first check ssk: need to kick "stale" logic */ - 2657 : 4470 : err = mptcp_sched_get_retrans(msk); - 2658 : 4470 : dfrag = mptcp_rtx_head(sk); - 2659 [ + + ]: 4470 : if (!dfrag) { - 2660 [ + + ]: 3078 : if (mptcp_data_fin_enabled(msk)) { - 2661 : 1152 : struct inet_connection_sock *icsk = inet_csk(sk); + 2657 : 6691 : err = mptcp_sched_get_retrans(msk); + 2658 : 6691 : dfrag = mptcp_rtx_head(sk); + 2659 [ + + ]: 6691 : if (!dfrag) { + 2660 [ + + ]: 2789 : if (mptcp_data_fin_enabled(msk)) { + 2661 : 1133 : struct inet_connection_sock *icsk = inet_csk(sk); 2662 : : - 2663 : 1152 : icsk->icsk_retransmits++; - 2664 : 1152 : mptcp_set_datafin_timeout(sk); - 2665 : 1152 : mptcp_send_ack(msk); + 2663 : 1133 : icsk->icsk_retransmits++; + 2664 : 1133 : mptcp_set_datafin_timeout(sk); + 2665 : 1133 : mptcp_send_ack(msk); 2666 : : - 2667 : 1152 : goto reset_timer; + 2667 : 1133 : goto reset_timer; 2668 : : } 2669 : : - 2670 [ + + ]: 1926 : if (!mptcp_send_head(sk)) - 2671 : 608 : return; + 2670 [ + + ]: 1656 : if (!mptcp_send_head(sk)) + 2671 : 695 : return; 2672 : : - 2673 : 1318 : goto reset_timer; + 2673 : 961 : goto reset_timer; 2674 : : } 2675 : : - 2676 [ + + ]: 1392 : if (err) - 2677 : 1353 : goto reset_timer; + 2676 [ + + ]: 3902 : if (err) + 2677 : 3813 : goto reset_timer; 2678 : : - 2679 [ + + ]: 165 : mptcp_for_each_subflow(msk, subflow) { - 2680 [ + + + + ]: 126 : if (READ_ONCE(subflow->scheduled)) { - 2681 : 39 : u16 copied = 0; + 2679 [ + + ]: 415 : mptcp_for_each_subflow(msk, subflow) { + 2680 [ + + + + ]: 326 : if (READ_ONCE(subflow->scheduled)) { + 2681 : 89 : u16 copied = 0; 2682 : : - 2683 : 39 : mptcp_subflow_set_scheduled(subflow, false); + 2683 : 89 : mptcp_subflow_set_scheduled(subflow, false); 2684 : : - 2685 : 39 : ssk = mptcp_subflow_tcp_sock(subflow); + 2685 : 89 : ssk = mptcp_subflow_tcp_sock(subflow); 2686 : : - 2687 : 39 : lock_sock(ssk); + 2687 : 89 : lock_sock(ssk); 2688 : : 2689 : : /* limit retransmission to the bytes already sent on some subflows */ - 2690 : 39 : info.sent = 0; - 2691 [ - + - + ]: 39 : info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len : + 2690 : 89 : info.sent = 0; + 2691 [ - + - + ]: 89 : info.limit = READ_ONCE(msk->csum_enabled) ? dfrag->data_len : 2692 : : dfrag->already_sent; - 2693 [ + + ]: 79 : while (info.sent < info.limit) { - 2694 : 40 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info); - 2695 [ + - ]: 40 : if (ret <= 0) + 2693 [ + + ]: 178 : while (info.sent < info.limit) { + 2694 : 89 : ret = mptcp_sendmsg_frag(sk, ssk, dfrag, &info); + 2695 [ + - ]: 89 : if (ret <= 0) 2696 : : break; 2697 : : - 2698 [ + - ]: 40 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS); - 2699 : 40 : copied += ret; - 2700 : 40 : info.sent += ret; + 2698 [ + - ]: 89 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RETRANSSEGS); + 2699 : 89 : copied += ret; + 2700 : 89 : info.sent += ret; 2701 : : } - 2702 [ + - ]: 39 : if (copied) { - 2703 : 39 : len = max(copied, len); - 2704 [ - + ]: 39 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, + 2702 [ + - ]: 89 : if (copied) { + 2703 : 89 : len = max(copied, len); + 2704 [ - + ]: 89 : tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, 2705 : : info.size_goal); - 2706 : 39 : WRITE_ONCE(msk->allow_infinite_fallback, false); + 2706 : 89 : WRITE_ONCE(msk->allow_infinite_fallback, false); 2707 : : } 2708 : : - 2709 : 39 : release_sock(ssk); + 2709 : 89 : release_sock(ssk); 2710 : : } 2711 : : } 2712 : : - 2713 : 39 : msk->bytes_retrans += len; - 2714 : 39 : dfrag->already_sent = max(dfrag->already_sent, len); + 2713 : 89 : msk->bytes_retrans += len; + 2714 : 89 : dfrag->already_sent = max(dfrag->already_sent, len); 2715 : : - 2716 : 3862 : reset_timer: - 2717 : 3862 : mptcp_check_and_set_pending(sk); + 2716 : 5996 : reset_timer: + 2717 : 5996 : mptcp_check_and_set_pending(sk); 2718 : : - 2719 [ + + ]: 3862 : if (!mptcp_rtx_timer_pending(sk)) - 2720 : 62 : mptcp_reset_rtx_timer(sk); + 2719 [ + + ]: 5996 : if (!mptcp_rtx_timer_pending(sk)) + 2720 : 59 : mptcp_reset_rtx_timer(sk); 2721 : : } 2722 : : 2723 : : /* schedule the timeout timer for the relevant event: either close timeout 2724 : : * or mp_fail timeout. The close timeout takes precedence on the mp_fail one 2725 : : */ - 2726 : 979 : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) + 2726 : 994 : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout) 2727 : : { - 2728 : 979 : struct sock *sk = (struct sock *)msk; - 2729 : 979 : unsigned long timeout, close_timeout; + 2728 : 994 : struct sock *sk = (struct sock *)msk; + 2729 : 994 : unsigned long timeout, close_timeout; 2730 : : - 2731 [ + + + - ]: 979 : if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) + 2731 [ + + + - ]: 994 : if (!fail_tout && !inet_csk(sk)->icsk_mtup.probe_timestamp) 2732 : : return; 2733 : : - 2734 : 1958 : close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - - 2735 : 979 : tcp_jiffies32 + jiffies + mptcp_close_timeout(sk); + 2734 : 1988 : close_timeout = (unsigned long)inet_csk(sk)->icsk_mtup.probe_timestamp - + 2735 : 994 : tcp_jiffies32 + jiffies + mptcp_close_timeout(sk); 2736 : : 2737 : : /* the close timeout takes precedence on the fail one, and here at least one of 2738 : : * them is active 2739 : : */ - 2740 [ + + ]: 979 : timeout = inet_csk(sk)->icsk_mtup.probe_timestamp ? close_timeout : fail_tout; + 2740 [ + + ]: 994 : timeout = inet_csk(sk)->icsk_mtup.probe_timestamp ? close_timeout : fail_tout; 2741 : : - 2742 : 979 : sk_reset_timer(sk, &sk->sk_timer, timeout); + 2742 : 994 : sk_reset_timer(sk, &sk->sk_timer, timeout); 2743 : : } 2744 : : 2745 : 0 : static void mptcp_mp_fail_no_response(struct mptcp_sock *msk) @@ -2846,61 +2846,61 @@ 2758 : 0 : unlock_sock_fast(ssk, slow); 2759 : : } 2760 : : - 2761 : 379 : static void mptcp_do_fastclose(struct sock *sk) + 2761 : 368 : static void mptcp_do_fastclose(struct sock *sk) 2762 : : { - 2763 : 379 : struct mptcp_subflow_context *subflow, *tmp; - 2764 [ - + ]: 379 : struct mptcp_sock *msk = mptcp_sk(sk); + 2763 : 368 : struct mptcp_subflow_context *subflow, *tmp; + 2764 [ - + ]: 368 : struct mptcp_sock *msk = mptcp_sk(sk); 2765 : : - 2766 : 379 : mptcp_set_state(sk, TCP_CLOSE); - 2767 [ + + ]: 819 : mptcp_for_each_subflow_safe(msk, subflow, tmp) - 2768 : 440 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), + 2766 : 368 : mptcp_set_state(sk, TCP_CLOSE); + 2767 [ + + ]: 794 : mptcp_for_each_subflow_safe(msk, subflow, tmp) + 2768 : 426 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), 2769 : : subflow, MPTCP_CF_FASTCLOSE); - 2770 : 379 : } + 2770 : 368 : } 2771 : : - 2772 : 9425 : static void mptcp_worker(struct work_struct *work) + 2772 : 11740 : static void mptcp_worker(struct work_struct *work) 2773 : : { - 2774 : 9425 : struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work); - 2775 : 9425 : struct sock *sk = (struct sock *)msk; - 2776 : 9425 : unsigned long fail_tout; - 2777 : 9425 : int state; + 2774 : 11740 : struct mptcp_sock *msk = container_of(work, struct mptcp_sock, work); + 2775 : 11740 : struct sock *sk = (struct sock *)msk; + 2776 : 11740 : unsigned long fail_tout; + 2777 : 11740 : int state; 2778 : : - 2779 : 9425 : lock_sock(sk); - 2780 : 9425 : state = sk->sk_state; - 2781 [ + + + + ]: 9425 : if (unlikely((1 << state) & (TCPF_CLOSE | TCPF_LISTEN))) - 2782 : 86 : goto unlock; + 2779 : 11740 : lock_sock(sk); + 2780 : 11740 : state = sk->sk_state; + 2781 [ + + + + ]: 11740 : if (unlikely((1 << state) & (TCPF_CLOSE | TCPF_LISTEN))) + 2782 : 87 : goto unlock; 2783 : : - 2784 : 9339 : mptcp_check_fastclose(msk); + 2784 : 11653 : mptcp_check_fastclose(msk); 2785 : : - 2786 : 9339 : mptcp_pm_nl_work(msk); + 2786 : 11653 : mptcp_pm_nl_work(msk); 2787 : : - 2788 : 9339 : mptcp_check_send_data_fin(sk); - 2789 : 9339 : mptcp_check_data_fin_ack(sk); - 2790 : 9339 : mptcp_check_data_fin(sk); + 2788 : 11653 : mptcp_check_send_data_fin(sk); + 2789 : 11653 : mptcp_check_data_fin_ack(sk); + 2790 : 11653 : mptcp_check_data_fin(sk); 2791 : : - 2792 [ + + ]: 14103 : if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - 2793 : 601 : __mptcp_close_subflow(sk); + 2792 [ + + ]: 16596 : if (test_and_clear_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + 2793 : 584 : __mptcp_close_subflow(sk); 2794 : : - 2795 [ + + ]: 9339 : if (mptcp_close_tout_expired(sk)) { + 2795 [ + + ]: 11653 : if (mptcp_close_tout_expired(sk)) { 2796 : 114 : mptcp_do_fastclose(sk); 2797 : 114 : mptcp_close_wake_up(sk); 2798 : : } 2799 : : - 2800 [ + + + + ]: 9339 : if (sock_flag(sk, SOCK_DEAD) && sk->sk_state == TCP_CLOSE) { - 2801 : 883 : __mptcp_destroy_sock(sk); - 2802 : 883 : goto unlock; + 2800 [ + + + + ]: 11653 : if (sock_flag(sk, SOCK_DEAD) && sk->sk_state == TCP_CLOSE) { + 2801 : 895 : __mptcp_destroy_sock(sk); + 2802 : 895 : goto unlock; 2803 : : } 2804 : : - 2805 [ + + ]: 12763 : if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) - 2806 : 4058 : __mptcp_retrans(sk); + 2805 [ + + ]: 15254 : if (test_and_clear_bit(MPTCP_WORK_RTX, &msk->flags)) + 2806 : 6312 : __mptcp_retrans(sk); 2807 : : - 2808 [ + - + - ]: 8456 : fail_tout = msk->first ? READ_ONCE(mptcp_subflow_ctx(msk->first)->fail_tout) : 0; - 2809 [ + - - - ]: 8456 : if (fail_tout && time_after(jiffies, fail_tout)) + 2808 [ + - + - ]: 10758 : fail_tout = msk->first ? READ_ONCE(mptcp_subflow_ctx(msk->first)->fail_tout) : 0; + 2809 [ + - - - ]: 10758 : if (fail_tout && time_after(jiffies, fail_tout)) 2810 : 0 : mptcp_mp_fail_no_response(msk); 2811 : : 2812 : 0 : unlock: - 2813 : 9425 : release_sock(sk); - 2814 : 9425 : sock_put(sk); - 2815 : 9425 : } + 2813 : 11740 : release_sock(sk); + 2814 : 11740 : sock_put(sk); + 2815 : 11740 : } 2816 : : 2817 : 3570 : static void __mptcp_init_sock(struct sock *sk) 2818 : : { @@ -2988,23 +2988,23 @@ 2900 : 3550 : struct mptcp_data_frag *dtmp, *dfrag; 2901 : : 2902 : 3550 : WRITE_ONCE(msk->first_pending, NULL); - 2903 [ + + ]: 3604 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) - 2904 : 54 : dfrag_clear(sk, dfrag); + 2903 [ + + ]: 4084 : list_for_each_entry_safe(dfrag, dtmp, &msk->rtx_queue, list) + 2904 : 534 : dfrag_clear(sk, dfrag); 2905 : 3550 : } 2906 : : - 2907 : 2605 : void mptcp_cancel_work(struct sock *sk) + 2907 : 2593 : void mptcp_cancel_work(struct sock *sk) 2908 : : { - 2909 [ - + ]: 2605 : struct mptcp_sock *msk = mptcp_sk(sk); + 2909 [ - + ]: 2593 : struct mptcp_sock *msk = mptcp_sk(sk); 2910 : : - 2911 [ + + ]: 2605 : if (cancel_work_sync(&msk->work)) + 2911 [ + + ]: 2593 : if (cancel_work_sync(&msk->work)) 2912 : 21 : __sock_put(sk); - 2913 : 2605 : } + 2913 : 2593 : } 2914 : : - 2915 : 2829 : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) + 2915 : 2846 : void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) 2916 : : { - 2917 : 2829 : lock_sock(ssk); + 2917 : 2846 : lock_sock(ssk); 2918 : : - 2919 [ - + + ]: 2829 : switch (ssk->sk_state) { + 2919 [ - + + ]: 2846 : switch (ssk->sk_state) { 2920 : 0 : case TCP_LISTEN: 2921 [ # # ]: 0 : if (!(how & RCV_SHUTDOWN)) 2922 : : break; @@ -3012,34 +3012,34 @@ 2924 : : case TCP_SYN_SENT: 2925 [ - + ]: 16 : WARN_ON_ONCE(tcp_disconnect(ssk, O_NONBLOCK)); 2926 : : break; - 2927 : 2813 : default: - 2928 [ - + + + ]: 2813 : if (__mptcp_check_fallback(mptcp_sk(sk))) { - 2929 [ - + ]: 94 : pr_debug("Fallback\n"); - 2930 : 94 : ssk->sk_shutdown |= how; - 2931 : 94 : tcp_shutdown(ssk, how); + 2927 : 2830 : default: + 2928 [ - + + + ]: 2830 : if (__mptcp_check_fallback(mptcp_sk(sk))) { + 2929 [ - + ]: 93 : pr_debug("Fallback\n"); + 2930 : 93 : ssk->sk_shutdown |= how; + 2931 : 93 : tcp_shutdown(ssk, how); 2932 : : 2933 : : /* simulate the data_fin ack reception to let the state 2934 : : * machine move forward 2935 : : */ - 2936 [ - + - + ]: 94 : WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); - 2937 : 94 : mptcp_schedule_work(sk); + 2936 [ - + - + ]: 93 : WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); + 2937 : 93 : mptcp_schedule_work(sk); 2938 : : } else { - 2939 [ - + ]: 2719 : pr_debug("Sending DATA_FIN on subflow %p\n", ssk); - 2940 : 2719 : tcp_send_ack(ssk); - 2941 [ + + ]: 2719 : if (!mptcp_rtx_timer_pending(sk)) - 2942 : 1616 : mptcp_reset_rtx_timer(sk); + 2939 [ - + ]: 2737 : pr_debug("Sending DATA_FIN on subflow %p\n", ssk); + 2940 : 2737 : tcp_send_ack(ssk); + 2941 [ + + ]: 2737 : if (!mptcp_rtx_timer_pending(sk)) + 2942 : 1621 : mptcp_reset_rtx_timer(sk); 2943 : : } 2944 : : break; 2945 : : } 2946 : : - 2947 : 2829 : release_sock(ssk); - 2948 : 2829 : } + 2947 : 2846 : release_sock(ssk); + 2948 : 2846 : } 2949 : : - 2950 : 16502 : void mptcp_set_state(struct sock *sk, int state) + 2950 : 16448 : void mptcp_set_state(struct sock *sk, int state) 2951 : : { - 2952 : 17197 : int oldstate = sk->sk_state; + 2952 : 17145 : int oldstate = sk->sk_state; 2953 : : - 2954 [ + + - ]: 16487 : switch (state) { + 2954 [ + + - ]: 16435 : switch (state) { 2955 : 2292 : case TCP_ESTABLISHED: 2956 [ + - ]: 2292 : if (oldstate != TCP_ESTABLISHED) 2957 [ + - ]: 2292 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); @@ -3050,12 +3050,12 @@ 2962 : : * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT. 2963 : : */ 2964 : : break; - 2965 : 14195 : default: - 2966 [ + + ]: 14195 : if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) + 2965 : 14143 : default: + 2966 [ + + ]: 14143 : if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) 2967 [ + - ]: 2292 : MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); 2968 : : } 2969 : : - 2970 : 17197 : inet_sk_state_store(sk, state); + 2970 : 17145 : inet_sk_state_store(sk, state); 2971 : 710 : } 2972 : : 2973 : : static const unsigned char new_state[16] = { @@ -3075,56 +3075,56 @@ 2987 : : [TCP_NEW_SYN_RECV] = TCP_CLOSE, /* should not happen ! */ 2988 : : }; 2989 : : - 2990 : 2465 : static int mptcp_close_state(struct sock *sk) + 2990 : 2469 : static int mptcp_close_state(struct sock *sk) 2991 : : { - 2992 : 2465 : int next = (int)new_state[sk->sk_state]; - 2993 : 2465 : int ns = next & TCP_STATE_MASK; + 2992 : 2469 : int next = (int)new_state[sk->sk_state]; + 2993 : 2469 : int ns = next & TCP_STATE_MASK; 2994 : : - 2995 : 2465 : mptcp_set_state(sk, ns); + 2995 : 2469 : mptcp_set_state(sk, ns); 2996 : : - 2997 : 2465 : return next & TCP_ACTION_FIN; + 2997 : 2469 : return next & TCP_ACTION_FIN; 2998 : : } 2999 : : - 3000 : 121336 : static void mptcp_check_send_data_fin(struct sock *sk) + 3000 : 207130 : static void mptcp_check_send_data_fin(struct sock *sk) 3001 : : { - 3002 : 121336 : struct mptcp_subflow_context *subflow; - 3003 [ - + ]: 121336 : struct mptcp_sock *msk = mptcp_sk(sk); + 3002 : 207130 : struct mptcp_subflow_context *subflow; + 3003 [ - + ]: 207130 : struct mptcp_sock *msk = mptcp_sk(sk); 3004 : : - 3005 [ - + - - ]: 121336 : pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu\n", + 3005 [ - + - - ]: 207130 : pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu\n", 3006 : : msk, msk->snd_data_fin_enable, !!mptcp_send_head(sk), 3007 : : msk->snd_nxt, msk->write_seq); 3008 : : 3009 : : /* we still need to enqueue subflows or not really shutting down, 3010 : : * skip this 3011 : : */ - 3012 [ + + + + : 123401 : if (!msk->snd_data_fin_enable || msk->snd_nxt + 1 != msk->write_seq || - + + - + ] - 3013 : 2065 : mptcp_send_head(sk)) - 3014 : 119271 : return; + 3012 [ + + + + : 209202 : if (!msk->snd_data_fin_enable || msk->snd_nxt + 1 != msk->write_seq || + + + - + ] + 3013 : 2072 : mptcp_send_head(sk)) + 3014 : 205058 : return; 3015 : : - 3016 : 2065 : WRITE_ONCE(msk->snd_nxt, msk->write_seq); + 3016 : 2072 : WRITE_ONCE(msk->snd_nxt, msk->write_seq); 3017 : : - 3018 [ + + ]: 4702 : mptcp_for_each_subflow(msk, subflow) { - 3019 : 2637 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); + 3018 [ + + ]: 4726 : mptcp_for_each_subflow(msk, subflow) { + 3019 : 2654 : struct sock *tcp_sk = mptcp_subflow_tcp_sock(subflow); 3020 : : - 3021 : 2637 : mptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN); + 3021 : 2654 : mptcp_subflow_shutdown(sk, tcp_sk, SEND_SHUTDOWN); 3022 : : } 3023 : : } 3024 : : - 3025 : 2066 : static void __mptcp_wr_shutdown(struct sock *sk) + 3025 : 2073 : static void __mptcp_wr_shutdown(struct sock *sk) 3026 : : { - 3027 [ - + ]: 2066 : struct mptcp_sock *msk = mptcp_sk(sk); + 3027 [ - + ]: 2073 : struct mptcp_sock *msk = mptcp_sk(sk); 3028 : : - 3029 [ - + - - ]: 2066 : pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d\n", + 3029 [ - + - - ]: 2073 : pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d\n", 3030 : : msk, msk->snd_data_fin_enable, sk->sk_shutdown, sk->sk_state, 3031 : : !!mptcp_send_head(sk)); 3032 : : 3033 : : /* will be ignored by fallback sockets */ - 3034 : 2066 : WRITE_ONCE(msk->write_seq, msk->write_seq + 1); - 3035 : 2066 : WRITE_ONCE(msk->snd_data_fin_enable, 1); + 3034 : 2073 : WRITE_ONCE(msk->write_seq, msk->write_seq + 1); + 3035 : 2073 : WRITE_ONCE(msk->snd_data_fin_enable, 1); 3036 : : - 3037 : 2066 : mptcp_check_send_data_fin(sk); - 3038 : 2066 : } + 3037 : 2073 : mptcp_check_send_data_fin(sk); + 3038 : 2073 : } 3039 : : 3040 : 3488 : static void __mptcp_destroy_sock(struct sock *sk) 3041 : : { @@ -3158,14 +3158,14 @@ 3069 : : 3070 : 0 : static __poll_t mptcp_check_readable(struct sock *sk) 3071 : : { - 3072 [ + + ]: 503157 : return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; + 3072 [ + + ]: 674546 : return mptcp_epollin_ready(sk) ? EPOLLIN | EPOLLRDNORM : 0; 3073 : : } 3074 : : - 3075 : 2343 : static void mptcp_check_listen_stop(struct sock *sk) + 3075 : 2344 : static void mptcp_check_listen_stop(struct sock *sk) 3076 : : { - 3077 : 2343 : struct sock *ssk; + 3077 : 2344 : struct sock *ssk; 3078 : : - 3079 [ + + ]: 2343 : if (inet_sk_state_load(sk) != TCP_LISTEN) + 3079 [ + + ]: 2344 : if (inet_sk_state_load(sk) != TCP_LISTEN) 3080 : : return; 3081 : : 3082 : 1208 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); @@ -3190,62 +3190,62 @@ 3101 : : 3102 : 3514 : WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK); 3103 : : - 3104 [ + + + + ]: 3514 : if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { - 3105 : 2285 : mptcp_check_listen_stop(sk); - 3106 : 2285 : mptcp_set_state(sk, TCP_CLOSE); - 3107 : 2285 : goto cleanup; + 3104 [ + + + + ]: 3514 : if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) { + 3105 : 2286 : mptcp_check_listen_stop(sk); + 3106 : 2286 : mptcp_set_state(sk, TCP_CLOSE); + 3107 : 2286 : goto cleanup; 3108 : : } 3109 : : - 3110 [ + + - + ]: 1229 : if (mptcp_data_avail(msk) || timeout < 0) { + 3110 [ + + - + ]: 1228 : if (mptcp_data_avail(msk) || timeout < 0) { 3111 : : /* If the msk has read data, or the caller explicitly ask it, 3112 : : * do the MPTCP equivalent of TCP reset, aka MPTCP fastclose 3113 : : */ - 3114 : 229 : mptcp_do_fastclose(sk); - 3115 : 229 : timeout = 0; - 3116 [ + + ]: 1000 : } else if (mptcp_close_state(sk)) { - 3117 : 698 : __mptcp_wr_shutdown(sk); + 3114 : 218 : mptcp_do_fastclose(sk); + 3115 : 218 : timeout = 0; + 3116 [ + + ]: 1010 : } else if (mptcp_close_state(sk)) { + 3117 : 709 : __mptcp_wr_shutdown(sk); 3118 : : } 3119 : : - 3120 : 1229 : sk_stream_wait_close(sk, timeout); + 3120 : 1228 : sk_stream_wait_close(sk, timeout); 3121 : : 3122 : 3514 : cleanup: 3123 : : /* orphan all the subflows */ - 3124 [ + + ]: 7588 : mptcp_for_each_subflow(msk, subflow) { - 3125 : 4074 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 3126 : 4074 : bool slow = lock_sock_fast_nested(ssk); + 3124 [ + + ]: 7598 : mptcp_for_each_subflow(msk, subflow) { + 3125 : 4084 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3126 : 4084 : bool slow = lock_sock_fast_nested(ssk); 3127 : : - 3128 : 4074 : subflows_alive += ssk->sk_state != TCP_CLOSE; + 3128 : 4084 : subflows_alive += ssk->sk_state != TCP_CLOSE; 3129 : : 3130 : : /* since the close timeout takes precedence on the fail one, 3131 : : * cancel the latter 3132 : : */ - 3133 [ + + ]: 4074 : if (ssk == msk->first) + 3133 [ + + ]: 4084 : if (ssk == msk->first) 3134 : 3502 : subflow->fail_tout = 0; 3135 : : 3136 : : /* detach from the parent socket, but allow data_ready to 3137 : : * push incoming data into the mptcp stack, to properly ack it 3138 : : */ - 3139 : 4074 : ssk->sk_socket = NULL; - 3140 : 4074 : ssk->sk_wq = NULL; - 3141 : 4074 : unlock_sock_fast(ssk, slow); + 3139 : 4084 : ssk->sk_socket = NULL; + 3140 : 4084 : ssk->sk_wq = NULL; + 3141 : 4084 : unlock_sock_fast(ssk, slow); 3142 : : } 3143 : 3514 : sock_orphan(sk); 3144 : : 3145 : : /* all the subflows are closed, only timeout can change the msk 3146 : : * state, let's not keep resources busy for no reasons 3147 : : */ - 3148 [ + + ]: 3514 : if (subflows_alive == 0) - 3149 : 1676 : mptcp_set_state(sk, TCP_CLOSE); + 3148 [ + + ]: 3514 : if (subflows_alive == 0) + 3149 : 1649 : mptcp_set_state(sk, TCP_CLOSE); 3150 : : 3151 : 3514 : sock_hold(sk); 3152 [ - + ]: 3514 : pr_debug("msk=%p state=%d\n", sk, sk->sk_state); 3153 : 3514 : mptcp_pm_connection_closed(msk); 3154 : : - 3155 [ + + ]: 3514 : if (sk->sk_state == TCP_CLOSE) { - 3156 : 2569 : __mptcp_destroy_sock(sk); - 3157 : 2569 : do_cancel_work = true; + 3155 [ + + ]: 3514 : if (sk->sk_state == TCP_CLOSE) { + 3156 : 2557 : __mptcp_destroy_sock(sk); + 3157 : 2557 : do_cancel_work = true; 3158 : : } else { - 3159 : 945 : mptcp_start_tout_timer(sk); + 3159 : 957 : mptcp_start_tout_timer(sk); 3160 : : } 3161 : : 3162 : 3514 : return do_cancel_work; @@ -3259,8 +3259,8 @@ 3170 : : 3171 : 3514 : do_cancel_work = __mptcp_close(sk, timeout); 3172 : 3514 : release_sock(sk); - 3173 [ + + ]: 3514 : if (do_cancel_work) - 3174 : 2569 : mptcp_cancel_work(sk); + 3173 [ + + ]: 3514 : if (do_cancel_work) + 3174 : 2557 : mptcp_cancel_work(sk); 3175 : : 3176 : 3514 : sock_put(sk); 3177 : 3514 : } @@ -3268,15 +3268,15 @@ 3179 : 4764 : static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) 3180 : : { 3181 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 3182 [ + - ]: 4764 : const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); - 3183 [ + - ]: 4764 : struct ipv6_pinfo *msk6 = inet6_sk(msk); + 3182 [ + - ]: 4764 : const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); + 3183 [ + - ]: 4764 : struct ipv6_pinfo *msk6 = inet6_sk(msk); 3184 : : 3185 : 4764 : msk->sk_v6_daddr = ssk->sk_v6_daddr; 3186 : 4764 : msk->sk_v6_rcv_saddr = ssk->sk_v6_rcv_saddr; 3187 : : - 3188 [ + + ]: 4764 : if (msk6 && ssk6) { - 3189 : 1930 : msk6->saddr = ssk6->saddr; - 3190 : 1930 : msk6->flow_label = ssk6->flow_label; + 3188 [ + + ]: 4764 : if (msk6 && ssk6) { + 3189 : 1932 : msk6->saddr = ssk6->saddr; + 3190 : 1932 : msk6->flow_label = ssk6->flow_label; 3191 : : } 3192 : : #endif 3193 : : @@ -3495,8 +3495,8 @@ 3402 : 3550 : __mptcp_clear_xmit(sk); 3403 : : 3404 : : /* join list will be eventually flushed (with rst) at sock lock release time */ - 3405 [ + + ]: 7586 : mptcp_for_each_subflow_safe(msk, subflow, tmp) - 3406 : 4036 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags); + 3405 [ + + ]: 7596 : mptcp_for_each_subflow_safe(msk, subflow, tmp) + 3406 : 4046 : __mptcp_close_ssk(sk, mptcp_subflow_tcp_sock(subflow), subflow, flags); 3407 : : 3408 : : /* move to sk_receive_queue, sk_stream_kill_queues will purge it */ 3409 : 3550 : mptcp_data_lock(sk); @@ -3525,23 +3525,23 @@ 3432 : 3492 : sk_sockets_allocated_dec(sk); 3433 : 3492 : } 3434 : : - 3435 : 213980 : void __mptcp_data_acked(struct sock *sk) + 3435 : 240106 : void __mptcp_data_acked(struct sock *sk) 3436 : : { - 3437 [ + + ]: 213980 : if (!sock_owned_by_user(sk)) - 3438 : 166100 : __mptcp_clean_una(sk); + 3437 [ + + ]: 240106 : if (!sock_owned_by_user(sk)) + 3438 : 199954 : __mptcp_clean_una(sk); 3439 : : else - 3440 [ - + ]: 47880 : __set_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->cb_flags); - 3441 : 213980 : } + 3440 [ - + ]: 40152 : __set_bit(MPTCP_CLEAN_UNA, &mptcp_sk(sk)->cb_flags); + 3441 : 240106 : } 3442 : : - 3443 : 814229 : void __mptcp_check_push(struct sock *sk, struct sock *ssk) + 3443 : 779654 : void __mptcp_check_push(struct sock *sk, struct sock *ssk) 3444 : : { - 3445 [ + + ]: 814229 : if (!mptcp_send_head(sk)) + 3445 [ + + ]: 779654 : if (!mptcp_send_head(sk)) 3446 : : return; 3447 : : - 3448 [ + + ]: 118643 : if (!sock_owned_by_user(sk)) - 3449 : 95227 : __mptcp_subflow_push_pending(sk, ssk, false); + 3448 [ + + ]: 95434 : if (!sock_owned_by_user(sk)) + 3449 : 83705 : __mptcp_subflow_push_pending(sk, ssk, false); 3450 : : else - 3451 [ - + ]: 23416 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); + 3451 [ - + ]: 11729 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); 3452 : : } 3453 : : 3454 : : #define MPTCP_FLAGS_PROCESS_CTX_NEED (BIT(MPTCP_PUSH_PENDING) | \ @@ -3549,20 +3549,20 @@ 3456 : : BIT(MPTCP_FLUSH_JOIN_LIST)) 3457 : : 3458 : : /* processes deferred events and flush wmem */ - 3459 : 605585 : static void mptcp_release_cb(struct sock *sk) + 3459 : 776428 : static void mptcp_release_cb(struct sock *sk) 3460 : : __must_hold(&sk->sk_lock.slock) 3461 : : { - 3462 [ - + ]: 605585 : struct mptcp_sock *msk = mptcp_sk(sk); + 3462 [ - + ]: 776428 : struct mptcp_sock *msk = mptcp_sk(sk); 3463 : : - 3464 : 7021 : for (;;) { - 3465 : 612398 : unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); - 3466 : 612398 : struct list_head join_list; + 3464 : 9372 : for (;;) { + 3465 : 785595 : unsigned long flags = (msk->cb_flags & MPTCP_FLAGS_PROCESS_CTX_NEED); + 3466 : 785595 : struct list_head join_list; 3467 : : - 3468 [ + + ]: 612398 : if (!flags) + 3468 [ + + ]: 785595 : if (!flags) 3469 : : break; 3470 : : - 3471 [ + + ]: 6813 : INIT_LIST_HEAD(&join_list); - 3472 [ + + ]: 6813 : list_splice_init(&msk->join_list, &join_list); + 3471 [ + + ]: 9167 : INIT_LIST_HEAD(&join_list); + 3472 [ + + ]: 9167 : list_splice_init(&msk->join_list, &join_list); 3473 : : 3474 : : /* the following actions acquire the subflow socket lock 3475 : : * @@ -3571,54 +3571,54 @@ 3478 : : * datapath acquires the msk socket spinlock while helding 3479 : : * the subflow socket lock 3480 : : */ - 3481 : 6813 : msk->cb_flags &= ~flags; - 3482 : 6813 : spin_unlock_bh(&sk->sk_lock.slock); + 3481 : 9167 : msk->cb_flags &= ~flags; + 3482 : 9167 : spin_unlock_bh(&sk->sk_lock.slock); 3483 : : - 3484 [ + + ]: 6813 : if (flags & BIT(MPTCP_FLUSH_JOIN_LIST)) - 3485 : 14 : __mptcp_flush_join_list(sk, &join_list); - 3486 [ + + ]: 6813 : if (flags & BIT(MPTCP_PUSH_PENDING)) - 3487 : 6519 : __mptcp_push_pending(sk, 0); - 3488 [ + + ]: 6813 : if (flags & BIT(MPTCP_RETRANSMIT)) - 3489 : 412 : __mptcp_retrans(sk); + 3484 [ + + ]: 9167 : if (flags & BIT(MPTCP_FLUSH_JOIN_LIST)) + 3485 : 20 : __mptcp_flush_join_list(sk, &join_list); + 3486 [ + + ]: 9167 : if (flags & BIT(MPTCP_PUSH_PENDING)) + 3487 : 8797 : __mptcp_push_pending(sk, 0); + 3488 [ + + ]: 9167 : if (flags & BIT(MPTCP_RETRANSMIT)) + 3489 : 379 : __mptcp_retrans(sk); 3490 : : - 3491 : 6813 : cond_resched(); - 3492 : 6813 : spin_lock_bh(&sk->sk_lock.slock); + 3491 : 9167 : cond_resched(); + 3492 : 9167 : spin_lock_bh(&sk->sk_lock.slock); 3493 : : } 3494 : : - 3495 [ - + - - : 1210753 : if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) - - - + + ] - 3496 : 15367 : __mptcp_clean_una_wakeup(sk); - 3497 [ + + ]: 605585 : if (unlikely(msk->cb_flags)) { + 3495 [ - + - - : 1552440 : if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) + - - + + ] + 3496 : 29096 : __mptcp_clean_una_wakeup(sk); + 3497 [ + + ]: 776428 : if (unlikely(msk->cb_flags)) { 3498 : : /* be sure to sync the msk state before taking actions 3499 : : * depending on sk_state (MPTCP_ERROR_REPORT) 3500 : : * On sk release avoid actions depending on the first subflow 3501 : : */ - 3502 [ - + - - : 6154 : if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) - - - + + + + 3502 [ - + - - : 5786 : if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) + - - + + + - ] - 3503 : 833 : __mptcp_sync_state(sk, msk->pending_state); - 3504 [ - + - - : 6154 : if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) - - - + + ] - 3505 : 478 : __mptcp_error_report(sk); - 3506 [ - + - - : 6154 : if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) - - - + + ] - 3507 : 1780 : __mptcp_sync_sndbuf(sk); + 3503 : 834 : __mptcp_sync_state(sk, msk->pending_state); + 3504 [ - + - - : 5786 : if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) + - - + + ] + 3505 : 453 : __mptcp_error_report(sk); + 3506 [ - + - - : 5786 : if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) + - - + + ] + 3507 : 1620 : __mptcp_sync_sndbuf(sk); 3508 : : } 3509 : : - 3510 : 605585 : __mptcp_update_rmem(sk); - 3511 : 605585 : } + 3510 : 776428 : __mptcp_update_rmem(sk); + 3511 : 776428 : } 3512 : : 3513 : : /* MP_JOIN client subflow must wait for 4th ack before sending any data: 3514 : : * TCP can't schedule delack timer before the subflow is fully established. 3515 : : * MPTCP uses the delack timer to do 3rd ack retransmissions 3516 : : */ - 3517 : 444 : static void schedule_3rdack_retransmission(struct sock *ssk) + 3517 : 446 : static void schedule_3rdack_retransmission(struct sock *ssk) 3518 : : { - 3519 : 444 : struct inet_connection_sock *icsk = inet_csk(ssk); - 3520 [ - + ]: 444 : struct tcp_sock *tp = tcp_sk(ssk); - 3521 : 444 : unsigned long timeout; + 3519 : 446 : struct inet_connection_sock *icsk = inet_csk(ssk); + 3520 [ - + ]: 446 : struct tcp_sock *tp = tcp_sk(ssk); + 3521 : 446 : unsigned long timeout; 3522 : : - 3523 [ + + + + ]: 444 : if (READ_ONCE(mptcp_subflow_ctx(ssk)->fully_established)) + 3523 [ + + + + ]: 446 : if (READ_ONCE(mptcp_subflow_ctx(ssk)->fully_established)) 3524 : : return; 3525 : : 3526 : : /* reschedule with a timeout above RTT, as we must look only for drop */ @@ -3635,30 +3635,30 @@ 3537 : 90 : sk_reset_timer(ssk, &icsk->icsk_delack_timer, timeout); 3538 : : } 3539 : : - 3540 : 26786 : void mptcp_subflow_process_delegated(struct sock *ssk, long status) + 3540 : 30160 : void mptcp_subflow_process_delegated(struct sock *ssk, long status) 3541 : : { - 3542 [ + + ]: 26786 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 3543 : 26786 : struct sock *sk = subflow->conn; + 3542 [ + + ]: 30160 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 3543 : 30160 : struct sock *sk = subflow->conn; 3544 : : - 3545 [ + + ]: 26786 : if (status & BIT(MPTCP_DELEGATE_SEND)) { - 3546 : 3677 : mptcp_data_lock(sk); - 3547 [ + + ]: 3677 : if (!sock_owned_by_user(sk)) - 3548 : 3433 : __mptcp_subflow_push_pending(sk, ssk, true); + 3545 [ + + ]: 30160 : if (status & BIT(MPTCP_DELEGATE_SEND)) { + 3546 : 5594 : mptcp_data_lock(sk); + 3547 [ + + ]: 5594 : if (!sock_owned_by_user(sk)) + 3548 : 5165 : __mptcp_subflow_push_pending(sk, ssk, true); 3549 : : else - 3550 [ - + ]: 244 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); - 3551 : 3677 : mptcp_data_unlock(sk); + 3550 [ - + ]: 429 : __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags); + 3551 : 5594 : mptcp_data_unlock(sk); 3552 : : } - 3553 [ + + ]: 26786 : if (status & BIT(MPTCP_DELEGATE_SNDBUF)) { - 3554 : 22829 : mptcp_data_lock(sk); - 3555 [ + + ]: 22829 : if (!sock_owned_by_user(sk)) - 3556 : 20600 : __mptcp_sync_sndbuf(sk); + 3553 [ + + ]: 30160 : if (status & BIT(MPTCP_DELEGATE_SNDBUF)) { + 3554 : 23946 : mptcp_data_lock(sk); + 3555 [ + + ]: 23946 : if (!sock_owned_by_user(sk)) + 3556 : 22088 : __mptcp_sync_sndbuf(sk); 3557 : : else - 3558 [ - + ]: 2229 : __set_bit(MPTCP_SYNC_SNDBUF, &mptcp_sk(sk)->cb_flags); - 3559 : 22829 : mptcp_data_unlock(sk); + 3558 [ - + ]: 1858 : __set_bit(MPTCP_SYNC_SNDBUF, &mptcp_sk(sk)->cb_flags); + 3559 : 23946 : mptcp_data_unlock(sk); 3560 : : } - 3561 [ + + ]: 26786 : if (status & BIT(MPTCP_DELEGATE_ACK)) - 3562 : 444 : schedule_3rdack_retransmission(ssk); - 3563 : 26786 : } + 3561 [ + + ]: 30160 : if (status & BIT(MPTCP_DELEGATE_ACK)) + 3562 : 446 : schedule_3rdack_retransmission(ssk); + 3563 : 30160 : } 3564 : : 3565 : 0 : static int mptcp_hash(struct sock *sk) 3566 : : { @@ -3708,59 +3708,59 @@ 3610 : 1082 : mptcp_pm_new_connection(msk, ssk, 0); 3611 : 1082 : } 3612 : : - 3613 : 4443 : void mptcp_sock_graft(struct sock *sk, struct socket *parent) + 3613 : 4445 : void mptcp_sock_graft(struct sock *sk, struct socket *parent) 3614 : : { - 3615 : 4443 : write_lock_bh(&sk->sk_callback_lock); - 3616 : 4443 : rcu_assign_pointer(sk->sk_wq, &parent->wq); - 3617 : 4443 : sk_set_socket(sk, parent); - 3618 : 4443 : sk->sk_uid = SOCK_INODE(parent)->i_uid; - 3619 : 4443 : write_unlock_bh(&sk->sk_callback_lock); - 3620 : 4443 : } + 3615 : 4445 : write_lock_bh(&sk->sk_callback_lock); + 3616 : 4445 : rcu_assign_pointer(sk->sk_wq, &parent->wq); + 3617 : 4445 : sk_set_socket(sk, parent); + 3618 : 4445 : sk->sk_uid = SOCK_INODE(parent)->i_uid; + 3619 : 4445 : write_unlock_bh(&sk->sk_callback_lock); + 3620 : 4445 : } 3621 : : - 3622 : 882 : bool mptcp_finish_join(struct sock *ssk) + 3622 : 886 : bool mptcp_finish_join(struct sock *ssk) 3623 : : { - 3624 [ - + ]: 882 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 3625 [ - + ]: 882 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 3626 : 882 : struct sock *parent = (void *)msk; - 3627 : 882 : bool ret = true; + 3624 [ - + ]: 886 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 3625 [ - + ]: 886 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 3626 : 886 : struct sock *parent = (void *)msk; + 3627 : 886 : bool ret = true; 3628 : : - 3629 [ - + ]: 882 : pr_debug("msk=%p, subflow=%p\n", msk, subflow); + 3629 [ - + ]: 886 : pr_debug("msk=%p, subflow=%p\n", msk, subflow); 3630 : : 3631 : : /* mptcp socket already closing? */ - 3632 [ - + ]: 882 : if (!mptcp_is_fully_established(parent)) { + 3632 [ - + ]: 886 : if (!mptcp_is_fully_established(parent)) { 3633 : 0 : subflow->reset_reason = MPTCP_RST_EMPTCP; 3634 : 0 : return false; 3635 : : } 3636 : : 3637 : : /* active subflow, already present inside the conn_list */ - 3638 [ + + ]: 882 : if (!list_empty(&subflow->node)) { - 3639 : 432 : mptcp_subflow_joined(msk, ssk); - 3640 : 432 : mptcp_propagate_sndbuf(parent, ssk); - 3641 : 432 : return true; + 3638 [ + + ]: 886 : if (!list_empty(&subflow->node)) { + 3639 : 434 : mptcp_subflow_joined(msk, ssk); + 3640 : 434 : mptcp_propagate_sndbuf(parent, ssk); + 3641 : 434 : return true; 3642 : : } 3643 : : - 3644 [ - + ]: 450 : if (!mptcp_pm_allow_new_subflow(msk)) + 3644 [ - + ]: 452 : if (!mptcp_pm_allow_new_subflow(msk)) 3645 : 0 : goto err_prohibited; 3646 : : 3647 : : /* If we can't acquire msk socket lock here, let the release callback 3648 : : * handle it 3649 : : */ - 3650 : 450 : mptcp_data_lock(parent); - 3651 [ + + ]: 450 : if (!sock_owned_by_user(parent)) { - 3652 : 436 : ret = __mptcp_finish_join(msk, ssk); - 3653 [ + - ]: 436 : if (ret) { - 3654 : 436 : sock_hold(ssk); - 3655 : 436 : list_add_tail(&subflow->node, &msk->conn_list); + 3650 : 452 : mptcp_data_lock(parent); + 3651 [ + + ]: 452 : if (!sock_owned_by_user(parent)) { + 3652 : 428 : ret = __mptcp_finish_join(msk, ssk); + 3653 [ + - ]: 428 : if (ret) { + 3654 : 428 : sock_hold(ssk); + 3655 : 428 : list_add_tail(&subflow->node, &msk->conn_list); 3656 : : } 3657 : : } else { - 3658 : 14 : sock_hold(ssk); - 3659 [ - + ]: 14 : list_add_tail(&subflow->node, &msk->join_list); - 3660 [ - + - - : 14 : __set_bit(MPTCP_FLUSH_JOIN_LIST, &msk->cb_flags); + 3658 : 24 : sock_hold(ssk); + 3659 [ - + ]: 24 : list_add_tail(&subflow->node, &msk->join_list); + 3660 [ - + - - : 24 : __set_bit(MPTCP_FLUSH_JOIN_LIST, &msk->cb_flags); - - ] 3661 : : } - 3662 : 450 : mptcp_data_unlock(parent); + 3662 : 452 : mptcp_data_unlock(parent); 3663 : : - 3664 [ - + ]: 450 : if (!ret) { + 3664 [ - + ]: 452 : if (!ret) { 3665 : 0 : err_prohibited: 3666 : 0 : subflow->reset_reason = MPTCP_RST_EPROHIBIT; 3667 : 0 : return false; @@ -3769,18 +3769,18 @@ 3670 : : return true; 3671 : : } 3672 : : - 3673 : 1465 : static void mptcp_shutdown(struct sock *sk, int how) + 3673 : 1459 : static void mptcp_shutdown(struct sock *sk, int how) 3674 : : { - 3675 [ - + ]: 1465 : pr_debug("sk=%p, how=%d\n", sk, how); + 3675 [ - + ]: 1459 : pr_debug("sk=%p, how=%d\n", sk, how); 3676 : : - 3677 [ + - + + ]: 1465 : if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) - 3678 : 1368 : __mptcp_wr_shutdown(sk); - 3679 : 1465 : } + 3677 [ + - + + ]: 1459 : if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) + 3678 : 1364 : __mptcp_wr_shutdown(sk); + 3679 : 1459 : } 3680 : : - 3681 : 5412 : static int mptcp_forward_alloc_get(const struct sock *sk) + 3681 : 5344 : static int mptcp_forward_alloc_get(const struct sock *sk) 3682 : : { - 3683 : 10824 : return READ_ONCE(sk->sk_forward_alloc) + - 3684 [ - + ]: 5412 : READ_ONCE(mptcp_sk(sk)->rmem_fwd_alloc); + 3683 : 10688 : return READ_ONCE(sk->sk_forward_alloc) + + 3684 [ - + ]: 5344 : READ_ONCE(mptcp_sk(sk)->rmem_fwd_alloc); 3685 : : } 3686 : : 3687 : 16 : static int mptcp_ioctl_outq(const struct mptcp_sock *msk, u64 v) @@ -4074,11 +4074,11 @@ 3974 : : /* set ssk->sk_socket of accept()ed flows to mptcp socket. 3975 : : * This is needed so NOSPACE flag can be set from tcp stack. 3976 : : */ - 3977 [ + + ]: 2176 : mptcp_for_each_subflow(msk, subflow) { - 3978 [ + - ]: 1092 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 3977 [ + + ]: 2177 : mptcp_for_each_subflow(msk, subflow) { + 3978 [ + - ]: 1093 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 3979 : : - 3980 [ + - ]: 1092 : if (!ssk->sk_socket) - 3981 : 1092 : mptcp_sock_graft(ssk, newsock); + 3980 [ + - ]: 1093 : if (!ssk->sk_socket) + 3981 : 1093 : mptcp_sock_graft(ssk, newsock); 3982 : : } 3983 : : 3984 : : /* Do late cleanup for the first subflow as necessary. Also @@ -4109,36 +4109,36 @@ 4009 : 1178 : return 0; 4010 : : } 4011 : : - 4012 : 245200 : static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) + 4012 : 396765 : static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) 4013 : : { - 4014 : 245200 : struct sock *sk = (struct sock *)msk; + 4014 : 396765 : struct sock *sk = (struct sock *)msk; 4015 : : - 4016 [ + + ]: 245200 : if (__mptcp_stream_is_writeable(sk, 1)) + 4016 [ + + ]: 396765 : if (__mptcp_stream_is_writeable(sk, 1)) 4017 : : return EPOLLOUT | EPOLLWRNORM; 4018 : : - 4019 : 65509 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); - 4020 : 65509 : smp_mb__after_atomic(); /* NOSPACE is changed by mptcp_write_space() */ - 4021 [ + + ]: 65509 : if (__mptcp_stream_is_writeable(sk, 1)) + 4019 : 117477 : set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); + 4020 : 117477 : smp_mb__after_atomic(); /* NOSPACE is changed by mptcp_write_space() */ + 4021 [ + + ]: 117477 : if (__mptcp_stream_is_writeable(sk, 1)) 4022 : : return EPOLLOUT | EPOLLWRNORM; 4023 : : 4024 : : return 0; 4025 : : } 4026 : : - 4027 : 505045 : static __poll_t mptcp_poll(struct file *file, struct socket *sock, + 4027 : 676434 : static __poll_t mptcp_poll(struct file *file, struct socket *sock, 4028 : : struct poll_table_struct *wait) 4029 : : { - 4030 : 505045 : struct sock *sk = sock->sk; - 4031 : 505045 : struct mptcp_sock *msk; - 4032 : 505045 : __poll_t mask = 0; - 4033 : 505045 : u8 shutdown; - 4034 : 505045 : int state; + 4030 : 676434 : struct sock *sk = sock->sk; + 4031 : 676434 : struct mptcp_sock *msk; + 4032 : 676434 : __poll_t mask = 0; + 4033 : 676434 : u8 shutdown; + 4034 : 676434 : int state; 4035 : : - 4036 [ - + ]: 505045 : msk = mptcp_sk(sk); - 4037 : 505045 : sock_poll_wait(file, sock, wait); + 4036 [ - + ]: 676434 : msk = mptcp_sk(sk); + 4037 : 676434 : sock_poll_wait(file, sock, wait); 4038 : : - 4039 : 505045 : state = inet_sk_state_load(sk); - 4040 [ - + ]: 505045 : pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags); - 4041 [ + + ]: 505045 : if (state == TCP_LISTEN) { + 4039 : 676434 : state = inet_sk_state_load(sk); + 4040 [ - + ]: 676434 : pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags); + 4041 [ + + ]: 676434 : if (state == TCP_LISTEN) { 4042 : 1888 : struct sock *ssk = READ_ONCE(msk->first); 4043 : : 4044 [ - + ]: 1888 : if (WARN_ON_ONCE(!ssk)) @@ -4147,18 +4147,18 @@ 4047 [ + + ]: 2832 : return inet_csk_listen_poll(ssk); 4048 : : } 4049 : : - 4050 : 503157 : shutdown = READ_ONCE(sk->sk_shutdown); - 4051 [ + + ]: 503157 : if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) - 4052 : 9770 : mask |= EPOLLHUP; - 4053 [ + + ]: 503157 : if (shutdown & RCV_SHUTDOWN) - 4054 : 186327 : mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; + 4050 : 674546 : shutdown = READ_ONCE(sk->sk_shutdown); + 4051 [ + + ]: 674546 : if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE) + 4052 : 11267 : mask |= EPOLLHUP; + 4053 [ + + ]: 674546 : if (shutdown & RCV_SHUTDOWN) + 4054 : 191849 : mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP; 4055 : : - 4056 [ + - ]: 503157 : if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { - 4057 : 503157 : mask |= mptcp_check_readable(sk); - 4058 [ + + ]: 503157 : if (shutdown & SEND_SHUTDOWN) - 4059 : 257957 : mask |= EPOLLOUT | EPOLLWRNORM; + 4056 [ + - ]: 674546 : if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) { + 4057 : 674546 : mask |= mptcp_check_readable(sk); + 4058 [ + + ]: 674546 : if (shutdown & SEND_SHUTDOWN) + 4059 : 277781 : mask |= EPOLLOUT | EPOLLWRNORM; 4060 : : else - 4061 : 245200 : mask |= mptcp_check_writeable(msk); + 4061 : 396765 : mask |= mptcp_check_writeable(msk); 4062 [ # # # # ]: 0 : } else if (state == TCP_SYN_SENT && 4063 [ # # ]: 0 : inet_test_bit(DEFER_CONNECT, sk)) { 4064 : : /* cf tcp_poll() note about TFO */ @@ -4166,9 +4166,9 @@ 4066 : : } 4067 : : 4068 : : /* This barrier is coupled with smp_wmb() in __mptcp_error_report() */ - 4069 : 503157 : smp_rmb(); - 4070 [ + + ]: 503157 : if (READ_ONCE(sk->sk_err)) - 4071 : 23 : mask |= EPOLLERR; + 4069 : 674546 : smp_rmb(); + 4070 [ + + ]: 674546 : if (READ_ONCE(sk->sk_err)) + 4071 : 21 : mask |= EPOLLERR; 4072 : : 4073 : : return mask; 4074 : : } @@ -4203,40 +4203,40 @@ 4103 : : .flags = INET_PROTOSW_ICSK, 4104 : : }; 4105 : : - 4106 : 48569 : static int mptcp_napi_poll(struct napi_struct *napi, int budget) + 4106 : 31438 : static int mptcp_napi_poll(struct napi_struct *napi, int budget) 4107 : : { - 4108 : 48569 : struct mptcp_delegated_action *delegated; - 4109 : 48569 : struct mptcp_subflow_context *subflow; - 4110 : 48569 : int work_done = 0; + 4108 : 31438 : struct mptcp_delegated_action *delegated; + 4109 : 31438 : struct mptcp_subflow_context *subflow; + 4110 : 31438 : int work_done = 0; 4111 : : - 4112 : 48569 : delegated = container_of(napi, struct mptcp_delegated_action, napi); - 4113 [ + + ]: 98051 : while ((subflow = mptcp_subflow_delegated_next(delegated)) != NULL) { - 4114 : 49482 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 4112 : 31438 : delegated = container_of(napi, struct mptcp_delegated_action, napi); + 4113 [ + + ]: 64161 : while ((subflow = mptcp_subflow_delegated_next(delegated)) != NULL) { + 4114 : 32723 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); 4115 : : - 4116 : 49482 : bh_lock_sock_nested(ssk); - 4117 [ + + ]: 49482 : if (!sock_owned_by_user(ssk)) { - 4118 : 24639 : mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0)); + 4116 : 32723 : bh_lock_sock_nested(ssk); + 4117 [ + + ]: 32723 : if (!sock_owned_by_user(ssk)) { + 4118 : 27968 : mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0)); 4119 : : } else { 4120 : : /* tcp_release_cb_override already processed 4121 : : * the action or will do at next release_sock(). 4122 : : * In both case must dequeue the subflow here - on the same 4123 : : * CPU that scheduled it. 4124 : : */ - 4125 : 24843 : smp_wmb(); - 4126 : 24843 : clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status); + 4125 : 4755 : smp_wmb(); + 4126 : 4755 : clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status); 4127 : : } - 4128 : 49482 : bh_unlock_sock(ssk); - 4129 : 49482 : sock_put(ssk); + 4128 : 32723 : bh_unlock_sock(ssk); + 4129 : 32723 : sock_put(ssk); 4130 : : - 4131 [ + - ]: 49482 : if (++work_done == budget) + 4131 [ + - ]: 32723 : if (++work_done == budget) 4132 : : return budget; 4133 : : } 4134 : : 4135 : : /* always provide a 0 'work_done' argument, so that napi_complete_done 4136 : : * will not try accessing the NULL napi->dev ptr 4137 : : */ - 4138 : 48569 : napi_complete_done(napi, 0); - 4139 : 48569 : return work_done; + 4138 : 31438 : napi_complete_done(napi, 0); + 4139 : 31438 : return work_done; 4140 : : } 4141 : : 4142 : 4 : void __init mptcp_proto_init(void) diff --git a/html/lcov/export-net/mptcp/protocol.h.func-c.html b/html/lcov/export-net/mptcp/protocol.h.func-c.html index c37fd142..47ebc7bd 100644 --- a/html/lcov/export-net/mptcp/protocol.h.func-c.html +++ b/html/lcov/export-net/mptcp/protocol.h.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 68.4 % - 526 - 360 + 73.3 % + 528 + 387 @@ -88,14 +88,14 @@ mptcp_pm_close_subflow - 37 + 39 mptcp_send_active_reset_reason - 40 + 43 @@ -116,210 +116,210 @@ __mptcp_pm_close_subflow - 316 + 313 - mptcp_start_tout_timer + __mptcp_has_initial_subflow - 977 + 978 mptcp_stop_tout_timer - 989 + 991 - __mptcp_has_initial_subflow + mptcp_start_tout_timer - 1013 + 992 mptcp_is_fully_established - 1880 + 1888 mptcp_space_from_win - 2881 + 2948 subflow_simultaneous_connect - 4752 + 4700 __mptcp_sync_sndbuf - 30328 + 31631 mptcp_check_infinite_map - 39332 + 53016 - mptcp_subflow_delegate + mptcp_subflow_delegated_next - 85385 + 64161 - mptcp_subflow_delegated_next + mptcp_subflow_delegate - 98051 + 70635 mptcp_rtx_head - 191819 + 243820 mptcp_send_next - 200765 + 282896 mptcp_pending_tail - 277201 + 378738 - __mptcp_stream_is_writeable + mptcp_propagate_sndbuf - 310709 + 436451 - mptcp_propagate_sndbuf + mptcp_write_space - 360700 + 504129 - mptcp_write_space + mptcp_check_fallback - 411139 + 506148 - mptcp_check_fallback + __mptcp_stream_is_writeable - 539883 + 514242 __tcp_can_send - 562767 + 723959 mptcp_data_fin_enabled - 621604 + 864735 __mptcp_subflow_active - 720035 + 907221 mptcp_epollin_ready - 956979 + 1074095 mptcp_stream_memory_free - 1004469 + 1422280 - mptcp_notsent_lowat + __mptcp_space - 1281670 + 1676870 - __mptcp_space + mptcp_notsent_lowat - 1482202 + 1801018 mptcp_send_head - 1877683 + 2143494 - __mptcp_rmem + mptcp_subflow_get_map_offset - 2392220 + 2375378 - mptcp_subflow_get_map_offset + __mptcp_rmem - 2567945 + 2620183 mptcp_win_from_space - 2591154 + 2912613 __mptcp_check_fallback - 4647776 + 5061204 diff --git a/html/lcov/export-net/mptcp/protocol.h.func.html b/html/lcov/export-net/mptcp/protocol.h.func.html index 9c049341..dd0e1e44 100644 --- a/html/lcov/export-net/mptcp/protocol.h.func.html +++ b/html/lcov/export-net/mptcp/protocol.h.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 68.4 % - 526 - 360 + 73.3 % + 528 + 387 @@ -81,7 +81,7 @@ __mptcp_check_fallback - 4647776 + 5061204 @@ -95,77 +95,77 @@ __mptcp_has_initial_subflow - 1013 + 978 __mptcp_pm_close_subflow - 316 + 313 __mptcp_rmem - 2392220 + 2620183 __mptcp_space - 1482202 + 1676870 __mptcp_stream_is_writeable - 310709 + 514242 __mptcp_subflow_active - 720035 + 907221 __mptcp_sync_sndbuf - 30328 + 31631 __tcp_can_send - 562767 + 723959 mptcp_check_fallback - 539883 + 506148 mptcp_check_infinite_map - 39332 + 53016 mptcp_data_fin_enabled - 621604 + 864735 @@ -179,112 +179,112 @@ mptcp_epollin_ready - 956979 + 1074095 mptcp_is_fully_established - 1880 + 1888 mptcp_notsent_lowat - 1281670 + 1801018 mptcp_pending_tail - 277201 + 378738 mptcp_pm_close_subflow - 37 + 39 mptcp_propagate_sndbuf - 360700 + 436451 mptcp_rtx_head - 191819 + 243820 mptcp_send_active_reset_reason - 40 + 43 mptcp_send_head - 1877683 + 2143494 mptcp_send_next - 200765 + 282896 mptcp_space_from_win - 2881 + 2948 mptcp_start_tout_timer - 977 + 992 mptcp_stop_tout_timer - 989 + 991 mptcp_stream_memory_free - 1004469 + 1422280 mptcp_subflow_delegate - 85385 + 70635 mptcp_subflow_delegated_next - 98051 + 64161 @@ -298,28 +298,28 @@ mptcp_subflow_get_map_offset - 2567945 + 2375378 mptcp_win_from_space - 2591154 + 2912613 mptcp_write_space - 411139 + 504129 subflow_simultaneous_connect - 4752 + 4700 diff --git a/html/lcov/export-net/mptcp/protocol.h.gcov.html b/html/lcov/export-net/mptcp/protocol.h.gcov.html index 8fa31121..46ad9cb5 100644 --- a/html/lcov/export-net/mptcp/protocol.h.gcov.html +++ b/html/lcov/export-net/mptcp/protocol.h.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -56,9 +56,9 @@ Branches: - 68.4 % - 526 - 360 + 73.3 % + 528 + 387 @@ -214,21 +214,21 @@ 136 : : 137 : 18 : static inline bool before64(__u64 seq1, __u64 seq2) 138 : : { - 139 [ + + - - : 5145014 : return (__s64)(seq1 - seq2) < 0; - - + + + + - - + + ][ + - + + + + + - + + + + + - + + - - + - + + + + + - + + + + + - + + ][ + + - + + + + + - + + + + + - - - - - - - - - - - - - - - - - - - - ] + 139 [ + + - + : 5606198 : return (__s64)(seq1 - seq2) < 0; + + + + + + + + + + ][ + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + ][ + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + ] 140 : : } 141 : : 142 : : #define after64(seq2, seq1) before64(seq1, seq2) @@ -269,8 +269,8 @@ 177 : : 178 : 0 : static inline __be32 mptcp_option(u8 subopt, u8 len, u8 nib, u8 field) 179 : : { - 180 [ + - + + : 599609 : return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) | - + + + - ] + 180 [ + - + + : 742414 : return htonl((TCPOPT_MPTCP << 24) | (len << 16) | (subopt << 12) | + + + + - ] 181 : : ((nib & 0xF) << 8) | field); 182 : : } 183 : : @@ -451,9 +451,9 @@ 358 : : 359 : : extern struct genl_family mptcp_genl_family; 360 : : - 361 : 58 : static inline void msk_owned_by_me(const struct mptcp_sock *msk) + 361 : 59 : static inline void msk_owned_by_me(const struct mptcp_sock *msk) 362 : : { - 363 : 582317 : sock_owned_by_me((const struct sock *)msk); + 363 : 722511 : sock_owned_by_me((const struct sock *)msk); 364 : : } 365 : : 366 : : #ifdef CONFIG_DEBUG_NET @@ -477,64 +477,64 @@ 384 : : /* the msk socket don't use the backlog, also account for the bulk 385 : : * free memory 386 : : */ - 387 : 2392220 : static inline int __mptcp_rmem(const struct sock *sk) + 387 : 2620183 : static inline int __mptcp_rmem(const struct sock *sk) 388 : : { - 389 [ - + ]: 2392220 : return atomic_read(&sk->sk_rmem_alloc) - READ_ONCE(mptcp_sk(sk)->rmem_released); + 389 [ - + ]: 2620183 : return atomic_read(&sk->sk_rmem_alloc) - READ_ONCE(mptcp_sk(sk)->rmem_released); 390 : : } 391 : : - 392 : 2591154 : static inline int mptcp_win_from_space(const struct sock *sk, int space) + 392 : 2912613 : static inline int mptcp_win_from_space(const struct sock *sk, int space) 393 : : { - 394 [ - + ]: 2591154 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space); + 394 [ - + ]: 2912613 : return __tcp_win_from_space(mptcp_sk(sk)->scaling_ratio, space); 395 : : } 396 : : - 397 : 2881 : static inline int mptcp_space_from_win(const struct sock *sk, int win) + 397 : 2948 : static inline int mptcp_space_from_win(const struct sock *sk, int win) 398 : : { - 399 [ - + ]: 2881 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win); + 399 [ - + ]: 2948 : return __tcp_space_from_win(mptcp_sk(sk)->scaling_ratio, win); 400 : : } 401 : : - 402 : 1482202 : static inline int __mptcp_space(const struct sock *sk) + 402 : 1676870 : static inline int __mptcp_space(const struct sock *sk) 403 : : { - 404 : 1482202 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - __mptcp_rmem(sk)); + 404 : 1676870 : return mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - __mptcp_rmem(sk)); 405 : : } 406 : : - 407 : 1877683 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk) + 407 : 2143494 : static inline struct mptcp_data_frag *mptcp_send_head(const struct sock *sk) 408 : : { - 409 [ - + ]: 1877683 : const struct mptcp_sock *msk = mptcp_sk(sk); + 409 [ - + ]: 2143494 : const struct mptcp_sock *msk = mptcp_sk(sk); 410 : : - 411 : 1877683 : return READ_ONCE(msk->first_pending); + 411 : 2143494 : return READ_ONCE(msk->first_pending); 412 : : } 413 : : - 414 : 200765 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk) + 414 : 282896 : static inline struct mptcp_data_frag *mptcp_send_next(struct sock *sk) 415 : : { - 416 [ - + ]: 200765 : struct mptcp_sock *msk = mptcp_sk(sk); - 417 : 200765 : struct mptcp_data_frag *cur; + 416 [ - + ]: 282896 : struct mptcp_sock *msk = mptcp_sk(sk); + 417 : 282896 : struct mptcp_data_frag *cur; 418 : : - 419 : 200765 : cur = msk->first_pending; - 420 [ + + ]: 200765 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL : - 421 : 92035 : list_next_entry(cur, list); + 419 : 282896 : cur = msk->first_pending; + 420 [ + + ]: 282896 : return list_is_last(&cur->list, &msk->rtx_queue) ? NULL : + 421 : 92554 : list_next_entry(cur, list); 422 : : } 423 : : - 424 : 277201 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk) + 424 : 378738 : static inline struct mptcp_data_frag *mptcp_pending_tail(const struct sock *sk) 425 : : { - 426 [ - + ]: 277201 : const struct mptcp_sock *msk = mptcp_sk(sk); + 426 [ - + ]: 378738 : const struct mptcp_sock *msk = mptcp_sk(sk); 427 : : - 428 [ + + ]: 277201 : if (!msk->first_pending) + 428 [ + + ]: 378738 : if (!msk->first_pending) 429 : : return NULL; 430 : : - 431 [ - + + - ]: 168486 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue))) + 431 [ - + + - ]: 188411 : if (WARN_ON_ONCE(list_empty(&msk->rtx_queue))) 432 : : return NULL; 433 : : - 434 : 168486 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list); + 434 : 188411 : return list_last_entry(&msk->rtx_queue, struct mptcp_data_frag, list); 435 : : } 436 : : - 437 : 191819 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk) + 437 : 243820 : static inline struct mptcp_data_frag *mptcp_rtx_head(struct sock *sk) 438 : : { - 439 [ - + ]: 191819 : struct mptcp_sock *msk = mptcp_sk(sk); + 439 [ - + ]: 243820 : struct mptcp_sock *msk = mptcp_sk(sk); 440 : : - 441 [ + + ]: 191819 : if (msk->snd_una == msk->snd_nxt) + 441 [ + + ]: 243820 : if (msk->snd_una == msk->snd_nxt) 442 : : return NULL; 443 : : - 444 [ + + ]: 147664 : return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list); + 444 [ + + ]: 194560 : return list_first_entry_or_null(&msk->rtx_queue, struct mptcp_data_frag, list); 445 : : } 446 : : 447 : : struct csum_pseudo_header { @@ -673,61 +673,62 @@ 580 : : static inline struct mptcp_subflow_context * 581 : 36 : mptcp_subflow_ctx(const struct sock *sk) 582 : : { - 583 [ - + + - ]: 303207 : const struct inet_connection_sock *icsk = inet_csk(sk); + 583 [ - + + - ]: 369329 : const struct inet_connection_sock *icsk = inet_csk(sk); 584 : : 585 : : /* Use RCU on icsk_ulp_data only for sock diag code */ - 586 [ + + ][ - + : 19828233 : return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data; + 586 [ + + ][ - + : 22948196 : return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data; + + - + - - + ][ + + + - - + + - + - - + + + + - + + + - + - - + + + + - + - + + + - - + + + + - - + + - + - - + - + + - + + - + + - - + ][ + + - + - + + - - + + + + + - + + + + + - + - + + + - + + - + + - + - + - + - + - + - - - + - + - + - + - - - + - - - + ][ + - + - + - + - - + + + - - + + - + + - - + - + - - + - + + - + ] + + ][ + + + + - + + - + + + + + + + + + + + + + + - + + + + + + - + + + + - + + + + + - + + - + + - + - + + + + + - + + + - + ][ + + + + - + + - + + + + + + + + + + + - + + - + + + + + + - + + + - - + + + + + - + + - + + - + - + + + + + - + + + - + ][ + + + - + - + + - + + + - + + + - + + + - + - + - + + - + + + + ] 587 : : } 588 : : 589 : : static inline struct sock * 590 : 0 : mptcp_subflow_tcp_sock(const struct mptcp_subflow_context *subflow) 591 : : { - 592 [ + + ][ - + : 2533194 : return subflow->tcp_sock; - + + + + ] - [ - + + + ] - [ + - - + - + - + + + - + - + - - - + + + + + - + - - - + 592 [ + + + + : 3127478 : return subflow->tcp_sock; + + + ][ + + + + + + + ] + [ - + + + ] + [ + - - + + + - + + + + + - + - - + + + + + + + + - - - - ] 593 : : } 594 : : 595 : : static inline void 596 : 24 : mptcp_subflow_ctx_reset(struct mptcp_subflow_context *subflow) 597 : : { - 598 : 821 : memset(&subflow->reset, 0, sizeof(subflow->reset)); - 599 : 821 : subflow->request_mptcp = 1; - 600 : 821 : WRITE_ONCE(subflow->local_id, -1); - 601 : 821 : } + 598 : 792 : memset(&subflow->reset, 0, sizeof(subflow->reset)); + 599 : 792 : subflow->request_mptcp = 1; + 600 : 792 : WRITE_ONCE(subflow->local_id, -1); + 601 : 792 : } 602 : : 603 : : /* Convert reset reasons in MPTCP to enum sk_rst_reason type */ 604 : : static inline enum sk_rst_reason @@ -757,71 +758,71 @@ 628 : : } 629 : : 630 : : static inline void - 631 : 40 : mptcp_send_active_reset_reason(struct sock *sk) + 631 : 43 : mptcp_send_active_reset_reason(struct sock *sk) 632 : : { - 633 : 40 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 634 : 40 : enum sk_rst_reason reason; + 633 : 43 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 634 : 43 : enum sk_rst_reason reason; 635 : : - 636 [ + - ]: 40 : reason = sk_rst_convert_mptcp_reason(subflow->reset_reason); - 637 : 40 : tcp_send_active_reset(sk, GFP_ATOMIC, reason); - 638 : 40 : } + 636 [ + - ]: 43 : reason = sk_rst_convert_mptcp_reason(subflow->reset_reason); + 637 : 43 : tcp_send_active_reset(sk, GFP_ATOMIC, reason); + 638 : 43 : } 639 : : 640 : : static inline u64 - 641 : 2567945 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow) + 641 : 2375378 : mptcp_subflow_get_map_offset(const struct mptcp_subflow_context *subflow) 642 : : { - 643 [ - + ]: 2567945 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq - - 644 : 2567945 : subflow->ssn_offset - - 645 : 2567945 : subflow->map_subflow_seq; + 643 [ - + ]: 2375378 : return tcp_sk(mptcp_subflow_tcp_sock(subflow))->copied_seq - + 644 : 2375378 : subflow->ssn_offset - + 645 : 2375378 : subflow->map_subflow_seq; 646 : : } 647 : : 648 : : static inline u64 649 : 36 : mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) 650 : : { - 651 [ + + ]: 1070489 : return subflow->map_seq + mptcp_subflow_get_map_offset(subflow); + 651 [ + + ]: 1004223 : return subflow->map_seq + mptcp_subflow_get_map_offset(subflow); 652 : : } 653 : : 654 : : void mptcp_subflow_process_delegated(struct sock *ssk, long actions); 655 : : - 656 : 85385 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action) + 656 : 70635 : static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action) 657 : : { - 658 [ - + ]: 85385 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action); - 659 : 85385 : struct mptcp_delegated_action *delegated; - 660 : 85385 : bool schedule; + 658 [ - + ]: 70635 : long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action); + 659 : 70635 : struct mptcp_delegated_action *delegated; + 660 : 70635 : bool schedule; 661 : : 662 : : /* the caller held the subflow bh socket lock */ - 663 [ + - + - : 85385 : lockdep_assert_in_softirq(); - + - + - - - + ] + 663 [ + - + - : 70635 : lockdep_assert_in_softirq(); + + - + - - + + ] 664 : : 665 : : /* The implied barrier pairs with tcp_release_cb_override() 666 : : * mptcp_napi_poll(), and ensures the below list check sees list 667 : : * updates done prior to delegated status bits changes 668 : : */ - 669 [ - + - + ]: 85385 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits); - 670 [ + + ]: 85385 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) { - 671 [ - + + - ]: 49482 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node))) + 669 [ + + + + ]: 70636 : old = set_mask_bits(&subflow->delegated_status, 0, set_bits); + 670 [ + + ]: 70635 : if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) { + 671 [ - + + - ]: 32723 : if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node))) 672 : : return; 673 : : - 674 : 49482 : delegated = this_cpu_ptr(&mptcp_delegated_actions); - 675 : 49482 : schedule = list_empty(&delegated->head); - 676 : 49482 : list_add_tail(&subflow->delegated_node, &delegated->head); - 677 : 49482 : sock_hold(mptcp_subflow_tcp_sock(subflow)); - 678 [ + + ]: 49482 : if (schedule) - 679 : 48604 : napi_schedule(&delegated->napi); + 674 : 32723 : delegated = this_cpu_ptr(&mptcp_delegated_actions); + 675 : 32723 : schedule = list_empty(&delegated->head); + 676 : 32723 : list_add_tail(&subflow->delegated_node, &delegated->head); + 677 : 32723 : sock_hold(mptcp_subflow_tcp_sock(subflow)); + 678 [ + + ]: 32723 : if (schedule) + 679 : 31579 : napi_schedule(&delegated->napi); 680 : : } 681 : : } 682 : : 683 : : static inline struct mptcp_subflow_context * - 684 : 98051 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) + 684 : 64161 : mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) 685 : : { - 686 : 98051 : struct mptcp_subflow_context *ret; + 686 : 64161 : struct mptcp_subflow_context *ret; 687 : : - 688 [ + + ]: 98051 : if (list_empty(&delegated->head)) + 688 [ + + ]: 64161 : if (list_empty(&delegated->head)) 689 : : return NULL; 690 : : - 691 : 49482 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node); - 692 : 49482 : list_del_init(&ret->delegated_node); - 693 : 49482 : return ret; + 691 : 32723 : ret = list_first_entry(&delegated->head, struct mptcp_subflow_context, delegated_node); + 692 : 32723 : list_del_init(&ret->delegated_node); + 693 : 32723 : return ret; 694 : : } 695 : : 696 : : int mptcp_is_enabled(const struct net *net); @@ -888,41 +889,41 @@ 757 : : 758 : 60 : static inline u64 mptcp_data_avail(const struct mptcp_sock *msk) 759 : : { - 760 [ + + ]: 536950 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); + 760 [ + + ]: 502095 : return READ_ONCE(msk->bytes_received) - READ_ONCE(msk->bytes_consumed); 761 : : } 762 : : - 763 : 956979 : static inline bool mptcp_epollin_ready(const struct sock *sk) + 763 : 1074095 : static inline bool mptcp_epollin_ready(const struct sock *sk) 764 : : { - 765 [ - + ]: 956979 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk)); + 765 [ - + ]: 1074095 : u64 data_avail = mptcp_data_avail(mptcp_sk(sk)); 766 : : - 767 [ + + ]: 956979 : if (!data_avail) + 767 [ + + ]: 1074095 : if (!data_avail) 768 : : return false; 769 : : 770 : : /* mptcp doesn't have to deal with small skbs in the receive queue, 771 : : * as it can always coalesce them 772 : : */ - 773 : 677021 : return (data_avail >= sk->sk_rcvlowat) || + 773 : 728473 : return (data_avail >= sk->sk_rcvlowat) || 774 : : (mem_cgroup_sockets_enabled && sk->sk_memcg && - 775 [ - + ]: 1354042 : mem_cgroup_under_socket_pressure(sk->sk_memcg)) || + 775 [ - + ]: 1456946 : mem_cgroup_under_socket_pressure(sk->sk_memcg)) || 776 [ # # ]: 0 : READ_ONCE(tcp_memory_pressure); 777 : : } 778 : : 779 : : int mptcp_set_rcvlowat(struct sock *sk, int val); 780 : : - 781 : 562788 : static inline bool __tcp_can_send(const struct sock *ssk) + 781 : 723980 : static inline bool __tcp_can_send(const struct sock *ssk) 782 : : { 783 : : /* only send if our side has not closed yet */ - 784 [ + + ]: 817525 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); + 784 [ + + ]: 1017205 : return ((1 << inet_sk_state_load(ssk)) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)); 785 : : } 786 : : - 787 : 720035 : static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow) + 787 : 907221 : static inline bool __mptcp_subflow_active(struct mptcp_subflow_context *subflow) 788 : : { 789 : : /* can't send if JOIN hasn't completed yet (i.e. is usable for mptcp) */ - 790 [ + + + + : 720035 : if (subflow->request_join && !READ_ONCE(subflow->fully_established)) - + + ] + 790 [ + + + + : 907221 : if (subflow->request_join && !READ_ONCE(subflow->fully_established)) + + + ] 791 : : return false; 792 : : - 793 : 719664 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); + 793 : 906858 : return __tcp_can_send(mptcp_subflow_tcp_sock(subflow)); 794 : : } 795 : : 796 : : void mptcp_subflow_set_active(struct mptcp_subflow_context *subflow); @@ -958,9 +959,9 @@ 826 : : void __mptcp_sync_state(struct sock *sk, int state); 827 : : void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); 828 : : - 829 : 989 : static inline void mptcp_stop_tout_timer(struct sock *sk) + 829 : 991 : static inline void mptcp_stop_tout_timer(struct sock *sk) 830 : : { - 831 [ + + ]: 989 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp) + 831 [ + + ]: 991 : if (!inet_csk(sk)->icsk_mtup.probe_timestamp) 832 : : return; 833 : : 834 : 4 : sk_stop_timer(sk, &sk->sk_timer); @@ -973,17 +974,17 @@ 841 : 36 : inet_csk(sk)->icsk_mtup.probe_timestamp = tout ? : 1; 842 : : } 843 : : - 844 : 977 : static inline void mptcp_start_tout_timer(struct sock *sk) + 844 : 992 : static inline void mptcp_start_tout_timer(struct sock *sk) 845 : : { - 846 : 977 : mptcp_set_close_tout(sk, tcp_jiffies32); - 847 [ - + ]: 977 : mptcp_reset_tout_timer(mptcp_sk(sk), 0); - 848 : 977 : } + 846 : 992 : mptcp_set_close_tout(sk, tcp_jiffies32); + 847 [ - + ]: 992 : mptcp_reset_tout_timer(mptcp_sk(sk), 0); + 848 : 992 : } 849 : : - 850 : 1880 : static inline bool mptcp_is_fully_established(struct sock *sk) + 850 : 1888 : static inline bool mptcp_is_fully_established(struct sock *sk) 851 : : { - 852 [ + - ]: 1880 : return inet_sk_state_load(sk) == TCP_ESTABLISHED && - 853 [ - + - + : 1880 : READ_ONCE(mptcp_sk(sk)->fully_established); - - + ] + 852 [ + - ]: 1888 : return inet_sk_state_load(sk) == TCP_ESTABLISHED && + 853 [ - + - + : 1888 : READ_ONCE(mptcp_sk(sk)->fully_established); + - + ] 854 : : } 855 : : 856 : : void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk); @@ -996,78 +997,78 @@ 863 : : char __user *optval, int __user *option); 864 : : 865 : : u64 __mptcp_expand_seq(u64 old_seq, u64 cur_seq); - 866 : 109 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit) + 866 : 103 : static inline u64 mptcp_expand_seq(u64 old_seq, u64 cur_seq, bool use_64bit) 867 : : { - 868 [ + + + + ]: 1371182 : if (use_64bit) - [ + + + + ] + 868 [ + + + + ]: 1324146 : if (use_64bit) + [ + + + + ] 869 : : return cur_seq; 870 : : - 871 : 153977 : return __mptcp_expand_seq(old_seq, cur_seq); + 871 : 28245 : return __mptcp_expand_seq(old_seq, cur_seq); 872 : : } 873 : : void __mptcp_check_push(struct sock *sk, struct sock *ssk); 874 : : void __mptcp_data_acked(struct sock *sk); 875 : : void __mptcp_error_report(struct sock *sk); 876 : : bool mptcp_update_rcv_data_fin(struct mptcp_sock *msk, u64 data_fin_seq, bool use_64bit); - 877 : 621670 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) + 877 : 864801 : static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk) 878 : : { - 879 [ + + + + ]: 1316716 : return READ_ONCE(msk->snd_data_fin_enable) && - [ + + + + ] - 880 [ + + - + ]: 101983 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); - [ + + - + ] + 879 [ + + + + ]: 1710260 : return READ_ONCE(msk->snd_data_fin_enable) && + [ + + + + ] + 880 [ + + ]: 119658 : READ_ONCE(msk->write_seq) == READ_ONCE(msk->snd_nxt); + [ + + - + ] 881 : : } 882 : : - 883 : 1281670 : static inline u32 mptcp_notsent_lowat(const struct sock *sk) + 883 : 1801018 : static inline u32 mptcp_notsent_lowat(const struct sock *sk) 884 : : { - 885 [ - + ]: 1281670 : struct net *net = sock_net(sk); - 886 : 1281670 : u32 val; + 885 [ - + ]: 1801018 : struct net *net = sock_net(sk); + 886 : 1801018 : u32 val; 887 : : - 888 [ - + ]: 1281670 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat); - 889 [ + - ]: 1281670 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); + 888 [ - + ]: 1801018 : val = READ_ONCE(mptcp_sk(sk)->notsent_lowat); + 889 [ + - ]: 1801018 : return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat); 890 : : } 891 : : - 892 : 1004469 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake) + 892 : 1422280 : static inline bool mptcp_stream_memory_free(const struct sock *sk, int wake) 893 : : { - 894 [ - + ]: 1004469 : const struct mptcp_sock *msk = mptcp_sk(sk); - 895 : 1004469 : u32 notsent_bytes; + 894 [ - + ]: 1422280 : const struct mptcp_sock *msk = mptcp_sk(sk); + 895 : 1422280 : u32 notsent_bytes; 896 : : - 897 : 1004469 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt); - 898 [ - + ]: 1004469 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk); + 897 : 1422280 : notsent_bytes = READ_ONCE(msk->write_seq) - READ_ONCE(msk->snd_nxt); + 898 [ - + ]: 1422280 : return (notsent_bytes << wake) < mptcp_notsent_lowat(sk); 899 : : } 900 : : - 901 : 310709 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake) + 901 : 514242 : static inline bool __mptcp_stream_is_writeable(const struct sock *sk, int wake) 902 : : { - 903 [ + - + + ]: 621418 : return mptcp_stream_memory_free(sk, wake) && - 904 : 310709 : __sk_stream_is_writeable(sk, wake); + 903 [ + - + + ]: 1028484 : return mptcp_stream_memory_free(sk, wake) && + 904 : 514242 : __sk_stream_is_writeable(sk, wake); 905 : : } 906 : : - 907 : 411139 : static inline void mptcp_write_space(struct sock *sk) + 907 : 504129 : static inline void mptcp_write_space(struct sock *sk) 908 : : { 909 : : /* pairs with memory barrier in mptcp_poll */ - 910 : 411139 : smp_mb(); - 911 [ + - ]: 411139 : if (mptcp_stream_memory_free(sk, 1)) - 912 : 411139 : sk_stream_write_space(sk); - 913 : 411139 : } + 910 : 504129 : smp_mb(); + 911 [ + - ]: 504129 : if (mptcp_stream_memory_free(sk, 1)) + 912 : 504129 : sk_stream_write_space(sk); + 913 : 504129 : } 914 : : - 915 : 30328 : static inline void __mptcp_sync_sndbuf(struct sock *sk) + 915 : 31631 : static inline void __mptcp_sync_sndbuf(struct sock *sk) 916 : : { - 917 : 30328 : struct mptcp_subflow_context *subflow; - 918 : 30328 : int ssk_sndbuf, new_sndbuf; + 917 : 31631 : struct mptcp_subflow_context *subflow; + 918 : 31631 : int ssk_sndbuf, new_sndbuf; 919 : : - 920 [ + - ]: 30328 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) + 920 [ + - ]: 31631 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) 921 : : return; 922 : : - 923 [ - + ]: 30328 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]); - 924 [ - + - + : 87723 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) { - + + ] - 925 : 57395 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf); + 923 [ - + ]: 31631 : new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]); + 924 [ - + - + : 92385 : mptcp_for_each_subflow(mptcp_sk(sk), subflow) { + + + ] + 925 : 60754 : ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf); 926 : : - 927 : 57395 : subflow->cached_sndbuf = ssk_sndbuf; - 928 : 57395 : new_sndbuf += ssk_sndbuf; + 927 : 60754 : subflow->cached_sndbuf = ssk_sndbuf; + 928 : 60754 : new_sndbuf += ssk_sndbuf; 929 : : } 930 : : 931 : : /* the msk max wmem limit is <nr_subflows> * tcp wmem[2] */ - 932 : 30328 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); - 933 : 30328 : mptcp_write_space(sk); + 932 : 31631 : WRITE_ONCE(sk->sk_sndbuf, new_sndbuf); + 933 : 31631 : mptcp_write_space(sk); 934 : : } 935 : : 936 : : /* The called held both the msk socket and the subflow socket locks, @@ -1075,11 +1076,11 @@ 938 : : */ 939 : 48 : static inline void __mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) 940 : : { - 941 : 2742 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 941 : 2744 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 942 : : - 943 [ + + ]: 2742 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf) - [ + - + - ] - 944 : 2710 : __mptcp_sync_sndbuf(sk); + 943 [ + + ]: 2744 : if (READ_ONCE(ssk->sk_sndbuf) != subflow->cached_sndbuf) + [ + - + - ] + 944 : 2712 : __mptcp_sync_sndbuf(sk); 945 : : } 946 : : 947 : : /* the caller held only the subflow socket lock, either in process or @@ -1087,16 +1088,16 @@ 949 : : * so we can't acquire such lock here: let the delegate action acquires 950 : : * the needed locks in suitable order. 951 : : */ - 952 : 360700 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) + 952 : 436451 : static inline void mptcp_propagate_sndbuf(struct sock *sk, struct sock *ssk) 953 : : { - 954 : 360700 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 954 : 436451 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 955 : : - 956 [ + + ]: 360700 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf)) + 956 [ + + ]: 436451 : if (likely(READ_ONCE(ssk->sk_sndbuf) == subflow->cached_sndbuf)) 957 : : return; 958 : : - 959 : 81348 : local_bh_disable(); - 960 : 81348 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF); - 961 : 81348 : local_bh_enable(); + 959 : 64545 : local_bh_disable(); + 960 : 64545 : mptcp_subflow_delegate(subflow, MPTCP_DELEGATE_SNDBUF); + 961 : 64545 : local_bh_enable(); 962 : : } 963 : : 964 : : void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags); @@ -1106,7 +1107,7 @@ 968 : : void __init mptcp_token_init(void); 969 : 30 : static inline void mptcp_token_init_request(struct request_sock *req) 970 : : { - 971 : 1742 : mptcp_subflow_rsk(req)->token_node.pprev = NULL; + 971 : 1744 : mptcp_subflow_rsk(req)->token_node.pprev = NULL; 972 : : } 973 : : 974 : : int mptcp_token_new_request(struct request_sock *req); @@ -1203,10 +1204,10 @@ 1065 : : int mptcp_nl_fill_addr(struct sk_buff *skb, 1066 : : struct mptcp_pm_addr_entry *entry); 1067 : : - 1068 : 135 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) + 1068 : 131 : static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) 1069 : : { - 1070 [ + + + - ]: 1298510 : return READ_ONCE(msk->pm.addr_signal) & - [ + + ] + 1070 [ + + + - ]: 1682410 : return READ_ONCE(msk->pm.addr_signal) & + [ + + ] 1071 : : (BIT(MPTCP_ADD_ADDR_SIGNAL) | BIT(MPTCP_ADD_ADDR_ECHO)); 1072 : : } 1073 : : @@ -1217,41 +1218,41 @@ 1078 : : 1079 : 6 : static inline bool mptcp_pm_should_add_signal_echo(struct mptcp_sock *msk) 1080 : : { - 1081 [ + + ]: 754 : 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 : 123 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) + 1084 : 119 : static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk) 1085 : : { - 1086 [ + + ]: 1296237 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL); + 1086 [ + + ]: 1680127 : return READ_ONCE(msk->pm.addr_signal) & BIT(MPTCP_RM_ADDR_SIGNAL); 1087 : : } 1088 : : 1089 : 6 : static inline bool mptcp_pm_is_userspace(const struct mptcp_sock *msk) 1090 : : { - 1091 [ - + + + ]: 7012 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE; - [ + + + + - + + + + + - + ][ + + ] + 1091 [ - + + + ]: 6999 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_USERSPACE; + [ + + + + + + + + + + + + ][ + + ] 1092 : : } 1093 : : - 1094 : 17 : static inline bool mptcp_pm_is_kernel(const struct mptcp_sock *msk) + 1094 : 16 : static inline bool mptcp_pm_is_kernel(const struct mptcp_sock *msk) 1095 : : { - 1096 [ + + ]: 1103 : return READ_ONCE(msk->pm.pm_type) == MPTCP_PM_TYPE_KERNEL; + 1096 [ + + ]: 1068 : 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 : 1508 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; + 1101 : 1512 : u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; 1102 : : - 1103 [ + + ]: 1508 : if (family == AF_INET6) - 1104 : 338 : len = TCPOLEN_MPTCP_ADD_ADDR6_BASE; - 1105 [ + + ]: 1508 : 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 [ + + ]: 1508 : if (port) + 1108 [ + + ]: 1512 : if (port) 1109 : 136 : len += TCPOLEN_MPTCP_PORT_LEN + TCPOLEN_MPTCP_PORT_ALIGN; 1110 : : - 1111 [ - + ]: 1508 : return len; + 1111 [ - + ]: 1512 : return len; 1112 : : } 1113 : : 1114 : 0 : static inline int mptcp_rm_addr_len(const struct mptcp_rm_list *rm_list) @@ -1301,47 +1302,47 @@ 1158 : : unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk); 1159 : : 1160 : : /* called under PM lock */ - 1161 : 316 : static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk) + 1161 : 313 : static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk) 1162 : : { - 1163 [ + - ]: 316 : if (--msk->pm.subflows < mptcp_pm_get_subflows_max(msk)) - 1164 : 316 : WRITE_ONCE(msk->pm.accept_subflow, true); - 1165 : 316 : } + 1163 [ + - ]: 313 : if (--msk->pm.subflows < mptcp_pm_get_subflows_max(msk)) + 1164 : 313 : WRITE_ONCE(msk->pm.accept_subflow, true); + 1165 : 313 : } 1166 : : - 1167 : 37 : static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk) + 1167 : 39 : static inline void mptcp_pm_close_subflow(struct mptcp_sock *msk) 1168 : : { - 1169 : 37 : spin_lock_bh(&msk->pm.lock); - 1170 : 37 : __mptcp_pm_close_subflow(msk); - 1171 : 37 : spin_unlock_bh(&msk->pm.lock); - 1172 : 37 : } + 1169 : 39 : spin_lock_bh(&msk->pm.lock); + 1170 : 39 : __mptcp_pm_close_subflow(msk); + 1171 : 39 : spin_unlock_bh(&msk->pm.lock); + 1172 : 39 : } 1173 : : 1174 : : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk); 1175 : : 1176 : 0 : static inline struct mptcp_ext *mptcp_get_ext(const struct sk_buff *skb) 1177 : : { - 1178 [ + + + - : 1652130 : return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP); - - + - + + + 1178 [ + - + + : 1844126 : return (struct mptcp_ext *)skb_ext_find(skb, SKB_EXT_MPTCP); + + + + + + + + - - - - ][ + - + - - + - - - - - - ][ + - - + + + + + - + ] + - ][ + + + + - - - - - + - - ][ + - + + - + - - + - ] 1179 : : } 1180 : : 1181 : : void mptcp_diag_subflow_init(struct tcp_ulp_ops *ops); 1182 : : - 1183 : 4647776 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk) + 1183 : 5061204 : static inline bool __mptcp_check_fallback(const struct mptcp_sock *msk) 1184 : : { - 1185 [ - + - - : 4647776 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags); + 1185 [ - + - - : 5061204 : return test_bit(MPTCP_FALLBACK_DONE, &msk->flags); - - ] 1186 : : } 1187 : : - 1188 : 539883 : static inline bool mptcp_check_fallback(const struct sock *sk) + 1188 : 506148 : static inline bool mptcp_check_fallback(const struct sock *sk) 1189 : : { - 1190 : 539883 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1191 [ - + ]: 539883 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 1190 : 506148 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1191 [ - + ]: 506148 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); 1192 : : - 1193 : 539883 : return __mptcp_check_fallback(msk); + 1193 : 506148 : return __mptcp_check_fallback(msk); 1194 : : } 1195 : : 1196 : 106 : static inline void __mptcp_do_fallback(struct mptcp_sock *msk) @@ -1353,12 +1354,12 @@ 1202 : 106 : set_bit(MPTCP_FALLBACK_DONE, &msk->flags); 1203 : : } 1204 : : - 1205 : 1013 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) + 1205 : 978 : static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *msk) 1206 : : { - 1207 : 1013 : struct sock *ssk = READ_ONCE(msk->first); + 1207 : 978 : struct sock *ssk = READ_ONCE(msk->first); 1208 : : - 1209 [ + - + + : 2026 : return ssk && ((1 << inet_sk_state_load(ssk)) & - + + ] + 1209 [ + - + + : 1956 : return ssk && ((1 << inet_sk_state_load(ssk)) & + + + ] 1210 : : (TCPF_ESTABLISHED | TCPF_SYN_SENT | 1211 : : TCPF_SYN_RECV | TCPF_LISTEN)); 1212 : : } @@ -1395,12 +1396,12 @@ 1242 : 24 : __mptcp_do_fallback(msk); 1243 : 24 : } 1244 : : - 1245 : 39332 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb) + 1245 : 53016 : static inline bool mptcp_check_infinite_map(struct sk_buff *skb) 1246 : : { - 1247 : 39332 : struct mptcp_ext *mpext; + 1247 : 53016 : struct mptcp_ext *mpext; 1248 : : - 1249 [ + + ]: 39332 : mpext = skb ? mptcp_get_ext(skb) : NULL; - 1250 [ + + + + ]: 8134 : if (mpext && mpext->infinite_map) + 1249 [ + + ]: 53016 : mpext = skb ? mptcp_get_ext(skb) : NULL; + 1250 [ + + + + ]: 9051 : if (mpext && mpext->infinite_map) 1251 : 1 : return true; 1252 : : 1253 : : return false; @@ -1408,18 +1409,18 @@ 1255 : : 1256 : 54 : static inline bool is_active_ssk(struct mptcp_subflow_context *subflow) 1257 : : { - 1258 : 3234 : return (subflow->request_mptcp || subflow->request_join); + 1258 : 3235 : return (subflow->request_mptcp || subflow->request_join); 1259 : : } 1260 : : - 1261 : 4752 : static inline bool subflow_simultaneous_connect(struct sock *sk) + 1261 : 4700 : static inline bool subflow_simultaneous_connect(struct sock *sk) 1262 : : { - 1263 : 4752 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1263 : 4700 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1264 : : - 1265 : 2376 : return (1 << sk->sk_state) & - 1266 [ + + ]: 3234 : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && - 1267 [ + + + + : 4752 : is_active_ssk(subflow) && + 1265 : 2338 : return (1 << sk->sk_state) & + 1266 [ + + ]: 3235 : (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING) && + 1267 [ + + + + : 4700 : is_active_ssk(subflow) && + + ] - 1268 [ + - ]: 1641 : !subflow->conn_finished; + 1268 [ + - ]: 1640 : !subflow->conn_finished; 1269 : : } 1270 : : 1271 : : #ifdef CONFIG_SYN_COOKIES diff --git a/html/lcov/export-net/mptcp/sched.c.func-c.html b/html/lcov/export-net/mptcp/sched.c.func-c.html index bfa4a433..873f8633 100644 --- a/html/lcov/export-net/mptcp/sched.c.func-c.html +++ b/html/lcov/export-net/mptcp/sched.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 90.9 % @@ -130,28 +130,28 @@ mptcp_sched_get_retrans - 4472 + 6695 mptcp_subflow_set_scheduled - 297195 + 363366 mptcp_sched_default_get_subflow - 347919 + 407366 mptcp_sched_get_send - 370806 + 443588 diff --git a/html/lcov/export-net/mptcp/sched.c.func.html b/html/lcov/export-net/mptcp/sched.c.func.html index effa9bf2..16b0ae85 100644 --- a/html/lcov/export-net/mptcp/sched.c.func.html +++ b/html/lcov/export-net/mptcp/sched.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 90.9 % @@ -109,7 +109,7 @@ mptcp_sched_default_get_subflow - 347919 + 407366 @@ -123,14 +123,14 @@ mptcp_sched_get_retrans - 4472 + 6695 mptcp_sched_get_send - 370806 + 443588 @@ -144,7 +144,7 @@ mptcp_subflow_set_scheduled - 297195 + 363366 diff --git a/html/lcov/export-net/mptcp/sched.c.gcov.html b/html/lcov/export-net/mptcp/sched.c.gcov.html index 0384a765..ac51a6e3 100644 --- a/html/lcov/export-net/mptcp/sched.c.gcov.html +++ b/html/lcov/export-net/mptcp/sched.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 90.9 % @@ -94,18 +94,18 @@ 16 : : static DEFINE_SPINLOCK(mptcp_sched_list_lock); 17 : : static LIST_HEAD(mptcp_sched_list); 18 : : - 19 : 347919 : static int mptcp_sched_default_get_subflow(struct mptcp_sock *msk, + 19 : 407366 : static int mptcp_sched_default_get_subflow(struct mptcp_sock *msk, 20 : : struct mptcp_sched_data *data) 21 : : { - 22 : 347919 : struct sock *ssk; + 22 : 407366 : struct sock *ssk; 23 : : - 24 [ + + + + ]: 347919 : ssk = data->reinject ? mptcp_subflow_get_retrans(msk) : - 25 : 346420 : mptcp_subflow_get_send(msk); - 26 [ + + ]: 347919 : if (!ssk) + 24 [ + + + + ]: 407366 : ssk = data->reinject ? mptcp_subflow_get_retrans(msk) : + 25 : 405889 : mptcp_subflow_get_send(msk); + 26 [ + + ]: 407366 : if (!ssk) 27 : : return -EINVAL; 28 : : - 29 : 278673 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true); - 30 : 278673 : return 0; + 29 : 331585 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(ssk), true); + 30 : 331585 : return 0; 31 : : } 32 : : 33 : : static struct mptcp_sched_ops mptcp_sched_default = { @@ -217,60 +217,60 @@ 135 : 3488 : bpf_module_put(sched, sched->owner); 136 : : } 137 : : - 138 : 297183 : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, + 138 : 363354 : void mptcp_subflow_set_scheduled(struct mptcp_subflow_context *subflow, 139 : : bool scheduled) 140 : : { - 141 : 278660 : WRITE_ONCE(subflow->scheduled, scheduled); - 142 : 297195 : } + 141 : 331572 : WRITE_ONCE(subflow->scheduled, scheduled); + 142 : 363366 : } 143 : : - 144 : 370806 : int mptcp_sched_get_send(struct mptcp_sock *msk) + 144 : 443588 : int mptcp_sched_get_send(struct mptcp_sock *msk) 145 : : { - 146 : 370806 : struct mptcp_subflow_context *subflow; - 147 : 370806 : struct mptcp_sched_data data; + 146 : 443588 : struct mptcp_subflow_context *subflow; + 147 : 443588 : struct mptcp_sched_data data; 148 : : - 149 : 370806 : msk_owned_by_me(msk); + 149 : 443588 : msk_owned_by_me(msk); 150 : : 151 : : /* the following check is moved out of mptcp_subflow_get_send */ - 152 [ + + ]: 370806 : if (__mptcp_check_fallback(msk)) { - 153 [ + - + - ]: 47376 : if (msk->first && - 154 [ + + ]: 37450 : __tcp_can_send(msk->first) && - 155 [ # # ]: 23688 : sk_stream_memory_free(msk->first)) { - 156 : 19119 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(msk->first), true); - 157 : 19119 : return 0; + 152 [ + + ]: 443588 : if (__mptcp_check_fallback(msk)) { + 153 [ + - + - ]: 73134 : if (msk->first && + 154 [ + + ]: 46725 : __tcp_can_send(msk->first) && + 155 [ # # ]: 36567 : sk_stream_memory_free(msk->first)) { + 156 : 32238 : mptcp_subflow_set_scheduled(mptcp_subflow_ctx(msk->first), true); + 157 : 32238 : return 0; 158 : : } - 159 : 4569 : return -EINVAL; + 159 : 4329 : return -EINVAL; 160 : : } 161 : : - 162 [ + + ]: 984949 : mptcp_for_each_subflow(msk, subflow) { - 163 [ + + + + ]: 638529 : if (READ_ONCE(subflow->scheduled)) + 162 [ + + ]: 1188444 : mptcp_for_each_subflow(msk, subflow) { + 163 [ + + + + ]: 782555 : if (READ_ONCE(subflow->scheduled)) 164 : : return 0; 165 : : } 166 : : - 167 : 346420 : data.reinject = false; - 168 [ - + - - ]: 346420 : if (msk->sched == &mptcp_sched_default || !msk->sched) - 169 : 346420 : return mptcp_sched_default_get_subflow(msk, &data); + 167 : 405889 : data.reinject = false; + 168 [ - + - - ]: 405889 : if (msk->sched == &mptcp_sched_default || !msk->sched) + 169 : 405889 : return mptcp_sched_default_get_subflow(msk, &data); 170 : 0 : return msk->sched->get_subflow(msk, &data); 171 : : } 172 : : - 173 : 4472 : int mptcp_sched_get_retrans(struct mptcp_sock *msk) + 173 : 6695 : int mptcp_sched_get_retrans(struct mptcp_sock *msk) 174 : : { - 175 : 4472 : struct mptcp_subflow_context *subflow; - 176 : 4472 : struct mptcp_sched_data data; + 175 : 6695 : struct mptcp_subflow_context *subflow; + 176 : 6695 : struct mptcp_sched_data data; 177 : : - 178 : 4472 : msk_owned_by_me(msk); + 178 : 6695 : msk_owned_by_me(msk); 179 : : 180 : : /* the following check is moved out of mptcp_subflow_get_retrans */ - 181 [ + + ]: 4472 : if (__mptcp_check_fallback(msk)) + 181 [ + + ]: 6695 : if (__mptcp_check_fallback(msk)) 182 : : return -EINVAL; 183 : : - 184 [ + + ]: 4378 : mptcp_for_each_subflow(msk, subflow) { - 185 [ + + + + ]: 2879 : if (READ_ONCE(subflow->scheduled)) + 184 [ + + ]: 4538 : mptcp_for_each_subflow(msk, subflow) { + 185 [ + + + + ]: 3061 : if (READ_ONCE(subflow->scheduled)) 186 : : return 0; 187 : : } 188 : : - 189 : 1499 : data.reinject = true; - 190 [ + + + - ]: 1499 : if (msk->sched == &mptcp_sched_default || !msk->sched) - 191 : 1499 : return mptcp_sched_default_get_subflow(msk, &data); + 189 : 1477 : data.reinject = true; + 190 [ + + + - ]: 1477 : if (msk->sched == &mptcp_sched_default || !msk->sched) + 191 : 1477 : return mptcp_sched_default_get_subflow(msk, &data); 192 : 0 : return msk->sched->get_subflow(msk, &data); 193 : : } diff --git a/html/lcov/export-net/mptcp/sockopt.c.func-c.html b/html/lcov/export-net/mptcp/sockopt.c.func-c.html index 0f2a2d03..506f1508 100644 --- a/html/lcov/export-net/mptcp/sockopt.c.func-c.html +++ b/html/lcov/export-net/mptcp/sockopt.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 90.2 % @@ -200,7 +200,7 @@ mptcp_getsockopt_info - 33 + 32 @@ -221,7 +221,7 @@ sync_socket_options - 44 + 45 @@ -298,14 +298,14 @@ mptcp_getsockopt_sol_mptcp - 313 + 312 mptcp_diag_fill_info - 1013 + 978 @@ -319,7 +319,7 @@ mptcp_sockopt_sync_locked - 3393 + 3395 @@ -340,14 +340,14 @@ mptcp_getsockopt - 6961 + 6960 __mptcp_tcp_fallback - 7185 + 7184 diff --git a/html/lcov/export-net/mptcp/sockopt.c.func.html b/html/lcov/export-net/mptcp/sockopt.c.func.html index 2d45d7aa..6fedfc4c 100644 --- a/html/lcov/export-net/mptcp/sockopt.c.func.html +++ b/html/lcov/export-net/mptcp/sockopt.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 90.2 % @@ -102,14 +102,14 @@ __mptcp_tcp_fallback - 7185 + 7184 mptcp_diag_fill_info - 1013 + 978 @@ -144,7 +144,7 @@ mptcp_getsockopt - 6961 + 6960 @@ -165,14 +165,14 @@ mptcp_getsockopt_info - 33 + 32 mptcp_getsockopt_sol_mptcp - 313 + 312 @@ -326,7 +326,7 @@ mptcp_sockopt_sync_locked - 3393 + 3395 @@ -361,7 +361,7 @@ sync_socket_options - 44 + 45 diff --git a/html/lcov/export-net/mptcp/sockopt.c.gcov.html b/html/lcov/export-net/mptcp/sockopt.c.gcov.html index 50163986..1b0de8a9 100644 --- a/html/lcov/export-net/mptcp/sockopt.c.gcov.html +++ b/html/lcov/export-net/mptcp/sockopt.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 90.2 % @@ -95,11 +95,11 @@ 17 : : #define MIN_INFO_OPTLEN_SIZE 16 18 : : #define MIN_FULL_INFO_OPTLEN_SIZE 40 19 : : - 20 : 7185 : static struct sock *__mptcp_tcp_fallback(struct mptcp_sock *msk) + 20 : 7184 : static struct sock *__mptcp_tcp_fallback(struct mptcp_sock *msk) 21 : : { - 22 : 7185 : msk_owned_by_me(msk); + 22 : 7184 : msk_owned_by_me(msk); 23 : : - 24 [ + + ]: 7185 : if (likely(!__mptcp_check_fallback(msk))) + 24 [ + + ]: 7184 : 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 [ + + ]: 22 : mptcp_for_each_subflow(msk, subflow) { - 161 : 14 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); - 162 : 14 : bool slow = lock_sock_fast(ssk); + 160 [ + + ]: 25 : mptcp_for_each_subflow(msk, subflow) { + 161 : 17 : struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + 162 : 17 : bool slow = lock_sock_fast(ssk); 163 : : - 164 : 14 : sock_set_timestamp(sk, optname, !!val); - 165 : 14 : unlock_sock_fast(ssk, slow); + 164 : 17 : sock_set_timestamp(sk, optname, !!val); + 165 : 17 : unlock_sock_fast(ssk, slow); 166 : : } 167 : : 168 : 8 : release_sock(sk); @@ -1015,85 +1015,85 @@ 932 : 6354 : return ret; 933 : : } 934 : : - 935 : 1013 : void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) + 935 : 978 : void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) 936 : : { - 937 : 1013 : struct sock *sk = (struct sock *)msk; - 938 : 1013 : u32 flags = 0; - 939 : 1013 : bool slow; - 940 : 1013 : u32 now; + 937 : 978 : struct sock *sk = (struct sock *)msk; + 938 : 978 : u32 flags = 0; + 939 : 978 : bool slow; + 940 : 978 : u32 now; 941 : : - 942 : 1013 : memset(info, 0, sizeof(*info)); + 942 : 978 : memset(info, 0, sizeof(*info)); 943 : : - 944 : 1013 : info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); - 945 : 1013 : info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); - 946 : 1013 : info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); - 947 : 1013 : info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); + 944 : 978 : info->mptcpi_subflows = READ_ONCE(msk->pm.subflows); + 945 : 978 : info->mptcpi_add_addr_signal = READ_ONCE(msk->pm.add_addr_signaled); + 946 : 978 : info->mptcpi_add_addr_accepted = READ_ONCE(msk->pm.add_addr_accepted); + 947 : 978 : info->mptcpi_local_addr_used = READ_ONCE(msk->pm.local_addr_used); 948 : : - 949 [ + - ]: 1013 : if (inet_sk_state_load(sk) == TCP_LISTEN) + 949 [ + - ]: 978 : if (inet_sk_state_load(sk) == TCP_LISTEN) 950 : : return; 951 : : 952 : : /* The following limits only make sense for the in-kernel PM */ - 953 [ + + ]: 1013 : if (mptcp_pm_is_kernel(msk)) { - 954 : 1922 : info->mptcpi_subflows_max = - 955 : 961 : mptcp_pm_get_subflows_max(msk); - 956 : 1922 : info->mptcpi_add_addr_signal_max = - 957 : 961 : mptcp_pm_get_add_addr_signal_max(msk); - 958 : 1922 : info->mptcpi_add_addr_accepted_max = - 959 : 961 : mptcp_pm_get_add_addr_accept_max(msk); - 960 : 961 : info->mptcpi_local_addr_max = - 961 : 961 : mptcp_pm_get_local_addr_max(msk); + 953 [ + + ]: 978 : if (mptcp_pm_is_kernel(msk)) { + 954 : 1852 : info->mptcpi_subflows_max = + 955 : 926 : mptcp_pm_get_subflows_max(msk); + 956 : 1852 : info->mptcpi_add_addr_signal_max = + 957 : 926 : mptcp_pm_get_add_addr_signal_max(msk); + 958 : 1852 : info->mptcpi_add_addr_accepted_max = + 959 : 926 : mptcp_pm_get_add_addr_accept_max(msk); + 960 : 926 : info->mptcpi_local_addr_max = + 961 : 926 : mptcp_pm_get_local_addr_max(msk); 962 : : } 963 : : - 964 [ + + ]: 1013 : if (__mptcp_check_fallback(msk)) + 964 [ + + ]: 978 : if (__mptcp_check_fallback(msk)) 965 : 2 : flags |= MPTCP_INFO_FLAG_FALLBACK; - 966 [ + + + + ]: 1013 : if (READ_ONCE(msk->can_ack)) - 967 : 1011 : flags |= MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED; - 968 : 1013 : info->mptcpi_flags = flags; + 966 [ + + + + ]: 978 : if (READ_ONCE(msk->can_ack)) + 967 : 976 : flags |= MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED; + 968 : 978 : info->mptcpi_flags = flags; 969 : : - 970 : 1013 : slow = lock_sock_fast(sk); - 971 [ - + ]: 1013 : info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled); - 972 : 1013 : info->mptcpi_token = msk->token; - 973 : 1013 : info->mptcpi_write_seq = msk->write_seq; - 974 : 1013 : info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits; - 975 : 1013 : info->mptcpi_bytes_sent = msk->bytes_sent; - 976 : 1013 : info->mptcpi_bytes_received = msk->bytes_received; - 977 : 1013 : info->mptcpi_bytes_retrans = msk->bytes_retrans; - 978 : 2026 : info->mptcpi_subflows_total = info->mptcpi_subflows + - 979 : 1013 : __mptcp_has_initial_subflow(msk); - 980 : 1013 : now = tcp_jiffies32; - 981 : 1013 : info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); - 982 : 1013 : info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); - 983 : 1013 : unlock_sock_fast(sk, slow); + 970 : 978 : slow = lock_sock_fast(sk); + 971 [ - + ]: 978 : info->mptcpi_csum_enabled = READ_ONCE(msk->csum_enabled); + 972 : 978 : info->mptcpi_token = msk->token; + 973 : 978 : info->mptcpi_write_seq = msk->write_seq; + 974 : 978 : info->mptcpi_retransmits = inet_csk(sk)->icsk_retransmits; + 975 : 978 : info->mptcpi_bytes_sent = msk->bytes_sent; + 976 : 978 : info->mptcpi_bytes_received = msk->bytes_received; + 977 : 978 : info->mptcpi_bytes_retrans = msk->bytes_retrans; + 978 : 1956 : info->mptcpi_subflows_total = info->mptcpi_subflows + + 979 : 978 : __mptcp_has_initial_subflow(msk); + 980 : 978 : now = tcp_jiffies32; + 981 : 978 : info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); + 982 : 978 : info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); + 983 : 978 : unlock_sock_fast(sk, slow); 984 : : - 985 : 1013 : mptcp_data_lock(sk); - 986 : 1013 : info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); - 987 : 1013 : info->mptcpi_snd_una = msk->snd_una; - 988 : 1013 : info->mptcpi_rcv_nxt = msk->ack_seq; - 989 : 1013 : info->mptcpi_bytes_acked = msk->bytes_acked; - 990 : 1013 : mptcp_data_unlock(sk); + 985 : 978 : mptcp_data_lock(sk); + 986 : 978 : info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); + 987 : 978 : info->mptcpi_snd_una = msk->snd_una; + 988 : 978 : info->mptcpi_rcv_nxt = msk->ack_seq; + 989 : 978 : info->mptcpi_bytes_acked = msk->bytes_acked; + 990 : 978 : mptcp_data_unlock(sk); 991 : : } 992 : : EXPORT_SYMBOL_GPL(mptcp_diag_fill_info); 993 : : - 994 : 33 : static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen) + 994 : 32 : static int mptcp_getsockopt_info(struct mptcp_sock *msk, char __user *optval, int __user *optlen) 995 : : { - 996 : 33 : struct mptcp_info m_info; - 997 : 33 : int len; + 996 : 32 : struct mptcp_info m_info; + 997 : 32 : int len; 998 : : - 999 [ - + ]: 33 : if (get_user(len, optlen)) + 999 [ - + ]: 32 : if (get_user(len, optlen)) 1000 : : return -EFAULT; 1001 : : 1002 : : /* When used only to check if a fallback to TCP happened. */ - 1003 [ - + ]: 33 : if (len == 0) + 1003 [ - + ]: 32 : if (len == 0) 1004 : : return 0; 1005 : : - 1006 : 33 : len = min_t(unsigned int, len, sizeof(struct mptcp_info)); + 1006 : 32 : len = min_t(unsigned int, len, sizeof(struct mptcp_info)); 1007 : : - 1008 : 33 : mptcp_diag_fill_info(msk, &m_info); + 1008 : 32 : mptcp_diag_fill_info(msk, &m_info); 1009 : : - 1010 [ - + ]: 33 : if (put_user(len, optlen)) + 1010 [ - + ]: 32 : if (put_user(len, optlen)) 1011 : : return -EFAULT; 1012 : : - 1013 [ - + ]: 33 : if (copy_to_user(optval, &m_info, len)) + 1013 [ - + ]: 32 : 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 : 313 : static int mptcp_getsockopt_sol_mptcp(struct mptcp_sock *msk, int optname, + 1433 : 312 : static int mptcp_getsockopt_sol_mptcp(struct mptcp_sock *msk, int optname, 1434 : : char __user *optval, int __user *optlen) 1435 : : { - 1436 [ + + + + : 313 : switch (optname) { + 1436 [ + + + + : 312 : switch (optname) { - ] - 1437 : 33 : case MPTCP_INFO: - 1438 : 33 : return mptcp_getsockopt_info(msk, optval, optlen); + 1437 : 32 : case MPTCP_INFO: + 1438 : 32 : 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 : 6961 : int mptcp_getsockopt(struct sock *sk, int level, int optname, + 1450 : 6960 : int mptcp_getsockopt(struct sock *sk, int level, int optname, 1451 : : char __user *optval, int __user *option) 1452 : : { - 1453 [ - + ]: 6961 : struct mptcp_sock *msk = mptcp_sk(sk); - 1454 : 6961 : struct sock *ssk; + 1453 [ - + ]: 6960 : struct mptcp_sock *msk = mptcp_sk(sk); + 1454 : 6960 : struct sock *ssk; 1455 : : - 1456 [ - + ]: 6961 : pr_debug("msk=%p\n", msk); + 1456 [ - + ]: 6960 : 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 : 6961 : lock_sock(sk); - 1465 : 6961 : ssk = __mptcp_tcp_fallback(msk); - 1466 : 6961 : release_sock(sk); - 1467 [ + + ]: 6961 : if (ssk) + 1464 : 6960 : lock_sock(sk); + 1465 : 6960 : ssk = __mptcp_tcp_fallback(msk); + 1466 : 6960 : release_sock(sk); + 1467 [ + + ]: 6960 : if (ssk) 1468 : 120 : return tcp_getsockopt(ssk, level, optname, optval, option); 1469 : : - 1470 [ + + ]: 6841 : if (level == SOL_IP) + 1470 [ + + ]: 6840 : if (level == SOL_IP) 1471 : 12 : return mptcp_getsockopt_v4(msk, optname, optval, option); - 1472 [ + + ]: 6829 : if (level == SOL_TCP) + 1472 [ + + ]: 6828 : if (level == SOL_TCP) 1473 : 6516 : return mptcp_getsockopt_sol_tcp(msk, optname, optval, option); - 1474 [ + - ]: 313 : if (level == SOL_MPTCP) - 1475 : 313 : return mptcp_getsockopt_sol_mptcp(msk, optname, optval, option); + 1474 [ + - ]: 312 : if (level == SOL_MPTCP) + 1475 : 312 : return mptcp_getsockopt_sol_mptcp(msk, optname, optval, option); 1476 : : return -EOPNOTSUPP; 1477 : : } 1478 : : - 1479 : 44 : static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) + 1479 : 45 : static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) 1480 : : { - 1481 : 44 : static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK; - 1482 : 44 : struct sock *sk = (struct sock *)msk; + 1481 : 45 : static const unsigned int tx_rx_locks = SOCK_RCVBUF_LOCK | SOCK_SNDBUF_LOCK; + 1482 : 45 : struct sock *sk = (struct sock *)msk; 1483 : : - 1484 [ + - ]: 44 : if (ssk->sk_prot->keepalive) { - 1485 [ - + ]: 44 : if (sock_flag(sk, SOCK_KEEPOPEN)) + 1484 [ + - ]: 45 : if (ssk->sk_prot->keepalive) { + 1485 [ - + ]: 45 : if (sock_flag(sk, SOCK_KEEPOPEN)) 1486 : 0 : ssk->sk_prot->keepalive(ssk, 1); 1487 : : else - 1488 : 44 : ssk->sk_prot->keepalive(ssk, 0); + 1488 : 45 : ssk->sk_prot->keepalive(ssk, 0); 1489 : : } 1490 : : - 1491 : 44 : ssk->sk_priority = sk->sk_priority; - 1492 : 44 : ssk->sk_bound_dev_if = sk->sk_bound_dev_if; - 1493 : 44 : ssk->sk_incoming_cpu = sk->sk_incoming_cpu; - 1494 : 44 : ssk->sk_ipv6only = sk->sk_ipv6only; - 1495 : 44 : __ip_sock_set_tos(ssk, inet_sk(sk)->tos); + 1491 : 45 : ssk->sk_priority = sk->sk_priority; + 1492 : 45 : ssk->sk_bound_dev_if = sk->sk_bound_dev_if; + 1493 : 45 : ssk->sk_incoming_cpu = sk->sk_incoming_cpu; + 1494 : 45 : ssk->sk_ipv6only = sk->sk_ipv6only; + 1495 : 45 : __ip_sock_set_tos(ssk, inet_sk(sk)->tos); 1496 : : - 1497 [ - + ]: 44 : if (sk->sk_userlocks & tx_rx_locks) { + 1497 [ - + ]: 45 : if (sk->sk_userlocks & tx_rx_locks) { 1498 : 0 : ssk->sk_userlocks |= sk->sk_userlocks & tx_rx_locks; 1499 [ # # ]: 0 : if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) { 1500 : 0 : WRITE_ONCE(ssk->sk_sndbuf, sk->sk_sndbuf); @@ -1590,54 +1590,54 @@ 1504 : 0 : WRITE_ONCE(ssk->sk_rcvbuf, sk->sk_rcvbuf); 1505 : : } 1506 : : - 1507 [ - + ]: 44 : if (sock_flag(sk, SOCK_LINGER)) { + 1507 [ - + ]: 45 : if (sock_flag(sk, SOCK_LINGER)) { 1508 : 0 : ssk->sk_lingertime = sk->sk_lingertime; 1509 : 0 : sock_set_flag(ssk, SOCK_LINGER); 1510 : : } else { - 1511 : 44 : sock_reset_flag(ssk, SOCK_LINGER); + 1511 : 45 : sock_reset_flag(ssk, SOCK_LINGER); 1512 : : } 1513 : : - 1514 [ + + ]: 44 : if (sk->sk_mark != ssk->sk_mark) { - 1515 : 28 : ssk->sk_mark = sk->sk_mark; - 1516 : 28 : sk_dst_reset(ssk); + 1514 [ + + ]: 45 : if (sk->sk_mark != ssk->sk_mark) { + 1515 : 29 : ssk->sk_mark = sk->sk_mark; + 1516 : 29 : sk_dst_reset(ssk); 1517 : : } 1518 : : - 1519 : 44 : sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG)); + 1519 : 45 : sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG)); 1520 : : - 1521 [ + - ]: 44 : if (inet_csk(sk)->icsk_ca_ops != inet_csk(ssk)->icsk_ca_ops) - 1522 : 44 : tcp_set_congestion_control(ssk, msk->ca_name, false, true); - 1523 : 44 : __tcp_sock_set_cork(ssk, !!msk->cork); - 1524 : 44 : __tcp_sock_set_nodelay(ssk, !!msk->nodelay); - 1525 : 44 : tcp_sock_set_keepidle_locked(ssk, msk->keepalive_idle); - 1526 : 44 : tcp_sock_set_keepintvl(ssk, msk->keepalive_intvl); - 1527 : 44 : tcp_sock_set_keepcnt(ssk, msk->keepalive_cnt); + 1521 [ + - ]: 45 : if (inet_csk(sk)->icsk_ca_ops != inet_csk(ssk)->icsk_ca_ops) + 1522 : 45 : tcp_set_congestion_control(ssk, msk->ca_name, false, true); + 1523 : 45 : __tcp_sock_set_cork(ssk, !!msk->cork); + 1524 : 45 : __tcp_sock_set_nodelay(ssk, !!msk->nodelay); + 1525 : 45 : tcp_sock_set_keepidle_locked(ssk, msk->keepalive_idle); + 1526 : 45 : tcp_sock_set_keepintvl(ssk, msk->keepalive_intvl); + 1527 : 45 : tcp_sock_set_keepcnt(ssk, msk->keepalive_cnt); 1528 : : - 1529 [ - + ]: 44 : inet_assign_bit(TRANSPARENT, ssk, inet_test_bit(TRANSPARENT, sk)); - 1530 [ - + ]: 44 : inet_assign_bit(FREEBIND, ssk, inet_test_bit(FREEBIND, sk)); - 1531 [ - + ]: 44 : inet_assign_bit(BIND_ADDRESS_NO_PORT, ssk, inet_test_bit(BIND_ADDRESS_NO_PORT, sk)); - 1532 : 44 : WRITE_ONCE(inet_sk(ssk)->local_port_range, READ_ONCE(inet_sk(sk)->local_port_range)); - 1533 : 44 : } + 1529 [ - + ]: 45 : inet_assign_bit(TRANSPARENT, ssk, inet_test_bit(TRANSPARENT, sk)); + 1530 [ - + ]: 45 : inet_assign_bit(FREEBIND, ssk, inet_test_bit(FREEBIND, sk)); + 1531 [ - + ]: 45 : inet_assign_bit(BIND_ADDRESS_NO_PORT, ssk, inet_test_bit(BIND_ADDRESS_NO_PORT, sk)); + 1532 : 45 : WRITE_ONCE(inet_sk(ssk)->local_port_range, READ_ONCE(inet_sk(sk)->local_port_range)); + 1533 : 45 : } 1534 : : - 1535 : 3393 : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) + 1535 : 3395 : void mptcp_sockopt_sync_locked(struct mptcp_sock *msk, struct sock *ssk) 1536 : : { - 1537 [ - + ]: 3393 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1537 [ - + ]: 3395 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); 1538 : : - 1539 : 3393 : msk_owned_by_me(msk); + 1539 : 3395 : msk_owned_by_me(msk); 1540 : : - 1541 : 3393 : ssk->sk_rcvlowat = 0; + 1541 : 3395 : 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 [ - + ]: 3393 : tcp_sk(ssk)->notsent_lowat = UINT_MAX; + 1547 [ - + ]: 3395 : tcp_sk(ssk)->notsent_lowat = UINT_MAX; 1548 : : - 1549 [ + + ]: 3393 : if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { - 1550 : 44 : sync_socket_options(msk, ssk); + 1549 [ + + ]: 3395 : if (READ_ONCE(subflow->setsockopt_seq) != msk->setsockopt_seq) { + 1550 : 45 : sync_socket_options(msk, ssk); 1551 : : - 1552 : 44 : subflow->setsockopt_seq = msk->setsockopt_seq; + 1552 : 45 : subflow->setsockopt_seq = msk->setsockopt_seq; 1553 : : } - 1554 : 3393 : } + 1554 : 3395 : } 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-net/mptcp/subflow.c.func-c.html b/html/lcov/export-net/mptcp/subflow.c.func-c.html index 5ae56c29..eb481771 100644 --- a/html/lcov/export-net/mptcp/subflow.c.func-c.html +++ b/html/lcov/export-net/mptcp/subflow.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.5 % @@ -186,63 +186,63 @@ subflow_v6_route_req - 301 + 302 subflow_v6_send_synack - 307 + 306 subflow_v6_req_destructor - 309 + 310 subflow_thmac_valid - 432 + 434 subflow_hmac_valid - 458 + 460 subflow_req_create_thmac - 460 + 462 subflow_token_join_request - 466 + 468 mptcp_can_accept_new_subflow - 480 + 482 __mptcp_subflow_connect - 518 + 520 @@ -256,14 +256,14 @@ subflow_v6_conn_request - 937 + 938 subflow_set_local_id - 973 + 975 @@ -294,60 +294,53 @@ 1208 - - - mptcp_subflow_discard_data - - 1322 - - subflow_v4_send_synack - 1379 + 1380 subflow_v4_conn_request - 1387 + 1388 subflow_v4_route_req - 1387 + 1388 subflow_v4_req_destructor - 1427 + 1428 subflow_v6_rebuild_header - 1542 + 1543 subflow_syn_recv_sock - 1672 + 1674 subflow_ulp_clone - 1672 + 1674 @@ -361,42 +354,49 @@ subflow_check_req - 1688 + 1690 subflow_init_req - 1736 + 1738 subflow_req_destructor - 1736 + 1738 + + + + + subflow_error_report + + 1774 subflow_generate_hmac - 1782 + 1790 - subflow_error_report + mptcp_subflow_discard_data - 1843 + 2235 __mptcp_subflow_fully_established - 2560 + 2562 @@ -410,7 +410,7 @@ mptcp_subflow_create_socket - 2952 + 2954 @@ -424,126 +424,126 @@ subflow_set_remote_key - 3642 + 3644 subflow_finish_connect - 4341 + 4387 subflow_ulp_release - 4385 + 4387 subflow_create_ctx - 4539 + 4541 __subflow_state_change - 4752 + 4700 subflow_state_change - 4752 + 4700 subflow_rebuild_header - 5519 + 5639 subflow_chk_local_id - 7061 + 7182 validate_mapping - 116255 + 148209 tcp_release_cb_override - 179298 + 279918 subflow_write_space - 360268 + 436017 validate_data_csum - 534615 + 500508 subflow_data_ready - 540986 + 506955 subflow_sched_work_if_closed - 548657 + 510656 get_mapping_status - 1081407 + 1009751 mptcp_subflow_data_available - 1081446 + 1015204 subflow_check_data_avail - 1081446 + 1015204 mptcp_space - 1107975 + 1234494 diff --git a/html/lcov/export-net/mptcp/subflow.c.func.html b/html/lcov/export-net/mptcp/subflow.c.func.html index 6838ef70..87c8e930 100644 --- a/html/lcov/export-net/mptcp/subflow.c.func.html +++ b/html/lcov/export-net/mptcp/subflow.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.5 % @@ -81,14 +81,14 @@ __mptcp_subflow_connect - 518 + 520 __mptcp_subflow_fully_established - 2560 + 2562 @@ -102,7 +102,7 @@ __subflow_state_change - 4752 + 4700 @@ -116,7 +116,7 @@ get_mapping_status - 1081407 + 1009751 @@ -130,7 +130,7 @@ mptcp_can_accept_new_subflow - 480 + 482 @@ -158,28 +158,28 @@ mptcp_space - 1107975 + 1234494 mptcp_subflow_create_socket - 2952 + 2954 mptcp_subflow_data_available - 1081446 + 1015204 mptcp_subflow_discard_data - 1322 + 2235 @@ -263,70 +263,70 @@ subflow_check_data_avail - 1081446 + 1015204 subflow_check_req - 1688 + 1690 subflow_chk_local_id - 7061 + 7182 subflow_create_ctx - 4539 + 4541 subflow_data_ready - 540986 + 506955 subflow_error_report - 1843 + 1774 subflow_finish_connect - 4341 + 4387 subflow_generate_hmac - 1782 + 1790 subflow_hmac_valid - 458 + 460 subflow_init_req - 1736 + 1738 @@ -347,21 +347,21 @@ subflow_rebuild_header - 5519 + 5639 subflow_req_create_thmac - 460 + 462 subflow_req_destructor - 1736 + 1738 @@ -375,56 +375,56 @@ subflow_sched_work_if_closed - 548657 + 510656 subflow_set_local_id - 973 + 975 subflow_set_remote_key - 3642 + 3644 subflow_state_change - 4752 + 4700 subflow_syn_recv_sock - 1672 + 1674 subflow_thmac_valid - 432 + 434 subflow_token_join_request - 466 + 468 subflow_ulp_clone - 1672 + 1674 @@ -445,77 +445,77 @@ subflow_ulp_release - 4385 + 4387 subflow_v4_conn_request - 1387 + 1388 subflow_v4_req_destructor - 1427 + 1428 subflow_v4_route_req - 1387 + 1388 subflow_v4_send_synack - 1379 + 1380 subflow_v6_conn_request - 937 + 938 subflow_v6_rebuild_header - 1542 + 1543 subflow_v6_req_destructor - 309 + 310 subflow_v6_route_req - 301 + 302 subflow_v6_send_synack - 307 + 306 subflow_write_space - 360268 + 436017 @@ -529,21 +529,21 @@ tcp_release_cb_override - 179298 + 279918 validate_data_csum - 534615 + 500508 validate_mapping - 116255 + 148209 diff --git a/html/lcov/export-net/mptcp/subflow.c.gcov.html b/html/lcov/export-net/mptcp/subflow.c.gcov.html index dda337ad..a86a7fc2 100644 --- a/html/lcov/export-net/mptcp/subflow.c.gcov.html +++ b/html/lcov/export-net/mptcp/subflow.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 95.5 % @@ -118,91 +118,91 @@ - - - - ] 36 : : } 37 : : - 38 : 1736 : static void subflow_req_destructor(struct request_sock *req) + 38 : 1738 : static void subflow_req_destructor(struct request_sock *req) 39 : : { - 40 : 1736 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 40 : 1738 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 41 : : - 42 [ - + ]: 1736 : pr_debug("subflow_req=%p\n", subflow_req); + 42 [ - + ]: 1738 : pr_debug("subflow_req=%p\n", subflow_req); 43 : : - 44 [ + + ]: 1736 : if (subflow_req->msk) + 44 [ + + ]: 1738 : if (subflow_req->msk) 45 : 30 : sock_put((struct sock *)subflow_req->msk); 46 : : - 47 : 1736 : mptcp_token_destroy_request(req); - 48 : 1736 : } + 47 : 1738 : mptcp_token_destroy_request(req); + 48 : 1738 : } 49 : : - 50 : 1782 : static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, + 50 : 1790 : static void subflow_generate_hmac(u64 key1, u64 key2, u32 nonce1, u32 nonce2, 51 : : void *hmac) 52 : : { - 53 : 1782 : u8 msg[8]; + 53 : 1790 : u8 msg[8]; 54 : : - 55 : 1782 : put_unaligned_be32(nonce1, &msg[0]); - 56 : 1782 : put_unaligned_be32(nonce2, &msg[4]); + 55 : 1790 : put_unaligned_be32(nonce1, &msg[0]); + 56 : 1790 : put_unaligned_be32(nonce2, &msg[4]); 57 : : - 58 : 1782 : mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac); - 59 : 1782 : } + 58 : 1790 : mptcp_crypto_hmac_sha(key1, key2, msg, 8, hmac); + 59 : 1790 : } 60 : : - 61 : 480 : static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk) + 61 : 482 : static bool mptcp_can_accept_new_subflow(const struct mptcp_sock *msk) 62 : : { - 63 [ + - + + ]: 480 : return mptcp_is_fully_established((void *)msk) && + 63 [ + - + + ]: 482 : return mptcp_is_fully_established((void *)msk) && 64 [ + + - - ]: 32 : ((mptcp_pm_is_userspace(msk) && 65 : 26 : mptcp_userspace_pm_active(msk)) || - 66 [ + + + + ]: 458 : READ_ONCE(msk->pm.accept_subflow)); + 66 [ + + + + ]: 460 : READ_ONCE(msk->pm.accept_subflow)); 67 : : } 68 : : 69 : : /* validate received token and create truncated hmac and nonce for SYN-ACK */ - 70 : 460 : static void subflow_req_create_thmac(struct mptcp_subflow_request_sock *subflow_req) + 70 : 462 : static void subflow_req_create_thmac(struct mptcp_subflow_request_sock *subflow_req) 71 : : { - 72 : 460 : struct mptcp_sock *msk = subflow_req->msk; - 73 : 460 : u8 hmac[SHA256_DIGEST_SIZE]; + 72 : 462 : struct mptcp_sock *msk = subflow_req->msk; + 73 : 462 : u8 hmac[SHA256_DIGEST_SIZE]; 74 : : - 75 : 460 : get_random_bytes(&subflow_req->local_nonce, sizeof(u32)); + 75 : 462 : get_random_bytes(&subflow_req->local_nonce, sizeof(u32)); 76 : : - 77 : 460 : subflow_generate_hmac(READ_ONCE(msk->local_key), - 78 : 460 : READ_ONCE(msk->remote_key), + 77 : 462 : subflow_generate_hmac(READ_ONCE(msk->local_key), + 78 : 462 : READ_ONCE(msk->remote_key), 79 : : subflow_req->local_nonce, 80 : : subflow_req->remote_nonce, hmac); 81 : : - 82 : 460 : subflow_req->thmac = get_unaligned_be64(hmac); - 83 : 460 : } + 82 : 462 : subflow_req->thmac = get_unaligned_be64(hmac); + 83 : 462 : } 84 : : - 85 : 466 : static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) + 85 : 468 : static struct mptcp_sock *subflow_token_join_request(struct request_sock *req) 86 : : { - 87 : 466 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 88 : 466 : struct mptcp_sock *msk; - 89 : 466 : int local_id; + 87 : 468 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 88 : 468 : struct mptcp_sock *msk; + 89 : 468 : int local_id; 90 : : - 91 : 466 : msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); - 92 [ + + ]: 466 : if (!msk) { + 91 : 468 : msk = mptcp_token_get_sock(sock_net(req_to_sk(req)), subflow_req->token); + 92 [ + + ]: 468 : if (!msk) { 93 [ + - ]: 6 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINNOTOKEN); 94 : 6 : return NULL; 95 : : } 96 : : - 97 : 460 : local_id = mptcp_pm_get_local_id(msk, (struct sock_common *)req); - 98 [ - + ]: 460 : if (local_id < 0) { + 97 : 462 : local_id = mptcp_pm_get_local_id(msk, (struct sock_common *)req); + 98 [ - + ]: 462 : if (local_id < 0) { 99 : 0 : sock_put((struct sock *)msk); 100 : 0 : return NULL; 101 : : } - 102 : 460 : subflow_req->local_id = local_id; - 103 : 460 : subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); + 102 : 462 : subflow_req->local_id = local_id; + 103 : 462 : subflow_req->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)req); 104 : : - 105 : 460 : return msk; + 105 : 462 : return msk; 106 : : } 107 : : - 108 : 1736 : static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) + 108 : 1738 : static void subflow_init_req(struct request_sock *req, const struct sock *sk_listener) 109 : : { - 110 : 1736 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 110 : 1738 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); 111 : : - 112 : 1736 : subflow_req->mp_capable = 0; - 113 : 1736 : subflow_req->mp_join = 0; - 114 : 1736 : subflow_req->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk_listener)); - 115 : 1736 : subflow_req->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk_listener)); - 116 : 1736 : subflow_req->msk = NULL; - 117 : 1736 : mptcp_token_init_request(req); - 118 : 1736 : } + 112 : 1738 : subflow_req->mp_capable = 0; + 113 : 1738 : subflow_req->mp_join = 0; + 114 : 1738 : subflow_req->csum_reqd = mptcp_is_checksum_enabled(sock_net(sk_listener)); + 115 : 1738 : subflow_req->allow_join_id0 = mptcp_allow_join_id0(sock_net(sk_listener)); + 116 : 1738 : subflow_req->msk = NULL; + 117 : 1738 : mptcp_token_init_request(req); + 118 : 1738 : } 119 : : 120 : 12 : static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk) 121 : : { - 122 : 910 : return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport; + 122 : 914 : 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 : 1688 : static int subflow_check_req(struct request_sock *req, + 147 : 1690 : static int subflow_check_req(struct request_sock *req, 148 : : const struct sock *sk_listener, 149 : : struct sk_buff *skb) 150 : : { - 151 [ - + ]: 1688 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener); - 152 : 1688 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 153 : 1688 : struct mptcp_options_received mp_opt; - 154 : 1688 : bool opt_mp_capable, opt_mp_join; + 151 [ - + ]: 1690 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener); + 152 : 1690 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 153 : 1690 : struct mptcp_options_received mp_opt; + 154 : 1690 : bool opt_mp_capable, opt_mp_join; 155 : : - 156 [ - + ]: 1688 : pr_debug("subflow_req=%p, listener=%p\n", subflow_req, listener); + 156 [ - + ]: 1690 : 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 : 1688 : mptcp_get_options(skb, &mp_opt); + 168 : 1690 : mptcp_get_options(skb, &mp_opt); 169 : : - 170 : 1688 : opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN); - 171 : 1688 : opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN); - 172 [ + + ]: 1688 : if (opt_mp_capable) { + 170 : 1690 : opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN); + 171 : 1690 : opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN); + 172 [ + + ]: 1690 : if (opt_mp_capable) { 173 [ + - ]: 1146 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE); 174 : : 175 [ + + + + ]: 1146 : if (unlikely(listener->pm_listener)) 176 : 2 : return subflow_reset_req_endp(req, skb); 177 [ - + ]: 1144 : if (opt_mp_join) 178 : : return 0; - 179 [ + + ]: 542 : } else if (opt_mp_join) { - 180 [ + - ]: 466 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); + 179 [ + + ]: 544 : } else if (opt_mp_join) { + 180 [ + - ]: 468 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINSYNRX); 181 : : - 182 [ + + ]: 466 : if (mp_opt.backup) + 182 [ + + ]: 468 : 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 [ + + + - ]: 1686 : if (opt_mp_capable && listener->request_mptcp) { + 188 [ + + + - ]: 1688 : if (opt_mp_capable && listener->request_mptcp) { 189 : 1144 : int err, retries = MPTCP_TOKEN_MAX_RETRIES; 190 : : 191 : 1144 : 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 [ + + - + ]: 542 : } else if (opt_mp_join && listener->request_mptcp) { - 220 : 466 : subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq; - 221 : 466 : subflow_req->mp_join = 1; - 222 : 466 : subflow_req->backup = mp_opt.backup; - 223 : 466 : subflow_req->remote_id = mp_opt.join_id; - 224 : 466 : subflow_req->token = mp_opt.token; - 225 : 466 : subflow_req->remote_nonce = mp_opt.nonce; - 226 : 466 : subflow_req->msk = subflow_token_join_request(req); + 219 [ + + - + ]: 544 : } else if (opt_mp_join && listener->request_mptcp) { + 220 : 468 : subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq; + 221 : 468 : subflow_req->mp_join = 1; + 222 : 468 : subflow_req->backup = mp_opt.backup; + 223 : 468 : subflow_req->remote_id = mp_opt.join_id; + 224 : 468 : subflow_req->token = mp_opt.token; + 225 : 468 : subflow_req->remote_nonce = mp_opt.nonce; + 226 : 468 : subflow_req->msk = subflow_token_join_request(req); 227 : : 228 : : /* Can't fall back to TCP in this case. */ - 229 [ + + ]: 466 : if (!subflow_req->msk) { + 229 [ + + ]: 468 : if (!subflow_req->msk) { 230 : 6 : subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP); 231 : 6 : return -EPERM; 232 : : } 233 : : - 234 [ + + ]: 460 : if (subflow_use_different_sport(subflow_req->msk, sk_listener)) { + 234 [ + + ]: 462 : 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 : 460 : subflow_req_create_thmac(subflow_req); + 246 : 462 : subflow_req_create_thmac(subflow_req); 247 : : - 248 [ + + ]: 460 : if (unlikely(req->syncookie)) { + 248 [ + + ]: 462 : 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 [ + - ]: 458 : pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token, + 257 [ + - ]: 460 : pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token, 258 : : subflow_req->remote_nonce, subflow_req->msk); 259 : : } 260 : : @@ -395,24 +395,24 @@ 312 [ + - ]: 16 : return sk_rst_convert_mptcp_reason(mpext->reset_reason); 313 : : } 314 : : - 315 : 1387 : static struct dst_entry *subflow_v4_route_req(const struct sock *sk, + 315 : 1388 : static struct dst_entry *subflow_v4_route_req(const struct sock *sk, 316 : : struct sk_buff *skb, 317 : : struct flowi *fl, 318 : : struct request_sock *req, 319 : : u32 tw_isn) 320 : : { - 321 : 1387 : struct dst_entry *dst; - 322 : 1387 : int err; + 321 : 1388 : struct dst_entry *dst; + 322 : 1388 : int err; 323 : : - 324 : 1387 : tcp_rsk(req)->is_mptcp = 1; - 325 : 1387 : subflow_init_req(req, sk); + 324 : 1388 : tcp_rsk(req)->is_mptcp = 1; + 325 : 1388 : subflow_init_req(req, sk); 326 : : - 327 : 1387 : dst = tcp_request_sock_ipv4_ops.route_req(sk, skb, fl, req, tw_isn); - 328 [ - + ]: 1387 : if (!dst) + 327 : 1388 : dst = tcp_request_sock_ipv4_ops.route_req(sk, skb, fl, req, tw_isn); + 328 [ - + ]: 1388 : if (!dst) 329 : : return NULL; 330 : : - 331 : 1387 : err = subflow_check_req(req, sk, skb); - 332 [ + + ]: 1387 : if (err == 0) + 331 : 1388 : err = subflow_check_req(req, sk, skb); + 332 [ + + ]: 1388 : if (err == 0) 333 : : return dst; 334 : : 335 : 8 : dst_release(dst); @@ -426,62 +426,62 @@ 343 : : struct tcp_fastopen_cookie *foc, 344 : : enum tcp_synack_type synack_type) 345 : : { - 346 [ + + ]: 1686 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 346 [ + + ]: 1686 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 347 : 1686 : struct inet_request_sock *ireq = inet_rsk(req); 348 : : 349 : : /* clear tstamp_ok, as needed depending on cookie */ - 350 [ + + + + ]: 1686 : if (foc && foc->len > -1) + 350 [ + + + + ]: 1686 : if (foc && foc->len > -1) 351 : 20 : ireq->tstamp_ok = 0; 352 : : 353 [ + + ]: 1686 : if (synack_type == TCP_SYNACK_FASTOPEN) 354 : 38 : mptcp_fastopen_subflow_synack_set_params(subflow, req); 355 : 1686 : } 356 : : - 357 : 1379 : static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst, + 357 : 1380 : static int subflow_v4_send_synack(const struct sock *sk, struct dst_entry *dst, 358 : : struct flowi *fl, 359 : : struct request_sock *req, 360 : : struct tcp_fastopen_cookie *foc, 361 : : enum tcp_synack_type synack_type, 362 : : struct sk_buff *syn_skb) 363 : : { - 364 : 1379 : subflow_prep_synack(sk, req, foc, synack_type); + 364 : 1380 : subflow_prep_synack(sk, req, foc, synack_type); 365 : : - 366 : 1379 : return tcp_request_sock_ipv4_ops.send_synack(sk, dst, fl, req, foc, + 366 : 1380 : return tcp_request_sock_ipv4_ops.send_synack(sk, dst, fl, req, foc, 367 : : synack_type, syn_skb); 368 : : } 369 : : 370 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 371 : 307 : static int subflow_v6_send_synack(const struct sock *sk, struct dst_entry *dst, + 371 : 306 : 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 : 307 : subflow_prep_synack(sk, req, foc, synack_type); + 378 : 306 : subflow_prep_synack(sk, req, foc, synack_type); 379 : : - 380 : 307 : return tcp_request_sock_ipv6_ops.send_synack(sk, dst, fl, req, foc, + 380 : 306 : 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 : 432 : static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) + 413 : 434 : static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow) 414 : : { - 415 : 432 : u8 hmac[SHA256_DIGEST_SIZE]; - 416 : 432 : u64 thmac; + 415 : 434 : u8 hmac[SHA256_DIGEST_SIZE]; + 416 : 434 : u64 thmac; 417 : : - 418 : 432 : subflow_generate_hmac(subflow->remote_key, subflow->local_key, + 418 : 434 : subflow_generate_hmac(subflow->remote_key, subflow->local_key, 419 : : subflow->remote_nonce, subflow->local_nonce, 420 : : hmac); 421 : : - 422 [ - + ]: 432 : thmac = get_unaligned_be64(hmac); - 423 [ - + ]: 432 : pr_debug("subflow=%p, token=%u, thmac=%llu, subflow->thmac=%llu\n", + 422 [ - + ]: 434 : thmac = get_unaligned_be64(hmac); + 423 [ - + ]: 434 : pr_debug("subflow=%p, token=%u, thmac=%llu, subflow->thmac=%llu\n", 424 : : subflow, subflow->token, thmac, subflow->thmac); 425 : : - 426 : 432 : return thmac == subflow->thmac; + 426 : 434 : return thmac == subflow->thmac; 427 : : } 428 : : 429 : 8 : void mptcp_subflow_reset(struct sock *ssk) @@ -533,7 +533,7 @@ 450 : : 451 : 6 : static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct sock *sk) 452 : : { - 453 : 432 : return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; + 453 : 434 : return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; 454 : : } 455 : : 456 : 1172 : void __mptcp_sync_state(struct sock *sk, int state) @@ -558,14 +558,14 @@ 475 : : } 476 : 1172 : } 477 : : - 478 : 3642 : static void subflow_set_remote_key(struct mptcp_sock *msk, + 478 : 3644 : 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 [ + + ]: 3642 : if (subflow->remote_key_valid) + 485 [ + + ]: 3644 : if (subflow->remote_key_valid) 486 : : return; 487 : : 488 : 2190 : subflow->remote_key_valid = 1; @@ -595,37 +595,37 @@ 512 : 1082 : subflow_set_remote_key(msk, subflow, mp_opt); 513 : : } 514 : : - 515 [ + + ]: 1172 : if (!sock_owned_by_user(sk)) { - 516 : 339 : __mptcp_sync_state(sk, ssk->sk_state); + 515 [ + + ]: 1172 : if (!sock_owned_by_user(sk)) { + 516 : 338 : __mptcp_sync_state(sk, ssk->sk_state); 517 : : } else { - 518 : 833 : msk->pending_state = ssk->sk_state; - 519 [ - + - - : 833 : __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); + 518 : 834 : msk->pending_state = ssk->sk_state; + 519 [ - + - - : 834 : __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); - - ] 520 : : } 521 : 1172 : mptcp_data_unlock(sk); 522 : 1172 : } 523 : : - 524 : 4341 : static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) + 524 : 4387 : static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) 525 : : { - 526 : 4341 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 527 : 4341 : struct mptcp_options_received mp_opt; - 528 : 4341 : struct sock *parent = subflow->conn; - 529 : 4341 : struct mptcp_sock *msk; + 526 : 4387 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 527 : 4387 : struct mptcp_options_received mp_opt; + 528 : 4387 : struct sock *parent = subflow->conn; + 529 : 4387 : struct mptcp_sock *msk; 530 : : - 531 : 4341 : subflow->icsk_af_ops->sk_rx_dst_set(sk, skb); + 531 : 4387 : 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 [ + + ]: 4341 : if (subflow->conn_finished) - 535 : 4341 : return; + 534 [ + + ]: 4387 : if (subflow->conn_finished) + 535 : 4387 : return; 536 : : - 537 [ - + ]: 1604 : msk = mptcp_sk(parent); - 538 : 1604 : subflow->rel_write_seq = 1; - 539 : 1604 : subflow->conn_finished = 1; - 540 : 1604 : subflow->ssn_offset = TCP_SKB_CB(skb)->seq; - 541 [ - + ]: 1604 : pr_debug("subflow=%p synack seq=%x\n", subflow, subflow->ssn_offset); + 537 [ - + ]: 1606 : msk = mptcp_sk(parent); + 538 : 1606 : subflow->rel_write_seq = 1; + 539 : 1606 : subflow->conn_finished = 1; + 540 : 1606 : subflow->ssn_offset = TCP_SKB_CB(skb)->seq; + 541 [ - + ]: 1606 : pr_debug("subflow=%p synack seq=%x\n", subflow, subflow->ssn_offset); 542 : : - 543 : 1604 : mptcp_get_options(skb, &mp_opt); - 544 [ + + ]: 1604 : if (subflow->request_mptcp) { + 543 : 1606 : mptcp_get_options(skb, &mp_opt); + 544 [ + + ]: 1606 : if (subflow->request_mptcp) { 545 [ + + ]: 1154 : 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 : 1082 : mptcp_finish_connect(sk); 560 : 1082 : mptcp_active_enable(parent); 561 : 1082 : mptcp_propagate_state(parent, sk, subflow, &mp_opt); - 562 [ + + ]: 450 : } else if (subflow->request_join) { - 563 : 432 : u8 hmac[SHA256_DIGEST_SIZE]; + 562 [ + + ]: 452 : } else if (subflow->request_join) { + 563 : 434 : u8 hmac[SHA256_DIGEST_SIZE]; 564 : : - 565 [ - + ]: 432 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { + 565 [ - + ]: 434 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYNACK)) { 566 : 0 : subflow->reset_reason = MPTCP_RST_EMPTCP; 567 : 0 : goto do_reset; 568 : : } 569 : : - 570 : 432 : subflow->backup = mp_opt.backup; - 571 : 432 : subflow->thmac = mp_opt.thmac; - 572 : 432 : subflow->remote_nonce = mp_opt.nonce; - 573 : 432 : WRITE_ONCE(subflow->remote_id, mp_opt.join_id); - 574 [ - + ]: 432 : pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d\n", + 570 : 434 : subflow->backup = mp_opt.backup; + 571 : 434 : subflow->thmac = mp_opt.thmac; + 572 : 434 : subflow->remote_nonce = mp_opt.nonce; + 573 : 434 : WRITE_ONCE(subflow->remote_id, mp_opt.join_id); + 574 [ - + ]: 434 : pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d\n", 575 : : subflow, subflow->thmac, subflow->remote_nonce, 576 : : subflow->backup); 577 : : - 578 [ - + ]: 432 : if (!subflow_thmac_valid(subflow)) { + 578 [ - + ]: 434 : 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 [ - + ]: 432 : if (!mptcp_finish_join(sk)) + 584 [ - + ]: 434 : if (!mptcp_finish_join(sk)) 585 : 0 : goto do_reset; 586 : : - 587 : 432 : subflow_generate_hmac(subflow->local_key, subflow->remote_key, + 587 : 434 : subflow_generate_hmac(subflow->local_key, subflow->remote_key, 588 : : subflow->local_nonce, 589 : : subflow->remote_nonce, 590 : : hmac); - 591 : 432 : memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN); + 591 : 434 : memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN); 592 : : - 593 : 432 : subflow->mp_join = 1; - 594 [ + - ]: 432 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); + 593 : 434 : subflow->mp_join = 1; + 594 [ + - ]: 434 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX); 595 : : - 596 [ + + ]: 432 : if (subflow->backup) + 596 [ + + ]: 434 : if (subflow->backup) 597 [ + - ]: 6 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX); 598 : : - 599 [ + + ]: 432 : if (subflow_use_different_dport(msk, sk)) { + 599 [ + + ]: 434 : 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,67 +700,67 @@ 616 : 0 : mptcp_subflow_reset(sk); 617 : : } 618 : : - 619 : 997 : static void subflow_set_local_id(struct mptcp_subflow_context *subflow, int local_id) + 619 : 999 : static void subflow_set_local_id(struct mptcp_subflow_context *subflow, int local_id) 620 : : { - 621 [ - + ]: 973 : WARN_ON_ONCE(local_id < 0 || local_id > 255); - 622 : 2111 : WRITE_ONCE(subflow->local_id, local_id); - 623 : 2111 : } + 621 [ - + ]: 975 : WARN_ON_ONCE(local_id < 0 || local_id > 255); + 622 : 2113 : WRITE_ONCE(subflow->local_id, local_id); + 623 : 2113 : } 624 : : - 625 : 7061 : static int subflow_chk_local_id(struct sock *sk) + 625 : 7182 : static int subflow_chk_local_id(struct sock *sk) 626 : : { - 627 [ - + ]: 7061 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 628 [ - + ]: 7061 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); - 629 : 7061 : int err; + 627 [ - + ]: 7182 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 628 [ - + ]: 7182 : struct mptcp_sock *msk = mptcp_sk(subflow->conn); + 629 : 7182 : int err; 630 : : - 631 [ + + ]: 7061 : if (likely(subflow->local_id >= 0)) + 631 [ + + ]: 7182 : if (likely(subflow->local_id >= 0)) 632 : : return 0; 633 : : - 634 : 250 : err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); - 635 [ + - ]: 250 : if (err < 0) + 634 : 251 : err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); + 635 [ + - ]: 251 : if (err < 0) 636 : : return err; 637 : : - 638 : 250 : subflow_set_local_id(subflow, err); - 639 : 250 : subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); + 638 : 251 : subflow_set_local_id(subflow, err); + 639 : 251 : subflow->request_bkup = mptcp_pm_is_backup(msk, (struct sock_common *)sk); 640 : : - 641 : 250 : return 0; + 641 : 251 : return 0; 642 : : } 643 : : - 644 : 5519 : static int subflow_rebuild_header(struct sock *sk) + 644 : 5639 : static int subflow_rebuild_header(struct sock *sk) 645 : : { - 646 : 5519 : int err = subflow_chk_local_id(sk); + 646 : 5639 : int err = subflow_chk_local_id(sk); 647 : : - 648 [ + - ]: 5519 : if (unlikely(err < 0)) + 648 [ + - ]: 5639 : if (unlikely(err < 0)) 649 : : return err; 650 : : - 651 : 5519 : return inet_sk_rebuild_header(sk); + 651 : 5639 : return inet_sk_rebuild_header(sk); 652 : : } 653 : : 654 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 655 : 1542 : static int subflow_v6_rebuild_header(struct sock *sk) + 655 : 1543 : static int subflow_v6_rebuild_header(struct sock *sk) 656 : : { - 657 : 1542 : int err = subflow_chk_local_id(sk); + 657 : 1543 : int err = subflow_chk_local_id(sk); 658 : : - 659 [ + - ]: 1542 : if (unlikely(err < 0)) + 659 [ + - ]: 1543 : if (unlikely(err < 0)) 660 : : return err; 661 : : - 662 : 1542 : return inet6_sk_rebuild_header(sk); + 662 : 1543 : return inet6_sk_rebuild_header(sk); 663 : : } 664 : : #endif 665 : : 666 : : static struct request_sock_ops mptcp_subflow_v4_request_sock_ops __ro_after_init; 667 : : static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops __ro_after_init; 668 : : - 669 : 1387 : static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) + 669 : 1388 : static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) 670 : : { - 671 [ - + ]: 1387 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 671 [ - + ]: 1388 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 672 : : - 673 [ - + ]: 1387 : pr_debug("subflow=%p\n", subflow); + 673 [ - + ]: 1388 : pr_debug("subflow=%p\n", subflow); 674 : : 675 : : /* Never answer to SYNs sent to broadcast or multicast */ - 676 [ - + ]: 1387 : if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) + 676 [ - + ]: 1388 : if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) 677 : 0 : goto drop; 678 : : - 679 : 1387 : return tcp_conn_request(&mptcp_subflow_v4_request_sock_ops, + 679 : 1388 : return tcp_conn_request(&mptcp_subflow_v4_request_sock_ops, 680 : : &subflow_request_sock_ipv4_ops, 681 : : sk, skb); 682 : 0 : drop: @@ -768,11 +768,11 @@ 684 : 0 : return 0; 685 : : } 686 : : - 687 : 1427 : static void subflow_v4_req_destructor(struct request_sock *req) + 687 : 1428 : static void subflow_v4_req_destructor(struct request_sock *req) 688 : : { - 689 : 1427 : subflow_req_destructor(req); - 690 : 1427 : tcp_request_sock_ops.destructor(req); - 691 : 1427 : } + 689 : 1428 : subflow_req_destructor(req); + 690 : 1428 : tcp_request_sock_ops.destructor(req); + 691 : 1428 : } 692 : : 693 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 694 : : static struct request_sock_ops mptcp_subflow_v6_request_sock_ops __ro_after_init; @@ -781,24 +781,24 @@ 697 : : static struct inet_connection_sock_af_ops subflow_v6m_specific __ro_after_init; 698 : : static struct proto tcpv6_prot_override __ro_after_init; 699 : : - 700 : 937 : static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) + 700 : 938 : static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) 701 : : { - 702 [ - + ]: 937 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 702 [ - + ]: 938 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 703 : : - 704 [ - + ]: 937 : pr_debug("subflow=%p\n", subflow); + 704 [ - + ]: 938 : pr_debug("subflow=%p\n", subflow); 705 : : - 706 [ + + ]: 937 : if (skb->protocol == htons(ETH_P_IP)) + 706 [ + + ]: 938 : if (skb->protocol == htons(ETH_P_IP)) 707 : 636 : 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 : 458 : static bool subflow_hmac_valid(const struct request_sock *req, + 748 : 460 : static bool subflow_hmac_valid(const struct request_sock *req, 749 : : const struct mptcp_options_received *mp_opt) 750 : : { - 751 : 458 : const struct mptcp_subflow_request_sock *subflow_req; - 752 : 458 : u8 hmac[SHA256_DIGEST_SIZE]; - 753 : 458 : struct mptcp_sock *msk; + 751 : 460 : const struct mptcp_subflow_request_sock *subflow_req; + 752 : 460 : u8 hmac[SHA256_DIGEST_SIZE]; + 753 : 460 : struct mptcp_sock *msk; 754 : : - 755 : 458 : subflow_req = mptcp_subflow_rsk(req); - 756 : 458 : msk = subflow_req->msk; - 757 [ + - ]: 458 : if (!msk) + 755 : 460 : subflow_req = mptcp_subflow_rsk(req); + 756 : 460 : msk = subflow_req->msk; + 757 [ + - ]: 460 : if (!msk) 758 : : return false; 759 : : - 760 : 458 : subflow_generate_hmac(READ_ONCE(msk->remote_key), - 761 : 458 : READ_ONCE(msk->local_key), - 762 : 458 : subflow_req->remote_nonce, - 763 : 458 : subflow_req->local_nonce, hmac); + 760 : 460 : subflow_generate_hmac(READ_ONCE(msk->remote_key), + 761 : 460 : READ_ONCE(msk->local_key), + 762 : 460 : subflow_req->remote_nonce, + 763 : 460 : subflow_req->local_nonce, hmac); 764 : : - 765 : 458 : return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); + 765 : 460 : return !crypto_memneq(hmac, mp_opt->hmac, MPTCPOPT_HMAC_LEN); 766 : : } 767 : : 768 : 138 : static void subflow_ulp_fallback(struct sock *sk, @@ -879,50 +879,50 @@ 795 : 62 : kfree_rcu(ctx, rcu); 796 : : } 797 : : - 798 : 2560 : void __mptcp_subflow_fully_established(struct mptcp_sock *msk, + 798 : 2562 : 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 : 2560 : subflow_set_remote_key(msk, subflow, mp_opt); - 803 : 2560 : WRITE_ONCE(subflow->fully_established, true); - 804 : 2560 : WRITE_ONCE(msk->fully_established, true); + 802 : 2562 : subflow_set_remote_key(msk, subflow, mp_opt); + 803 : 2562 : WRITE_ONCE(subflow->fully_established, true); + 804 : 2562 : WRITE_ONCE(msk->fully_established, true); 805 : : - 806 [ + + ]: 2560 : if (subflow->is_mptfo) + 806 [ + + ]: 2562 : if (subflow->is_mptfo) 807 : 26 : __mptcp_fastopen_gen_msk_ackseq(msk, subflow, mp_opt); - 808 : 2560 : } + 808 : 2562 : } 809 : : - 810 : 1672 : static struct sock *subflow_syn_recv_sock(const struct sock *sk, + 810 : 1674 : static struct sock *subflow_syn_recv_sock(const struct sock *sk, 811 : : struct sk_buff *skb, 812 : : struct request_sock *req, 813 : : struct dst_entry *dst, 814 : : struct request_sock *req_unhash, 815 : : bool *own_req) 816 : : { - 817 [ - + ]: 1672 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk); - 818 : 1672 : struct mptcp_subflow_request_sock *subflow_req; - 819 : 1672 : struct mptcp_options_received mp_opt; - 820 : 1672 : bool fallback, fallback_is_fatal; - 821 : 1672 : enum sk_rst_reason reason; - 822 : 1672 : struct mptcp_sock *owner; - 823 : 1672 : struct sock *child; + 817 [ - + ]: 1674 : struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk); + 818 : 1674 : struct mptcp_subflow_request_sock *subflow_req; + 819 : 1674 : struct mptcp_options_received mp_opt; + 820 : 1674 : bool fallback, fallback_is_fatal; + 821 : 1674 : enum sk_rst_reason reason; + 822 : 1674 : struct mptcp_sock *owner; + 823 : 1674 : struct sock *child; 824 : : - 825 [ - + ]: 1672 : pr_debug("listener=%p, req=%p, conn=%p\n", listener, req, listener->conn); + 825 [ - + ]: 1674 : pr_debug("listener=%p, req=%p, conn=%p\n", listener, req, listener->conn); 826 : : 827 : : /* After child creation we must look for MPC even when options 828 : : * are not parsed 829 : : */ - 830 : 1672 : mp_opt.suboptions = 0; + 830 : 1674 : mp_opt.suboptions = 0; 831 : : 832 : : /* hopefully temporary handling for MP_JOIN+syncookie */ - 833 : 1672 : subflow_req = mptcp_subflow_rsk(req); - 834 [ + + + + : 1672 : fallback_is_fatal = tcp_rsk(req)->is_mptcp && subflow_req->mp_join; - + + ] - 835 [ - + ]: 1672 : fallback = !tcp_rsk(req)->is_mptcp; - 836 [ - + ]: 1672 : if (fallback) + 833 : 1674 : subflow_req = mptcp_subflow_rsk(req); + 834 [ + + + + : 1674 : fallback_is_fatal = tcp_rsk(req)->is_mptcp && subflow_req->mp_join; + + + ] + 835 [ - + ]: 1674 : fallback = !tcp_rsk(req)->is_mptcp; + 836 [ - + ]: 1674 : if (fallback) 837 : 0 : goto create_child; 838 : : 839 : : /* if the sk is MP_CAPABLE, we try to fetch the client key */ - 840 [ + + ]: 1672 : if (subflow_req->mp_capable) { + 840 [ + + ]: 1674 : if (subflow_req->mp_capable) { 841 : : /* we can receive and accept an in-window, out-of-order pkt, 842 : : * which may not carry the MP_CAPABLE opt even on mptcp enabled 843 : : * paths: always try to extract the peer key, and fallback @@ -936,31 +936,31 @@ 851 : : (OPTION_MPTCP_MPC_SYN | OPTION_MPTCP_MPC_ACK))) 852 : 0 : fallback = true; 853 : : - 854 [ + + ]: 534 : } else if (subflow_req->mp_join) { - 855 : 458 : mptcp_get_options(skb, &mp_opt); - 856 [ + - + - ]: 916 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) || - 857 [ + + ]: 916 : !subflow_hmac_valid(req, &mp_opt) || - 858 : 458 : !mptcp_can_accept_new_subflow(subflow_req->msk)) { + 854 [ + + ]: 536 : } else if (subflow_req->mp_join) { + 855 : 460 : mptcp_get_options(skb, &mp_opt); + 856 [ + - + - ]: 920 : if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) || + 857 [ + + ]: 920 : !subflow_hmac_valid(req, &mp_opt) || + 858 : 460 : !mptcp_can_accept_new_subflow(subflow_req->msk)) { 859 [ - + ]: 8 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); 860 : : fallback = true; 861 : : } 862 : : } 863 : : - 864 : 520 : create_child: - 865 : 1672 : child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst, + 864 : 522 : create_child: + 865 : 1674 : child = listener->icsk_af_ops->syn_recv_sock(sk, skb, req, dst, 866 : : req_unhash, own_req); 867 : : - 868 [ + - + + : 1672 : if (child && *own_req) { - + - ] - 869 [ + + ]: 1672 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); + 868 [ + - + + : 1674 : if (child && *own_req) { + + - ] + 869 [ + + ]: 1674 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child); 870 : : - 871 : 1672 : tcp_rsk(req)->drop_req = false; + 871 : 1674 : tcp_rsk(req)->drop_req = false; 872 : : 873 : : /* we need to fallback on ctx allocation failure and on pre-reqs 874 : : * checking above. In the latter scenario we additionally need 875 : : * to reset the context to non MPTCP status. 876 : : */ - 877 [ + + ]: 1672 : if (!ctx || fallback) { + 877 [ + + ]: 1674 : if (!ctx || fallback) { 878 [ + + ]: 102 : if (fallback_is_fatal) { 879 : 8 : subflow_add_reset_reason(skb, MPTCP_RST_EMPTCP); 880 : 8 : goto dispose_child; @@ -969,9 +969,9 @@ 883 : : } 884 : : 885 : : /* ssk inherits options of listener sk */ - 886 : 1570 : ctx->setsockopt_seq = listener->setsockopt_seq; + 886 : 1572 : ctx->setsockopt_seq = listener->setsockopt_seq; 887 : : - 888 [ + + ]: 1570 : if (ctx->mp_capable) { + 888 [ + + ]: 1572 : if (ctx->mp_capable) { 889 : 1120 : ctx->conn = mptcp_sk_clone_init(listener->conn, &mp_opt, child, req); 890 [ - + ]: 1120 : if (!ctx->conn) 891 : 0 : goto fallback; @@ -987,18 +987,18 @@ 901 : 1082 : mptcp_pm_fully_established(owner, child); 902 : 1082 : ctx->pm_notified = 1; 903 : : } - 904 [ + - ]: 450 : } else if (ctx->mp_join) { - 905 : 450 : owner = subflow_req->msk; - 906 [ - + ]: 450 : if (!owner) { + 904 [ + - ]: 452 : } else if (ctx->mp_join) { + 905 : 452 : owner = subflow_req->msk; + 906 [ - + ]: 452 : if (!owner) { 907 : 0 : subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT); 908 : 0 : goto dispose_child; 909 : : } 910 : : 911 : : /* move the msk reference ownership to the subflow */ - 912 : 450 : subflow_req->msk = NULL; - 913 : 450 : ctx->conn = (struct sock *)owner; + 912 : 452 : subflow_req->msk = NULL; + 913 : 452 : ctx->conn = (struct sock *)owner; 914 : : - 915 [ + + ]: 450 : if (subflow_use_different_sport(owner, sk)) { + 915 [ + + ]: 452 : if (subflow_use_different_sport(owner, sk)) { 916 [ - + ]: 24 : pr_debug("ack inet_sport=%d %d\n", 917 : : ntohs(inet_sk(sk)->inet_sport), 918 : : ntohs(inet_sk((struct sock *)owner)->inet_sport)); @@ -1010,28 +1010,28 @@ 924 [ + - ]: 24 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINPORTACKRX); 925 : : } 926 : : - 927 [ - + ]: 450 : if (!mptcp_finish_join(child)) { + 927 [ - + ]: 452 : if (!mptcp_finish_join(child)) { 928 : 0 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(child); 929 : : 930 : 0 : subflow_add_reset_reason(skb, subflow->reset_reason); 931 : 0 : goto dispose_child; 932 : : } 933 : : - 934 [ + - ]: 450 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX); - 935 : 450 : tcp_rsk(req)->drop_req = true; + 934 [ + - ]: 452 : SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX); + 935 : 452 : tcp_rsk(req)->drop_req = true; 936 : : } 937 : : } 938 : : 939 : : /* check for expected invariant - should never trigger, just help 940 : : * catching earlier subtle bugs 941 : : */ - 942 [ + + + + : 1570 : WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp && - + + + + + - + + - - - + ] + 942 [ + + + + : 1572 : WARN_ON_ONCE(child && *own_req && tcp_sk(child)->is_mptcp && + + + + + + + + + - - + + ] 943 : : (!mptcp_subflow_ctx(child) || 944 : : !mptcp_subflow_ctx(child)->conn)); - 945 : 1570 : return child; + 945 : 1572 : return child; 946 : : 947 : 8 : dispose_child: 948 : 8 : mptcp_subflow_drop_ctx(child); @@ -1085,19 +1085,19 @@ 996 : 0 : mptcp_subflow_get_map_offset(subflow); 997 : : } 998 : : - 999 : 116255 : static bool validate_mapping(struct sock *ssk, struct sk_buff *skb) + 999 : 148209 : static bool validate_mapping(struct sock *ssk, struct sk_buff *skb) 1000 : : { - 1001 [ - + ]: 116255 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1002 [ - + ]: 116255 : u32 ssn = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + 1001 [ - + ]: 148209 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1002 [ - + ]: 148209 : u32 ssn = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; 1003 : : - 1004 [ - + ]: 116255 : if (unlikely(before(ssn, subflow->map_subflow_seq))) { + 1004 [ - + ]: 148209 : if (unlikely(before(ssn, subflow->map_subflow_seq))) { 1005 : : /* Mapping covers data later in the subflow stream, 1006 : : * currently unsupported. 1007 : : */ 1008 : 0 : dbg_bad_map(subflow, ssn); 1009 : 0 : return false; 1010 : : } - 1011 [ - + ]: 116255 : if (unlikely(!before(ssn, subflow->map_subflow_seq + + 1011 [ - + ]: 148209 : if (unlikely(!before(ssn, subflow->map_subflow_seq + 1012 : : subflow->map_data_len))) { 1013 : : /* Mapping does covers past subflow data, invalid */ 1014 : 0 : dbg_bad_map(subflow, ssn); @@ -1106,19 +1106,19 @@ 1017 : : return true; 1018 : : } 1019 : : - 1020 : 534615 : static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *skb, + 1020 : 500508 : static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff *skb, 1021 : : bool csum_reqd) 1022 : : { - 1023 [ + + ]: 534615 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1024 : 534615 : u32 offset, seq, delta; - 1025 : 534615 : __sum16 csum; - 1026 : 534615 : int len; + 1023 [ + + ]: 500508 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1024 : 500508 : u32 offset, seq, delta; + 1025 : 500508 : __sum16 csum; + 1026 : 500508 : int len; 1027 : : - 1028 [ + + ]: 534615 : if (!csum_reqd) + 1028 [ + + ]: 500508 : if (!csum_reqd) 1029 : : return MAPPING_OK; 1030 : : 1031 : : /* mapping already validated on previous traversal */ - 1032 [ + + ]: 1602 : if (subflow->map_csum_len == subflow->map_data_len) + 1032 [ + + ]: 1608 : if (subflow->map_csum_len == subflow->map_data_len) 1033 : : return MAPPING_OK; 1034 : : 1035 : : /* traverse the receive queue, ensuring it contains a full @@ -1126,39 +1126,39 @@ 1037 : : * Preserve the accoumlate csum across multiple calls, to compute 1038 : : * the csum only once 1039 : : */ - 1040 : 1598 : delta = subflow->map_data_len - subflow->map_csum_len; - 1041 : 10372 : for (;;) { - 1042 [ - + ]: 10372 : seq = tcp_sk(ssk)->copied_seq + subflow->map_csum_len; - 1043 : 10372 : offset = seq - TCP_SKB_CB(skb)->seq; + 1040 : 1601 : delta = subflow->map_data_len - subflow->map_csum_len; + 1041 : 10551 : for (;;) { + 1042 [ - + ]: 10551 : seq = tcp_sk(ssk)->copied_seq + subflow->map_csum_len; + 1043 : 10551 : offset = seq - TCP_SKB_CB(skb)->seq; 1044 : : 1045 : : /* if the current skb has not been accounted yet, csum its contents 1046 : : * up to the amount covered by the current DSS 1047 : : */ - 1048 [ + + ]: 10372 : if (offset < skb->len) { - 1049 : 1600 : __wsum csum; + 1048 [ + + ]: 10551 : if (offset < skb->len) { + 1049 : 1603 : __wsum csum; 1050 : : - 1051 : 1600 : len = min(skb->len - offset, delta); - 1052 : 1600 : csum = skb_checksum(skb, offset, len, 0); - 1053 : 3200 : subflow->map_data_csum = csum_block_add(subflow->map_data_csum, csum, - 1054 [ - + ]: 1600 : subflow->map_csum_len); + 1051 : 1603 : len = min(skb->len - offset, delta); + 1052 : 1603 : csum = skb_checksum(skb, offset, len, 0); + 1053 : 3206 : subflow->map_data_csum = csum_block_add(subflow->map_data_csum, csum, + 1054 [ - + ]: 1603 : subflow->map_csum_len); 1055 : : - 1056 : 1600 : delta -= len; - 1057 : 1600 : subflow->map_csum_len += len; + 1056 : 1603 : delta -= len; + 1057 : 1603 : subflow->map_csum_len += len; 1058 : : } - 1059 [ + + ]: 10372 : if (delta == 0) + 1059 [ + + ]: 10551 : if (delta == 0) 1060 : : break; 1061 : : - 1062 [ + + ]: 10246 : if (skb_queue_is_last(&ssk->sk_receive_queue, skb)) { + 1062 [ + + ]: 10420 : if (skb_queue_is_last(&ssk->sk_receive_queue, skb)) { 1063 : : /* if this subflow is closed, the partial mapping 1064 : : * will be never completed; flush the pending skbs, so 1065 : : * that subflow_sched_work_if_closed() can kick in 1066 : : */ - 1067 [ - + ]: 1472 : if (unlikely(ssk->sk_state == TCP_CLOSE)) + 1067 [ - + ]: 1470 : if (unlikely(ssk->sk_state == TCP_CLOSE)) 1068 [ # # # # ]: 0 : while ((skb = skb_peek(&ssk->sk_receive_queue))) 1069 : 0 : sk_eat_skb(ssk, skb); 1070 : : 1071 : : /* not enough data to validate the csum */ - 1072 : 1472 : return MAPPING_EMPTY; + 1072 : 1470 : return MAPPING_EMPTY; 1073 : : } 1074 : : 1075 : : /* the DSS mapping for next skbs will be validated later, @@ -1172,73 +1172,73 @@ 1083 : : * while the pseudo header requires the original DSS data len, 1084 : : * including that 1085 : : */ - 1086 : 126 : csum = __mptcp_make_csum(subflow->map_seq, + 1086 : 131 : csum = __mptcp_make_csum(subflow->map_seq, 1087 : : subflow->map_subflow_seq, - 1088 : 126 : subflow->map_data_len + subflow->map_data_fin, + 1088 : 131 : subflow->map_data_len + subflow->map_data_fin, 1089 : : subflow->map_data_csum); - 1090 [ + + ]: 126 : if (unlikely(csum)) { + 1090 [ + + ]: 131 : if (unlikely(csum)) { 1091 [ + - ]: 4 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); 1092 : 4 : return MAPPING_BAD_CSUM; 1093 : : } 1094 : : - 1095 : 122 : subflow->valid_csum_seen = 1; - 1096 : 122 : return MAPPING_OK; + 1095 : 127 : subflow->valid_csum_seen = 1; + 1096 : 127 : return MAPPING_OK; 1097 : : } 1098 : : - 1099 : 1081407 : static enum mapping_status get_mapping_status(struct sock *ssk, + 1099 : 1009751 : static enum mapping_status get_mapping_status(struct sock *ssk, 1100 : : struct mptcp_sock *msk) 1101 : : { - 1102 [ + + ]: 1081407 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1103 [ - + ]: 1081407 : bool csum_reqd = READ_ONCE(msk->csum_enabled); - 1104 : 1081407 : struct mptcp_ext *mpext; - 1105 : 1081407 : struct sk_buff *skb; - 1106 : 1081407 : u16 data_len; - 1107 : 1081407 : u64 map_seq; + 1102 [ + + ]: 1009751 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1103 [ - + ]: 1009751 : bool csum_reqd = READ_ONCE(msk->csum_enabled); + 1104 : 1009751 : struct mptcp_ext *mpext; + 1105 : 1009751 : struct sk_buff *skb; + 1106 : 1009751 : u16 data_len; + 1107 : 1009751 : u64 map_seq; 1108 : : - 1109 [ + + ]: 1081407 : skb = skb_peek(&ssk->sk_receive_queue); - 1110 [ - + ]: 539865 : if (!skb) + 1109 [ + + ]: 1009751 : skb = skb_peek(&ssk->sk_receive_queue); + 1110 [ - + ]: 506130 : if (!skb) 1111 : : return MAPPING_EMPTY; 1112 : : - 1113 [ + + ]: 539865 : if (mptcp_check_fallback(ssk)) + 1113 [ + + ]: 506130 : if (mptcp_check_fallback(ssk)) 1114 : : return MAPPING_DUMMY; 1115 : : - 1116 [ + + ]: 535514 : mpext = mptcp_get_ext(skb); - 1117 [ + + + + ]: 534712 : if (!mpext || !mpext->use_map) { - 1118 [ + + + + ]: 2505 : if (!subflow->map_valid && !skb->len) { + 1116 [ + + ]: 501381 : mpext = mptcp_get_ext(skb); + 1117 [ + + + + ]: 500592 : if (!mpext || !mpext->use_map) { + 1118 [ + + + + ]: 2496 : if (!subflow->map_valid && !skb->len) { 1119 : : /* the TCP stack deliver 0 len FIN pkt to the receive 1120 : : * queue, that is the only 0len pkts ever expected here, 1121 : : * and we can admit no mapping only for 0 len pkts 1122 : : */ - 1123 [ - + ]: 879 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) + 1123 [ - + ]: 853 : if (!(TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)) 1124 [ # # # # ]: 0 : WARN_ONCE(1, "0len seq %d:%d flags %x", 1125 : : TCP_SKB_CB(skb)->seq, 1126 : : TCP_SKB_CB(skb)->end_seq, 1127 : : TCP_SKB_CB(skb)->tcp_flags); - 1128 : 879 : sk_eat_skb(ssk, skb); - 1129 : 879 : return MAPPING_EMPTY; + 1128 : 853 : sk_eat_skb(ssk, skb); + 1129 : 853 : return MAPPING_EMPTY; 1130 : : } 1131 : : 1132 : : /* If the required DSS has likely been dropped by a middlebox */ - 1133 [ + + ]: 1626 : if (!subflow->map_valid) + 1133 [ + + ]: 1643 : if (!subflow->map_valid) 1134 : : return MAPPING_NODSS; 1135 : : - 1136 : 1620 : goto validate_seq; + 1136 : 1637 : goto validate_seq; 1137 : : } 1138 : : - 1139 : 533009 : trace_get_mapping_status(mpext); + 1139 : 498885 : trace_get_mapping_status(mpext); 1140 : : - 1141 : 533009 : data_len = mpext->data_len; - 1142 [ + + ]: 533009 : if (data_len == 0) { + 1141 : 498885 : data_len = mpext->data_len; + 1142 [ + + ]: 498885 : if (data_len == 0) { 1143 [ - + ]: 2 : pr_debug("infinite mapping received\n"); 1144 [ + - ]: 2 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); 1145 : 2 : subflow->map_data_len = 0; 1146 : 2 : return MAPPING_INVALID; 1147 : : } 1148 : : - 1149 [ + + ]: 533007 : if (mpext->data_fin == 1) { - 1150 : 787 : u64 data_fin_seq; + 1149 [ + + ]: 498883 : if (mpext->data_fin == 1) { + 1150 : 1078 : u64 data_fin_seq; 1151 : : - 1152 [ + + ]: 787 : if (data_len == 1) { + 1152 [ + + ]: 1078 : if (data_len == 1) { 1153 : 12 : bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq, 1154 : 12 : mpext->dsn64); 1155 [ - + ]: 12 : pr_debug("DATA_FIN with no payload seq=%llu\n", mpext->data_seq); @@ -1258,33 +1258,33 @@ 1169 : 12 : return MAPPING_DATA_FIN; 1170 : : } 1171 : : - 1172 : 775 : data_fin_seq = mpext->data_seq + data_len - 1; + 1172 : 1066 : data_fin_seq = mpext->data_seq + data_len - 1; 1173 : : 1174 : : /* If mpext->data_seq is a 32-bit value, data_fin_seq must also 1175 : : * be limited to 32 bits. 1176 : : */ - 1177 [ - + ]: 775 : if (!mpext->dsn64) + 1177 [ - + ]: 1066 : if (!mpext->dsn64) 1178 : 0 : data_fin_seq &= GENMASK_ULL(31, 0); 1179 : : - 1180 : 775 : mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); - 1181 [ - + ]: 775 : pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d\n", + 1180 : 1066 : mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); + 1181 [ - + ]: 1066 : pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d\n", 1182 : : data_fin_seq, mpext->dsn64); 1183 : : 1184 : : /* Adjust for DATA_FIN using 1 byte of sequence space */ - 1185 : 775 : data_len--; + 1185 : 1066 : data_len--; 1186 : : } 1187 : : - 1188 [ + + ]: 532995 : map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64); - 1189 [ - + ]: 532995 : WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64); + 1188 [ + + ]: 498871 : map_seq = mptcp_expand_seq(READ_ONCE(msk->ack_seq), mpext->data_seq, mpext->dsn64); + 1189 [ - + ]: 498871 : WRITE_ONCE(mptcp_sk(subflow->conn)->use_64bit_ack, !!mpext->dsn64); 1190 : : - 1191 [ + + ]: 532995 : if (subflow->map_valid) { + 1191 [ + + ]: 498871 : if (subflow->map_valid) { 1192 : : /* Allow replacing only with an identical map */ - 1193 [ + - ]: 418360 : if (subflow->map_seq == map_seq && - 1194 [ + - ]: 418360 : subflow->map_subflow_seq == mpext->subflow_seq && - 1195 [ + - ]: 418360 : subflow->map_data_len == data_len && - 1196 [ + - ]: 418360 : subflow->map_csum_reqd == mpext->csum_reqd) { - 1197 : 418360 : skb_ext_del(skb, SKB_EXT_MPTCP); - 1198 : 418360 : goto validate_csum; + 1193 [ + - ]: 352299 : if (subflow->map_seq == map_seq && + 1194 [ + - ]: 352299 : subflow->map_subflow_seq == mpext->subflow_seq && + 1195 [ + - ]: 352299 : subflow->map_data_len == data_len && + 1196 [ + - ]: 352299 : subflow->map_csum_reqd == mpext->csum_reqd) { + 1197 : 352299 : skb_ext_del(skb, SKB_EXT_MPTCP); + 1198 : 352299 : goto validate_csum; 1199 : : } 1200 : : 1201 : : /* If this skb data are fully covered by the current mapping, @@ -1299,81 +1299,81 @@ 1210 : 0 : goto validate_csum; 1211 : : } 1212 : : - 1213 : 114635 : subflow->map_seq = map_seq; - 1214 : 114635 : subflow->map_subflow_seq = mpext->subflow_seq; - 1215 : 114635 : subflow->map_data_len = data_len; - 1216 : 114635 : subflow->map_valid = 1; - 1217 : 114635 : subflow->map_data_fin = mpext->data_fin; - 1218 : 114635 : subflow->mpc_map = mpext->mpc_map; - 1219 : 114635 : subflow->map_csum_reqd = mpext->csum_reqd; - 1220 : 114635 : subflow->map_csum_len = 0; - 1221 [ - + ]: 114635 : subflow->map_data_csum = csum_unfold(mpext->csum); + 1213 : 146572 : subflow->map_seq = map_seq; + 1214 : 146572 : subflow->map_subflow_seq = mpext->subflow_seq; + 1215 : 146572 : subflow->map_data_len = data_len; + 1216 : 146572 : subflow->map_valid = 1; + 1217 : 146572 : subflow->map_data_fin = mpext->data_fin; + 1218 : 146572 : subflow->mpc_map = mpext->mpc_map; + 1219 : 146572 : subflow->map_csum_reqd = mpext->csum_reqd; + 1220 : 146572 : subflow->map_csum_len = 0; + 1221 [ - + ]: 146572 : subflow->map_data_csum = csum_unfold(mpext->csum); 1222 : : 1223 : : /* Cfr RFC 8684 Section 3.3.0 */ - 1224 [ - + ]: 114635 : if (unlikely(subflow->map_csum_reqd != csum_reqd)) + 1224 [ - + ]: 146572 : if (unlikely(subflow->map_csum_reqd != csum_reqd)) 1225 : : return MAPPING_INVALID; 1226 : : - 1227 [ - + ]: 114635 : pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", + 1227 [ - + ]: 146572 : pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n", 1228 : : subflow->map_seq, subflow->map_subflow_seq, 1229 : : subflow->map_data_len, subflow->map_csum_reqd, 1230 : : subflow->map_data_csum); 1231 : : - 1232 : 116255 : validate_seq: + 1232 : 148209 : validate_seq: 1233 : : /* we revalidate valid mapping on new skb, because we must ensure 1234 : : * the current skb is completely covered by the available mapping 1235 : : */ - 1236 [ - + ]: 116255 : if (!validate_mapping(ssk, skb)) { + 1236 [ - + ]: 148209 : if (!validate_mapping(ssk, skb)) { 1237 [ # # ]: 0 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DSSTCPMISMATCH); 1238 : 0 : return MAPPING_INVALID; 1239 : : } 1240 : : - 1241 : 116255 : skb_ext_del(skb, SKB_EXT_MPTCP); + 1241 : 148209 : skb_ext_del(skb, SKB_EXT_MPTCP); 1242 : : - 1243 : 534615 : validate_csum: - 1244 : 534615 : return validate_data_csum(ssk, skb, csum_reqd); + 1243 : 500508 : validate_csum: + 1244 : 500508 : return validate_data_csum(ssk, skb, csum_reqd); 1245 : : } 1246 : : - 1247 : 1322 : static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, + 1247 : 2235 : static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, 1248 : : u64 limit) 1249 : : { - 1250 [ - + ]: 1322 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1251 : 1322 : bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; - 1252 [ - + ]: 1322 : struct tcp_sock *tp = tcp_sk(ssk); - 1253 : 1322 : u32 offset, incr, avail_len; + 1250 [ - + ]: 2235 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1251 : 2235 : bool fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; + 1252 [ - + ]: 2235 : struct tcp_sock *tp = tcp_sk(ssk); + 1253 : 2235 : u32 offset, incr, avail_len; 1254 : : - 1255 : 1322 : offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; - 1256 [ - + - + ]: 1322 : if (WARN_ON_ONCE(offset > skb->len)) + 1255 : 2235 : offset = tp->copied_seq - TCP_SKB_CB(skb)->seq; + 1256 [ - + - + ]: 2235 : if (WARN_ON_ONCE(offset > skb->len)) 1257 : 0 : goto out; 1258 : : - 1259 : 1322 : avail_len = skb->len - offset; - 1260 [ + + ]: 1322 : incr = limit >= avail_len ? avail_len + fin : limit; + 1259 : 2235 : avail_len = skb->len - offset; + 1260 [ + + ]: 2235 : incr = limit >= avail_len ? avail_len + fin : limit; 1261 : : - 1262 [ - + ]: 1322 : pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len, + 1262 [ - + ]: 2235 : pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len, 1263 : : offset, subflow->map_subflow_seq); - 1264 [ + - ]: 1322 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); - 1265 [ - + ]: 1322 : tcp_sk(ssk)->copied_seq += incr; + 1264 [ + - ]: 2235 : MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); + 1265 [ - + ]: 2235 : tcp_sk(ssk)->copied_seq += incr; 1266 : : - 1267 : 1322 : out: - 1268 [ - + + + ]: 1322 : if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) - 1269 : 1174 : sk_eat_skb(ssk, skb); - 1270 [ + + ]: 1322 : if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) - 1271 : 240 : subflow->map_valid = 0; - 1272 : 1322 : } + 1267 : 2235 : out: + 1268 [ - + + + ]: 2235 : if (!before(tcp_sk(ssk)->copied_seq, TCP_SKB_CB(skb)->end_seq)) + 1269 : 2068 : sk_eat_skb(ssk, skb); + 1270 [ + + ]: 2235 : if (mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) + 1271 : 425 : subflow->map_valid = 0; + 1272 : 2235 : } 1273 : : 1274 : : /* sched mptcp worker to remove the subflow if no more data is pending */ - 1275 : 548657 : static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) + 1275 : 510656 : static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) 1276 : : { - 1277 : 548657 : struct sock *sk = (struct sock *)msk; + 1277 : 510656 : struct sock *sk = (struct sock *)msk; 1278 : : - 1279 [ + + + + : 551306 : if (likely(ssk->sk_state != TCP_CLOSE && - + + ] + 1279 [ + + + + : 513236 : if (likely(ssk->sk_state != TCP_CLOSE && + + + ] 1280 : : (ssk->sk_state != TCP_CLOSE_WAIT || 1281 : : inet_sk_state_load(sk) != TCP_ESTABLISHED))) - 1282 : 546908 : return; + 1282 : 508965 : return; 1283 : : - 1284 [ + + + + ]: 3422 : if (skb_queue_empty(&ssk->sk_receive_queue) && - 1285 [ + + ]: 1761 : !test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) - 1286 : 639 : mptcp_schedule_work(sk); + 1284 [ + + + + ]: 3310 : if (skb_queue_empty(&ssk->sk_receive_queue) && + 1285 [ + + ]: 1703 : !test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) + 1286 : 622 : mptcp_schedule_work(sk); 1287 : : } 1288 : : 1289 : 8 : static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) @@ -1415,59 +1415,59 @@ 1325 : 2 : mptcp_reset_tout_timer(msk, subflow->fail_tout); 1326 : : } 1327 : : - 1328 : 1081446 : static bool subflow_check_data_avail(struct sock *ssk) + 1328 : 1015204 : static bool subflow_check_data_avail(struct sock *ssk) 1329 : : { - 1330 [ + + ]: 1081446 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1331 : 1081446 : enum mapping_status status; - 1332 : 1081446 : struct mptcp_sock *msk; - 1333 : 1081446 : struct sk_buff *skb; + 1330 [ + + ]: 1015204 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1331 : 1015204 : enum mapping_status status; + 1332 : 1015204 : struct mptcp_sock *msk; + 1333 : 1015204 : struct sk_buff *skb; 1334 : : - 1335 [ + + - + ]: 1081446 : if (!skb_peek(&ssk->sk_receive_queue)) - 1336 : 540370 : WRITE_ONCE(subflow->data_avail, false); - 1337 [ + + + + ]: 1081446 : if (subflow->data_avail) + 1335 [ + + - + ]: 1015204 : if (!skb_peek(&ssk->sk_receive_queue)) + 1336 : 501596 : WRITE_ONCE(subflow->data_avail, false); + 1337 [ + + + + ]: 1015204 : if (subflow->data_avail) 1338 : : return true; 1339 : : - 1340 [ - + ]: 1080085 : msk = mptcp_sk(subflow->conn); - 1341 : 1082610 : for (;;) { - 1342 : 1081407 : u64 ack_seq; - 1343 : 1081407 : u64 old_ack; + 1340 [ - + ]: 1007516 : msk = mptcp_sk(subflow->conn); + 1341 : 1011869 : for (;;) { + 1342 : 1009751 : u64 ack_seq; + 1343 : 1009751 : u64 old_ack; 1344 : : - 1345 : 1081407 : status = get_mapping_status(ssk, msk); - 1346 [ + + ]: 1623828 : trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); - 1347 [ + + + + ]: 1081407 : if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY || + 1345 : 1009751 : status = get_mapping_status(ssk, msk); + 1346 [ + + ]: 1514225 : trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue)); + 1347 [ + + + + ]: 1009751 : if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY || 1348 : : status == MAPPING_BAD_CSUM || status == MAPPING_NODSS)) - 1349 : 4363 : goto fallback; + 1349 : 4761 : goto fallback; 1350 : : - 1351 [ + + ]: 1077044 : if (status != MAPPING_OK) - 1352 : 543905 : goto no_data; + 1351 [ + + ]: 1004990 : if (status != MAPPING_OK) + 1352 : 505956 : goto no_data; 1353 : : - 1354 [ + - ]: 533139 : skb = skb_peek(&ssk->sk_receive_queue); - 1355 [ - + ]: 533139 : if (WARN_ON_ONCE(!skb)) + 1354 [ + - ]: 499034 : skb = skb_peek(&ssk->sk_receive_queue); + 1355 [ - + ]: 499034 : if (WARN_ON_ONCE(!skb)) 1356 : 0 : goto no_data; 1357 : : - 1358 [ - + - + ]: 533139 : if (unlikely(!READ_ONCE(msk->can_ack))) + 1358 [ - + - + ]: 499034 : if (unlikely(!READ_ONCE(msk->can_ack))) 1359 : 0 : goto fallback; 1360 : : - 1361 : 533139 : old_ack = READ_ONCE(msk->ack_seq); - 1362 : 533139 : ack_seq = mptcp_subflow_get_mapped_dsn(subflow); - 1363 [ - + ]: 533139 : pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack, + 1361 : 499034 : old_ack = READ_ONCE(msk->ack_seq); + 1362 : 499034 : ack_seq = mptcp_subflow_get_mapped_dsn(subflow); + 1363 [ - + ]: 499034 : pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack, 1364 : : ack_seq); - 1365 [ + + ]: 533139 : if (unlikely(before64(ack_seq, old_ack))) { - 1366 : 1322 : mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); - 1367 : 1322 : continue; + 1365 [ + + ]: 499034 : if (unlikely(before64(ack_seq, old_ack))) { + 1366 : 2235 : mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); + 1367 : 2235 : continue; 1368 : : } 1369 : : - 1370 : 531817 : WRITE_ONCE(subflow->data_avail, true); - 1371 : 531817 : break; + 1370 : 496799 : WRITE_ONCE(subflow->data_avail, true); + 1371 : 496799 : break; 1372 : : } - 1373 : 531817 : return true; + 1373 : 496799 : return true; 1374 : : - 1375 : 543905 : no_data: - 1376 : 543905 : subflow_sched_work_if_closed(msk, ssk); - 1377 : 543905 : return false; + 1375 : 505956 : no_data: + 1376 : 505956 : subflow_sched_work_if_closed(msk, ssk); + 1377 : 505956 : return false; 1378 : : - 1379 : 4363 : fallback: - 1380 [ + + ]: 4363 : if (!__mptcp_check_fallback(msk)) { + 1379 : 4761 : fallback: + 1380 [ + + ]: 4761 : if (!__mptcp_check_fallback(msk)) { 1381 : : /* RFC 8684 section 3.7. */ 1382 [ + + ]: 12 : if (status == MAPPING_BAD_CSUM && 1383 [ + - ]: 4 : (subflow->mp_join || subflow->valid_csum_seen)) { @@ -1505,31 +1505,31 @@ 1415 : 8 : mptcp_do_fallback(ssk); 1416 : : } 1417 : : - 1418 [ - + ]: 4359 : skb = skb_peek(&ssk->sk_receive_queue); - 1419 : 4359 : subflow->map_valid = 1; - 1420 : 4359 : subflow->map_seq = READ_ONCE(msk->ack_seq); - 1421 : 4359 : subflow->map_data_len = skb->len; - 1422 [ - + ]: 4359 : subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; - 1423 : 4359 : WRITE_ONCE(subflow->data_avail, true); - 1424 : 4359 : return true; + 1418 [ - + ]: 4757 : skb = skb_peek(&ssk->sk_receive_queue); + 1419 : 4757 : subflow->map_valid = 1; + 1420 : 4757 : subflow->map_seq = READ_ONCE(msk->ack_seq); + 1421 : 4757 : subflow->map_data_len = skb->len; + 1422 [ - + ]: 4757 : subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset; + 1423 : 4757 : WRITE_ONCE(subflow->data_avail, true); + 1424 : 4757 : return true; 1425 : : } 1426 : : - 1427 : 1081446 : bool mptcp_subflow_data_available(struct sock *sk) + 1427 : 1015204 : bool mptcp_subflow_data_available(struct sock *sk) 1428 : : { - 1429 [ + + ]: 1081446 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1429 [ + + ]: 1015204 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); 1430 : : 1431 : : /* check if current mapping is still valid */ - 1432 [ + + ]: 1081446 : if (subflow->map_valid && - 1433 [ + + ]: 957369 : mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { - 1434 : 118751 : subflow->map_valid = 0; - 1435 : 118751 : WRITE_ONCE(subflow->data_avail, false); + 1432 [ + + ]: 1015204 : if (subflow->map_valid && + 1433 [ + + ]: 863004 : mptcp_subflow_get_map_offset(subflow) >= subflow->map_data_len) { + 1434 : 150901 : subflow->map_valid = 0; + 1435 : 150901 : WRITE_ONCE(subflow->data_avail, false); 1436 : : - 1437 [ - + ]: 118751 : pr_debug("Done with mapping: seq=%u data_len=%u\n", + 1437 [ - + ]: 150901 : pr_debug("Done with mapping: seq=%u data_len=%u\n", 1438 : : subflow->map_subflow_seq, 1439 : : subflow->map_data_len); 1440 : : } 1441 : : - 1442 : 1081446 : return subflow_check_data_avail(sk); + 1442 : 1015204 : return subflow_check_data_avail(sk); 1443 : : } 1444 : : 1445 : : /* If ssk has an mptcp parent socket, use the mptcp rcvbuf occupancy, @@ -1541,81 +1541,81 @@ 1451 : : * as far as mptcp peer is concerned that data is still inflight. 1452 : : * DSS ACK is updated when skb is moved to the mptcp rx queue. 1453 : : */ - 1454 : 1107975 : void mptcp_space(const struct sock *ssk, int *space, int *full_space) + 1454 : 1234494 : void mptcp_space(const struct sock *ssk, int *space, int *full_space) 1455 : : { - 1456 : 1107975 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 1457 : 1107975 : const struct sock *sk = subflow->conn; + 1456 : 1234494 : const struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 1457 : 1234494 : const struct sock *sk = subflow->conn; 1458 : : - 1459 : 1107975 : *space = __mptcp_space(sk); - 1460 : 1107975 : *full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); - 1461 : 1107975 : } + 1459 : 1234494 : *space = __mptcp_space(sk); + 1460 : 1234494 : *full_space = mptcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); + 1461 : 1234494 : } 1462 : : - 1463 : 1843 : static void subflow_error_report(struct sock *ssk) + 1463 : 1774 : static void subflow_error_report(struct sock *ssk) 1464 : : { - 1465 [ + + ]: 1843 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; + 1465 [ + + ]: 1774 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; 1466 : : 1467 : : /* bail early if this is a no-op, so that we avoid introducing a 1468 : : * problematic lockdep dependency between TCP accept queue lock 1469 : : * and msk socket spinlock 1470 : : */ - 1471 [ + + ]: 1843 : if (!sk->sk_socket) + 1471 [ + + ]: 1774 : if (!sk->sk_socket) 1472 : : return; 1473 : : - 1474 : 1022 : mptcp_data_lock(sk); - 1475 [ + + ]: 1022 : if (!sock_owned_by_user(sk)) - 1476 : 392 : __mptcp_error_report(sk); + 1474 : 973 : mptcp_data_lock(sk); + 1475 [ + + ]: 973 : if (!sock_owned_by_user(sk)) + 1476 : 378 : __mptcp_error_report(sk); 1477 : : else - 1478 [ - + ]: 630 : __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); - 1479 : 1022 : mptcp_data_unlock(sk); + 1478 [ - + ]: 595 : __set_bit(MPTCP_ERROR_REPORT, &mptcp_sk(sk)->cb_flags); + 1479 : 973 : mptcp_data_unlock(sk); 1480 : : } 1481 : : - 1482 : 540986 : static void subflow_data_ready(struct sock *sk) + 1482 : 506955 : static void subflow_data_ready(struct sock *sk) 1483 : : { - 1484 : 540986 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1485 [ - + ]: 540986 : u16 state = 1 << inet_sk_state_load(sk); - 1486 : 540986 : struct sock *parent = subflow->conn; - 1487 : 540986 : struct mptcp_sock *msk; + 1484 : 506955 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1485 [ - + ]: 506955 : u16 state = 1 << inet_sk_state_load(sk); + 1486 : 506955 : struct sock *parent = subflow->conn; + 1487 : 506955 : struct mptcp_sock *msk; 1488 : : - 1489 : 540986 : trace_sk_data_ready(sk); + 1489 : 506955 : trace_sk_data_ready(sk); 1490 : : - 1491 [ - + ]: 540986 : msk = mptcp_sk(parent); - 1492 [ + + ]: 540986 : if (state & TCPF_LISTEN) { + 1491 [ - + ]: 506955 : msk = mptcp_sk(parent); + 1492 [ + + ]: 506955 : if (state & TCPF_LISTEN) { 1493 : : /* MPJ subflow are removed from accept queue before reaching here, 1494 : : * avoid stray wakeups 1495 : : */ - 1496 [ + + ]: 1664 : if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue)) + 1496 [ + + ]: 1666 : if (reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue)) 1497 : : return; 1498 : : - 1499 : 1225 : parent->sk_data_ready(parent); - 1500 : 1225 : return; + 1499 : 1226 : parent->sk_data_ready(parent); + 1500 : 1226 : return; 1501 : : } 1502 : : - 1503 [ + + - + : 539322 : WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && + 1503 [ + + - + : 505289 : WARN_ON_ONCE(!__mptcp_check_fallback(msk) && !subflow->mp_capable && - - ] 1504 : : !subflow->mp_join && !(state & TCPF_CLOSE)); 1505 : : - 1506 [ + + ]: 539322 : if (mptcp_subflow_data_available(sk)) { - 1507 : 535721 : mptcp_data_ready(parent, sk); + 1506 [ + + ]: 505289 : if (mptcp_subflow_data_available(sk)) { + 1507 : 500867 : mptcp_data_ready(parent, sk); 1508 : : 1509 : : /* subflow-level lowat test are not relevant. 1510 : : * respect the msk-level threshold eventually mandating an immediate ack 1511 : : */ - 1512 [ + + ]: 535721 : if (mptcp_data_avail(msk) < parent->sk_rcvlowat && - 1513 [ - + - + : 59287 : (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) - + + ] - 1514 : 50446 : inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; - 1515 [ + + ]: 3601 : } else if (unlikely(sk->sk_err)) { + 1512 [ + + ]: 500867 : if (mptcp_data_avail(msk) < parent->sk_rcvlowat && + 1513 [ - + - + : 66930 : (tcp_sk(sk)->rcv_nxt - tcp_sk(sk)->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss) + + + ] + 1514 : 56381 : inet_csk(sk)->icsk_ack.pending |= ICSK_ACK_NOW; + 1515 [ + + ]: 4422 : } else if (unlikely(sk->sk_err)) { 1516 : 2 : subflow_error_report(sk); 1517 : : } 1518 : : } 1519 : : - 1520 : 360268 : static void subflow_write_space(struct sock *ssk) + 1520 : 436017 : static void subflow_write_space(struct sock *ssk) 1521 : : { - 1522 : 360268 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; + 1522 : 436017 : struct sock *sk = mptcp_subflow_ctx(ssk)->conn; 1523 : : - 1524 : 360268 : mptcp_propagate_sndbuf(sk, ssk); - 1525 : 360268 : mptcp_write_space(sk); - 1526 : 360268 : } + 1524 : 436017 : mptcp_propagate_sndbuf(sk, ssk); + 1525 : 436017 : mptcp_write_space(sk); + 1526 : 436017 : } 1527 : : 1528 : : static const struct inet_connection_sock_af_ops * 1529 : 0 : subflow_default_af_ops(struct sock *sk) @@ -1656,11 +1656,11 @@ 1564 [ + + ]: 1038 : if (addr->ss_family == AF_INET) { 1565 : 920 : struct sockaddr_in *in_addr = (struct sockaddr_in *)addr; 1566 : : - 1567 [ + + ]: 920 : if (info->family == AF_INET) - 1568 : 899 : in_addr->sin_addr = info->addr; + 1567 [ + + ]: 920 : if (info->family == AF_INET) + 1568 : 900 : in_addr->sin_addr = info->addr; 1569 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) - 1570 [ + - ]: 21 : else if (ipv6_addr_v4mapped(&info->addr6)) - 1571 : 21 : in_addr->sin_addr.s_addr = info->addr6.s6_addr32[3]; + 1570 [ + - ]: 20 : else if (ipv6_addr_v4mapped(&info->addr6)) + 1571 : 20 : in_addr->sin_addr.s_addr = info->addr6.s6_addr32[3]; 1572 : : #endif 1573 : 920 : in_addr->sin_port = info->port; 1574 : : } @@ -1678,30 +1678,30 @@ 1586 : : #endif 1587 : 1038 : } 1588 : : - 1589 : 518 : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, + 1589 : 520 : int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_pm_local *local, 1590 : : const struct mptcp_addr_info *remote) 1591 : : { - 1592 [ - + ]: 518 : struct mptcp_sock *msk = mptcp_sk(sk); - 1593 : 518 : struct mptcp_subflow_context *subflow; - 1594 : 518 : int local_id = local->addr.id; - 1595 : 518 : struct sockaddr_storage addr; - 1596 : 518 : int remote_id = remote->id; - 1597 : 518 : int err = -ENOTCONN; - 1598 : 518 : struct socket *sf; - 1599 : 518 : struct sock *ssk; - 1600 : 518 : u32 remote_token; - 1601 : 518 : int addrlen; + 1592 [ - + ]: 520 : struct mptcp_sock *msk = mptcp_sk(sk); + 1593 : 520 : struct mptcp_subflow_context *subflow; + 1594 : 520 : int local_id = local->addr.id; + 1595 : 520 : struct sockaddr_storage addr; + 1596 : 520 : int remote_id = remote->id; + 1597 : 520 : int err = -ENOTCONN; + 1598 : 520 : struct socket *sf; + 1599 : 520 : struct sock *ssk; + 1600 : 520 : u32 remote_token; + 1601 : 520 : int addrlen; 1602 : : 1603 : : /* The userspace PM sent the request too early? */ - 1604 [ - + ]: 518 : if (!mptcp_is_fully_established(sk)) + 1604 [ - + ]: 520 : if (!mptcp_is_fully_established(sk)) 1605 : 0 : goto err_out; 1606 : : - 1607 : 518 : err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); - 1608 [ + + ]: 518 : if (err) { - 1609 [ + - ]: 9 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); - 1610 [ - + ]: 9 : pr_debug("msk=%p local=%d remote=%d create sock error: %d\n", + 1607 : 520 : err = mptcp_subflow_create_socket(sk, local->addr.family, &sf); + 1608 [ + + ]: 520 : if (err) { + 1609 [ + - ]: 11 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTXCREATSKERR); + 1610 [ - + ]: 11 : pr_debug("msk=%p local=%d remote=%d create sock error: %d\n", 1611 : : msk, local_id, remote_id, err); - 1612 : 9 : goto err_out; + 1612 : 11 : goto err_out; 1613 : : } 1614 : : 1615 : 509 : ssk = sf->sk; @@ -1712,7 +1712,7 @@ 1620 : : 1621 : : /* if 'IPADDRANY', the ID will be set later, after the routing */ 1622 [ + + ]: 509 : if (local->addr.family == AF_INET) { - 1623 [ + + ]: 450 : if (!local->addr.addr.s_addr) + 1623 [ + + ]: 450 : if (!local->addr.addr.s_addr) 1624 : : local_id = -1; 1625 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 1626 [ + + ]: 59 : } else if (sk->sk_family == AF_INET6) { @@ -1721,8 +1721,8 @@ 1629 : : #endif 1630 : : } 1631 : : - 1632 : 265 : if (local_id >= 0) - 1633 : 265 : subflow_set_local_id(subflow, local_id); + 1632 : 264 : if (local_id >= 0) + 1633 : 264 : subflow_set_local_id(subflow, local_id); 1634 : : 1635 : 509 : subflow->remote_key_valid = 1; 1636 : 509 : subflow->remote_key = READ_ONCE(msk->remote_key); @@ -1764,7 +1764,7 @@ 1672 : 26 : goto failed_unlink; 1673 : : } 1674 : : - 1675 [ + - ]: 481 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); + 1675 [ + - ]: 481 : MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNTX); 1676 : : 1677 : : /* discard the subflow socket */ 1678 : 481 : mptcp_sock_graft(ssk, sk->sk_socket); @@ -1781,12 +1781,12 @@ 1689 : 28 : subflow->disposable = 1; 1690 : 28 : sock_release(sf); 1691 : : - 1692 : 37 : err_out: + 1692 : 39 : err_out: 1693 : : /* we account subflows before the creation, and this failures will not 1694 : : * be caught by sk_state_change() 1695 : : */ - 1696 : 37 : mptcp_pm_close_subflow(msk); - 1697 : 37 : return err; + 1696 : 39 : mptcp_pm_close_subflow(msk); + 1697 : 39 : return err; 1698 : : } 1699 : : 1700 : 2943 : static void mptcp_attach_cgroup(struct sock *parent, struct sock *child) @@ -1827,24 +1827,24 @@ 1735 : : { 1736 : : #if IS_ENABLED(CONFIG_MPTCP_IPV6) 1737 [ + + ]: 138 : if (ssk->sk_prot == &tcpv6_prot_override) - 1738 : 1813 : ssk->sk_prot = &tcpv6_prot; + 1738 : 1814 : ssk->sk_prot = &tcpv6_prot; 1739 : : else 1740 : : #endif - 1741 : 2702 : ssk->sk_prot = &tcp_prot; + 1741 : 2703 : ssk->sk_prot = &tcp_prot; 1742 : : } 1743 : : - 1744 : 2952 : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, + 1744 : 2954 : int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, 1745 : : struct socket **new_sock) 1746 : : { - 1747 : 2952 : struct mptcp_subflow_context *subflow; - 1748 [ + + ]: 2952 : struct net *net = sock_net(sk); - 1749 : 2952 : struct socket *sf; - 1750 : 2952 : int err; + 1747 : 2954 : struct mptcp_subflow_context *subflow; + 1748 [ + + ]: 2954 : struct net *net = sock_net(sk); + 1749 : 2954 : struct socket *sf; + 1750 : 2954 : int err; 1751 : : 1752 : : /* un-accepted server sockets can reach here - on bad configuration 1753 : : * bail early to avoid greater trouble later 1754 : : */ - 1755 [ + + ]: 2952 : if (unlikely(!sk->sk_socket)) + 1755 [ + + ]: 2954 : if (unlikely(!sk->sk_socket)) 1756 : : return -EINVAL; 1757 : : 1758 : 2943 : err = sock_create_kern(net, family, SOCK_STREAM, IPPROTO_TCP, &sf); @@ -1901,56 +1901,56 @@ 1809 : 0 : return err; 1810 : : } 1811 : : - 1812 : 4539 : static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk, + 1812 : 4541 : static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk, 1813 : : gfp_t priority) 1814 : : { - 1815 : 4539 : struct inet_connection_sock *icsk = inet_csk(sk); - 1816 : 4539 : struct mptcp_subflow_context *ctx; + 1815 : 4541 : struct inet_connection_sock *icsk = inet_csk(sk); + 1816 : 4541 : struct mptcp_subflow_context *ctx; 1817 : : - 1818 : 4539 : ctx = kzalloc(sizeof(*ctx), priority); - 1819 [ + - ]: 4539 : if (!ctx) + 1818 : 4541 : ctx = kzalloc(sizeof(*ctx), priority); + 1819 [ + - ]: 4541 : if (!ctx) 1820 : : return NULL; 1821 : : - 1822 : 4539 : rcu_assign_pointer(icsk->icsk_ulp_data, ctx); - 1823 [ - + ]: 4539 : INIT_LIST_HEAD(&ctx->node); - 1824 : 4539 : INIT_LIST_HEAD(&ctx->delegated_node); + 1822 : 4541 : rcu_assign_pointer(icsk->icsk_ulp_data, ctx); + 1823 [ - + ]: 4541 : INIT_LIST_HEAD(&ctx->node); + 1824 : 4541 : INIT_LIST_HEAD(&ctx->delegated_node); 1825 : : - 1826 [ - + ]: 4539 : pr_debug("subflow=%p\n", ctx); + 1826 [ - + ]: 4541 : pr_debug("subflow=%p\n", ctx); 1827 : : - 1828 : 4539 : ctx->tcp_sock = sk; - 1829 : 4539 : WRITE_ONCE(ctx->local_id, -1); + 1828 : 4541 : ctx->tcp_sock = sk; + 1829 : 4541 : WRITE_ONCE(ctx->local_id, -1); 1830 : : - 1831 : 4539 : return ctx; + 1831 : 4541 : return ctx; 1832 : : } 1833 : : - 1834 : 4752 : static void __subflow_state_change(struct sock *sk) + 1834 : 4700 : static void __subflow_state_change(struct sock *sk) 1835 : : { - 1836 : 4752 : struct socket_wq *wq; + 1836 : 4700 : struct socket_wq *wq; 1837 : : - 1838 : 4752 : rcu_read_lock(); - 1839 [ + - - + : 4752 : wq = rcu_dereference(sk->sk_wq); + 1838 : 4700 : rcu_read_lock(); + 1839 [ + - - + : 4700 : wq = rcu_dereference(sk->sk_wq); - - - - - - ] - 1840 [ + + ]: 4752 : if (skwq_has_sleeper(wq)) - 1841 : 371 : wake_up_interruptible_all(&wq->wait); - 1842 : 4752 : rcu_read_unlock(); - 1843 : 4752 : } + 1840 [ + + ]: 4700 : if (skwq_has_sleeper(wq)) + 1841 : 386 : wake_up_interruptible_all(&wq->wait); + 1842 : 4700 : rcu_read_unlock(); + 1843 : 4700 : } 1844 : : 1845 : 0 : static bool subflow_is_done(const struct sock *sk) 1846 : : { - 1847 [ + + - + ]: 295 : return sk->sk_shutdown & RCV_SHUTDOWN || sk->sk_state == TCP_CLOSE; + 1847 [ + + - + ]: 284 : return sk->sk_shutdown & RCV_SHUTDOWN || sk->sk_state == TCP_CLOSE; 1848 : : } 1849 : : - 1850 : 4752 : static void subflow_state_change(struct sock *sk) + 1850 : 4700 : static void subflow_state_change(struct sock *sk) 1851 : : { - 1852 : 4752 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - 1853 : 4752 : struct sock *parent = subflow->conn; - 1854 : 4752 : struct mptcp_sock *msk; + 1852 : 4700 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); + 1853 : 4700 : struct sock *parent = subflow->conn; + 1854 : 4700 : struct mptcp_sock *msk; 1855 : : - 1856 : 4752 : __subflow_state_change(sk); + 1856 : 4700 : __subflow_state_change(sk); 1857 : : - 1858 [ - + ]: 4752 : msk = mptcp_sk(parent); - 1859 [ - + ]: 4752 : if (subflow_simultaneous_connect(sk)) { + 1858 [ - + ]: 4700 : msk = mptcp_sk(parent); + 1859 [ - + ]: 4700 : if (subflow_simultaneous_connect(sk)) { 1860 : 0 : mptcp_do_fallback(sk); 1861 [ # # ]: 0 : pr_fallback(msk); 1862 : 0 : subflow->conn_finished = 1; @@ -1961,21 +1961,21 @@ 1867 : : * a fin packet carrying a DSS can be unnoticed if we don't trigger 1868 : : * the data available machinery here. 1869 : : */ - 1870 [ + + ]: 4752 : if (mptcp_subflow_data_available(sk)) + 1870 [ + + ]: 4700 : if (mptcp_subflow_data_available(sk)) 1871 : 70 : mptcp_data_ready(parent, sk); - 1872 [ + + ]: 4682 : else if (unlikely(sk->sk_err)) - 1873 : 462 : subflow_error_report(sk); + 1872 [ + + ]: 4630 : else if (unlikely(sk->sk_err)) + 1873 : 444 : subflow_error_report(sk); 1874 : : - 1875 [ - + ]: 4752 : subflow_sched_work_if_closed(mptcp_sk(parent), sk); + 1875 [ - + ]: 4700 : subflow_sched_work_if_closed(mptcp_sk(parent), sk); 1876 : : 1877 : : /* when the fallback subflow closes the rx side, trigger a 'dummy' 1878 : : * ingress data fin, so that the msk state will follow along 1879 : : */ - 1880 [ + + + - : 5044 : if (__mptcp_check_fallback(msk) && subflow_is_done(sk) && msk->first == sk && - + + ] - 1881 : 146 : mptcp_update_rcv_data_fin(msk, READ_ONCE(msk->ack_seq), true)) - 1882 : 85 : mptcp_schedule_work(parent); - 1883 : 4752 : } + 1880 [ + + + - : 4978 : if (__mptcp_check_fallback(msk) && subflow_is_done(sk) && msk->first == sk && + + + ] + 1881 : 139 : mptcp_update_rcv_data_fin(msk, READ_ONCE(msk->ack_seq), true)) + 1882 : 82 : mptcp_schedule_work(parent); + 1883 : 4700 : } 1884 : : 1885 : 1208 : void mptcp_subflow_queue_clean(struct sock *listener_sk, struct sock *listener_ssk) 1886 : : { @@ -2088,22 +2088,22 @@ 1993 : 3255 : return err; 1994 : : } 1995 : : - 1996 : 4385 : static void subflow_ulp_release(struct sock *ssk) + 1996 : 4387 : static void subflow_ulp_release(struct sock *ssk) 1997 : : { - 1998 [ + - ]: 4385 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(ssk); - 1999 : 4385 : bool release = true; - 2000 : 4385 : struct sock *sk; + 1998 [ + - ]: 4387 : struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(ssk); + 1999 : 4387 : bool release = true; + 2000 : 4387 : struct sock *sk; 2001 : : - 2002 [ + - ]: 4385 : if (!ctx) + 2002 [ + - ]: 4387 : if (!ctx) 2003 : : return; 2004 : : - 2005 : 4385 : sk = ctx->conn; - 2006 [ + - ]: 4385 : if (sk) { + 2005 : 4387 : sk = ctx->conn; + 2006 [ + - ]: 4387 : 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 [ - + - - ]: 4385 : release = ctx->disposable || list_empty(&ctx->node); + 2011 [ - + - - ]: 4387 : 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 @@ -2111,41 +2111,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 : 4385 : sock_put(sk); + 2019 : 4387 : sock_put(sk); 2020 : : } 2021 : : - 2022 [ + + ]: 4385 : mptcp_subflow_ops_undo_override(ssk); - 2023 [ + - ]: 4385 : if (release) - 2024 : 4385 : kfree_rcu(ctx, rcu); + 2022 [ + + ]: 4387 : mptcp_subflow_ops_undo_override(ssk); + 2023 [ + - ]: 4387 : if (release) + 2024 : 4387 : kfree_rcu(ctx, rcu); 2025 : : } 2026 : : - 2027 : 1672 : static void subflow_ulp_clone(const struct request_sock *req, + 2027 : 1674 : static void subflow_ulp_clone(const struct request_sock *req, 2028 : : struct sock *newsk, 2029 : : const gfp_t priority) 2030 : : { - 2031 : 1672 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 2032 [ + + ]: 1672 : struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk); - 2033 : 1672 : struct mptcp_subflow_context *new_ctx; + 2031 : 1674 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 2032 [ + + ]: 1674 : struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk); + 2033 : 1674 : struct mptcp_subflow_context *new_ctx; 2034 : : - 2035 [ + + + - ]: 1672 : if (!tcp_rsk(req)->is_mptcp || - 2036 [ + + ]: 1672 : (!subflow_req->mp_capable && !subflow_req->mp_join)) { + 2035 [ + + + - ]: 1674 : if (!tcp_rsk(req)->is_mptcp || + 2036 [ + + ]: 1674 : (!subflow_req->mp_capable && !subflow_req->mp_join)) { 2037 : 76 : subflow_ulp_fallback(newsk, old_ctx); 2038 : 76 : return; 2039 : : } 2040 : : - 2041 : 1596 : new_ctx = subflow_create_ctx(newsk, priority); - 2042 [ - + ]: 1596 : if (!new_ctx) { + 2041 : 1598 : new_ctx = subflow_create_ctx(newsk, priority); + 2042 [ - + ]: 1598 : if (!new_ctx) { 2043 : 0 : subflow_ulp_fallback(newsk, old_ctx); 2044 : 0 : return; 2045 : : } 2046 : : - 2047 : 1596 : new_ctx->conn_finished = 1; - 2048 : 1596 : new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; - 2049 : 1596 : new_ctx->tcp_state_change = old_ctx->tcp_state_change; - 2050 : 1596 : new_ctx->tcp_error_report = old_ctx->tcp_error_report; - 2051 : 1596 : new_ctx->rel_write_seq = 1; + 2047 : 1598 : new_ctx->conn_finished = 1; + 2048 : 1598 : new_ctx->icsk_af_ops = old_ctx->icsk_af_ops; + 2049 : 1598 : new_ctx->tcp_state_change = old_ctx->tcp_state_change; + 2050 : 1598 : new_ctx->tcp_error_report = old_ctx->tcp_error_report; + 2051 : 1598 : new_ctx->rel_write_seq = 1; 2052 : : - 2053 [ + + ]: 1596 : if (subflow_req->mp_capable) { + 2053 [ + + ]: 1598 : 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 : : */ @@ -2157,39 +2157,39 @@ 2062 : : 2063 : : /* this is the first subflow, id is always 0 */ 2064 : 1138 : subflow_set_local_id(new_ctx, 0); - 2065 [ + - ]: 458 : } else if (subflow_req->mp_join) { - 2066 : 458 : new_ctx->ssn_offset = subflow_req->ssn_offset; - 2067 : 458 : new_ctx->mp_join = 1; - 2068 : 458 : WRITE_ONCE(new_ctx->fully_established, true); - 2069 : 458 : new_ctx->remote_key_valid = 1; - 2070 : 458 : new_ctx->backup = subflow_req->backup; - 2071 : 458 : new_ctx->request_bkup = subflow_req->request_bkup; - 2072 : 458 : WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id); - 2073 : 458 : new_ctx->token = subflow_req->token; - 2074 : 458 : new_ctx->thmac = subflow_req->thmac; + 2065 [ + - ]: 460 : } else if (subflow_req->mp_join) { + 2066 : 460 : new_ctx->ssn_offset = subflow_req->ssn_offset; + 2067 : 460 : new_ctx->mp_join = 1; + 2068 : 460 : WRITE_ONCE(new_ctx->fully_established, true); + 2069 : 460 : new_ctx->remote_key_valid = 1; + 2070 : 460 : new_ctx->backup = subflow_req->backup; + 2071 : 460 : new_ctx->request_bkup = subflow_req->request_bkup; + 2072 : 460 : WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id); + 2073 : 460 : new_ctx->token = subflow_req->token; + 2074 : 460 : 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 : 458 : subflow_set_local_id(new_ctx, subflow_req->local_id); + 2079 : 460 : subflow_set_local_id(new_ctx, subflow_req->local_id); 2080 : : } 2081 : : } 2082 : : - 2083 : 179298 : static void tcp_release_cb_override(struct sock *ssk) + 2083 : 279918 : static void tcp_release_cb_override(struct sock *ssk) 2084 : : { - 2085 : 179298 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); - 2086 : 179298 : long status; + 2085 : 279918 : struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); + 2086 : 279918 : 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 [ - + - + ]: 179298 : status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0); - 2093 [ + + ]: 179298 : if (status) - 2094 : 2147 : mptcp_subflow_process_delegated(ssk, status); + 2092 [ - + - + ]: 279918 : status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0); + 2093 [ + + ]: 279918 : if (status) + 2094 : 2192 : mptcp_subflow_process_delegated(ssk, status); 2095 : : - 2096 : 179298 : tcp_release_cb(ssk); - 2097 : 179298 : } + 2096 : 279918 : tcp_release_cb(ssk); + 2097 : 279918 : } 2098 : : 2099 : 0 : static int tcp_abort_override(struct sock *ssk, int err) 2100 : : { diff --git a/html/lcov/export-net/mptcp/syncookies.c.func-c.html b/html/lcov/export-net/mptcp/syncookies.c.func-c.html index 2aa373e4..a42d8513 100644 --- a/html/lcov/export-net/mptcp/syncookies.c.func-c.html +++ b/html/lcov/export-net/mptcp/syncookies.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/syncookies.c.func.html b/html/lcov/export-net/mptcp/syncookies.c.func.html index fcc18933..8daf3ffe 100644 --- a/html/lcov/export-net/mptcp/syncookies.c.func.html +++ b/html/lcov/export-net/mptcp/syncookies.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/syncookies.c.gcov.html b/html/lcov/export-net/mptcp/syncookies.c.gcov.html index b5dc528f..eee991d5 100644 --- a/html/lcov/export-net/mptcp/syncookies.c.gcov.html +++ b/html/lcov/export-net/mptcp/syncookies.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/token.c.func-c.html b/html/lcov/export-net/mptcp/token.c.func-c.html index 0efda856..610ed09b 100644 --- a/html/lcov/export-net/mptcp/token.c.func-c.html +++ b/html/lcov/export-net/mptcp/token.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -95,7 +95,7 @@ mptcp_token_get_sock - 638 + 640 @@ -130,7 +130,7 @@ mptcp_token_destroy_request - 1740 + 1742 @@ -144,7 +144,7 @@ mptcp_token_destroy - 3777 + 3770 @@ -158,7 +158,7 @@ mptcp_token_iter_next - 5573 + 5502 diff --git a/html/lcov/export-net/mptcp/token.c.func.html b/html/lcov/export-net/mptcp/token.c.func.html index 318f342c..75e2a0ee 100644 --- a/html/lcov/export-net/mptcp/token.c.func.html +++ b/html/lcov/export-net/mptcp/token.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -109,14 +109,14 @@ mptcp_token_destroy - 3777 + 3770 mptcp_token_destroy_request - 1740 + 1742 @@ -130,7 +130,7 @@ mptcp_token_get_sock - 638 + 640 @@ -144,7 +144,7 @@ mptcp_token_iter_next - 5573 + 5502 diff --git a/html/lcov/export-net/mptcp/token.c.gcov.html b/html/lcov/export-net/mptcp/token.c.gcov.html index 7eccd86a..657503b4 100644 --- a/html/lcov/export-net/mptcp/token.c.gcov.html +++ b/html/lcov/export-net/mptcp/token.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % @@ -125,7 +125,7 @@ 47 : : 48 : 0 : static struct token_bucket *token_bucket(u32 token) 49 : : { - 50 : 6389 : return &token_hash[token & token_mask]; + 50 : 6391 : return &token_hash[token & token_mask]; 51 : : } 52 : : 53 : : /* called with bucket lock held */ @@ -150,8 +150,8 @@ 70 : 4687 : struct hlist_nulls_node *pos; 71 : 4687 : struct sock *sk; 72 : : - 73 [ + + ]: 4697 : sk_nulls_for_each_rcu(sk, pos, &t->msk_chain) - 74 [ + + - + ]: 2311 : if (mptcp_sk(sk)->token == token) + 73 [ + + ]: 4706 : sk_nulls_for_each_rcu(sk, pos, &t->msk_chain) + 74 [ + + - + ]: 2320 : if (mptcp_sk(sk)->token == token) 75 [ - + ]: 2301 : return mptcp_sk(sk); 76 : : return NULL; 77 : : } @@ -324,32 +324,32 @@ 243 : : * 244 : : * returns NULL if no connection with the given token value exists. 245 : : */ - 246 : 638 : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) + 246 : 640 : struct mptcp_sock *mptcp_token_get_sock(struct net *net, u32 token) 247 : : { - 248 : 638 : struct hlist_nulls_node *pos; - 249 : 638 : struct token_bucket *bucket; - 250 : 638 : struct mptcp_sock *msk; - 251 : 638 : struct sock *sk; + 248 : 640 : struct hlist_nulls_node *pos; + 249 : 640 : struct token_bucket *bucket; + 250 : 640 : struct mptcp_sock *msk; + 251 : 640 : struct sock *sk; 252 : : - 253 : 638 : rcu_read_lock(); - 254 : 638 : bucket = token_bucket(token); + 253 : 640 : rcu_read_lock(); + 254 : 640 : bucket = token_bucket(token); 255 : : 256 : : again: - 257 [ + + ]: 638 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { - 258 [ - + ]: 624 : msk = mptcp_sk(sk); - 259 [ + - - + ]: 933 : if (READ_ONCE(msk->token) != token || + 257 [ + + ]: 640 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + 258 [ - + ]: 626 : msk = mptcp_sk(sk); + 259 [ + - - + ]: 936 : if (READ_ONCE(msk->token) != token || 260 [ - + ]: 6 : !net_eq(sock_net(sk), net)) 261 : 0 : continue; 262 : : - 263 [ + + ]: 624 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 263 [ + + ]: 626 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 264 : 2 : goto not_found; 265 : : - 266 [ + - - + ]: 930 : if (READ_ONCE(msk->token) != token || + 266 [ + - - + ]: 933 : if (READ_ONCE(msk->token) != token || 267 [ - + ]: 6 : !net_eq(sock_net(sk), net)) { 268 : 0 : sock_put(sk); 269 : 0 : goto again; 270 : : } - 271 : 622 : goto found; + 271 : 624 : 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 : 638 : found: - 280 : 638 : rcu_read_unlock(); - 281 : 638 : return msk; + 279 : 640 : found: + 280 : 640 : rcu_read_unlock(); + 281 : 640 : 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 : 5573 : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, + 297 : 5502 : struct mptcp_sock *mptcp_token_iter_next(const struct net *net, long *s_slot, 298 : : long *s_num) 299 : : { - 300 : 5573 : struct mptcp_sock *ret = NULL; - 301 : 5573 : struct hlist_nulls_node *pos; - 302 : 5573 : int slot, num = 0; + 300 : 5502 : struct mptcp_sock *ret = NULL; + 301 : 5502 : struct hlist_nulls_node *pos; + 302 : 5502 : int slot, num = 0; 303 : : - 304 [ + + ]: 9393605 : for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { - 305 : 9391080 : struct token_bucket *bucket = &token_hash[slot]; - 306 : 9391080 : struct sock *sk; + 304 [ + + ]: 9385342 : for (slot = *s_slot; slot <= token_mask; *s_num = 0, slot++) { + 305 : 9382819 : struct token_bucket *bucket = &token_hash[slot]; + 306 : 9382819 : struct sock *sk; 307 : : - 308 : 9391080 : num = 0; + 308 : 9382819 : num = 0; 309 : : - 310 [ + + ]: 9391080 : if (hlist_nulls_empty(&bucket->msk_chain)) - 311 : 9383362 : continue; + 310 [ + + ]: 9382819 : if (hlist_nulls_empty(&bucket->msk_chain)) + 311 : 9375243 : continue; 312 : : - 313 : 7718 : rcu_read_lock(); - 314 [ + + ]: 12436 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { - 315 : 7766 : ++num; - 316 [ + + ]: 7766 : if (!net_eq(sock_net(sk), net)) - 317 : 1658 : continue; + 313 : 7576 : rcu_read_lock(); + 314 [ + + ]: 12249 : sk_nulls_for_each_rcu(sk, pos, &bucket->msk_chain) { + 315 : 7652 : ++num; + 316 [ + + ]: 7652 : if (!net_eq(sock_net(sk), net)) + 317 : 1667 : continue; 318 : : - 319 [ + + ]: 6108 : if (num <= *s_num) - 320 : 3060 : continue; + 319 [ + + ]: 5985 : if (num <= *s_num) + 320 : 3006 : continue; 321 : : - 322 [ - + ]: 3048 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) + 322 [ - + ]: 2979 : if (!refcount_inc_not_zero(&sk->sk_refcnt)) 323 : 0 : continue; 324 : : - 325 [ - + ]: 3048 : if (!net_eq(sock_net(sk), net)) { + 325 [ - + ]: 2979 : if (!net_eq(sock_net(sk), net)) { 326 : 0 : sock_put(sk); 327 : 0 : continue; 328 : : } 329 : : - 330 [ - + ]: 3048 : ret = mptcp_sk(sk); - 331 : 3048 : rcu_read_unlock(); - 332 : 3048 : goto out; + 330 [ - + ]: 2979 : ret = mptcp_sk(sk); + 331 : 2979 : rcu_read_unlock(); + 332 : 2979 : goto out; 333 : : } - 334 : 4670 : rcu_read_unlock(); + 334 : 4597 : rcu_read_unlock(); 335 : : } 336 : : - 337 : 2525 : out: - 338 : 5573 : *s_slot = slot; - 339 : 5573 : *s_num = num; - 340 : 5573 : return ret; + 337 : 2523 : out: + 338 : 5502 : *s_slot = slot; + 339 : 5502 : *s_num = num; + 340 : 5502 : 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 : 1740 : void mptcp_token_destroy_request(struct request_sock *req) + 350 : 1742 : void mptcp_token_destroy_request(struct request_sock *req) 351 : : { - 352 : 1740 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); - 353 : 1740 : struct mptcp_subflow_request_sock *pos; - 354 : 1740 : struct token_bucket *bucket; + 352 : 1742 : struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); + 353 : 1742 : struct mptcp_subflow_request_sock *pos; + 354 : 1742 : struct token_bucket *bucket; 355 : : - 356 [ + + ]: 1740 : if (hlist_nulls_unhashed(&subflow_req->token_node)) + 356 [ + + ]: 1742 : if (hlist_nulls_unhashed(&subflow_req->token_node)) 357 : : return; 358 : : 359 : 26 : bucket = token_bucket(subflow_req->token); @@ -453,13 +453,13 @@ 372 : : * 373 : : * Remove the token associated to @msk 374 : : */ - 375 : 3777 : void mptcp_token_destroy(struct mptcp_sock *msk) + 375 : 3770 : void mptcp_token_destroy(struct mptcp_sock *msk) 376 : : { - 377 : 3777 : struct sock *sk = (struct sock *)msk; - 378 : 3777 : struct token_bucket *bucket; - 379 : 3777 : struct mptcp_sock *pos; + 377 : 3770 : struct sock *sk = (struct sock *)msk; + 378 : 3770 : struct token_bucket *bucket; + 379 : 3770 : struct mptcp_sock *pos; 380 : : - 381 [ + + ]: 3777 : if (sk_unhashed((struct sock *)msk)) + 381 [ + + ]: 3770 : if (sk_unhashed((struct sock *)msk)) 382 : : return; 383 : : 384 : 2301 : sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); diff --git a/html/lcov/export-net/mptcp/token_test.c.func-c.html b/html/lcov/export-net/mptcp/token_test.c.func-c.html index 7a257926..27f0970b 100644 --- a/html/lcov/export-net/mptcp/token_test.c.func-c.html +++ b/html/lcov/export-net/mptcp/token_test.c.func-c.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/token_test.c.func.html b/html/lcov/export-net/mptcp/token_test.c.func.html index dc070bb0..596723f3 100644 --- a/html/lcov/export-net/mptcp/token_test.c.func.html +++ b/html/lcov/export-net/mptcp/token_test.c.func.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 % diff --git a/html/lcov/export-net/mptcp/token_test.c.gcov.html b/html/lcov/export-net/mptcp/token_test.c.gcov.html index 3e3e58f2..2193d1f5 100644 --- a/html/lcov/export-net/mptcp/token_test.c.gcov.html +++ b/html/lcov/export-net/mptcp/token_test.c.gcov.html @@ -37,7 +37,7 @@ Test Date: - 2025-02-03 13:06:43 + 2025-02-04 06:48:18 Functions: 100.0 %