diff options
29 files changed, 373 insertions, 350 deletions
diff --git a/svm/ssvm.c b/svm/ssvm.c index 337840ffa81..6f409eb68b6 100644 --- a/svm/ssvm.c +++ b/svm/ssvm.c @@ -49,7 +49,7 @@ ssvm_master_init (ssvm_private_t * ssvm, u32 master_index) close (ssvm_fd); return SSVM_API_ERROR_SET_SIZE; } - + if (write (ssvm_fd, &junk, 1) != 1) { clib_unix_warning ("set ssvm size"); diff --git a/svm/svmdbtool.c b/svm/svmdbtool.c index 829df4e9e61..a98b22a1272 100644 --- a/svm/svmdbtool.c +++ b/svm/svmdbtool.c @@ -49,8 +49,8 @@ typedef struct svmdbtool_main_t svmdbtool_main; -static inline -svmdb_map_args_t * map_arg_setup (char *chroot_path) +static inline svmdb_map_args_t * +map_arg_setup (char *chroot_path) { svmdbtool_main_t *sm = &svmdbtool_main; svmdb_map_args_t *ma = &sm->map_args; @@ -351,8 +351,8 @@ main (int argc, char **argv) struct group _grp, *grp; char *s, buf[128]; - svmdbtool_main.uid = geteuid(); - svmdbtool_main.gid = getegid(); + svmdbtool_main.uid = geteuid (); + svmdbtool_main.gid = getegid (); unformat_init_command_line (&input, argv); @@ -428,45 +428,45 @@ main (int argc, char **argv) parsed++; } else if (unformat (&input, "uid %d", &uid)) - svmdbtool_main.uid = uid; + svmdbtool_main.uid = uid; else if (unformat (&input, "gid %d", &gid)) - svmdbtool_main.gid = gid; + svmdbtool_main.gid = gid; else if (unformat (&input, "uid %s", &s)) - { - /* lookup the username */ - pw = NULL; - rv = getpwnam_r(s, &_pw, buf, sizeof(buf), &pw); - if (rv < 0) - { - fformat (stderr, "cannot fetch username %s", s); - exit (1); - } - if (pw == NULL) - { - fformat (stderr, "username %s does not exist", s); - exit (1); - } - vec_free (s); - svmdbtool_main.uid = pw->pw_uid; - } + { + /* lookup the username */ + pw = NULL; + rv = getpwnam_r (s, &_pw, buf, sizeof (buf), &pw); + if (rv < 0) + { + fformat (stderr, "cannot fetch username %s", s); + exit (1); + } + if (pw == NULL) + { + fformat (stderr, "username %s does not exist", s); + exit (1); + } + vec_free (s); + svmdbtool_main.uid = pw->pw_uid; + } else if (unformat (&input, "gid %s", &s)) - { - /* lookup the group name */ - grp = NULL; - rv = getgrnam_r(s, &_grp, buf, sizeof(buf), &grp); - if (rv != 0) - { - fformat (stderr, "cannot fetch group %s", s); - exit (1); - } - if (grp == NULL) - { - fformat (stderr, "group %s does not exist", s); - exit (1); - } - vec_free (s); - svmdbtool_main.gid = grp->gr_gid; - } + { + /* lookup the group name */ + grp = NULL; + rv = getgrnam_r (s, &_grp, buf, sizeof (buf), &grp); + if (rv != 0) + { + fformat (stderr, "cannot fetch group %s", s); + exit (1); + } + if (grp == NULL) + { + fformat (stderr, "group %s does not exist", s); + exit (1); + } + vec_free (s); + svmdbtool_main.gid = grp->gr_gid; + } else { break; diff --git a/vlib-api/vlibapi/api_shared.c b/vlib-api/vlibapi/api_shared.c index fd23c458946..c62ac5b18a5 100644 --- a/vlib-api/vlibapi/api_shared.c +++ b/vlib-api/vlibapi/api_shared.c @@ -781,7 +781,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename, if (!(statb.st_mode & S_IFREG) || (statb.st_size < sizeof (*hp))) { vlib_cli_output (vm, "File not plausible: %s\n", filename); - close(fd); + close (fd); return; } @@ -1084,17 +1084,19 @@ api_trace_command_fn (vlib_main_t * vm, rv = vl_msg_api_trace_save (am, which, fp); fclose (fp); if (rv == -1) - vlib_cli_output (vm, "API Trace data not present\n"); + vlib_cli_output (vm, "API Trace data not present\n"); else if (rv == -2) - vlib_cli_output (vm, "File for writing is closed\n"); + vlib_cli_output (vm, "File for writing is closed\n"); else if (rv == -10) - vlib_cli_output (vm, "Error while writing header to file\n"); + vlib_cli_output (vm, "Error while writing header to file\n"); else if (rv == -11) - vlib_cli_output (vm, "Error while writing trace to file\n"); + vlib_cli_output (vm, "Error while writing trace to file\n"); else if (rv == -12) - vlib_cli_output (vm, "Error while writing end of buffer trace to file\n"); + vlib_cli_output (vm, + "Error while writing end of buffer trace to file\n"); else if (rv == -13) - vlib_cli_output (vm, "Error while writing start of buffer trace to file\n"); + vlib_cli_output (vm, + "Error while writing start of buffer trace to file\n"); else if (rv < 0) vlib_cli_output (vm, "Unkown error while saving: %d", rv); else diff --git a/vlib-api/vlibapi/node_serialize.c b/vlib-api/vlibapi/node_serialize.c index b1e4ae18697..4dc1a7d2272 100644 --- a/vlib-api/vlibapi/node_serialize.c +++ b/vlib-api/vlibapi/node_serialize.c @@ -356,10 +356,10 @@ test_node_serialize_command_fn (vlib_main_t * vm, for (k = 0; k < vec_len (node->next_nodes); k++) { if (node->next_nodes[k] != ~0) - { - next_node = nodes[node->next_nodes[k]]; - vlib_cli_output (vm, " [%d] %s", k, next_node->name); - } + { + next_node = nodes[node->next_nodes[k]]; + vlib_cli_output (vm, " [%d] %s", k, next_node->name); + } } } } diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c index 13b1121a0f4..68752745d66 100644 --- a/vlib-api/vlibmemory/memory_vlib.c +++ b/vlib-api/vlibmemory/memory_vlib.c @@ -1043,11 +1043,11 @@ vl_api_trace_print_file_cmd (vlib_main_t * vm, u32 first, u32 last, msg_id = ntohs (msg_id); if (fseek (fp, -2, SEEK_CUR) < 0) - { - vlib_cli_output (vm, "fseek failed, %s", strerror(errno)); - fclose(fp); - return; - } + { + vlib_cli_output (vm, "fseek failed, %s", strerror (errno)); + fclose (fp); + return; + } /* Mild sanity check */ if (msg_id >= vec_len (am->msg_handlers)) diff --git a/vlib-api/vlibsocket/sockclnt_vlib.c b/vlib-api/vlibsocket/sockclnt_vlib.c index e8d749c58d4..e16adfeb503 100644 --- a/vlib-api/vlibsocket/sockclnt_vlib.c +++ b/vlib-api/vlibsocket/sockclnt_vlib.c @@ -107,7 +107,7 @@ sockclnt_open_index (char *client_name, char *hostname, int port) if (connect (sockfd, (const void *) &serv_addr, sizeof (serv_addr)) < 0) { clib_unix_warning ("Connect failure to (%s, %d)", hostname, port); - close(sockfd); + close (sockfd); return ~0; } @@ -115,7 +115,7 @@ sockclnt_open_index (char *client_name, char *hostname, int port) if (rv < 0) { clib_unix_warning ("FIONBIO"); - close(sockfd); + close (sockfd); return ~0; } diff --git a/vlib-api/vlibsocket/socksvr_vlib.c b/vlib-api/vlibsocket/socksvr_vlib.c index 354c4f1c53d..dc8c63ebbaf 100644 --- a/vlib-api/vlibsocket/socksvr_vlib.c +++ b/vlib-api/vlibsocket/socksvr_vlib.c @@ -611,7 +611,7 @@ socksvr_api_init (vlib_main_t * vm) rv = listen (sockfd, 5); if (rv < 0) { - close(sockfd); + close (sockfd); return clib_error_return_unix (0, "listen"); } diff --git a/vlib/vlib/cli.c b/vlib/vlib/cli.c index 5e959a78bf5..a54298505ab 100644 --- a/vlib/vlib/cli.c +++ b/vlib/vlib/cli.c @@ -853,11 +853,11 @@ add_sub_command (vlib_cli_main_t * cm, uword parent_index, uword child_index) q = hash_get_mem (cm->parse_rule_index_by_name, sub_name); if (!q) - { - clib_error ("reference to unknown rule `%%%v' in path `%v'", - sub_name, c->path); - return; - } + { + clib_error ("reference to unknown rule `%%%v' in path `%v'", + sub_name, c->path); + return; + } hash_set_mem (p->sub_rule_index_by_name, sub_name, vec_len (p->sub_rules)); diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c index 337fca9ade7..828bc81f418 100644 --- a/vlib/vlib/dpdk_buffer.c +++ b/vlib/vlib/dpdk_buffer.c @@ -991,70 +991,70 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, { #if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 0) { - uword this_pool_end; - uword this_pool_start; - uword this_pool_size; - uword save_vpm_start, save_vpm_end, save_vpm_size; + uword this_pool_end; + uword this_pool_start; + uword this_pool_size; + uword save_vpm_start, save_vpm_end, save_vpm_size; struct rte_mempool_memhdr *memhdr; - - this_pool_start = ~0ULL; - this_pool_end = 0LL; - - STAILQ_FOREACH (memhdr, &rmp->mem_list, next) - { - if (((uword)(memhdr->addr + memhdr->len)) > this_pool_end) - this_pool_end = (uword)(memhdr->addr + memhdr->len); - if (((uword)memhdr->addr) < this_pool_start) - this_pool_start = (uword)(memhdr->addr); - } - ASSERT (this_pool_start < ~0ULL && this_pool_end > 0); - this_pool_size = this_pool_end - this_pool_start; - - if (CLIB_DEBUG > 1) - { - clib_warning ("%s: pool start %llx pool end %llx pool size %lld", - pool_name, this_pool_start, this_pool_end, - this_pool_size); - clib_warning - ("before: virtual.start %llx virtual.end %llx virtual.size %lld", - vpm->virtual.start, vpm->virtual.end, vpm->virtual.size); - } - - save_vpm_start = vpm->virtual.start; - save_vpm_end = vpm->virtual.end; - save_vpm_size = vpm->virtual.size; - - if ((this_pool_start < vpm->virtual.start) || vpm->virtual.start == 0) - vpm->virtual.start = this_pool_start; - if (this_pool_end > vpm->virtual.end) - vpm->virtual.end = this_pool_end; - - vpm->virtual.size = vpm->virtual.end - vpm->virtual.start; - - if (CLIB_DEBUG > 1) - { - clib_warning - ("after: virtual.start %llx virtual.end %llx virtual.size %lld", - vpm->virtual.start, vpm->virtual.end, vpm->virtual.size); - } - - /* check if fits into buffer index range */ - if ((u64) vpm->virtual.size > - ((u64) 1 << (32 + CLIB_LOG2_CACHE_LINE_BYTES))) - { - clib_warning ("physmem: virtual size out of range!"); - vpm->virtual.start = save_vpm_start; - vpm->virtual.end = save_vpm_end; - vpm->virtual.size = save_vpm_size; - rmp = 0; - } + + this_pool_start = ~0ULL; + this_pool_end = 0LL; + + STAILQ_FOREACH (memhdr, &rmp->mem_list, next) + { + if (((uword) (memhdr->addr + memhdr->len)) > this_pool_end) + this_pool_end = (uword) (memhdr->addr + memhdr->len); + if (((uword) memhdr->addr) < this_pool_start) + this_pool_start = (uword) (memhdr->addr); + } + ASSERT (this_pool_start < ~0ULL && this_pool_end > 0); + this_pool_size = this_pool_end - this_pool_start; + + if (CLIB_DEBUG > 1) + { + clib_warning ("%s: pool start %llx pool end %llx pool size %lld", + pool_name, this_pool_start, this_pool_end, + this_pool_size); + clib_warning + ("before: virtual.start %llx virtual.end %llx virtual.size %lld", + vpm->virtual.start, vpm->virtual.end, vpm->virtual.size); + } + + save_vpm_start = vpm->virtual.start; + save_vpm_end = vpm->virtual.end; + save_vpm_size = vpm->virtual.size; + + if ((this_pool_start < vpm->virtual.start) || vpm->virtual.start == 0) + vpm->virtual.start = this_pool_start; + if (this_pool_end > vpm->virtual.end) + vpm->virtual.end = this_pool_end; + + vpm->virtual.size = vpm->virtual.end - vpm->virtual.start; + + if (CLIB_DEBUG > 1) + { + clib_warning + ("after: virtual.start %llx virtual.end %llx virtual.size %lld", + vpm->virtual.start, vpm->virtual.end, vpm->virtual.size); + } + + /* check if fits into buffer index range */ + if ((u64) vpm->virtual.size > + ((u64) 1 << (32 + CLIB_LOG2_CACHE_LINE_BYTES))) + { + clib_warning ("physmem: virtual size out of range!"); + vpm->virtual.start = save_vpm_start; + vpm->virtual.end = save_vpm_end; + vpm->virtual.size = save_vpm_size; + rmp = 0; + } } if (rmp) - { - bm->pktmbuf_pools[socket_id] = rmp; - vec_free(pool_name); - return 0; - } + { + bm->pktmbuf_pools[socket_id] = rmp; + vec_free (pool_name); + return 0; + } } #else new_start = pointer_to_uword (rmp); @@ -1085,7 +1085,7 @@ vlib_buffer_pool_create (vlib_main_t * vm, unsigned num_mbufs, vpm->virtual.start = new_start; vpm->virtual.size = new_size; vpm->virtual.end = new_start + new_size; - vec_free(pool_name); + vec_free (pool_name); return 0; } #endif diff --git a/vlib/vlib/mc.h b/vlib/vlib/mc.h index 8614050c241..dc95b0e9074 100644 --- a/vlib/vlib/mc.h +++ b/vlib/vlib/mc.h @@ -96,7 +96,7 @@ typedef enum typedef CLIB_PACKED (struct { mc_peer_id_t peer_id; mc_relay_msg_type_t type:32; - /* MC_MSG_TYPE_join_or_leave_request */ + /* MC_MSG_TYPE_join_or_leave_request */ /* Stream to join or leave. */ u32 stream_index; /* join = 1, leave = 0 */ @@ -117,7 +117,7 @@ mc_byte_swap_msg_join_or_leave_request (mc_msg_join_or_leave_request_t * r) typedef CLIB_PACKED (struct { mc_peer_id_t peer_id; mc_relay_msg_type_t type:32; - /* MC_MSG_TYPE_join_reply */ + /* MC_MSG_TYPE_join_reply */ u32 stream_index; /* Peer ID to contact to catchup with this stream. */ mc_peer_id_t catchup_peer_id;}) mc_msg_join_reply_t; @@ -165,8 +165,7 @@ mc_byte_swap_msg_user_request (mc_msg_user_request_t * r) typedef CLIB_PACKED (struct { mc_peer_id_t peer_id; - u32 global_sequence; - u32 stream_index; + u32 global_sequence; u32 stream_index; u32 local_sequence; i32 seq_cmp_result;}) mc_msg_user_ack_t; diff --git a/vlib/vlib/node.c b/vlib/vlib/node.c index 3d26559a03d..4b8e3f74bb9 100644 --- a/vlib/vlib/node.c +++ b/vlib/vlib/node.c @@ -486,11 +486,11 @@ vlib_node_main_init (vlib_main_t * vm) sib = vlib_get_node_by_name (vm, (u8 *) n->sibling_of); if (!sib) - { - error = clib_error_create ("sibling `%s' not found for node `%v'", - n->sibling_of, n->name); - goto done; - } + { + error = clib_error_create ("sibling `%s' not found for node `%v'", + n->sibling_of, n->name); + goto done; + } /* *INDENT-OFF* */ clib_bitmap_foreach (si, sib->sibling_bitmap, ({ diff --git a/vlib/vlib/pci/linux_pci.c b/vlib/vlib/pci/linux_pci.c index 914016effca..acd913a91e7 100644 --- a/vlib/vlib/pci/linux_pci.c +++ b/vlib/vlib/pci/linux_pci.c @@ -149,7 +149,8 @@ vlib_pci_bind_to_uio (vlib_pci_device_t * d, char *uio_driver_name) { /* Some interfaces (eg "lo") don't support this ioctl */ if ((errno != ENOTSUP) && (errno != ENODEV)) - clib_unix_warning ("ioctl fetch intf %s bus info error", e->d_name); + clib_unix_warning ("ioctl fetch intf %s bus info error", + e->d_name); continue; } diff --git a/vlib/vlib/pci/pci_config.h b/vlib/vlib/pci/pci_config.h index f65a36cac5a..92e56af6d57 100644 --- a/vlib/vlib/pci/pci_config.h +++ b/vlib/vlib/pci/pci_config.h @@ -404,10 +404,12 @@ typedef enum pci_capability_type } pci_capability_type_t; /* Common header for capabilities. */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { enum pci_capability_type type:8; u8 next_offset;}) pci_capability_regs_t; +/* *INDENT-ON* */ always_inline void * pci_config_find_capability (pci_config_type0_regs_t * t, int cap_type) @@ -433,6 +435,7 @@ pci_config_find_capability (pci_config_type0_regs_t * t, int cap_type) } /* Power Management Registers */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 capabilities; @@ -460,8 +463,10 @@ typedef CLIB_PACKED (struct #define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ #define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ u8 data;}) pci_power_management_regs_t; +/* *INDENT-ON* */ /* AGP registers */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u8 version; @@ -476,24 +481,30 @@ typedef CLIB_PACKED (struct #define PCI_AGP_RATE2 0x0002 /* 2x transfer rate supported */ #define PCI_AGP_RATE1 0x0001 /* 1x transfer rate supported */ }) pci_agp_regs_t; +/* *INDENT-ON* */ /* Vital Product Data */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 address; #define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ #define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ u32 data;}) pci_vpd_regs_t; +/* *INDENT-ON* */ /* Slot Identification */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u8 esr; #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ u8 chassis;}) pci_sid_regs_t; +/* *INDENT-ON* */ /* Message Signalled Interrupts registers */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 flags; @@ -505,14 +516,18 @@ typedef CLIB_PACKED (struct #define PCI_MSI_FLAGS_64BIT (1 << 7) /* 64-bit addresses allowed */ #define PCI_MSI_FLAGS_MASKBIT (1 << 8) /* 64-bit mask bits allowed */ u32 address; u32 data; u32 mask_bits;}) pci_msi32_regs_t; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 flags; u32 address[2]; u32 data; u32 mask_bits;}) pci_msi64_regs_t; +/* *INDENT-ON* */ /* CompactPCI Hotswap Register */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 control_status; @@ -524,8 +539,10 @@ typedef CLIB_PACKED (struct #define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ #define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ }) pci_chswp_regs_t; +/* *INDENT-ON* */ /* PCIX registers */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 command; @@ -549,6 +566,7 @@ typedef CLIB_PACKED (struct #define PCIX_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ #define PCIX_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ }) pcix_config_regs_t; +/* *INDENT-ON* */ static inline int pcie_size_to_code (int bytes) @@ -567,6 +585,7 @@ pcie_code_to_size (int code) } /* PCI Express capability registers */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pci_capability_regs_t header; u16 pcie_capabilities; @@ -629,6 +648,7 @@ typedef CLIB_PACKED (struct u16 link_status2; u32 slot_capabilities2; u16 slot_control2; u16 slot_status2;}) pcie_config_regs_t; +/* *INDENT-ON* */ /* PCI express extended capabilities. */ typedef enum pcie_capability_type @@ -640,11 +660,14 @@ typedef enum pcie_capability_type } pcie_capability_type_t; /* Common header for capabilities. */ +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { enum pcie_capability_type type:16; u16 version: 4; u16 next_capability:12;}) - pcie_capability_regs_t; + /* *INDENT-ON* */ +pcie_capability_regs_t; +/* *INDENT-OFF* */ typedef CLIB_PACKED (struct { pcie_capability_regs_t header; u32 uncorrectable_status; @@ -674,6 +697,7 @@ typedef CLIB_PACKED (struct u32 root_command; u32 root_status; u16 correctable_error_source; u16 error_source;}) pcie_advanced_error_regs_t; +/* *INDENT-ON* */ /* Virtual Channel */ #define PCI_VC_PORT_REG1 4 diff --git a/vlib/vlib/threads.c b/vlib/vlib/threads.c index 302e201397b..7b5b8ff0544 100644 --- a/vlib/vlib/threads.c +++ b/vlib/vlib/threads.c @@ -100,7 +100,7 @@ vlib_set_thread_name (char *name) { rv = pthread_setname_np (thread, name); if (rv) - clib_warning ("pthread_setname_np returned %d", rv); + clib_warning ("pthread_setname_np returned %d", rv); } } @@ -132,7 +132,7 @@ vlib_sysfs_list_to_bitmap (char *filename) unformat_init_string (&in, (char *) buffer, strlen ((char *) buffer)); if (unformat (&in, "%U", unformat_bitmap_list, &r) != 1) - clib_warning ("unformat_bitmap_list failed"); + clib_warning ("unformat_bitmap_list failed"); unformat_free (&in); } vec_free (buffer); diff --git a/vlib/vlib/unix/cli.c b/vlib/vlib/unix/cli.c index 22f07f99eb1..92bb8bc3945 100644 --- a/vlib/vlib/unix/cli.c +++ b/vlib/vlib/unix/cli.c @@ -2397,7 +2397,7 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input) if (isatty (UNIX_CLI_STDIN_FD) && um->cli_line_mode == 0) { /* Capture terminal resize events */ - memset (&sa, 0, sizeof(sa)); + memset (&sa, 0, sizeof (sa)); sa.sa_handler = unix_cli_resize_interrupt; if (sigaction (SIGWINCH, &sa, 0) < 0) clib_panic ("sigaction"); diff --git a/vlib/vlib/unix/plugin.c b/vlib/vlib/unix/plugin.c index f8805b803cc..b3d5be02ed6 100644 --- a/vlib/vlib/unix/plugin.c +++ b/vlib/vlib/unix/plugin.c @@ -223,8 +223,7 @@ vlib_plugin_early_init (vlib_main_t * vm) static clib_error_t * vlib_plugins_show_cmd_fn (vlib_main_t * vm, - unformat_input_t * input, - vlib_cli_command_t * cmd) + unformat_input_t * input, vlib_cli_command_t * cmd) { plugin_main_t *pm = &vlib_plugin_main; u8 *s = 0; @@ -232,27 +231,26 @@ vlib_plugins_show_cmd_fn (vlib_main_t * vm, uword *value = 0; int index = 1; - s = format(s, " Plugin path is: %s\n",pm->plugin_path); + s = format (s, " Plugin path is: %s\n", pm->plugin_path); if (vlib_plugin_name_filter) - s = format(s," Plugin filter: %s\n",vlib_plugin_name_filter); + s = format (s, " Plugin filter: %s\n", vlib_plugin_name_filter); - s = format(s, " Plugins loaded: \n"); - hash_foreach_mem (key, value, pm->plugin_by_name_hash, { - if (key != 0) - s = format(s, " %d.%s\n",index, key); - index++; - }); + s = format (s, " Plugins loaded: \n"); + hash_foreach_mem (key, value, pm->plugin_by_name_hash, + { + if (key != 0) + s = format (s, " %d.%s\n", index, key); index++;} + ); - vlib_cli_output(vm, "%v", s); - vec_free(s); + vlib_cli_output (vm, "%v", s); + vec_free (s); return 0; } -VLIB_CLI_COMMAND (plugins_show_cmd, static) = { - .path = "show plugins", - .short_help = "show loaded plugins", - .function = vlib_plugins_show_cmd_fn, -}; +VLIB_CLI_COMMAND (plugins_show_cmd, static) = +{ +.path = "show plugins",.short_help = "show loaded plugins",.function = + vlib_plugins_show_cmd_fn,}; /* * fd.io coding-style-patch-verification: ON * diff --git a/vlib/vlib/unix/util.c b/vlib/vlib/unix/util.c index 9118f5b5283..fc243e41821 100644 --- a/vlib/vlib/unix/util.c +++ b/vlib/vlib/unix/util.c @@ -103,7 +103,7 @@ vlib_sysfs_write (char *file_name, char *fmt, ...) { u8 *s; int fd; - clib_error_t * error = 0; + clib_error_t *error = 0; fd = open (file_name, O_WRONLY); if (fd < 0) diff --git a/vnet/vnet/ip/ip4_source_and_port_range_check.c b/vnet/vnet/ip/ip4_source_and_port_range_check.c index f716ebdb1e1..00faddf0fb3 100644 --- a/vnet/vnet/ip/ip4_source_and_port_range_check.c +++ b/vnet/vnet/ip/ip4_source_and_port_range_check.c @@ -240,10 +240,9 @@ always_inline uword ASSERT (adj_index0 == ip4_fib_lookup_with_table (im, fib_index0, &ip0-> - src_address, - 0 + src_address, 0 /* use dflt rt */ - )); + )); adj0 = ip_get_adjacency (lm, adj_index0); } diff --git a/vnet/vnet/ipsec/ikev2_cli.c b/vnet/vnet/ipsec/ikev2_cli.c index beba8352c8c..bbd9a5739bc 100644 --- a/vnet/vnet/ipsec/ikev2_cli.c +++ b/vnet/vnet/ipsec/ikev2_cli.c @@ -263,9 +263,8 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, { data = vec_new (u8, 4); clib_memcpy (data, ip4.as_u8, 4); - r = - ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */ - 0); + r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */ + 0); goto done; } else if (unformat (line_input, "set %U id remote %U 0x%U", @@ -273,18 +272,16 @@ ikev2_profile_add_del_command_fn (vlib_main_t * vm, unformat_ikev2_id_type, &id_type, unformat_hex_string, &data)) { - r = - ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */ - 0); + r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */ + 0); goto done; } else if (unformat (line_input, "set %U id remote %U %v", unformat_token, valid_chars, &name, unformat_ikev2_id_type, &id_type, &data)) { - r = - ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */ - 0); + r = ikev2_set_profile_id (vm, name, (u8) id_type, data, /*remote */ + 0); goto done; } else if (unformat (line_input, "set %U traffic-selector local " diff --git a/vnet/vnet/ipsec/ipsec.c b/vnet/vnet/ipsec/ipsec.c index b3075bf7598..42b8f29dc44 100644 --- a/vnet/vnet/ipsec/ipsec.c +++ b/vnet/vnet/ipsec/ipsec.c @@ -220,19 +220,19 @@ ipsec_add_del_policy (vlib_main_t * vm, ipsec_policy_t * policy, int is_add) vec_add1 (spd->ipv6_inbound_protect_policy_indices, policy_index); clib_memcpy (vp, policy, sizeof (ipsec_policy_t)); - vec_sort_with_function (spd-> - ipv6_inbound_protect_policy_indices, - ipsec_spd_entry_sort); + vec_sort_with_function + (spd->ipv6_inbound_protect_policy_indices, + ipsec_spd_entry_sort); } else { - vec_add1 (spd-> - ipv6_inbound_policy_discard_and_bypass_indices, - policy_index); + vec_add1 + (spd->ipv6_inbound_policy_discard_and_bypass_indices, + policy_index); clib_memcpy (vp, policy, sizeof (ipsec_policy_t)); - vec_sort_with_function (spd-> - ipv6_inbound_policy_discard_and_bypass_indices, - ipsec_spd_entry_sort); + vec_sort_with_function + (spd->ipv6_inbound_policy_discard_and_bypass_indices, + ipsec_spd_entry_sort); } } else @@ -242,19 +242,19 @@ ipsec_add_del_policy (vlib_main_t * vm, ipsec_policy_t * policy, int is_add) vec_add1 (spd->ipv4_inbound_protect_policy_indices, policy_index); clib_memcpy (vp, policy, sizeof (ipsec_policy_t)); - vec_sort_with_function (spd-> - ipv4_inbound_protect_policy_indices, - ipsec_spd_entry_sort); + vec_sort_with_function + (spd->ipv4_inbound_protect_policy_indices, + ipsec_spd_entry_sort); } else { - vec_add1 (spd-> - ipv4_inbound_policy_discard_and_bypass_indices, - policy_index); + vec_add1 + (spd->ipv4_inbound_policy_discard_and_bypass_indices, + policy_index); clib_memcpy (vp, policy, sizeof (ipsec_policy_t)); - vec_sort_with_function (spd-> - ipv4_inbound_policy_discard_and_bypass_indices, - ipsec_spd_entry_sort); + vec_sort_with_function + (spd->ipv4_inbound_policy_discard_and_bypass_indices, + ipsec_spd_entry_sort); } } } diff --git a/vnet/vnet/ipsec/ipsec.h b/vnet/vnet/ipsec/ipsec.h index 5c43bf51ce7..5b88c8278fb 100644 --- a/vnet/vnet/ipsec/ipsec.h +++ b/vnet/vnet/ipsec/ipsec.h @@ -283,9 +283,9 @@ ipsec_alloc_empty_buffers (vlib_main_t * vm, ipsec_main_t * im) } n_alloc = vlib_buffer_alloc_from_free_list (vm, - im-> - empty_buffers[cpu_index] + - l, 2 * VLIB_FRAME_SIZE - l, + im->empty_buffers[cpu_index] + + l, + 2 * VLIB_FRAME_SIZE - l, free_list_index); _vec_len (im->empty_buffers[cpu_index]) = l + n_alloc; diff --git a/vnet/vnet/ipsec/ipsec_output.c b/vnet/vnet/ipsec/ipsec_output.c index 278dddc360e..e72890d1239 100644 --- a/vnet/vnet/ipsec/ipsec_output.c +++ b/vnet/vnet/ipsec/ipsec_output.c @@ -271,10 +271,10 @@ ipsec_output_node_fn (vlib_main_t * vm, p0 = ipsec_output_ip6_policy_match (spd0, &ip6_0->src_address, &ip6_0->dst_address, - clib_net_to_host_u16 (udp0-> - src_port), - clib_net_to_host_u16 (udp0-> - dst_port), + clib_net_to_host_u16 + (udp0->src_port), + clib_net_to_host_u16 + (udp0->dst_port), ip6_0->protocol); } else @@ -291,16 +291,14 @@ ipsec_output_node_fn (vlib_main_t * vm, #endif p0 = ipsec_output_policy_match (spd0, ip0->protocol, - clib_net_to_host_u32 (ip0-> - src_address. - as_u32), - clib_net_to_host_u32 (ip0-> - dst_address. - as_u32), - clib_net_to_host_u16 (udp0-> - src_port), - clib_net_to_host_u16 (udp0-> - dst_port)); + clib_net_to_host_u32 + (ip0->src_address.as_u32), + clib_net_to_host_u32 + (ip0->dst_address.as_u32), + clib_net_to_host_u16 + (udp0->src_port), + clib_net_to_host_u16 + (udp0->dst_port)); } if (PREDICT_TRUE (p0 != NULL)) diff --git a/vnet/vnet/map/ip4_map.c b/vnet/vnet/map/ip4_map.c index 1a75ca3a68b..b2795acec2b 100644 --- a/vnet/vnet/map/ip4_map.c +++ b/vnet/vnet/map/ip4_map.c @@ -320,12 +320,10 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) ip4_map_decrement_ttl (ip40, &error0); ip4_map_decrement_ttl (ip41, &error1); bool df0 = - ip40-> - flags_and_fragment_offset & + ip40->flags_and_fragment_offset & clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT); bool df1 = - ip41-> - flags_and_fragment_offset & + ip41->flags_and_fragment_offset & clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT); /* MAP calc */ @@ -487,8 +485,7 @@ ip4_map (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) /* Decrement IPv4 TTL */ ip4_map_decrement_ttl (ip40, &error0); bool df0 = - ip40-> - flags_and_fragment_offset & + ip40->flags_and_fragment_offset & clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT); /* MAP calc */ @@ -613,11 +610,11 @@ ip4_map_reass (vlib_main_t * vm, &map_domain_index0); map_ip4_reass_lock (); - map_ip4_reass_t *r = - map_ip4_reass_get (ip40->src_address.as_u32, - ip40->dst_address.as_u32, - ip40->fragment_id, ip40->protocol, - &fragments_to_drop); + map_ip4_reass_t *r = map_ip4_reass_get (ip40->src_address.as_u32, + ip40->dst_address.as_u32, + ip40->fragment_id, + ip40->protocol, + &fragments_to_drop); if (PREDICT_FALSE (!r)) { // Could not create a caching entry @@ -711,9 +708,8 @@ ip4_map_reass (vlib_main_t * vm, vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_TX, cpu_index, map_domain_index0, 1, - clib_net_to_host_u16 (ip60-> - payload_length) - + 40); + clib_net_to_host_u16 + (ip60->payload_length) + 40); next0 = (error0 == MAP_ERROR_NONE) ? next0 : IP4_MAP_REASS_NEXT_DROP; p0->error = error_node->errors[error0]; diff --git a/vnet/vnet/map/ip4_map_t.c b/vnet/vnet/map/ip4_map_t.c index 6c3a80cc5f3..15974d8a46e 100644 --- a/vnet/vnet/map/ip4_map_t.c +++ b/vnet/vnet/map/ip4_map_t.c @@ -376,8 +376,8 @@ _ip4_map_t_icmp (map_domain_t * d, vlib_buffer_t * p, u8 * error) } else { - /* To shut up Coverity */ - os_panic(); + /* To shut up Coverity */ + os_panic (); } //FIXME: Security check with the port found in the inner packet diff --git a/vnet/vnet/map/ip6_map.c b/vnet/vnet/map/ip6_map.c index b51e8358d41..44f0e5dd677 100644 --- a/vnet/vnet/map/ip6_map.c +++ b/vnet/vnet/map/ip6_map.c @@ -870,11 +870,11 @@ ip6_map_ip4_reass (vlib_main_t * vm, map_ip4_reass_lock (); //This node only deals with fragmented ip4 - map_ip4_reass_t *r = - map_ip4_reass_get (ip40->src_address.as_u32, - ip40->dst_address.as_u32, - ip40->fragment_id, ip40->protocol, - &fragments_to_drop); + map_ip4_reass_t *r = map_ip4_reass_get (ip40->src_address.as_u32, + ip40->dst_address.as_u32, + ip40->fragment_id, + ip40->protocol, + &fragments_to_drop); if (PREDICT_FALSE (!r)) { // Could not create a caching entry @@ -968,8 +968,8 @@ ip6_map_ip4_reass (vlib_main_t * vm, vlib_increment_combined_counter (cm + MAP_DOMAIN_COUNTER_RX, cpu_index, map_domain_index0, 1, - clib_net_to_host_u16 (ip40-> - length)); + clib_net_to_host_u16 + (ip40->length)); next0 = (error0 == MAP_ERROR_NONE) ? next0 : IP6_MAP_IP4_REASS_NEXT_DROP; @@ -1113,8 +1113,7 @@ ip6_map_icmp_relay (vlib_main_t * vm, /* Check DF flag */ if (! - (inner_ip40-> - flags_and_fragment_offset & + (inner_ip40->flags_and_fragment_offset & clib_host_to_net_u16 (IP4_HEADER_FLAG_DONT_FRAGMENT))) { error0 = MAP_ERROR_ICMP_RELAY; diff --git a/vnet/vnet/map/map.c b/vnet/vnet/map/map.c index 93a10c679f0..fdd56ee488d 100644 --- a/vnet/vnet/map/map.c +++ b/vnet/vnet/map/map.c @@ -128,8 +128,9 @@ ip6_get_port (ip6_header_t * ip6, map_dir_e dir, u16 buffer_len) if (l4_protocol == IP_PROTOCOL_TCP || l4_protocol == IP_PROTOCOL_UDP) { return (dir == - MAP_SENDER) ? ((udp_header_t *) (l4))-> - src_port : ((udp_header_t *) (l4))->dst_port; + MAP_SENDER) ? ((udp_header_t *) (l4))->src_port : ((udp_header_t + *) + (l4))->dst_port; } else if (l4_protocol == IP_PROTOCOL_ICMP6) { @@ -230,8 +231,7 @@ map_create_domain (ip4_address_t * ip4_prefix, memset (&adj, 0, sizeof (adj)); adj.explicit_fib_index = ~0; adj.lookup_next_index = - (d-> - flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T : + (d->flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T : IP_LOOKUP_NEXT_MAP; p = (uword *) & adj.rewrite_data[0]; *p = (uword) (*map_domain_index); @@ -339,8 +339,7 @@ map_delete_domain (u32 map_domain_index) memset (&adj, 0, sizeof (adj)); adj.explicit_fib_index = ~0; adj.lookup_next_index = - (d-> - flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T : + (d->flags & MAP_DOMAIN_TRANSLATION) ? IP_LOOKUP_NEXT_MAP_T : IP_LOOKUP_NEXT_MAP; /* Delete ip4 adjacency */ diff --git a/vnet/vnet/sr/sr_replicate.c b/vnet/vnet/sr/sr_replicate.c index 8a51fdb882d..4711ff1a1ed 100644 --- a/vnet/vnet/sr/sr_replicate.c +++ b/vnet/vnet/sr/sr_replicate.c @@ -357,8 +357,8 @@ sr_replicate_node_fn (vlib_main_t * vm, (hdr_ip0->payload_length); } tr->next_index = next_index; - if (hdr_sr0) - memcpy (tr->sr, hdr_sr0, sizeof (tr->sr)); + if (hdr_sr0) + memcpy (tr->sr, hdr_sr0, sizeof (tr->sr)); } } diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index 3e3548d1460..8a341597a0a 100644 --- a/vpp/vpp-api/api.c +++ b/vpp/vpp-api/api.c @@ -2591,7 +2591,7 @@ vl_api_sw_interface_clear_stats_t_handler (vl_api_sw_interface_clear_stats_t * int rv = 0; if (mp->sw_if_index != ~0) - VALIDATE_SW_IF_INDEX(mp); + VALIDATE_SW_IF_INDEX (mp); vec_reset_length (my_vnet_mains); @@ -5668,16 +5668,16 @@ send_lisp_eid_table_details (mapping_t * mapit, switch (filter) { - case 0: /* all mappings */ + case 0: /* all mappings */ break; - case 1: /* local only */ + case 1: /* local only */ if (!mapit->local) - return; + return; break; - case 2: /* remote only */ + case 2: /* remote only */ if (mapit->local) - return; + return; break; default: clib_warning ("Filter error, unknown filter: %d", filter); @@ -5754,7 +5754,7 @@ vl_api_lisp_eid_table_dump_t_handler (vl_api_lisp_eid_table_dump_t * mp) mapit = pool_elt_at_index (lcm->mapping_pool, mi); send_lisp_eid_table_details (mapit, q, mp->context, - 0 /* ignore filter */); + 0 /* ignore filter */ ); } else { @@ -7100,7 +7100,7 @@ send_mpls_gre_tunnel_entry (vpe_api_main_t * am, e = pool_elt_at_index (mm->encaps, gt->encap_index); nlabels = vec_len (e->labels); - mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32)); + mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32)); memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_MPLS_GRE_TUNNEL_DETAILS); mp->context = context; @@ -7143,11 +7143,11 @@ vl_api_mpls_gre_tunnel_dump_t_handler (vl_api_mpls_gre_tunnel_dump_t * mp) if (index != ~0) { if (!pool_is_free_index (mm->gre_tunnels, index)) - { - gt = pool_elt_at_index (mm->gre_tunnels, index); - send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels, - mp->context); - } + { + gt = pool_elt_at_index (mm->gre_tunnels, index); + send_mpls_gre_tunnel_entry (am, q, gt, gt - mm->gre_tunnels, + mp->context); + } } else { @@ -7182,7 +7182,7 @@ send_mpls_eth_tunnel_entry (vpe_api_main_t * am, e = pool_elt_at_index (mm->encaps, et->encap_index); nlabels = vec_len (e->labels); - mp = vl_msg_api_alloc (sizeof (*mp) + nlabels*sizeof(u32)); + mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32)); memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_MPLS_ETH_TUNNEL_DETAILS); mp->context = context; @@ -7223,12 +7223,12 @@ vl_api_mpls_eth_tunnel_dump_t_handler (vl_api_mpls_eth_tunnel_dump_t * mp) if (index != ~0) { - if (!pool_is_free_index(mm->eth_tunnels, index)) - { - et = pool_elt_at_index (mm->eth_tunnels, index); - send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels, - mp->context); - } + if (!pool_is_free_index (mm->eth_tunnels, index)) + { + et = pool_elt_at_index (mm->eth_tunnels, index); + send_mpls_eth_tunnel_entry (am, q, et, et - mm->eth_tunnels, + mp->context); + } } else { @@ -7262,7 +7262,7 @@ send_mpls_fib_encap_details (vpe_api_main_t * am, e = pool_elt_at_index (mm->encaps, s->entry_index); nlabels = vec_len (e->labels); - mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof(u32)); + mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32)); memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_ENCAP_DETAILS); mp->context = context; @@ -8118,7 +8118,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input) struct passwd _pw, *pw; struct group _grp, *grp; clib_error_t *e; - buf = vec_new(char,128); + buf = vec_new (char, 128); while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { if (unformat (input, "prefix %s", &chroot_path)) @@ -8134,10 +8134,12 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input) { /* lookup the username */ pw = NULL; - while (((rv = getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE) && ( vec_len(buf) <= max_buf_size )) - { - vec_resize(buf,vec_len(buf)*2); - } + while (((rv = + getpwnam_r (s, &_pw, buf, vec_len (buf), &pw)) == ERANGE) + && (vec_len (buf) <= max_buf_size)) + { + vec_resize (buf, vec_len (buf) * 2); + } if (rv < 0) { e = clib_error_return_code (0, rv, @@ -8145,7 +8147,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input) CLIB_ERROR_FATAL, "cannot fetch username %s", s); vec_free (s); - vec_free (buf); + vec_free (buf); return e; } if (pw == NULL) @@ -8153,7 +8155,7 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input) e = clib_error_return_fatal (0, "username %s does not exist", s); vec_free (s); - vec_free (buf); + vec_free (buf); return e; } vec_free (s); @@ -8163,10 +8165,12 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input) { /* lookup the group name */ grp = NULL; - while ( ( (rv = getgrnam_r (s, &_grp, buf, vec_len(buf), &grp)) == ERANGE ) && ( vec_len(buf) <= max_buf_size ) ) - { - vec_resize(buf,vec_len(buf)*2); - } + while (((rv = + getgrnam_r (s, &_grp, buf, vec_len (buf), &grp)) == ERANGE) + && (vec_len (buf) <= max_buf_size)) + { + vec_resize (buf, vec_len (buf) * 2); + } if (rv != 0) { e = clib_error_return_code (0, rv, @@ -8174,18 +8178,18 @@ api_segment_config (vlib_main_t * vm, unformat_input_t * input) CLIB_ERROR_FATAL, "cannot fetch group %s", s); vec_free (s); - vec_free (buf); + vec_free (buf); return e; } if (grp == NULL) { e = clib_error_return_fatal (0, "group %s does not exist", s); vec_free (s); - vec_free (buf); + vec_free (buf); return e; } vec_free (s); - vec_free (buf); + vec_free (buf); vl_set_memory_gid (grp->gr_gid); } else diff --git a/vpp/vpp-api/custom_dump.c b/vpp/vpp-api/custom_dump.c index 51bb00bb2b4..c4d9a6ee7e6 100644 --- a/vpp/vpp-api/custom_dump.c +++ b/vpp/vpp-api/custom_dump.c @@ -2196,20 +2196,20 @@ static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print } static void *vl_api_lisp_enable_disable_t_print - (vl_api_lisp_enable_disable_t * mp, void * handle) + (vl_api_lisp_enable_disable_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_enable_disable %s", - mp->is_en ? "enable" : "disable"); + mp->is_en ? "enable" : "disable"); FINISH; } static void *vl_api_lisp_gpe_add_del_iface_t_print - (vl_api_lisp_gpe_add_del_iface_t * mp, void * handle) + (vl_api_lisp_gpe_add_del_iface_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_gpe_add_del_iface "); @@ -2221,9 +2221,9 @@ static void *vl_api_lisp_gpe_add_del_iface_t_print } static void *vl_api_lisp_pitr_set_locator_set_t_print - (vl_api_lisp_pitr_set_locator_set_t * mp, void * handle) + (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_pitr_set_locator_set "); @@ -2235,10 +2235,11 @@ static void *vl_api_lisp_pitr_set_locator_set_t_print FINISH; } -static u8 * format_lisp_flat_eid (u8 * s, va_list * args) +static u8 * +format_lisp_flat_eid (u8 * s, va_list * args) { u32 type = va_arg (*args, u32); - u8 * eid = va_arg (*args, u8 *); + u8 *eid = va_arg (*args, u8 *); u32 eid_len = va_arg (*args, u32); switch (type) @@ -2253,12 +2254,13 @@ static u8 * format_lisp_flat_eid (u8 * s, va_list * args) return 0; } -static u8 * format_lisp_eid_vat (u8 * s, va_list * args) +static u8 * +format_lisp_eid_vat (u8 * s, va_list * args) { u32 type = va_arg (*args, u32); - u8 * eid = va_arg (*args, u8 *); + u8 *eid = va_arg (*args, u8 *); u32 eid_len = va_arg (*args, u32); - u8 * seid = va_arg (*args, u8 *); + u8 *seid = va_arg (*args, u8 *); u32 seid_len = va_arg (*args, u32); u32 is_src_dst = va_arg (*args, u32); @@ -2271,17 +2273,22 @@ static u8 * format_lisp_eid_vat (u8 * s, va_list * args) } /** Used for transferring locators via VPP API */ -typedef CLIB_PACKED(struct -{ - u8 is_ip4; /**< is locator an IPv4 address */ - u8 priority; /**< locator priority */ - u8 weight; /**< locator weight */ - u8 addr[16]; /**< IPv4/IPv6 address */ -}) rloc_t; +typedef CLIB_PACKED (struct + { + u8 is_ip4; + /**< is locator an IPv4 address */ + u8 priority; + /**< locator priority */ + u8 weight; + /**< locator weight */ + u8 addr[16]; + /**< IPv4/IPv6 address */ + }) rloc_t; -static u8 * format_rloc (u8 * s, va_list * args) +static u8 * +format_rloc (u8 * s, va_list * args) { - rloc_t * rloc = va_arg (*args, rloc_t *); + rloc_t *rloc = va_arg (*args, rloc_t *); if (rloc->is_ip4) s = format (s, "%U ", format_ip4_address, rloc->addr); @@ -2294,9 +2301,9 @@ static u8 * format_rloc (u8 * s, va_list * args) } static void *vl_api_lisp_add_del_remote_mapping_t_print - (vl_api_lisp_add_del_remote_mapping_t * mp, void * handle) + (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle) { - u8 * s; + u8 *s; u32 i, rloc_num = 0; s = format (0, "SCRIPT: lisp_add_del_remote_mapping "); @@ -2308,8 +2315,8 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni)); s = format (s, "deid %U ", format_lisp_eid_vat, - mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len, - mp->is_src_dst); + mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len, + mp->is_src_dst); rloc_num = mp->rloc_num; @@ -2317,34 +2324,34 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print s = format (s, "action %d", mp->action); else { - rloc_t * rloc = (rloc_t *) mp->rlocs; + rloc_t *rloc = (rloc_t *) mp->rlocs; for (i = 0; i < rloc_num; i++) - s = format (s, "%U ", format_rloc, &rloc[i]); + s = format (s, "%U ", format_rloc, &rloc[i]); } FINISH; } static void *vl_api_lisp_add_del_adjacency_t_print - (vl_api_lisp_add_del_adjacency_t * mp, void * handle) + (vl_api_lisp_add_del_adjacency_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_add_del_adjacency "); s = format (s, "%s ", mp->is_add ? "add" : "del"); s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni)); s = format (s, "deid %U seid %U ", - format_lisp_flat_eid, mp->eid_type, mp->deid, mp->deid_len, - format_lisp_flat_eid, mp->eid_type, mp->seid, mp->seid_len); + format_lisp_flat_eid, mp->eid_type, mp->deid, mp->deid_len, + format_lisp_flat_eid, mp->eid_type, mp->seid, mp->seid_len); FINISH; } static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print - (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void * handle) + (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs "); @@ -2357,9 +2364,9 @@ static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print } static void *vl_api_lisp_eid_table_add_del_map_t_print - (vl_api_lisp_eid_table_add_del_map_t * mp, void * handle) + (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_eid_table_add_del_map "); @@ -2368,15 +2375,15 @@ static void *vl_api_lisp_eid_table_add_del_map_t_print s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni)); s = format (s, "%s %d ", - mp->is_l2 ? "bd_index" : "vrf", - clib_net_to_host_u32 (mp->dp_table)); + mp->is_l2 ? "bd_index" : "vrf", + clib_net_to_host_u32 (mp->dp_table)); FINISH; } static void *vl_api_lisp_add_del_local_eid_t_print - (vl_api_lisp_add_del_local_eid_t * mp, void * handle) + (vl_api_lisp_add_del_local_eid_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_add_del_local_eid "); @@ -2385,15 +2392,15 @@ static void *vl_api_lisp_add_del_local_eid_t_print s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni)); s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid, - mp->prefix_len); + mp->prefix_len); s = format (s, "locator-set %s ", mp->locator_set_name); FINISH; } static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print - (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void * handle) + (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_gpe_add_del_fwd_entry TODO"); @@ -2401,9 +2408,9 @@ static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print } static void *vl_api_lisp_add_del_map_resolver_t_print - (vl_api_lisp_add_del_map_resolver_t * mp, void * handle) + (vl_api_lisp_add_del_map_resolver_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_add_del_map_resolver "); @@ -2419,9 +2426,9 @@ static void *vl_api_lisp_add_del_map_resolver_t_print } static void *vl_api_lisp_gpe_enable_disable_t_print - (vl_api_lisp_gpe_enable_disable_t * mp, void * handle) + (vl_api_lisp_gpe_enable_disable_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_gpe_enable_disable "); @@ -2430,28 +2437,31 @@ static void *vl_api_lisp_gpe_enable_disable_t_print FINISH; } -typedef CLIB_PACKED(struct -{ - u32 sw_if_index; /**< locator sw_if_index */ - u8 priority; /**< locator priority */ - u8 weight; /**< locator weight */ -}) ls_locator_t; +typedef CLIB_PACKED (struct + { + u32 sw_if_index; + /**< locator sw_if_index */ + u8 priority; + /**< locator priority */ + u8 weight; + /**< locator weight */ + }) ls_locator_t; static u8 * format_locator (u8 * s, va_list * args) { - ls_locator_t * l = va_arg (*args, ls_locator_t *); + ls_locator_t *l = va_arg (*args, ls_locator_t *); return format (s, "sw_if_index %d p %d w %d", - l->sw_if_index, l->priority, l->weight); + l->sw_if_index, l->priority, l->weight); } static void *vl_api_lisp_add_del_locator_set_t_print - (vl_api_lisp_add_del_locator_set_t * mp, void * handle) + (vl_api_lisp_add_del_locator_set_t * mp, void *handle) { - u8 * s; + u8 *s; u32 loc_num = 0, i; - ls_locator_t * locs; + ls_locator_t *locs; s = format (0, "SCRIPT: lisp_add_del_locator_set "); @@ -2470,9 +2480,9 @@ static void *vl_api_lisp_add_del_locator_set_t_print } static void *vl_api_lisp_add_del_locator_t_print - (vl_api_lisp_add_del_locator_t * mp, void * handle) + (vl_api_lisp_add_del_locator_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_add_del_locator "); @@ -2487,9 +2497,9 @@ static void *vl_api_lisp_add_del_locator_t_print } static void *vl_api_lisp_locator_set_dump_t_print - (vl_api_lisp_locator_set_dump_t * mp, void * handle) + (vl_api_lisp_locator_set_dump_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_locator_set_dump "); @@ -2499,9 +2509,9 @@ static void *vl_api_lisp_locator_set_dump_t_print } static void *vl_api_lisp_eid_table_dump_t_print - (vl_api_lisp_eid_table_dump_t * mp, void * handle) + (vl_api_lisp_eid_table_dump_t * mp, void *handle) { - u8 * s; + u8 *s; s = format (0, "SCRIPT: lisp_eid_table_dump "); @@ -2509,16 +2519,16 @@ static void *vl_api_lisp_eid_table_dump_t_print { s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni)); s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, - mp->eid, mp->prefix_length); + mp->eid, mp->prefix_length); switch (mp->filter) - { - case 1: - s = format (s, "local "); - break; - case 2: - s = format (s, "remote "); - break; - } + { + case 1: + s = format (s, "local "); + break; + case 2: + s = format (s, "remote "); + break; + } } FINISH; @@ -2539,7 +2549,6 @@ static void * vl_api_ ## f ## _t_print \ } foreach_custom_print_no_arg_function #undef _ - #define foreach_custom_print_function \ _(CREATE_LOOPBACK, create_loopback) \ _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \ @@ -2669,9 +2678,7 @@ _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \ _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \ _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \ _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) - - -void + void vl_msg_api_custom_dump_configure (api_main_t * am) { #define _(n,f) am->msg_print_handlers[VL_API_##n] \ |