diff mbox

[ovs-dev] datapath-windows: Add support for OVS_CT_ATTR_FORCE_COMMIT

Message ID 20170321070202.62680-1-vsairam@vmware.com
State Accepted
Headers show

Commit Message

Sairam Venugopal March 21, 2017, 7:02 a.m. UTC
Add support for handling OVS_CT_ATTR_FORCE_COMMIT in Conntrack action.
When this flag is specified, it implicitly means commit and deletes
entries in the reverse direction.

Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
---
 datapath-windows/ovsext/Conntrack.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Comments

Alin Serdean March 21, 2017, 4:57 p.m. UTC | #1
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>


> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> bounces@openvswitch.org] On Behalf Of Sairam Venugopal
> Sent: Tuesday, March 21, 2017 9:02 AM
> To: dev@openvswitch.org
> Subject: [ovs-dev] [PATCH] datapath-windows: Add support for
> OVS_CT_ATTR_FORCE_COMMIT
> 
> Add support for handling OVS_CT_ATTR_FORCE_COMMIT in Conntrack
> action.
> When this flag is specified, it implicitly means commit and deletes entries in
> the reverse direction.
> 
> Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
> ---
Gurucharan Shetty March 22, 2017, 4:06 p.m. UTC | #2
On 21 March 2017 at 00:02, Sairam Venugopal <vsairam@vmware.com> wrote:

> Add support for handling OVS_CT_ATTR_FORCE_COMMIT in Conntrack action.
> When this flag is specified, it implicitly means commit and deletes
> entries in the reverse direction.
>
> Signed-off-by: Sairam Venugopal <vsairam@vmware.com>
>

Applied to master.


> ---
>  datapath-windows/ovsext/Conntrack.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/datapath-windows/ovsext/Conntrack.c
> b/datapath-windows/ovsext/Conntrack.c
> index 9f41861..35ab7a1 100644
> --- a/datapath-windows/ovsext/Conntrack.c
> +++ b/datapath-windows/ovsext/Conntrack.c
> @@ -633,6 +633,7 @@ OvsCtExecute_(PNET_BUFFER_LIST curNbl,
>                OvsFlowKey *key,
>                OVS_PACKET_HDR_INFO *layers,
>                BOOLEAN commit,
> +              BOOLEAN force,
>                UINT16 zone,
>                MD_MARK *mark,
>                MD_LABELS *labels,
> @@ -653,6 +654,13 @@ OvsCtExecute_(PNET_BUFFER_LIST curNbl,
>      /* Lookup Conntrack entries for a matching entry */
>      entry = OvsCtLookup(&ctx);
>      BOOLEAN entryCreated = FALSE;
> +
> +    /* Delete entry in reverse direction if 'force' is specified */
> +    if (entry && force && ctx.reply) {
> +        OvsCtEntryDelete(entry);
> +        entry = NULL;
> +    }
> +
>      if (!entry) {
>          /* If no matching entry was found, create one and add New state */
>          entry = OvsCtEntryCreate(curNbl, key->ipKey.nwProto,
> @@ -709,6 +717,7 @@ OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
>  {
>      PNL_ATTR ctAttr;
>      BOOLEAN commit = FALSE;
> +    BOOLEAN force = FALSE;
>      UINT16 zone = 0;
>      MD_MARK *mark = NULL;
>      MD_LABELS *labels = NULL;
> @@ -721,6 +730,7 @@ OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
>          return status;
>      }
>
> +    /* XXX Convert this to NL_ATTR_FOR_EACH */
>      ctAttr = NlAttrFindNested(a, OVS_CT_ATTR_ZONE);
>      if (ctAttr) {
>          zone = NlAttrGetU16(ctAttr);
> @@ -748,9 +758,15 @@ OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
>              return NDIS_STATUS_NOT_SUPPORTED;
>          }
>      }
> +    ctAttr = NlAttrFindNested(a, OVS_CT_ATTR_FORCE_COMMIT);
> +    if (ctAttr) {
> +        force = TRUE;
> +        /* Force implicitly means commit */
> +        commit = TRUE;
> +    }
>
> -    status = OvsCtExecute_(curNbl, key, layers,
> -                           commit, zone, mark, labels, helper);
> +    status = OvsCtExecute_(curNbl, key, layers, commit, force,
> +                           zone, mark, labels, helper);
>      return status;
>  }
>
> --
> 2.9.0.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/Conntrack.c b/datapath-windows/ovsext/Conntrack.c
index 9f41861..35ab7a1 100644
--- a/datapath-windows/ovsext/Conntrack.c
+++ b/datapath-windows/ovsext/Conntrack.c
@@ -633,6 +633,7 @@  OvsCtExecute_(PNET_BUFFER_LIST curNbl,
               OvsFlowKey *key,
               OVS_PACKET_HDR_INFO *layers,
               BOOLEAN commit,
+              BOOLEAN force,
               UINT16 zone,
               MD_MARK *mark,
               MD_LABELS *labels,
@@ -653,6 +654,13 @@  OvsCtExecute_(PNET_BUFFER_LIST curNbl,
     /* Lookup Conntrack entries for a matching entry */
     entry = OvsCtLookup(&ctx);
     BOOLEAN entryCreated = FALSE;
+
+    /* Delete entry in reverse direction if 'force' is specified */
+    if (entry && force && ctx.reply) {
+        OvsCtEntryDelete(entry);
+        entry = NULL;
+    }
+
     if (!entry) {
         /* If no matching entry was found, create one and add New state */
         entry = OvsCtEntryCreate(curNbl, key->ipKey.nwProto,
@@ -709,6 +717,7 @@  OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
 {
     PNL_ATTR ctAttr;
     BOOLEAN commit = FALSE;
+    BOOLEAN force = FALSE;
     UINT16 zone = 0;
     MD_MARK *mark = NULL;
     MD_LABELS *labels = NULL;
@@ -721,6 +730,7 @@  OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
         return status;
     }
 
+    /* XXX Convert this to NL_ATTR_FOR_EACH */
     ctAttr = NlAttrFindNested(a, OVS_CT_ATTR_ZONE);
     if (ctAttr) {
         zone = NlAttrGetU16(ctAttr);
@@ -748,9 +758,15 @@  OvsExecuteConntrackAction(PNET_BUFFER_LIST curNbl,
             return NDIS_STATUS_NOT_SUPPORTED;
         }
     }
+    ctAttr = NlAttrFindNested(a, OVS_CT_ATTR_FORCE_COMMIT);
+    if (ctAttr) {
+        force = TRUE;
+        /* Force implicitly means commit */
+        commit = TRUE;
+    }
 
-    status = OvsCtExecute_(curNbl, key, layers,
-                           commit, zone, mark, labels, helper);
+    status = OvsCtExecute_(curNbl, key, layers, commit, force,
+                           zone, mark, labels, helper);
     return status;
 }