Skip to content

Commit

Permalink
more strict if conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-GS committed Sep 7, 2023
1 parent 02b39de commit da791e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/platform/datapath_raw_xdp_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
#endif

typedef struct XDP_DATAPATH {
CXPLAT_DATAPATH_RAW;
DECLSPEC_CACHEALIGN
CXPLAT_DATAPATH_RAW;

//
// Currently, all XDP interfaces share the same config.
//
Expand Down
22 changes: 12 additions & 10 deletions src/platform/datapath_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ CxPlatSocketUpdateQeo(
_In_ uint32_t OffloadCount
)
{
if (Socket->RawSocketAvailable &&
!IS_LOOPBACK(Offloads[0].Address)) {
if (Socket->UseTcp || (Socket->RawSocketAvailable &&
!IS_LOOPBACK(Offloads[0].Address))) {
return RawSocketUpdateQeo(SocketToRaw(Socket), Offloads, OffloadCount);
}
return QUIC_STATUS_NOT_SUPPORTED;
Expand All @@ -386,8 +386,8 @@ CxPlatSocketGetLocalMtu(
)
{
CXPLAT_DBG_ASSERT(Socket != NULL);
if (Socket->RawSocketAvailable &&
!IS_LOOPBACK(Socket->RemoteAddress)) {
if (Socket->UseTcp || (Socket->RawSocketAvailable &&
!IS_LOOPBACK(Socket->RemoteAddress))) {
return RawSocketGetLocalMtu(SocketToRaw(Socket));
}
return Socket->Mtu;
Expand Down Expand Up @@ -449,12 +449,12 @@ CxPlatSendDataAlloc(
Socket->RawSocketAvailable && !IS_LOOPBACK(Config->Route->RemoteAddress))) {
SendData = RawSendDataAlloc(SocketToRaw(Socket), Config);
if (SendData) {
DatapathType(SendData) = CXPLAT_DATAPATH_TYPE_XDP;
DatapathType(SendData) = Config->Route->DatapathType = CXPLAT_DATAPATH_TYPE_XDP;
}
} else {
SendData = SendDataAlloc(Socket, Config);
if (SendData) {
DatapathType(SendData) = CXPLAT_DATAPATH_TYPE_USER;
DatapathType(SendData) = Config->Route->DatapathType = CXPLAT_DATAPATH_TYPE_USER;
}
}
return SendData;
Expand Down Expand Up @@ -611,8 +611,9 @@ CxPlatResolveRoute(
_In_ CXPLAT_ROUTE_RESOLUTION_CALLBACK_HANDLER Callback
)
{
if (Socket->RawSocketAvailable &&
!IS_LOOPBACK(Route->RemoteAddress)) {
if (Socket->UseTcp || Route->DatapathType == CXPLAT_DATAPATH_TYPE_XDP ||
(Route->DatapathType == CXPLAT_DATAPATH_TYPE_UNKNOWN &&
Socket->RawSocketAvailable && !IS_LOOPBACK(Route->RemoteAddress))) {
return RawResolveRoute(SocketToRaw(Socket), Route, PathId, Context, Callback);
}
Route->State = RouteResolved;
Expand All @@ -626,8 +627,9 @@ CxPlatUpdateRoute(
_In_ CXPLAT_ROUTE* SrcRoute
)
{
if (SrcRoute->DatapathType == CXPLAT_DATAPATH_TYPE_XDP &&
!IS_LOOPBACK(SrcRoute->RemoteAddress)) {
if (SrcRoute->DatapathType == CXPLAT_DATAPATH_TYPE_XDP ||
(SrcRoute->DatapathType == CXPLAT_DATAPATH_TYPE_UNKNOWN &&
!IS_LOOPBACK(SrcRoute->RemoteAddress))) {
RawUpdateRoute(DstRoute, SrcRoute);
}
}
Expand Down

0 comments on commit da791e7

Please sign in to comment.