Commit 654e7871 authored by guruhegde's avatar guruhegde

[Eval] Update BatchMaker test

parent 78f14b8a
......@@ -20,8 +20,10 @@ string generateIR(string InFile, string Input_dir, bool isTas = false) {
tags += "-std=gnu99 -Wall -Werror -I. -I/home/gp/mpi-sws/tas/include/ -march=native "
"-fno-omit-frame-pointer -Wno-unused-variable -Wno-unused-function "
"-Wno-address-of-packed-member -Wno-sometimes-uninitialized "
"-I/usr/share/dpdk/x86_64-default-linuxapp-gcc/include "
"-I/usr/share/dpdk/x86_64-default-linuxapp-gcc/include/dpdk "
"-I/usr/share/dpdk/x86_64-native-linuxapp-gcc/include "
"-I/usr/share/dpdk/x86_64-native-linuxapp-gcc/include/dpdk "
"-I/usr/share/dpdk/x86_64-native-linuxapp-gcc/include/x86_64-linux-gnu/dpdk/ "
"-I/usr/include/dpdk "
"-I/home/gp/mpi-sws/tas -I/home/gp/mpi-sws/tas/lib/tas/include "
"-I/home/gp/mpi-sws/tas/lib/sockets/include "
"-I/home/gp/mpi-sws/tas/tas/include "
......@@ -30,6 +32,7 @@ string generateIR(string InFile, string Input_dir, bool isTas = false) {
string GenerateIRCmd = string("clang ") + tags + string("-o") +
Input_dir + OutFile + " " + Input_dir + InFile;
cout << GenerateIRCmd << "\n";
auto ret = system(GenerateIRCmd.c_str());
if (ret != 0) {
cerr << "clang:IR generation failed with error code " << ret << "\n";
......
......@@ -249,3 +249,32 @@ TEST_CASE("input parameter struct type") {
auto ret = system(binary.c_str());
REQUIRE(ret == 0);
}
TEST_CASE("make fast_flows_packet fn as batched form") {
std::string filePrefix = "fast_flows";
auto M = parseIR(filePrefix + string(".ll"), input_dir);
REQUIRE(M != nullptr);
M->setSourceFileName(filePrefix + string("_batch.ll"));
{
std::string functionName = "fast_flows_packet";
// Function with 2 arguments and int return type.
auto F = M->getFunction(functionName);
REQUIRE(F->getReturnType() == Type::getInt32Ty(C));
REQUIRE(F->arg_size() == 5);
REQUIRE(M->getFunction(functionName + string("_batch")) == nullptr);
BatchMaker BM(F);
BM.run();
// Function with 4 arguments and void return type.
auto BF = M->getFunction(functionName + string("_batch"));
REQUIRE(BF != nullptr);
REQUIRE(BF->getReturnType() == Type::getVoidTy(C));
REQUIRE(BF->arg_size() == 7);
}
auto asmFile = writeToAsmFile(*M);
// Generate object for unit under test.
auto TestObject = generateObject(writeToBitCodeFile(*M));
}
......@@ -171,7 +171,7 @@ TEST_CASE("fast_flows_packet") {
BlockPredication BP(F);
BP.run();
//auto asmFile = writeToAsmFile(*M);
auto asmFile = writeToAsmFile(*M);
// Generate object for unit under test.
auto TestObject = generateObject(writeToBitCodeFile(*M));
......
......@@ -37,8 +37,6 @@
#define TCP_MSS 1448
#define TCP_MAX_RTT 100000
#define HWXSUM_EN 1
//#define SKIP_ACK 1
struct flow_key {
......@@ -707,6 +705,18 @@ int fast_flows_bump(struct dataplane_context *ctx, uint32_t flow_id,
tx_avail = fs->tx_avail + tx_bump;
/* validate tx bump */
if (tx_bump > fs->tx_len || tx_avail > fs->tx_len ||
tx_avail + fs->tx_sent > fs->tx_len)
{
fprintf(stderr, "fast_flows_bump: tx bump too large\n");
goto unlock;
}
/* validate rx bump */
if (rx_bump > fs->rx_len || rx_bump + fs->rx_avail > fs->tx_len) {
fprintf(stderr, "fast_flows_bump: rx bump too large\n");
goto unlock;
}
/* calculate how many bytes can be sent before and after this bump */
old_avail = tcp_txavail(fs, NULL);
new_avail = tcp_txavail(fs, &tx_avail);
......@@ -1010,6 +1020,8 @@ static void flow_reset_retransmit(struct flextcp_pl_flowst *fs)
x = fs->tx_sent - fs->tx_next_pos;
fs->tx_next_pos = fs->tx_len - x;
}
fs->tx_avail += fs->tx_sent;
fs->rx_remote_avail += fs->tx_sent;
fs->tx_sent = 0;
/* cut rate by half if first drop in control interval */
......@@ -1024,13 +1036,13 @@ static inline void tcp_checksums(struct network_buf_handle *nbh,
struct pkt_tcp *p, beui32_t ip_s, beui32_t ip_d, uint16_t l3_paylen)
{
p->ip.chksum = 0;
#ifdef HWXSUM_EN
p->tcp.chksum = tx_xsum_enable(nbh, &p->ip, ip_s, ip_d, l3_paylen);
#else
p->tcp.chksum = 0;
p->ip.chksum = rte_ipv4_cksum((void *) &p->ip);
p->tcp.chksum = rte_ipv4_udptcp_cksum((void *) &p->ip, (void *) &p->tcp);
#endif
if (config.fp_xsumoffload) {
p->tcp.chksum = tx_xsum_enable(nbh, &p->ip, ip_s, ip_d, l3_paylen);
} else {
p->tcp.chksum = 0;
p->ip.chksum = rte_ipv4_cksum((void *) &p->ip);
p->tcp.chksum = rte_ipv4_udptcp_cksum((void *) &p->ip, (void *) &p->tcp);
}
}
void fast_flows_kernelxsums(struct network_buf_handle *nbh,
......
......@@ -58,12 +58,9 @@ TEST_CASE("fn with single loop") {
DominatorTree DT(*F);
LoopInfo LI(DT);
errs() << "Loop details\n";
LI.print(errs());
LoopSplitter LS(F, &LI);
LS.run();
auto Stats = LS.getStats();
REQUIRE(Stats.AnnotatedVarsSize == 1);
REQUIRE(Stats.VarUsePointsSize == 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment