diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2021-02-10 12:03:53 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-03-19 14:30:50 +0000 |
commit | 5b3f523918932793254b6313f78659fe0ed6320e (patch) | |
tree | 26241978a6669b4a466e09d598cc0e83cb00825c /src/vnet/devices/tap | |
parent | 34c54dff5c66f9a4aef77daf08219301e15cc1fa (diff) |
interface: add capabilities flags
Type: improvement
This patch adds flags to represent the modern NICs capabilities.
Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/tap')
-rw-r--r-- | src/vnet/devices/tap/tap.c | 38 |
1 files changed, 16 insertions, 22 deletions
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; } |