Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
fib: Source Address Selection
[vpp.git]
/
src
/
vnet
/
ip-neighbor
/
ip6_neighbor.c
diff --git
a/src/vnet/ip-neighbor/ip6_neighbor.c
b/src/vnet/ip-neighbor/ip6_neighbor.c
index
325db8c
..
478eca7
100644
(file)
--- a/
src/vnet/ip-neighbor/ip6_neighbor.c
+++ b/
src/vnet/ip-neighbor/ip6_neighbor.c
@@
-16,20
+16,20
@@
*/
#include <vnet/ip-neighbor/ip6_neighbor.h>
*/
#include <vnet/ip-neighbor/ip6_neighbor.h>
+#include <vnet/util/throttle.h>
+#include <vnet/fib/fib_sas.h>
+
+/** ND throttling */
+static throttle_t nd_throttle;
void
void
-ip6_neighbor_probe_dst (
const ip_adjacency_t * adj
, const ip6_address_t * dst)
+ip6_neighbor_probe_dst (
u32 sw_if_index
, const ip6_address_t * dst)
{
{
- ip_interface_address_t *ia;
- ip6_address_t *src;
-
- src = ip6_interface_address_matching_destination
- (&ip6_main, dst, adj->rewrite_header.sw_if_index, &ia);
-
- if (!src)
- return;
+ ip6_address_t src;
- ip6_neighbor_probe (vlib_get_main (), vnet_get_main (), adj, src, dst);
+ if (fib_sas6_get (sw_if_index, dst, &src))
+ ip6_neighbor_probe (vlib_get_main (), vnet_get_main (),
+ sw_if_index, &src, dst);
}
void
}
void
@@
-121,7
+121,6
@@
ip6_discover_neighbor_inline (vlib_main_t * vm,
vlib_frame_t * frame, int is_glean)
{
vnet_main_t *vnm = vnet_get_main ();
vlib_frame_t * frame, int is_glean)
{
vnet_main_t *vnm = vnet_get_main ();
- ip6_main_t *im = &ip6_main;
u32 *from, *to_next_drop;
uword n_left_from, n_left_to_next_drop;
u64 seed;
u32 *from, *to_next_drop;
uword n_left_from, n_left_to_next_drop;
u64 seed;
@@
-130,7
+129,7
@@
ip6_discover_neighbor_inline (vlib_main_t * vm,
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
- seed = throttle_seed (&
im->
nd_throttle, thread_index, vlib_time_now (vm));
+ seed = throttle_seed (&nd_throttle, thread_index, vlib_time_now (vm));
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@
-173,7
+172,7
@@
ip6_discover_neighbor_inline (vlib_main_t * vm,
/* combine the address and interface for a hash */
r0 = ip6_address_hash_to_u64 (&ip0->dst_address) ^ sw_if_index0;
/* combine the address and interface for a hash */
r0 = ip6_address_hash_to_u64 (&ip0->dst_address) ^ sw_if_index0;
- drop0 = throttle_check (&
im->
nd_throttle, thread_index, r0, seed);
+ drop0 = throttle_check (&nd_throttle, thread_index, r0, seed);
from += 1;
n_left_from -= 1;
from += 1;
n_left_from -= 1;
@@
-207,15
+206,15
@@
ip6_discover_neighbor_inline (vlib_main_t * vm,
* Choose source address based on destination lookup
* adjacency.
*/
* Choose source address based on destination lookup
* adjacency.
*/
- if (!ip6_src_address_for_packet (sw_if_index0,
- &ip0->dst_address, &src))
+ if (!fib_sas6_get (sw_if_index0, &ip0->dst_address, &src))
{
/* There is no address on the interface */
p0->error = node->errors[IP6_NBR_ERROR_NO_SOURCE_ADDRESS];
continue;
}
{
/* There is no address on the interface */
p0->error = node->errors[IP6_NBR_ERROR_NO_SOURCE_ADDRESS];
continue;
}
- b0 = ip6_neighbor_probe (vm, vnm, adj0, &src, &ip0->dst_address);
+ b0 = ip6_neighbor_probe (vm, vnm, sw_if_index0,
+ &src, &ip0->dst_address);
if (PREDICT_TRUE (NULL != b0))
{
if (PREDICT_TRUE (NULL != b0))
{
@@
-329,6
+328,18
@@
ip6_neighbor_init (vlib_main_t * vm)
VLIB_INIT_FUNCTION (ip6_neighbor_init);
VLIB_INIT_FUNCTION (ip6_neighbor_init);
+static clib_error_t *
+ip6_nd_main_loop_enter (vlib_main_t * vm)
+{
+ vlib_thread_main_t *tm = &vlib_thread_main;
+
+ throttle_init (&nd_throttle, tm->n_vlib_mains, 1e-3);
+
+ return 0;
+}
+
+VLIB_MAIN_LOOP_ENTER_FUNCTION (ip6_nd_main_loop_enter);
+
/*
* fd.io coding-style-patch-verification: ON
*
/*
* fd.io coding-style-patch-verification: ON
*