diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c index ce592b3c7..e9029834f 100644 --- a/datapath-windows/ovsext/Actions.c +++ b/datapath-windows/ovsext/Actions.c @@ -291,7 +291,7 @@ OvsDetectTunnelPkt(OvsForwardingContext *ovsFwdCtx, * If the packet will not be encapsulated, consume the tunnel context * by clearing it. */ - if (ovsFwdCtx->srcVportNo != OVS_DEFAULT_PORT_NO) { + if (ovsFwdCtx->srcVportNo != OVS_DPPORT_NUMBER_INVALID) { POVS_VPORT_ENTRY vport = OvsFindVportByPortNo( ovsFwdCtx->switchContext, ovsFwdCtx->srcVportNo); diff --git a/datapath-windows/ovsext/BufferMgmt.c b/datapath-windows/ovsext/BufferMgmt.c index ab7a18e91..7ec073b70 100644 --- a/datapath-windows/ovsext/BufferMgmt.c +++ b/datapath-windows/ovsext/BufferMgmt.c @@ -88,6 +88,7 @@ #include "Flow.h" #include "Checksum.h" #include "PacketParser.h" +#include "Vport.h" /* * -------------------------------------------------------------------------- @@ -418,7 +419,7 @@ OvsAllocateFixSizeNBL(PVOID ovsContext, OvsInitNBLContext(ctx, OVS_BUFFER_FROM_FIX_SIZE_POOL | OVS_BUFFER_PRIVATE_FORWARD_CONTEXT, size, - OVS_DEFAULT_PORT_NO); + OVS_DPPORT_NUMBER_INVALID); line = __LINE__; allocate_done: OVS_LOG_LOUD("Allocate Fix NBL: %p, line: %d", nbl, line); @@ -531,7 +532,7 @@ OvsAllocateVariableSizeNBL(PVOID ovsContext, OvsInitNBLContext(ctx, OVS_BUFFER_PRIVATE_MDL | OVS_BUFFER_PRIVATE_DATA | OVS_BUFFER_PRIVATE_FORWARD_CONTEXT | OVS_BUFFER_FROM_ZERO_SIZE_POOL, - size, OVS_DEFAULT_PORT_NO); + size, OVS_DPPORT_NUMBER_INVALID); OVS_LOG_LOUD("Allocate variable size NBL: %p", nbl); return nbl; @@ -583,7 +584,8 @@ OvsInitExternalNBLContext(PVOID ovsContext, * we use first nb to decide whether we need advance or retreat during * complete. */ - OvsInitNBLContext(ctx, flags, NET_BUFFER_DATA_LENGTH(nb), OVS_DEFAULT_PORT_NO); + OvsInitNBLContext(ctx, flags, NET_BUFFER_DATA_LENGTH(nb), + OVS_DPPORT_NUMBER_INVALID); return ctx; } @@ -799,7 +801,7 @@ OvsPartialCopyNBL(PVOID ovsContext, srcNb = NET_BUFFER_LIST_FIRST_NB(nbl); OvsInitNBLContext(dstCtx, flags, NET_BUFFER_DATA_LENGTH(srcNb) - copySize, - OVS_DEFAULT_PORT_NO); + OVS_DPPORT_NUMBER_INVALID); InterlockedIncrement((LONG volatile *)&srcCtx->refCount); @@ -1053,7 +1055,7 @@ OvsFullCopyNBL(PVOID ovsContext, OVS_BUFFER_PRIVATE_FORWARD_CONTEXT; OvsInitNBLContext(dstCtx, flags, NET_BUFFER_DATA_LENGTH(firstNb), - OVS_DEFAULT_PORT_NO); + OVS_DPPORT_NUMBER_INVALID); #ifdef DBG OvsDumpNetBufferList(nbl); diff --git a/datapath-windows/ovsext/DpInternal.h b/datapath-windows/ovsext/DpInternal.h index 4b58ae8ca..466a33a48 100644 --- a/datapath-windows/ovsext/DpInternal.h +++ b/datapath-windows/ovsext/DpInternal.h @@ -294,8 +294,6 @@ typedef struct _OVS_EVENT_ENTRY { UINT32 type; } OVS_EVENT_ENTRY, *POVS_EVENT_ENTRY; -#define OVS_DEFAULT_PORT_NO 0xffffffff -#define OVS_DEFAULT_EVENT_STATUS 0xffffffff typedef struct _OVS_EVENT_STATUS { uint32_t numberEntries; diff --git a/datapath-windows/ovsext/IpHelper.c b/datapath-windows/ovsext/IpHelper.c index de0d4579a..812622201 100644 --- a/datapath-windows/ovsext/IpHelper.c +++ b/datapath-windows/ovsext/IpHelper.c @@ -38,7 +38,7 @@ KSTART_ROUTINE OvsStartIpHelper; * queued. */ static BOOLEAN ovsInternalIPConfigured; -static UINT32 ovsInternalPortNo; +static BOOLEAN ovsInternalAdapterUp; static GUID ovsInternalNetCfgId; static MIB_IF_ROW2 ovsInternalRow; static MIB_IPINTERFACE_ROW ovsInternalIPRow; @@ -1059,7 +1059,7 @@ VOID OvsInternalAdapterDown(VOID) { NdisAcquireSpinLock(&ovsIpHelperLock); - ovsInternalPortNo = OVS_DEFAULT_PORT_NO; + ovsInternalAdapterUp = FALSE; ovsInternalIPConfigured = FALSE; NdisReleaseSpinLock(&ovsIpHelperLock); @@ -1070,8 +1070,7 @@ OvsInternalAdapterDown(VOID) VOID -OvsInternalAdapterUp(UINT32 portNo, - GUID *netCfgInstanceId) +OvsInternalAdapterUp(GUID *netCfgInstanceId) { POVS_IP_HELPER_REQUEST request; @@ -1088,7 +1087,7 @@ OvsInternalAdapterUp(UINT32 portNo, request->command = OVS_IP_HELPER_INTERNAL_ADAPTER_UP; NdisAcquireSpinLock(&ovsIpHelperLock); - ovsInternalPortNo = portNo; + ovsInternalAdapterUp = TRUE; InsertHeadList(&ovsIpHelperRequestList, &request->link); ovsNumIpHelperRequests++; if (ovsNumIpHelperRequests == 1) { @@ -1160,7 +1159,7 @@ OvsEnqueueIpHelperRequest(POVS_IP_HELPER_REQUEST request) NdisAcquireSpinLock(&ovsIpHelperLock); - if (ovsInternalPortNo == OVS_DEFAULT_PORT_NO || + if (ovsInternalAdapterUp == FALSE || ovsInternalIPConfigured == FALSE) { NdisReleaseSpinLock(&ovsIpHelperLock); OvsFreeMemoryWithTag(request, OVS_IPHELPER_POOL_TAG); @@ -1554,7 +1553,7 @@ OvsInitIpHelper(NDIS_HANDLE ndisFilterHandle) RtlZeroMemory(&ovsInternalIPRow, sizeof (MIB_IPINTERFACE_ROW)); ovsInternalIP = 0; - ovsInternalPortNo = OVS_DEFAULT_PORT_NO; + ovsInternalAdapterUp = FALSE; InitializeListHead(&ovsSortedIPNeighList); diff --git a/datapath-windows/ovsext/IpHelper.h b/datapath-windows/ovsext/IpHelper.h index 19702a2f3..8562f868c 100644 --- a/datapath-windows/ovsext/IpHelper.h +++ b/datapath-windows/ovsext/IpHelper.h @@ -114,7 +114,7 @@ typedef struct _OVS_IP_HELPER_THREAD_CONTEXT { NTSTATUS OvsInitIpHelper(NDIS_HANDLE ndisFilterHandle); VOID OvsCleanupIpHelper(VOID); -VOID OvsInternalAdapterUp(UINT32 portNo, GUID *netCfgInstanceId); +VOID OvsInternalAdapterUp(GUID *netCfgInstanceId); VOID OvsInternalAdapterDown(VOID); NTSTATUS OvsFwdIPHelperRequest(PNET_BUFFER_LIST nbl, UINT32 inPort, diff --git a/datapath-windows/ovsext/Switch.c b/datapath-windows/ovsext/Switch.c index 6ddf5dc84..4d9cfda40 100644 --- a/datapath-windows/ovsext/Switch.c +++ b/datapath-windows/ovsext/Switch.c @@ -564,7 +564,6 @@ OvsActivateSwitch(POVS_SWITCH_CONTEXT switchContext) OvsClearAllSwitchVports(switchContext); goto cleanup; } - // OvsPostEvent(OVS_DEFAULT_PORT_NO, OVS_DEFAULT_EVENT_STATUS); cleanup: if (status != NDIS_STATUS_SUCCESS) { diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c index 78286870a..42af7f32d 100644 --- a/datapath-windows/ovsext/User.c +++ b/datapath-windows/ovsext/User.c @@ -434,7 +434,7 @@ OvsExecuteDpIoctl(OvsPacketExecute *execute) NdisAcquireRWLockRead(gOvsSwitchContext->dispatchLock, &lockState, 0); ndisStatus = OvsActionsExecute(gOvsSwitchContext, NULL, pNbl, vport ? vport->portNo : - OVS_DEFAULT_PORT_NO, + OVS_DPPORT_NUMBER_INVALID, NDIS_SEND_FLAGS_SWITCH_DESTINATION_GROUP, &key, NULL, &layers, actions, execute->actionsLen); @@ -1208,4 +1208,4 @@ OvsReadPacketCmdHandler(POVS_USER_PARAMS_CONTEXT usrParamsCtx, status = OvsReadDpIoctl(instance->fileObject, usrParamsCtx->outputBuffer, usrParamsCtx->outputLength, replyLen); return status; -} \ No newline at end of file +} diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c index 48845dacb..388920e58 100644 --- a/datapath-windows/ovsext/Vport.c +++ b/datapath-windows/ovsext/Vport.c @@ -447,7 +447,7 @@ HvConnectNic(POVS_SWITCH_CONTEXT switchContext, NdisReleaseRWLock(switchContext->dispatchLock, &lockState); if (nicParam->NicType == NdisSwitchNicTypeInternal) { - OvsInternalAdapterUp(portNo, &nicParam->NetCfgInstanceId); + OvsInternalAdapterUp(&nicParam->NetCfgInstanceId); } done: