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>
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -139,9 +139,15 @@ typedef CLIB_PACKED (struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vlib_frame_t **frame;
|
||||
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
|
||||
u32 buffers[VLIB_FRAME_SIZE];
|
||||
u32 n_buffers;
|
||||
} bond_per_port_queue_t;
|
||||
|
||||
} bond_if_per_thread_t;
|
||||
typedef struct
|
||||
{
|
||||
bond_per_port_queue_t *per_port_queue;
|
||||
} bond_per_thread_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -175,7 +181,6 @@ typedef struct
|
||||
u8 hw_address[6];
|
||||
|
||||
clib_spinlock_t lockp;
|
||||
bond_if_per_thread_t *per_thread_info;
|
||||
} bond_if_t;
|
||||
|
||||
typedef struct
|
||||
@ -292,7 +297,7 @@ typedef struct
|
||||
/* pool of bonding interfaces */
|
||||
bond_if_t *interfaces;
|
||||
|
||||
/* pool of lacp neighbors */
|
||||
/* pool of slave interfaces */
|
||||
slave_if_t *neighbors;
|
||||
|
||||
/* rapidly find a bond by vlib software interface index */
|
||||
@ -308,6 +313,8 @@ typedef struct
|
||||
lacp_enable_disable_func lacp_enable_disable;
|
||||
|
||||
uword *slave_by_sw_if_index;
|
||||
|
||||
bond_per_thread_data_t *per_thread_data;
|
||||
} bond_main_t;
|
||||
|
||||
/* bond packet trace capture */
|
||||
|
Reference in New Issue
Block a user