/* * Copyright (c) 2015 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 included_vlib_threads_h #define included_vlib_threads_h #include #include extern vlib_main_t **vlib_mains; void vlib_set_thread_name (char *name); /* arg is actually a vlib__thread_t * */ typedef void (vlib_thread_function_t) (void *arg); typedef struct vlib_thread_registration_ { /* constructor generated list of thread registrations */ struct vlib_thread_registration_ *next; /* config parameters */ char *name; char *short_name; vlib_thread_function_t *function; uword mheap_size; int fixed_count; u32 count; int no_data_structure_clone; u32 frame_queue_nelts; /* All threads of this type run on pthreads */ int use_pthreads; u32 first_index; uword *coremask; } vlib_thread_registration_t; /* * Frames have their cpu / vlib_main_t index in the low-order N bits * Make VLIB_MAX_CPUS a power-of-two, please... */ #ifndef VLIB_MAX_CPUS #define VLIB_MAX_CPUS 256 #endif #if VLIB_MAX_CPUS > CLIB_MAX_MHEAPS #error Please increase number of per-cpu mheaps #endif #define VLIB_CPU_MASK (VLIB_MAX_CPUS - 1) /* 0x3f, max */ #define VLIB_OFFSET_MASK (~VLIB_CPU_MASK) #define VLIB_LOG2_THREAD_STACK_SIZE (21) #define VLIB_THREAD_STACK_SIZE (1< 0 /* long barrier timeout, for gdb... */ #define BARRIER_SYNC_TIMEOUT (600.1) #else #define BARRIER_SYNC_TIMEOUT (1.0) #endif #define vlib_worker_thread_barrier_sync(X) {vlib_worker_thread_barrier_sync_int(X, __FUNCTION__);} void vlib_worker_thread_barrier_sync_int (vlib_main_t * vm, const char *func_name); void vlib_worker_thread_barrier_release (vlib_main_t * vm); void vlib_worker_thread_node_refork (void); static_always_inline uword vlib_get_thread_index (void) { return __os_thread_index; } always_inline void vlib_smp_unsafe_warning (void) { if (CLIB_DEBUG > 0) { if (vlib_get_thread_index ()) fformat (stderr, "%s: SMP unsafe warning...\n", __FUNCTION__); } } typedef enum { VLIB_WORKER_THREAD_FORK_FIXUP_ILLEGAL = 0, VLIB_WORKER_THREAD_FORK_FIXUP_NEW_SW_IF_INDEX, } vlib_fork_fixup_t; void vlib_worker_thread_fork_fixup (vlib_fork_fixup_t which); #define foreach_vlib_main(body) \ do {
/*
 * Copyright (c) 2018 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.
 */
/**
 * @file syslog protocol UDP transport layer declaration (RFC5426)
 */
#ifndef __included_syslog_udp_h__
#define __included_syslog_udp_h__

#include <vnet/syslog/syslog.h>

/**
 * @brief Add UDP/IP transport layer by prepending it to existing data
 */
void syslog_add_udp_transport (vlib_main_t * vm, u32 bi);

#endif /* __includ