-
Notifications
You must be signed in to change notification settings - Fork 546
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
Add support for setting TypeOfService/TrafficClass on connections #4757
base: main
Are you sure you want to change the base?
Conversation
Status = QUIC_STATUS_SUCCESS; | ||
break; | ||
|
||
case QUIC_PARAM_CONN_DSCP: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should GetParam return the last-set DSCP value, or the most recently received DSCP value?
Or should getting the received DSCP value be a separate, get-only param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably better to support querying the last value set by the app. So, then we would need two parameters, one for send and one (get-only) for receive. But let's save receive for a future PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, receive can be a future PR
CMsg = (PWSACMSGHDR)&CMsgBuffer[CMsgLen]; | ||
CMsgLen += WSA_CMSG_SPACE(sizeof(INT)); | ||
CMsg->cmsg_level = | ||
Route->LocalAddress.si_family == QUIC_ADDRESS_FAMILY_INET ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LocalAddress might be the wrong address to use; if trying to send to an IPv4 address using a dual-mode socket, you need to set the IPv4 IP_TOS, instead of the IPV6_TCLASS
@@ -803,7 +803,7 @@ QuicBindingProcessStatelessOperation( | |||
Binding, | |||
OperationType); | |||
|
|||
CXPLAT_SEND_CONFIG SendConfig = { RecvPacket->Route, 0, CXPLAT_ECN_NON_ECT, 0 }; | |||
CXPLAT_SEND_CONFIG SendConfig = { RecvPacket->Route, 0, CXPLAT_ECN_NON_ECT, 0, 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a #define
for zero here instead of using a magic number?
case QUIC_PARAM_CONN_DSCP: | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case QUIC_PARAM_CONN_DSCP: | |
{ | |
case QUIC_PARAM_CONN_DSCP: { | |
uint8_t DSCP = 0; | ||
CxPlatCopyMemory(&DSCP, Buffer, BufferLength); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify?
uint8_t DSCP = 0; | |
CxPlatCopyMemory(&DSCP, Buffer, BufferLength); | |
uint8_t DSCP = *Buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't the simplification cause a crash if the buffer is unaligned on ARM?
@@ -7207,27 +7228,55 @@ QuicConnParamGet( | |||
} | |||
|
|||
case QUIC_PARAM_CONN_ORIG_DEST_CID: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: don't modify code that's not relevant to this PR?
@@ -923,6 +923,7 @@ typedef struct QUIC_SCHANNEL_CREDENTIAL_ATTRIBUTE_W { | |||
#define QUIC_PARAM_CONN_STATISTICS_V2 0x05000016 // QUIC_STATISTICS_V2 | |||
#define QUIC_PARAM_CONN_STATISTICS_V2_PLAT 0x05000017 // QUIC_STATISTICS_V2 | |||
#define QUIC_PARAM_CONN_ORIG_DEST_CID 0x05000018 // uint8_t[] | |||
#define QUIC_PARAM_CONN_DSCP 0x50000019 // uint8_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call it _SEND_DSCP
?
#define QUIC_PARAM_CONN_DSCP 0x50000019 // uint8_t | |
#define QUIC_PARAM_CONN_SEND_DSCP 0x50000019 // uint8_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of the same pattern that socket options use where the send one has no prefix, but the receive one has a prefix. So when we do the last-received DSCP value, it would be QUIC_PARAM_CONN_RECV_DSCP
@@ -444,6 +455,7 @@ CxPlatDataPathUpdateConfig( | |||
#define CXPLAT_DATAPATH_FEATURE_TCP 0x0020 | |||
#define CXPLAT_DATAPATH_FEATURE_RAW 0x0040 | |||
#define CXPLAT_DATAPATH_FEATURE_TTL 0x0080 | |||
#define CXPLAT_DATAPATH_FEATURE_DSCP 0x0100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we need separate features for send/receive support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the receive support already exists in all stacks, it's just the send support that's missing on some.
@@ -1672,7 +1708,7 @@ SocketCreateUdp( | |||
setsockopt( | |||
SocketProc->Socket, | |||
IPPROTO_IP, | |||
IP_ECN, | |||
IP_RECVTOS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be causing test failures because packets aren't getting received in some tests since adding this change.
} else if (CMsg->cmsg_type == IP_ECN) { | ||
ECN = *(PINT)WSA_CMSG_DATA(CMsg); | ||
CXPLAT_DBG_ASSERT(ECN < UINT8_MAX); | ||
} else if (CMsg->cmsg_type == IP_TOS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here; I think this change might be causing receives to fail.
Description
Resolves #4767. Add support for applications to set the Type of Service/Traffic Class field all traffic sent from a connection.
Testing
TBD
Documentation
Updated the settings document with the new get/set param.