2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-21 14:49:41 +00:00

User-Space MPLS actions and matches

This patch implements use-space datapath and non-datapath code
to match and use the datapath API set out in Leo Alterman's patch
"user-space datapath: Add basic MPLS support to kernel".

The resulting MPLS implementation supports:
* Pushing a single MPLS label
* Poping a single MPLS label
* Modifying an MPLS lable using set-field or load actions
  that act on the label value, tc and bos bit.
* There is no support for manipulating the TTL
  this is considered future work.

The single-level push pop limitation is implemented by processing
push, pop and set-field/load actions in order and discarding information
that would require multiple levels of push/pop to be supported.

e.g.
   push,push -> the first push is discarded
   pop,pop -> the first pop is discarded

This patch is based heavily on work by Ravi K.

Cc: Ravi K <rkerur@gmail.com>
Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Simon Horman
2013-01-25 16:22:07 +09:00
committed by Ben Pfaff
parent d224e35014
commit b02475c53b
29 changed files with 1223 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -304,6 +304,8 @@ enum nx_action_subtype {
NXAST_CONTROLLER, /* struct nx_action_controller */
NXAST_DEC_TTL_CNT_IDS, /* struct nx_action_cnt_ids */
NXAST_WRITE_METADATA, /* struct nx_action_write_metadata */
NXAST_PUSH_MPLS, /* struct nx_action_push_mpls */
NXAST_POP_MPLS, /* struct nx_action_pop_mpls */
};
/* Header for Nicira-defined actions. */
@@ -2212,4 +2214,26 @@ struct nx_action_write_metadata {
};
OFP_ASSERT(sizeof(struct nx_action_write_metadata) == 32);
/* Action structure for NXAST_PUSH_MPLS. */
struct nx_action_push_mpls {
ovs_be16 type; /* OFPAT_VENDOR. */
ovs_be16 len; /* Length is 8. */
ovs_be32 vendor; /* NX_VENDOR_ID. */
ovs_be16 subtype; /* NXAST_PUSH_MPLS. */
ovs_be16 ethertype; /* Ethertype */
uint8_t pad[4];
};
OFP_ASSERT(sizeof(struct nx_action_push_mpls) == 16);
/* Action structure for NXAST_POP_MPLS. */
struct nx_action_pop_mpls {
ovs_be16 type; /* OFPAT_VENDOR. */
ovs_be16 len; /* Length is 8. */
ovs_be32 vendor; /* NX_VENDOR_ID. */
ovs_be16 subtype; /* NXAST_POP_MPLS. */
ovs_be16 ethertype; /* Ethertype */
uint8_t pad[4];
};
OFP_ASSERT(sizeof(struct nx_action_pop_mpls) == 16);
#endif /* openflow/nicira-ext.h */

View File

@@ -204,8 +204,8 @@ enum ofp11_action_type {
OFPAT11_PUSH_VLAN, /* Push a new VLAN tag */
OFPAT11_POP_VLAN, /* Pop the outer VLAN tag */
OFPAT11_PUSH_MPLS, /* Push a new MPLS tag */
OFPAT11_POP_MPLS, /* Pop the outer MPLS tag */
OFPAT11_PUSH_MPLS, /* Push a new MPLS Label Stack Entry */
OFPAT11_POP_MPLS, /* Pop the outer MPLS Label Stack Entry */
OFPAT11_SET_QUEUE, /* Set queue id when outputting to a port */
OFPAT11_GROUP, /* Apply group. */
OFPAT11_SET_NW_TTL, /* IP TTL. */