diff mbox

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

Message ID 20170110005924.1864-6-kumaranand@vmware.com
State Superseded
Headers show

Commit Message

Anand Kumar Jan. 10, 2017, 12:59 a.m. UTC
MRU value is updated only for the Ipv4 fragments. If it is non zero,
then fragment the NBL based on MRU value and send out the new NBL to
the vnic.
---
 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 9cc79dc..3156fb6 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 */
+            fragNbl = OvsFragmentNBL(ovsFwdCtx->switchContext,ovsFwdCtx->curNbl, &(ovsFwdCtx->layers),
+                                     ovsFwdCtx->mru, 0, TRUE);
+            if (fragNbl != NULL) {
+                OvsCompleteNBLForwardingCtx(ovsFwdCtx,
+                                            L"Dropped, failed to create fragments");
+                ovsFwdCtx->sendFlags |= NDIS_SEND_FLAGS_SWITCH_DESTINATION_GROUP;
+                status = OvsInitForwardingCtx(ovsFwdCtx,
+                                              ovsFwdCtx->switchContext,
+                                              fragNbl,
+                                              ovsFwdCtx->srcVportNo,
+                                              ovsFwdCtx->sendFlags,
+                                              NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL(fragNbl),
+                                              ovsFwdCtx->mru,
+                                              ovsFwdCtx->completionList,
+                                              &ovsFwdCtx->layers, FALSE);
+                if (status != NDIS_STATUS_SUCCESS) {
+                    dropReason = L"Dropped due to resouces";
+                    goto dropit;
+                }
+            }
+        }
+
         OvsSendNBLIngress(ovsFwdCtx->switchContext, ovsFwdCtx->curNbl,
                           ovsFwdCtx->sendFlags);
         /* End this pipeline by resetting the corresponding context. */