summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-11-29 12:40:10 -0800
committerOle Trøan <otroan@employees.org>2018-11-30 07:21:02 +0000
commitfa76a76bf3388f09d55d0c83e7aea507c44f9619 (patch)
treeee9f51236f6e4acf5627f11f27aff73de9d1fe15 /src/tests
parent4744ddbfe0012861895dbd33487569e46b81554b (diff)
session: segment handle in accept/connect notifications
Change-Id: I03884b6cde9d4c38ae13d1994fd8d37d44016ef0 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/vnet/session/udp_echo.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index 3c928965c02..ea68ee162d1 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -915,7 +915,6 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
udp_echo_main_t *utm = &udp_echo_main;
svm_fifo_segment_create_args_t _a, *a = &_a;
svm_fifo_segment_private_t *seg;
- u8 *seg_name;
int rv;
clib_memset (a, 0, sizeof (*a));
@@ -932,9 +931,8 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
seg = svm_fifo_segment_get_segment (a->new_segment_indices[0]);
clib_warning ("Mapped new segment '%s' size %d", seg->ssvm.name,
seg->ssvm.ssvm_size);
- seg_name = format (0, "%s", (char *) mp->segment_name);
- hash_set_mem (utm->segments_table, seg_name, a->new_segment_indices[0]);
- vec_free (seg_name);
+ hash_set (utm->segments_table, clib_net_to_host_u64 (mp->segment_handle),
+ a->new_segment_indices[0]);
}
static void
@@ -942,22 +940,19 @@ vl_api_unmap_segment_t_handler (vl_api_unmap_segment_t * mp)
{
udp_echo_main_t *utm = &udp_echo_main;
svm_fifo_segment_private_t *seg;
- u64 *seg_indexp;
- u8 *seg_name;
+ u64 *seg_indexp, segment_handle;
-
- seg_name = format (0, "%s", mp->segment_name);
- seg_indexp = hash_get_mem (utm->segments_table, seg_name);
+ segment_handle = clib_net_to_host_u64 (mp->segment_handle);
+ seg_indexp = hash_get (utm->segments_table, segment_handle);
if (!seg_indexp)
{
- clib_warning ("segment not mapped: %s", seg_name);
+ clib_warning ("segment not mapped: %s", segment_handle);
return;
}
- hash_unset_mem (utm->segments_table, seg_name);
+ hash_unset (utm->segments_table, segment_handle);
seg = svm_fifo_segment_get_segment ((u32) seg_indexp[0]);
svm_fifo_segment_delete (seg);
- clib_warning ("Unmapped segment '%s'", seg_name);
- vec_free (seg_name);
+ clib_warning ("Unmapped segment '%s'", segment_handle);
}
static void
@@ -1228,7 +1223,6 @@ main (int argc, char **argv)
utm->session_index_by_vpp_handles = hash_create (0, sizeof (uword));
utm->my_pid = getpid ();
utm->configured_segment_size = 1 << 20;
- utm->segments_table = hash_create_vec (0, sizeof (u8), sizeof (u64));
utm->have_return = 1;
utm->bytes_to_send = 1024;
utm->fifo_size = 128 << 10;
{ color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 *------------------------------------------------------------------
 * Copyright (c) 2017 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *------------------------------------------------------------------
 */

#ifndef _IGMP_ERROR_H_
#define _IGMP_ERROR_H_

#define foreach_igmp_error					\
  _ (NONE, "valid igmp packets")				\
  _ (UNSPECIFIED, "unspecified error")				\
  _ (INVALID_PROTOCOL, "invalid ip4 protocol")			\
  _ (BAD_CHECKSUM, "bad checksum")				\
  _ (UNKNOWN_TYPE, "unknown igmp message type")			\
  _ (NOT_ENABLED, "IGMP not enabled on this interface")         \

typedef enum
{
#define _(sym,str) IGMP_ERROR_##sym,
  foreach_igmp_error
#undef _
    IGMP_N_ERROR,
} igmp_error_t;

#endif /* IGMP_ERROR_H */

/*
 * fd.io coding-style-patch-verification: ON
 *
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */