diff mbox

[ovs-dev,v3,5/5] datapath-windows: Fragment NBL based on MRU size

Message ID 20170127221330.3844-6-kumaranand@vmware.com
State Superseded
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Anand Kumar Jan. 27, 2017, 10:13 p.m. UTC
This patch adds support for Fragmenting NBL based on the MRU value.
MRU value is updated only for Ipv4 fragments, if it is non zero, then
fragment the NBL and send out the new NBL to the vnic.

v2->v3:
	- Updated log message
v1->v2: No change

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
---
 datapath-windows/ovsext/Actions.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
diff mbox

Patch

diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
index 14eacb4..2f029c8 100644
--- a/datapath-windows/ovsext/Actions.c
+++ b/datapath-windows/ovsext/Actions.c
@@ -34,6 +34,7 @@ 
 #include "Vport.h"
 #include "Vxlan.h"
 #include "Geneve.h"
+#include "IpFragment.h"
 
 #ifdef OVS_DBG_MOD
 #undef OVS_DBG_MOD
@@ -873,6 +874,7 @@  OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
     NDIS_STATUS status = STATUS_SUCCESS;
     POVS_SWITCH_CONTEXT switchContext = ovsFwdCtx->switchContext;
     PCWSTR dropReason;
+    PNET_BUFFER_LIST fragNbl = NULL;
 
     /*
      * Handle the case where the some of the destination ports are tunneled
@@ -918,6 +920,30 @@  OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
             goto dropit;
         }
 
+        if (ovsFwdCtx->mru != 0) {
+            /* Fragment nbl based on mru. If it returns NULL then the original
+             * reassembled NBL is sent out to the VIF which will be dropped if
+             * the packet size is more than VIF MTU.
+             */
+            fragNbl = OvsFragmentNBL(ovsFwdCtx->switchContext,
+                                     ovsFwdCtx->curNbl,
+                                     &(ovsFwdCtx->layers),
+                                     ovsFwdCtx->mru, 0, TRUE);
+            if (fragNbl != NULL) {
+                OvsCompleteNBLForwardingCtx(ovsFwdCtx,
+                                            L"Dropped since fragmenting NBL");
+                status = OvsInitForwardingCtx(ovsFwdCtx,
+                                              ovsFwdCtx->switchContext,
+                                              fragNbl,
+                                              ovsFwdCtx->srcVportNo,
+                                              ovsFwdCtx->sendFlags,
+                                              NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(fragNbl),
+                                              ovsFwdCtx->mru,
+                                              ovsFwdCtx->completionList,
+                                              &ovsFwdCtx->layers, FALSE);
+            }
+        }
+
         OvsSendNBLIngress(ovsFwdCtx->switchContext, ovsFwdCtx->curNbl,
                           ovsFwdCtx->sendFlags);
         /* End this pipeline by resetting the corresponding context. */