History

openvswitch: Add recirc and hash action.

Recirc action allows a packet to reenter openvswitch processing. currently openvswitch lookup flow for packet received and execute set of actions on that packet, with help of recirc action we can process/modify the packet and recirculate it back in openvswitch for another pass. OVS hash action calculates 5-tupple hash and set hash in flow-key hash. This can be used along with recirculation for distributing packets among different ports for bond devices. For example: OVS bonding can use following actions: Match on: bond flow; Action: hash, recirc(id) Match on: recirc-id == id and hash lower bits == a; Action: output port_bond_a

Andy Zhou committed 12 years ago

Commit 971427f1 parent 32ae87f7 files · +288 −12Browse files

Showing the changes to include/uapi/linux (1 of 7 files). Show all

Unified · Split

include/uapi/linux/openvswitch.h+26−0
@@ -289,6 +289,9 @@ enum ovs_key_attr { · 288 unmodified lines
289 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */289 OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */
290 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */290 OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */
291 OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */291 OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */
292 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash
293 is not computed by the datapath. */
294 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */
292 295
293#ifdef __KERNEL__296#ifdef __KERNEL__
294 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */297 OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */
@@ -493,6 +496,27 @@ struct ovs_action_push_vlan { · 198 unmodified lines
493 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */496 __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
494};497};
495 498
499/* Data path hash algorithm for computing Datapath hash.
500 *
501 * The algorithm type only specifies the fields in a flow
502 * will be used as part of the hash. Each datapath is free
503 * to use its own hash algorithm. The hash value will be
504 * opaque to the user space daemon.
505 */
506enum ovs_hash_alg {
507 OVS_HASH_ALG_L4,
508};
509
510/*
511 * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument.
512 * @hash_alg: Algorithm used to compute hash prior to recirculation.
513 * @hash_basis: basis used for computing hash.
514 */
515struct ovs_action_hash {
516 uint32_t hash_alg; /* One of ovs_hash_alg. */
517 uint32_t hash_basis;
518};
519
496/**520/**
497 * enum ovs_action_attr - Action types.521 * enum ovs_action_attr - Action types.
498 *522 *
@@ -521,6 +545,8 @@ enum ovs_action_attr { · 22 unmodified lines
521 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */545 OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
522 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */546 OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
523 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */547 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
548 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */
549 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
524 __OVS_ACTION_ATTR_MAX550 __OVS_ACTION_ATTR_MAX
525};551};
526 552