summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-10-07 20:59:07 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-10-08 10:21:54 +0000
commiteabd4249826259d2221ed339ea4bbe9e7bf7560e (patch)
tree222f7f5bce0f994f3da63bf8622667816e1b4497
parent9c9490cee8aba658ad2fef06305461cbaaaec1a1 (diff)
interface: shorten vnet_hw_if_rx_mode
This is part of bigger refactor. Type: refactor Change-Id: I6fc2c0a1e2d217a70952901bcf775b8485bd3c20 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/avf/device.c4
-rw-r--r--src/plugins/marvell/pp2/pp2.c2
-rw-r--r--src/plugins/memif/device.c4
-rw-r--r--src/plugins/memif/memif.c6
-rw-r--r--src/plugins/vmxnet3/vmxnet3.c4
-rw-r--r--src/vat/api_format.c10
-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
-rw-r--r--src/vnet/interface.c2
-rw-r--r--src/vnet/interface.h20
-rw-r--r--src/vnet/interface_api.c7
-rw-r--r--src/vnet/interface_cli.c22
-rw-r--r--src/vnet/interface_format.c10
-rw-r--r--src/vnet/interface_funcs.h5
21 files changed, 88 insertions, 93 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 32df1dfcb79..eab8106c4a8 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -1654,13 +1654,13 @@ avf_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
static clib_error_t *
avf_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)
{
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
avf_device_t *ad = avf_get_device (hw->dev_instance);
avf_rxq_t *rxq = vec_elt_at_index (ad->rxqs, qid);
- if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (mode == VNET_HW_IF_RX_MODE_POLLING)
{
if (rxq->int_mode == 0)
return 0;
diff --git a/src/plugins/marvell/pp2/pp2.c b/src/plugins/marvell/pp2/pp2.c
index 36b191a178b..fdd0e85035d 100644
--- a/src/plugins/marvell/pp2/pp2.c
+++ b/src/plugins/marvell/pp2/pp2.c
@@ -305,7 +305,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
mrvl_pp2_input_node.index);
vnet_hw_interface_assign_rx_thread (vnm, ppif->hw_if_index, 0, ~0);
vnet_hw_interface_set_rx_mode (vnm, ppif->hw_if_index, 0,
- VNET_HW_INTERFACE_RX_MODE_POLLING);
+ VNET_HW_IF_RX_MODE_POLLING);
vnet_hw_interface_set_flags (vnm, ppif->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
goto done;
diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c
index 28bf8259311..aa79f884eef 100644
--- a/src/plugins/memif/device.c
+++ b/src/plugins/memif/device.c
@@ -459,14 +459,14 @@ memif_clear_hw_interface_counters (u32 instance)
static clib_error_t *
memif_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)
{
memif_main_t *mm = &memif_main;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
memif_if_t *mif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
memif_queue_t *mq = vec_elt_at_index (mif->rx_queues, qid);
- if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (mode == VNET_HW_IF_RX_MODE_POLLING)
mq->ring->flags |= MEMIF_RING_FLAG_MASK_INT;
else
mq->ring->flags &= ~MEMIF_RING_FLAG_MASK_INT;
diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c
index c1bab0ba15f..3a2ed36c2dc 100644
--- a/src/plugins/memif/memif.c
+++ b/src/plugins/memif/memif.c
@@ -296,17 +296,17 @@ memif_connect (memif_if_t * mif)
mq->buffer_pool_index =
vlib_buffer_pool_get_default_for_numa (vm, vlib_mains[ti]->numa_node);
rv = vnet_hw_interface_set_rx_mode (vnm, mif->hw_if_index, i,
- VNET_HW_INTERFACE_RX_MODE_DEFAULT);
+ VNET_HW_IF_RX_MODE_DEFAULT);
if (rv)
memif_log_err
(mif, "Warning: unable to set rx mode for interface %d queue %d: "
"rc=%d", mif->hw_if_index, i, rv);
else
{
- vnet_hw_interface_rx_mode rxmode;
+ vnet_hw_if_rx_mode rxmode;
vnet_hw_interface_get_rx_mode (vnm, mif->hw_if_index, i, &rxmode);
- if (rxmode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (rxmode == VNET_HW_IF_RX_MODE_POLLING)
mq->ring->flags |= MEMIF_RING_FLAG_MASK_INT;
else
vnet_device_input_set_interrupt_pending (vnm, mif->hw_if_index, i);
diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c
index 9209c3e2f90..ec0ab2b6863 100644
--- a/src/plugins/vmxnet3/vmxnet3.c
+++ b/src/plugins/vmxnet3/vmxnet3.c
@@ -62,14 +62,14 @@ vmxnet3_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index,
static clib_error_t *
vmxnet3_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)
{
vmxnet3_main_t *vmxm = &vmxnet3_main;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
vmxnet3_device_t *vd = pool_elt_at_index (vmxm->devices, hw->dev_instance);
vmxnet3_rxq_t *rxq = vec_elt_at_index (vd->rxqs, qid);
- if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (mode == VNET_HW_IF_RX_MODE_POLLING)
rxq->int_mode = 0;
else
rxq->int_mode = 1;
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 1c226517a66..4dd3f054ff3 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -3987,7 +3987,7 @@ api_sw_interface_set_rx_mode (vat_main_t * vam)
int ret;
u8 queue_id_valid = 0;
u32 queue_id;
- vnet_hw_interface_rx_mode mode = VNET_HW_INTERFACE_RX_MODE_UNKNOWN;
+ vnet_hw_if_rx_mode mode = VNET_HW_IF_RX_MODE_UNKNOWN;
/* Parse args required to build the message */
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -3995,11 +3995,11 @@ api_sw_interface_set_rx_mode (vat_main_t * vam)
if (unformat (i, "queue %d", &queue_id))
queue_id_valid = 1;
else if (unformat (i, "polling"))
- mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ mode = VNET_HW_IF_RX_MODE_POLLING;
else if (unformat (i, "interrupt"))
- mode = VNET_HW_INTERFACE_RX_MODE_INTERRUPT;
+ mode = VNET_HW_IF_RX_MODE_INTERRUPT;
else if (unformat (i, "adaptive"))
- mode = VNET_HW_INTERFACE_RX_MODE_ADAPTIVE;
+ mode = VNET_HW_IF_RX_MODE_ADAPTIVE;
else
if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
sw_if_index_set = 1;
@@ -4014,7 +4014,7 @@ api_sw_interface_set_rx_mode (vat_main_t * vam)
errmsg ("missing interface name or sw_if_index");
return -99;
}
- if (mode == VNET_HW_INTERFACE_RX_MODE_UNKNOWN)
+ if (mode == VNET_HW_IF_RX_MODE_UNKNOWN)
{
errmsg ("missing rx-mode");
return -99;
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
{
diff --git a/src/vnet/interface.c b/src/vnet/interface.c
index ad8bde3457a..8ca9c1a2f1f 100644
--- a/src/vnet/interface.c
+++ b/src/vnet/interface.c
@@ -775,7 +775,7 @@ vnet_register_interface (vnet_main_t * vnm,
hw_index = hw - im->hw_interfaces;
hw->hw_if_index = hw_index;
- hw->default_rx_mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ hw->default_rx_mode = VNET_HW_IF_RX_MODE_POLLING;
if (dev_class->format_device_name)
hw->name = format (0, "%U", dev_class->format_device_name, dev_instance);
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index 895ce2e9279..5c04c5dc3bb 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -52,13 +52,13 @@ union ip46_address_t_;
typedef enum
{
- VNET_HW_INTERFACE_RX_MODE_UNKNOWN,
- VNET_HW_INTERFACE_RX_MODE_POLLING,
- VNET_HW_INTERFACE_RX_MODE_INTERRUPT,
- VNET_HW_INTERFACE_RX_MODE_ADAPTIVE,
- VNET_HW_INTERFACE_RX_MODE_DEFAULT,
- VNET_HW_INTERFACE_NUM_RX_MODES,
-} vnet_hw_interface_rx_mode;
+ VNET_HW_IF_RX_MODE_UNKNOWN,
+ VNET_HW_IF_RX_MODE_POLLING,
+ VNET_HW_IF_RX_MODE_INTERRUPT,
+ VNET_HW_IF_RX_MODE_ADAPTIVE,
+ VNET_HW_IF_RX_MODE_DEFAULT,
+ VNET_HW_IF_NUM_RX_MODES,
+} vnet_hw_if_rx_mode;
/* Interface up/down callback. */
typedef clib_error_t *(vnet_interface_function_t)
@@ -81,7 +81,7 @@ typedef clib_error_t *(vnet_interface_add_del_mac_address_function_t)
/* Interface set rx mode callback. */
typedef clib_error_t *(vnet_interface_set_rx_mode_function_t)
(struct vnet_main_t * vnm, u32 if_index, u32 queue_id,
- vnet_hw_interface_rx_mode mode);
+ vnet_hw_if_rx_mode mode);
/* Interface set l2 mode callback. */
typedef clib_error_t *(vnet_interface_set_l2_mode_function_t)
@@ -600,9 +600,9 @@ typedef struct vnet_hw_interface_t
/* input node cpu index by queue */
u32 *input_node_thread_index_by_queue;
- /* vnet_hw_interface_rx_mode by queue */
+ /* vnet_hw_if_rx_mode by queue */
u8 *rx_mode_by_queue;
- vnet_hw_interface_rx_mode default_rx_mode;
+ vnet_hw_if_rx_mode default_rx_mode;
/* device input device_and_queue runtime index */
uword *dq_runtime_index_by_queue;
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index f8056c28bfe..51555cabc6b 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -1006,7 +1006,7 @@ static void vl_api_sw_interface_set_rx_mode_t_handler
vnet_sw_interface_t *si;
clib_error_t *error;
int rv = 0;
- vnet_hw_interface_rx_mode rx_mode;
+ vnet_hw_if_rx_mode rx_mode;
VALIDATE_SW_IF_INDEX (mp);
@@ -1017,12 +1017,11 @@ static void vl_api_sw_interface_set_rx_mode_t_handler
goto bad_sw_if_index;
}
- rx_mode = (vnet_hw_interface_rx_mode) ntohl (mp->mode);
+ rx_mode = (vnet_hw_if_rx_mode) ntohl (mp->mode);
error = set_hw_interface_change_rx_mode (vnm, si->hw_if_index,
mp->queue_id_valid,
ntohl (mp->queue_id),
- (vnet_hw_interface_rx_mode)
- rx_mode);
+ (vnet_hw_if_rx_mode) rx_mode);
if (error)
{
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index 55433fe8314..b720f44ca71 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -1477,16 +1477,16 @@ VLIB_CLI_COMMAND (set_ip_directed_broadcast_command, static) = {
static clib_error_t *
set_hw_interface_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
- u32 queue_id, vnet_hw_interface_rx_mode mode)
+ u32 queue_id, vnet_hw_if_rx_mode mode)
{
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
vnet_device_class_t *dev_class =
vnet_get_device_class (vnm, hw->dev_class_index);
clib_error_t *error;
- vnet_hw_interface_rx_mode old_mode;
+ vnet_hw_if_rx_mode old_mode;
int rv;
- if (mode == VNET_HW_INTERFACE_RX_MODE_DEFAULT)
+ if (mode == VNET_HW_IF_RX_MODE_DEFAULT)
mode = hw->default_rx_mode;
rv = vnet_hw_interface_get_rx_mode (vnm, hw_if_index, queue_id, &old_mode);
@@ -1533,7 +1533,7 @@ set_hw_interface_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
clib_error_t *
set_hw_interface_change_rx_mode (vnet_main_t * vnm, u32 hw_if_index,
u8 queue_id_valid, u32 queue_id,
- vnet_hw_interface_rx_mode mode)
+ vnet_hw_if_rx_mode mode)
{
clib_error_t *error = 0;
vnet_hw_interface_t *hw;
@@ -1566,7 +1566,7 @@ set_interface_rx_mode (vlib_main_t * vm, unformat_input_t * input,
vnet_main_t *vnm = vnet_get_main ();
u32 hw_if_index = (u32) ~ 0;
u32 queue_id = (u32) ~ 0;
- vnet_hw_interface_rx_mode mode = VNET_HW_INTERFACE_RX_MODE_UNKNOWN;
+ vnet_hw_if_rx_mode mode = VNET_HW_IF_RX_MODE_UNKNOWN;
u8 queue_id_valid = 0;
if (!unformat_user (input, unformat_line_input, line_input))
@@ -1580,11 +1580,11 @@ set_interface_rx_mode (vlib_main_t * vm, unformat_input_t * input,
else if (unformat (line_input, "queue %d", &queue_id))
queue_id_valid = 1;
else if (unformat (line_input, "polling"))
- mode = VNET_HW_INTERFACE_RX_MODE_POLLING;
+ mode = VNET_HW_IF_RX_MODE_POLLING;
else if (unformat (line_input, "interrupt"))
- mode = VNET_HW_INTERFACE_RX_MODE_INTERRUPT;
+ mode = VNET_HW_IF_RX_MODE_INTERRUPT;
else if (unformat (line_input, "adaptive"))
- mode = VNET_HW_INTERFACE_RX_MODE_ADAPTIVE;
+ mode = VNET_HW_IF_RX_MODE_ADAPTIVE;
else
{
error = clib_error_return (0, "parse error: '%U'",
@@ -1599,7 +1599,7 @@ set_interface_rx_mode (vlib_main_t * vm, unformat_input_t * input,
if (hw_if_index == (u32) ~ 0)
return clib_error_return (0, "please specify valid interface name");
- if (mode == VNET_HW_INTERFACE_RX_MODE_UNKNOWN)
+ if (mode == VNET_HW_IF_RX_MODE_UNKNOWN)
return clib_error_return (0, "please specify valid rx-mode");
error = set_hw_interface_change_rx_mode (vnm, hw_if_index, queue_id_valid,
@@ -1677,7 +1677,7 @@ show_interface_rx_placement_fn (vlib_main_t * vm, unformat_input_t * input,
s = format (s, " %U queue %u (%U)\n",
format_vnet_sw_if_index_name, vnm, hi->sw_if_index,
dq->queue_id,
- format_vnet_hw_interface_rx_mode, dq->mode);
+ format_vnet_hw_if_rx_mode, dq->mode);
}
}));
if (vec_len (s) > 0)
@@ -1734,7 +1734,7 @@ set_hw_interface_rx_placement (u32 hw_if_index, u32 queue_id,
vnet_main_t *vnm = vnet_get_main ();
vnet_device_main_t *vdm = &vnet_device_main;
clib_error_t *error = 0;
- vnet_hw_interface_rx_mode mode = VNET_HW_INTERFACE_RX_MODE_UNKNOWN;
+ vnet_hw_if_rx_mode mode = VNET_HW_IF_RX_MODE_UNKNOWN;
int rv;
if (is_main)
diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c
index 5f995b8a34f..a2adc9bbb02 100644
--- a/src/vnet/interface_format.c
+++ b/src/vnet/interface_format.c
@@ -97,17 +97,17 @@ format_vnet_sw_interface_flags (u8 * s, va_list * args)
}
u8 *
-format_vnet_hw_interface_rx_mode (u8 * s, va_list * args)
+format_vnet_hw_if_rx_mode (u8 * s, va_list * args)
{
- vnet_hw_interface_rx_mode mode = va_arg (*args, vnet_hw_interface_rx_mode);
+ vnet_hw_if_rx_mode mode = va_arg (*args, vnet_hw_if_rx_mode);
- if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+ if (mode == VNET_HW_IF_RX_MODE_POLLING)
return format (s, "polling");
- if (mode == VNET_HW_INTERFACE_RX_MODE_INTERRUPT)
+ if (mode == VNET_HW_IF_RX_MODE_INTERRUPT)
return format (s, "interrupt");
- if (mode == VNET_HW_INTERFACE_RX_MODE_ADAPTIVE)
+ if (mode == VNET_HW_IF_RX_MODE_ADAPTIVE)
return format (s, "adaptive");
return format (s, "unknown");
diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h
index 8f589d1d6dd..120d92cb11d 100644
--- a/src/vnet/interface_funcs.h
+++ b/src/vnet/interface_funcs.h
@@ -407,8 +407,7 @@ clib_error_t *set_hw_interface_change_rx_mode (vnet_main_t * vnm,
u32 hw_if_index,
u8 queue_id_valid,
u32 queue_id,
- vnet_hw_interface_rx_mode
- mode);
+ vnet_hw_if_rx_mode mode);
/* Set rx-placement on the interface */
clib_error_t *set_hw_interface_rx_placement (u32 hw_if_index, u32 queue_id,
@@ -438,7 +437,7 @@ clib_error_t *vnet_hw_interface_set_rss_queues (vnet_main_t * vnm,
/* Formats sw/hw interface. */
format_function_t format_vnet_hw_interface;
-format_function_t format_vnet_hw_interface_rx_mode;
+format_function_t format_vnet_hw_if_rx_mode;
format_function_t format_vnet_hw_if_index_name;
format_function_t format_vnet_sw_interface;
format_function_t format_vnet_sw_interface_name;