diff mbox series

[ovs-dev,v2] datapath-windows: Update OvsIPv4TunnelKey flags in geneve decap.

Message ID 20171019202617.3480-1-kumaranand@vmware.com
State Accepted
Headers show
Series [ovs-dev,v2] datapath-windows: Update OvsIPv4TunnelKey flags in geneve decap. | expand

Commit Message

Anand Kumar Oct. 19, 2017, 8:26 p.m. UTC
Currently, the OvsLookupFlow fails for the decap packet,
when the Geneve options are present in the packet as the OvsIPv4TunnelKey
flags are not set in the Geneve decap.

Set the OvsIPv4TunnelKey flags OVS_TNL_F_OAM and OVS_TNL_F_CRT_OPT
in OvsDecapGeneve based on the geneve header. Also set OVS_TNL_F_GENEVE_OPT
if the packet has geneve options.

Signed-off-by: Anand Kumar <kumaranand@vmware.com>
---
 datapath-windows/ovsext/Geneve.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Sairam Venugopal Oct. 19, 2017, 9:14 p.m. UTC | #1
Thanks for fixing this.

Alin/Guru - Can we back port this to 2.8 too? This causes flow misses when geneve options are present.

Acked-by: Sairam Venugopal <vsairam@vmware.com>






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

>Currently, the OvsLookupFlow fails for the decap packet,
>when the Geneve options are present in the packet as the OvsIPv4TunnelKey
>flags are not set in the Geneve decap.
>
>Set the OvsIPv4TunnelKey flags OVS_TNL_F_OAM and OVS_TNL_F_CRT_OPT
>in OvsDecapGeneve based on the geneve header. Also set OVS_TNL_F_GENEVE_OPT
>if the packet has geneve options.
>
>Signed-off-by: Anand Kumar <kumaranand@vmware.com>
>---
> datapath-windows/ovsext/Geneve.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
>diff --git a/datapath-windows/ovsext/Geneve.c b/datapath-windows/ovsext/Geneve.c
>index 43374e2..6dca69b 100644
>--- a/datapath-windows/ovsext/Geneve.c
>+++ b/datapath-windows/ovsext/Geneve.c
>@@ -324,10 +324,10 @@ NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
>         status = STATUS_NDIS_INVALID_PACKET;
>         goto dropNbl;
>     }
>-    tunKey->flags = OVS_TNL_F_KEY;
>-    if (geneveHdr->oam) {
>-        tunKey->flags |= OVS_TNL_F_OAM;
>-    }
>+    /* Update tunnelKey flags. */
>+    tunKey->flags = OVS_TNL_F_KEY | (geneveHdr->oam ? OVS_TNL_F_OAM : 0) |
>+                    (geneveHdr->critical ? OVS_TNL_F_CRT_OPT : 0);
>+
>     tunKey->tunnelId = GENEVE_VNI_TO_TUNNELID(geneveHdr->vni);
>     tunKey->tunOptLen = (uint8)geneveHdr->optLen * 4;
>     if (tunKey->tunOptLen > TUN_OPT_MAX_LEN ||
>@@ -349,6 +349,7 @@ NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
>             memcpy(TunnelKeyGetOptions(tunKey), optStart, tunKey->tunOptLen);
>         }
>         NdisAdvanceNetBufferDataStart(curNb, tunKey->tunOptLen, FALSE, NULL);
>+        tunKey->flags |= OVS_TNL_F_GENEVE_OPT;
>     }
> 
>     return NDIS_STATUS_SUCCESS;
>-- 
>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=BRjHHHPFJJP1H7BWHjwF0OS4UFpTbBiTQNM1SPvh51w&s=JCowvVY7CQ4CxJWnx8dPPqUbvS346xU066Dd0DnMI8A&e=
Alin-Gabriel Serdean Oct. 20, 2017, 4:10 p.m. UTC | #2
Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>

> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> bounces@openvswitch.org] On Behalf Of Anand Kumar
> Sent: Thursday, October 19, 2017 11:26 PM
> To: dev@openvswitch.org
> Subject: [ovs-dev] [PATCH v2] datapath-windows: Update
> OvsIPv4TunnelKey flags in geneve decap.
> 
> Currently, the OvsLookupFlow fails for the decap packet, when the Geneve
> options are present in the packet as the OvsIPv4TunnelKey flags are not
set
> in the Geneve decap.
> 
> Set the OvsIPv4TunnelKey flags OVS_TNL_F_OAM and
> OVS_TNL_F_CRT_OPT in OvsDecapGeneve based on the geneve header.
> Also set OVS_TNL_F_GENEVE_OPT if the packet has geneve options.
> 
> Signed-off-by: Anand Kumar <kumaranand@vmware.com>
> ---
>  datapath-windows/ovsext/Geneve.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/datapath-windows/ovsext/Geneve.c b/datapath-
> windows/ovsext/Geneve.c
> index 43374e2..6dca69b 100644
> --- a/datapath-windows/ovsext/Geneve.c
> +++ b/datapath-windows/ovsext/Geneve.c
> @@ -324,10 +324,10 @@ NDIS_STATUS
> OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
>          status = STATUS_NDIS_INVALID_PACKET;
>          goto dropNbl;
>      }
> -    tunKey->flags = OVS_TNL_F_KEY;
> -    if (geneveHdr->oam) {
> -        tunKey->flags |= OVS_TNL_F_OAM;
> -    }
> +    /* Update tunnelKey flags. */
> +    tunKey->flags = OVS_TNL_F_KEY | (geneveHdr->oam ?
> OVS_TNL_F_OAM : 0) |
> +                    (geneveHdr->critical ? OVS_TNL_F_CRT_OPT : 0);
> +
>      tunKey->tunnelId = GENEVE_VNI_TO_TUNNELID(geneveHdr->vni);
>      tunKey->tunOptLen = (uint8)geneveHdr->optLen * 4;
>      if (tunKey->tunOptLen > TUN_OPT_MAX_LEN || @@ -349,6 +349,7 @@
> NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
>              memcpy(TunnelKeyGetOptions(tunKey), optStart, tunKey-
> >tunOptLen);
>          }
>          NdisAdvanceNetBufferDataStart(curNb, tunKey->tunOptLen, FALSE,
> NULL);
> +        tunKey->flags |= OVS_TNL_F_GENEVE_OPT;
>      }
> 
>      return NDIS_STATUS_SUCCESS;
> --
> 2.9.3.windows.1
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Alin Serdean Oct. 20, 2017, 4:20 p.m. UTC | #3
Thanks Anand and Sai. I applied this on master and on branch-2.8.

Should we apply this on branch-2.7 also?

Thanks,
Alin.

> -----Original Message-----
> From: Sairam Venugopal [mailto:vsairam@vmware.com]
> Sent: Friday, October 20, 2017 12:15 AM
> To: Anand Kumar <kumaranand@vmware.com>; dev@openvswitch.org
> Cc: Alin Serdean <aserdean@cloudbasesolutions.com>; Gurucharan Shetty
> <guru@ovn.org>
> Subject: Re: [ovs-dev] [PATCH v2] datapath-windows: Update
> OvsIPv4TunnelKey flags in geneve decap.
> 
> Thanks for fixing this.
> 
> Alin/Guru - Can we back port this to 2.8 too? This causes flow misses when
> geneve options are present.
> 
> Acked-by: Sairam Venugopal <vsairam@vmware.com>
> 
> 
> 
> 
> 
> 
> On 10/19/17, 1:26 PM, "ovs-dev-bounces@openvswitch.org on behalf of
> Anand Kumar" <ovs-dev-bounces@openvswitch.org on behalf of
> kumaranand@vmware.com> wrote:
> 
> >Currently, the OvsLookupFlow fails for the decap packet, when the
> >Geneve options are present in the packet as the OvsIPv4TunnelKey flags
> >are not set in the Geneve decap.
> >
> >Set the OvsIPv4TunnelKey flags OVS_TNL_F_OAM and
> OVS_TNL_F_CRT_OPT in
> >OvsDecapGeneve based on the geneve header. Also set
> >OVS_TNL_F_GENEVE_OPT if the packet has geneve options.
> >
> >Signed-off-by: Anand Kumar <kumaranand@vmware.com>
> >---
> > datapath-windows/ovsext/Geneve.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> >diff --git a/datapath-windows/ovsext/Geneve.c
> >b/datapath-windows/ovsext/Geneve.c
> >index 43374e2..6dca69b 100644
> >--- a/datapath-windows/ovsext/Geneve.c
> >+++ b/datapath-windows/ovsext/Geneve.c
> >@@ -324,10 +324,10 @@ NDIS_STATUS
> OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
> >         status = STATUS_NDIS_INVALID_PACKET;
> >         goto dropNbl;
> >     }
> >-    tunKey->flags = OVS_TNL_F_KEY;
> >-    if (geneveHdr->oam) {
> >-        tunKey->flags |= OVS_TNL_F_OAM;
> >-    }
> >+    /* Update tunnelKey flags. */
> >+    tunKey->flags = OVS_TNL_F_KEY | (geneveHdr->oam ?
> OVS_TNL_F_OAM : 0) |
> >+                    (geneveHdr->critical ? OVS_TNL_F_CRT_OPT : 0);
> >+
> >     tunKey->tunnelId = GENEVE_VNI_TO_TUNNELID(geneveHdr->vni);
> >     tunKey->tunOptLen = (uint8)geneveHdr->optLen * 4;
> >     if (tunKey->tunOptLen > TUN_OPT_MAX_LEN || @@ -349,6 +349,7 @@
> >NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
> >             memcpy(TunnelKeyGetOptions(tunKey), optStart, tunKey-
> >tunOptLen);
> >         }
> >         NdisAdvanceNetBufferDataStart(curNb, tunKey->tunOptLen, FALSE,
> >NULL);
> >+        tunKey->flags |= OVS_TNL_F_GENEVE_OPT;
> >     }
> >
> >     return NDIS_STATUS_SUCCESS;
> >--
> >2.9.3.windows.1
> >
> >_______________________________________________
> >dev mailing list
> >dev@openvswitch.org
> >https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__mail.openvswitch.o
> >rg_mailman_listinfo_ovs-
> 2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vow
> >HUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=BRjHHHPFJJP1H7BWHj
> wF0OS4UFpTbB
> >iTQNM1SPvh51w&s=JCowvVY7CQ4CxJWnx8dPPqUbvS346xU066Dd0DnMI8
> A&e=
diff mbox series

Patch

diff --git a/datapath-windows/ovsext/Geneve.c b/datapath-windows/ovsext/Geneve.c
index 43374e2..6dca69b 100644
--- a/datapath-windows/ovsext/Geneve.c
+++ b/datapath-windows/ovsext/Geneve.c
@@ -324,10 +324,10 @@  NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
         status = STATUS_NDIS_INVALID_PACKET;
         goto dropNbl;
     }
-    tunKey->flags = OVS_TNL_F_KEY;
-    if (geneveHdr->oam) {
-        tunKey->flags |= OVS_TNL_F_OAM;
-    }
+    /* Update tunnelKey flags. */
+    tunKey->flags = OVS_TNL_F_KEY | (geneveHdr->oam ? OVS_TNL_F_OAM : 0) |
+                    (geneveHdr->critical ? OVS_TNL_F_CRT_OPT : 0);
+
     tunKey->tunnelId = GENEVE_VNI_TO_TUNNELID(geneveHdr->vni);
     tunKey->tunOptLen = (uint8)geneveHdr->optLen * 4;
     if (tunKey->tunOptLen > TUN_OPT_MAX_LEN ||
@@ -349,6 +349,7 @@  NDIS_STATUS OvsDecapGeneve(POVS_SWITCH_CONTEXT switchContext,
             memcpy(TunnelKeyGetOptions(tunKey), optStart, tunKey->tunOptLen);
         }
         NdisAdvanceNetBufferDataStart(curNb, tunKey->tunOptLen, FALSE, NULL);
+        tunKey->flags |= OVS_TNL_F_GENEVE_OPT;
     }
 
     return NDIS_STATUS_SUCCESS;