History

openvswitch: Add basic MPLS support to kernel

Allow datapath to recognize and extract MPLS labels into flow keys and execute actions which push, pop, and set labels on packets. Based heavily on work by Leo Alterman, Ravi K, Isaku Yamahata and Joe Stringer.

Simon Horman committed 12 years ago

Commit 25cd9ba1 parent 59b93b410 files · +345 −30Browse files

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

Unified · Split

include/uapi/linux/openvswitch.h+32−0
@@ -293,6 +293,9 @@ enum ovs_key_attr { · 292 unmodified lines
293293 OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash
294294 is not computed by the datapath. */
295295 OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */
296+ OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls.
297+ * The implementation may restrict
298+ * the accepted length of the array. */
296299
297300 #ifdef __KERNEL__
298301 OVS_KEY_ATTR_TUNNEL_INFO, /* struct ovs_tunnel_info */
@@ -340,6 +343,10 @@ struct ovs_key_ethernet { · 41 unmodified lines
340343 __u8 eth_dst[ETH_ALEN];
341344 };
342345
346+struct ovs_key_mpls {
347+ __be32 mpls_lse;
348+};
349+
343350 struct ovs_key_ipv4 {
344351 __be32 ipv4_src;
345352 __be32 ipv4_dst;
@@ -483,6 +490,19 @@ enum ovs_userspace_attr { · 137 unmodified lines
483490
484491 #define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
485492
493+/**
494+ * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument.
495+ * @mpls_lse: MPLS label stack entry to push.
496+ * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame.
497+ *
498+ * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and
499+ * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected.
500+ */
501+struct ovs_action_push_mpls {
502+ __be32 mpls_lse;
503+ __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
504+};
505+
486506 /**
487507 * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
488508 * @vlan_tpid: Tag protocol identifier (TPID) to push.
@@ -534,6 +554,15 @@ struct ovs_action_hash { · 45 unmodified lines
534554 * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
535555 * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
536556 * the nested %OVS_SAMPLE_ATTR_* attributes.
557+ * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the
558+ * top of the packets MPLS label stack. Set the ethertype of the
559+ * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to
560+ * indicate the new packet contents.
561+ * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the
562+ * packet's MPLS label stack. Set the encapsulating frame's ethertype to
563+ * indicate the new packet contents. This could potentially still be
564+ * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there
565+ * is no MPLS label stack, as determined by ethertype, no action is taken.
537566 *
538567 * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
539568 * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
@@ -550,6 +579,9 @@ enum ovs_action_attr { · 10 unmodified lines
550579 OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
551580 OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */
552581 OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
582+ OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */
583+ OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */
584+
553585 __OVS_ACTION_ATTR_MAX
554586 };
555587