summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/PacketIO.c
diff options
context:
space:
mode:
authorSorin Vinturis <svinturis@cloudbasesolutions.com>2014-11-24 22:32:06 +0000
committerBen Pfaff <blp@nicira.com>2014-11-24 17:10:17 -0800
commitd6b7cf62b0cdcb5853cf2385205ddfe4624b88d3 (patch)
tree34f6d218fbdeccec94647cf6da1a74a397909014 /datapath-windows/ovsext/PacketIO.c
parentd24f701b5e2d4e30c4bdd83f87f61b04b6e63d5b (diff)
downloadopenvswitch-d6b7cf62b0cdcb5853cf2385205ddfe4624b88d3.tar.gz
datapath-windows: Support for hybrid forwarding
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 <svinturis@cloudbasesolutions.com> Reported-by: Nithin Raju <nithin@vmware.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/52 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/PacketIO.c')
-rw-r--r--datapath-windows/ovsext/PacketIO.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/PacketIO.c b/datapath-windows/ovsext/PacketIO.c
index 1af391b42..1f5c8b0f6 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 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)?
NDIS_RWL_AT_DISPATCH_LEVEL : 0;
@@ -202,7 +206,48 @@ 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;
@@ -315,6 +360,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);