aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/devices')
-rw-r--r--src/vnet/devices/af_packet/af_packet.c2
-rw-r--r--src/vnet/devices/devices.c24
-rw-r--r--src/vnet/devices/devices.h10
-rw-r--r--src/vnet/devices/tap/tap.c2
-rw-r--r--src/vnet/devices/virtio/device.c4
-rw-r--r--src/vnet/devices/virtio/pci.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user.c12
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c8
-rw-r--r--src/vnet/devices/virtio/vhost_user_output.c21
9 files changed, 41 insertions, 44 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 455e76b4280..62371cd5495 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -396,7 +396,7 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set,
VNET_HW_INTERFACE_FLAG_LINK_UP);
vnet_hw_interface_set_rx_mode (vnm, apif->hw_if_index, 0,
- VNET_HW_INTERFACE_RX_MODE_INTERRUPT);
+ VNET_HW_IF_RX_MODE_INTERRUPT);
mhash_set_mem (&apm->if_index_by_host_if_name, host_if_name_dup, &if_index,
0);
diff --git a/src/vnet/devices/devices.c b/src/vnet/devices/devices.c
index cfce2ac2856..82b46f7244a 100644
--- a/src/vnet/devices/devices.c
+++ b/src/vnet/devices/devices.c
@@ -170,14 +170,14 @@ vnet_hw_interface_assign_rx_thread (vnet_main_t * vnm, u32 hw_if_index,
dq->hw_if_index = hw_if_index;
dq->dev_instance = hw->dev_instance;
dq->queue_id = queue_id;
- dq->mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ dq->mode = VNET_HW_IF_RX_MODE_POLLING;
rt->enabled_node_state = VLIB_NODE_STATE_POLLING;
vnet_device_queue_update (vnm, rt);
vec_validate (hw->input_node_thread_index_by_queue, queue_id);
vec_validate (hw->rx_mode_by_queue, queue_id);
hw->input_node_thread_index_by_queue[queue_id] = thread_index;
- hw->rx_mode_by_queue[queue_id] = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ hw->rx_mode_by_queue[queue_id] = VNET_HW_IF_RX_MODE_POLLING;
vlib_worker_thread_barrier_release (vm0);
@@ -193,7 +193,7 @@ vnet_hw_interface_unassign_rx_thread (vnet_main_t * vnm, u32 hw_if_index,
vnet_device_input_runtime_t *rt;
vnet_device_and_queue_t *dq;
uword old_thread_index;
- vnet_hw_interface_rx_mode mode;
+ vnet_hw_if_rx_mode mode;
if (hw->input_node_thread_index_by_queue == 0)
return VNET_API_ERROR_INVALID_INTERFACE;
@@ -222,12 +222,12 @@ delete:
vlib_worker_thread_barrier_sync (vm0);
vec_del1 (rt->devices_and_queues, dq - rt->devices_and_queues);
vnet_device_queue_update (vnm, rt);
- hw->rx_mode_by_queue[queue_id] = VNET_HW_INTERFACE_RX_MODE_UNKNOWN;
+ hw->rx_mode_by_queue[queue_id] = VNET_HW_IF_RX_MODE_UNKNOWN;
vlib_worker_thread_barrier_release (vm0);
if (vec_len (rt->devices_and_queues) == 0)
vlib_node_set_state (vm, hw->input_node_index, VLIB_NODE_STATE_DISABLED);
- else if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ else if (mode == VNET_HW_IF_RX_MODE_POLLING)
{
/*
* if the deleted interface is polling, we may need to set the node state
@@ -238,7 +238,7 @@ delete:
*/
vec_foreach (dq, rt->devices_and_queues)
{
- if (dq->mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (dq->mode == VNET_HW_IF_RX_MODE_POLLING)
return 0;
}
rt->enabled_node_state = VLIB_NODE_STATE_INTERRUPT;
@@ -251,18 +251,18 @@ delete:
int
vnet_hw_interface_set_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
- u16 queue_id, vnet_hw_interface_rx_mode mode)
+ u16 queue_id, vnet_hw_if_rx_mode mode)
{
vlib_main_t *vm;
uword thread_index;
vnet_device_and_queue_t *dq;
vlib_node_state_t enabled_node_state;
- ASSERT (mode < VNET_HW_INTERFACE_NUM_RX_MODES);
+ ASSERT (mode < VNET_HW_IF_NUM_RX_MODES);
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
vnet_device_input_runtime_t *rt;
int is_polling = 0;
- if (mode == VNET_HW_INTERFACE_RX_MODE_DEFAULT)
+ if (mode == VNET_HW_IF_RX_MODE_DEFAULT)
mode = hw->default_rx_mode;
if (hw->input_node_thread_index_by_queue == 0 || hw->rx_mode_by_queue == 0)
@@ -271,7 +271,7 @@ vnet_hw_interface_set_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
if (hw->rx_mode_by_queue[queue_id] == mode)
return 0;
- if (mode != VNET_HW_INTERFACE_RX_MODE_POLLING &&
+ if (mode != VNET_HW_IF_RX_MODE_POLLING &&
(hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE) == 0)
return VNET_API_ERROR_UNSUPPORTED;
@@ -289,7 +289,7 @@ vnet_hw_interface_set_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
{
if (dq->hw_if_index == hw_if_index && dq->queue_id == queue_id)
dq->mode = mode;
- if (dq->mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (dq->mode == VNET_HW_IF_RX_MODE_POLLING)
is_polling = 1;
}
@@ -311,7 +311,7 @@ vnet_hw_interface_set_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
int
vnet_hw_interface_get_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
- u16 queue_id, vnet_hw_interface_rx_mode * mode)
+ u16 queue_id, vnet_hw_if_rx_mode * mode)
{
vlib_main_t *vm;
uword thread_index;
diff --git a/src/vnet/devices/devices.h b/src/vnet/devices/devices.h
index d561563c295..4e7f30db4d6 100644
--- a/src/vnet/devices/devices.h
+++ b/src/vnet/devices/devices.h
@@ -60,7 +60,7 @@ typedef struct
u32 hw_if_index;
u32 dev_instance;
u16 queue_id;
- vnet_hw_interface_rx_mode mode;
+ vnet_hw_if_rx_mode mode;
u32 interrupt_pending;
} vnet_device_and_queue_t;
@@ -88,11 +88,9 @@ void vnet_hw_interface_assign_rx_thread (vnet_main_t * vnm, u32 hw_if_index,
int vnet_hw_interface_unassign_rx_thread (vnet_main_t * vnm, u32 hw_if_index,
u16 queue_id);
int vnet_hw_interface_set_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
- u16 queue_id,
- vnet_hw_interface_rx_mode mode);
+ u16 queue_id, vnet_hw_if_rx_mode mode);
int vnet_hw_interface_get_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
- u16 queue_id,
- vnet_hw_interface_rx_mode * mode);
+ u16 queue_id, vnet_hw_if_rx_mode * mode);
static inline u64
vnet_get_aggregate_rx_packets (void)
@@ -160,7 +158,7 @@ vnet_device_input_set_interrupt_pending (vnet_main_t * vnm, u32 hw_if_index,
*/
#define foreach_device_and_queue(var,vec) \
for (var = (vec); var < vec_end (vec); var++) \
- if ((var->mode == VNET_HW_INTERFACE_RX_MODE_POLLING) \
+ if ((var->mode == VNET_HW_IF_RX_MODE_POLLING) \
|| clib_atomic_swap_acq_n (&((var)->interrupt_pending), 0))
#endif /* included_vnet_vnet_device_h */
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 040ec1f1ea5..4a02c5a627f 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -740,7 +740,7 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
{
vnet_hw_interface_assign_rx_thread (vnm, vif->hw_if_index, i, ~0);
vnet_hw_interface_set_rx_mode (vnm, vif->hw_if_index, i,
- VNET_HW_INTERFACE_RX_MODE_DEFAULT);
+ VNET_HW_IF_RX_MODE_DEFAULT);
virtio_vring_set_numa_node (vm, vif, RX_QUEUE (i));
}
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 334da18ecb7..32c1eab6b34 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -762,7 +762,7 @@ virtio_clear_hw_interface_counters (u32 instance)
static clib_error_t *
virtio_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
- vnet_hw_interface_rx_mode mode)
+ vnet_hw_if_rx_mode mode)
{
virtio_main_t *mm = &virtio_main;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
@@ -776,7 +776,7 @@ virtio_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
return clib_error_return (0, "interrupt mode is not supported");
}
- if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (mode == VNET_HW_IF_RX_MODE_POLLING)
{
vec_foreach (tx_vring, vif->txq_vrings)
{
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 9b68b1cefbe..177f764c08a 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -1190,7 +1190,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
virtio_vring_set_numa_node (vm, vif, RX_QUEUE (i));
/* Set default rx mode to POLLING */
vnet_hw_interface_set_rx_mode (vnm, vif->hw_if_index, i,
- VNET_HW_INTERFACE_RX_MODE_POLLING);
+ VNET_HW_IF_RX_MODE_POLLING);
}
if (virtio_pci_is_link_up (vm, vif) & VIRTIO_NET_S_LINK_UP)
{
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c
index 92aee00c25e..5b42a272658 100644
--- a/src/vnet/devices/virtio/vhost_user.c
+++ b/src/vnet/devices/virtio/vhost_user.c
@@ -170,9 +170,9 @@ vhost_user_rx_thread_placement (vhost_user_intf_t * vui, u32 qid)
vnet_hw_interface_set_input_node (vnm, vui->hw_if_index,
vhost_user_input_node.index);
vnet_hw_interface_assign_rx_thread (vnm, vui->hw_if_index, q, ~0);
- if (txvq->mode == VNET_HW_INTERFACE_RX_MODE_UNKNOWN)
+ if (txvq->mode == VNET_HW_IF_RX_MODE_UNKNOWN)
/* Set polling as the default */
- txvq->mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ txvq->mode = VNET_HW_IF_RX_MODE_POLLING;
txvq->qid = q;
rv = vnet_hw_interface_set_rx_mode (vnm, vui->hw_if_index, q, txvq->mode);
if (rv)
@@ -1358,8 +1358,8 @@ vhost_user_delete_if (vnet_main_t * vnm, vlib_main_t * vm, u32 sw_if_index)
if (txvq->qid == -1)
continue;
if ((vum->ifq_count > 0) &&
- ((txvq->mode == VNET_HW_INTERFACE_RX_MODE_INTERRUPT) ||
- (txvq->mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE)))
+ ((txvq->mode == VNET_HW_IF_RX_MODE_INTERRUPT) ||
+ (txvq->mode == VNET_HW_IF_RX_MODE_ADAPTIVE)))
{
vum->ifq_count--;
// Stop the timer if there is no more interrupt interface/queue
@@ -2164,7 +2164,7 @@ show_vhost_user_command_fn (vlib_main_t * vm,
{
vnet_main_t *vnm = vnet_get_main ();
uword thread_index;
- vnet_hw_interface_rx_mode mode;
+ vnet_hw_if_rx_mode mode;
vhost_user_vring_t *txvq = &vui->vrings[qid];
if (txvq->qid == -1)
@@ -2176,7 +2176,7 @@ show_vhost_user_command_fn (vlib_main_t * vm,
&mode);
vlib_cli_output (vm, " thread %d on vring %d, %U\n",
thread_index, qid,
- format_vnet_hw_interface_rx_mode, mode);
+ format_vnet_hw_if_rx_mode, mode);
}
vlib_cli_output (vm, " tx placement: %s\n",
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index ea8e7d6f777..8d0ee4a4803 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -380,7 +380,7 @@ vhost_user_if_input (vlib_main_t * vm,
vhost_user_main_t * vum,
vhost_user_intf_t * vui,
u16 qid, vlib_node_runtime_t * node,
- vnet_hw_interface_rx_mode mode, u8 enable_csum)
+ vnet_hw_if_rx_mode mode, u8 enable_csum)
{
vhost_user_vring_t *txvq = &vui->vrings[VHOST_VRING_IDX_TX (qid)];
vnet_feature_main_t *fm = &feature_main;
@@ -415,7 +415,7 @@ vhost_user_if_input (vlib_main_t * vm,
* When the traffic subsides, the scheduler switches the node back to
* interrupt mode. We must tell the driver we want interrupt.
*/
- if (PREDICT_FALSE (mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE))
+ if (PREDICT_FALSE (mode == VNET_HW_IF_RX_MODE_ADAPTIVE))
{
if ((node->flags &
VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE) ||
@@ -1088,7 +1088,7 @@ static_always_inline u32
vhost_user_if_input_packed (vlib_main_t * vm, vhost_user_main_t * vum,
vhost_user_intf_t * vui, u16 qid,
vlib_node_runtime_t * node,
- vnet_hw_interface_rx_mode mode, u8 enable_csum)
+ vnet_hw_if_rx_mode mode, u8 enable_csum)
{
vhost_user_vring_t *txvq = &vui->vrings[VHOST_VRING_IDX_TX (qid)];
vnet_feature_main_t *fm = &feature_main;
@@ -1130,7 +1130,7 @@ vhost_user_if_input_packed (vlib_main_t * vm, vhost_user_main_t * vum,
* When the traffic subsides, the scheduler switches the node back to
* interrupt mode. We must tell the driver we want interrupt.
*/
- if (PREDICT_FALSE (mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE))
+ if (PREDICT_FALSE (mode == VNET_HW_IF_RX_MODE_ADAPTIVE))
{
if ((node->flags &
VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE) ||
diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c
index 2d17ddfda04..8ac9d0bba2a 100644
--- a/src/vnet/devices/virtio/vhost_user_output.c
+++ b/src/vnet/devices/virtio/vhost_user_output.c
@@ -1059,7 +1059,7 @@ done3:
static __clib_unused clib_error_t *
vhost_user_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index,
- u32 qid, vnet_hw_interface_rx_mode mode)
+ u32 qid, vnet_hw_if_rx_mode mode)
{
vlib_main_t *vm = vnm->vlib_main;
vnet_hw_interface_t *hif = vnet_get_hw_interface (vnm, hw_if_index);
@@ -1068,15 +1068,15 @@ vhost_user_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index,
pool_elt_at_index (vum->vhost_user_interfaces, hif->dev_instance);
vhost_user_vring_t *txvq = &vui->vrings[VHOST_VRING_IDX_TX (qid)];
- if ((mode == VNET_HW_INTERFACE_RX_MODE_INTERRUPT) ||
- (mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE))
+ if ((mode == VNET_HW_IF_RX_MODE_INTERRUPT) ||
+ (mode == VNET_HW_IF_RX_MODE_ADAPTIVE))
{
if (txvq->kickfd_idx == ~0)
{
// We cannot support interrupt mode if the driver opts out
return clib_error_return (0, "Driver does not support interrupt");
}
- if (txvq->mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (txvq->mode == VNET_HW_IF_RX_MODE_POLLING)
{
vum->ifq_count++;
// Start the timer if this is the first encounter on interrupt
@@ -1088,11 +1088,10 @@ vhost_user_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index,
VHOST_USER_EVENT_START_TIMER, 0);
}
}
- else if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ else if (mode == VNET_HW_IF_RX_MODE_POLLING)
{
- if (((txvq->mode == VNET_HW_INTERFACE_RX_MODE_INTERRUPT) ||
- (txvq->mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE)) &&
- vum->ifq_count)
+ if (((txvq->mode == VNET_HW_IF_RX_MODE_INTERRUPT) ||
+ (txvq->mode == VNET_HW_IF_RX_MODE_ADAPTIVE)) && vum->ifq_count)
{
vum->ifq_count--;
// Stop the timer if there is no more interrupt interface/queue
@@ -1105,10 +1104,10 @@ vhost_user_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index,
}
txvq->mode = mode;
- if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (mode == VNET_HW_IF_RX_MODE_POLLING)
txvq->used->flags = VRING_USED_F_NO_NOTIFY;
- else if ((mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE) ||
- (mode == VNET_HW_INTERFACE_RX_MODE_INTERRUPT))
+ else if ((mode == VNET_HW_IF_RX_MODE_ADAPTIVE) ||
+ (mode == VNET_HW_IF_RX_MODE_INTERRUPT))
txvq->used->flags = 0;
else
{