changeset 1275:05273ffd04e1

DPDK - verbosity exposed
author Devel 1
date Tue, 07 Jul 2020 15:28:21 +0200
parents f9f429b781da
children 494df42c1b84
files stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketEmitter.java stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketWorker.java
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketEmitter.java	Tue Jul 07 15:14:16 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketEmitter.java	Tue Jul 07 15:28:21 2020 +0200
@@ -30,6 +30,7 @@
             bufferSize = MAX_BUFFER_SIZE;
         }
         bufferFlushPeriod = config.getLong("bufferFlushPeriod", DEFAULT_FLUSH_PERIOD);
+        DpdkUnidirectionalRawPacketWorker.verbosity = config.getInteger("verbosity", DEFAULT_VERBOSITY);
     }
 
     @Override
@@ -52,7 +53,8 @@
             MapNodeDefinition def = super.create();
             def.add(
                     tupleDef("bufferSize", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false),
-                    tupleDef("bufferFlushPeriod", LONG_GREATER_THAN_ZERO_DEF).setRequired(false)
+                    tupleDef("bufferFlushPeriod", LONG_GREATER_THAN_ZERO_DEF).setRequired(false),
+                    tupleDef("verbosity", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false)
             );
             return def;
         }
--- a/stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketWorker.java	Tue Jul 07 15:14:16 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketWorker.java	Tue Jul 07 15:28:21 2020 +0200
@@ -19,6 +19,7 @@
     public static final int MAX_BUFFER_SIZE = DpdkAO.sendBuffSize();
     public static final int DEFAULT_BUFFER_SIZE = 0;
     public static final long DEFAULT_FLUSH_PERIOD = 50;
+    public static final int DEFAULT_VERBOSITY = 1;
 
     private DpdkAO dpdkAO;
 
@@ -26,6 +27,7 @@
 
     private MACAddress localMac = new MACAddress(ZERO_MAC);
 
+    public static int verbosity = DEFAULT_VERBOSITY;
     private int bufferSize = DEFAULT_BUFFER_SIZE;
     private long bufferFlushPeriod = DEFAULT_FLUSH_PERIOD;
     private ScheduledTimerService scheduler;
@@ -50,12 +52,23 @@
     protected DpdkAO doInitEngine(UnidirectionalRawPacketChannelContext<DpdkAO> channelContext, String device) throws IOException {
         synchronized (DpdkAO.class) {
             if (dpdkAO == null) {
+                DpdkAO.setVerbose(verbosity);
                 String memPoolLib = "/root/MoonGen/libmoon/deps/dpdk/x86_64-native-linuxapp-gcc/lib/librte_mempool_ring.so";
                 String[] ealArgs = {"-l", "1,2", "-n", "4", "--proc-type=auto", "-d", memPoolLib};
                 String[] appArgs = {"--", "-p", "1", "--num-queues=2", "--proc-id=0"};
 
+                LOGGER.info("DPDK JNI build info" + DpdkAO.buildInfo());
+
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug("Initializing DPDK EAL. args=" + Arrays.toString(ealArgs));
+                }
                 DpdkAO.initEal(ealArgs);
+
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug("Initializing DPDK APP. args=" + Arrays.toString(appArgs));
+                }
                 DpdkAO.initApp(appArgs);
+
                 dpdkAO = new DpdkAO();
             }
 
@@ -150,6 +163,7 @@
                 }
             }
         } else {
+            System.out.println("xxx " + length + " " + frame.length);
             int res = DpdkAO.sendPacket(length, frame);
             if (res < 0) {
                 throw new IOException("Unable to send packet. DPDK error.");