summaryrefslogtreecommitdiffstats
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.c13
-rw-r--r--src/vnet/devices/tap/tap.c38
-rw-r--r--src/vnet/devices/virtio/device.c4
-rw-r--r--src/vnet/devices/virtio/pci.c17
-rw-r--r--src/vnet/devices/virtio/vhost_user.c16
5 files changed, 46 insertions, 42 deletions
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 2cc0cc70bca..60a3ccc081f 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -404,7 +404,7 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set,
apif->queue_index = vnet_hw_if_register_rx_queue (vnm, apif->hw_if_index, 0,
VNET_HW_IF_RXQ_THREAD_ANY);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
vnet_hw_interface_set_flags (vnm, apif->hw_if_index,
VNET_HW_INTERFACE_FLAG_LINK_UP);
@@ -515,10 +515,15 @@ af_packet_set_l4_cksum_offload (vlib_main_t * vm, u32 sw_if_index, u8 set)
return VNET_API_ERROR_INVALID_INTERFACE;
if (set)
- hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ {
+ hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+ }
else
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
-
+ {
+ hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+ }
return 0;
}
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 7e7d3d5e8c0..5b15f92051d 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -724,15 +724,17 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
args->sw_if_index = vif->sw_if_index;
args->rv = 0;
hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
if (args->tap_flags & TAP_FLAG_GSO)
{
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
}
else if (args->tap_flags & TAP_FLAG_CSUM_OFFLOAD)
{
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
}
if ((args->tap_flags & TAP_FLAG_GSO)
&& (args->tap_flags & TAP_FLAG_GRO_COALESCE))
@@ -834,26 +836,18 @@ tap_csum_offload_enable_disable (vlib_main_t * vm, u32 sw_if_index,
vif->packet_coalesce = 0;
vif->csum_offload_enabled = enable_disable ? 1 : 0;
- if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0)
+ if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) != 0)
{
- hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
+ hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO;
}
if (enable_disable)
{
- if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) ==
- 0)
- {
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
- }
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM;
}
else
{
- if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) !=
- 0)
- {
- hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
- }
+ hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM;
}
error:
@@ -893,10 +887,10 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable,
vif->csum_offload_enabled = 0;
if (enable_disable)
{
- if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0)
+ if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == 0)
{
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM;
}
if (is_packet_coalesce)
{
@@ -905,10 +899,10 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable,
}
else
{
- if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0)
+ if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) != 0)
{
- hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+ hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM);
}
vif->packet_coalesce = 0;
}
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index fb996d551fa..e71e16caecc 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -965,12 +965,12 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
vnet_main_t *vnm = vnet_get_main ();
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
- if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO)
+ if (hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO)
return virtio_interface_tx_gso_inline (vm, node, vif, type, vring,
buffers, n_left, packed,
1 /* do_gso */ ,
1 /* checksum offload */ );
- else if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD)
+ else if (hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM)
return virtio_interface_tx_gso_inline (vm, node, vif, type, vring,
buffers, n_left, packed,
0 /* no do_gso */ ,
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 79bd0047570..7ef4b2a52dd 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -525,8 +525,9 @@ virtio_pci_offloads (vlib_main_t * vm, virtio_if_t * vif, int gso_enabled,
{
vif->gso_enabled = 1;
vif->csum_offload_enabled = 0;
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
}
}
else if (csum_offload_enabled
@@ -540,9 +541,9 @@ virtio_pci_offloads (vlib_main_t * vm, virtio_if_t * vif, int gso_enabled,
{
vif->csum_offload_enabled = 1;
vif->gso_enabled = 0;
- hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
- hw->flags |=
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+ hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
}
}
else
@@ -555,8 +556,8 @@ virtio_pci_offloads (vlib_main_t * vm, virtio_if_t * vif, int gso_enabled,
{
vif->csum_offload_enabled = 0;
vif->gso_enabled = 0;
- hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+ hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO);
}
}
}
@@ -1500,7 +1501,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
args->sw_if_index = sw->sw_if_index;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
if (args->virtio_flags & VIRTIO_FLAG_BUFFERING)
{
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c
index 426f03c6ab1..5f04db09395 100644
--- a/src/vnet/devices/virtio/vhost_user.c
+++ b/src/vnet/devices/virtio/vhost_user.c
@@ -515,12 +515,16 @@ vhost_user_socket_read (clib_file_t * uf)
if (vui->enable_gso &&
((vui->features & FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS)
== FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS))
- hw->flags |=
- (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+ {
+ hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+ }
else
- hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
- VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+ {
+ hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+ VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM);
+ }
vnet_hw_interface_set_flags (vnm, vui->hw_if_index, 0);
vui->is_ready = 0;
vhost_user_update_iface_state (vui);
@@ -1619,7 +1623,7 @@ vhost_user_vui_init (vnet_main_t * vnm, vhost_user_intf_t * vui,
for (q = 0; q < vec_len (vui->vrings); q++)
vhost_user_vring_init (vui, q);
- hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+ hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
vnet_hw_interface_set_flags (vnm, vui->hw_if_index, 0);
if (sw_if_index)