summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio
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 /src/vnet/devices/virtio
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>
Diffstat (limited to 'src/vnet/devices/virtio')
-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
5 files changed, 23 insertions, 24 deletions
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
{