aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-12-13 21:47:40 +0100
committerDave Barach <openvpp@barachs.net>2020-12-14 12:14:21 +0000
commitb2c31b685fd2cf28436ca32bc93e23eb24c74878 (patch)
treedc0a1b1ff784445b2cbb0f9b2c07b5bcb4f5a5d0 /src/vnet/devices
parent62c25abaa3e93be5815172d391295a6ab0390122 (diff)
misc: move to new pool_foreach macros
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/af_packet/af_packet.c6
-rw-r--r--src/vnet/devices/tap/cli.c6
-rw-r--r--src/vnet/devices/tap/tap.c4
-rw-r--r--src/vnet/devices/virtio/cli.c5
-rw-r--r--src/vnet/devices/virtio/pci.c4
-rw-r--r--src/vnet/devices/virtio/vhost_user.c27
-rw-r--r--src/vnet/devices/virtio/virtio_api.c15
-rw-r--r--src/vnet/devices/virtio/virtio_process.c4
8 files changed, 32 insertions, 39 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 62371cd5495..31d4df0c0e3 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -506,8 +506,8 @@ af_packet_dump_ifs (af_packet_if_detail_t ** out_af_packet_ifs)
af_packet_if_detail_t *af_packet_if = NULL;
/* *INDENT-OFF* */
- pool_foreach (apif, apm->interfaces,
- ({
+ pool_foreach (apif, apm->interfaces)
+ {
vec_add2 (r_af_packet_ifs, af_packet_if, 1);
af_packet_if->sw_if_index = apif->sw_if_index;
if (apif->host_if_name)
@@ -516,7 +516,7 @@ af_packet_dump_ifs (af_packet_if_detail_t ** out_af_packet_ifs)
MIN (ARRAY_LEN (af_packet_if->host_if_name) - 1,
strlen ((const char *) apif->host_if_name)));
}
- }));
+ }
/* *INDENT-ON* */
*out_af_packet_ifs = r_af_packet_ifs;
diff --git a/src/vnet/devices/tap/cli.c b/src/vnet/devices/tap/cli.c
index 89b2ff091b0..10f4bb0ee2e 100644
--- a/src/vnet/devices/tap/cli.c
+++ b/src/vnet/devices/tap/cli.c
@@ -297,9 +297,8 @@ tap_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (vec_len (hw_if_indices) == 0)
{
/* *INDENT-OFF* */
- pool_foreach (vif, mm->interfaces,
+ pool_foreach (vif, mm->interfaces)
vec_add1 (hw_if_indices, vif->hw_if_index);
- );
/* *INDENT-ON* */
}
@@ -347,9 +346,8 @@ tun_show_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (vec_len (hw_if_indices) == 0)
{
/* *INDENT-OFF* */
- pool_foreach (vif, mm->interfaces,
+ pool_foreach (vif, mm->interfaces)
vec_add1 (hw_if_indices, vif->hw_if_index);
- );
/* *INDENT-ON* */
}
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index b65879c42fc..11c24808f7b 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -946,7 +946,7 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids)
tap_interface_details_t *tapid = NULL;
/* *INDENT-OFF* */
- pool_foreach (vif, mm->interfaces,
+ pool_foreach (vif, mm->interfaces) {
if ((vif->type != VIRTIO_IF_TYPE_TAP)
&& (vif->type != VIRTIO_IF_TYPE_TUN))
continue;
@@ -988,7 +988,7 @@ tap_dump_ifs (tap_interface_details_t ** out_tapids)
clib_memcpy(tapid->host_ip6_addr.as_u8, &vif->host_ip6_addr, 16);
tapid->host_ip6_prefix_len = vif->host_ip6_prefix_len;
tapid->host_mtu_size = vif->host_mtu_size;
- );
+ }
/* *INDENT-ON* */
*out_tapids = r_tapids;
diff --git a/src/vnet/devices/virtio/cli.c b/src/vnet/devices/virtio/cli.c
index 05f9eab18cf..a78336997e2 100644
--- a/src/vnet/devices/virtio/cli.c
+++ b/src/vnet/devices/virtio/cli.c
@@ -231,9 +231,8 @@ show_virtio_pci_fn (vlib_main_t * vm, unformat_input_t * input,
if (vec_len (hw_if_indices) == 0)
{
- pool_foreach (vif, vim->interfaces,
- vec_add1 (hw_if_indices, vif->hw_if_index);
- );
+ pool_foreach (vif, vim->interfaces)
+ vec_add1 (hw_if_indices, vif->hw_if_index);
}
else if (show_device_config)
{
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 785ca4839c5..93ea70b3b53 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -1352,7 +1352,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
u32 interrupt_count = 0;
/* *INDENT-OFF* */
- pool_foreach (vif, vim->interfaces, ({
+ pool_foreach (vif, vim->interfaces) {
if (vif->pci_addr.as_u32 == args->addr)
{
args->rv = VNET_API_ERROR_ADDRESS_IN_USE;
@@ -1363,7 +1363,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
" PCI address in use");
return;
}
- }));
+ }
/* *INDENT-ON* */
pool_get (vim->interfaces, vif);
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c
index f7cecef4d19..45897b66cb6 100644
--- a/src/vnet/devices/virtio/vhost_user.c
+++ b/src/vnet/devices/virtio/vhost_user.c
@@ -1126,7 +1126,7 @@ vhost_user_send_interrupt_process (vlib_main_t * vm,
case ~0:
/* *INDENT-OFF* */
- pool_foreach (vui, vum->vhost_user_interfaces, {
+ pool_foreach (vui, vum->vhost_user_interfaces) {
next_timeout = timeout;
for (qid = 0; qid < VHOST_VRING_MAX_N / 2; qid += 2)
{
@@ -1154,7 +1154,7 @@ vhost_user_send_interrupt_process (vlib_main_t * vm,
if ((next_timeout < timeout) && (next_timeout > 0.0))
timeout = next_timeout;
}
- });
+ }
/* *INDENT-ON* */
break;
@@ -1205,7 +1205,7 @@ vhost_user_process (vlib_main_t * vm,
timeout = 3.0;
/* *INDENT-OFF* */
- pool_foreach (vui, vum->vhost_user_interfaces, {
+ pool_foreach (vui, vum->vhost_user_interfaces) {
if (vui->unix_server_index == ~0) { //Nothing to do for server sockets
if (vui->clib_file_index == ~0)
@@ -1273,7 +1273,7 @@ vhost_user_process (vlib_main_t * vm,
}
}
}
- });
+ }
/* *INDENT-ON* */
}
return 0;
@@ -1408,9 +1408,9 @@ vhost_user_exit (vlib_main_t * vm)
vlib_worker_thread_barrier_sync (vlib_get_main ());
/* *INDENT-OFF* */
- pool_foreach (vui, vum->vhost_user_interfaces, {
+ pool_foreach (vui, vum->vhost_user_interfaces) {
vhost_user_delete_if (vnm, vm, vui->sw_if_index);
- });
+ }
/* *INDENT-ON* */
vlib_worker_thread_barrier_release (vlib_get_main ());
return 0;
@@ -1832,9 +1832,8 @@ vhost_user_dump_ifs (vnet_main_t * vnm, vlib_main_t * vm,
if (!out_vuids)
return -1;
- pool_foreach (vui, vum->vhost_user_interfaces,
- vec_add1 (hw_if_indices, vui->hw_if_index);
- );
+ pool_foreach (vui, vum->vhost_user_interfaces)
+ vec_add1 (hw_if_indices, vui->hw_if_index);
for (i = 0; i < vec_len (hw_if_indices); i++)
{
@@ -2110,9 +2109,8 @@ show_vhost_user_command_fn (vlib_main_t * vm,
}
if (vec_len (hw_if_indices) == 0)
{
- pool_foreach (vui, vum->vhost_user_interfaces,
- vec_add1 (hw_if_indices, vui->hw_if_index);
- );
+ pool_foreach (vui, vum->vhost_user_interfaces)
+ vec_add1 (hw_if_indices, vui->hw_if_index);
}
vlib_cli_output (vm, "Virtio vhost-user interfaces");
vlib_cli_output (vm, "Global:\n coalesce frames %d time %e",
@@ -2509,9 +2507,8 @@ vhost_user_unmap_all (void)
if (vum->dont_dump_vhost_user_memory)
{
- pool_foreach (vui, vum->vhost_user_interfaces,
- unmap_all_mem_regions (vui);
- );
+ pool_foreach (vui, vum->vhost_user_interfaces)
+ unmap_all_mem_regions (vui);
}
}
diff --git a/src/vnet/devices/virtio/virtio_api.c b/src/vnet/devices/virtio/virtio_api.c
index bd72284fd78..4d0b663b3dd 100644
--- a/src/vnet/devices/virtio/virtio_api.c
+++ b/src/vnet/devices/virtio/virtio_api.c
@@ -232,14 +232,13 @@ static void
if (!reg)
return;
- pool_foreach (vif, vmx->interfaces, (
- {
- if (vif->type == VIRTIO_IF_TYPE_PCI)
- {
- virtio_pci_send_sw_interface_details
- (am, reg, vif, mp->context);}
- }
- ));
+ pool_foreach (vif, vmx->interfaces)
+ {
+ if (vif->type == VIRTIO_IF_TYPE_PCI)
+ {
+ virtio_pci_send_sw_interface_details (am, reg, vif, mp->context);
+ }
+ }
}
#define vl_msg_name_crc_list
diff --git a/src/vnet/devices/virtio/virtio_process.c b/src/vnet/devices/virtio/virtio_process.c
index 7a25611bb95..1689459f1cc 100644
--- a/src/vnet/devices/virtio/virtio_process.c
+++ b/src/vnet/devices/virtio/virtio_process.c
@@ -46,7 +46,7 @@ virtio_send_interrupt_process (vlib_main_t * vm,
case ~0:
/* *INDENT-OFF* */
- pool_foreach (vif, vim->interfaces, {
+ pool_foreach (vif, vim->interfaces) {
if (vif->packet_coalesce || vif->packet_buffering)
{
virtio_vring_t *vring;
@@ -59,7 +59,7 @@ virtio_send_interrupt_process (vlib_main_t * vm,
RX_QUEUE_ACCESS (vring->queue_id));
}
}
- });
+ }
/* *INDENT-ON* */
break;