Commit c208339b authored by Jialin Li's avatar Jialin Li
Browse files

Merge branch 'master' of github.com:simbricks/simbricks

parents 1bf41fae e6fbe164
...@@ -25,7 +25,7 @@ import simbricks.simulators as sim ...@@ -25,7 +25,7 @@ import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
# iperf TCP_single test # iperf UDP test
# naming convention following host-nic-net-app # naming convention following host-nic-net-app
# host: gem5-timing # host: gem5-timing
# nic: cv/cb/ib # nic: cv/cb/ib
......
...@@ -25,8 +25,8 @@ import simbricks.simulators as sim ...@@ -25,8 +25,8 @@ import simbricks.simulators as sim
import simbricks.nodeconfig as node import simbricks.nodeconfig as node
# iperf TCP_single test # iperf UDP Load Scalability test
# naming convention following host-nic-net-app # naming convention following host-nic-net
# host: gem5-timing # host: gem5-timing
# nic: cv/cb/ib # nic: cv/cb/ib
# net: wire/switch/dumbbell/bridge # net: wire/switch/dumbbell/bridge
...@@ -34,13 +34,13 @@ import simbricks.nodeconfig as node ...@@ -34,13 +34,13 @@ import simbricks.nodeconfig as node
host_types = ['gt', 'qt', 'qemu'] host_types = ['gt', 'qt', 'qemu']
nic_types = ['cv','cb','ib'] nic_types = ['cv','cb','ib']
net_types = ['wire', 'switch', 'bridge'] net_types = ['wire', 'sw', 'br']
app = ['UDPs'] app = ['UDPs']
rate_types = [] rate_types = []
rate_start = 0 rate_start = 0
rate_end = 140 rate_end = 1000
rate_step = 20 rate_step = 100
for r in range(rate_start, rate_end + 1, rate_step): for r in range(rate_start, rate_end + 1, rate_step):
rate = f'{r}m' rate = f'{r}m'
rate_types.append(rate) rate_types.append(rate)
...@@ -53,11 +53,11 @@ for rate in rate_types: ...@@ -53,11 +53,11 @@ for rate in rate_types:
for nic_type in nic_types: for nic_type in nic_types:
for net_type in net_types: for net_type in net_types:
e = exp.Experiment(host_type + '-' + nic_type + '-' + net_type + '-UDPs-' + rate ) e = exp.Experiment(host_type + '-' + nic_type + '-' + net_type + '-Load-' + rate )
# network # network
if net_type == 'switch': if net_type == 'sw':
net = sim.SwitchNet() net = sim.SwitchNet()
elif net_type == 'bridge': elif net_type == 'br':
net = sim.NS3BridgeNet() net = sim.NS3BridgeNet()
elif net_type == 'wire': elif net_type == 'wire':
net = sim.WireNet() net = sim.WireNet()
...@@ -76,7 +76,7 @@ for rate in rate_types: ...@@ -76,7 +76,7 @@ for rate in rate_types:
host_class = qemu_timing host_class = qemu_timing
elif host_type == 'gt': elif host_type == 'gt':
host_class = sim.Gem5Host host_class = sim.Gem5Host
e.checkpoint = False e.checkpoint = True
else: else:
raise NameError(host_type) raise NameError(host_type)
...@@ -106,6 +106,7 @@ for rate in rate_types: ...@@ -106,6 +106,7 @@ for rate in rate_types:
clients[0].wait = True clients[0].wait = True
clients[0].node_config.app.server_ip = servers[0].node_config.ip clients[0].node_config.app.server_ip = servers[0].node_config.ip
clients[0].node_config.app.is_last = True
clients[0].node_config.app.rate = rate clients[0].node_config.app.rate = rate
print(e.name) print(e.name)
......
...@@ -190,7 +190,7 @@ class ExpEnv(object): ...@@ -190,7 +190,7 @@ class ExpEnv(object):
self.qemu_img_path = self.repodir + '/sims/external/qemu/build/qemu-img' self.qemu_img_path = self.repodir + '/sims/external/qemu/build/qemu-img'
self.qemu_path = self.repodir + '/sims/external/qemu/build/x86_64-softmmu/qemu-system-x86_64' self.qemu_path = self.repodir + '/sims/external/qemu/build/x86_64-softmmu/qemu-system-x86_64'
self.qemu_kernel_path = self.repodir + '/images/bzImage' self.qemu_kernel_path = self.repodir + '/images/bzImage'
self.gem5_path = self.repodir + '/sims/external/gem5/build/X86/gem5.opt' self.gem5_path = self.repodir + '/sims/external/gem5/build/X86/gem5.fast'
self.gem5_py_path = self.repodir + '/sims/external/gem5/configs/simbricks/simbricks.py' self.gem5_py_path = self.repodir + '/sims/external/gem5/configs/simbricks/simbricks.py'
self.gem5_kernel_path = self.repodir + '/images/vmlinux' self.gem5_kernel_path = self.repodir + '/images/vmlinux'
......
...@@ -326,18 +326,20 @@ class IperfTCPClient(AppConfig): ...@@ -326,18 +326,20 @@ class IperfTCPClient(AppConfig):
class IperfUDPClient(AppConfig): class IperfUDPClient(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
rate = '150m' rate = '150m'
def run_cmds(self, node): is_last = False
return ['sleep 1',
'iperf -c ' + self.server_ip + ' -i 1 -u -b ' + self.rate,
'sleep 20']
class IperfUDPClientLast(AppConfig):
server_ip = '10.0.0.1'
rate = '150m'
def run_cmds(self, node): def run_cmds(self, node):
return ['sleep 1', cmds = ['sleep 1',
'iperf -c ' + self.server_ip + ' -i 1 -u -b ' + self.rate, 'iperf -c ' + self.server_ip + ' -i 1 -u -b ' + self.rate]
'sleep 0.5']
if self.is_last:
cmds.append('sleep 0.5')
else:
cmds.append('sleep infinity')
return cmds
class IperfUDPClientSleep(AppConfig): class IperfUDPClientSleep(AppConfig):
server_ip = '10.0.0.1' server_ip = '10.0.0.1'
......
...@@ -42,7 +42,7 @@ class HostSim(Simulator): ...@@ -42,7 +42,7 @@ class HostSim(Simulator):
name = '' name = ''
wait = False wait = False
sleep = 0 sleep = 0
cpu_freq = '3GHz' cpu_freq = '8GHz'
sync_mode = 0 sync_mode = 0
sync_period = 500 sync_period = 500
...@@ -187,6 +187,7 @@ class Gem5Host(HostSim): ...@@ -187,6 +187,7 @@ class Gem5Host(HostSim):
cmd = (f'{env.gem5_path} --outdir={env.gem5_outdir(self)} ' cmd = (f'{env.gem5_path} --outdir={env.gem5_outdir(self)} '
f'{env.gem5_py_path} --caches --l2cache --l3cache ' f'{env.gem5_py_path} --caches --l2cache --l3cache '
'--l1d_size=32kB --l1i_size=32kB --l2_size=2MB --l3_size=32MB ' '--l1d_size=32kB --l1i_size=32kB --l2_size=2MB --l3_size=32MB '
'--l1d_assoc=8 --l1i_assoc=8 --l2_assoc=4 --l3_assoc=16 '
f'--cacheline_size=64 --cpu-clock={self.cpu_freq} --sys-clock={self.sys_clock} ' f'--cacheline_size=64 --cpu-clock={self.cpu_freq} --sys-clock={self.sys_clock} '
f'--checkpoint-dir={env.gem5_cpdir(self)} ' f'--checkpoint-dir={env.gem5_cpdir(self)} '
f'--kernel={env.gem5_kernel_path} ' f'--kernel={env.gem5_kernel_path} '
......
#!/bin/bash #!/bin/bash
qemupath=`pwd`/../qemu/ qemupath=`pwd`/../sims/external/qemu/
# add our qemu to $PATH # add our qemu to $PATH
export PATH="$qemupath:$qemupath/build/:$PATH" export PATH="$qemupath:$qemupath/build/:$PATH"
......
Subproject commit 4ca6108945ec809e12fb7e2b5909c4656cedf78a Subproject commit 2a38119e6a46e871bb540f51557c3c72edc5a253
...@@ -620,6 +620,9 @@ class i40e_bm : public nicbm::Runner::Device { ...@@ -620,6 +620,9 @@ class i40e_bm : public nicbm::Runner::Device {
// places the tcp checksum in the packet (assuming ipv4) // places the tcp checksum in the packet (assuming ipv4)
void xsum_tcp(void *tcphdr, size_t l4len); void xsum_tcp(void *tcphdr, size_t l4len);
// places the udpp checksum in the packet (assuming ipv4)
void xsum_udp(void *udpphdr, size_t l4len);
// calculates the full ipv4 & tcp checksum without assuming any pseudo header // calculates the full ipv4 & tcp checksum without assuming any pseudo header
// xsums // xsums
void xsum_tcpip_tso(void *iphdr, uint8_t iplen, uint8_t l4len, uint16_t paylen); void xsum_tcpip_tso(void *iphdr, uint8_t iplen, uint8_t l4len, uint16_t paylen);
......
...@@ -135,7 +135,7 @@ void host_mem_cache::issue_mem_op(mem_op &op) { ...@@ -135,7 +135,7 @@ void host_mem_cache::issue_mem_op(mem_op &op) {
#ifdef DEBUG_HMC #ifdef DEBUG_HMC
std::cerr << "hmc issue_mem_op: hmc_addr=" << addr std::cerr << "hmc issue_mem_op: hmc_addr=" << addr
<< " dma_addr=" << op.dma_addr << " len=" << op.len << std::endl; << " dma_addr=" << op.dma_addr_ << " len=" << op.len_ << std::endl;
#endif #endif
runner->IssueDma(op); runner->IssueDma(op);
} }
......
...@@ -430,7 +430,7 @@ void lan_queue_tx::do_writeback(uint32_t first_idx, uint32_t first_pos, ...@@ -430,7 +430,7 @@ void lan_queue_tx::do_writeback(uint32_t first_idx, uint32_t first_pos,
dma->dma_addr_ = hwb_addr; dma->dma_addr_ = hwb_addr;
#ifdef DEBUG_LAN #ifdef DEBUG_LAN
log << " hwb=" << *((uint32_t *)dma->data) << logger::endl; log << " hwb=" << *((uint32_t *)dma->data_) << logger::endl;
#endif #endif
runner->IssueDma(*dma); runner->IssueDma(*dma);
} }
...@@ -591,6 +591,9 @@ bool lan_queue_tx::trigger_tx_packet() { ...@@ -591,6 +591,9 @@ bool lan_queue_tx::trigger_tx_packet() {
if (l4t == I40E_TX_DESC_CMD_L4T_EOFT_TCP) { if (l4t == I40E_TX_DESC_CMD_L4T_EOFT_TCP) {
uint16_t tcp_off = maclen + iplen; uint16_t tcp_off = maclen + iplen;
xsum_tcp(pktbuf + tcp_off, tso_len - tcp_off); xsum_tcp(pktbuf + tcp_off, tso_len - tcp_off);
} else if (l4t == I40E_TX_DESC_CMD_L4T_EOFT_UDP) {
uint16_t udp_off = maclen + iplen;
xsum_udp(pktbuf + udp_off, tso_len - udp_off);
} }
runner->EthSend(pktbuf, tso_len); runner->EthSend(pktbuf, tso_len);
......
...@@ -30,6 +30,14 @@ struct rte_tcp_hdr { ...@@ -30,6 +30,14 @@ struct rte_tcp_hdr {
uint16_t tcp_urp; /**< TCP urgent pointer, if any. */ uint16_t tcp_urp; /**< TCP urgent pointer, if any. */
} __attribute__((packed)); } __attribute__((packed));
/* from dpdk/lib/librte_net/rte_udp.h */
struct rte_udp_hdr {
uint16_t src_port;
uint16_t dst_port;
uint16_t dgram_len;
uint16_t dgram_cksum;
} __attribute__((packed));
/* from dpdk/lib/librte_net/rte_ip.h */ /* from dpdk/lib/librte_net/rte_ip.h */
struct ipv4_hdr { struct ipv4_hdr {
uint8_t version_ihl; /**< version and header length */ uint8_t version_ihl; /**< version and header length */
...@@ -106,6 +114,14 @@ static inline uint16_t rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr) { ...@@ -106,6 +114,14 @@ static inline uint16_t rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr) {
return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
} }
void xsum_udp(void *udphdr, size_t l4_len) {
struct rte_udp_hdr *udph = reinterpret_cast<struct rte_udp_hdr *>(udphdr);
uint32_t cksum = rte_raw_cksum(udphdr, l4_len);
cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
cksum = (~cksum) & 0xffff;
udph->dgram_cksum = cksum;
}
void xsum_tcp(void *tcphdr, size_t l4_len) { void xsum_tcp(void *tcphdr, size_t l4_len) {
struct rte_tcp_hdr *tcph = reinterpret_cast<struct rte_tcp_hdr *>(tcphdr); struct rte_tcp_hdr *tcph = reinterpret_cast<struct rte_tcp_hdr *>(tcphdr);
uint32_t cksum = rte_raw_cksum(tcphdr, l4_len); uint32_t cksum = rte_raw_cksum(tcphdr, l4_len);
......
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