aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/util
AgeCommit message (Collapse)AuthorFilesLines
2021-05-01vlib: refactor trajectory trace debug featureBenoît Ganne1-99/+0
trajectory trace has been broken for a while because we used to save the buffer trajectory in a vector pointed to in opaque2. This does not work well when opaque2 is copied (eg. because of a clone) as 2 buffers end up sharing the same vector. This dedicates a full cacheline in the buffer metadata instead when trajectory is compiled in. No dynamic allocation, no sharing, no tears. Type: refactor Change-Id: I6a028ca1b48d38f393a36979e5e452c2dd48ad3f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-07-31vppinfra: refactor test_and_set spinlocks to use clib_spinlock_tjaszha031-9/+7
Spinlock performance improved when implemented with compare_and_exchange instead of test_and_set. All instances of test_and_set locks were refactored to use clib_spinlock_t when possible. Some locks e.g. ssvm synchronize between processes rather than threads, so they cannot directly use clib_spinlock_t. Type: refactor Change-Id: Ia16b5d4cd49209b2b57b8df6c94615c28b11bb60 Signed-off-by: Jason Zhang <jason.zhang2@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
2018-10-29Use throttle_t for ND throttlingNeale Ranns1-5/+7
Change-Id: I93c6b7bccd1a1ab71625ae29c99c974581186c4d Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-10-23c11 safe string handling supportDave Barach2-8/+8
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-19vppinfra: add atomic macros for __sync builtinsSirshak Das1-2/+2
This is first part of addition of atomic macros with only macros for __sync builtins. - Based on earlier patch by Damjan (https://gerrit.fd.io/r/#/c/10729/) Additionally - clib_atomic_release macro added and used in the absence of any memory barrier. - clib_atomic_bool_cmp_and_swap added Change-Id: Ie4e48c1e184a652018d1d0d87c4be80ddd180a3b Original-patch-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Sirshak Das <sirshak.das@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Steve Capper <steve.capper@arm.com>
2018-09-24Trivial: Clean up some typos.Paul Vinciguerra1-1/+1
Change-Id: I085615fde1f966490f30ed5d32017b8b088cfd59 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-08-30Refactor the ARP throttle into a common type so it can be reusedNeale Ranns2-0/+117
Change-Id: Ic7f7af983d5b6d756748023aa0c650f53e9285cf Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-07-23fix vector index range checksEyal Bari1-1/+1
Change-Id: I63c36644c9d93f2c3ec6606ca0205b407499de4e Signed-off-by: Eyal Bari <ebari@cisco.com>
2017-12-06Restructure some files in LB to src/vnet to reuseHongjun Ni2-0/+141
Change-Id: Ic8b193e93ce18ca82b294816aa7ee0ef31d64bc2 Signed-off-by: Pierre Pfister <ppfister@cisco.com> Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2017-11-28tcp: fix retransmissions under buffer shortageFlorin Coras1-1/+5
- add debugging scaffolding for simulating buffer shortage Change-Id: Ice519d74f9c4e4094c4586c548185135b7bb5f2d Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-10-19VPP-1024: rewrite buffer trajectory tracerDave Barach1-0/+95
Use a proper u16 * vector to capture node indices, since vpp w/ plugins now exceeds 255 graph nodes Change-Id: Ic48cad676fa3a6116413ddf08c083dd9660783f1 Signed-off-by: Dave Barach <dave@barachs.net>
2017-01-27IP Multicast FIB (mfib)Neale Ranns2-0/+1251
- IPv[46] mfib tables with support for (*,G/m), (*,G) and (S,G) exact and longest prefix match - Replication represented via a new replicate DPO. - RPF configuration and data-plane checking - data-plane signals sent to listening control planes. The functions of multicast forwarding entries differ from their unicast conterparts, so we introduce a new mfib_table_t and mfib_entry_t objects. However, we re-use the fib_path_list to resolve and build the entry's output list. the fib_path_list provides the service to construct a replicate DPO for multicast. 'make tests' is added to with two new suites; TEST=mfib, this is invocation of the CLI command 'test mfib' which deals with many path add/remove, flag set/unset scenarios, TEST=ip-mcast, data-plane forwarding tests. Updated applications to use the new MIFB functions; - IPv6 NS/RA. - DHCPv6 unit tests for these are undated accordingly. Change-Id: I49ec37b01f1b170335a5697541c8fd30e6d3a961 Signed-off-by: Neale Ranns <nranns@cisco.com>
nsed 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 __IP6_FIB_H__ #define __IP6_FIB_H__ #include <vlib/vlib.h> #include <vnet/ip/format.h> #include <vnet/fib/fib_entry.h> #include <vnet/fib/fib_table.h> #include <vnet/ip/lookup.h> #include <vnet/dpo/load_balance.h> extern fib_node_index_t ip6_fib_table_lookup(u32 fib_index, const ip6_address_t *addr, u32 len); extern fib_node_index_t ip6_fib_table_lookup_exact_match(u32 fib_index, const ip6_address_t *addr, u32 len); extern void ip6_fib_table_entry_remove(u32 fib_index, const ip6_address_t *addr, u32 len); extern void ip6_fib_table_entry_insert(u32 fib_index, const ip6_address_t *addr, u32 len, fib_node_index_t fib_entry_index); extern void ip6_fib_table_destroy(u32 fib_index); extern void ip6_fib_table_fwding_dpo_update(u32 fib_index, const ip6_address_t *addr, u32 len, const dpo_id_t *dpo); extern void ip6_fib_table_fwding_dpo_remove(u32 fib_index, const ip6_address_t *addr, u32 len, const dpo_id_t *dpo); u32 ip6_fib_table_fwding_lookup_with_if_index(ip6_main_t * im, u32 sw_if_index, const ip6_address_t * dst); u32 ip6_fib_table_fwding_lookup(ip6_main_t * im, u32 fib_index, const ip6_address_t * dst); /** * @biref return the DPO that the LB stacks on. */ always_inline u32 ip6_src_lookup_for_packet (ip6_main_t * im, vlib_buffer_t * b, ip6_header_t * i) { if (vnet_buffer (b)->ip.adj_index[VLIB_RX] == ~0) { const dpo_id_t *dpo; index_t lbi; lbi = ip6_fib_table_fwding_lookup_with_if_index( im, vnet_buffer (b)->sw_if_index[VLIB_RX], &i->src_address); dpo = load_balance_get_bucket_i(load_balance_get(lbi), 0); if (dpo_is_adj(dpo)) { vnet_buffer (b)->ip.adj_index[VLIB_RX] = dpo->dpoi_index; } } return vnet_buffer (b)->ip.adj_index[VLIB_RX]; } /** * \brief Get or create an IPv6 fib. * * Get or create an IPv4 fib with the provided table ID. * * \param im * ip4_main pointer. * \param table_id * When set to \c ~0, an arbitrary and unused fib ID is picked * and can be retrieved with \c ret->table_id. * Otherwise, the fib ID to be used to retrieve or create the desired fib. * \returns A pointer to the retrieved or created fib. * */ extern u32 ip6_fib_table_find_or_create_and_lock(u32 table_id); extern u32 ip6_fib_table_create_and_lock(void); static inline ip6_fib_t * ip6_fib_get (fib_node_index_t index) { ASSERT(!pool_is_free_index(ip6_main.fibs, index)); return (&pool_elt_at_index (ip6_main.fibs, index)->v6); } static inline u32 ip6_fib_index_from_table_id (u32 table_id) { ip6_main_t * im = &ip6_main; uword * p; p = hash_get (im->fib_index_by_table_id, table_id); if (!p) return ~0; return p[0]; } extern u32 ip6_fib_table_get_index_for_sw_if_index(u32 sw_if_index); extern flow_hash_config_t ip6_fib_table_get_flow_hash_config(u32 fib_index); #endif