aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/bonding/cli.c
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2018-09-27 20:06:26 -0700
committerDamjan Marion <dmarion@me.com>2018-09-28 19:39:50 +0000
commitc4e99c5d6f19cf7c026b021266e309f29de1ac7f (patch)
tree760eb9f8c6cd365521edac14b731635063562ad5 /src/vnet/bonding/cli.c
parent9be93c8f85d752930566a1d37e9f4841ca78861f (diff)
bond: tx performance enhancement part deux
- Reduce per packet cost by buffering the output packet buffer indexes in the queue and process the queue outside the packet processing loop. - Move unnecessary variable initialization outside of the while loop. - There is no need to save the old interface if tracing is not enabled. Test result for 256 bytes packet comparison. Other packet size shows similar improvement. With the patch -------------- BondEthernet0-output active 52836 13526016 0 1.71e1 256.00 BondEthernet0-tx active 52836 13526016 0 2.68e1 256.00 TenGigabitEthernet6/0/0-output active 52836 6762896 0 9.17e0 127.99 TenGigabitEthernet6/0/0-tx active 52836 6762896 0 6.97e1 127.99 TenGigabitEthernet6/0/1-output active 52836 6763120 0 9.40e0 128.00 TenGigabitEthernet6/0/1-tx active 52836 6763120 0 7.00e1 128.00 bond-input active 52836 13526016 0 1.76e1 256.00 Without the patch ----------------- BondEthernet0-output active 60858 15579648 0 1.73e1 256.00 BondEthernet0-tx active 60858 15579648 0 2.94e1 256.00 TenGigabitEthernet6/0/0-output active 60858 7789626 0 9.29e0 127.99 TenGigabitEthernet6/0/0-tx active 60858 7789626 0 7.01e1 127.99 TenGigabitEthernet6/0/1-output active 60858 7790022 0 9.31e0 128.00 TenGigabitEthernet6/0/1-tx active 60858 7790022 0 7.10e1 128.00 bond-input active 60858 15579648 0 1.77e1 256.00 Change-Id: Ib6d73a63ceeaa2f1397ceaf4c5391c57fd865b04 Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/vnet/bonding/cli.c')
-rw-r--r--src/vnet/bonding/cli.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index ec34b47351e..522d13aadf7 100644
--- a/src/vnet/bonding/cli.c
+++ b/src/vnet/bonding/cli.c
@@ -198,7 +198,6 @@ bond_delete_if (vlib_main_t * vm, u32 sw_if_index)
slave_if_t *sif;
vnet_hw_interface_t *hw;
u32 *sif_sw_if_index;
- u32 thread_index;
u32 **s_list = 0;
u32 i;
@@ -232,12 +231,6 @@ bond_delete_if (vlib_main_t * vm, u32 sw_if_index)
clib_bitmap_free (bif->port_number_bitmap);
hash_unset (bm->bond_by_sw_if_index, bif->sw_if_index);
- for (thread_index = 0; thread_index < vlib_get_thread_main ()->n_vlib_mains;
- thread_index++)
- {
- vec_free (bif->per_thread_info[thread_index].frame);
- }
- vec_free (bif->per_thread_info);
memset (bif, 0, sizeof (*bif));
pool_put (bm->interfaces, bif);
@@ -310,9 +303,6 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args)
sw = vnet_get_hw_sw_interface (vnm, bif->hw_if_index);
bif->sw_if_index = sw->sw_if_index;
bif->group = bif->sw_if_index;
- vec_validate_aligned (bif->per_thread_info,
- vlib_get_thread_main ()->n_vlib_mains - 1,
- CLIB_CACHE_LINE_BYTES);
if (vlib_get_thread_main ()->n_vlib_mains > 1)
clib_spinlock_init (&bif->lockp);
@@ -431,6 +421,8 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
vnet_interface_main_t *im = &vnm->interface_main;
vnet_hw_interface_t *bif_hw, *sif_hw;
vnet_sw_interface_t *sw;
+ u32 thread_index;
+ u32 sif_if_index;
bif = bond_get_master_by_sw_if_index (args->group);
if (!bif)
@@ -527,6 +519,20 @@ bond_enslave (vlib_main_t * vm, bond_enslave_args_t * args)
bond_enable_collecting_distributing (vm, sif);
}
+ vec_foreach_index (thread_index, bm->per_thread_data)
+ {
+ bond_per_thread_data_t *ptd = vec_elt_at_index (bm->per_thread_data,
+ thread_index);
+
+ vec_validate_aligned (ptd->per_port_queue, sif->sw_if_index,
+ CLIB_CACHE_LINE_BYTES);
+
+ vec_foreach_index (sif_if_index, ptd->per_port_queue)
+ {
+ ptd->per_port_queue[sif_if_index].n_buffers = 0;
+ }
+ }
+
args->rv = vnet_feature_enable_disable ("device-input", "bond-input",
sif_hw->hw_if_index, 1, 0, 0);
@@ -755,6 +761,9 @@ bond_cli_init (vlib_main_t * vm)
bm->vlib_main = vm;
bm->vnet_main = vnet_get_main ();
vec_validate_aligned (bm->slave_by_sw_if_index, 1, CLIB_CACHE_LINE_BYTES);
+ vec_validate_aligned (bm->per_thread_data,
+ vlib_get_thread_main ()->n_vlib_mains - 1,
+ CLIB_CACHE_LINE_BYTES);
return 0;
}