aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/functions.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/functions.py b/tools/functions.py
index d00200d9..05bde54f 100644
--- a/tools/functions.py
+++ b/tools/functions.py
@@ -21,6 +21,8 @@ import glob
import shutil
from conf import settings as S
+MAX_L4_FLOWS = 65536
+
#
# Support functions
#
@@ -139,3 +141,15 @@ def settings_update_paths():
tools['dpdk_src'] = S.getValue('PATHS')['dpdk']['src']['path']
S.setValue('TOOLS', tools)
+
+def check_traffic(traffic):
+ """Check traffic definition and correct it if needed.
+ """
+ # in case of UDP ports we have only 65536 (0-65535) unique options
+ if traffic['multistream'] > MAX_L4_FLOWS and \
+ traffic['stream_type'] == 'L4':
+ logging.getLogger().warning('Requested amount of L4 flows %s is bigger than '
+ 'number of transport protocol ports. It was set '
+ 'to %s.', traffic['multistream'], MAX_L4_FLOWS)
+ traffic['multistream'] = MAX_L4_FLOWS
+ return traffic