diff options
author | Sorin Vinturis <svinturis@cloudbasesolutions.com> | 2015-05-08 06:16:51 +0000 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2015-05-08 09:32:56 -0700 |
commit | d0000b68f948536045cbf528198148020e1362eb (patch) | |
tree | 94e5e74a3c13b74bfab1993490d65b40f85d0a4b /datapath-windows | |
parent | 433637881ca5d1b71eed693afef162df8e529bff (diff) | |
download | openvswitch-d0000b68f948536045cbf528198148020e1362eb.tar.gz |
datapath-windows: Added new function for native forwarded traffic
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows')
-rw-r--r-- | datapath-windows/ovsext/PacketIO.c | 87 |
1 files changed, 40 insertions, 47 deletions
diff --git a/datapath-windows/ovsext/PacketIO.c b/datapath-windows/ovsext/PacketIO.c index 1f5c8b0f6..902e9aa4f 100644 --- a/datapath-windows/ovsext/PacketIO.c +++ b/datapath-windows/ovsext/PacketIO.c @@ -177,6 +177,29 @@ OvsStartNBLIngressError(POVS_SWITCH_CONTEXT switchContext, } static VOID +OvsAppendNativeForwardedPacket(POVS_SWITCH_CONTEXT switchContext, + PNET_BUFFER_LIST curNbl, + PNET_BUFFER_LIST *nativeNbls, + ULONG flags, + BOOLEAN isRecv) +{ + POVS_BUFFER_CONTEXT ctx = { 0 }; + NDIS_STRING filterReason; + + *nativeNbls = curNbl; + nativeNbls = &(curNbl->Next); + + ctx = OvsInitExternalNBLContext(switchContext, curNbl, isRecv); + if (ctx == NULL) { + RtlInitUnicodeString(&filterReason, + L"Cannot allocate native NBL context."); + + OvsStartNBLIngressError(switchContext, curNbl, flags, &filterReason, + NDIS_STATUS_RESOURCES); + } +} + +static VOID OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, PNET_BUFFER_LIST netBufferLists, ULONG SendFlags) @@ -193,9 +216,7 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, LIST_ENTRY missedPackets; UINT32 num = 0; OvsCompletionList completionList; - PNET_BUFFER_LIST ovsForwardedNbls = NULL; PNET_BUFFER_LIST nativeForwardedNbls = NULL; - PNET_BUFFER_LIST *nextOvsForwardNbl = &ovsForwardedNbls; PNET_BUFFER_LIST *nextNativeForwardedNbl = &nativeForwardedNbls; dispatch = NDIS_TEST_SEND_AT_DISPATCH_LEVEL(SendFlags)? @@ -206,48 +227,7 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, InitializeListHead(&missedPackets); OvsInitCompletionList(&completionList, switchContext, sendCompleteFlags); -#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) { - POVS_BUFFER_CONTEXT ctx; - - *nextNativeForwardedNbl = curNbl; - nextNativeForwardedNbl = &(curNbl->Next); - - ctx = OvsInitExternalNBLContext(switchContext, curNbl, - sourcePort == switchContext->virtualExternalPortId); - if (ctx == NULL) { - RtlInitUnicodeString(&filterReason, - L"Cannot allocate native NBL context."); - - OvsStartNBLIngressError(switchContext, curNbl, - sendCompleteFlags, &filterReason, - NDIS_STATUS_RESOURCES); - - continue; - } - } else { - *nextOvsForwardNbl = curNbl; - nextOvsForwardNbl = &(curNbl->Next); - } - } -#else - UNREFERENCED_PARAMETER(nativeForwardedNbls); - UNREFERENCED_PARAMETER(nextNativeForwardedNbl); - UNREFERENCED_PARAMETER(nextOvsForwardNbl); - - ovsForwardedNbls = netBufferLists; -#endif - - for (curNbl = ovsForwardedNbls; curNbl != NULL; curNbl = nextNbl) { POVS_VPORT_ENTRY vport; UINT32 portNo; OVS_DATAPATH *datapath = &switchContext->datapath; @@ -259,6 +239,23 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, nextNbl = curNbl->Next; curNbl->Next = NULL; + fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl); + sourcePort = fwdDetail->SourcePortId; + sourceIndex = (NDIS_SWITCH_NIC_INDEX)fwdDetail->SourceNicIndex; + +#if (NDIS_SUPPORT_NDIS640) + if (fwdDetail->NativeForwardingRequired) { + /* Add current NBL to those that require native forwarding. */ + OvsAppendNativeForwardedPacket( + switchContext, + curNbl, + nextNativeForwardedNbl, + sendCompleteFlags, + sourcePort == switchContext->virtualExternalPortId); + continue; + } +#endif + /* Ethernet Header is a guaranteed safe access. */ curNb = NET_BUFFER_LIST_FIRST_NB(curNbl); if (curNb->Next != NULL) { @@ -273,10 +270,6 @@ OvsStartNBLIngress(POVS_SWITCH_CONTEXT switchContext, POVS_BUFFER_CONTEXT ctx; OvsFlow *flow; - fwdDetail = NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(curNbl); - sourcePort = fwdDetail->SourcePortId; - sourceIndex = (NDIS_SWITCH_NIC_INDEX)fwdDetail->SourceNicIndex; - /* Take the DispatchLock so none of the VPORTs disconnect while * we are setting destination ports. * |