Implement "explicit wild" endpoints - #335
Open
zhuyifei1999 wants to merge 1 commit into
Open
zhuyifei1999 wants to merge 1 commit into
zhuyifei1999 wants to merge 1 commit into
Conversation
It's been observed that for some NICs, flow steering configuration (which is needed for AF_XDP) is a slow control-path process, taking milliseconds. And as a result, opening a listening port and closing causes unreasonable delays in the processing, especially with the `ci_netif_lock(ep->netif)` lock held for the entire duration. For outgoing sockets, there exist the workaround of "active wilds" (EF_TCP_SHARED_LOCAL_PORTS), but for listeners, no such workaround exist. This patch adds a new state CI_TCP_STATE_EXPLICIT_WILD = CI_TCP_STATE_ACTIVE_WILD | CI_TCP_STATE_NOT_CONNECTED, turning CI_TCP_STATE_ACTIVE_WILD sort of into a bitmasked value. Common code between active wilds and explicit wilds now check for that value after masking. The new endpoint state is always orphaned (no fd), only creatable on stack creation, and is always non-matching for packet delivery to endpoints (allowing the packet to be sent to kernel sockets listening on the same port). It also never has a kernel socket attached, this is so that someone can connect to it and see that the the connection is refused, rather than being delivered to a socket that will not respond. As a result, user has to explicitly make sure that those sockets are not used for other outgoing sockets via sysctls. User passes the list of ports for explicit wilds in the env variable `EF_TCP_EXPLICIT_WILD_PORTS`, in the format of what bitmap_parselist accepts. Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Contributor
Author
|
I can't think of a better name for this than "explicit wild", so feel free to suggest other names. Also not sure if CI_TCP_STATE_ACTIVE_WILD into a bitmask is the right choice. I didn't want to use up the last type slot. |
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.
It's been observed that for some NICs, flow steering configuration (which is needed for AF_XDP) is a slow control-path process, taking milliseconds. And as a result, opening a listening port and closing causes unreasonable delays in the processing, especially with the
ci_netif_lock(ep->netif)lock held for the entire duration. For outgoing sockets, there exist the workaround of "active wilds" (EF_TCP_SHARED_LOCAL_PORTS), but for listeners, no such workaround exist.This patch adds a new state CI_TCP_STATE_EXPLICIT_WILD = CI_TCP_STATE_ACTIVE_WILD | CI_TCP_STATE_NOT_CONNECTED, turning CI_TCP_STATE_ACTIVE_WILD sort of into a bitmasked value. Common code between active wilds and explicit wilds now check for that value after masking.
The new endpoint state is always orphaned (no fd), only creatable on stack creation, and is always non-matching for packet delivery to endpoints (allowing the packet to be sent to kernel sockets listening on the same port). It also never has a kernel socket attached, this is so that someone can connect to it and see that the the connection is refused, rather than being delivered to a socket that will not respond. As a result, user has to explicitly make sure that those sockets are not used for other outgoing sockets via sysctls.
User passes the list of ports for explicit wilds in the env variable
EF_TCP_EXPLICIT_WILD_PORTS, in the format of what bitmap_parselist accepts.