On Wed, Oct 05, 2016 at 11:55:01AM +0200, Jan Tluka wrote:
Wed, Sep 21, 2016 at 06:53:36PM CEST, idosch(a)idosch.org wrote:
>From: Ido Schimmel <idosch(a)mellanox.com>
>
>The PktgenTx module removes devices from the pktgen threads that are
>going to participate in the recipe. However, when 'start' is issued all
>the configured pktgen threads will start generating packets, even those
>configured prior to the currently executing recipe.
>
>Fix this by deconfiguring all the pktgen threads during the module init.
>
>Signed-off-by: Ido Schimmel <idosch(a)mellanox.com>
>---
> test_modules/PktgenTx.py | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/test_modules/PktgenTx.py b/test_modules/PktgenTx.py
>index 71c2870..51fcd4c 100644
>--- a/test_modules/PktgenTx.py
>+++ b/test_modules/PktgenTx.py
>@@ -32,7 +32,6 @@ class PktgenWorkers:
> def _init_current_wrkr(self):
> num = self._current
> wrkr = Pktgen("/proc/net/pktgen/kpktgend_%d" % (num))
>- wrkr.set("rem_device_all")
> wrkr.set("max_before_softirq 5000")
> self._wrkrs[num] = wrkr
>
>@@ -61,6 +60,11 @@ def pktget_options_merge(pktgen_options, default_pktgen_options):
> res = res + opts
> return [" ".join(opt) for opt in res]
>
>+def pktgen_devices_remove():
>+ for cpu in range(os.sysconf('SC_NPROCESSORS_ONLN')):
>+ cmd = "echo rem_device_all > /proc/net/pktgen/kpktgend_{}"
This broke the module on RHEL6 that has an older python version 2.6.6.
That version expects an index in formatting string, e.g. {0}
For versions 2.7 and above the index can be omitted.
Good to know :)
I'll post a fix for this today.
Thanks!