aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2015-02-05 16:40:49 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-08 01:40:17 -0500
commit83d2b9ba1abca241df44a502b6da950a25856b5b (patch)
tree16b6618df6b9cdbbf955457352cb71acd8cca324 /include/uapi
parent2150f984258e7909327cb90115c8ff41b4e9acb5 (diff)
net: openvswitch: Support masked set actions.
OVS userspace already probes the openvswitch kernel module for OVS_ACTION_ATTR_SET_MASKED support. This patch adds the kernel module implementation of masked set actions. The existing set action sets many fields at once. When only a subset of the IP header fields, for example, should be modified, all the IP fields need to be exact matched so that the other field values can be copied to the set action. A masked set action allows modification of an arbitrary subset of the supported header bits without requiring the rest to be matched. Masked set action is now supported for all writeable key types, except for the tunnel key. The set tunnel action is an exception as any input tunnel info is cleared before action processing starts, so there is no tunnel info to mask. The kernel module converts all (non-tunnel) set actions to masked set actions. This makes action processing more uniform, and results in less branching and duplicating the action processing code. When returning actions to userspace, the fully masked set actions are converted back to normal set actions. We use a kernel internal action code to be able to tell the userspace provided and converted masked set actions apart. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/openvswitch.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 7a8785a99243..bbd49a0c46c7 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -599,6 +599,12 @@ struct ovs_action_hash {
599 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The 599 * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
600 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its 600 * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
601 * value. 601 * value.
602 * @OVS_ACTION_ATTR_SET_MASKED: Replaces the contents of an existing header. A
603 * nested %OVS_KEY_ATTR_* attribute specifies a header to modify, its value,
604 * and a mask. For every bit set in the mask, the corresponding bit value
605 * is copied from the value to the packet header field, rest of the bits are
606 * left unchanged. The non-masked value bits must be passed in as zeroes.
607 * Masking is not supported for the %OVS_KEY_ATTR_TUNNEL attribute.
602 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the 608 * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
603 * packet. 609 * packet.
604 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. 610 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
@@ -617,6 +623,9 @@ struct ovs_action_hash {
617 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all 623 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
618 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment 624 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
619 * type may not be changed. 625 * type may not be changed.
626 *
627 * @OVS_ACTION_ATTR_SET_TO_MASKED: Kernel internal masked set action translated
628 * from the @OVS_ACTION_ATTR_SET.
620 */ 629 */
621 630
622enum ovs_action_attr { 631enum ovs_action_attr {
@@ -631,8 +640,19 @@ enum ovs_action_attr {
631 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */ 640 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
632 OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */ 641 OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */
633 OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */ 642 OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */
643 OVS_ACTION_ATTR_SET_MASKED, /* One nested OVS_KEY_ATTR_* including
644 * data immediately followed by a mask.
645 * The data must be zero for the unmasked
646 * bits. */
647
648 __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted
649 * from userspace. */
634 650
635 __OVS_ACTION_ATTR_MAX 651#ifdef __KERNEL__
652 OVS_ACTION_ATTR_SET_TO_MASKED, /* Kernel module internal masked
653 * set action converted from
654 * OVS_ACTION_ATTR_SET. */
655#endif
636}; 656};
637 657
638#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) 658#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)