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_{}"
+ exec_cmd(cmd.format(cpu))
+
class PktgenTx(TestGeneric):
def run(self):
dev_names = self.get_multi_mopt("netdev_name")
@@ -77,6 +81,8 @@ class PktgenTx(TestGeneric):
exec_cmd("modprobe pktgen")
+ pktgen_devices_remove()
+
pgctl = Pktgen("/proc/net/pktgen/pgctrl")
pgwrkr = PktgenWorkers()
--
2.7.4