diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-08-11 15:00:44 +0200 |
---|---|---|
committer | BenoƮt Ganne <bganne@cisco.com> | 2020-08-14 09:38:58 +0000 |
commit | f382b06febf2b26c37fd384824a1915e16517a2b (patch) | |
tree | 0d53d28cbc1b089b45d3add515bea6a298512665 /src/vnet/pg/stream.c | |
parent | c3ed1c99134d063dff03c4babe0ebbf5cc0e8ab2 (diff) |
gso: packet coalesce library
Type: feature
Change-Id: Ia19d3611e596d9ec47509889b34e8fe793a0ccc3
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/pg/stream.c')
-rw-r--r-- | src/vnet/pg/stream.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c index f09e9a44398..88c89371c6c 100644 --- a/src/vnet/pg/stream.c +++ b/src/vnet/pg/stream.c @@ -178,9 +178,26 @@ pg_eth_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags) return 0; } +void +pg_interface_enable_disable_coalesce (pg_interface_t * pi, u8 enable, + u32 tx_node_index) +{ + if (enable) + { + gro_flow_table_init (&pi->flow_table, 1 /* is_l2 */ , + tx_node_index); + pi->coalesce_enabled = 1; + } + else + { + pi->coalesce_enabled = 0; + gro_flow_table_free (pi->flow_table); + } +} + u32 pg_interface_add_or_get (pg_main_t * pg, uword if_id, u8 gso_enabled, - u32 gso_size) + u32 gso_size, u8 coalesce_enabled) { vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); @@ -219,6 +236,10 @@ pg_interface_add_or_get (pg_main_t * pg, uword if_id, u8 gso_enabled, hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; pi->gso_enabled = 1; pi->gso_size = gso_size; + if (coalesce_enabled) + { + pg_interface_enable_disable_coalesce (pi, 1, hi->tx_node_index); + } } pi->sw_if_index = hi->sw_if_index; @@ -454,7 +475,7 @@ pg_stream_add (pg_main_t * pg, pg_stream_t * s_init) /* Find an interface to use. */ s->pg_if_index = pg_interface_add_or_get (pg, s->if_id, 0 /* gso_enabled */ , - 0 /* gso_size */ ); + 0 /* gso_size */ , 0 /* coalesce_enabled */ ); if (s->sw_if_index[VLIB_RX] == ~0) { |