diff mbox

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

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

Commit Message

Anand Kumar March 24, 2017, 8:51 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.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
---
v5->v6: No Change
v4->v5:
	- Use MRU information in the _OVS_BUFFER_CONTEXT to fragment NBL.
v3->v4: No Change
v2->v3:
	- Updated log message
v1->v2: No change
---
 datapath-windows/ovsext/Actions.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Sairam Venugopal April 6, 2017, 4:57 p.m. UTC | #1
Acked-by: Sairam Venugopal <vsairam@vmware.com>





On 3/24/17, 1:51 PM, "ovs-dev-bounces@openvswitch.org on behalf of Anand Kumar" <ovs-dev-bounces@openvswitch.org on behalf of kumaranand@vmware.com> wrote:

>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.
>
>Signed-off-by: Anand Kumar <kumaranand@vmware.com>
>---
>v5->v6: No Change
>v4->v5:
>	- Use MRU information in the _OVS_BUFFER_CONTEXT to fragment NBL.
>v3->v4: No Change
>v2->v3:
>	- Updated log message
>v1->v2: No change
>---
> datapath-windows/ovsext/Actions.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
>diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
>index cbc7640..a68679c 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
>@@ -864,6 +865,8 @@ OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
>     NDIS_STATUS status = STATUS_SUCCESS;
>     POVS_SWITCH_CONTEXT switchContext = ovsFwdCtx->switchContext;
>     PCWSTR dropReason;
>+    PNET_BUFFER_LIST fragNbl = NULL;
>+    POVS_BUFFER_CONTEXT ctx;
> 
>     /*
>      * Handle the case where the some of the destination ports are tunneled
>@@ -909,6 +912,30 @@ OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
>             goto dropit;
>         }
> 
>+        ctx = (POVS_BUFFER_CONTEXT)NET_BUFFER_LIST_CONTEXT_DATA_START(ovsFwdCtx->curNbl);
>+        if (ctx->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),
>+                                     ctx->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->completionList,
>+                                              &ovsFwdCtx->layers, FALSE);
>+            }
>+        }
>+
>         OvsSendNBLIngress(ovsFwdCtx->switchContext, ovsFwdCtx->curNbl,
>                           ovsFwdCtx->sendFlags);
>         /* End this pipeline by resetting the corresponding context. */
>-- 
>2.9.3.windows.1
>
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=3sl4LJX8-HSAc_mfofbqDS1UYgla5hIj4zVdVv8Mz5c&s=CuBYGxQI9b-Q-vjVq6DY8KAqOu1TllZ5TWdmnea67go&e=
Alin Serdean April 7, 2017, 2:29 a.m. UTC | #2
Mind creating a function for it? You will need to add the same for OvsTunnelPortTx as well, otherwise the packet won't be fragmented to the vif value before sending it via a tunnel type (i.e. vxlan).

I will try to explain more on patch 0.

> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> bounces@openvswitch.org] On Behalf Of Anand Kumar
> Sent: Friday, March 24, 2017 10:51 PM
> To: dev@openvswitch.org
> Subject: [ovs-dev] [PATCH v6 5/5] datapath-windows: Fragment NBL based
> on MRU size
> 
> 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.
> 
> Signed-off-by: Anand Kumar <kumaranand@vmware.com>
> ---
> v5->v6: No Change
> v4->v5:
> 	- Use MRU information in the _OVS_BUFFER_CONTEXT to fragment
> NBL.
> v3->v4: No Change
> v2->v3:
> 	- Updated log message
> v1->v2: No change
> ---
>  datapath-windows/ovsext/Actions.c | 27
> +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/datapath-windows/ovsext/Actions.c b/datapath-
> windows/ovsext/Actions.c
> index cbc7640..a68679c 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
> @@ -864,6 +865,8 @@ OvsOutputForwardingCtx(OvsForwardingContext
> *ovsFwdCtx)
>      NDIS_STATUS status = STATUS_SUCCESS;
>      POVS_SWITCH_CONTEXT switchContext = ovsFwdCtx->switchContext;
>      PCWSTR dropReason;
> +    PNET_BUFFER_LIST fragNbl = NULL;
> +    POVS_BUFFER_CONTEXT ctx;
> 
>      /*
>       * Handle the case where the some of the destination ports are tunneled
> @@ -909,6 +912,30 @@ OvsOutputForwardingCtx(OvsForwardingContext
> *ovsFwdCtx)
>              goto dropit;
>          }
> 
> +        ctx =
> (POVS_BUFFER_CONTEXT)NET_BUFFER_LIST_CONTEXT_DATA_START(ovsF
> wdCtx->curNbl);
> +        if (ctx->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),
> +                                     ctx->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->completionList,
> +                                              &ovsFwdCtx->layers, FALSE);
> +            }
> +        }
> +
>          OvsSendNBLIngress(ovsFwdCtx->switchContext, ovsFwdCtx->curNbl,
>                            ovsFwdCtx->sendFlags);
>          /* End this pipeline by resetting the corresponding context. */
> --
> 2.9.3.windows.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox

Patch

diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c
index cbc7640..a68679c 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
@@ -864,6 +865,8 @@  OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
     NDIS_STATUS status = STATUS_SUCCESS;
     POVS_SWITCH_CONTEXT switchContext = ovsFwdCtx->switchContext;
     PCWSTR dropReason;
+    PNET_BUFFER_LIST fragNbl = NULL;
+    POVS_BUFFER_CONTEXT ctx;
 
     /*
      * Handle the case where the some of the destination ports are tunneled
@@ -909,6 +912,30 @@  OvsOutputForwardingCtx(OvsForwardingContext *ovsFwdCtx)
             goto dropit;
         }
 
+        ctx = (POVS_BUFFER_CONTEXT)NET_BUFFER_LIST_CONTEXT_DATA_START(ovsFwdCtx->curNbl);
+        if (ctx->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),
+                                     ctx->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->completionList,
+                                              &ovsFwdCtx->layers, FALSE);
+            }
+        }
+
         OvsSendNBLIngress(ovsFwdCtx->switchContext, ovsFwdCtx->curNbl,
                           ovsFwdCtx->sendFlags);
         /* End this pipeline by resetting the corresponding context. */