diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2017-01-22 23:41:33 +0800 |
---|---|---|
committer | Hongjun Ni <hongjun.ni@intel.com> | 2017-03-10 23:22:32 +0800 |
commit | a865240bfc157e06699319e39251e3653ca205f5 (patch) | |
tree | 7a85bd11ce162e2e2ad7220103b01ce207cf14ac /nsh-plugin/nsh/nsh_packet.h | |
parent | 3f3ac79b962de5c1be97c6fa7a0cd815379b419f (diff) |
Restructure code to support both md-type1 and md-type2
Basic support to both MD1 and MD2
MD1 configuration:
create nsh entry nsp 185 nsi 255 md-type 1 c1 1 c2 2 c3 3 c4 4 next-ethernet
MD2 configuration:
create nsh entry nsp 185 nsi 254 md-type 2 pot next-ethernet
Change-Id: Ide0fdc122d76cb6a55643a15febd985bd41981b0
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Signed-off-by: Vengada <venggovi@cisco.com>
Diffstat (limited to 'nsh-plugin/nsh/nsh_packet.h')
-rw-r--r-- | nsh-plugin/nsh/nsh_packet.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/nsh-plugin/nsh/nsh_packet.h b/nsh-plugin/nsh/nsh_packet.h index 553fc0b..101652a 100644 --- a/nsh-plugin/nsh/nsh_packet.h +++ b/nsh-plugin/nsh/nsh_packet.h @@ -74,11 +74,30 @@ typedef CLIB_PACKED(struct { u8 md_type; u8 next_protocol; u32 nsp_nsi; // nsp 24 bits, nsi 8 bits +}) nsh_base_header_t; + +typedef CLIB_PACKED(struct { /* Context headers, always present */ - u32 c1; u32 c2; u32 c3; u32 c4; + u32 c1; + u32 c2; + u32 c3; + u32 c4; +}) nsh_md1_data_t; - /* Optional variable length metadata */ - u32 tlvs[0]; +typedef CLIB_PACKED(struct { + u16 class; + u8 type; + u8 length; +}) nsh_tlv_header_t; + +typedef nsh_tlv_header_t nsh_md2_data_t; + +typedef CLIB_PACKED(struct { + nsh_base_header_t nsh_base; + union { + nsh_md1_data_t md1_data; + nsh_md2_data_t md2_data; + } md; }) nsh_header_t; #define NSH_VERSION (0<<6) |