aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest/main.cpp
diff options
context:
space:
mode:
authorKonstantin Ananyev <konstantin.ananyev@intel.com>2017-02-21 18:12:20 +0000
committerKonstantin Ananyev <konstantin.ananyev@intel.com>2017-02-24 16:37:08 +0000
commitaa97dd1ce910b839fed46ad55d1e70e403f5a930 (patch)
treef6f0fd494eaf499859bff9f20f5ddfac9ab99233 /test/gtest/main.cpp
parentf5f10013ffef8e4ac1071087b8492fe6380d98fe (diff)
Introduce first version of TCP code.
Supported functionality: - open/close - listen/accept/connect - send/recv In order to achieve that libtle_udp library was reworked into libtle_l4p library that supports both TCP and UDP protocols. New libtle_timer library was introduced (thanks to Cisco guys and Dave Barach <dbarach@cisco.com> for sharing their timer code with us). Sample application was also reworked significantly to support both TCP and UDP traffic handling. New UT were introduced. Change-Id: I806b05011f521e89b58db403cfdd484a37beb775 Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com> Signed-off-by: Karol Latecki <karolx.latecki@intel.com> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Diffstat (limited to 'test/gtest/main.cpp')
-rw-r--r--test/gtest/main.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/test/gtest/main.cpp b/test/gtest/main.cpp
index 8c4e2dc..17cdccd 100644
--- a/test/gtest/main.cpp
+++ b/test/gtest/main.cpp
@@ -13,17 +13,30 @@
* limitations under the License.
*/
+#include <iostream>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
-#include <iostream>
+
#include <rte_common.h>
#include <rte_eal.h>
+#include <rte_ethdev.h>
+#include <rte_cycles.h>
+#include <rte_lcore.h>
+#include <rte_mbuf.h>
+#include <rte_errno.h>
+
+#include "test_common.h"
-int main(int argc, char *argv[])
+struct rte_mempool *mbuf_pool;
+
+int
+main(int argc, char *argv[])
{
+ uint8_t nb_ports = 1;
+ int rc = 0;
+
/* Initialize GoogleTest&Mock and parse any args */
testing::InitGoogleMock(&argc, argv);
-
/* Initialize EAL */
int ret = rte_eal_init(argc, argv);
if (ret < 0)
@@ -31,5 +44,19 @@ int main(int argc, char *argv[])
argc -= ret;
argv += ret;
+ /*
+ * Creates a new mempool in memory to hold the mbufs.
+ * Multiplied by 2 because of mempeool to be used for packet
+ * fragmentation purposes.
+ */
+ mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL",
+ 2 * NUM_MBUFS * nb_ports, MBUF_CACHE_SIZE, 0,
+ RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
+ if (mbuf_pool == NULL) {
+ rc = -rte_errno;
+ printf("Mempool was not created, rc=%d\n", rc);
+ return rc;
+ }
+
return RUN_ALL_TESTS();
}