virtio: fix the gro enable/disable on tx-vrings
Type: fix Change-Id: I96c30baaf34fe7b0cd899966a507501e58cde934 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 1017a1d360cc1c38e2aee4b5f19ff1f2869a8cd9)
This commit is contained in:

committed by
Andrew Yourtchenko

parent
c6f50a3e3e
commit
36e657032c
@ -142,7 +142,7 @@ VLIB_CLI_COMMAND (tap_create_command, static) = {
|
||||
"[host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6-addr>] "
|
||||
"[host-ip4-gw <ip4-addr>] [host-ip6-gw <ip6-addr>] "
|
||||
"[host-mac-addr <host-mac-address>] [host-if-name <name>] "
|
||||
"[host-mtu-size <size>] [no-gso|gso|csum-offload|gro-coalesce] "
|
||||
"[host-mtu-size <size>] [no-gso|gso [gro-coalesce]|csum-offload] "
|
||||
"[persist] [attach] [tun] [packed] [in-order]",
|
||||
.function = tap_create_command_fn,
|
||||
};
|
||||
|
@ -731,7 +731,6 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
|
||||
if ((args->tap_flags & TAP_FLAG_GSO)
|
||||
&& (args->tap_flags & TAP_FLAG_GRO_COALESCE))
|
||||
{
|
||||
vif->packet_coalesce = 1;
|
||||
virtio_set_packet_coalesce (vif);
|
||||
}
|
||||
vnet_hw_interface_set_input_node (vnm, vif->hw_if_index,
|
||||
@ -900,7 +899,6 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable,
|
||||
}
|
||||
if (is_packet_coalesce)
|
||||
{
|
||||
vif->packet_coalesce = 1;
|
||||
virtio_set_packet_coalesce (vif);
|
||||
}
|
||||
}
|
||||
|
@ -719,24 +719,38 @@ virtio_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
|
||||
virtio_main_t *mm = &virtio_main;
|
||||
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
|
||||
virtio_if_t *vif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
|
||||
virtio_vring_t *vring = vec_elt_at_index (vif->rxq_vrings, qid);
|
||||
virtio_vring_t *rx_vring = vec_elt_at_index (vif->rxq_vrings, qid);
|
||||
virtio_vring_t *tx_vring = 0;
|
||||
|
||||
if (vif->type == VIRTIO_IF_TYPE_PCI && !(vif->support_int_mode))
|
||||
{
|
||||
vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
|
||||
rx_vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
|
||||
return clib_error_return (0, "interrupt mode is not supported");
|
||||
}
|
||||
|
||||
if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
|
||||
{
|
||||
/* only enable packet coalesce in poll mode */
|
||||
gro_flow_table_set_is_enable (vring->flow_table, 1);
|
||||
vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
|
||||
vec_foreach (tx_vring, vif->txq_vrings)
|
||||
{
|
||||
/* only enable packet coalesce in poll mode */
|
||||
gro_flow_table_set_is_enable (tx_vring->flow_table, 1);
|
||||
}
|
||||
rx_vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
|
||||
}
|
||||
else
|
||||
{
|
||||
gro_flow_table_set_is_enable (vring->flow_table, 0);
|
||||
vring->avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
|
||||
if (vif->packet_coalesce)
|
||||
{
|
||||
virtio_log_warning (vif,
|
||||
"interface %U is in interrupt mode, disabling packet coalescing",
|
||||
format_vnet_sw_if_index_name, vnet_get_main (),
|
||||
vif->sw_if_index);
|
||||
vec_foreach (tx_vring, vif->txq_vrings)
|
||||
{
|
||||
gro_flow_table_set_is_enable (tx_vring->flow_table, 0);
|
||||
}
|
||||
}
|
||||
rx_vring->avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -226,6 +226,7 @@ virtio_set_packet_coalesce (virtio_if_t * vif)
|
||||
vnet_main_t *vnm = vnet_get_main ();
|
||||
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
|
||||
virtio_vring_t *vring;
|
||||
vif->packet_coalesce = 1;
|
||||
vec_foreach (vring, vif->txq_vrings)
|
||||
{
|
||||
gro_flow_table_init (&vring->flow_table,
|
||||
|
@ -164,16 +164,7 @@ static_always_inline void
|
||||
gro_flow_table_set_is_enable (gro_flow_table_t * flow_table, u8 is_enable)
|
||||
{
|
||||
if (flow_table)
|
||||
{
|
||||
if (is_enable)
|
||||
{
|
||||
flow_table->is_enable = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flow_table->is_enable = 0;
|
||||
}
|
||||
}
|
||||
flow_table->is_enable = is_enable;
|
||||
}
|
||||
|
||||
static_always_inline void
|
||||
@ -264,12 +255,24 @@ static_always_inline u8 *
|
||||
gro_flow_table_format (u8 * s, va_list * args)
|
||||
{
|
||||
gro_flow_table_t *flow_table = va_arg (*args, gro_flow_table_t *);
|
||||
u32 indent;
|
||||
|
||||
if (!flow_table)
|
||||
return s;
|
||||
|
||||
indent = format_get_indent (s);
|
||||
if (flow_table->is_enable)
|
||||
s = format (s, "packet-coalesce: enable\n");
|
||||
else
|
||||
s = format (s, "packet-coalesce: disable\n");
|
||||
|
||||
indent += 2;
|
||||
|
||||
s =
|
||||
format (s,
|
||||
"flow-table: size %u gro-total-vectors %lu gro-n-vectors %u",
|
||||
flow_table->flow_table_size, flow_table->total_vectors,
|
||||
flow_table->n_vectors);
|
||||
"%Uflow-table: size %u gro-total-vectors %lu gro-n-vectors %u",
|
||||
format_white_space, indent, flow_table->flow_table_size,
|
||||
flow_table->total_vectors, flow_table->n_vectors);
|
||||
if (flow_table->n_vectors)
|
||||
{
|
||||
double average_rate =
|
||||
|
Reference in New Issue
Block a user