add stream bps config option

This commit is contained in:
Christian Giese
2021-04-14 11:11:06 +02:00
parent 42235609d4
commit dbbafb4df4
4 changed files with 27 additions and 7 deletions
+9 -1
View File
@@ -550,11 +550,19 @@ Attribute | Description | Default
`priority` | IPv4 TOS / IPv6 TC | 0
`vlan-priority` | VLAN priority | 0
`length` | Layer 3 (IP + payload) traffic length (76 - 1500) | 128
`pps` | Stream traffic rate in packets per second | 1
`pps` | Stream traffic rate in packets per second | 1
`bps` | Stream traffic rate in bits per second (layer 3) |
`network-ipv4-address` | Overwrite network interface IPv4 address |
`network-ipv6-address` | Overwrite network interface IPv6 address |
`threaded` | Run those streams in separate threads | false
For L2TP downstream traffic the IPv4 TOS is applied to the outer IPv4 and inner IPv4 header.
The `pps` option has priority over `bps` where second is only a helper to calculate the `pps`
based on given `bps` and `length`.
With threading enabled, those streams will be started in a dedicated thread per flow. This
means one thread per session and stream direction. A threaded , bidirectional stream assigned
to 10 sessions will therefore run in 20 threads.
**WARNING**: The threading support is experimental and should be used with caution!
+4 -3
View File
@@ -7,8 +7,9 @@ Traffic streams allow to test QoS using BNG Blaster.
```json
{
"interfaces": {
"tx-interval": 1,
"rx-interval": 1,
"tx-interval": 0.1,
"rx-interval": 0.1,
"io-slots": 2048,
"network": {
"interface": "eth2",
"address": "10.0.0.1",
@@ -206,7 +207,7 @@ The `rx-outer-vlan-pbit` might be wrong depending on network interface driver an
optional VLAN offloading.
The measured `rx-delay-nsec-min/max` depends also on the actual test environment
and maximum host send delay.
and maximum host IO delay.
## Start/Stop Session Stream Information
+12 -1
View File
@@ -311,6 +311,7 @@ static bool
json_parse_stream (bbl_ctx_s *ctx, json_t *stream, bbl_stream_config *stream_config) {
json_t *value = NULL;
const char *s = NULL;
double bps;
if (json_unpack(stream, "{s:s}", "type", &s) == 0) {
if (strcmp(s, "ipv4") == 0) {
@@ -385,8 +386,18 @@ json_parse_stream (bbl_ctx_s *ctx, json_t *stream, bbl_stream_config *stream_con
return false;
}
} else {
stream_config->pps = 1;
/* pps config has priority over bps */
value = json_object_get(stream, "bps");
if (value) {
bps = json_number_value(value);
if(!bps) {
fprintf(stderr, "JSON config error: Invalid value for stream->bps\n");
return false;
}
stream_config->pps = bps / (stream_config->length * 8);
}
}
if(!stream_config->pps) stream_config->pps = 1;
if (json_unpack(stream, "{s:s}", "network-ipv4-address", &s) == 0) {
if(!inet_pton(AF_INET, s, &stream_config->ipv4_network_address)) {
+2 -2
View File
@@ -758,7 +758,7 @@ bbl_stream_add(bbl_ctx_s *ctx, bbl_access_config_s *access_config, bbl_session_s
timer_add_periodic(&ctx->timer_root, &stream->timer, config->name, timer_sec, timer_nsec, stream, bbl_stream_tx_job);
}
timer_add_periodic(&ctx->timer_root, &stream->timer_rate, "Rate Computation", 1, 0, stream, bbl_stream_rate_job);
LOG(DEBUG, "Traffic stream %s added in upstream with timer %lu sec %lu nsec\n", config->name, timer_sec, timer_nsec);
LOG(DEBUG, "Traffic stream %s added in upstream with %u PPS (timer: %lu sec %lu nsec)\n", config->name, config->pps, timer_sec, timer_nsec);
}
if(config->direction & STREAM_DIRECTION_DOWN) {
stream = calloc(1, sizeof(bbl_stream));
@@ -792,7 +792,7 @@ bbl_stream_add(bbl_ctx_s *ctx, bbl_access_config_s *access_config, bbl_session_s
timer_add_periodic(&ctx->timer_root, &stream->timer, config->name, timer_sec, timer_nsec, stream, bbl_stream_tx_job);
}
timer_add_periodic(&ctx->timer_root, &stream->timer_rate, "Rate Computation", 1, 0, stream, bbl_stream_rate_job);
LOG(DEBUG, "Traffic stream %s added in downstream with timer %lu sec %lu nsec\n", config->name, timer_sec, timer_nsec);
LOG(DEBUG, "Traffic stream %s added in downstream with %u PPS (timer %lu sec %lu nsec)\n", config->name, config->pps, timer_sec, timer_nsec);
}
timer_smear_bucket(&ctx->timer_root, timer_sec, timer_nsec);
}