Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/VPP-2129-CPP-build-compatible #3595

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ compile_commands.json
/startup.vpp
# log file archives
/archives
/venv
12 changes: 6 additions & 6 deletions extras/deprecated/plugins/gbp/gbp_learn_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ typedef struct gbp_learn_l2_trace_t_
/* per-pkt trace data */
mac_address_t mac;
u32 sw_if_index;
u32 new;
u32 _new;
u32 throttled;
u32 sclass;
u32 d_bit;
Expand Down Expand Up @@ -352,7 +352,7 @@ VLIB_NODE_FN (gbp_learn_l2_node) (vlib_main_t * vm,
gbp_learn_l2_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
clib_memcpy_fast (t->mac.bytes, eh0->src_address, 6);
t->new = (NULL == ge0);
t->_new = (NULL == ge0);
t->throttled = t0;
t->sw_if_index = sw_if_index0;
t->sclass = sclass0;
Expand Down Expand Up @@ -383,7 +383,7 @@ format_gbp_learn_l2_trace (u8 * s, va_list * args)

s = format (s, "new:%d throttled:%d d-bit:%d mac:%U itf:%d sclass:%d"
" gb-flags:%U",
t->new, t->throttled, t->d_bit,
t->_new, t->throttled, t->d_bit,
format_mac_address_t, &t->mac, t->sw_if_index, t->sclass,
format_gbp_bridge_domain_flags, t->gb_flags);

Expand Down Expand Up @@ -489,7 +489,7 @@ typedef struct gbp_learn_l3_trace_t_
/* per-pkt trace data */
ip46_address_t ip;
u32 sw_if_index;
u32 new;
u32 _new;
u32 throttled;
u32 sclass;
} gbp_learn_l3_trace_t;
Expand Down Expand Up @@ -633,7 +633,7 @@ gbp_learn_l3 (vlib_main_t * vm,
ip46_address_set_ip6 (&t->ip, &ip6_0->src_address);
if (FIB_PROTOCOL_IP4 == fproto && ip4_0)
ip46_address_set_ip4 (&t->ip, &ip4_0->src_address);
t->new = (NULL == ge0);
t->_new = (NULL == ge0);
t->throttled = t0;
t->sw_if_index = sw_if_index0;
t->sclass = sclass0;
Expand All @@ -659,7 +659,7 @@ format_gbp_learn_l3_trace (u8 * s, va_list * args)
gbp_learn_l3_trace_t *t = va_arg (*args, gbp_learn_l3_trace_t *);

s = format (s, "new:%d throttled:%d ip:%U itf:%d sclass:%d",
t->new, t->throttled,
t->_new, t->throttled,
format_ip46_address, &t->ip, IP46_TYPE_ANY, t->sw_if_index,
t->sclass);

Expand Down
16 changes: 8 additions & 8 deletions extras/deprecated/vppinfra/cuckoo_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,16 +723,16 @@ static void CV (clib_cuckoo_rehash) (CVT (clib_cuckoo) * h)
CVT (clib_cuckoo_bucket) * old = h->buckets;
uword old_nbuckets = vec_len (old);
uword new_nbuckets = 2 * old_nbuckets;
CVT (clib_cuckoo_bucket) * new =
CVT (clib_cuckoo_bucket) * _new =
vec_dup_aligned (old, CLIB_CACHE_LINE_BYTES);
/* allocate space */
vec_validate_aligned (new, new_nbuckets - 1, CLIB_CACHE_LINE_BYTES);
ASSERT (new_nbuckets == vec_len (new));
vec_validate_aligned (_new, new_nbuckets - 1, CLIB_CACHE_LINE_BYTES);
ASSERT (new_nbuckets == vec_len (_new));
/* store old pointer in to-be-freed list */
vec_add1 (h->to_be_freed, old);
/* mark new elements as free */
CVT (clib_cuckoo_bucket) * bucket;
for (bucket = new + old_nbuckets; bucket < vec_end (new); ++bucket)
for (bucket = _new + old_nbuckets; bucket < vec_end (_new); ++bucket)
{
clib_memset (bucket->elts, 0xff, sizeof (bucket->elts));
}
Expand All @@ -745,8 +745,8 @@ static void CV (clib_cuckoo_rehash) (CVT (clib_cuckoo) * h)
{
/* items in old bucket might be moved to new bucket */
uword new_bucket_idx = old_bucket_idx + old_nbuckets;
CVT (clib_cuckoo_bucket) * old_bucket = new + old_bucket_idx;
CVT (clib_cuckoo_bucket) * new_bucket = new + new_bucket_idx;
CVT (clib_cuckoo_bucket) * old_bucket = _new + old_bucket_idx;
CVT (clib_cuckoo_bucket) * new_bucket = _new + new_bucket_idx;
int i = 0;
int moved = 0;
clib_cuckoo_bucket_aux_t aux = old_bucket->aux;
Expand All @@ -757,7 +757,7 @@ static void CV (clib_cuckoo_rehash) (CVT (clib_cuckoo) * h)
clib_cuckoo_lookup_info_t old_lookup =
CV (clib_cuckoo_calc_lookup) (old, hash);
clib_cuckoo_lookup_info_t new_lookup =
CV (clib_cuckoo_calc_lookup) (new, hash);
CV (clib_cuckoo_calc_lookup) (_new, hash);
if ((old_bucket_idx == old_lookup.bucket1 &&
new_bucket_idx == new_lookup.bucket1) ||
(old_bucket_idx == old_lookup.bucket2 &&
Expand Down Expand Up @@ -788,7 +788,7 @@ static void CV (clib_cuckoo_rehash) (CVT (clib_cuckoo) * h)
new_bucket->aux = aux;
}
}
h->buckets = new;
h->buckets = _new;
#if CLIB_CUCKOO_DEBUG_COUNTERS
++h->rehashes;
#endif
Expand Down
12 changes: 6 additions & 6 deletions extras/deprecated/vppinfra/vhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ vhash_resize_incremental (vhash_resize_t * vr, u32 vector_index,
u32 n_keys_this_call)
{
vhash_t *old = vr->old;
vhash_main_t *vm = &vr->new;
vhash_t *new = vm->vhash;
vhash_main_t *vm = &vr->_new;
vhash_t *_new = vm->vhash;
uword i, j, n_key_u32;

n_key_u32 = old->n_key_u32;
Expand All @@ -665,7 +665,7 @@ vhash_resize_incremental (vhash_resize_t * vr, u32 vector_index,
hash_seeds[0] = old->hash_seeds[0].as_u32[0];
hash_seeds[1] = old->hash_seeds[1].as_u32[0];
hash_seeds[2] = old->hash_seeds[2].as_u32[0];
vhash_init (new, old->log2_n_keys + 1, n_key_u32, hash_seeds);
vhash_init (_new, old->log2_n_keys + 1, n_key_u32, hash_seeds);
}

vec_reset_length (vm->keys);
Expand Down Expand Up @@ -744,11 +744,11 @@ void
vhash_resize (vhash_t * old, u32 log2_n_keys)
{
static vhash_resize_t vr;
vhash_t new;
vhash_t _new;
u32 i = 0;

vr.old = old;
vr.new.vhash = &new;
vr._new.vhash = &_new;

while (1)
{
Expand All @@ -758,7 +758,7 @@ vhash_resize (vhash_t * old, u32 log2_n_keys)
}

vhash_free (old);
*old = new;
*old = _new;
}

#endif /* CLIB_HAVE_VEC128 */
Expand Down
2 changes: 1 addition & 1 deletion extras/deprecated/vppinfra/vhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void vhash_main_unset (vhash_main_t * vm);

typedef struct
{
vhash_main_t new;
vhash_main_t _new;

vhash_t *old;
} vhash_resize_t;
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ else()
set(CMAKE_C_COMPILER_NAMES clang gcc cc)
endif()

project(vpp C)
set(CXX_STANDARD 20)
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

project(vpp LANGUAGES C CXX)

if(NOT DEFINED CMAKE_INSTALL_LIBDIR AND EXISTS "/etc/debian_version")
set(CMAKE_INSTALL_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
Expand Down
14 changes: 7 additions & 7 deletions src/plugins/af_packet/af_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ af_packet_set_rx_queues (vlib_main_t *vm, af_packet_if_t *apif)
vnm, apif->hw_if_index, rx_queue->queue_id, VNET_HW_IF_RXQ_THREAD_ANY);

{
clib_file_t template = { 0 };
template.read_function = af_packet_fd_read_ready;
template.error_function = af_packet_fd_error;
template.file_descriptor = rx_queue->fd;
template.private_data = rx_queue->queue_index;
template.description =
clib_file_t _template = { 0 };
_template.read_function = af_packet_fd_read_ready;
_template.error_function = af_packet_fd_error;
_template.file_descriptor = rx_queue->fd;
_template.private_data = rx_queue->queue_index;
_template.description =
format (0, "%U queue %u", format_af_packet_device_name,
apif->dev_instance, rx_queue->queue_id);
rx_queue->clib_file_index = clib_file_add (&file_main, &template);
rx_queue->clib_file_index = clib_file_add (&file_main, &_template);
}
vnet_hw_if_set_rx_queue_file_index (vnm, rx_queue->queue_index,
rx_queue->clib_file_index);
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/af_xdp/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ gdb_af_xdp_get_cons (const struct xsk_ring_cons * cons)
}

static clib_error_t *
af_xdp_mac_change (vnet_hw_interface_t * hw, const u8 * old, const u8 * new)
af_xdp_mac_change (vnet_hw_interface_t * hw, const u8 * old, const u8 * _new)
{
af_xdp_main_t *am = &af_xdp_main;
af_xdp_device_t *ad = vec_elt_at_index (am->devices, hw->dev_instance);
errno_t err = memcpy_s (ad->hwaddr, sizeof (ad->hwaddr), new, 6);
errno_t err = memcpy_s (ad->hwaddr, sizeof (ad->hwaddr), _new, 6);
if (err)
return clib_error_return_code (0, -err, CLIB_ERROR_ERRNO_VALID,
"mac change failed");
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/auto_sdl/auto_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ VLIB_REGISTER_LOG_CLASS (auto_sdl_log, static) = { .class_name = "auto",
.subclass_name = "sdl" };

#define log_debug(fmt, ...) \
vlib_log_debug (auto_sdl_log.class, "%s: " fmt, __func__, __VA_ARGS__)
#define log_warn(fmt, ...) vlib_log_warn (auto_sdl_log.class, fmt, __VA_ARGS__)
#define log_err(fmt, ...) vlib_log_err (auto_sdl_log.class, fmt, __VA_ARGS__)
vlib_log_debug (auto_sdl_log._class, "%s: " fmt, __func__, __VA_ARGS__)
#define log_warn(fmt, ...) vlib_log_warn (auto_sdl_log._class, fmt, __VA_ARGS__)
#define log_err(fmt, ...) vlib_log_err (auto_sdl_log._class, fmt, __VA_ARGS__)

static auto_sdl_per_fib_t *
auto_sdlb_get_for_fib_index (u32 fib_proto, u32 fib_index, int alloc)
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/avf/avf.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ extern vlib_log_class_registration_t avf_log;
extern vlib_log_class_registration_t avf_stats_log;

#define avf_log_err(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_ERR, avf_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_ERR, avf_log._class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, \
## __VA_ARGS__)

#define avf_log_warn(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_WARNING, avf_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_WARNING, avf_log._class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, \
## __VA_ARGS__)

#define avf_log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, avf_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_DEBUG, avf_log._class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, \
## __VA_ARGS__)

#define avf_stats_log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, avf_stats_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_DEBUG, avf_stats_log._class, "%U: " f, \
format_vlib_pci_addr, &dev->pci_addr, ##__VA_ARGS__)

#define foreach_avf_device_flags \
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/avf/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ avf_process_one_device (vlib_main_t * vm, avf_device_t * ad, int is_irq)
error:
ad->flags |= AVF_DEVICE_F_ERROR;
ASSERT (ad->error != 0);
vlib_log_err (avf_log.class, "%U", format_clib_error, ad->error);
vlib_log_err (avf_log._class, "%U", format_clib_error, ad->error);
}

clib_error_t *
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/dev_armada/pp2/pp2.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,20 @@ vnet_dev_tx_queue_op_no_rv_t mvpp2_txq_free;
/* inline funcs */

#define log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, mvpp2_log.class, "%U" f, \
vlib_log (VLIB_LOG_LEVEL_DEBUG, mvpp2_log._class, "%U" f, \
format_vnet_dev_log, (dev), \
clib_string_skip_prefix (__func__, "mvpp2_"), ##__VA_ARGS__)
#define log_info(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_INFO, mvpp2_log.class, "%U" f, \
vlib_log (VLIB_LOG_LEVEL_INFO, mvpp2_log._class, "%U" f, \
format_vnet_dev_log, (dev), 0, ##__VA_ARGS__)
#define log_notice(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_NOTICE, mvpp2_log.class, "%U" f, \
vlib_log (VLIB_LOG_LEVEL_NOTICE, mvpp2_log._class, "%U" f, \
format_vnet_dev_log, (dev), 0, ##__VA_ARGS__)
#define log_warn(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_WARNING, mvpp2_log.class, "%U" f, \
vlib_log (VLIB_LOG_LEVEL_WARNING, mvpp2_log._class, "%U" f, \
format_vnet_dev_log, (dev), 0, ##__VA_ARGS__)
#define log_err(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_ERR, mvpp2_log.class, "%U" f, format_vnet_dev_log, \
vlib_log (VLIB_LOG_LEVEL_ERR, mvpp2_log._class, "%U" f, format_vnet_dev_log, \
(dev), 0, ##__VA_ARGS__)

#define foreach_mvpp2_tx_node_counter \
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/dev_armada/pp2/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ mrvl_pp2_rx_one_if (vlib_main_t *vm, vlib_node_runtime_t *node,
b1 = desc_to_vlib_buffer (vm, dp[1]);
bi[0] = pp2_ppio_inq_desc_get_cookie (dp[0]);
bi[1] = pp2_ppio_inq_desc_get_cookie (dp[1]);
b0->template = bt;
b1->template = bt;
b0->_template = bt;
b1->_template = bt;

n_rx_bytes += b0->current_length =
pp2_ppio_inq_desc_get_pkt_len (dp[0]) + len_adj;
Expand All @@ -56,7 +56,7 @@ mrvl_pp2_rx_one_if (vlib_main_t *vm, vlib_node_runtime_t *node,
{
b0 = desc_to_vlib_buffer (vm, dp[0]);
bi[0] = pp2_ppio_inq_desc_get_cookie (dp[0]);
b0->template = bt;
b0->_template = bt;

n_rx_bytes += b0->current_length =
pp2_ppio_inq_desc_get_pkt_len (dp[0]) + len_adj;
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/dev_ena/ena.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,19 @@ typedef enum
} ena_tx_node_ctr_t;

#define log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, ena_log.class, "%U" f, format_vnet_dev_log, \
vlib_log (VLIB_LOG_LEVEL_DEBUG, ena_log._class, "%U" f, format_vnet_dev_log, \
(dev), clib_string_skip_prefix (__func__, "ena_"), ##__VA_ARGS__)
#define log_info(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_INFO, ena_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_INFO, ena_log._class, "%U: " f, \
format_vnet_dev_addr, (dev), ##__VA_ARGS__)
#define log_notice(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_NOTICE, ena_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_NOTICE, ena_log._class, "%U: " f, \
format_vnet_dev_addr, (dev), ##__VA_ARGS__)
#define log_warn(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_WARNING, ena_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_WARNING, ena_log._class, "%U: " f, \
format_vnet_dev_addr, (dev), ##__VA_ARGS__)
#define log_err(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_ERR, ena_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_ERR, ena_log._class, "%U: " f, \
format_vnet_dev_addr, (dev), ##__VA_ARGS__)

#endif /* _ENA_H_ */
8 changes: 4 additions & 4 deletions src/plugins/dev_ena/ena_inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
#include <dev_ena/ena.h>

#define ena_log_is_debug() \
vlib_log_is_enabled (VLIB_LOG_LEVEL_DEBUG, ena_log.class)
vlib_log_is_enabled (VLIB_LOG_LEVEL_DEBUG, ena_log._class)

#define ena_stats_log_err(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_ERR, ena_stats_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_ERR, ena_stats_log._class, "%U: " f, \
format_vnet_dev_addr, dev, ##__VA_ARGS__)

#define ena_stats_log_debug(dev, f, ...) \
vlib_log (VLIB_LOG_LEVEL_DEBUG, ena_stats_log.class, "%U: " f, \
vlib_log (VLIB_LOG_LEVEL_DEBUG, ena_stats_log._class, "%U: " f, \
format_vnet_dev_addr, dev, ##__VA_ARGS__)

#define ena_stats_log_is_debug() \
vlib_log_is_enabled (VLIB_LOG_LEVEL_DEBUG, ena_stats_log.class)
vlib_log_is_enabled (VLIB_LOG_LEVEL_DEBUG, ena_stats_log._class)

static_always_inline void
ena_set_mem_addr (vlib_main_t *vm, vnet_dev_t *dev, ena_mem_addr_t *m, void *p)
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/dev_ena/rx_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,23 +317,23 @@ ena_device_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node,
clib_prefetch_store (b[5]);
clib_prefetch_store (b[6]);
clib_prefetch_store (b[7]);
b[0]->template = bt;
b[0]->_template = bt;
n_rx_bytes += b[0]->current_length = l[0];
b[0]->flags = f[0];
b[1]->template = bt;
b[1]->_template = bt;
n_rx_bytes += b[1]->current_length = l[1];
b[1]->flags = f[1];
b[2]->template = bt;
b[2]->_template = bt;
n_rx_bytes += b[2]->current_length = l[2];
b[2]->flags = f[2];
b[3]->template = bt;
b[3]->_template = bt;
n_rx_bytes += b[3]->current_length = l[3];
b[3]->flags = f[3];
}

for (; n_left > 0; b += 1, f += 1, l += 1, n_left -= 1)
{
b[0]->template = bt;
b[0]->_template = bt;
n_rx_bytes += b[0]->current_length = l[0];
b[0]->flags = f[0];
}
Expand Down
Loading