diff options
author | Damjan Marion <damarion@cisco.com> | 2022-01-05 01:52:38 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2022-01-05 19:04:07 +0100 |
commit | d4f88cc0967ea1de66396ac07b20cf6e33a3fa1a (patch) | |
tree | 1f316431b414ac3adf693eb876132dd675c73a2a /src/vnet/bonding | |
parent | 7c11bd7a87b901106bb14d40572fddc703b74e5b (diff) |
interface: refactor interface capabilities code
Make it shorter to type, easier to debug, make adding callbacks in
future simpler.
Type: improvement
Change-Id: I6cdd6375e36da23bd452a7c7273ff42789e94433
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/bonding')
-rw-r--r-- | src/vnet/bonding/cli.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c index a24d1104486..2045ff43c53 100644 --- a/src/vnet/bonding/cli.c +++ b/src/vnet/bonding/cli.c @@ -380,7 +380,6 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args) vnet_main_t *vnm = vnet_get_main (); vnet_sw_interface_t *sw; bond_if_t *bif; - vnet_hw_interface_t *hw; if ((args->mode == BOND_MODE_LACP) && bm->lacp_plugin_loaded == 0) { @@ -458,15 +457,15 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args) bif->group = bif->sw_if_index; bif->numa_only = args->numa_only; - hw = vnet_get_hw_interface (vnm, bif->hw_if_index); /* * Add GSO and Checksum offload flags if GSO is enabled on Bond */ if (args->gso) { - 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); + vnet_hw_if_set_caps (vnm, bif->hw_if_index, + VNET_HW_IF_CAP_TCP_GSO | + VNET_HW_IF_CAP_TX_TCP_CKSUM | + VNET_HW_IF_CAP_TX_UDP_CKSUM); } if (vlib_get_thread_main ()->n_vlib_mains > 1) clib_spinlock_init (&bif->lockp); @@ -632,7 +631,7 @@ bond_add_member (vlib_main_t * vm, bond_add_member_args_t * args) clib_error_return (0, "bond interface cannot be added as member"); return; } - if (bif->gso && !(mif_hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO)) + if (bif->gso && !(mif_hw->caps & VNET_HW_IF_CAP_TCP_GSO)) { args->rv = VNET_API_ERROR_INVALID_INTERFACE; args->error = |