aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/gre/packet.h
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-02-13 17:15:23 -0500
committerNeale Ranns <nranns@cisco.com>2018-02-15 11:07:56 +0000
commita43ccaefc3bd50c03c90f7c3bee02eac9709df56 (patch)
treebd2820c08864b8c3094cc6f6dddb279926c625cc /src/vnet/gre/packet.h
parent5fda7a3925be145f0c326d0aecc36d883cbcb2ee (diff)
Optimize GRE Tunnel and add support for ERSPAN encap
Change GRE tunnel to use the interface type where the same encap node is used as output node for all GRE tunnels, instead of having dedicated output and tx node for each tunnel. This allows for more efficient tunnel creation and deletion at scale tested at 1000's of GRE tunnels. Add support for ERSPAN encap as another tunnel type, in addition to the existing L3 and TEB types. The GRE ERSPAN encap supported is type 2 thus GRE encap need to include sequence number and GRE- ERSPAN tunnel can be created with user secified ERSPAN session ID. The GRE tunnel lookup hash key is updated to inclue tunnel type and session ID, in addition to SIP/DIP and FIB index. Thus, GRE-ERSPAN tunnel can be created, with the appropriate session ID, to be used as output interface for SPAN config to send mirrored packets. Change interface naming so that all GRE tunnels, irrespective of tunnel type, uses "greN" where N is the instance number. Removed interface reuse on tunnel creation and deletion to enable unfied tunnel interface name. Add support of user specified instance on GRE tunnel creation. Thus, N in the "greN" interface name can optionally be specified by user via CLI/API. Optimize GRE tunnel encap DPO stacking to bypass load-balance DPO node since packet output on GRE tunnel always belong to the same flow after 5-tupple hash. Change-Id: Ifa83915744a1a88045c998604777cc3583f4da52 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/gre/packet.h')
-rw-r--r--src/vnet/gre/packet.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/vnet/gre/packet.h b/src/vnet/gre/packet.h
index 64b39f2c40b..034a611eda3 100644
--- a/src/vnet/gre/packet.h
+++ b/src/vnet/gre/packet.h
@@ -24,6 +24,7 @@ _ (0x86DD, ip6) \
_ (0x6558, teb) \
_ (0x0806, arp) \
_ (0x8847, mpls_unicast) \
+_ (0x88BE, erspan) \
_ (0x894F, nsh)
typedef enum
@@ -54,6 +55,111 @@ typedef struct
u16 protocol;
} gre_header_t;
+/* From draft-foschiano-erspan-03.txt
+
+ Different frame variants known as "ERSPAN Types" can be
+ distinguished based on the GRE "Protocol Type" field value: Type I
+ and II's value is 0x88BE while Type III's is 0x22EB [ETYPES].
+
+ GRE header for ERSPAN Type II encapsulation (8 octets [34:41])
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |0|0|0|1|0|00000|000000000|00000| Protocol Type for ERSPAN |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Sequence Number (increments per packet per session) |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ Note that in the above GRE header [RFC1701] out of the C, R, K, S,
+ s, Recur, Flags, Version fields only S (bit 03) may be set to 1. The
+ other fields are always set to zero.
+
+ ERSPAN Type II's frame format also adds a special 8-octet ERSPAN
+ "feature" header on top of the MAC/IPv4/GRE headers to enclose the
+ raw mirrored frames.
+
+ The ERSPAN Type II feature header is described below:
+
+ ERSPAN Type II header (8 octets [42:49])
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Ver | VLAN | COS | En|T| Session ID |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Reserved | Index |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ The various fields of the above header are described in this table:
+
+ Field Position Length Definition
+ [octet:bit] (bits)
+
+ Ver [42:0] 4 ERSPAN Encapsulation version.
+ This indicates the version of
+ the ERSPAN encapsulation
+ specification. Set to 0x1 for
+ Type II.
+
+ VLAN [42:4] 12 Original VLAN of the frame,
+ mirrored from the source.
+ If the En field is set to 11,
+ the value of VLAN is undefined.
+
+ COS [44:0] 3 Original class of service of the
+ frame, mirrored from the source.
+
+ En [44:3] 2 The trunk encapsulation type
+ associated with the ERSPAN source
+ port for ingress ERSPAN traffic.
+
+ The possible values are:
+ 00-originally without VLAN tag
+ 01-originally ISL encapsulated
+ 10-originally 802.1Q encapsulated
+ 11-VLAN tag preserved in frame.
+
+ T [44:5] 1 This bit indicates that the frame
+ copy encapsulated in the ERSPAN
+ packet has been truncated. This
+ occurs if the ERSPAN encapsulated
+ frame exceeds the configured MTU.
+
+ Session ID [44:6] 10 Identification associated with
+ (ERSPAN ID) each ERSPAN session. Must be
+ unique between the source and the
+ receiver(s). (See section below.)
+
+ Reserved [46:0] 12 All bits are set to zero
+
+ Index [47:4] 20 A 20 bit index/port number
+ associated with the ERSPAN
+ traffic's port and
+ direction (ingress/egress). N.B.:
+ This field is platform dependent.
+*/
+
+/* *INDENT-OFF* */
+typedef CLIB_PACKED (struct {
+ u32 seq_num;
+ union
+ {
+ struct
+ {
+ u16 ver_vlan;
+ u16 cos_en_t_session;
+ u32 res_index;
+ } t2;
+ u64 t2_u64;
+ };
+}) erspan_t2_t;
+
+typedef CLIB_PACKED (struct {
+ gre_header_t gre;
+ erspan_t2_t erspan;
+}) erspan_t2_header_t;
+
+/* *INDENT-ON* */
+
#endif /* included_vnet_gre_packet_h */
/*