From aec524e024e6a3f9a3a242defeab2f5c2cc62649 Mon Sep 17 00:00:00 2001 From: Hongjun Ni Date: Tue, 2 Aug 2016 01:33:51 +0800 Subject: Fix tlv[0] issue of nsh_entry PatchSet 2: delete tlv Change-Id: I19131a8dfc441be1d7cbb92c817a3f7e583f9189 Signed-off-by: Hongjun Ni --- nsh-plugin/build.sh | 2 +- nsh-plugin/nsh/nsh.api | 14 ++++++-------- nsh-plugin/nsh/nsh.c | 5 ----- nsh-plugin/nsh/nsh_test.c | 4 ---- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/nsh-plugin/build.sh b/nsh-plugin/build.sh index 4a8c3d1..aae99c9 100755 --- a/nsh-plugin/build.sh +++ b/nsh-plugin/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash NSH_PLUGIN_DIR=$(dirname $0) -NSH_INSTALL_PREFIX=${NSH_INSTALL_PREFIX:-/usr} +NSH_INSTALL_PREFIX=${NSH_INSTALL_PREFIX:-/usr/local} cd ${NSH_PLUGIN_DIR} autoreconf -i -f [ -d build ] || mkdir build diff --git a/nsh-plugin/nsh/nsh.api b/nsh-plugin/nsh/nsh.api index 0f9e13d..01292d1 100644 --- a/nsh-plugin/nsh/nsh.api +++ b/nsh-plugin/nsh/nsh.api @@ -24,11 +24,10 @@ define nsh_add_del_entry { u8 ver_o_c; u8 length; u8 next_protocol; - u32 c1; + u32 c1; u32 c2; - u32 c3; + u32 c3; u32 c4; - u32 tlvs[0]; }; /** \brief Reply from adding NSH entry (nsh_add_del_entry) @@ -53,19 +52,18 @@ define nsh_entry_details { u8 ver_o_c; u8 length; u8 next_protocol; - u32 c1; + u32 c1; u32 c2; - u32 c3; + u32 c3; u32 c4; - u32 tlvs[0]; }; /** \brief Set or delete a mapping from one NSH header to another and its egress (decap to inner packet, encap NSH with outer header) @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param is_add - add address if non-zero, else delete - @param nsh_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI - @param mapped_nsp_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI this may be ~0 + @param nsh_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI + @param mapped_nsp_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI this may be ~0 if next action is to decap to NSH next protocol Note the following heuristic: - if nsp_nsi == mapped_nsp_nsi then use-case is like SFC SFF diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c index 21a972e..19c8fa7 100644 --- a/nsh-plugin/nsh/nsh.c +++ b/nsh-plugin/nsh/nsh.c @@ -469,7 +469,6 @@ nsh_add_del_entry_command_fn (vlib_main_t * vm, u32 c2 = 0; u32 c3 = 0; u32 c4 = 0; - u32 *tlvs = 0; u32 tmp; int rv; nsh_add_del_entry_args_t _a, * a = &_a; @@ -507,8 +506,6 @@ nsh_add_del_entry_command_fn (vlib_main_t * vm, nsp_set = 1; else if (unformat (line_input, "nsi %d", &nsi)) nsi_set = 1; - else if (unformat (line_input, "tlv %x")) - vec_add1 (tlvs, tmp); else return clib_error_return (0, "parse error: '%U'", format_unformat_error, line_input); @@ -538,8 +535,6 @@ nsh_add_del_entry_command_fn (vlib_main_t * vm, foreach_copy_nshhdr_field; #undef _ - a->nsh.tlvs[0] = 0 ; // TODO FIXME this shouldn't be set 0 - in NSH_SFC project - rv = nsh_add_del_entry (a); switch(rv) diff --git a/nsh-plugin/nsh/nsh_test.c b/nsh-plugin/nsh/nsh_test.c index dc3c4d0..d3dabee 100644 --- a/nsh-plugin/nsh/nsh_test.c +++ b/nsh-plugin/nsh/nsh_test.c @@ -143,7 +143,6 @@ static int api_nsh_add_del_entry (vat_main_t * vam) u32 c2 = 0; u32 c3 = 0; u32 c4 = 0; - u32 *tlvs = 0; u32 tmp; vl_api_nsh_add_del_entry_t * mp; @@ -176,8 +175,6 @@ static int api_nsh_add_del_entry (vat_main_t * vam) nsp_set = 1; else if (unformat (line_input, "nsi %d", &nsi)) nsi_set = 1; - else if (unformat (line_input, "tlv %x")) - vec_add1 (tlvs, tmp); else return -99; // PARSE ERROR; } @@ -207,7 +204,6 @@ static int api_nsh_add_del_entry (vat_main_t * vam) foreach_copy_nshhdr_field; #undef _ - mp->tlvs[0] = 0 ; // TODO FIXME this shouldn't be set 0 - in NSH_SFC project /* send it... */ S; -- cgit 1.2.3-korg