summaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/stream.c
diff options
context:
space:
mode:
authorKingwel Xie <kingwel.xie@ericsson.com>2019-01-19 22:49:26 -0500
committerDamjan Marion <dmarion@me.com>2019-01-23 17:53:30 +0000
commit4222347a87994cc109499ebe67498792c0e705f8 (patch)
tree85ddef2733b28452d2120a5b91eef66278e47b6c /src/vnet/pg/stream.c
parent72de626da7578a3c19e22b44e5d7f266b5798526 (diff)
pg: cli improvement
1. show packet-generator verbose, display all edit-groups and hdr-size 2. unformat_pg_payload, always mark payload hdr-size as 0 3. packet-generator now can change rate/limit/size at runtime 4. validate_stream checks buffer min-size/max-size against all edit groups' header size 5. remove incorrect max packet size limit check in validate_stream(...) Change-Id: Ic45e4f2b98bc0fd7330e0b480dd677fa3c69a677 Signed-off-by: Kingwel Xie <kingwel.xie@ericsson.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vnet/pg/stream.c')
-rw-r--r--src/vnet/pg/stream.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c
index ddd15d66406..c91cacafe57 100644
--- a/src/vnet/pg/stream.c
+++ b/src/vnet/pg/stream.c
@@ -483,6 +483,31 @@ pg_stream_del (pg_main_t * pg, uword index)
pool_put (pg->streams, s);
}
+void
+pg_stream_change (pg_main_t * pg, pg_stream_t * s)
+{
+ /* Determine packet size. */
+ switch (s->packet_size_edit_type)
+ {
+ case PG_EDIT_INCREMENT:
+ case PG_EDIT_RANDOM:
+ if (s->min_packet_bytes == s->max_packet_bytes)
+ s->packet_size_edit_type = PG_EDIT_FIXED;
+ case PG_EDIT_FIXED:
+ break;
+
+ default:
+ /* Get packet size from fixed edits. */
+ s->packet_size_edit_type = PG_EDIT_FIXED;
+ if (!s->replay_packet_templates)
+ s->min_packet_bytes = s->max_packet_bytes =
+ vec_len (s->fixed_packet_data);
+ break;
+ }
+
+ s->last_increment_packet_size = s->min_packet_bytes;
+}
+
/*
* fd.io coding-style-patch-verification: ON