In a hybrid forwarding environment, there are two types of packets that enter and leave the Hyper-V extensible switch: NVGRE packets and non-NVGRE packets. Hybrid forwarding involves filtering the incoming traffic based on packet type.
Thus, we must split the incoming traffic into NVGRE and non-NVGRE packets. All non-NVGRE traffic is forwarded by the OVS extension and processed as usual, and the NVGRE traffic is passed to NDIS to be handled by the HNV module. Currently, the OVS extension supports only NDIS 6.30, but hybrid forwarding involves supporting NDIS 6.40. Thus, I have changed the necessary compiler settings to reflect this. More details about hybrid forwarding and the necessary NDIS 6.40 support is provided in issue #52. Signed-off-by: Sorin Vinturis <svintu...@cloudbasesolutions.com> Reported-by: Nithin Raju <nit...@vmware.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/52 --- datapath-windows/ovsext/PacketIO.c | 33 +++++++++++++++++++++++++++++++-- datapath-windows/ovsext/ovsext.vcxproj | 6 +++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/datapath-windows/ovsext/PacketIO.c b/datapath-windows/ovsext/PacketIO.c index 1af391b..d022c45 100644 --- a/datapath-windows/ovsext/PacketIO.c +++ b/datapath-windows/ovsext/PacketIO.c @@ -193,6 +193,10 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, LIST_ENTRY missedPackets; UINT32 num = 0; OvsCompletionList completionList; + PNET_BUFFER_LIST extForwardedNbls = NULL; + PNET_BUFFER_LIST nativeForwardedNbls = NULL; + PNET_BUFFER_LIST *nextExtForwardNbl = &extForwardedNbls; + PNET_BUFFER_LIST *nextNativeForwardedNbl = &nativeForwardedNbls; dispatch = NDIS_TEST_SEND_AT_DISPATCH_LEVEL(SendFlags)? NDIS_RWL_AT_DISPATCH_LEVEL : 0; @@ -201,8 +205,27 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, InitializeListHead(&missedPackets); OvsInitCompletionList(&completionList, switchContext, sendCompleteFlags); - - for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) { + + /* + * Split NBL list into NBLs to be forwarded by us, and those that require + * native forwarding. */ + for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) { + nextNbl = curNbl->Next; + curNbl->Next = NULL; + fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl); + + if (fwdDetail->NativeForwardingRequired) { + *nextNativeForwardedNbl = curNbl; + nextNativeForwardedNbl = &(curNbl->Next); + } + else + { + *nextExtForwardNbl = curNbl; + nextExtForwardNbl = &(curNbl->Next); + } + } + + for (curNbl = extForwardedNbls; curNbl != NULL; curNbl = nextNbl) { POVS_VPORT_ENTRY vport; UINT32 portNo; OVS_DATAPATH *datapath = &switchContext->datapath; @@ -315,6 +338,12 @@ dropit: } } + if (nativeForwardedNbls) { + /* This is NVGRE encapsulated traffic and is forwarded to NDIS + * in order to be handled by the HNV module. */ + OvsSendNBLIngress(switchContext, nativeForwardedNbls, SendFlags); + } + /* Queue the missed packets. */ OvsQueuePackets(&missedPackets, num); OvsFinalizeCompletionList(&completionList); diff --git a/datapath-windows/ovsext/ovsext.vcxproj b/datapath-windows/ovsext/ovsext.vcxproj index 88c9122..2a34f5d 100644 --- a/datapath-windows/ovsext/ovsext.vcxproj +++ b/datapath-windows/ovsext/ovsext.vcxproj @@ -104,13 +104,13 @@ </PropertyGroup> <ItemDefinitionGroup> <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1</PreprocessorDefinitions> </ClCompile> <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1</PreprocessorDefinitions> </Midl> <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1</PreprocessorDefinitions> + <PreprocessorDefinitions>%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1</PreprocessorDefinitions> </ResourceCompile> </ItemDefinitionGroup> <ItemDefinitionGroup> -- 1.9.0.msysgit.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev