cifs: enable and harden SMB3 multichannel on vendor 5.15 - #51
Open
juanruizm001 wants to merge 16 commits into
Open
juanruizm001 wants to merge 16 commits into
juanruizm001 wants to merge 16 commits into
Conversation
Open multichannel connections after a successful non-DFS mount. The vendor 5.15 tree uses a different mount path from current mainline, so adapt the upstream channel-opening behavior to that layout. Signed-off-by: Aurelien Aptel <aaptel@suse.com> Change-Id: I320380d0e8efe25d55ec944a95d3a42a1e855928 (cherry picked from commit d70e9fa) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Keep secondary-channel hostnames empty so reconnect does not resolve the primary hostname to the wrong address for another channel. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I6bd519a1bbd1af5021a7b6bd592b69245c966d64 (cherry picked from commit 4c14d7043fede258957d7b01da0cad2d9fe3a205) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Select the least-loaded eligible channel for regular requests while retaining the binding behavior required by this vendor 5.15 tree. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I7d1dfe2b4d2da152c69dcf7d09ee0eeb5c54411d (cherry picked from commit ea90708d3cf3d0d92c02afe445ad463fb3c6bf10) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Start channel scanning from the previously selected position. This reduces selection skew while preserving the 5.15 binding model. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: Ia756124913521f42956ee3c49fcf86735a88b5f3 (cherry picked from commit 66d590b828b1fd9fa337047ae58fe1c4c6f43609) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Compose the upstream channel-eligibility fixes for the vendor 5.15 selector. Skip reconnecting channels, test the correct candidate slot, and keep the scan-selected channel when loads are equal. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I8674146879a3e664553bb08d31093af156d1bd77 (cherry picked from commit fc43a8ac396d302ced1e991e4913827cf72c8eb9) (cherry picked from commit 79280191c2fd7f24899bbd640003b5389d3c109c) (cherry picked from commit 663c28469d3274d6456f206a6671c91493d85ff1) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Add the per-channel reconnect bitmap and helpers needed to keep an SMB session usable while an individual transport reconnects. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I75c5f2aec2c82ef678fde796c794f8efb4cd2f50 (cherry picked from commit d1a931ce2e3b7761d293ba8e0bde2b0180f456e9) (cherry picked from commit f486ef8e2003f6c308d0db81ea116c880a760d4f) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Adapt the reconnect engine so one failed TCP transport can recover while the SMB session remains usable through another established channel. Keep socket teardown owned by the channel's cifsd thread. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I28fd6813fc1a16f42f8f0ce8c55fad736ff115bb (cherry picked from commit 183eea2ee5ba968ca7c31f04a0f01fd3e5c1d014) (cherry picked from commit 3663c9045f51a7ad635a0785adef07c21b79b560) (cherry picked from commit a81da65fbae6436e1e2f415532b8aacc3274d840) (cherry picked from commit 489f710a738e24d887823a010b8b206b4124e26f) (cherry picked from commit 2a05137a0575b7d1006bdf4c1beeee9e391e22a0) (cherry picked from commit 52492ff5c583036306bc422a83e246c971af387a) (cherry picked from commit dca65818c80cf06e0f08ba2cf94060a5236e73c2) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Adapt upstream locking and reconnect serialization to the vendor 5.15 structures so parallel reconnect activity does not race channel state. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I8f69312cb1299cb07fee9e53087d02c83ddbbca2 (cherry picked from commit 88b024f556fcd5bf1288c6333016f576cfa5f539) (cherry picked from commit 5752bf645f9dd7db600651f726eb04a97c9f597f) (cherry picked from commit bc962159e8e326af634a506508034a375bf2b858) (cherry picked from commit a96c94481f5993eac2271f9fb4d009b7dc076c24) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Wire negotiate, session and tree-connect state transitions into the vendor layout. Keep signing state and request selection aligned with the transport that is reconnecting. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: Ia6e3e22100535bbdc4dfd40080356c0da72bca88 (cherry picked from commit 73f9bfbe3d818bb52266d5c9f3ba57d97842ffe7) (cherry picked from commit 47de760655f329ce4b3d3e6276557220956d8c38) (cherry picked from commit a05885ce13bd5ec9602551e32dfb1a4f26bfa542) (cherry picked from commit ba978e83255a759a4a07257a46ca6396a8b81787) (cherry picked from commit 05ce0448c3f36febd8db0ee0e9e16557f3ab5ee8) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Use the SMB session reconnect state when the full-key ioctl checks whether session state allows the operation. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I1a4128a7e7842384a104146e25af1cada93802b1 (cherry picked from commit dd3cd8709ed5f4ae8998e0cd44c05bd26bc879e8) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Move retry-time channel selection to the direct-read attempt so a replayed read can use a currently eligible transport. Signed-off-by: Aurelien Aptel <aaptel@suse.com> Change-Id: Iab0fed2d7569acde490e3e2e83a4bad66472229b (cherry picked from commit 352d96f) (cherry picked from commit f1bf10d7e909fe898a112f5cae1e97ce34d6484d) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Track whether a retried write request is a replay so the SMB2 replay flag is applied only when an earlier request may have reached the server. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I1f93b5183178a1b4042d1e0a06e511a7b9cf91ee (cherry picked from commit 4cdad80261862c8cdcbb5fd232aa713d0bdefe24) (cherry picked from commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Repick an eligible channel for each direct-write retry and preserve the replay state needed by SMB2 after a transport failure. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I23924bab8a9f7cf042da9e97a65e1583710d2c3a (cherry picked from commit 4cdad80261862c8cdcbb5fd232aa713d0bdefe24) (cherry picked from commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Normalize transport send failures to a replayable error and use one helper to decide whether an operation can be retried. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: If727a76848114ac8f2b5761ed0439a395c401d88 (cherry picked from commit a68106a6928e0a6680f12bcc7338c0dddcfe4d11) (cherry picked from commit 64cc377b7628b81ffdbdb1c6bacfba895dcac3f8) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Reinitialize per-attempt FLUSH response state, repick an eligible channel for each replay, set the SMB2 replay flag, and keep retries bounded for soft mounts. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: I49b2c4eb78a7412f79074d432059ccecea332508 (cherry picked from commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e) (cherry picked from commit 4be31c943a3a27a5a0251dbb8f5cb89059ec3d5a) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
Bind each write attempt to one eligible transport before credits are taken and keep retry/replay state consistent across writeback and direct-write paths. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Change-Id: Ia0f106c345be401b01ae77f2e5e648ddd1aabc8d (cherry picked from commit 4cdad80261862c8cdcbb5fd232aa713d0bdefe24) (cherry picked from commit 64cc377b7628b81ffdbdb1c6bacfba895dcac3f8) (cherry picked from commit a68106a6928e0a6680f12bcc7338c0dddcfe4d11) (cherry picked from commit 4f1fffa2376922f3d1d506e49c0fd445b023a28e) [juan: adapted the listed upstream change(s) to the CoreELEC 5.15.196 vendor layout; no original code authorship is claimed.] Signed-off-by: Juan Ruiz <6059278+juanruizm001@users.noreply.github.com>
juanruizm001
marked this pull request as ready for review
September 13, 2026 20:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
On the Xiaomi TV Box S 3rd Gen, the USB-attached Ethernet path is practically limited to the mid-300 Mbit/s range while 5 GHz Wi-Fi has substantial independent capacity.
The goal of this series is to let one SMB3 session use Ethernet and Wi-Fi concurrently via SMB Multichannel, so one real media application can benefit from aggregate bandwidth while retaining a surviving path if one transport is lost.
What was missing
The vendor 5.15 tree already contained
cifs_try_adding_channels()and the basic multichannel data structures. The original functional gap was that the normal non-DFScifs_mount()path did not invoke the channel-opening helper after mount.The first commit adapts the upstream channel-opening behavior to that non-DFS vendor path. Subsequent commits adapt later upstream fixes for channel selection/loading, per-channel reconnect, reconnect serialization, reconnect-aware request selection, and read/write retry/replay behavior.
Tested head:
3294f2c166d2ce27d523f84243763b57e5641352Base:
CoreELEC/linux-amlogic:5.15.196_20260306at69e87fa40cc3a04bf91d92e388d2787a2efcb50cTest environment
10.77.77.2/30 <-> 10.77.77.110.77.78.2/30 <-> 10.77.78.1/storage/zimaosCH=2 CH_ETH=1 CH_WIFI=1Validation summary
Kernel acceptance matrix
51 scenarios completed: 48 PASS / 3 FAIL.
Local 4-reader capacity (
cache=none, wire rate):BOTH is about +52.1% above Ethernet-only and reaches about 89.3% of the arithmetic sum of the independently measured ETH and Wi-Fi ceilings.
All controlled synthetic READ reconnect scenarios passed, including intentional Wi-Fi and double-link loss. All WRITE reconnect scenarios passed their integrity checks.
One external 3DFF movie/double-drop failure coincided with demonstrated rclone/VFS backend degradation.
Two local Wi-Fi-only non-drop scenarios lost the original test SessionId mid-transfer. Both had already transferred normally before the identity disappeared.
Definitive Kodi production-direct matrix
Final accepted result set: 36/36 PASS.
Kodi always used
/storage/zimaos, exactly one CIFS mount was allowed, and BOTH used the real productiveCH=2/E=1/W=1session.Across six media files and two cache profiles, BOTH peak-1-second throughput exceeded the matched ETH result in 12/12 comparisons, with an average gain of about 25.5%.
Examples:
362.288ETH ->491.197BOTH Mbit/s361.125ETH ->499.521BOTH Mbit/sAcross accepted BOTH scenarios, traffic was split approximately 50/50 between Ethernet and Wi-Fi. This is the main application-level result: one Kodi application using one SMB session family can consume capacity from both TCP transports and exceed the Ethernet-only ceiling.
The accepted set was completed with a reboot/resume after the first attempt at scenario 21 hit the residual issue below. That failed attempt is preserved separately as forensic evidence.
Residual Wi-Fi-only reconnect/session event
A later Wi-Fi-only failure was captured while the physical Wi-Fi link was still healthy (
-41 dBm, carrier=1, operstate=up, route/neighbor valid), while CIFS entered reconnect/disconnected state and the channel count dropped to zero.After reboot the identical scenario passed and the remaining campaign completed.
This resembles the two earlier SessionId-loss events, but the evidence does not prove identical root cause. Because the controlled reconnect battery passes intentional ETH/Wi-Fi/double link drops, I currently classify this as a rare, stress-sensitive session/reconnect-lifecycle edge case rather than a deterministic failover failure.
I would appreciate maintainer guidance on whether this resembles a known 5.15 CIFS reconnect issue and which newer fixes or tracing would be most useful for a focused follow-up.
AI assistance disclosure
I used AI assistance extensively for source comparison, upstream commit discovery, test-script drafting, log analysis, and documentation.
AI output was not accepted as evidence or applied blindly. Changes were traced to upstream work, adapted to this vendor tree, compiled, and validated through many laboratory iterations on real hardware. The 51- and 36-scenario matrices are the final acceptance evidence, not the full development history.
I remain responsible for the submitted code and for addressing review feedback.
Evidence package
A curated public evidence archive is ready to attach to this draft before marking it ready for review.
Archive:
CoreELEC_SMBMC_Public_Submission_Evidence_20260913_v2.tar.gzSHA-256:
3086abc890832516fe23ad3b7305fd49408b8c7676cfcc15b4c66e7cc29d1ae5It contains the raw 51-test evidence, the definitive Kodi evidence, the forensic failure capture, exact runners, tables, plots, architecture/flow notes, and SHA-256 manifests.
CoreELEC_SMBMC_Public_Submission_Evidence_20260913_v2.tar.gz