-
Notifications
You must be signed in to change notification settings - Fork 656
Add support for multi-process port sharing with CIBIR. #5798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ProjectsByJackHe
wants to merge
32
commits into
main
Choose a base branch
from
jackhe/sql-cibir-fix-sock-reservation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ee68434
add a comment
ProjectsByJackHe 68a7afe
update code to account for cibir
ProjectsByJackHe 382fba7
clog fixes
ProjectsByJackHe c1c1445
update docs, update tests
ProjectsByJackHe df75326
rename reserveauxtcpsock and add explicit check for error code
ProjectsByJackHe a952c04
always false in kernel mode...
ProjectsByJackHe a0b20b3
XDP and CIBIR
ProjectsByJackHe d2bd384
add logs
ProjectsByJackHe c2ac95b
more logs
ProjectsByJackHe 7f6d88e
more logs
ProjectsByJackHe b442e8a
return error if xdp not available
ProjectsByJackHe 323d3f0
update docs on proper behavior
ProjectsByJackHe f55cc25
fix test
ProjectsByJackHe a70a8c2
get rid of bad artifact
ProjectsByJackHe cabc5a8
fix nit / clog
ProjectsByJackHe 1557c28
address feedback
ProjectsByJackHe 24e1390
clog
ProjectsByJackHe b43c894
fix inline def
ProjectsByJackHe 8da485c
clog
ProjectsByJackHe 2f06dad
update to use ifdef
ProjectsByJackHe a76904d
do not reserve any sockets at all
ProjectsByJackHe 347356e
give it a non-0 local address
ProjectsByJackHe 70a6e9e
proper port reservations
ProjectsByJackHe e4b5ecc
fix conn pool test case
ProjectsByJackHe cf4fd8b
fix tests
ProjectsByJackHe da3dfd6
put ifdef in handshaketest directly
ProjectsByJackHe 4c9753c
update docs, add dbg assert, and fix logic
ProjectsByJackHe ced6a30
update warning logs
ProjectsByJackHe 8a16a62
Merge branch 'main' into jackhe/sql-cibir-fix-sock-reservation
ProjectsByJackHe 808ea0c
more crisp behavior
ProjectsByJackHe 8a6eef8
Merge branch 'main' into jackhe/sql-cibir-fix-sock-reservation
ProjectsByJackHe ad2070a
update cibir docs
ProjectsByJackHe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # CIBIR | ||
|
|
||
| ## What is it | ||
|
|
||
| See [XDP](./XDP.md) first to understand the context. | ||
|
|
||
| When CIBIR is used, rather than programming XDP to filter packets on port numbers, | ||
| we now filter and de-mux packets based on QUIC connection ID. | ||
|
|
||
| CIBIR (CID-Based Identification and Routing) is just a prefix substring that XDP | ||
| will use to match and filter all packets with a QUIC CID that contains the prefix substring equal to CIBIR. | ||
|
|
||
| What using CIBIR also enables is allowing 2 separate server processes to share a single | ||
| port. As long as the CIBIR configuration used by each process is different, XDP can | ||
| properly de-mux and dispatch received packets to the right process. | ||
|
|
||
| ## Port reservation | ||
| The first process that uses CIBIR will still need to reserve the OS ports to avoid | ||
| non-CIBIR applications from getting their traffic stolen. The second (and so on) processes | ||
| using CIBIR thereafter will skip reserving OS socket ports. | ||
|
|
||
|
|
||
| CIBIR usage is controlled by setting the `QUIC_PARAM_LISTENER_CIBIR_ID` setparam. | ||
|
|
||
| CIBIR does 2 things when set: | ||
| 1. XDP will now steer packets to the correct process/listener by matching the CIBIR prefix within the packet QUIC Connection ID. | ||
|
|
||
| 2. In the case of a port collision when reserving OS UDP/TCP sockets, MsQuic will continue with initializing the datapath if XDP is available/enabled. If XDP is not available/enabled, then MsQuic will return a QUIC_STATUS_INVALID_STATE socket error. | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # MsQuic over XDP | ||
|
|
||
| To avoid confusion, "XDP" refers to [XDP-for-windows](https://github.com/microsoft/xdp-for-windows). While Linux XDP has been experimented | ||
| upon in the past and shown some promise for running MsQuic, it is NOT a stable datapath actively being maintained today. | ||
|
|
||
| ## What is XDP | ||
|
|
||
| XDP enables received packets to completely bypass the OS networking stack. | ||
|
|
||
| Applications can subscribe to XDP ring buffers to post packets to send, | ||
| and process packets that are received through AF_XDP sockets. | ||
|
|
||
| Additionally, applications can program XDP to determine the | ||
| logic for which packets to filter for, and what to do with them. | ||
|
|
||
| For instance: "drop all packets with a UDP header and destination port | ||
| 42." | ||
|
|
||
| ## Port reservation logic | ||
|
|
||
| The type of logic MsQuic programs into XDP looks like: | ||
| "redirect all packets with a destination port X to an AF_XDP socket." | ||
|
|
||
| This runs into the issue of **packet stealing.** If say there was an unrelated process | ||
ProjectsByJackHe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| that binds an OS socket to the same port MsQuic used to program XDP, XDP will steal | ||
| that traffic from underneath it. | ||
|
|
||
| Which is why MsQuic will always create an OS UDP socket on the same port as the AF_XDP | ||
| socket to play nice with the rest of the stack. | ||
|
|
||
| There are *exceptions* to this port reservation. | ||
|
|
||
| - Sometimes, MsQuic may create a TCP OS socket instead, or both TCP and UDP (see [QTIP](./QTIP.md)). | ||
| - Sometimes, MsQuic may NOT create any OS sockets at all (see [CIBIR](./CIBIR.md)). | ||
|
|
||
|
|
||
|
|
||
| ## MsQuic over XDP general architecture: | ||
|
|
||
|  | ||
|
|
||
|
|
||
|
|
||
|
|
||
ProjectsByJackHe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.