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

On 2/22/16, 6:07 AM, "Sorin Vinturis" <svintu...@cloudbasesolutions.com>
wrote:

>Signed-off-by: Sorin Vinturis <svintu...@cloudbasesolutions.com>
>---
>v3: No changes from the previous version.
>---
> datapath-windows/ovsext/Actions.c    | 32
>++++++++++++++++++++++++++++++++
> datapath-windows/ovsext/DpInternal.h |  1 +
> datapath-windows/ovsext/Flow.c       | 13 +++++++++++++
> 3 files changed, 46 insertions(+)
>
>diff --git a/datapath-windows/ovsext/Actions.c
>b/datapath-windows/ovsext/Actions.c
>index d3f18f2..d3f9be4 100644
>--- a/datapath-windows/ovsext/Actions.c
>+++ b/datapath-windows/ovsext/Actions.c
>@@ -19,6 +19,7 @@
> #include "Event.h"
> #include "Flow.h"
> #include "Gre.h"
>+#include "Jhash.h"
> #include "Mpls.h"
> #include "NetProto.h"
> #include "Offload.h"
>@@ -1571,6 +1572,21 @@ OvsActionExecuteRecirc(POVS_SWITCH_CONTEXT
>switchContext,
>     return STATUS_SUCCESS;
> }
> 
>+VOID
>+OvsActionExecuteHash(OvsFlowKey *key,
>+                     const PNL_ATTR attr)
>+{
>+    struct ovs_action_hash *hash_act = NlAttrData(attr);
>+    UINT32 hash = 0;
>+
>+    hash = (UINT32)OvsHashFlow(key);
>+    hash = OvsJhashWords(&hash, 1, hash_act->hash_basis);
>+    if (!hash)
>+        hash = 1;
>+
>+    key->dpHash = hash;
>+}
>+
> /*
>  * 
>--------------------------------------------------------------------------
>  * OvsDoExecuteActions --
>@@ -1748,6 +1764,22 @@ OvsDoExecuteActions(POVS_SWITCH_CONTEXT
>switchContext,
>             break;
>         }
> 
>+        case OVS_ACTION_ATTR_HASH:
>+        {
>+            if (ovsFwdCtx.destPortsSizeOut > 0 || ovsFwdCtx.tunnelTxNic
>!= NULL
>+                || ovsFwdCtx.tunnelRxNic != NULL) {
>+                status = OvsOutputBeforeSetAction(&ovsFwdCtx);
>+                if (status != NDIS_STATUS_SUCCESS) {
>+                    dropReason = L"OVS-adding destination failed";
>+                    goto dropit;
>+                }
>+            }
>+
>+            OvsActionExecuteHash(key, (const PNL_ATTR)a);
>+
>+            break;
>+        }
>+
>         case OVS_ACTION_ATTR_RECIRC:
>         {
>             if (ovsFwdCtx.destPortsSizeOut > 0 || ovsFwdCtx.tunnelTxNic
>!= NULL
>diff --git a/datapath-windows/ovsext/DpInternal.h
>b/datapath-windows/ovsext/DpInternal.h
>index 845c132..612ff7b 100644
>--- a/datapath-windows/ovsext/DpInternal.h
>+++ b/datapath-windows/ovsext/DpInternal.h
>@@ -166,6 +166,7 @@ typedef __declspec(align(8)) struct OvsFlowKey {
>         MplsKey mplsKey;         /* size 8 */
>     };
>     UINT32 recircId;             /* Recirculation ID.  */
>+    UINT32 dpHash;               /* Datapath calculated hash value. */
> } OvsFlowKey;
> 
> #define OVS_WIN_TUNNEL_KEY_SIZE (sizeof (OvsIPv4TunnelKey))
>diff --git a/datapath-windows/ovsext/Flow.c
>b/datapath-windows/ovsext/Flow.c
>index a481eca..8fc068e 100644
>--- a/datapath-windows/ovsext/Flow.c
>+++ b/datapath-windows/ovsext/Flow.c
>@@ -830,6 +830,14 @@ MapFlowKeyToNlKey(PNL_BUFFER nlBuf,
>         goto done;
>     }
> 
>+    if (flowKey->dpHash) {
>+        if (!NlMsgPutTailU32(nlBuf, OVS_KEY_ATTR_DP_HASH,
>+                             flowKey->dpHash)) {
>+            rc = STATUS_UNSUCCESSFUL;
>+            goto done;
>+        }
>+    }
>+
>     /* Ethernet header */
>     RtlCopyMemory(&(ethKey.eth_src), flowKey->l2.dlSrc, ETH_ADDR_LEN);
>     RtlCopyMemory(&(ethKey.eth_dst), flowKey->l2.dlDst, ETH_ADDR_LEN);
>@@ -1356,6 +1364,10 @@ _MapKeyAttrToFlowPut(PNL_ATTR *keyAttrs,
>         destKey->recircId =
>NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_RECIRC_ID]);
>     }
> 
>+    if (keyAttrs[OVS_KEY_ATTR_DP_HASH]) {
>+        destKey->dpHash = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_DP_HASH]);
>+    }
>+
>     /* ===== L2 headers ===== */
>     destKey->l2.inPort = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_IN_PORT]);
> 
>@@ -2292,6 +2304,7 @@ ReportFlowInfo(OvsFlow *flow,
>     }
> 
>     info->key.recircId = flow->key.recircId;
>+    info->key.dpHash = flow->key.dpHash;
> 
>     return status;
> }
>-- 
>1.9.0.msysgit.0
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=http-3A__openvswitch.org_mailma
>n_listinfo_dev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Dc
>ruz40PROJ40ROzSpxyQSLw6fcrOWpJgEcEmNR3JEQ&m=s6nF6ybmqft6aXOJXfSlvCLaOdTN6I
>kK9y_QPQ0okUs&s=x0UyyuvQdD2-IrR8Bk2Td_D9WAmX8KVw1MSCr6IwlPc&e= 

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to