diff options
Diffstat (limited to 'vlib')
-rw-r--r-- | vlib/vlib/cli.c | 10 | ||||
-rw-r--r-- | vlib/vlib/dpdk_buffer.c | 124 | ||||
-rw-r--r-- | vlib/vlib/mc.h | 7 | ||||
-rw-r--r-- | vlib/vlib/node.c | 10 | ||||
-rw-r--r-- | vlib/vlib/pci/linux_pci.c | 3 | ||||
-rw-r--r-- | vlib/vlib/pci/pci_config.h | 26 | ||||
-rw-r--r-- | vlib/vlib/threads.c | 4 | ||||
-rw-r--r-- | vlib/vlib/unix/cli.c | 2 | ||||
-rw-r--r-- | vlib/vlib/unix/plugin.c | 32 | ||||
-rw-r--r-- | vlib/vlib/unix/util.c | 2 |
10 files changed, 121 insertions, 99 deletions
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) |