X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=datapath%2Factions.c;h=c4b4605945541673f5f46d53313750c308607632;hb=7804df205faf285037994c7d222dfd45d5c00c49;hp=82cfd2d50f79b9af8a8389ac556ec2e8c014e55b;hpb=270a2b8e7692fb0102503d9d590d92db80155ea4;p=sliver-openvswitch.git diff --git a/datapath/actions.c b/datapath/actions.c index 82cfd2d50..c4b460594 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -460,6 +460,21 @@ static int sample(struct datapath *dp, struct sk_buff *skb, nla_len(acts_list), true); } +static void execute_hash(struct sk_buff *skb, const struct nlattr *attr) +{ + struct sw_flow_key *key = OVS_CB(skb)->pkt_key; + struct ovs_action_hash *hash_act = nla_data(attr); + u32 hash = 0; + + /* OVS_HASH_ALG_L4 is the only possible hash algorithm. */ + hash = skb_get_rxhash(skb); + hash = jhash_1word(hash, hash_act->hash_basis); + if (!hash) + hash = 0x1; + + key->ovs_flow_hash = hash; +} + static int execute_set_action(struct sk_buff *skb, const struct nlattr *nested_attr) { @@ -536,6 +551,10 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, output_userspace(dp, skb, a); break; + case OVS_ACTION_ATTR_HASH: + execute_hash(skb, a); + break; + case OVS_ACTION_ATTR_PUSH_VLAN: err = push_vlan(skb, nla_data(a)); if (unlikely(err)) /* skb already freed. */