Mercurial > stress-tester
changeset 1280:f5ba6579b526
DpdkUnidirectionalRawPacketWorker - initialization
author | Devel 1 |
---|---|
date | Thu, 09 Jul 2020 11:34:40 +0200 |
parents | 895cbec4d75c |
children | b181731fc098 |
files | stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketWorker.java |
diffstat | 1 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketWorker.java Thu Jul 09 11:01:52 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/raw/DpdkUnidirectionalRawPacketWorker.java Thu Jul 09 11:34:40 2020 +0200 @@ -26,7 +26,7 @@ private int dpdkInitCalls = 0; - private MACAddress localMac = new MACAddress(ZERO_MAC); + private final MACAddress localMac = new MACAddress(ZERO_MAC); public static int verbosity = DEFAULT_VERBOSITY; private int bufferSize = DEFAULT_BUFFER_SIZE; @@ -51,31 +51,6 @@ @Override 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(); - } - - dpdkInitCalls++; - } - return dpdkAO; } @@ -126,7 +101,32 @@ @Override protected void onInit() { + 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(); + } + dpdkInitCalls++; + } + synchronized (this) { + LOGGER.debug("Creating buffers: " + bufferSize); if (bufferSize > 0) { bufferBytes = new byte[bufferSize][]; bufferLengths = new int[bufferSize];