diff options
author | Sorin Vinturis <svinturis@cloudbasesolutions.com> | 2016-03-25 14:49:27 +0000 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-03-25 08:24:36 -0700 |
commit | 245eedef9519d8b75db7a7c36bc2ed1005938f81 (patch) | |
tree | 58470d50d932fe6e1ad9f72c3a05aef5927f3eba /datapath-windows/ovsext/Actions.c | |
parent | c7b46d8a0f58a61a28b1c626d2a7c61e5bec7651 (diff) | |
download | openvswitch-245eedef9519d8b75db7a7c36bc2ed1005938f81.tar.gz |
datapath-windows: Support for OVS_ACTION_ATTR_HASH attribute
Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Actions.c')
-rw-r--r-- | datapath-windows/ovsext/Actions.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Actions.c b/datapath-windows/ovsext/Actions.c index 199f6804e..a91454da1 100644 --- a/datapath-windows/ovsext/Actions.c +++ b/datapath-windows/ovsext/Actions.c @@ -21,6 +21,7 @@ #include "Event.h" #include "Flow.h" #include "Gre.h" +#include "Jhash.h" #include "Mpls.h" #include "NetProto.h" #include "Offload.h" @@ -1573,6 +1574,27 @@ OvsExecuteRecirc(OvsForwardingContext *ovsFwdCtx, /* * -------------------------------------------------------------------------- + * OvsExecuteHash -- + * The function updates datapath hash read from userspace. + * -------------------------------------------------------------------------- + */ +VOID +OvsExecuteHash(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 -- * Interpret and execute the specified 'actions' on the specified packet * 'curNbl'. The expectation is that if the packet needs to be dropped @@ -1748,6 +1770,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; + } + } + + OvsExecuteHash(key, (const PNL_ATTR)a); + + break; + } + case OVS_ACTION_ATTR_RECIRC: { if (ovsFwdCtx.destPortsSizeOut > 0 || ovsFwdCtx.tunnelTxNic != NULL |