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. Necessary VS project changes regarding the compiler settings will be made in a different patch. 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 | 41 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/datapath-windows/ovsext/PacketIO.c b/datapath-windows/ovsext/PacketIO.c index 1af391b..78b62c1 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,35 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, InitializeListHead(&missedPackets); OvsInitCompletionList(&completionList, switchContext, sendCompleteFlags); - - for (curNbl = netBufferLists; curNbl != NULL; curNbl = nextNbl) { + +#if (NDIS_SUPPORT_NDIS640) + /* + * 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); + } + } +#else + UNREFERENCED_PARAMETER(nativeForwardedNbls); + UNREFERENCED_PARAMETER(nextNativeForwardedNbl); + UNREFERENCED_PARAMETER(nextExtForwardNbl); + + extForwardedNbls = netBufferLists; +#endif + + for (curNbl = extForwardedNbls; curNbl != NULL; curNbl = nextNbl) { POVS_VPORT_ENTRY vport; UINT32 portNo; OVS_DATAPATH *datapath = &switchContext->datapath; @@ -315,6 +346,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); -- 1.9.0.msysgit.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev