From fa128153a541e6f1f3866bbb63b8e6346eed129b Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Thu, 13 Dec 2018 14:12:59 -0600 Subject: [PATCH 01/20] Add new function SetSenderReceiverKNI SetSenderReceiverKNI combines send and receive KNI to one core. With a parameter function can use core that is assigned for Linux KNI device. Performance for 64 byte packets: 3 cores: 900MBits 2 cores: without range: 700 MBits with range: 1300 MBits 1 core: 2 MBits (however this is 44 MBits for 1400 byte packets) --- examples/kni.go | 15 ++++++++-- flow/flow.go | 71 +++++++++++++++++++++++++++++++++++------------ flow/scheduler.go | 29 +++++++++++++------ low/low.go | 19 +++++++++---- low/low.h | 50 ++++++++++++++++++--------------- 5 files changed, 127 insertions(+), 57 deletions(-) diff --git a/examples/kni.go b/examples/kni.go index 2c9137a8..83a77c53 100644 --- a/examples/kni.go +++ b/examples/kni.go @@ -29,6 +29,7 @@ func main() { inport := flag.Uint("inport", 0, "port for receiver") outport := flag.Uint("outport", 0, "port for sender") kniport := flag.Uint("kniport", 0, "port for kni") + mode := flag.Uint("mode", 0, "0 - for three cores for KNI send/receive/Linux, 1 - for single core for KNI send/receive, 2 - for one core for all KNI") flag.BoolVar(&ping, "ping", false, "use this for pushing only ARP and ICMP packets to KNI") flag.Parse() @@ -49,8 +50,18 @@ func main() { toKNIFlow, err := flow.SetSeparator(inputFlow, pingSeparator, nil) flow.CheckFatal(err) - flow.CheckFatal(flow.SetSenderKNI(toKNIFlow, kni)) - fromKNIFlow := flow.SetReceiverKNI(kni) + var fromKNIFlow *flow.Flow + switch *mode { + case 0: + flow.CheckFatal(flow.SetSenderKNI(toKNIFlow, kni)) + fromKNIFlow = flow.SetReceiverKNI(kni) + case 1: + fromKNIFlow, err = flow.SetSenderReceiverKNI(toKNIFlow, kni, false) + flow.CheckFatal(err) + case 2: + fromKNIFlow, err = flow.SetSenderReceiverKNI(toKNIFlow, kni, true) + flow.CheckFatal(err) + } outputFlow, err := flow.SetMerger(inputFlow, fromKNIFlow) flow.CheckFatal(err) diff --git a/flow/flow.go b/flow/flow.go index d64e4692..d512f735 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -148,18 +148,36 @@ type Kni struct { type receiveParameters struct { out low.Rings port *low.Port - kni bool } -func addReceiver(portId uint16, kni bool, out low.Rings, inIndexNumber int32) { +func addReceiver(portId uint16, out low.Rings, inIndexNumber int32) { par := new(receiveParameters) par.port = low.GetPort(portId) par.out = out - par.kni = kni - if kni { - schedState.addFF("KNI receiver", nil, recvKNI, nil, par, nil, sendReceiveKNI, 0) + schedState.addFF("receiver", nil, recvRSS, nil, par, nil, receiveRSS, inIndexNumber) +} + +type KNIParameters struct { + in low.Rings + out low.Rings + port *low.Port + recv bool + send bool + linuxCore bool +} + +func addKNI(portId uint16, recv bool, out low.Rings, send bool, in low.Rings, inIndexNumber int32, name string, core bool) { + par := new(KNIParameters) + par.port = low.GetPort(portId) + par.in = in + par.out = out + par.recv = recv + par.send = send + par.linuxCore = core + if core { + schedState.addFF(name, nil, processKNI, nil, par, nil, comboKNI, inIndexNumber) } else { - schedState.addFF("receiver", nil, recvRSS, nil, par, nil, receiveRSS, inIndexNumber) + schedState.addFF(name, nil, processKNI, nil, par, nil, sendReceiveKNI, inIndexNumber) } } @@ -213,11 +231,7 @@ func addSender(port uint16, queue int16, in low.Rings, inIndexNumber int32) { par.port = port par.queue = queue par.in = in - if queue != -1 { - schedState.addFF("sender", nil, send, nil, par, nil, sendReceiveKNI, inIndexNumber) - } else { - schedState.addFF("KNI sender", nil, send, nil, par, nil, sendReceiveKNI, inIndexNumber) - } + schedState.addFF("sender", nil, send, nil, par, nil, sendReceiveKNI, inIndexNumber) } type copyParameters struct { @@ -669,7 +683,7 @@ func SetReceiver(portId uint16) (OUT *Flow, err error) { createdPorts[portId].wasRequested = true createdPorts[portId].willReceive = true rings := low.CreateRings(burstSize*sizeMultiplier, createdPorts[portId].InIndex) - addReceiver(portId, false, rings, createdPorts[portId].InIndex) + addReceiver(portId, rings, createdPorts[portId].InIndex) return newFlow(rings, createdPorts[portId].InIndex), nil } @@ -679,10 +693,24 @@ func SetReceiver(portId uint16) (OUT *Flow, err error) { // Returns new opened flow with received packets func SetReceiverKNI(kni *Kni) (OUT *Flow) { rings := low.CreateRings(burstSize*sizeMultiplier, 1) - addReceiver(kni.portId, true, rings, 1) + addKNI(kni.portId, true, rings, false, nil, 1, "receiver KNI", false) return newFlow(rings, 1) } +// SetSenderReceiverKNI adds function send/receive from KNI. +// Gets KNI device from which packets will be received and flow to send. +// Returns new opened flow with received packets +// If linuxCore parameter is true function will use core that was assigned +// to KNI device in Linux. So all send/receive/device can use one core +func SetSenderReceiverKNI(IN *Flow, kni *Kni, linuxCore bool) (OUT *Flow, err error) { + if err := checkFlow(IN); err != nil { + return nil, err + } + rings := low.CreateRings(burstSize*sizeMultiplier, 1) + addKNI(kni.portId, true, rings, true, finishFlow(IN), IN.inIndexNumber, "send-receive KNI", linuxCore) + return newFlow(rings, 1), nil +} + // SetFastGenerator adds clonable generate function to flow graph. // Gets user-defined generate function, target speed of generation user wants to achieve and context. // Returns new open flow with generated packets. @@ -741,7 +769,7 @@ func SetSenderKNI(IN *Flow, kni *Kni) error { if err := checkFlow(IN); err != nil { return err } - addSender(kni.portId, -1, finishFlow(IN), IN.inIndexNumber) + addKNI(kni.portId, false, nil, true, finishFlow(IN), IN.inIndexNumber, "KNI sender", false) return nil } @@ -1166,9 +1194,12 @@ func recvRSS(parameters interface{}, inIndex []int32, flag *int32, coreID int) { low.ReceiveRSS(uint16(srp.port.PortId), inIndex, srp.out, flag, coreID) } -func recvKNI(parameters interface{}, inIndex []int32, flag *int32, coreID int) { - srp := parameters.(*receiveParameters) - low.ReceiveKNI(uint16(srp.port.PortId), srp.out[0], flag, coreID) +func processKNI(parameters interface{}, inIndex []int32, flag *int32, coreID int) { + srk := parameters.(*KNIParameters) + if srk.linuxCore == true { + coreID = schedState.cores[createdPorts[srk.port.PortId].KNICoreIndex].id + } + low.SrKNI(uint16(srk.port.PortId), flag, coreID, srk.recv, srk.out, srk.send, srk.in) } func pGenerate(parameters interface{}, inIndex []int32, stopper [2]chan int, report chan reportPair, context []UserContext) { @@ -1336,7 +1367,7 @@ func pcopy(parameters interface{}, inIndex []int32, stopper [2]chan int, report func send(parameters interface{}, inIndex []int32, flag *int32, coreID int) { srp := parameters.(*sendParameters) - low.Send(srp.port, srp.queue, srp.in, inIndex[0], flag, coreID) + low.Send(srp.port, srp.queue, srp.in, flag, coreID) } func merge(from low.Rings, to low.Rings) { @@ -1367,6 +1398,10 @@ func merge(from low.Rings, to low.Rings) { if parameters.outCopy[0] == from[0] { parameters.outCopy = to } + case *KNIParameters: + if parameters.out != nil && parameters.out[0] == from[0] { + parameters.out = to + } } } } diff --git a/flow/scheduler.go b/flow/scheduler.go index 43549ab7..37f0ed8b 100644 --- a/flow/scheduler.go +++ b/flow/scheduler.go @@ -101,6 +101,7 @@ const ( sendReceiveKNI // send to port, send to KNI, receive from KNI generate readWrite + comboKNI // KNI send/receive will use core assigned to Linux KNI device ) // Flow function representation @@ -252,20 +253,26 @@ func (ff *flowFunction) startNewInstance(inIndex []int32, scheduler *scheduler) func (ffi *instance) startNewClone(scheduler *scheduler, n int) (err error) { ff := ffi.ff - core, index, err := scheduler.getCore() - if err != nil { - common.LogWarning(common.Debug, "Can't start new clone for", ff.name, "instance", n) - return err + var core int + var index int + if ff.fType != comboKNI { + core, index, err = scheduler.getCore() + if err != nil { + common.LogWarning(common.Debug, "Can't start new clone for", ff.name, "instance", n) + return err + } + common.LogDebug(common.Debug, "Start new clone for", ff.name, "instance", n, "at", core, "core") + } else { + common.LogDebug(common.Debug, "Start new clone for", ff.name, "instance", n, "at KNI Linux core") } - common.LogDebug(common.Debug, "Start new clone for", ff.name, "instance", n, "at", core, "core") ffi.clone = append(ffi.clone, &clonePair{index, [2]chan int{nil, nil}, process}) ffi.cloneNumber++ - if ff.fType != receiveRSS && ff.fType != sendReceiveKNI { + if ff.fType != receiveRSS && ff.fType != sendReceiveKNI && ff.fType != comboKNI{ ffi.clone[ffi.cloneNumber-1].channel[0] = make(chan int) ffi.clone[ffi.cloneNumber-1].channel[1] = make(chan int) } go func() { - if ff.fType != receiveRSS && ff.fType != sendReceiveKNI { + if ff.fType != receiveRSS && ff.fType != sendReceiveKNI && ff.fType != comboKNI { if err := low.SetAffinity(core); err != nil { common.LogFatal(common.Debug, "Failed to set affinity to", core, "core: ", err) } @@ -274,8 +281,10 @@ func (ffi *instance) startNewClone(scheduler *scheduler, n int) (err error) { } else { ff.uncloneFunction(ff.Parameters, ffi.inIndex, ffi.clone[ffi.cloneNumber-1].channel) } - } else { + } else if ff.fType != comboKNI { ff.cFunction(ff.Parameters, ffi.inIndex, &ffi.clone[ffi.cloneNumber-1].flag, core) + } else { + ff.cFunction(ff.Parameters, ffi.inIndex, &ffi.clone[ffi.cloneNumber-1].flag, 0) } }() if ff.fType == segmentCopy || ff.fType == fastGenerate || ff.fType == generate { @@ -297,7 +306,9 @@ func (ff *flowFunction) stopClone(ffi *instance, scheduler *scheduler) { runtime.Gosched() } } - scheduler.setCoreByIndex(ffi.clone[ffi.cloneNumber-1].index) + if ffi.ff.fType != comboKNI { + scheduler.setCoreByIndex(ffi.clone[ffi.cloneNumber-1].index) + } ffi.clone = ffi.clone[:len(ffi.clone)-1] ffi.cloneNumber-- ffi.removed = true diff --git a/low/low.go b/low/low.go index 38449710..ba60d49f 100644 --- a/low/low.go +++ b/low/low.go @@ -454,15 +454,22 @@ func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int C.receiveRSS(C.uint16_t(port), (*C.int32_t)(unsafe.Pointer(&(inIndex[0]))), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(OUT[0]))), C.int32_t(len(OUT))), (*C.int)(unsafe.Pointer(flag)), C.int(coreID)) } -// ReceiveKNI - get packets from Linux core and enqueue on a Ring. -func ReceiveKNI(port uint16, OUT *Ring, flag *int32, coreID int) { - C.receiveKNI(C.uint16_t(port), OUT.DPDK_ring, (*C.int)(unsafe.Pointer(flag)), C.int(coreID)) +func SrKNI(port uint16, flag *int32, coreID int, recv bool, OUT Rings, send bool, IN Rings) { + var nOut *C.struct_rte_ring + var nIn **C.struct_rte_ring + if OUT != nil { + nOut = OUT[0].DPDK_ring + } + if IN != nil { + nIn = C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(IN[0]))), C.int32_t(len(IN))) + } + C.nff_go_KNI(C.uint16_t(port), (*C.int)(unsafe.Pointer(flag)), C.int(coreID), + C.bool(recv), nOut, C.bool(send), nIn, C.int32_t(len(IN))) } // Send - dequeue packets and send. -func Send(port uint16, queue int16, IN Rings, inIndexNumber int32, flag *int32, coreID int) { - t := C.rte_eth_dev_socket_id(C.uint16_t(port)) - if queue != -1 && t != C.int(C.rte_lcore_to_socket_id(C.uint(coreID))) { +func Send(port uint16, queue int16, IN Rings, flag *int32, coreID int) { + if C.rte_eth_dev_socket_id(C.uint16_t(port)) != C.int(C.rte_lcore_to_socket_id(C.uint(coreID))) { common.LogWarning(common.Initialization, "Send port", port, "is on remote NUMA node to polling thread - not optimal performance.") } C.nff_go_send(C.uint16_t(port), C.int16_t(queue), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(IN[0]))), C.int32_t(len(IN))), C.int32_t(len(IN)), (*C.int)(unsafe.Pointer(flag)), C.int(coreID)) diff --git a/low/low.h b/low/low.h index 360e3868..d1020a72 100644 --- a/low/low.h +++ b/low/low.h @@ -357,27 +357,38 @@ void receiveRSS(uint16_t port, volatile int32_t *inIndex, struct rte_ring **out_ *flag = wasStopped; } -void receiveKNI(uint16_t port, struct rte_ring *out_ring, volatile int *flag, int coreId) { +void nff_go_KNI(uint16_t port, volatile int *flag, int coreId, + bool recv, struct rte_ring *out_ring, + bool send, struct rte_ring **in_rings, int32_t inIndexNumber) { setAffinity(coreId); struct rte_mbuf *bufs[BURST_SIZE]; + int q = 0; REASSEMBLY_INIT - while (*flag == process) { - // Get packets from KNI - uint16_t rx_pkts_number = rte_kni_rx_burst(kni[port], bufs, BURST_SIZE); - rte_kni_handle_request(kni[port]); - if (unlikely(rx_pkts_number == 0)) { - continue; + if (recv == true) { + // Get packets from KNI + uint16_t rx_pkts_number = rte_kni_rx_burst(kni[port], bufs, BURST_SIZE); + rte_kni_handle_request(kni[port]); + if (likely(rx_pkts_number != 0)) { + rx_pkts_number = handleReceived(bufs, rx_pkts_number, tbl, pdeath_row); + uint16_t pushed_pkts_number = rte_ring_enqueue_burst(out_ring, (void*)bufs, rx_pkts_number, NULL); + // Free any packets which can't be pushed to the ring. The ring is probably full. + handleUnpushed(bufs, pushed_pkts_number, rx_pkts_number); + } + } + if (send == true) { + (q == inIndexNumber - 1) ? q = 0 : q++; + // Get packets for TX from ring + uint16_t pkts_for_tx_number = rte_ring_mc_dequeue_burst(in_rings[q], (void*)bufs, BURST_SIZE, NULL); + if (likely(pkts_for_tx_number != 0)) { + uint16_t tx_pkts_number = rte_kni_tx_burst(kni[port], bufs, pkts_for_tx_number); + // Free any unsent packets + handleUnpushed(bufs, tx_pkts_number, pkts_for_tx_number); + } } - rx_pkts_number = handleReceived(bufs, rx_pkts_number, tbl, pdeath_row); - - uint16_t pushed_pkts_number = rte_ring_enqueue_burst(out_ring, (void*)bufs, rx_pkts_number, NULL); - // Free any packets which can't be pushed to the ring. The ring is probably full. - handleUnpushed(bufs, pushed_pkts_number, rx_pkts_number); -#ifdef DEBUG - receive_received += rx_pkts_number; - receive_pushed += pushed_pkts_number; -#endif + } + if (in_rings != NULL) { + free(in_rings); } *flag = wasStopped; } @@ -396,12 +407,7 @@ void nff_go_send(uint16_t port, int16_t queue, struct rte_ring **in_rings, int32 if (unlikely(pkts_for_tx_number == 0)) continue; - if (queue != -1) { - tx_pkts_number = rte_eth_tx_burst(port, queue, bufs, pkts_for_tx_number); - } else { - // if queue == "-1" this means that this send is to KNI device - tx_pkts_number = rte_kni_tx_burst(kni[port], bufs, pkts_for_tx_number); - } + tx_pkts_number = rte_eth_tx_burst(port, queue, bufs, pkts_for_tx_number); // Free any unsent packets handleUnpushed(bufs, tx_pkts_number, pkts_for_tx_number); #ifdef DEBUG From 5e89dcfe65abf6e0c19b3774189a8dcc00eef67c Mon Sep 17 00:00:00 2001 From: Ben Krieger Date: Tue, 11 Dec 2018 10:34:51 -0500 Subject: [PATCH 02/20] flow: Add GetPortByName and GetNameByPort Added GetPortByName and GetNameByPort to the flow package. Underlying functions in low are simple C wrappers to rte_eth_dev_get_port_by_name and rte_eth_dev_get_name_by_port. The addition of GetPortByName allows the user to determine the MAC address of a device with a DPDK-compatible driver bound without prior knowledge of the port number assigned by DPDK/EAL. Signed-off-by: Ben Krieger --- flow/flow.go | 19 +++++++++++++++++++ low/low.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/flow/flow.go b/flow/flow.go index d512f735..2e640af5 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -974,6 +974,25 @@ func GetPortMACAddress(port uint16) [common.EtherAddrLen]uint8 { return low.GetPortMACAddress(port) } +// GetPortByName gets the port id from device name. The device name should be +// specified as below: +// +// - PCIe address (Domain:Bus:Device.Function), for example- 0000:2:00.0 +// - SoC device name, for example- fsl-gmac0 +// - vdev dpdk name, for example- net_[pcap0|null0|tap0] +func GetPortByName(name string) (uint16, error) { + return low.GetPortByName(name) +} + +// GetNameByPort gets the device name from port id. The device name is specified as below: +// +// - PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0 +// - SoC device name, for example- fsl-gmac0 +// - vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0] +func GetNameByPort(port uint16) (string, error) { + return low.GetNameByPort(port) +} + // SetIPForPort sets IP for specified port if it was created. Not thread safe. // Return error if requested port isn't exist or wasn't previously requested. func SetIPForPort(port uint16, ip uint32) error { diff --git a/low/low.go b/low/low.go index ba60d49f..fb1e0872 100644 --- a/low/low.go +++ b/low/low.go @@ -87,6 +87,48 @@ func GetPortMACAddress(port uint16) [common.EtherAddrLen]uint8 { return mac } +// GetPortByName gets the port id from device name. The device name should be +// specified as below: +// +// - PCIe address (Domain:Bus:Device.Function), for example- 0000:2:00.0 +// - SoC device name, for example- fsl-gmac0 +// - vdev dpdk name, for example- net_[pcap0|null0|tap0] +func GetPortByName(name string) (uint16, error) { + var port C.uint16_t + ret := C.rte_eth_dev_get_port_by_name(C.CString(name), &port) + switch ret { + case 0: + return uint16(port), nil + case -C.ENODEV, -C.EINVAL: + msg := common.LogError(common.Debug, + "GetPortByName cannot find device: no such device") + return 0, common.WrapWithNFError(nil, msg, common.BadArgument) + default: + msg := common.LogError(common.Debug, "GetPortByName got an unknown error") + return 0, common.WrapWithNFError(nil, msg, common.Fail) + } +} + +// GetNameByPort gets the device name from port id. The device name is specified as below: +// +// - PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0 +// - SoC device name, for example- fsl-gmac0 +// - vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0] +func GetNameByPort(port uint16) (string, error) { + s := make([]C.char, C.RTE_ETH_NAME_MAX_LEN) + ret := C.rte_eth_dev_get_name_by_port(C.uint16_t(port), &s[0]) + switch ret { + case 0: + return C.GoString(&s[0]), nil + case -C.EINVAL: + msg := common.LogError(common.Debug, "GetNameByPort cannot find port") + return "", common.WrapWithNFError(nil, msg, common.BadArgument) + default: + msg := common.LogError(common.Debug, "GetNameByPort got an unknown error") + return "", common.WrapWithNFError(nil, msg, common.Fail) + } +} + // GetPacketDataStartPointer returns the pointer to the // beginning of packet. func GetPacketDataStartPointer(mb *Mbuf) uintptr { From e2e583c6a015ecabb680a1d6a6130a73cb9c6e13 Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Fri, 14 Dec 2018 13:56:50 -0800 Subject: [PATCH 03/20] Fixed printf format --- low/low.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/low/low.h b/low/low.h index d1020a72..0d893269 100644 --- a/low/low.h +++ b/low/low.h @@ -478,12 +478,12 @@ void statistics(float N) { fprintf(stderr, "DEBUG: Current speed of all receives: received %.0f Mbits/s, pushed %.0f Mbits/s\n", (receive_received/N) * multiplier, (receive_pushed/N) * multiplier); if (receive_pushed < receive_received) { - fprintf(stderr, "DROP: Receive dropped %d packets\n", receive_received - receive_pushed); + fprintf(stderr, "DROP: Receive dropped %ld packets\n", receive_received - receive_pushed); } fprintf(stderr, "DEBUG: Current speed of all sends: required %.0f Mbits/s, sent %.0f Mbits/s\n", (send_required/N) * multiplier, (send_sent/N) * multiplier); if (send_sent < send_required) { - fprintf(stderr, "DROP: Send dropped %d packets\n", send_required - send_sent); + fprintf(stderr, "DROP: Send dropped %ld packets\n", send_required - send_sent); } fprintf(stderr, "DEBUG: Current speed of stop ring: freed %.0f Mbits/s\n", (stop_freed/N) * multiplier); // Yes, there can be race conditions here. However in practise they are rare and it is more From 165d92177d6b20bc685a06604c947cab319f0b4d Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Fri, 14 Dec 2018 14:14:27 -0800 Subject: [PATCH 04/20] Fixed GTP IPv4 header checksum --- examples/gtpu.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gtpu.go b/examples/gtpu.go index b8e240f3..b59f4dd7 100644 --- a/examples/gtpu.go +++ b/examples/gtpu.go @@ -80,7 +80,7 @@ func encap(current *packet.Packet, context flow.UserContext) bool { ipv4.NextProtoID = common.UDPNumber ipv4.SrcAddr = packet.BytesToIPv4(11, 22, 33, 44) ipv4.DstAddr = packet.BytesToIPv4(55, 66, 77, 88) - ipv4.HdrChecksum = packet.CalculateIPv4Checksum(ipv4) + ipv4.HdrChecksum = packet.SwapBytesUint16(packet.CalculateIPv4Checksum(ipv4)) current.ParseL4ForIPv4() udp := current.GetUDPNoCheck() From 4a064e4abc487da2aa63fc0a48fa2038a861d5aa Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Sat, 15 Dec 2018 07:28:25 -0600 Subject: [PATCH 05/20] Test system: add waiting for pktgen to get started Fixes "connection reset by peer" error --- test/framework/dockerlauncher.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/framework/dockerlauncher.go b/test/framework/dockerlauncher.go index 1889eea1..1ee83607 100644 --- a/test/framework/dockerlauncher.go +++ b/test/framework/dockerlauncher.go @@ -271,6 +271,11 @@ func (app *RunningApp) testPktgenRoutine(report chan<- TestReport, done <-chan s return false } + // We need to wait a little bit, because connection will be active + // even if pktgen hasn't launch yet (Docker opens port in advance). + // This will lead to "connection reset by peer" error at read stage. + time.Sleep(5 * time.Second) + // First try to connect to pktgen ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() From 615074b7825553c9785ae5140b69a15eca603c40 Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Sat, 15 Dec 2018 07:33:27 -0600 Subject: [PATCH 06/20] Introduce first (primitive) perf_gen packet generator. Pktgen has several issues so replaced it at "generate" stage to our own perf_gen. Additional features will be added to perf_gen later. --- test/framework/main/perf.json | 990 ++++++++++------------------------ test/performance/.gitignore | 1 + test/performance/Dockerfile | 1 + test/performance/Makefile | 2 +- test/performance/perf_gen.go | 68 +++ 5 files changed, 341 insertions(+), 721 deletions(-) create mode 100644 test/performance/perf_gen.go diff --git a/test/framework/main/perf.json b/test/framework/main/perf.json index d5fb564f..7ec9aad4 100644 --- a/test/framework/main/perf.json +++ b/test/framework/main/perf.json @@ -26,10 +26,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -48,11 +48,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -63,10 +58,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -85,11 +80,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -100,10 +90,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -122,11 +112,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -137,10 +122,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -159,11 +144,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -174,10 +154,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -196,11 +176,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -211,10 +186,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -233,11 +208,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -248,10 +218,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -270,11 +240,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -285,10 +250,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -307,11 +272,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -322,10 +282,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -344,11 +304,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -359,10 +314,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -381,11 +336,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -396,10 +346,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -418,11 +368,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -433,10 +378,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -455,11 +400,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -470,10 +410,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -492,11 +432,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -507,10 +442,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -529,11 +464,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -544,10 +474,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -566,11 +496,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -581,10 +506,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -603,11 +528,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -618,10 +538,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -640,11 +560,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -655,10 +570,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -677,11 +592,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -692,10 +602,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -714,11 +624,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -729,10 +634,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -751,11 +656,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -766,10 +666,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -788,11 +688,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -803,10 +698,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -825,11 +720,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -840,10 +730,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -862,11 +752,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -877,10 +762,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -899,11 +784,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -914,10 +794,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -936,11 +816,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -951,10 +826,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -973,11 +848,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -988,10 +858,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1010,11 +880,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1025,10 +890,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1047,11 +912,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1062,10 +922,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1084,11 +944,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1099,10 +954,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1121,11 +976,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1136,10 +986,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -1158,11 +1008,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1173,10 +1018,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -1195,11 +1040,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -1210,10 +1050,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -1232,11 +1072,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1247,10 +1082,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -1269,11 +1104,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -1284,10 +1114,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1306,11 +1136,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1321,10 +1146,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1343,11 +1168,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1358,10 +1178,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1380,11 +1200,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1395,10 +1210,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1417,11 +1232,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1432,10 +1242,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -1454,11 +1264,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1469,10 +1274,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -1491,11 +1296,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -1506,10 +1306,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -1528,11 +1328,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1543,10 +1338,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -1565,11 +1360,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -1580,10 +1370,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1602,11 +1392,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1617,10 +1402,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1639,11 +1424,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1654,10 +1434,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1676,11 +1456,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1691,10 +1466,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1713,11 +1488,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1728,10 +1498,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -1750,11 +1520,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1765,10 +1530,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -1787,11 +1552,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -1802,10 +1562,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -1824,11 +1584,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1839,10 +1594,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -1861,11 +1616,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -1876,10 +1626,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1898,11 +1648,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1913,10 +1658,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -1935,11 +1680,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -1950,10 +1690,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -1972,11 +1712,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -1987,10 +1722,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2009,11 +1744,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2024,10 +1754,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2046,11 +1776,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2061,10 +1786,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2083,11 +1808,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2098,10 +1818,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -2120,11 +1840,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2135,10 +1850,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -2157,11 +1872,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2172,10 +1882,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -2194,11 +1904,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2209,10 +1914,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -2231,11 +1936,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2246,10 +1946,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2268,11 +1968,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2283,10 +1978,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2305,11 +2000,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2320,10 +2010,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2342,11 +2032,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2357,10 +2042,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2379,11 +2064,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2394,10 +2074,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -2416,11 +2096,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2431,10 +2106,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -2453,11 +2128,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2468,10 +2138,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -2490,11 +2160,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2505,10 +2170,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -2527,11 +2192,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2542,10 +2202,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2564,11 +2224,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2579,10 +2234,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2601,11 +2256,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2616,10 +2266,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2638,11 +2288,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2653,10 +2298,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2675,11 +2320,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2690,10 +2330,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -2712,11 +2352,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2727,10 +2362,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -2749,11 +2384,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2764,10 +2394,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -2786,11 +2416,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2801,10 +2426,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -2823,11 +2448,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2838,10 +2458,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2860,11 +2480,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2875,10 +2490,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -2897,11 +2512,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -2912,10 +2522,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2934,11 +2544,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -2949,10 +2554,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -2971,11 +2576,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -2986,10 +2586,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -3008,11 +2608,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -3023,10 +2618,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -3045,11 +2640,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -3060,10 +2650,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -3082,11 +2672,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -3097,10 +2682,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "64", "-v", "28000" ] }, { @@ -3119,11 +2704,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 64);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -3134,10 +2714,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -3156,11 +2736,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -3171,10 +2746,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "128" ] }, { @@ -3193,11 +2768,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 128);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 60000000000, "measure-for": 35000000000 } @@ -3208,10 +2778,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -3230,11 +2800,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -3245,10 +2810,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "256" ] }, { @@ -3267,11 +2832,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 256);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } @@ -3282,10 +2842,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -3304,11 +2864,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 15000000000, "measure-for": 15000000000 } @@ -3319,10 +2874,10 @@ "test-type": "TestTypeBenchmark", "test-apps": [ { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppGo", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_gen", "-s", "1514" ] }, { @@ -3341,11 +2896,6 @@ } ], "benchmarking-settings": { - "pktgen-startup-commands": [ - "pktgen.pkt_size(\"0\", \"start\", 1518);", - "pktgen.set_range(\"0\", \"on\");", - "pktgen.start(0);" - ], "measure-after": 40000000000, "measure-for": 25000000000 } diff --git a/test/performance/.gitignore b/test/performance/.gitignore index c64b4062..ada3ee4e 100644 --- a/test/performance/.gitignore +++ b/test/performance/.gitignore @@ -3,3 +3,4 @@ perf_main perf_seq ipsec latency +perf_gen diff --git a/test/performance/Dockerfile b/test/performance/Dockerfile index b571bc4e..ca34750a 100644 --- a/test/performance/Dockerfile +++ b/test/performance/Dockerfile @@ -13,3 +13,4 @@ COPY perf_main . COPY perf_seq . COPY ipsec . COPY latency . +COPY perf_gen . diff --git a/test/performance/Makefile b/test/performance/Makefile index 796ff3e9..d906cf79 100644 --- a/test/performance/Makefile +++ b/test/performance/Makefile @@ -4,6 +4,6 @@ PATH_TO_MK = ../../mk IMAGENAME = nff-go-performance -EXECUTABLES = perf_light perf_main perf_seq ipsec latency +EXECUTABLES = perf_light perf_main perf_seq ipsec latency perf_gen include $(PATH_TO_MK)/leaf.mk diff --git a/test/performance/perf_gen.go b/test/performance/perf_gen.go new file mode 100644 index 00000000..3b7703c9 --- /dev/null +++ b/test/performance/perf_gen.go @@ -0,0 +1,68 @@ +// Copyright 2017 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "flag" + "github.com/intel-go/nff-go/flow" + "github.com/intel-go/nff-go/packet" + . "github.com/intel-go/nff-go/common" +) + +var size uint +var speed uint + +type ctx struct { + r uint16 +} + +func (c ctx) Copy() interface{} { + n := new(ctx) + n.r = 20 + return n +} + +func (c ctx) Delete() { +} + + +func main() { + flag.UintVar(&size, "s", 64, "size of packets") + flag.UintVar(&speed, "v", 40000, "speed of generation") + flag.Parse() + + pkts := uint64(speed * 1000 * 1000 / 8 / (size + 20)) + size = size - EtherLen - IPv4MinLen - TCPMinLen + + flow.SystemInit(nil) + + a, _ := flow.SetFastGenerator(generatePacket, pkts / 2, *new(ctx)) + b, _ := flow.SetFastGenerator(generatePacket, pkts / 2, *new(ctx)) + + flow.SetSender(a, 0) + flow.SetSender(b, 0) + + flow.SystemStart() +} + +// Function to use in generator +func generatePacket(pkt *packet.Packet, context flow.UserContext) { + ctx1 := context.(*ctx) + r := ctx1.r + packet.InitEmptyIPv4TCPPacket(pkt, size) + ipv4 := pkt.GetIPv4() + tcp := pkt.GetTCPForIPv4() + + ipv4.DstAddr = packet.SwapBytesUint32(uint32(r)) + ipv4.SrcAddr = packet.SwapBytesUint32(uint32(r + 15)) + + tcp.DstPort = packet.SwapBytesUint16(r + 25) + tcp.SrcPort = packet.SwapBytesUint16(r + 35) + + ctx1.r++ + if ctx1.r > 259 { + ctx1.r = 20 + } +} From e1d76ab83a775da859cf95800f518e920cd3a687 Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Sat, 15 Dec 2018 07:44:08 -0600 Subject: [PATCH 07/20] Build fix: proxies, pciutils --- nff-go-base/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nff-go-base/Makefile b/nff-go-base/Makefile index bfb71af5..edd6f658 100644 --- a/nff-go-base/Makefile +++ b/nff-go-base/Makefile @@ -14,8 +14,7 @@ Fedora: Makefile echo 'FROM fedora' >> Dockerfile if [ -n '${http_proxy}' ]; then \ echo 'ENV http_proxy ${http_proxy}' >> Dockerfile; \ - echo 'ENV https_proxy ${http_proxy}' >> Dockerfile; \ - echo 'RUN echo proxy=${http_proxy} >> /etc/dnf/dnf.conf' >> Dockerfile; \ + echo 'ENV https_proxy ${https_proxy}' >> Dockerfile; \ echo 'RUN echo proxy=${http_proxy} >> /etc/dnf/dnf.conf' >> Dockerfile; \ fi echo 'RUN dnf -y install numactl-libs.x86_64; dnf clean all' >> Dockerfile @@ -26,11 +25,11 @@ Dockerfile: Makefile echo 'FROM ubuntu:cosmic' >> Dockerfile if [ -n '${http_proxy}' ]; then \ echo 'ENV http_proxy ${http_proxy}' >> Dockerfile; \ - echo 'ENV https_proxy ${http_proxy}' >> Dockerfile; \ + echo 'ENV https_proxy ${https_proxy}' >> Dockerfile; \ echo 'RUN echo Acquire::http::Proxy \"${http_proxy}\"\; >> /etc/apt/apt.conf' >> Dockerfile; \ echo 'RUN echo Acquire::https::Proxy \"${https_proxy}\"\; >> /etc/apt/apt.conf' >> Dockerfile; \ fi - echo 'RUN apt-get update; apt-get install -y libnuma-dev; apt-get install -y libpcap0.8-dev; apt-get install -y liblua5.3-dev; apt-get clean all' >> Dockerfile + echo 'RUN apt-get update; apt-get install -y pciutils; apt-get install -y libnuma-dev; apt-get install -y libpcap0.8-dev; apt-get install -y liblua5.3-dev; apt-get clean all' >> Dockerfile echo 'CMD ["/bin/bash"]' >> Dockerfile .PHONY: dpdk From 6280802361c0b3883fd0a0bb90ee393cd4d81c3b Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Mon, 17 Dec 2018 09:40:19 -0600 Subject: [PATCH 08/20] Make Pktgen delay configurable --- test/framework/config.go | 3 +++ test/framework/dockerlauncher.go | 2 +- test/framework/main/perf.json | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/framework/config.go b/test/framework/config.go index 697eb178..f13c9746 100644 --- a/test/framework/config.go +++ b/test/framework/config.go @@ -97,6 +97,9 @@ type DockerConfig struct { // Network socket port to be used to communicate with pktgen // program. Usually 22022. PktgenPort int `json:"pktgen-port"` + // Delay in seconds after launching pktgen before first connection + // attempt. + PktgenDelay time.Duration `json:"pktgen-delay"` } // TestsuiteConfig struct has settings which describe diff --git a/test/framework/dockerlauncher.go b/test/framework/dockerlauncher.go index 1ee83607..f32832e2 100644 --- a/test/framework/dockerlauncher.go +++ b/test/framework/dockerlauncher.go @@ -274,7 +274,7 @@ func (app *RunningApp) testPktgenRoutine(report chan<- TestReport, done <-chan s // We need to wait a little bit, because connection will be active // even if pktgen hasn't launch yet (Docker opens port in advance). // This will lead to "connection reset by peer" error at read stage. - time.Sleep(5 * time.Second) + time.Sleep(app.dockerConfig.PktgenDelay * time.Second) // First try to connect to pktgen ticker := time.NewTicker(1 * time.Second) diff --git a/test/framework/main/perf.json b/test/framework/main/perf.json index 7ec9aad4..43f7d42c 100644 --- a/test/framework/main/perf.json +++ b/test/framework/main/perf.json @@ -9,7 +9,8 @@ "/sys/devices/system/node:/sys/devices/system/node", "/dev:/dev" ], - "pktgen-port": 22022 + "pktgen-port": 22022, + "pktgen-delay": 5 }, "variables": { "INPORT1": "0", From 9e01a545101066effc1a436cd4d0d7b426091b27 Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Tue, 18 Dec 2018 08:00:14 -0600 Subject: [PATCH 09/20] Fix merging after exit from segment --- flow/flow.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flow/flow.go b/flow/flow.go index 2e640af5..168fb480 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -1421,6 +1421,12 @@ func merge(from low.Rings, to low.Rings) { if parameters.out != nil && parameters.out[0] == from[0] { parameters.out = to } + case *segmentParameters: + for i := range *parameters.out { + if (*parameters.out)[i][0] == from[0] { + (*parameters.out)[i] = to + } + } } } } From 29e640d58aa086941f07b2e5a3ba18b5197dd52d Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Tue, 18 Dec 2018 09:19:50 -0600 Subject: [PATCH 10/20] Added requirements for pktgen on RedHat based linux distros --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e1dae881..8e0956f2 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,11 @@ Requirements in the DPDK Getting Started Guide for Linux](http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html) for more information. +Additional dependencies are required for pktgen, especially if you are +running RedHat or CentOS Linux distributions. See [this +file](https://git.dpdk.org/apps/pktgen-dpdk/tree/INSTALL.md?h=pktgen-3.5.9&id=d469543f651506a8c9fb7c667a060950c5d92649) +for details. LUA section for RedHat and CentOS is in its end. + After building a DPDK driver with the make command, you must register network cards to work with the DPDK driver, load necessary kernel modules, and bind cards to the modules. See [Compiling the DPDK Target from @@ -111,7 +116,7 @@ in the DPDK Getting Started Guide for Linux for more information. The kernel module, which is required for DPDK user-mode drivers, is built but not installed into kernel directory. You can load it using the full path to the module file: -$GOPATH/src/github.com/intel-go/nff-go/test/dpdk/dpdk-17.08/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko +nff-go/test/dpdk/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko ### Go From e1034dd41e4ba434a388939d08ab2862d3c910fd Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Mon, 17 Dec 2018 13:26:05 -0600 Subject: [PATCH 11/20] Combine sends to one core Idea is that 40GB can be handled only by 2 send queues, however one CPU core can handle both queues, there is no need to use two CPU cores. We can't use two threads at one core, so this commit added support of multiple send queues to one nff_go_send routine. Semantic changes: 1) Multiple SetSenders to one port will be merged to one send. 2) If inIndexNumber = 1 (no scheduler or no RSS) performance can be worse because one send can't handle both send queues without RSS balancing. 3) inIndexNumber > 1 must be even because send simply change send queues 0->1, 1->0. If inIndexNumber is uneven it will lead to reordering. 4) TX_QUEUE_NUMBER defines number of send queues per port. 2 queues in enough for 40GB, however it should be checked at other network cards. --- flow/flow.go | 63 ++++++++++++++++++++++++++++++++++++---------------- low/low.go | 8 +++---- low/low.h | 16 ++++++++++--- 3 files changed, 61 insertions(+), 26 deletions(-) diff --git a/flow/flow.go b/flow/flow.go index 168fb480..340034d8 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -221,16 +221,16 @@ func addFastGenerator(out low.Rings, generateFunction GenerateFunction, } type sendParameters struct { - in low.Rings - queue int16 - port uint16 + in low.Rings + port uint16 + anyway bool } -func addSender(port uint16, queue int16, in low.Rings, inIndexNumber int32) { +func addSender(port uint16, in low.Rings, inIndexNumber int32) { par := new(sendParameters) par.port = port - par.queue = queue par.in = in + par.anyway = schedState.anyway schedState.addFF("sender", nil, send, nil, par, nil, sendReceiveKNI, inIndexNumber) } @@ -386,13 +386,13 @@ var hwtxchecksum bool type port struct { wasRequested bool // has user requested any send/receive operations at this port - txQueuesNumber int16 willReceive bool // will this port receive packets willKNI bool // will this port has assigned KNI device KNICoreIndex int port uint16 MAC [common.EtherAddrLen]uint8 InIndex int32 + sendRings low.Rings } // Config is a struct with all parameters, which user can pass to NFF-GO library @@ -527,6 +527,9 @@ func SystemInit(args *Config) error { maxInIndex = 1 } if args.MaxInIndex != 0 { + if args.MaxInIndex > 1 && args.MaxInIndex % 2 != 0 { + return common.WrapWithNFError(nil, "MaxInIndex should be 1 or even", common.Fail) + } maxInIndex = args.MaxInIndex } @@ -575,7 +578,7 @@ func SystemInitPortsAndMemory() error { for i := range createdPorts { if createdPorts[i].wasRequested { if err := low.CreatePort(createdPorts[i].port, createdPorts[i].willReceive, - uint16(createdPorts[i].txQueuesNumber), true, hwtxchecksum, createdPorts[i].InIndex); err != nil { + true, hwtxchecksum, createdPorts[i].InIndex); err != nil { return err } } @@ -623,8 +626,8 @@ func SystemStop() error { if createdPorts[i].wasRequested { low.StopPort(createdPorts[i].port) createdPorts[i].wasRequested = false - createdPorts[i].txQueuesNumber = 0 createdPorts[i].willReceive = false + createdPorts[i].sendRings = nil } if createdPorts[i].willKNI { err := low.FreeKNI(createdPorts[i].port) @@ -757,8 +760,26 @@ func SetSender(IN *Flow, portId uint16) error { return common.WrapWithNFError(nil, "Requested send port exceeds number of ports which can be used by DPDK (bind to DPDK).", common.ReqTooManyPorts) } createdPorts[portId].wasRequested = true - addSender(portId, createdPorts[portId].txQueuesNumber, finishFlow(IN), IN.inIndexNumber) - createdPorts[portId].txQueuesNumber++ + if createdPorts[portId].sendRings == nil { + // To allow consequent sends to one port, we need to create a send ring + // for the first, and then all the consequent sends should be merged + // with already created send ring. + // We need send rings with max possible number of connection groups, + // to be able to merge all the consequent sends, so we set max to + // the max value from all the ports. + var max int32 + for i := range createdPorts { + if createdPorts[i].InIndex > max { + max = createdPorts[i].InIndex + } + } + createdPorts[portId].sendRings = low.CreateRings(burstSize*sizeMultiplier, max) + addSender(portId, createdPorts[portId].sendRings, IN.inIndexNumber) + } + // For a typical 40 GB card, like Intel 710 series, one core should be able + // to handle all the TX without problems. So we merged all income flows to created + // ring which will be send. + mergeOneFlow(IN, createdPorts[portId].sendRings) return nil } @@ -957,18 +978,22 @@ func SetMerger(InArray ...*Flow) (OUT *Flow, err error) { if err := checkFlow(InArray[i]); err != nil { return nil, err } - if InArray[i].segment == nil { - merge(InArray[i].current, rings) - closeFlow(InArray[i]) - } else { - // TODO merge finishes segment even if this is merge inside it. Need to optimize. - ms := makeSlice(rings, InArray[i].segment) - segmentInsert(InArray[i], ms, true, nil, 0, 0) - } + mergeOneFlow(InArray[i], rings) } return newFlow(rings, max), nil } +func mergeOneFlow(IN *Flow, rings low.Rings) { + if IN.segment == nil { + merge(IN.current, rings) + closeFlow(IN) + } else { + // TODO merge finishes segment even if this is merge inside it. Need to optimize. + ms := makeSlice(rings, IN.segment) + segmentInsert(IN, ms, true, nil, 0, 0) + } +} + // GetPortMACAddress returns default MAC address of an Ethernet port. func GetPortMACAddress(port uint16) [common.EtherAddrLen]uint8 { return low.GetPortMACAddress(port) @@ -1386,7 +1411,7 @@ func pcopy(parameters interface{}, inIndex []int32, stopper [2]chan int, report func send(parameters interface{}, inIndex []int32, flag *int32, coreID int) { srp := parameters.(*sendParameters) - low.Send(srp.port, srp.queue, srp.in, flag, coreID) + low.Send(srp.port, srp.in, srp.anyway, flag, coreID) } func merge(from low.Rings, to low.Rings) { diff --git a/low/low.go b/low/low.go index fb1e0872..a01ec8f5 100644 --- a/low/low.go +++ b/low/low.go @@ -510,11 +510,11 @@ func SrKNI(port uint16, flag *int32, coreID int, recv bool, OUT Rings, send bool } // Send - dequeue packets and send. -func Send(port uint16, queue int16, IN Rings, flag *int32, coreID int) { +func Send(port uint16, IN Rings, anyway bool, flag *int32, coreID int) { if C.rte_eth_dev_socket_id(C.uint16_t(port)) != C.int(C.rte_lcore_to_socket_id(C.uint(coreID))) { common.LogWarning(common.Initialization, "Send port", port, "is on remote NUMA node to polling thread - not optimal performance.") } - C.nff_go_send(C.uint16_t(port), C.int16_t(queue), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(IN[0]))), C.int32_t(len(IN))), C.int32_t(len(IN)), (*C.int)(unsafe.Pointer(flag)), C.int(coreID)) + C.nff_go_send(C.uint16_t(port), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(IN[0]))), C.int32_t(len(IN))), C.int32_t(len(IN)), C.bool(anyway), (*C.int)(unsafe.Pointer(flag)), C.int(coreID)) } // Stop - dequeue and free packets. @@ -581,7 +581,7 @@ func CheckPortRSS(port uint16) int32 { } // CreatePort initializes a new port using global settings and parameters. -func CreatePort(port uint16, willReceive bool, sendQueuesNumber uint16, promiscuous bool, hwtxchecksum bool, inIndex int32) error { +func CreatePort(port uint16, willReceive bool, promiscuous bool, hwtxchecksum bool, inIndex int32) error { var mempools **C.struct_rte_mempool if willReceive { m := CreateMempools("receive", inIndex) @@ -589,7 +589,7 @@ func CreatePort(port uint16, willReceive bool, sendQueuesNumber uint16, promiscu } else { mempools = nil } - if C.port_init(C.uint16_t(port), C.bool(willReceive), C.uint16_t(sendQueuesNumber), + if C.port_init(C.uint16_t(port), C.bool(willReceive), mempools, C._Bool(promiscuous), C._Bool(hwtxchecksum), C.int32_t(inIndex)) != 0 { msg := common.LogError(common.Initialization, "Cannot init port ", port, "!") return common.WrapWithNFError(nil, msg, common.FailToInitPort) diff --git a/low/low.h b/low/low.h index 0d893269..bcc679f6 100644 --- a/low/low.h +++ b/low/low.h @@ -27,6 +27,10 @@ #define RX_RING_SIZE 128 #define TX_RING_SIZE 512 +// 2 queues are enough for handling 40GBits. Should be checked for other NICs. +// TODO This macro should be a function that will dynamically return the needed number of cores. +#define TX_QUEUE_NUMBER 2 + #define APP_RETA_SIZE_MAX (ETH_RSS_RETA_SIZE_512 / RTE_RETA_GROUP_SIZE) // #define DEBUG @@ -167,8 +171,8 @@ int check_port_rss(uint16_t port) { // Initializes a given port using global settings and with the RX buffers // coming from the mbuf_pool passed as a parameter. -int port_init(uint16_t port, bool willReceive, uint16_t sendQueuesNumber, struct rte_mempool **mbuf_pools, bool promiscuous, bool hwtxchecksum, int32_t inIndex) { - uint16_t rx_rings, tx_rings = sendQueuesNumber; +int port_init(uint16_t port, bool willReceive, struct rte_mempool **mbuf_pools, bool promiscuous, bool hwtxchecksum, int32_t inIndex) { + uint16_t rx_rings, tx_rings = TX_QUEUE_NUMBER; struct rte_eth_dev_info dev_info; memset(&dev_info, 0, sizeof(dev_info)); @@ -393,12 +397,13 @@ void nff_go_KNI(uint16_t port, volatile int *flag, int coreId, *flag = wasStopped; } -void nff_go_send(uint16_t port, int16_t queue, struct rte_ring **in_rings, int32_t inIndexNumber, volatile int *flag, int coreId) { +void nff_go_send(uint16_t port, struct rte_ring **in_rings, int32_t inIndexNumber, bool anyway, volatile int *flag, int coreId) { setAffinity(coreId); struct rte_mbuf *bufs[BURST_SIZE]; uint16_t buf; uint16_t tx_pkts_number; + int16_t queue = 0; while (*flag == process) { for (int q = 0; q < inIndexNumber; q++) { // Get packets for TX from ring @@ -408,6 +413,11 @@ void nff_go_send(uint16_t port, int16_t queue, struct rte_ring **in_rings, int32 continue; tx_pkts_number = rte_eth_tx_burst(port, queue, bufs, pkts_for_tx_number); + // inIndexNumber must be "1" or even. This prevents any reordering. + // anyway allows reordering explicitly + if (anyway || inIndexNumber > 1) { + queue = !queue; + } // Free any unsent packets handleUnpushed(bufs, tx_pkts_number, pkts_for_tx_number); #ifdef DEBUG From 43156937c2df06ca3b8392890e84086e5c0e7193 Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Tue, 18 Dec 2018 14:09:37 -0600 Subject: [PATCH 12/20] Remove SetPartitioner and second SetSender Now one send can achieve enough speed automatically - so remove this stuff. --- examples/gopacketParserExample.go | 10 +- examples/sendFixedPktsNumber.go | 3 - test/framework/main/perf.json | 183 +++++++++++++++--------------- test/performance/latency.go | 3 - test/performance/perf_light.go | 10 +- test/performance/perf_main.go | 10 +- test/performance/perf_seq.go | 9 +- 7 files changed, 99 insertions(+), 129 deletions(-) diff --git a/examples/gopacketParserExample.go b/examples/gopacketParserExample.go index 8f690b01..3bc6ed46 100644 --- a/examples/gopacketParserExample.go +++ b/examples/gopacketParserExample.go @@ -20,8 +20,7 @@ var ( func main() { flag.BoolVar(&printOn, "print", false, "enable print of parsed layers") - outport1 := flag.Uint("outport1", 1, "port for 1st sender") - outport2 := flag.Uint("outport2", 1, "port for 2nd sender") + outport := flag.Uint("outport", 1, "port for sender") inport := flag.Uint("inport", 0, "port for receiver") noscheduler := flag.Bool("no-scheduler", false, "disable scheduler") flag.Parse() @@ -40,12 +39,7 @@ func main() { var ctx gopacketContext flow.CheckFatal(flow.SetHandler(firstFlow, gopacketHandleFunc, ctx)) - // Split for two senders and send - secondFlow, err := flow.SetPartitioner(firstFlow, 150, 150) - flow.CheckFatal(err) - - flow.CheckFatal(flow.SetSender(firstFlow, uint16(*outport1))) - flow.CheckFatal(flow.SetSender(secondFlow, uint16(*outport2))) + flow.CheckFatal(flow.SetSender(firstFlow, uint16(*outport))) flow.SystemStart() } diff --git a/examples/sendFixedPktsNumber.go b/examples/sendFixedPktsNumber.go index af616695..5d502bb8 100644 --- a/examples/sendFixedPktsNumber.go +++ b/examples/sendFixedPktsNumber.go @@ -38,12 +38,9 @@ func main() { // With fast generator sent only multiple of burst-size. // f1 := flow.SetFastGenerator(generatePacket, 100, nil) - f2, err := flow.SetPartitioner(f1, 350, 350) - flow.CheckFatal(err) // Send all generated packets to the output flow.CheckFatal(flow.SetSender(f1, uint16(*outport))) - flow.CheckFatal(flow.SetSender(f2, uint16(*outport))) flow.CheckFatal(flow.SystemStart()) } diff --git a/test/framework/main/perf.json b/test/framework/main/perf.json index 43f7d42c..d9c470c9 100644 --- a/test/framework/main/perf.json +++ b/test/framework/main/perf.json @@ -14,8 +14,7 @@ }, "variables": { "INPORT1": "0", - "OUTPORT1_1": "1", - "OUTPORT1_2": "1", + "OUTPORT1": "1", "PKTGENCOREMASK": "0x1ff", "PKTGENPORT": "[1-2:3-4].0", "CORES": "0-43" @@ -37,7 +36,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -69,7 +68,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -101,7 +100,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -133,7 +132,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -165,7 +164,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -197,7 +196,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -229,7 +228,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=1", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=1", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -261,7 +260,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=1", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=1", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -293,7 +292,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=1", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=1", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -325,7 +324,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=1", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=1", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -357,7 +356,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=1", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=1", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -389,7 +388,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=1", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=1", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -421,7 +420,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -453,7 +452,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -485,7 +484,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -517,7 +516,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -549,7 +548,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_light", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -581,7 +580,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_light", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_light", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -613,7 +612,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -645,7 +644,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -677,7 +676,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -709,7 +708,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -741,7 +740,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -773,7 +772,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -805,7 +804,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=50", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -837,7 +836,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=50", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -869,7 +868,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -901,7 +900,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -933,7 +932,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -965,7 +964,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -997,7 +996,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1029,7 +1028,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1061,7 +1060,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=1000", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1093,7 +1092,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=1000", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1125,7 +1124,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1157,7 +1156,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1189,7 +1188,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1221,7 +1220,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1253,7 +1252,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1285,7 +1284,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1317,7 +1316,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=500", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1349,7 +1348,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=500", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1381,7 +1380,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1413,7 +1412,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1445,7 +1444,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1477,7 +1476,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1509,7 +1508,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1541,7 +1540,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1573,7 +1572,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_main", "-load=250", "-loadRW=0", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1605,7 +1604,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_main", "-load=250", "-loadRW=0", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1637,7 +1636,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1669,7 +1668,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1701,7 +1700,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1733,7 +1732,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1765,7 +1764,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1797,7 +1796,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1829,7 +1828,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=250", "-mode=2", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1861,7 +1860,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=250", "-mode=2", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1893,7 +1892,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1925,7 +1924,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -1957,7 +1956,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -1989,7 +1988,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2021,7 +2020,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2053,7 +2052,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2085,7 +2084,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=50", "-mode=3", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2117,7 +2116,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=50", "-mode=3", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2149,7 +2148,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2181,7 +2180,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2213,7 +2212,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2245,7 +2244,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2277,7 +2276,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2309,7 +2308,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2341,7 +2340,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=4", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2373,7 +2372,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=4", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2405,7 +2404,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2437,7 +2436,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2469,7 +2468,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2501,7 +2500,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2533,7 +2532,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2565,7 +2564,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2597,7 +2596,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2" + "./perf_seq", "-load=25", "-mode=14", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2629,7 +2628,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport1=OUTPORT1_1", "-outport2=OUTPORT1_2", "-cores=CORES" + "./perf_seq", "-load=25", "-mode=14", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2661,7 +2660,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1_1" + "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2693,7 +2692,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1_1", "-cores=CORES" + "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2725,7 +2724,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1_1" + "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2757,7 +2756,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1_1", "-cores=CORES" + "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2789,7 +2788,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1_1" + "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2821,7 +2820,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1_1", "-cores=CORES" + "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { @@ -2853,7 +2852,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1_1" + "./ipsec", "--no-scheduler", "-inport=INPORT1", "-outport=OUTPORT1" ] }, { @@ -2885,7 +2884,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1_1", "-cores=CORES" + "./ipsec", "-inport=INPORT1", "-outport=OUTPORT1", "-cores=CORES" ] }, { diff --git a/test/performance/latency.go b/test/performance/latency.go index 7bd4ea23..5bed3d07 100644 --- a/test/performance/latency.go +++ b/test/performance/latency.go @@ -109,11 +109,8 @@ func main() { // Create packet flow outputFlow, err := flow.SetFastGenerator(generatePackets, speed, nil) flow.CheckFatal(err) - outputFlow2, err := flow.SetPartitioner(outputFlow, 350, 350) - flow.CheckFatal(err) flow.CheckFatal(flow.SetSender(outputFlow, uint16(*outport))) - flow.CheckFatal(flow.SetSender(outputFlow2, uint16(*outport))) // Create receiving flow and set a checking function for it inputFlow, err := flow.SetReceiver(uint16(*inport)) diff --git a/test/performance/perf_light.go b/test/performance/perf_light.go index f0433dd1..67b2a07c 100644 --- a/test/performance/perf_light.go +++ b/test/performance/perf_light.go @@ -14,8 +14,7 @@ import ( func main() { var mode uint flag.UintVar(&mode, "mode", 0, "Benching mode: 0 - empty, 1 - parsing, 2 - parsing, reading, writing") - outport1 := flag.Uint("outport1", 1, "port for 1st sender") - outport2 := flag.Uint("outport2", 1, "port for 2nd sender") + outport := flag.Uint("outport", 1, "port for sender") inport := flag.Uint("inport", 0, "port for receiver") noscheduler := flag.Bool("no-scheduler", false, "disable scheduler") dpdkLogLevel := flag.String("dpdk", "--log-level=0", "Passes an arbitrary argument to dpdk EAL") @@ -43,12 +42,7 @@ func main() { flow.CheckFatal(flow.SetHandler(firstFlow, heavyFunc2, nil)) } - // Split for two senders and send - secondFlow, err := flow.SetPartitioner(firstFlow, 150, 150) - flow.CheckFatal(err) - - flow.CheckFatal(flow.SetSender(firstFlow, uint16(*outport1))) - flow.CheckFatal(flow.SetSender(secondFlow, uint16(*outport2))) + flow.CheckFatal(flow.SetSender(firstFlow, uint16(*outport))) flow.CheckFatal(flow.SystemStart()) } diff --git a/test/performance/perf_main.go b/test/performance/perf_main.go index 2e1527ea..0098a1ce 100644 --- a/test/performance/perf_main.go +++ b/test/performance/perf_main.go @@ -20,8 +20,7 @@ func main() { flag.UintVar(&load, "load", 1000, "Use this for regulating 'load intensity', number of iterations") flag.UintVar(&loadRW, "loadRW", 50, "Use this for regulating 'load read/write intensity', number of iterations") - outport1 := flag.Uint("outport1", 1, "port for 1st sender") - outport2 := flag.Uint("outport2", 1, "port for 2nd sender") + outport := flag.Uint("outport", 1, "port for sender") inport := flag.Uint("inport", 0, "port for receiver") noscheduler := flag.Bool("no-scheduler", false, "disable scheduler") dpdkLogLevel := flag.String("dpdk", "--log-level=0", "Passes an arbitrary argument to dpdk EAL") @@ -43,12 +42,7 @@ func main() { // Handle second flow via some heavy function flow.CheckFatal(flow.SetHandler(firstFlow, heavyFunc, nil)) - // Split for two senders and send - secondFlow, err := flow.SetPartitioner(firstFlow, 150, 150) - flow.CheckFatal(err) - - flow.CheckFatal(flow.SetSender(firstFlow, uint16(*outport1))) - flow.CheckFatal(flow.SetSender(secondFlow, uint16(*outport2))) + flow.CheckFatal(flow.SetSender(firstFlow, uint16(*outport))) flow.CheckFatal(flow.SystemStart()) } diff --git a/test/performance/perf_seq.go b/test/performance/perf_seq.go index 0f17a3e7..06714f6c 100644 --- a/test/performance/perf_seq.go +++ b/test/performance/perf_seq.go @@ -20,8 +20,7 @@ func main() { var mode uint flag.UintVar(&load, "load", 1000, "Use this for regulating 'load intensity', number of iterations") flag.UintVar(&mode, "mode", 2, "Benching mode: 2, 12 - two handles; 3, 13 - tree handles; 4, 14 - four handles. 2,3,4 - one flow; 12,13,14 - two flows") - outport1 := flag.Uint("outport1", 1, "port for 1st sender") - outport2 := flag.Uint("outport2", 1, "port for 2nd sender") + outport := flag.Uint("outport", 1, "port for sender") inport := flag.Uint("inport", 0, "port for receiver") noscheduler := flag.Bool("no-scheduler", false, "disable scheduler") dpdkLogLevel := flag.String("dpdk", "--log-level=0", "Passes an arbitrary argument to dpdk EAL") @@ -71,12 +70,8 @@ func main() { } else { afterFlow = firstFlow } - secondFlow, err := flow.SetPartitioner(afterFlow, 150, 150) - flow.CheckFatal(err) - // Send both flows each one to one port. Queues will be added automatically. - flow.CheckFatal(flow.SetSender(afterFlow, uint16(*outport1))) - flow.CheckFatal(flow.SetSender(secondFlow, uint16(*outport2))) + flow.CheckFatal(flow.SetSender(afterFlow, uint16(*outport))) flow.CheckFatal(flow.SystemStart()) } From 025abf2bfe647846a01676024387573f7767006e Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Wed, 9 Jan 2019 14:25:28 -0600 Subject: [PATCH 13/20] Make receive cloning thread-safe Remove race condition which leads to use one NIC receive queue by multiple threads simultaneously while cloning --- flow/flow.go | 32 +++++++++++++++++++++++++++----- flow/scheduler.go | 4 ++-- low/low.go | 5 +++-- low/low.h | 7 ++++++- 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/flow/flow.go b/flow/flow.go index 340034d8..db3e5ecd 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -146,14 +146,16 @@ type Kni struct { } type receiveParameters struct { - out low.Rings - port *low.Port + out low.Rings + port *low.Port + status []int32 } func addReceiver(portId uint16, out low.Rings, inIndexNumber int32) { par := new(receiveParameters) par.port = low.GetPort(portId) par.out = out + par.status = make([]int32, maxRecv, maxRecv) schedState.addFF("receiver", nil, recvRSS, nil, par, nil, receiveRSS, inIndexNumber) } @@ -354,6 +356,12 @@ const ( HWTXChecksumCapability HWCapability = iota ) +const ( + recvNotUsed int32 = iota + recvNotDone + recvDone +) + // CheckHWCapability return true if hardware offloading capability // present in all ports. Otherwise it returns false. func CheckHWCapability(capa HWCapability, ports []uint16) bool { @@ -383,6 +391,7 @@ const reportMbits = false var sizeMultiplier uint var schedTime uint var hwtxchecksum bool +var maxRecv int type port struct { wasRequested bool // has user requested any send/receive operations at this port @@ -517,9 +526,9 @@ func SystemInit(args *Config) error { } common.SetLogType(logType) - maxRecv := 2 + maxRecv = 2 if args.MaxRecv != 0 { - needKNI = args.MaxRecv + maxRecv = args.MaxRecv } maxInIndex := int32(16) @@ -1235,7 +1244,20 @@ func segmentProcess(parameters interface{}, inIndex []int32, stopper [2]chan int func recvRSS(parameters interface{}, inIndex []int32, flag *int32, coreID int) { srp := parameters.(*receiveParameters) - low.ReceiveRSS(uint16(srp.port.PortId), inIndex, srp.out, flag, coreID) + var index int + for i := 0; i < len(srp.status); i++ { + if !atomic.CompareAndSwapInt32(&srp.status[i], recvDone, recvNotDone) { + index = i + } + } + for i := 0; i < len(srp.status); i++ { + // Need to wait while all receive instances finish current "receive from NIC" operation + // Next "receive from NIC" operation will use new borders without simultaneous access + if atomic.LoadInt32(&srp.status[i]) == recvNotDone { + i-- + } + } + low.ReceiveRSS(uint16(srp.port.PortId), inIndex, srp.out, flag, coreID, &srp.status[index]) } func processKNI(parameters interface{}, inIndex []int32, flag *int32, coreID int) { diff --git a/flow/scheduler.go b/flow/scheduler.go index 37f0ed8b..05222b1c 100644 --- a/flow/scheduler.go +++ b/flow/scheduler.go @@ -745,13 +745,13 @@ func constructZeroIndex(old []int32) []int32 { } func constructDuplicatedIndex(old []int32, newIndex []int32) { - oldLen := old[0]/2 + old[0]%2 + oldLen := old[0] / 2 + old[0]%2 newLen := old[0] / 2 + old[0] = oldLen for q := int32(0); q < newLen; q++ { newIndex[q+1] = old[q+1+oldLen] } newIndex[0] = newLen - old[0] = oldLen } func constructNewIndex(inIndexNumber int32) []int32 { diff --git a/low/low.go b/low/low.go index a01ec8f5..b47cc356 100644 --- a/low/low.go +++ b/low/low.go @@ -489,11 +489,12 @@ func (ring *Ring) GetRingCount() uint32 { } // ReceiveRSS - get packets from port and enqueue on a Ring. -func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int) { +func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int, race *int32) { if C.rte_eth_dev_socket_id(C.uint16_t(port)) != C.int(C.rte_lcore_to_socket_id(C.uint(coreID))) { common.LogWarning(common.Initialization, "Receive port", port, "is on remote NUMA node to polling thread - not optimal performance.") } - C.receiveRSS(C.uint16_t(port), (*C.int32_t)(unsafe.Pointer(&(inIndex[0]))), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(OUT[0]))), C.int32_t(len(OUT))), (*C.int)(unsafe.Pointer(flag)), C.int(coreID)) + C.receiveRSS(C.uint16_t(port), (*C.int32_t)(unsafe.Pointer(&(inIndex[0]))), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(OUT[0]))), C.int32_t(len(OUT))), + (*C.int)(unsafe.Pointer(flag)), C.int(coreID), (*C.int)(unsafe.Pointer(race))) } func SrKNI(port uint16, flag *int32, coreID int, recv bool, OUT Rings, send bool, IN Rings) { diff --git a/low/low.h b/low/low.h index bcc679f6..76a69355 100644 --- a/low/low.h +++ b/low/low.h @@ -36,6 +36,9 @@ // #define DEBUG // #define REASSEMBLY +#define recvNotUsed 0 +#define recvDone 2 + // This macros clears packet structure which is stored inside mbuf // 0 offset is L3 protocol pointer // 8 offset is L4 protocol pointer @@ -335,7 +338,7 @@ static inline struct rte_mbuf* reassemble(struct rte_ip_frag_tbl* tbl, struct rt return buf; } -void receiveRSS(uint16_t port, volatile int32_t *inIndex, struct rte_ring **out_rings, volatile int *flag, int coreId) { +void receiveRSS(uint16_t port, volatile int32_t *inIndex, struct rte_ring **out_rings, volatile int *flag, int coreId, volatile int *race) { setAffinity(coreId); struct rte_mbuf *bufs[BURST_SIZE]; REASSEMBLY_INIT @@ -343,6 +346,7 @@ void receiveRSS(uint16_t port, volatile int32_t *inIndex, struct rte_ring **out_ for (int q = 0; q < inIndex[0]; q++) { // Get packets from port uint16_t rx_pkts_number = rte_eth_rx_burst(port, inIndex[q+1], bufs, BURST_SIZE); + __atomic_store_n(race, recvDone, __ATOMIC_RELAXED); if (unlikely(rx_pkts_number == 0)) { continue; } @@ -358,6 +362,7 @@ void receiveRSS(uint16_t port, volatile int32_t *inIndex, struct rte_ring **out_ } } free(out_rings); + __atomic_store_n(race, recvNotUsed, __ATOMIC_RELAXED); *flag = wasStopped; } From c935181680aee4033f2f1692a2a627e807cb8fd6 Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Thu, 10 Jan 2019 10:46:31 -0600 Subject: [PATCH 14/20] gofmt fixes --- examples/devbind.go | 4 +- flow/flow.go | 40 ++++++++++---------- flow/scheduler.go | 6 +-- low/low.go | 2 +- test/performance/perf_gen.go | 71 ++++++++++++++++++------------------ 5 files changed, 61 insertions(+), 62 deletions(-) diff --git a/examples/devbind.go b/examples/devbind.go index baca580b..a4e708c6 100644 --- a/examples/devbind.go +++ b/examples/devbind.go @@ -1,12 +1,12 @@ package main import ( - "log" "flag" + "log" + "github.com/intel-go/nff-go/devices" "github.com/intel-go/nff-go/flow" "github.com/intel-go/nff-go/packet" - "github.com/intel-go/nff-go/devices" ) // Example that shows how to bind a driver to a NIC diff --git a/flow/flow.go b/flow/flow.go index db3e5ecd..ead77aa0 100644 --- a/flow/flow.go +++ b/flow/flow.go @@ -160,11 +160,11 @@ func addReceiver(portId uint16, out low.Rings, inIndexNumber int32) { } type KNIParameters struct { - in low.Rings - out low.Rings - port *low.Port - recv bool - send bool + in low.Rings + out low.Rings + port *low.Port + recv bool + send bool linuxCore bool } @@ -394,14 +394,14 @@ var hwtxchecksum bool var maxRecv int type port struct { - wasRequested bool // has user requested any send/receive operations at this port - willReceive bool // will this port receive packets - willKNI bool // will this port has assigned KNI device - KNICoreIndex int - port uint16 - MAC [common.EtherAddrLen]uint8 - InIndex int32 - sendRings low.Rings + wasRequested bool // has user requested any send/receive operations at this port + willReceive bool // will this port receive packets + willKNI bool // will this port has assigned KNI device + KNICoreIndex int + port uint16 + MAC [common.EtherAddrLen]uint8 + InIndex int32 + sendRings low.Rings } // Config is a struct with all parameters, which user can pass to NFF-GO library @@ -536,7 +536,7 @@ func SystemInit(args *Config) error { maxInIndex = 1 } if args.MaxInIndex != 0 { - if args.MaxInIndex > 1 && args.MaxInIndex % 2 != 0 { + if args.MaxInIndex > 1 && args.MaxInIndex%2 != 0 { return common.WrapWithNFError(nil, "MaxInIndex should be 1 or even", common.Fail) } maxInIndex = args.MaxInIndex @@ -715,12 +715,12 @@ func SetReceiverKNI(kni *Kni) (OUT *Flow) { // If linuxCore parameter is true function will use core that was assigned // to KNI device in Linux. So all send/receive/device can use one core func SetSenderReceiverKNI(IN *Flow, kni *Kni, linuxCore bool) (OUT *Flow, err error) { - if err := checkFlow(IN); err != nil { - return nil, err - } - rings := low.CreateRings(burstSize*sizeMultiplier, 1) - addKNI(kni.portId, true, rings, true, finishFlow(IN), IN.inIndexNumber, "send-receive KNI", linuxCore) - return newFlow(rings, 1), nil + if err := checkFlow(IN); err != nil { + return nil, err + } + rings := low.CreateRings(burstSize*sizeMultiplier, 1) + addKNI(kni.portId, true, rings, true, finishFlow(IN), IN.inIndexNumber, "send-receive KNI", linuxCore) + return newFlow(rings, 1), nil } // SetFastGenerator adds clonable generate function to flow graph. diff --git a/flow/scheduler.go b/flow/scheduler.go index 05222b1c..5b4a7a05 100644 --- a/flow/scheduler.go +++ b/flow/scheduler.go @@ -101,7 +101,7 @@ const ( sendReceiveKNI // send to port, send to KNI, receive from KNI generate readWrite - comboKNI // KNI send/receive will use core assigned to Linux KNI device + comboKNI // KNI send/receive will use core assigned to Linux KNI device ) // Flow function representation @@ -267,7 +267,7 @@ func (ffi *instance) startNewClone(scheduler *scheduler, n int) (err error) { } ffi.clone = append(ffi.clone, &clonePair{index, [2]chan int{nil, nil}, process}) ffi.cloneNumber++ - if ff.fType != receiveRSS && ff.fType != sendReceiveKNI && ff.fType != comboKNI{ + if ff.fType != receiveRSS && ff.fType != sendReceiveKNI && ff.fType != comboKNI { ffi.clone[ffi.cloneNumber-1].channel[0] = make(chan int) ffi.clone[ffi.cloneNumber-1].channel[1] = make(chan int) } @@ -745,7 +745,7 @@ func constructZeroIndex(old []int32) []int32 { } func constructDuplicatedIndex(old []int32, newIndex []int32) { - oldLen := old[0] / 2 + old[0]%2 + oldLen := old[0]/2 + old[0]%2 newLen := old[0] / 2 old[0] = oldLen for q := int32(0); q < newLen; q++ { diff --git a/low/low.go b/low/low.go index b47cc356..e4fb7ac0 100644 --- a/low/low.go +++ b/low/low.go @@ -494,7 +494,7 @@ func ReceiveRSS(port uint16, inIndex []int32, OUT Rings, flag *int32, coreID int common.LogWarning(common.Initialization, "Receive port", port, "is on remote NUMA node to polling thread - not optimal performance.") } C.receiveRSS(C.uint16_t(port), (*C.int32_t)(unsafe.Pointer(&(inIndex[0]))), C.extractDPDKRings((**C.struct_nff_go_ring)(unsafe.Pointer(&(OUT[0]))), C.int32_t(len(OUT))), - (*C.int)(unsafe.Pointer(flag)), C.int(coreID), (*C.int)(unsafe.Pointer(race))) + (*C.int)(unsafe.Pointer(flag)), C.int(coreID), (*C.int)(unsafe.Pointer(race))) } func SrKNI(port uint16, flag *int32, coreID int, recv bool, OUT Rings, send bool, IN Rings) { diff --git a/test/performance/perf_gen.go b/test/performance/perf_gen.go index 3b7703c9..f302d48e 100644 --- a/test/performance/perf_gen.go +++ b/test/performance/perf_gen.go @@ -5,64 +5,63 @@ package main import ( - "flag" - "github.com/intel-go/nff-go/flow" - "github.com/intel-go/nff-go/packet" - . "github.com/intel-go/nff-go/common" + "flag" + . "github.com/intel-go/nff-go/common" + "github.com/intel-go/nff-go/flow" + "github.com/intel-go/nff-go/packet" ) var size uint var speed uint type ctx struct { - r uint16 + r uint16 } func (c ctx) Copy() interface{} { - n := new(ctx) - n.r = 20 - return n + n := new(ctx) + n.r = 20 + return n } func (c ctx) Delete() { } - func main() { - flag.UintVar(&size, "s", 64, "size of packets") - flag.UintVar(&speed, "v", 40000, "speed of generation") - flag.Parse() + flag.UintVar(&size, "s", 64, "size of packets") + flag.UintVar(&speed, "v", 40000, "speed of generation") + flag.Parse() - pkts := uint64(speed * 1000 * 1000 / 8 / (size + 20)) - size = size - EtherLen - IPv4MinLen - TCPMinLen + pkts := uint64(speed * 1000 * 1000 / 8 / (size + 20)) + size = size - EtherLen - IPv4MinLen - TCPMinLen - flow.SystemInit(nil) + flow.SystemInit(nil) - a, _ := flow.SetFastGenerator(generatePacket, pkts / 2, *new(ctx)) - b, _ := flow.SetFastGenerator(generatePacket, pkts / 2, *new(ctx)) + a, _ := flow.SetFastGenerator(generatePacket, pkts/2, *new(ctx)) + b, _ := flow.SetFastGenerator(generatePacket, pkts/2, *new(ctx)) - flow.SetSender(a, 0) - flow.SetSender(b, 0) + flow.SetSender(a, 0) + flow.SetSender(b, 0) - flow.SystemStart() + flow.SystemStart() } // Function to use in generator func generatePacket(pkt *packet.Packet, context flow.UserContext) { - ctx1 := context.(*ctx) - r := ctx1.r - packet.InitEmptyIPv4TCPPacket(pkt, size) - ipv4 := pkt.GetIPv4() - tcp := pkt.GetTCPForIPv4() - - ipv4.DstAddr = packet.SwapBytesUint32(uint32(r)) - ipv4.SrcAddr = packet.SwapBytesUint32(uint32(r + 15)) - - tcp.DstPort = packet.SwapBytesUint16(r + 25) - tcp.SrcPort = packet.SwapBytesUint16(r + 35) - - ctx1.r++ - if ctx1.r > 259 { - ctx1.r = 20 - } + ctx1 := context.(*ctx) + r := ctx1.r + packet.InitEmptyIPv4TCPPacket(pkt, size) + ipv4 := pkt.GetIPv4() + tcp := pkt.GetTCPForIPv4() + + ipv4.DstAddr = packet.SwapBytesUint32(uint32(r)) + ipv4.SrcAddr = packet.SwapBytesUint32(uint32(r + 15)) + + tcp.DstPort = packet.SwapBytesUint16(r + 25) + tcp.SrcPort = packet.SwapBytesUint16(r + 35) + + ctx1.r++ + if ctx1.r > 259 { + ctx1.r = 20 + } } From 907336b97614d4f6aeda4b816f0e9ad18828c602 Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Thu, 10 Jan 2019 14:28:14 -0600 Subject: [PATCH 15/20] Enabled Mellanox network drivers in DPDK Added libmnl-dev and libibverbs-dev dependencies in docker images Fixed DPDK build to reqire generated config file instead of stock --- Dockerfile | 4 +++- README.md | 4 ++++ dpdk/Makefile | 17 ++++++++--------- low/low.go | 2 +- mk/include.mk | 4 +++- nff-go-base/Makefile | 4 ++-- vagrant/Vagrantfile | 5 +++-- 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 21b0f7c3..96c84f70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,9 @@ RUN apt-get -q update && apt-get -q -y install \ hugepages \ libnuma-dev \ libhyperscan-dev \ - liblua5.3-dev + liblua5.3-dev \ + libmnl-dev \ + libibverbs-dev RUN cd /opt && curl -L -s https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz | tar zx diff --git a/README.md b/README.md index 18139a2d..3bababfa 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,10 @@ Requirements in the DPDK Getting Started Guide for Linux](http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html) for more information. +Since NFF-Go is build with Mellanox cards support out of the box you +need to install additional dependencies required for MLX network +drivers. On Ubuntu they are called `libmnl-dev` and `libibverbs-dev`. + Additional dependencies are required for pktgen, especially if you are running RedHat or CentOS Linux distributions. See [this file](https://git.dpdk.org/apps/pktgen-dpdk/tree/INSTALL.md?h=pktgen-3.5.9&id=d469543f651506a8c9fb7c667a060950c5d92649) diff --git a/dpdk/Makefile b/dpdk/Makefile index 2735b868..a3b10ec6 100644 --- a/dpdk/Makefile +++ b/dpdk/Makefile @@ -1,4 +1,4 @@ -# Copyright 2017 Intel Corporation. +# Copyright 2017-2019 Intel Corporation. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. @@ -8,9 +8,7 @@ IMAGENAME = nff-go-pktgen # Pktgen variables NOCHECK_PKTGEN = yes -# Main DPDK variables -DPDK_INSTALL_DIR=$(RTE_TARGET)-install -export WORKDIR=/workdir +include $(PATH_TO_MK)/leaf.mk # Disable FSGSBASE and F16C to run in VMs and Docker containers. export EXTRA_CFLAGS = -mno-fsgsbase -mno-f16c @@ -25,7 +23,9 @@ all: pktgen $(DPDK_DIR)/$(DPDK_INSTALL_DIR): $(MAKE) -C $(DPDK_DIR) config T=$(RTE_TARGET) - $(MAKE) -C $(DPDK_DIR) install T=$(RTE_TARGET) DESTDIR=$(DPDK_INSTALL_DIR) + sed -ri 's,(MLX._PMD=)n,\1y,' $(DPDK_DIR)/build/.config + $(MAKE) -C $(DPDK_DIR) + $(MAKE) -C $(DPDK_DIR) install DESTDIR=$(DPDK_INSTALL_DIR) $(PKTGEN_DIR)/app/$(RTE_TARGET)/pktgen: $(DPDK_DIR)/$(DPDK_INSTALL_DIR) $(MAKE) -C $(PKTGEN_DIR) @@ -34,8 +34,7 @@ pktgen: $(PKTGEN_DIR)/app/$(RTE_TARGET)/pktgen cp $(PKTGEN_DIR)/app/$(RTE_TARGET)/pktgen . clean: - -$(MAKE) -C $(DPDK_DIR) clean - -rm -rf $(DPDK_DIR)/$(DPDK_INSTALL_DIR) $(DPDK_DIR)/build $(DPDK_DIR)/$(RTE_TARGET) -$(MAKE) -C $(PKTGEN_DIR) realclean - -include $(PATH_TO_MK)/leaf.mk + -rm pktgen + -$(MAKE) -C $(DPDK_DIR) clean + -rm -rf $(DPDK_DIR)/$(DPDK_INSTALL_DIR) $(DPDK_DIR)/build diff --git a/low/low.go b/low/low.go index b47cc356..56049156 100644 --- a/low/low.go +++ b/low/low.go @@ -13,7 +13,7 @@ package low // it increases executable size and build time. /* -#cgo LDFLAGS: -lrte_distributor -lrte_reorder -lrte_kni -lrte_pipeline -lrte_table -lrte_port -lrte_timer -lrte_jobstats -lrte_lpm -lrte_power -lrte_acl -lrte_meter -lrte_sched -lrte_vhost -lrte_ip_frag -lrte_cfgfile -Wl,--whole-archive -Wl,--start-group -lrte_kvargs -lrte_mbuf -lrte_hash -lrte_ethdev -lrte_mempool -lrte_ring -lrte_mempool_ring -lrte_eal -lrte_cmdline -lrte_net -lrte_bus_pci -lrte_pci -lrte_bus_vdev -lrte_timer -lrte_pmd_bond -lrte_pmd_vmxnet3_uio -lrte_pmd_virtio -lrte_pmd_cxgbe -lrte_pmd_enic -lrte_pmd_i40e -lrte_pmd_fm10k -lrte_pmd_ixgbe -lrte_pmd_e1000 -lrte_pmd_ena -lrte_pmd_ring -lrte_pmd_af_packet -lrte_pmd_null -Wl,--end-group -Wl,--no-whole-archive -lrt -lm -ldl -lnuma +#cgo LDFLAGS: -lrte_distributor -lrte_reorder -lrte_kni -lrte_pipeline -lrte_table -lrte_port -lrte_timer -lrte_jobstats -lrte_lpm -lrte_power -lrte_acl -lrte_meter -lrte_sched -lrte_vhost -lrte_ip_frag -lrte_cfgfile -Wl,--whole-archive -Wl,--start-group -lrte_kvargs -lrte_mbuf -lrte_hash -lrte_ethdev -lrte_mempool -lrte_ring -lrte_mempool_ring -lrte_eal -lrte_cmdline -lrte_net -lrte_bus_pci -lrte_pci -lrte_bus_vdev -lrte_timer -lrte_pmd_bond -lrte_pmd_vmxnet3_uio -lrte_pmd_virtio -lrte_pmd_cxgbe -lrte_pmd_enic -lrte_pmd_i40e -lrte_pmd_fm10k -lrte_pmd_ixgbe -lrte_pmd_e1000 -lrte_pmd_ena -lrte_pmd_ring -lrte_pmd_af_packet -lrte_pmd_null -libverbs -lmnl -lmlx4 -lmlx5 -lrte_pmd_mlx4 -lrte_pmd_mlx5 -Wl,--end-group -Wl,--no-whole-archive -lrt -lm -ldl -lnuma #include "low.h" */ import "C" diff --git a/mk/include.mk b/mk/include.mk index ba78afef..40d5155b 100644 --- a/mk/include.mk +++ b/mk/include.mk @@ -6,11 +6,13 @@ PROJECT_ROOT := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/..) +# Main DPDK variables DPDK_VERSION=18.11 DPDK_DIR=dpdk PKTGEN_VERSION=3.5.8 PKTGEN_DIR=pktgen-dpdk -export RTE_SDK=$(PROJECT_ROOT)/dpdk/$(DPDK_DIR) +DPDK_INSTALL_DIR=$(RTE_TARGET)-install +export RTE_SDK=$(PROJECT_ROOT)/dpdk/$(DPDK_DIR)/$(DPDK_INSTALL_DIR)/usr/local/share/dpdk export RTE_TARGET=x86_64-native-linuxapp-gcc # Configure flags for native code. Disable FSGSBASE and F16C to run in diff --git a/nff-go-base/Makefile b/nff-go-base/Makefile index edd6f658..e7b1dd21 100644 --- a/nff-go-base/Makefile +++ b/nff-go-base/Makefile @@ -17,7 +17,7 @@ Fedora: Makefile echo 'ENV https_proxy ${https_proxy}' >> Dockerfile; \ echo 'RUN echo proxy=${http_proxy} >> /etc/dnf/dnf.conf' >> Dockerfile; \ fi - echo 'RUN dnf -y install numactl-libs.x86_64; dnf clean all' >> Dockerfile + echo 'RUN dnf -y install numactl-libs.x86_64 lua-devel libmnl-devel rdma-core-devel libibverbs; dnf clean all' >> Dockerfile echo 'CMD ["/bin/bash"]' >> Dockerfile Dockerfile: Makefile @@ -29,7 +29,7 @@ Dockerfile: Makefile echo 'RUN echo Acquire::http::Proxy \"${http_proxy}\"\; >> /etc/apt/apt.conf' >> Dockerfile; \ echo 'RUN echo Acquire::https::Proxy \"${https_proxy}\"\; >> /etc/apt/apt.conf' >> Dockerfile; \ fi - echo 'RUN apt-get update; apt-get install -y pciutils; apt-get install -y libnuma-dev; apt-get install -y libpcap0.8-dev; apt-get install -y liblua5.3-dev; apt-get clean all' >> Dockerfile + echo 'RUN apt-get update; apt-get install -y pciutils libnuma-dev libpcap0.8-dev liblua5.3-dev libibverbs-dev libmnl-dev; apt-get clean all' >> Dockerfile echo 'CMD ["/bin/bash"]' >> Dockerfile .PHONY: dpdk diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index 0d663149..451ba801 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -103,7 +103,8 @@ SHELL $provision_fedora = < Date: Wed, 16 Jan 2019 14:11:21 -0600 Subject: [PATCH 16/20] Added perf_count instead of pktgen for receive part of performance tests --- test/framework/dockerlauncher.go | 35 +- test/framework/main/perf.json | 576 +++++++++++++++---------------- test/framework/testsuite.go | 2 + test/framework/types.go | 3 + test/performance/.gitignore | 1 + test/performance/Dockerfile | 1 + test/performance/Makefile | 2 +- test/performance/perf_count.go | 76 ++++ test/performance/perf_gen.go | 2 +- 9 files changed, 396 insertions(+), 302 deletions(-) create mode 100644 test/performance/perf_count.go diff --git a/test/framework/dockerlauncher.go b/test/framework/dockerlauncher.go index f32832e2..77c8f5ef 100644 --- a/test/framework/dockerlauncher.go +++ b/test/framework/dockerlauncher.go @@ -37,6 +37,7 @@ var ( TestPassedRegexp = regexp.MustCompile(`^TEST PASSED$`) TestFailedRegexp = regexp.MustCompile(`^TEST FAILED$`) TestCoresRegexp = regexp.MustCompile(`^DEBUG: System is using (\d+) cores now\. (\d+) cores are left available\.$`) + TestPerfRegexp = regexp.MustCompile(`^Output: Packets/sec\: (\d+) Mbits/sec\: (\d+)$`) ABStatsRegexps = [4]*regexp.Regexp{ regexp.MustCompile(`^Requests per second: *(\d+\.\d+) \[#/sec\] \(mean\)$`), regexp.MustCompile(`^Time per request: *(\d+\.\d+) \[ms\] \(mean\)$`), @@ -185,24 +186,34 @@ func (app *RunningApp) testRoutine(report chan<- TestReport, done <-chan struct{ } } } - - // Scan for strings specific to test application type - if app.config.Type == TestAppGo { - // Get cores number information for NFF-Go application + fillstats2 := func(first *int64, second *int64, rexps *regexp.Regexp) bool { t := time.Now() if t.After(app.benchStartTime) && t.Before(app.benchEndTime) { - matches := TestCoresRegexp.FindStringSubmatch(str) + matches := rexps.FindStringSubmatch(str) if len(matches) == 3 { - var c CoresInfo - c.CoresUsed, err = strconv.Atoi(matches[1]) - if err == nil { - c.CoresFree, err = strconv.Atoi(matches[2]) - if err == nil { - app.CoresStats = append(app.CoresStats, c) - } + n0, err0 := fmt.Sscanf(matches[1], "%d", first) + n1, err1 := fmt.Sscanf(matches[2], "%d", second) + if err0 == nil && err1 == nil && n0 == 1 && n1 == 1 { + return true } } } + return false + } + + // Scan for strings specific to test application type + if app.config.Type == TestAppGo { + // Get cores number information for NFF-Go application + var first, second int64 + if fillstats2(&first, &second, TestCoresRegexp) == true { + app.CoresStats = append(app.CoresStats, CoresInfo{int(first), int(second)}) + } + } else if app.config.Type == TestAppPerf { + // Get cores number information for NFF-Go application + var first, second int64 + if fillstats2(&first, &second, TestPerfRegexp) == true { + app.PktgenBenchdata = append(app.PktgenBenchdata, []PktgenMeasurement{{0, 0, first, second}}) + } } else if app.config.Type == TestAppApacheBenchmark { // Get Apache Benchmark output fillstats(app.abs.Stats[:], ABStatsRegexps[:]) diff --git a/test/framework/main/perf.json b/test/framework/main/perf.json index d9c470c9..8b634b83 100644 --- a/test/framework/main/perf.json +++ b/test/framework/main/perf.json @@ -40,10 +40,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -72,10 +72,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -104,10 +104,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -136,10 +136,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -168,10 +168,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -200,10 +200,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -232,10 +232,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -264,10 +264,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -296,10 +296,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -328,10 +328,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -360,10 +360,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -392,10 +392,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -424,10 +424,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -456,10 +456,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -488,10 +488,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -520,10 +520,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -552,10 +552,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -584,10 +584,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -616,10 +616,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -648,10 +648,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -680,10 +680,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -712,10 +712,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -744,10 +744,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -776,10 +776,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -797,7 +797,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -808,10 +808,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -829,7 +829,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -840,10 +840,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -872,10 +872,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -904,10 +904,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -936,10 +936,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -968,10 +968,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1000,10 +1000,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1032,10 +1032,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1053,7 +1053,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1064,10 +1064,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1085,7 +1085,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1096,10 +1096,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1128,10 +1128,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1160,10 +1160,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1192,10 +1192,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1224,10 +1224,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1256,10 +1256,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1288,10 +1288,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1309,7 +1309,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1320,10 +1320,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1341,7 +1341,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1352,10 +1352,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1384,10 +1384,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1416,10 +1416,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1448,10 +1448,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1480,10 +1480,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1512,10 +1512,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1544,10 +1544,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1565,7 +1565,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1576,10 +1576,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1597,7 +1597,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1608,10 +1608,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1640,10 +1640,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1672,10 +1672,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1704,10 +1704,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1736,10 +1736,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1768,10 +1768,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1800,10 +1800,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -1821,7 +1821,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1832,10 +1832,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1853,7 +1853,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -1864,10 +1864,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -1896,10 +1896,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1928,10 +1928,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -1960,10 +1960,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -1992,10 +1992,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2024,10 +2024,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2056,10 +2056,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2077,7 +2077,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2088,10 +2088,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2109,7 +2109,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2120,10 +2120,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2152,10 +2152,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -2184,10 +2184,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -2216,10 +2216,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2248,10 +2248,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2280,10 +2280,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2312,10 +2312,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2333,7 +2333,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2344,10 +2344,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2365,7 +2365,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2376,10 +2376,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2408,10 +2408,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -2440,10 +2440,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -2472,10 +2472,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2504,10 +2504,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2536,10 +2536,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2568,10 +2568,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2589,7 +2589,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2600,10 +2600,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2621,7 +2621,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2632,10 +2632,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2664,10 +2664,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -2696,10 +2696,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "64" ] } ], @@ -2728,10 +2728,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2760,10 +2760,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "128" ] } ], @@ -2792,10 +2792,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2824,10 +2824,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "256" ] } ], @@ -2845,7 +2845,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2856,10 +2856,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], @@ -2877,7 +2877,7 @@ "image-name": "nff-go-performance", "app-type": "TestAppGo", "exec-cmd": [ - "./perf_gen", "-s", "1514" + "./perf_gen", "-s", "1518" ] }, { @@ -2888,10 +2888,10 @@ ] }, { - "image-name": "nff-go-pktgen", - "app-type": "TestAppPktgen", + "image-name": "nff-go-performance", + "app-type": "TestAppPerf", "exec-cmd": [ - "./pktgen", "-c", "PKTGENCOREMASK", "-n", "4", "--", "-P", "-m", "PKTGENPORT", "-G" + "./perf_count", "-s", "1518" ] } ], diff --git a/test/framework/testsuite.go b/test/framework/testsuite.go index 675d5ec6..c5a8cc7a 100644 --- a/test/framework/testsuite.go +++ b/test/framework/testsuite.go @@ -68,6 +68,8 @@ func (config *TestsuiteConfig) executeOneTest(test *TestConfig, logdir string, go apps[iii].testPktgenRoutine(report, cancel, false) } pktgenAppIndex = iii + } else if apps[iii].config.Type == TestAppPerf { + pktgenAppIndex = iii } else { coresAppIndex = iii } diff --git a/test/framework/types.go b/test/framework/types.go index 914806b8..84bae9df 100644 --- a/test/framework/types.go +++ b/test/framework/types.go @@ -58,6 +58,7 @@ type AppType int // Constants for different application types. const ( TestAppGo AppType = iota + TestAppPerf TestAppPktgen TestAppApacheBenchmark TestAppLatency @@ -75,6 +76,7 @@ func (at *AppType) UnmarshalJSON(data []byte) error { // Use map to get int keys for string values got, ok := map[string]AppType{ "TestAppGo": TestAppGo, + "TestAppPerf": TestAppPerf, "TestAppPktgen": TestAppPktgen, "TestAppApacheBenchmark": TestAppApacheBenchmark, "TestAppLatency": TestAppLatency, @@ -167,6 +169,7 @@ type LatencyStats struct { Stats [5]float64 } +// Indexes in array of Wireshark Benchmark stats WrkBenchmarkStats const ( WrkRequestsPerSecond = iota WrkTransferRate diff --git a/test/performance/.gitignore b/test/performance/.gitignore index ada3ee4e..60e7f8d9 100644 --- a/test/performance/.gitignore +++ b/test/performance/.gitignore @@ -4,3 +4,4 @@ perf_seq ipsec latency perf_gen +perf_count diff --git a/test/performance/Dockerfile b/test/performance/Dockerfile index ca34750a..efe31bda 100644 --- a/test/performance/Dockerfile +++ b/test/performance/Dockerfile @@ -14,3 +14,4 @@ COPY perf_seq . COPY ipsec . COPY latency . COPY perf_gen . +COPY perf_count . diff --git a/test/performance/Makefile b/test/performance/Makefile index d906cf79..a7bd0ad9 100644 --- a/test/performance/Makefile +++ b/test/performance/Makefile @@ -4,6 +4,6 @@ PATH_TO_MK = ../../mk IMAGENAME = nff-go-performance -EXECUTABLES = perf_light perf_main perf_seq ipsec latency perf_gen +EXECUTABLES = perf_light perf_main perf_seq ipsec latency perf_gen perf_count include $(PATH_TO_MK)/leaf.mk diff --git a/test/performance/perf_count.go b/test/performance/perf_count.go new file mode 100644 index 00000000..634049df --- /dev/null +++ b/test/performance/perf_count.go @@ -0,0 +1,76 @@ +// Copyright 2017 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import ( + "flag" + "fmt" + "sync/atomic" + "time" + + "github.com/intel-go/nff-go/flow" + "github.com/intel-go/nff-go/packet" +) + +var received uint64 + +type ctx struct { + received uint64 +} + +var ccc []*uint64 + +func (c ctx) Copy() interface{} { + n := new(ctx) + ccc = append(ccc, &(n.received)) + return n +} + +func (c ctx) Delete() { +} + +func main() { + inport := flag.Uint("inport", 0, "port for receiver") + s := flag.Uint("size", 64, "size of packets") + flag.Parse() + + config := flow.Config{ + StopOnDedicatedCore: true, + } + flow.CheckFatal(flow.SystemInit(&config)) + + firstFlow, err := flow.SetReceiver(uint16(*inport)) + flow.CheckFatal(err) + + go report(uint64(*s)) + + flow.CheckFatal(flow.SetVectorHandler(firstFlow, count, *new(ctx))) + flow.CheckFatal(flow.SetStopper(firstFlow)) + + flow.CheckFatal(flow.SystemStart()) +} + +func count(currentPacket []*packet.Packet, mask *[32]bool, context flow.UserContext) { + var i uint64 + for i = 0; i < 32; i++ { + if mask[i] == false { + break + } + } + ctx1 := context.(*ctx) + atomic.AddUint64(&(ctx1.received), i) +} + +func report(size uint64) { + for { + time.Sleep(time.Second) + var number uint64 + for i := 0; i < len(ccc); i++ { + number += atomic.LoadUint64(ccc[i]) + atomic.StoreUint64(ccc[i], 0) + } + fmt.Println("Output: Packets/sec:", number, "Mbits/sec:", number*8*(size+20)/1000/1000) + } +} diff --git a/test/performance/perf_gen.go b/test/performance/perf_gen.go index f302d48e..66889b34 100644 --- a/test/performance/perf_gen.go +++ b/test/performance/perf_gen.go @@ -33,7 +33,7 @@ func main() { flag.Parse() pkts := uint64(speed * 1000 * 1000 / 8 / (size + 20)) - size = size - EtherLen - IPv4MinLen - TCPMinLen + size = size - EtherLen - IPv4MinLen - TCPMinLen - 4 /* Ethernet checksum length*/ flow.SystemInit(nil) From c31246942d93900e3449d2be6db796cbf683c8c5 Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Tue, 22 Jan 2019 15:44:03 -0600 Subject: [PATCH 17/20] Added fixes for various docker systemd files. Switched to Ubuntu 18.10 --- vagrant/Vagrantfile | 2 +- vagrant/scripts.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index 451ba801..88f7e904 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -19,7 +19,7 @@ Vagrant.configure(2) do |config| vm_port_base = ENV.fetch("VM_TUNNEL_PORT_BASE", 12345).to_i vm_second_port_base = vm_port_base + (vm_links_number + 1) * vm_total_number - config.vm.box = "generic/ubuntu1804" + config.vm.box = "generic/ubuntu1810" # config.vm.box = "fedora/28-cloud-base" # Docker server port diff --git a/vagrant/scripts.sh b/vagrant/scripts.sh index 204a498f..b3ec83c5 100644 --- a/vagrant/scripts.sh +++ b/vagrant/scripts.sh @@ -64,6 +64,9 @@ setupdocker () sudo gpasswd -a vagrant docker sudo sed -i -e 's,ExecStart=/usr/bin/dockerd -H unix://,ExecStart=/usr/bin/dockerd,' /lib/systemd/system/docker.service + sudo sed -i -e 's,ExecStart=/usr/bin/dockerd -H fd://,ExecStart=/usr/bin/dockerd,' /lib/systemd/system/docker.service + sudo sed -i -e 's,ExecStart=/usr/bin/dockerd -H unix://,ExecStart=/usr/bin/dockerd,' /etc/systemd/system/docker.service + sudo sed -i -e 's,ExecStart=/usr/bin/dockerd -H fd://,ExecStart=/usr/bin/dockerd,' /etc/systemd/system/docker.service if [ ! -z "${http_proxy}" ] then From ca49c1d79b5faef47f74d56613232c257fc64d5b Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Fri, 7 Sep 2018 13:24:58 -0600 Subject: [PATCH 18/20] Added scalar/vector ipsec as an example --- examples/Makefile | 2 +- examples/ipsec/Makefile | 8 + examples/ipsec/crypt.go | 122 +++++++ examples/ipsec/crypto_mb/aes.go | 42 +++ examples/ipsec/crypto_mb/aes.s | 147 +++++++++ examples/ipsec/crypto_mb/aes_test.go | 69 ++++ examples/ipsec/crypto_mb/cbc.go | 277 ++++++++++++++++ examples/ipsec/crypto_mb/cbc.s | 390 ++++++++++++++++++++++ examples/ipsec/crypto_mb/cbc_test.go | 238 ++++++++++++++ examples/ipsec/crypto_mb/expandKeyAsm.go | 9 + examples/ipsec/crypto_mb/expandKeyAsm.s | 183 +++++++++++ examples/ipsec/crypto_mb/hmac.go | 94 ++++++ examples/ipsec/crypto_mb/hmac_test.go | 212 ++++++++++++ examples/ipsec/crypto_mb/sha1.go | 221 +++++++++++++ examples/ipsec/crypto_mb/sha1.s | 399 +++++++++++++++++++++++ examples/ipsec/crypto_mb/sha1_test.go | 124 +++++++ examples/ipsec/ipsec_kernel.go | 195 +++++++++++ examples/ipsec/perf/.gitignore | 1 + examples/ipsec/perf/Dockerfile | 11 + examples/ipsec/perf/Makefile | 8 + examples/ipsec/perf/ipsec.go | 39 +++ examples/ipsec/stability/.gitignore | 1 + examples/ipsec/stability/Dockerfile | 11 + examples/ipsec/stability/Makefile | 8 + examples/ipsec/stability/ipsec_test.go | 106 ++++++ examples/ipsec/stability/stability.go | 74 +++++ examples/ipsec/stability/test.conf | 10 + examples/ipsec/stability/test.sh | 3 + 28 files changed, 3003 insertions(+), 1 deletion(-) create mode 100644 examples/ipsec/Makefile create mode 100644 examples/ipsec/crypt.go create mode 100644 examples/ipsec/crypto_mb/aes.go create mode 100644 examples/ipsec/crypto_mb/aes.s create mode 100644 examples/ipsec/crypto_mb/aes_test.go create mode 100644 examples/ipsec/crypto_mb/cbc.go create mode 100644 examples/ipsec/crypto_mb/cbc.s create mode 100644 examples/ipsec/crypto_mb/cbc_test.go create mode 100644 examples/ipsec/crypto_mb/expandKeyAsm.go create mode 100644 examples/ipsec/crypto_mb/expandKeyAsm.s create mode 100644 examples/ipsec/crypto_mb/hmac.go create mode 100644 examples/ipsec/crypto_mb/hmac_test.go create mode 100644 examples/ipsec/crypto_mb/sha1.go create mode 100644 examples/ipsec/crypto_mb/sha1.s create mode 100644 examples/ipsec/crypto_mb/sha1_test.go create mode 100644 examples/ipsec/ipsec_kernel.go create mode 100644 examples/ipsec/perf/.gitignore create mode 100644 examples/ipsec/perf/Dockerfile create mode 100644 examples/ipsec/perf/Makefile create mode 100644 examples/ipsec/perf/ipsec.go create mode 100644 examples/ipsec/stability/.gitignore create mode 100644 examples/ipsec/stability/Dockerfile create mode 100644 examples/ipsec/stability/Makefile create mode 100644 examples/ipsec/stability/ipsec_test.go create mode 100644 examples/ipsec/stability/stability.go create mode 100644 examples/ipsec/stability/test.conf create mode 100644 examples/ipsec/stability/test.sh diff --git a/examples/Makefile b/examples/Makefile index 495aa05f..78fe0fa0 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -7,7 +7,7 @@ IMAGENAME = nff-go-examples EXECUTABLES = dump clonablePcapDumper kni copy errorHandling timer \ createPacket sendFixedPktsNumber gtpu pingReplay \ netlink gopacketParserExample devbind -SUBDIRS = tutorial antiddos demo fileReadWrite firewall forwarding +SUBDIRS = tutorial antiddos demo fileReadWrite firewall forwarding ipsec .PHONY: dpi nffPktgen dpi: diff --git a/examples/ipsec/Makefile b/examples/ipsec/Makefile new file mode 100644 index 00000000..dd6865bf --- /dev/null +++ b/examples/ipsec/Makefile @@ -0,0 +1,8 @@ +# Copyright 2019 Intel Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +PATH_TO_MK = ../../mk +SUBDIRS = stability perf + +include $(PATH_TO_MK)/intermediate.mk diff --git a/examples/ipsec/crypt.go b/examples/ipsec/crypt.go new file mode 100644 index 00000000..2dbfef88 --- /dev/null +++ b/examples/ipsec/crypt.go @@ -0,0 +1,122 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Only IPv4, Only tunnel, Only ESP, Only AES-128-CBC +package ipsec + +import "github.com/intel-go/nff-go/examples/ipsec/crypto_mb" + +import "crypto/aes" +import "crypto/cipher" +import "crypto/hmac" +import "crypto/sha1" +import "hash" + +const VECTOR = 8 + +type SContext struct { + mac123 hash.Hash + modeEnc cipher.BlockMode + modeDec cipher.BlockMode +} + +type VContext struct { + mac123 crypto_mb.MultiHash + modeEnc crypto_mb.MultiBlockMode + modeDec crypto_mb.MultiBlockMode + + vectorEncryptionPart [][]byte + vectorIV [][]byte + vectorAuthPart [][]byte + vectorAuthPlace [][]byte + + s SContext +} + +type SetIVerM interface { + SetIV([][]byte) +} + +type SetIVer interface { + SetIV([]byte) +} + +func InitSContext() interface{} { + var auth123Key = []byte("qqqqqqqqqqqqqqqqqqqq") + var crypt123Key = []byte("AES128Key-16Char") + block123, _ := aes.NewCipher(crypt123Key) + + tempScalarIV := make([]byte, 16) + + n := new(SContext) + n.mac123 = hmac.New(sha1.New, auth123Key) + n.modeEnc = cipher.NewCBCEncrypter(block123, tempScalarIV) + n.modeDec = cipher.NewCBCDecrypter(block123, tempScalarIV) + return n +} + +func InitVContext() interface{} { + var auth123Key = []byte("qqqqqqqqqqqqqqqqqqqq") + var crypt123Key = []byte("AES128Key-16Char") + block123 := crypto_mb.NewAESMultiBlock(crypt123Key) + + tempVectorIV := make([][]byte, VECTOR, VECTOR) + for i := 0; i < VECTOR; i++ { + tempVectorIV[i] = make([]byte, 16) + } + + n := new(VContext) + n.mac123 = crypto_mb.NewHmac(crypto_mb.New, auth123Key) + n.modeEnc = crypto_mb.NewMultiCBCEncrypter(block123, tempVectorIV) + n.modeDec = crypto_mb.NewMultiCBCDecrypter(block123, tempVectorIV) + n.vectorEncryptionPart = make([][]byte, VECTOR, VECTOR) + n.vectorIV = make([][]byte, VECTOR, VECTOR) + n.vectorAuthPart = make([][]byte, VECTOR, VECTOR) + n.vectorAuthPlace = make([][]byte, VECTOR, VECTOR) + n.s = *InitSContext().(*SContext) + return n +} + +func (c SContext) Copy() interface{} { + return InitSContext() +} + +func (c VContext) Copy() interface{} { + return InitVContext() +} + +func (c SContext) Delete() { +} + +func (c VContext) Delete() { +} + +func Encrypt(EncryptionPart [][]byte, where [][]byte, IV [][]byte, Z uint, context *VContext) { + if Z != VECTOR { + for t := uint(0); t < Z; t++ { + context.s.modeEnc.(SetIVer).SetIV(IV[t]) + context.s.modeEnc.CryptBlocks(EncryptionPart[t], where[t]) + } + } else { + context.modeEnc.(SetIVerM).SetIV(IV[:]) + context.modeEnc.CryptManyBlocks(EncryptionPart, where) + } +} + +func Authenticate(AuthenticationPart [][]byte, where [][]byte, Z uint, context *VContext) { + if Z != VECTOR { + for t := uint(0); t < Z; t++ { + context.s.mac123.Reset() + context.s.mac123.Write(where[t]) + copy(where[t], context.s.mac123.Sum(nil)) + } + } else { + context.mac123.Reset() + context.mac123.Write(context.vectorAuthPart) + temp := context.mac123.Sum(nil) + for t := uint(0); t < VECTOR; t++ { + copy(where[t], temp[t]) + } + } +} diff --git a/examples/ipsec/crypto_mb/aes.go b/examples/ipsec/crypto_mb/aes.go new file mode 100644 index 00000000..6564f466 --- /dev/null +++ b/examples/ipsec/crypto_mb/aes.go @@ -0,0 +1,42 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +//TODO check cpuid + +type aes_x8 struct { + blockSize int + enc []uint32 + dec []uint32 +} + +func (this *aes_x8) BlockSize() int { + return this.blockSize +} + +func (this *aes_x8) VecSize() int { + return 8 +} + +//TODO accept number of blocks +func NewAESMultiBlock(key []byte) MultiBlock { + if len(key) != 16 { + // TODO return error? + panic("For now only 16-byte keys are supported") + } + n := len(key) + 28 + rounds := 10 + c := aes_x8{len(key), make([]uint32, n), make([]uint32, n)} + expandKeyAsm(rounds, &key[0], &c.enc[0], &c.dec[0]) + return &c +} + +// in aes.s +//go:noescape +func encrypt8BlocksAsm(xk *uint32, dst, src [][]byte) + +func (this *aes_x8) DecryptMany(dst, src [][]byte) { + panic("Not implemented yet") +} diff --git a/examples/ipsec/crypto_mb/aes.s b/examples/ipsec/crypto_mb/aes.s new file mode 100644 index 00000000..138cf026 --- /dev/null +++ b/examples/ipsec/crypto_mb/aes.s @@ -0,0 +1,147 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// This is asm block routine unrolled x8 and acting on 8 input blocks + +// func encrypt8BlocksAsm(xk *uint32, dst, src [][]byte) +TEXT ·encrypt8BlocksAsm(SB), NOSPLIT, $0 + // For now 128 only + MOVQ xk+0(FP), AX + MOVQ dst+8(FP), DI // dst + MOVQ src+32(FP), SI // src + MOVQ (SI), BX // &src[0] + MOVQ 24(SI), BP // &src[1] ... + MOVQ 48(SI), R9 + MOVQ 72(SI), R10 + MOVQ 96(SI), R11 + MOVQ 120(SI), R12 + MOVQ 144(SI), R13 + MOVQ 168(SI), R14 + MOVUPS 0(AX), X0 // Key + MOVUPS 0(BX), X1 //src[0] + MOVUPS 0(BP), X2 + MOVUPS 0(R9), X3 + MOVUPS 0(R10), X4 + MOVUPS 0(R11), X5 + MOVUPS 0(R12), X6 + MOVUPS 0(R13), X7 + MOVUPS 0(R14), X8 + ADDQ $16, AX + PXOR X0, X1 + PXOR X0, X2 + PXOR X0, X3 + PXOR X0, X4 + PXOR X0, X5 + PXOR X0, X6 + PXOR X0, X7 + PXOR X0, X8 + MOVUPS 0(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 16(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 32(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 48(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 64(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 80(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 96(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 112(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 128(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 144(AX), X0 + AESENCLAST X0, X1 + AESENCLAST X0, X2 + AESENCLAST X0, X3 + AESENCLAST X0, X4 + AESENCLAST X0, X5 + AESENCLAST X0, X6 + AESENCLAST X0, X7 + AESENCLAST X0, X8 + MOVQ (DI), DX // &dst[0] + MOVQ 24(DI), SI + MOVQ 48(DI), AX + MOVQ 72(DI), BX + MOVQ 96(DI), CX + MOVQ 120(DI), BP + MOVQ 144(DI), R8 + MOVQ 168(DI), R9 + MOVUPS X1, 0(DX) + MOVUPS X2, 0(SI) + MOVUPS X3, 0(AX) + MOVUPS X4, 0(BX) + MOVUPS X5, 0(CX) + MOVUPS X6, 0(BP) + MOVUPS X7, 0(R8) + MOVUPS X8, 0(R9) + RET diff --git a/examples/ipsec/crypto_mb/aes_test.go b/examples/ipsec/crypto_mb/aes_test.go new file mode 100644 index 00000000..be4441cb --- /dev/null +++ b/examples/ipsec/crypto_mb/aes_test.go @@ -0,0 +1,69 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +import "testing" + +//TODO Separate test package? + +// Appendix B, C of FIPS 197: Cipher examples, Example vectors. +type CryptTest struct { + key []byte + in []byte + out []byte +} + +var encryptTests = []CryptTest{ + { + // Appendix B. + []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, + []byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34}, + []byte{0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32}, + }, + { + // Appendix C.1. AES-128 + []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, + []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + []byte{0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a}, + }, +} + +// Test Cipher Encrypt method against FIPS 197 examples. +func TestCipherEncrypt(t *testing.T) { + for i, tt := range encryptTests { + c := NewAESMultiBlock(tt.key) + out := make([][]byte, 0) + in := make([][]byte, 0) + for i := 0; i < c.VecSize(); i++ { + in = append(in, tt.in) + out = append(out, make([]byte, len(tt.in))) + } + c.EncryptMany(out, in) + for s := 0; s < c.VecSize(); s++ { + for j, v := range out[s] { + if v != tt.out[j] { + t.Errorf("EncryptMany slice %d %d: out[%d] = %#x, want %#x", s, i, j, v, tt.out[j]) + break + } + } + } + } +} + +func BenchmarkEncrypt(b *testing.B) { + tt := encryptTests[0] + c := NewAESMultiBlock(tt.key) + out := make([][]byte, 0) + in := make([][]byte, 0) + for i := 0; i < c.VecSize(); i++ { + in = append(in, tt.in) + out = append(out, make([]byte, len(tt.in))) + } + b.SetBytes(int64(len(out[0]) * c.VecSize())) + b.ResetTimer() + for i := 0; i < b.N; i++ { + c.EncryptMany(out, in) + } +} diff --git a/examples/ipsec/crypto_mb/cbc.go b/examples/ipsec/crypto_mb/cbc.go new file mode 100644 index 00000000..2cfc8bff --- /dev/null +++ b/examples/ipsec/crypto_mb/cbc.go @@ -0,0 +1,277 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +//TODO split into subpackages + +// This is based on crypto/cipher & co + +// A MultiBlock represents an implementation of block cipher +// using a given key and acting on a several blocks ata once. +// All blocks must use the same key. It provides the capability to encrypt +// or decrypt "vectors" of individual blocks. The mode implementations +// extend that capability to streams of blocks. +type MultiBlock interface { + // BlockSize returns the cipher's block size. + BlockSize() int + + // VecSize return a number of blocks encrypted at once + VecSize() int + + // DecryptMany decrypts the first block in src into dst. + // Dst and src may point at the same memory. + DecryptMany(dst, src [][]byte) +} + +// A BlockMode represents a block cipher running in a block-based mode (CBC, +// ECB etc). +type MultiBlockMode interface { + // BlockSize returns the mode's block size. + BlockSize() int + // VecSize return a number of blocks encrypted at once + VecSize() int + // CryptManyBlocks encrypts or decrypts a number of blocks. The length of + // src must be a multiple of the block size. Dst and src may point to + // the same memory. + CryptManyBlocks(dst, src [][]byte) +} + +type MultiSetIVer interface { + SetIV(IV [][]byte) + SetIVat(IVslice []byte, index int) +} + +type multicbc struct { + mb MultiBlock + blockSize int + vecSize int + iv [][]byte + tmp [][]byte +} + +type cbcVectorEncrypter multicbc + +func NewMultiCBCEncrypter(mb MultiBlock, iv [][]byte) MultiBlockMode { + if mb.VecSize() <= 0 { + panic("MultiBlock should have positive vector size") + } + if len(iv) != mb.VecSize() { + panic("NewMultiCBCEncrypter: number of IVs is not equal to vectro size of MultiBlock") + } + for i := range iv { + if len(iv[i]) != mb.BlockSize() { + panic("NewMultiCBCEncrypter: IV length must equal block size") + } + } + tmp := make([][]byte, mb.VecSize()) + for i := 0; i < mb.VecSize(); i++ { + tmp[i] = make([]byte, mb.BlockSize()) + } + //TODO why do we need to dup + iv2 := make([][]byte, mb.VecSize()) + for i := 0; i < mb.VecSize(); i++ { + + iv2[i] = make([]byte, len(iv[i])) + copy(iv2[i], iv[i]) + } + ret := &multicbc{mb: mb, blockSize: mb.BlockSize(), vecSize: mb.VecSize(), iv: iv2, tmp: tmp} + return (*cbcVectorEncrypter)(ret) +} + +func (this *cbcVectorEncrypter) BlockSize() int { + return this.blockSize +} + +func (this *cbcVectorEncrypter) VecSize() int { + return this.vecSize +} + +func (this *cbcVectorEncrypter) CryptManyBlocks(dst, src [][]byte) { + if len(src) != this.vecSize { + panic("Number of sources must be equal to vecSize") + } + if len(src) != len(dst) { + panic("number of inputs must equal number of outputs") + } + srcLen := len(src[0]) + if srcLen%this.blockSize != 0 { + panic("Input should be full blocks") + } + for i := 1; i < this.vecSize; i++ { + if len(src[i]) != srcLen { + panic("All elements of src must have same length") + } + } + for i := 0; i < this.vecSize; i++ { + if len(dst[i]) < srcLen { + panic("Not enough space in dst") + } + } + iv := this.iv + val, ok := this.mb.(*aes_x8) + if ok { + var dst1, src1, iv1 [8]*byte + for i := 0; i < 8; i++ { + dst1[i] = &dst[i][0] + src1[i] = &src[i][0] + iv1[i] = &iv[i][0] + } + aes_x8_cbc_encrypt(&val.enc[0], &dst1, &src1, &iv1, len(src[0])) + } else { + } + + //Save iv for later CryptManyBlocks calls + for i := 0; i < this.vecSize; i++ { + copy(this.iv[i], iv[i]) + } +} + +func (this *cbcVectorEncrypter) SetIV(IV [][]byte) { + if len(IV) != this.vecSize { + panic("Wrong IV size") + } + for i := range IV { + if len(IV[i]) != this.blockSize { + panic("SetIV: IV length must equal block size") + } + } + for i := range IV { + copy(this.iv[i], IV[i]) + } +} + +func (this *cbcVectorEncrypter) SetIVat(IVslice []byte, index int) { + if len(IVslice) != this.blockSize { + panic("SetIVat: IV length must equal block size") + } + //no check, bounds checks are automatic + copy(this.iv[index], IVslice) +} + +func xorBytes(dst, src, iv [][]byte, blockSize int) { + if blockSize == 16 { + for i := range dst { + xor16(&dst[i][0], &src[i][0], &iv[i][0]) + } + } else { + for i := range dst { + for j := 0; j < blockSize; j++ { + dst[i][j] = src[i][j] ^ iv[i][j] + } + } + } +} + +// in cbc.s +//go:noescape +func aes_x8_cbc_encrypt(xk *uint32, dst1, src1, iv *[8]*byte, ln int) + +// in cbc.s +//go:noescape +func xor16(dst, src, iv *byte) + +// in cbc.s +//go:noescape +func aes_x8_cbc_decrypt(xk *uint32, dst1, src1, iv *[8]*byte, ln int) + +type cbcVectorDecrypter multicbc + +func NewMultiCBCDecrypter(mb MultiBlock, iv [][]byte) MultiBlockMode { + if mb.VecSize() <= 0 { + panic("MultiBlock should have positive vector size") + } + if len(iv) != mb.VecSize() { + panic("NewMultiCBCDecrypter: number of IVs is not equal to vectro size of MultiBlock") + } + for i := range iv { + if len(iv[i]) != mb.BlockSize() { + panic("NewMultiCBCDecrypter: IV length must equal block size") + } + } + tmp := make([][]byte, mb.VecSize()) + for i := 0; i < mb.VecSize(); i++ { + tmp[i] = make([]byte, mb.BlockSize()) + } + //TODO why do we need to dup + iv2 := make([][]byte, mb.VecSize()) + for i := 0; i < mb.VecSize(); i++ { + + iv2[i] = make([]byte, len(iv[i])) + copy(iv2[i], iv[i]) + } + ret := &multicbc{mb: mb, blockSize: mb.BlockSize(), vecSize: mb.VecSize(), iv: iv2, tmp: tmp} + return (*cbcVectorDecrypter)(ret) +} + +func (this *cbcVectorDecrypter) BlockSize() int { + return this.blockSize +} + +func (this *cbcVectorDecrypter) VecSize() int { + return this.vecSize +} + +func (this *cbcVectorDecrypter) SetIV(IV [][]byte) { + if len(IV) != this.vecSize { + panic("Wrong IV size") + } + for i := range IV { + if len(IV[i]) != this.blockSize { + panic("SetIV: IV length must equal block size") + } + } + for i := range IV { + copy(this.iv[i], IV[i]) + } +} + +func (this *cbcVectorDecrypter) SetIVat(IVslice []byte, index int) { + if len(IVslice) != this.blockSize { + panic("SetIVat: IV length must equal block size") + } + //no check, bounds checks are automatic + copy(this.iv[index], IVslice) +} + +func (this *cbcVectorDecrypter) CryptManyBlocks(dst, src [][]byte) { + if len(src) != this.vecSize { + panic("Number of sources must be equal to vecSize") + } + if len(src) != len(dst) { + panic("number of inputs must equal number of outputs") + } + srcLen := len(src[0]) + if srcLen%this.blockSize != 0 { + panic("Input should be full blocks") + } + for i := 1; i < this.vecSize; i++ { + if len(src[i]) != srcLen { + panic("All elements of src must have same length") + } + } + for i := 0; i < this.vecSize; i++ { + if len(dst[i]) < srcLen { + panic("Not enough space in dst") + } + } + iv := this.iv + val, ok := this.mb.(*aes_x8) + if ok { + var dst1, src1, iv1 [8]*byte + for i := 0; i < 8; i++ { + dst1[i] = &dst[i][0] + src1[i] = &src[i][0] + iv1[i] = &iv[i][0] + } + aes_x8_cbc_decrypt(&val.dec[0], &dst1, &src1, &iv1, len(src[0])) + } else { + panic("Not implemented yet") + } + + //Save iv for later CryptManyBlocks calls + for i := 0; i < this.vecSize; i++ { + copy(this.iv[i], iv[i]) + } +} diff --git a/examples/ipsec/crypto_mb/cbc.s b/examples/ipsec/crypto_mb/cbc.s new file mode 100644 index 00000000..156a0dfe --- /dev/null +++ b/examples/ipsec/crypto_mb/cbc.s @@ -0,0 +1,390 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" +// func xor16(dst,src,iv *byte) +TEXT ·xor16(SB), NOSPLIT, $0 + MOVQ dst+0(FP), AX + MOVQ src+8(FP), BX + MOVQ iv+16(FP), CX + MOVUPS (BX), X0 + MOVUPS (CX), X1 + PXOR X0, X1 + MOVUPS X1, (AX) + RET + +// func aes_x8_cbc_encrypt(xk *uint32,dst,src,iv [][]byte,ln int) +TEXT ·aes_x8_cbc_encrypt(SB), NOSPLIT, $0 + MOVQ xk+0(FP), AX // xk + MOVQ dst+8(FP), DI // dst + MOVQ src+16(FP), SI // src + MOVQ iv+24(FP), BP // iv + MOVQ ln+32(FP), BX // ln + MOVQ 0(BP), R8 // iv[0] + MOVQ 8(BP), R9 // iv[1] + MOVQ 16(BP), R10 + MOVQ 24(BP), R11 + MOVQ 32(BP), R12 + MOVQ 40(BP), R13 + MOVQ 48(BP), R14 + MOVQ 56(BP), R15 + XORQ CX, CX + +loop: + CMPQ CX, BX + JGE done + MOVUPS 0(AX), X0 // key + MOVQ 0(SI), DX // &src[0] + MOVUPS 0(R8), X1 + MOVUPS 0(R9), X2 + MOVUPS 0(R10), X3 + MOVUPS 0(R11), X4 + MOVUPS 0(R12), X5 + MOVUPS 0(R13), X6 + MOVUPS 0(R14), X7 + MOVUPS 0(R15), X8 + MOVUPS 0(CX)(DX*1), X9 // src[0][CX:CX+16] + PXOR X9, X1 + MOVQ 8(SI), DX // &src[1] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X2 + MOVQ 16(SI), DX // &src[2] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X3 + MOVQ 24(SI), DX // &src[3] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X4 + MOVQ 32(SI), DX // &src[4] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X5 + MOVQ 40(SI), DX // &src[5] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X6 + MOVQ 48(SI), DX // &src[6] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X7 + MOVQ 56(SI), DX // &src[7] + MOVUPS 0(CX)(DX*1), X9 + PXOR X9, X8 + PXOR X0, X1 + PXOR X0, X2 + PXOR X0, X3 + PXOR X0, X4 + PXOR X0, X5 + PXOR X0, X6 + PXOR X0, X7 + PXOR X0, X8 + MOVUPS 16(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 32(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 48(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 64(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 80(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 96(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 112(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 128(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 144(AX), X0 + AESENC X0, X1 + AESENC X0, X2 + AESENC X0, X3 + AESENC X0, X4 + AESENC X0, X5 + AESENC X0, X6 + AESENC X0, X7 + AESENC X0, X8 + MOVUPS 160(AX), X0 + AESENCLAST X0, X1 + AESENCLAST X0, X2 + AESENCLAST X0, X3 + AESENCLAST X0, X4 + AESENCLAST X0, X5 + AESENCLAST X0, X6 + AESENCLAST X0, X7 + AESENCLAST X0, X8 + MOVQ (DI), DX // &dst[0] + MOVUPS X1, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R8 + MOVQ 8(DI), DX + MOVUPS X2, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R9 + MOVQ 16(DI), DX + MOVUPS X3, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R10 + MOVQ 24(DI), DX + MOVUPS X4, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R11 + MOVQ 32(DI), DX + MOVUPS X5, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R12 + MOVQ 40(DI), DX + MOVUPS X6, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R13 + MOVQ 48(DI), DX + MOVUPS X7, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R14 + MOVQ 56(DI), DX + MOVUPS X8, 0(CX)(DX*1) + LEAQ 0(CX)(DX*1), R15 + ADDQ $16, CX // Move to next block + JMP loop + +done: + RET + +// func aes_x8_cbc_decrypt(xk *uint32,dst,src,iv [][]byte,ln int) +TEXT ·aes_x8_cbc_decrypt(SB), NOSPLIT, $0 + MOVQ xk+0(FP), AX // xk + MOVQ dst+8(FP), DI // dst + MOVQ src+16(FP), SI // src + MOVQ iv+24(FP), BP // iv + MOVQ ln+32(FP), BX // ln + MOVQ 0(SI), R8 // in[0] + MOVQ 8(SI), R9 // in[1]... + MOVQ 16(SI), R10 + MOVQ 24(SI), R11 + MOVQ 32(SI), R12 + MOVQ 40(SI), R13 + MOVQ 48(SI), R14 + MOVQ 56(SI), R15 + MOVQ $0, CX + //MOVQ $16, CX + SUBQ $16,BX + + //Do it backwards due to lack of registers, + //Because we need to keep ciphertext for xoring +loop: + CMPQ BX,$-16 + JLE done + CMPQ CX, BX + JGE last_block + MOVUPS 0(BX)(R8*1), X1 + MOVUPS 0(BX)(R9*1), X2 + MOVUPS 0(BX)(R10*1), X3 + MOVUPS 0(BX)(R11*1), X4 + MOVUPS 0(BX)(R12*1), X5 + MOVUPS 0(BX)(R13*1), X6 + MOVUPS 0(BX)(R14*1), X7 + MOVUPS 0(BX)(R15*1), X8 + last_block_loop: + MOVUPS 0(AX), X0 // key + PXOR X0, X1 + PXOR X0, X2 + PXOR X0, X3 + PXOR X0, X4 + PXOR X0, X5 + PXOR X0, X6 + PXOR X0, X7 + PXOR X0, X8 + MOVUPS 16(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 32(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 48(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 64(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 80(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 96(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 112(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 128(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 144(AX), X0 + AESDEC X0, X1 + AESDEC X0, X2 + AESDEC X0, X3 + AESDEC X0, X4 + AESDEC X0, X5 + AESDEC X0, X6 + AESDEC X0, X7 + AESDEC X0, X8 + MOVUPS 160(AX), X0 + AESDECLAST X0, X1 + AESDECLAST X0, X2 + AESDECLAST X0, X3 + AESDECLAST X0, X4 + AESDECLAST X0, X5 + AESDECLAST X0, X6 + AESDECLAST X0, X7 + AESDECLAST X0, X8 + MOVUPS -16(BX)(R8*1),X9 + PXOR X9,X1 + MOVQ 0(DI),DX + MOVUPS X1,0(BX)(DX*1) + MOVUPS -16(BX)(R9*1),X9 + PXOR X9,X2 + MOVQ 8(DI),DX + MOVUPS X2,0(BX)(DX*1) + MOVUPS -16(BX)(R10*1),X9 + PXOR X9,X3 + MOVQ 16(DI),DX + MOVUPS X3,0(BX)(DX*1) + MOVUPS -16(BX)(R11*1),X9 + PXOR X9,X4 + MOVQ 24(DI),DX + MOVUPS X4,0(BX)(DX*1) + MOVUPS -16(BX)(R12*1),X9 + PXOR X9,X5 + MOVQ 32(DI),DX + MOVUPS X5,0(BX)(DX*1) + MOVUPS -16(BX)(R13*1),X9 + PXOR X9,X6 + MOVQ 40(DI),DX + MOVUPS X6,0(BX)(DX*1) + MOVUPS -16(BX)(R14*1),X9 + PXOR X9,X7 + MOVQ 48(DI),DX + MOVUPS X7,0(BX)(DX*1) + MOVUPS -16(BX)(R15*1),X9 + PXOR X9,X8 + MOVQ 56(DI),DX + MOVUPS X8,0(BX)(DX*1) + + SUBQ $16,BX //move to prev block + JMP loop + +last_block: +//TODO cmp + MOVUPS 0(AX), X0 // key + MOVUPS 0(BX)(R8*1), X1 + MOVUPS 0(BX)(R9*1), X2 + MOVUPS 0(BX)(R10*1), X3 + MOVUPS 0(BX)(R11*1), X4 + MOVUPS 0(BX)(R12*1), X5 + MOVUPS 0(BX)(R13*1), X6 + MOVUPS 0(BX)(R14*1), X7 + MOVUPS 0(BX)(R15*1), X8 + MOVQ 0(BP), R8 // in[0] + MOVQ 8(BP), R9 // in[1]... + ADDQ $16,R8 + MOVQ 16(BP), R10 + MOVQ 24(BP), R11 + MOVQ 32(BP), R12 + MOVQ 40(BP), R13 + MOVQ 48(BP), R14 + MOVQ 56(BP), R15 + JMP last_block_loop +done: + RET diff --git a/examples/ipsec/crypto_mb/cbc_test.go b/examples/ipsec/crypto_mb/cbc_test.go new file mode 100644 index 00000000..7412705a --- /dev/null +++ b/examples/ipsec/crypto_mb/cbc_test.go @@ -0,0 +1,238 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "strconv" + "testing" +) + +//TODO Separate test package? + +// Common values for tests. + +var commonInput = []byte{ + 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, + 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, + 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, + 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10, +} + +var commonKey128 = []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c} + +var commonKey192 = []byte{ + 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, + 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b, +} + +var commonKey256 = []byte{ + 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, + 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4, +} + +var commonIV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f} + +var cbcAESTests = []struct { + name string + key []byte + iv []byte + in []byte + out []byte +}{ + // NIST SP 800-38A pp 27-29 + { + "CBC-AES128", + commonKey128, + commonIV, + commonInput, + []byte{ + 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, + 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2, + 0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b, 0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16, + 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7, + }, + }, + /* { + "CBC-AES192", + commonKey192, + commonIV, + commonInput, + []byte{ + 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8, + 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4, 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a, + 0x57, 0x1b, 0x24, 0x20, 0x12, 0xfb, 0x7a, 0xe0, 0x7f, 0xa9, 0xba, 0xac, 0x3d, 0xf1, 0x02, 0xe0, + 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81, 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd, + }, + }, + { + "CBC-AES256", + commonKey256, + commonIV, + commonInput, + []byte{ + 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6, + 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d, 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d, + 0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf, 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61, + 0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc, 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b, + }, + },*/ +} + +func TestCBCEncrypterAES(t *testing.T) { + for _, tt := range cbcAESTests { + c := NewAESMultiBlock(tt.key) + iv := make([][]byte, 0) + in := make([][]byte, 0) + for i := 0; i < c.VecSize(); i++ { + tmp_i := make([]byte, len(tt.in)) + copy(tmp_i, tt.in) + in = append(in, tmp_i) + iv = append(iv, tt.iv) + } + + encrypter := NewMultiCBCEncrypter(c, iv) + encrypter.CryptManyBlocks(in, in) + for i := 0; i < c.VecSize(); i++ { + if !bytes.Equal(tt.out, in[i]) { + t.Errorf("%s: CBCEncrypter\nhave %x\nwant %x in %d round", tt.name, in[i], tt.out, i) + } + } + } +} + +func TestSetIV(t *testing.T) { + for _, tt := range cbcAESTests { + c := NewAESMultiBlock(tt.key) + iv := make([][]byte, c.VecSize()) + iv2 := make([][]byte, c.VecSize()) + in := make([][]byte, c.VecSize()) + for i := range iv { + iv[i] = make([]byte, len(tt.iv)) + iv2[i] = make([]byte, len(tt.iv)) + in[i] = make([]byte, len(tt.in)) + copy(in[i], tt.in) + copy(iv2[i], tt.iv) + } + encrypter := NewMultiCBCEncrypter(c, iv) + encrypter.(MultiSetIVer).SetIV(iv2) + encrypter.CryptManyBlocks(in, in) + for i := 0; i < c.VecSize(); i++ { + if !bytes.Equal(tt.out, in[i]) { + t.Errorf("%s: CBCEncrypter\nhave %x\nwant %x in %d lane", tt.name, in[i], tt.out, i) + } + } + } +} + +func TestCBCEncrypterAESagainstNonMB(t *testing.T) { + c := NewAESMultiBlock(commonKey128) + iv1 := make([][]byte, 0) + in1 := make([][]byte, 0) + iv2 := make([][]byte, 0) + in2 := make([][]byte, 0) + for i := 0; i < c.VecSize(); i++ { + tmp_in1 := make([]byte, 128) + tmp_in2 := make([]byte, 128) + for j := range tmp_in2 { + //TODO math/rand + tmp_in2[j] = byte(j*7 + i + 23) + tmp_in1[j] = byte(j*7 + i + 23) + } + tmp_iv1 := make([]byte, 16) + tmp_iv2 := make([]byte, 16) + for j := range tmp_iv2 { + tmp_iv2[j] = byte(j*7 + i + 23) + tmp_iv1[j] = byte(j*7 + i + 23) + } + in1 = append(in1, tmp_in1) + in2 = append(in2, tmp_in2) + iv1 = append(iv1, tmp_iv1) + iv2 = append(iv2, tmp_iv2) + } + + encrypter := NewMultiCBCEncrypter(c, iv1) + encrypter.CryptManyBlocks(in1, in1) + c2, err := aes.NewCipher(commonKey128) + if err != nil { + t.Errorf("Failed to create aes.NewCipher") + } + + for i := 0; i < c.VecSize(); i++ { + scalarEncrypter := cipher.NewCBCEncrypter(c2, iv2[i]) + scalarEncrypter.CryptBlocks(in2[i], in2[i]) + if !bytes.Equal(in2[i], in1[i]) { + t.Errorf("MultiCBCEncrypter produced %x\nwant %x in %d lane", in1[i], in2[i], i) + } + } +} + +func BenchmarkAESCBCEncrypt(b *testing.B) { + sizes := []int{16, 64, 320, 1024, 8096} + for i := range sizes { + size := sizes[i] + b.Run(strconv.Itoa(size), func(b *testing.B) { + buf := make([][]byte, 0) + iv := make([][]byte, 0) + var key [16]byte + c := NewAESMultiBlock(key[:]) + for i := 0; i < c.VecSize(); i++ { + buf = append(buf, make([]byte, size)) + iv = append(iv, make([]byte, 16)) + } + cbc := NewMultiCBCEncrypter(c, iv) + b.SetBytes(int64(len(buf[0]) * c.VecSize())) + for i := 0; i < b.N; i++ { + cbc.CryptManyBlocks(buf, buf) + } + }) + } +} + +func BenchmarkAESCBCEncryptAlloc(b *testing.B) { + sizes := []int{16, 64, 320, 1024, 8096} + for i := range sizes { + size := sizes[i] + b.Run(strconv.Itoa(size), func(b *testing.B) { + buf := make([][]byte, 0) + iv := make([][]byte, 0) + var key [16]byte + c := NewAESMultiBlock(key[:]) + for i := 0; i < c.VecSize(); i++ { + buf = append(buf, make([]byte, size)) + iv = append(iv, make([]byte, 16)) + } + b.SetBytes(int64(len(buf[0]) * c.VecSize())) + for i := 0; i < b.N; i++ { + cbc := NewMultiCBCEncrypter(c, iv) + cbc.CryptManyBlocks(buf, buf) + } + }) + } +} + +func TestCBCDecrypterAES(t *testing.T) { + for _, tt := range cbcAESTests { + c := NewAESMultiBlock(tt.key) + iv := make([][]byte, 0) + in := make([][]byte, 0) + for i := 0; i < c.VecSize(); i++ { + tmp_i := make([]byte, len(tt.in)) + copy(tmp_i, tt.out) + in = append(in, tmp_i) + iv = append(iv, tt.iv) + } + + decrypter := NewMultiCBCDecrypter(c, iv) + decrypter.CryptManyBlocks(in, in) + for i := 0; i < c.VecSize(); i++ { + if !bytes.Equal(tt.in, in[i]) { + t.Errorf("%s: CBCDecrypter\nhave %x\nwant %x in %d lane", tt.name, in[i], tt.in, i) + } + } + } +} diff --git a/examples/ipsec/crypto_mb/expandKeyAsm.go b/examples/ipsec/crypto_mb/expandKeyAsm.go new file mode 100644 index 00000000..e3df21cd --- /dev/null +++ b/examples/ipsec/crypto_mb/expandKeyAsm.go @@ -0,0 +1,9 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +// in aes.s +//go:noescape +func expandKeyAsm(nr int, key *byte, enc, dec *uint32) diff --git a/examples/ipsec/crypto_mb/expandKeyAsm.s b/examples/ipsec/crypto_mb/expandKeyAsm.s new file mode 100644 index 00000000..ba75e0f8 --- /dev/null +++ b/examples/ipsec/crypto_mb/expandKeyAsm.s @@ -0,0 +1,183 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +//This is taken directly from golang/src/crypto/aes/asm_amd64.s +// func expandKeyAsm(nr int, key *byte, enc, dec *uint32) { +// Note that round keys are stored in uint128 format, not uint32 +TEXT ·expandKeyAsm(SB), NOSPLIT, $0 + MOVQ nr+0(FP), CX + MOVQ key+8(FP), AX + MOVQ enc+16(FP), BX + MOVQ dec+24(FP), DX + MOVUPS (AX), X0 + + // enc + MOVUPS X0, (BX) + ADDQ $16, BX + PXOR X4, X4 // _expand_key_* expect X4 to be zero + CMPL CX, $12 + JE Lexp_enc196 + JB Lexp_enc128 + +Lexp_enc256: + MOVUPS 16(AX), X2 + MOVUPS X2, (BX) + ADDQ $16, BX + AESKEYGENASSIST $0x01, X2, X1 + CALL _expand_key_256a<>(SB) + AESKEYGENASSIST $0x01, X0, X1 + CALL _expand_key_256b<>(SB) + AESKEYGENASSIST $0x02, X2, X1 + CALL _expand_key_256a<>(SB) + AESKEYGENASSIST $0x02, X0, X1 + CALL _expand_key_256b<>(SB) + AESKEYGENASSIST $0x04, X2, X1 + CALL _expand_key_256a<>(SB) + AESKEYGENASSIST $0x04, X0, X1 + CALL _expand_key_256b<>(SB) + AESKEYGENASSIST $0x08, X2, X1 + CALL _expand_key_256a<>(SB) + AESKEYGENASSIST $0x08, X0, X1 + CALL _expand_key_256b<>(SB) + AESKEYGENASSIST $0x10, X2, X1 + CALL _expand_key_256a<>(SB) + AESKEYGENASSIST $0x10, X0, X1 + CALL _expand_key_256b<>(SB) + AESKEYGENASSIST $0x20, X2, X1 + CALL _expand_key_256a<>(SB) + AESKEYGENASSIST $0x20, X0, X1 + CALL _expand_key_256b<>(SB) + AESKEYGENASSIST $0x40, X2, X1 + CALL _expand_key_256a<>(SB) + JMP Lexp_dec + +Lexp_enc196: + MOVQ 16(AX), X2 + AESKEYGENASSIST $0x01, X2, X1 + CALL _expand_key_192a<>(SB) + AESKEYGENASSIST $0x02, X2, X1 + CALL _expand_key_192b<>(SB) + AESKEYGENASSIST $0x04, X2, X1 + CALL _expand_key_192a<>(SB) + AESKEYGENASSIST $0x08, X2, X1 + CALL _expand_key_192b<>(SB) + AESKEYGENASSIST $0x10, X2, X1 + CALL _expand_key_192a<>(SB) + AESKEYGENASSIST $0x20, X2, X1 + CALL _expand_key_192b<>(SB) + AESKEYGENASSIST $0x40, X2, X1 + CALL _expand_key_192a<>(SB) + AESKEYGENASSIST $0x80, X2, X1 + CALL _expand_key_192b<>(SB) + JMP Lexp_dec + +Lexp_enc128: + AESKEYGENASSIST $0x01, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x02, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x04, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x08, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x10, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x20, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x40, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x80, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x1b, X0, X1 + CALL _expand_key_128<>(SB) + AESKEYGENASSIST $0x36, X0, X1 + CALL _expand_key_128<>(SB) + +Lexp_dec: + // dec + SUBQ $16, BX + MOVUPS (BX), X1 + MOVUPS X1, (DX) + DECQ CX + +Lexp_dec_loop: + MOVUPS -16(BX), X1 + AESIMC X1, X0 + MOVUPS X0, 16(DX) + SUBQ $16, BX + ADDQ $16, DX + DECQ CX + JNZ Lexp_dec_loop + MOVUPS -16(BX), X0 + MOVUPS X0, 16(DX) + RET + +TEXT _expand_key_128<>(SB), NOSPLIT, $0 + PSHUFD $0xff, X1, X1 + SHUFPS $0x10, X0, X4 + PXOR X4, X0 + SHUFPS $0x8c, X0, X4 + PXOR X4, X0 + PXOR X1, X0 + MOVUPS X0, (BX) + ADDQ $16, BX + RET + +TEXT _expand_key_192a<>(SB), NOSPLIT, $0 + PSHUFD $0x55, X1, X1 + SHUFPS $0x10, X0, X4 + PXOR X4, X0 + SHUFPS $0x8c, X0, X4 + PXOR X4, X0 + PXOR X1, X0 + + MOVAPS X2, X5 + MOVAPS X2, X6 + PSLLDQ $0x4, X5 + PSHUFD $0xff, X0, X3 + PXOR X3, X2 + PXOR X5, X2 + + MOVAPS X0, X1 + SHUFPS $0x44, X0, X6 + MOVUPS X6, (BX) + SHUFPS $0x4e, X2, X1 + MOVUPS X1, 16(BX) + ADDQ $32, BX + RET + +TEXT _expand_key_192b<>(SB), NOSPLIT, $0 + PSHUFD $0x55, X1, X1 + SHUFPS $0x10, X0, X4 + PXOR X4, X0 + SHUFPS $0x8c, X0, X4 + PXOR X4, X0 + PXOR X1, X0 + + MOVAPS X2, X5 + PSLLDQ $0x4, X5 + PSHUFD $0xff, X0, X3 + PXOR X3, X2 + PXOR X5, X2 + + MOVUPS X0, (BX) + ADDQ $16, BX + RET + +TEXT _expand_key_256a<>(SB), NOSPLIT, $0 + JMP _expand_key_128<>(SB) + +TEXT _expand_key_256b<>(SB), NOSPLIT, $0 + PSHUFD $0xaa, X1, X1 + SHUFPS $0x10, X2, X4 + PXOR X4, X2 + SHUFPS $0x8c, X2, X4 + PXOR X4, X2 + PXOR X1, X2 + + MOVUPS X2, (BX) + ADDQ $16, BX + RET diff --git a/examples/ipsec/crypto_mb/hmac.go b/examples/ipsec/crypto_mb/hmac.go new file mode 100644 index 00000000..e3137708 --- /dev/null +++ b/examples/ipsec/crypto_mb/hmac.go @@ -0,0 +1,94 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +//based on crypto/hmac +// key is zero padded to the block size of the hash function +// ipad = 0x36 byte repeated for key length +// opad = 0x5c byte repeated for key length +// hmac = H([key ^ opad] H([key ^ ipad] text)) + +type multihmac struct { + size int + blocksize int + vecsize int + opad, ipad [][]byte + outer, inner MultiHash + p1, p2 [][]byte +} + +func (h *multihmac) Sum(in [][]byte) [][]byte { + origLen := 0 + if len(in) != 0 { + origLen = len(in[0]) + } + //TODO fix,check len(in) + in = h.inner.Sum(in) + h.outer.Reset() + h.outer.Write(h.opad) + for i := range h.p1 { + h.p1[i] = in[i][origLen:] + h.p2[i] = in[i][:origLen] + } + h.outer.Write(h.p1) + return h.outer.Sum(h.p2) +} + +// Doesn't implement io.writer due to input +func (h *multihmac) Write(p [][]byte) int { + return h.inner.Write(p) +} + +func (h *multihmac) Size() int { return h.size } + +func (h *multihmac) BlockSize() int { return h.blocksize } + +func (h *multihmac) VecSize() int { return h.vecsize } + +func (h *multihmac) Reset() { + h.inner.Reset() + h.inner.Write(h.ipad) +} + +//TODO separate packages to avoid name collisions +// New returns a new HMAC hash using the given hash.Hash type and key. +func NewHmac(h func() MultiHash, key []byte) MultiHash { + hm := new(multihmac) + hm.outer = h() + hm.inner = h() + hm.size = hm.inner.Size() + hm.vecsize = hm.inner.VecSize() + hm.blocksize = hm.inner.BlockSize() + hm.ipad = make([][]byte, hm.vecsize) + hm.opad = make([][]byte, hm.vecsize) + hm.p1 = make([][]byte, hm.vecsize) + hm.p2 = make([][]byte, hm.vecsize) + keys := make([][]byte, hm.vecsize) + for i := range hm.ipad { + hm.ipad[i] = make([]byte, hm.blocksize) + hm.opad[i] = make([]byte, hm.blocksize) + keys[i] = make([]byte, len(key)) + copy(keys[i], key) + } + // println(keys[0]) + if len(key) > hm.blocksize { + // If key is too big, hash it. + hm.outer.Write(keys) + keys = hm.outer.Sum(nil) + // println(keys[0]) + } + for i := 0; i < hm.vecsize; i++ { + copy(hm.ipad[i], keys[i]) + copy(hm.opad[i], keys[i]) + for j := range hm.ipad[i] { + hm.ipad[i][j] ^= 0x36 + } + for j := range hm.opad[i] { + hm.opad[i][j] ^= 0x5c + } + } + hm.inner.Write(hm.ipad) + return hm +} diff --git a/examples/ipsec/crypto_mb/hmac_test.go b/examples/ipsec/crypto_mb/hmac_test.go new file mode 100644 index 00000000..898db67f --- /dev/null +++ b/examples/ipsec/crypto_mb/hmac_test.go @@ -0,0 +1,212 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +//based on crypto/hmac + +import ( + "fmt" + "testing" +) + +type hmacTest struct { + hash func() MultiHash + key []byte + in []byte + out string + size int + blocksize int + vecsize int +} + +var hmacTests = []hmacTest{ + // Tests from US FIPS 198 + // http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf + { + New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + }, + []byte("Sample #1"), + "4f4ca3d5d68ba7cc0a1208c9c61e9c5da0403c0a", + SizeSHA1, + BlockSizeSHA1, + vecSize, + }, + { + New, + []byte{ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + 0x40, 0x41, 0x42, 0x43, + }, + []byte("Sample #2"), + "0922d3405faa3d194f82a45830737d5cc6c75d24", + SizeSHA1, + BlockSizeSHA1, + vecSize, + }, + { + New, + []byte{ + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, + }, + []byte("Sample #3"), + "bcf41eab8bb2d802f3d05caf7cb092ecf8d1a3aa", + SizeSHA1, + BlockSizeSHA1, + vecSize, + }, + + // Tests from http://csrc.nist.gov/groups/ST/toolkit/examples.html + // (truncated tag tests are left out) + { + New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, + }, + []byte("Sample message for keylen=blocklen"), + "5fd596ee78d5553c8ff4e72d266dfd192366da29", + SizeSHA1, + BlockSizeSHA1, + vecSize, + }, + { + New, + []byte{ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, + }, + []byte("Sample message for keylen 0 { + var n int + for i := 0; i < d.VecSize(); i++ { + n = copy(d.x[i][d.nx:], p[i]) + p[i] = p[i][n:] + } + d.nx += n + if d.nx == SHA1chunk { + var par [vecSize]*byte + for i := 0; i < d.VecSize(); i++ { + par[i] = &d.x[i][0] + } + multiblock(d, &par, SHA1chunk) + d.nx = 0 + } + } + if len(p[0]) >= SHA1chunk { + n := len(p[0]) &^ (SHA1chunk - 1) + var par [vecSize]*byte + for i := 0; i < d.VecSize(); i++ { + par[i] = &p[i][0] + } + multiblock(d, &par, n) + for i := 0; i < d.VecSize(); i++ { + p[i] = p[i][n:] + } + } + if len(p[0]) > 0 { + for i := 0; i < d.VecSize(); i++ { + d.nx = copy(d.x[i][:], p[i]) + } + } + return +} + +func (d0 *digest8sha1) Sum(in [][]byte) [][]byte { + // Make a copy of d0 so that caller can keep writing and summing. + d := *d0 + var ret [][]byte + var ret1 [vecSize][]byte + var digest [vecSize][SizeSHA1]byte + for i := 0; i < d.VecSize(); i++ { + ret1[i] = digest[i][:] + } + ret = ret1[:] + d.checkSum(ret) + for i := 0; i < d.VecSize(); i++ { + if i < len(in) { + ret[i] = append(in[i], ret[i]...) + } + } + return ret +} + +func (d *digest8sha1) checkSum(ret [][]byte) { + length := d.len + // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. + sz := 0 + if length%64 < 56 { + sz = int(56 - length%64) + } else { + sz = int(64 + 56 - length%64) + } + for i := 0; i < d.VecSize(); i++ { + d.tmp[i] = d.tmp[i][:sz] + for j := range d.tmp[i] { + d.tmp[i][j] = 0 + } + d.tmp[i][0] = 0x80 + } + d.Write(d.tmp) + + // Length in bits. + length <<= 3 + for i := 0; i < d.VecSize(); i++ { + d.tmp[i] = d.tmp[i][0:8] + // TODO encodin/binary putuint64? + lane := d.tmp[i] + _ = lane[7] + lane[0] = byte(length >> 56) + lane[1] = byte(length >> 48) + lane[2] = byte(length >> 40) + lane[3] = byte(length >> 32) + lane[4] = byte(length >> 24) + lane[5] = byte(length >> 16) + lane[6] = byte(length >> 8) + lane[7] = byte(length) + } + d.Write(d.tmp) + + if d.nx != 0 { + panic("d.nx != 0") + } + + for j := range d.h { + for i := range d.h[j] { + //TODO encoding/binary + s := d.h[j][i] + offset := j * 4 + lane := ret[i][offset:] + _ = lane[3] + lane[0] = byte(s >> 24) + lane[1] = byte(s >> 16) + lane[2] = byte(s >> 8) + lane[3] = byte(s) + } + } + + return +} + +// In sha1.s +//go:noescape +func multiblock(d *digest8sha1, p *[vecSize]*byte, ln int) diff --git a/examples/ipsec/crypto_mb/sha1.s b/examples/ipsec/crypto_mb/sha1.s new file mode 100644 index 00000000..90a1faca --- /dev/null +++ b/examples/ipsec/crypto_mb/sha1.s @@ -0,0 +1,399 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +//TODO check cpuid + +// AX has a pointer to area where w's are stored +#define ROUND_0_TO_15(a,b,c,d,e,t,f,index,k_const) \ + VPADDD k_const,e,e ; \ + VPADDD (32*index)(AX),e,e ; \ + VPSRLD $(32-5),a,f ; \ + VPSLLD $5,a,t ; \ + VPOR f,t,t ; \ + VPADDD t,e,e ; \ + VPXOR d,c,f ; \ + VPAND b,f,f ; \ + VPXOR d,f,f ; \ + VPSRLD $2,b,t ; \ + VPSLLD $30,b,b ; \ + VPOR t,b,b ; \ + VPADDD f,e,e + + +#define ROUND_16_TO_19(a,b,c,d,e,t,f,index,k_const,w14,w15,w16) \ + VPADDD k_const,e,e ; \ + VMOVDQU (32*((index-14)&15))(AX),w14 ; \ + VPXOR w14,w16,w16 ; \ + VPXOR (32*((index-8)&15))(AX),w16,w16 ; \ + VPXOR (32*((index-3)&15))(AX),w16,w16 ; \ + VPSRLD $31,w16,f ; \ + VPSLLD $1,w16,w16 ; \ + VPOR w16,f,f ; \ // rotate w here + VMOVDQU f,(32*((index-0)&15))(AX) ; \ + VPADDD f,e,e ; \ + VPSRLD $(32-5),a,f ; \ + VPSLLD $5,a,t ; \ + VPOR f,t,t ; \ + VPADDD t,e,e ; \ + VPXOR d,c,f ; \ + VPAND b,f,f ; \ + VPXOR d,f,f ; \ + VPSRLD $2,b,t ; \ + VPSLLD $30,b,b ; \ + VPOR t,b,b ; \ + VPADDD f,e,e + + +#define ROUND_20_TO_39(a,b,c,d,e,t,f,index,k_const,w14,w15,w16) \ + VPADDD k_const,e,e ; \ + VMOVDQU (32*((index-14)&15))(AX),w14 ; \ + VPXOR w14,w16,w16 ; \ + VPXOR (32*((index-8)&15))(AX),w16,w16 ; \ + VPXOR (32*((index-3)&15))(AX),w16,w16 ; \ + VPSRLD $31,w16,f ; \ + VPSLLD $1,w16,w16 ; \ + VPOR w16,f,f ; \ // rotate w here + VMOVDQU f,(32*((index-0)&15))(AX) ; \ + VPADDD f,e,e ; \ + VPSRLD $(32-5),a,f ; \ + VPSLLD $5,a,t ; \ + VPOR f,t,t ; \ + VPADDD t,e,e ; \ + VPXOR c,d,f ; \ + VPXOR b,f,f ; \ + VPSRLD $2,b,t ; \ + VPSLLD $30,b,b ; \ + VPOR t,b,b ; \ + VPADDD f,e,e + + +#define ROUND_40_TO_59(a,b,c,d,e,t,f,index,k_const,w14,w15,w16) \ + VPADDD k_const,e,e ; \ + VMOVDQU (32*((index-14)&15))(AX),w14 ; \ + VPXOR w14,w16,w16 ; \ + VPXOR (32*((index-8)&15))(AX),w16,w16 ; \ + VPXOR (32*((index-3)&15))(AX),w16,w16 ; \ + VPSRLD $31,w16,f ; \ + VPSLLD $1,w16,w16 ; \ + VPOR w16,f,f ; \ // rotate w here + VMOVDQU f,(32*((index-0)&15))(AX) ; \ + VPADDD f,e,e ; \ + VPSRLD $(32-5),a,f ; \ + VPSLLD $5,a,t ; \ + VPOR f,t,t ; \ + VPADDD t,e,e ; \ + VPOR c,b,f ; \ + VPAND c,b,t ; \ + VPAND d,f,f ; \ + VPOR t,f,f ; \ + VPSRLD $2,b,t ; \ + VPSLLD $30,b,b ; \ + VPOR t,b,b ; \ + VPADDD f,e,e + + +#define ROUND_60_TO_79(a,b,c,d,e,t,f,index,k_const,w14,w15,w16) \ + VPADDD k_const,e,e ; \ + VMOVDQU (32*((index-14)&15))(AX),w14 ; \ + VPXOR w14,w16,w16 ; \ + VPXOR (32*((index-8)&15))(AX),w16,w16 ; \ + VPXOR (32*((index-3)&15))(AX),w16,w16 ; \ + VPSRLD $31,w16,f ; \ + VPSLLD $1,w16,w16 ; \ + VPOR w16,f,f ; \ // rotate w here + VMOVDQU f,(32*((index-0)&15))(AX) ; \ + VPADDD f,e,e ; \ + VPSRLD $(32-5),a,f ; \ + VPSLLD $5,a,t ; \ + VPOR f,t,t ; \ + VPADDD t,e,e ; \ + VPXOR c,d,f ; \ + VPXOR b,f,f ; \ + VPSRLD $2,b,t ; \ + VPSLLD $30,b,b ; \ + VPOR t,b,b ; \ + VPADDD f,e,e + + + + +//func multiblock(d *digest8sha1, p *[8]*byte, ln int) +TEXT ·multiblock(SB), NOSPLIT, $0 + MOVQ d+0(FP), DX // digest + MOVQ p+8(FP), SI // Input array + MOVQ ln+16(FP), DI // len + MOVQ (SI),R8 // R8-15 inputs + MOVQ 8(SI),R9 + MOVQ 16(SI),R10 + MOVQ 24(SI),R11 + MOVQ 32(SI),R12 + MOVQ 40(SI),R13 + MOVQ 48(SI),R14 + MOVQ 56(SI),R15 + MOVQ (DX),AX // pointer to scratch area + VMOVDQU 8(DX),Y11 // Y11 = vec of A + VMOVDQU 40(DX),Y12 // Y12 = vec of B + VMOVDQU 72(DX),Y13 // Y13 = vec of C + VMOVDQU 104(DX),Y14 // Y14 = vec of D + VMOVDQU 136(DX),Y15 // Y15 = vec of E + XORQ CX,CX // i = 0 +loop: + CMPQ CX,DI // i < len + JGE done + MOVQ $BSWAP_SHUFB_CTL<>(SB), BX + VMOVDQU (BX), Y10 // mask for byte swapping + VMOVDQU 0(CX)(R8*1),Y0// load first half of a block + VMOVDQU 0(CX)(R9*1),Y1 + VMOVDQU 0(CX)(R10*1),Y2 + VMOVDQU 0(CX)(R11*1),Y3 + VMOVDQU 0(CX)(R12*1),Y4 + VMOVDQU 0(CX)(R13*1),Y5 + VMOVDQU 0(CX)(R14*1),Y6 + VMOVDQU 0(CX)(R15*1),Y7 // transpone it using Y8 and Y9 as temporaries, aa..,bb..,cc.. -> abc..,abc.. + BYTE $0xC5; BYTE $0x7C; BYTE $0xC6; BYTE $0xC1; BYTE $0x44 // vshufps $0x44,%ymm1,%ymm0,%ymm8 + BYTE $0xC5; BYTE $0xFC; BYTE $0xC6; BYTE $0xC1; BYTE $0xEE // vshufps $0xee,%ymm1,%ymm0,%ymm0 + BYTE $0xC5; BYTE $0x6C; BYTE $0xC6; BYTE $0xCB; BYTE $0x44 // vshufps $0x44,%ymm3,%ymm2,%ymm9 + BYTE $0xC5; BYTE $0xEC; BYTE $0xC6; BYTE $0xD3; BYTE $0xEE // vshufps $0xee,%ymm3,%ymm2,%ymm2 + BYTE $0xC4; BYTE $0xC1; BYTE $0x3C; BYTE $0xC6; BYTE $0xD9; BYTE $0xDD // vshufps $0xdd,%ymm9,%ymm8,%ymm3 + BYTE $0xC5; BYTE $0xFC; BYTE $0xC6; BYTE $0xCA; BYTE $0x88 // vshufps $0x88,%ymm2,%ymm0,%ymm1 + BYTE $0xC5; BYTE $0xFC; BYTE $0xC6; BYTE $0xC2; BYTE $0xDD // vshufps $0xdd,%ymm2,%ymm0,%ymm0 + BYTE $0xC4; BYTE $0x41; BYTE $0x3C; BYTE $0xC6; BYTE $0xC1; BYTE $0x88 // vshufps $0x88,%ymm9,%ymm8,%ymm8 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xD5; BYTE $0x44 // vshufps $0x44,%ymm5,%ymm4,%ymm2 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xE5; BYTE $0xEE // vshufps $0xee,%ymm5,%ymm4,%ymm4 + BYTE $0xC5; BYTE $0x4C; BYTE $0xC6; BYTE $0xCF; BYTE $0x44 // vshufps $0x44,%ymm7,%ymm6,%ymm9 + BYTE $0xC5; BYTE $0xCC; BYTE $0xC6; BYTE $0xF7; BYTE $0xEE // vshufps $0xee,%ymm7,%ymm6,%ymm6 + BYTE $0xC4; BYTE $0xC1; BYTE $0x6C; BYTE $0xC6; BYTE $0xF9; BYTE $0xDD // vshufps $0xdd,%ymm9,%ymm2,%ymm7 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xEE; BYTE $0x88 // vshufps $0x88,%ymm6,%ymm4,%ymm5 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xE6; BYTE $0xDD // vshufps $0xdd,%ymm6,%ymm4,%ymm4 + BYTE $0xC4; BYTE $0x41; BYTE $0x6C; BYTE $0xC6; BYTE $0xC9; BYTE $0x88 // vshufps $0x88,%ymm9,%ymm2,%ymm9 + VPERM2F128 $0x13, Y1, Y5, Y6 + VPERM2F128 $0x02, Y1, Y5, Y2 + VPERM2F128 $0x13, Y3, Y7, Y5 + VPERM2F128 $0x02, Y3, Y7, Y1 + VPERM2F128 $0x13, Y0, Y4, Y7 + VPERM2F128 $0x02, Y0, Y4, Y3 + VPERM2F128 $0x13, Y8, Y9, Y4 + VPERM2F128 $0x02, Y8, Y9, Y0 + VPSHUFB Y10, Y0, Y0 // get w's (endianness swapped p's) + VMOVDQU Y0,(AX) // Store it onto stack + VPSHUFB Y10, Y1, Y1 + VMOVDQU Y1,32(AX) + VPSHUFB Y10, Y2, Y2 + VMOVDQU Y2,64(AX) + VPSHUFB Y10, Y3, Y3 + VMOVDQU Y3,96(AX) + VPSHUFB Y10, Y4, Y4 + VMOVDQU Y4,128(AX) + VPSHUFB Y10, Y5, Y5 + VMOVDQU Y5,160(AX) + VPSHUFB Y10, Y6, Y6 + VMOVDQU Y6,192(AX) + VPSHUFB Y10, Y7, Y7 + VMOVDQU Y7,224(AX) + VMOVDQU 32(CX)(R8*1),Y0 // Do the same for second half of input block + VMOVDQU 32(CX)(R9*1),Y1 + VMOVDQU 32(CX)(R10*1),Y2 + VMOVDQU 32(CX)(R11*1),Y3 + VMOVDQU 32(CX)(R12*1),Y4 + VMOVDQU 32(CX)(R13*1),Y5 + VMOVDQU 32(CX)(R14*1),Y6 + VMOVDQU 32(CX)(R15*1),Y7 + BYTE $0xC5; BYTE $0x7C; BYTE $0xC6; BYTE $0xC1; BYTE $0x44 // vshufps $0x44,%ymm1,%ymm0,%ymm8 + BYTE $0xC5; BYTE $0xFC; BYTE $0xC6; BYTE $0xC1; BYTE $0xEE // vshufps $0xee,%ymm1,%ymm0,%ymm0 + BYTE $0xC5; BYTE $0x6C; BYTE $0xC6; BYTE $0xCB; BYTE $0x44 // vshufps $0x44,%ymm3,%ymm2,%ymm9 + BYTE $0xC5; BYTE $0xEC; BYTE $0xC6; BYTE $0xD3; BYTE $0xEE // vshufps $0xee,%ymm3,%ymm2,%ymm2 + BYTE $0xC4; BYTE $0xC1; BYTE $0x3C; BYTE $0xC6; BYTE $0xD9; BYTE $0xDD // vshufps $0xdd,%ymm9,%ymm8,%ymm3 + BYTE $0xC5; BYTE $0xFC; BYTE $0xC6; BYTE $0xCA; BYTE $0x88 // vshufps $0x88,%ymm2,%ymm0,%ymm1 + BYTE $0xC5; BYTE $0xFC; BYTE $0xC6; BYTE $0xC2; BYTE $0xDD // vshufps $0xdd,%ymm2,%ymm0,%ymm0 + BYTE $0xC4; BYTE $0x41; BYTE $0x3C; BYTE $0xC6; BYTE $0xC1; BYTE $0x88 // vshufps $0x88,%ymm9,%ymm8,%ymm8 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xD5; BYTE $0x44 // vshufps $0x44,%ymm5,%ymm4,%ymm2 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xE5; BYTE $0xEE // vshufps $0xee,%ymm5,%ymm4,%ymm4 + BYTE $0xC5; BYTE $0x4C; BYTE $0xC6; BYTE $0xCF; BYTE $0x44 // vshufps $0x44,%ymm7,%ymm6,%ymm9 + BYTE $0xC5; BYTE $0xCC; BYTE $0xC6; BYTE $0xF7; BYTE $0xEE // vshufps $0xee,%ymm7,%ymm6,%ymm6 + BYTE $0xC4; BYTE $0xC1; BYTE $0x6C; BYTE $0xC6; BYTE $0xF9; BYTE $0xDD // vshufps $0xdd,%ymm9,%ymm2,%ymm7 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xEE; BYTE $0x88 // vshufps $0x88,%ymm6,%ymm4,%ymm5 + BYTE $0xC5; BYTE $0xDC; BYTE $0xC6; BYTE $0xE6; BYTE $0xDD // vshufps $0xdd,%ymm6,%ymm4,%ymm4 + BYTE $0xC4; BYTE $0x41; BYTE $0x6C; BYTE $0xC6; BYTE $0xC9; BYTE $0x88 // vshufps $0x88,%ymm9,%ymm2,%ymm9 + VPERM2F128 $0x13, Y1, Y5, Y6 + VPERM2F128 $0x02, Y1, Y5, Y2 + VPERM2F128 $0x13, Y3, Y7, Y5 + VPERM2F128 $0x02, Y3, Y7, Y1 + VPERM2F128 $0x13, Y0, Y4, Y7 + VPERM2F128 $0x02, Y0, Y4, Y3 + VPERM2F128 $0x13, Y8, Y9, Y4 + VPERM2F128 $0x02, Y8, Y9, Y0 + VPSHUFB Y10, Y0, Y0 + VMOVDQU Y0,256(AX) + VPSHUFB Y10, Y1, Y1 + VMOVDQU Y1,288(AX) + VPSHUFB Y10, Y2, Y2 + VMOVDQU Y2,320(AX) + VPSHUFB Y10, Y3, Y3 + VMOVDQU Y3,352(AX) + VPSHUFB Y10, Y4, Y4 + VMOVDQU Y4,384(AX) + VPSHUFB Y10, Y5, Y5 + VMOVDQU Y5,416(AX) + VPSHUFB Y10, Y6, Y6 + VMOVDQU Y6,448(AX) + VPSHUFB Y10, Y7, Y7 + VMOVDQU Y7,480(AX) + VMOVDQU Y11,Y0 // make a copy of A,B,C,D,E + VMOVDQU Y12,Y1 + VMOVDQU Y13,Y2 + VMOVDQU Y14,Y3 + VMOVDQU Y15,Y4 + MOVQ $K_XMM_AR<>(SB), BX + VMOVDQU (BX), Y10 // contants for rounds 0-19 + ROUND_0_TO_15(Y0,Y1,Y2,Y3,Y4,Y5,Y6,0,Y10) + ROUND_0_TO_15(Y4,Y0,Y1,Y2,Y3,Y5,Y6,1,Y10) + ROUND_0_TO_15(Y3,Y4,Y0,Y1,Y2,Y5,Y6,2,Y10) + ROUND_0_TO_15(Y2,Y3,Y4,Y0,Y1,Y5,Y6,3,Y10) + ROUND_0_TO_15(Y1,Y2,Y3,Y4,Y0,Y5,Y6,4,Y10) + ROUND_0_TO_15(Y0,Y1,Y2,Y3,Y4,Y5,Y6,5,Y10) + ROUND_0_TO_15(Y4,Y0,Y1,Y2,Y3,Y5,Y6,6,Y10) + ROUND_0_TO_15(Y3,Y4,Y0,Y1,Y2,Y5,Y6,7,Y10) + ROUND_0_TO_15(Y2,Y3,Y4,Y0,Y1,Y5,Y6,8,Y10) + ROUND_0_TO_15(Y1,Y2,Y3,Y4,Y0,Y5,Y6,9,Y10) + ROUND_0_TO_15(Y0,Y1,Y2,Y3,Y4,Y5,Y6,10,Y10) + ROUND_0_TO_15(Y4,Y0,Y1,Y2,Y3,Y5,Y6,11,Y10) + ROUND_0_TO_15(Y3,Y4,Y0,Y1,Y2,Y5,Y6,12,Y10) + ROUND_0_TO_15(Y2,Y3,Y4,Y0,Y1,Y5,Y6,13,Y10) + ROUND_0_TO_15(Y1,Y2,Y3,Y4,Y0,Y5,Y6,14,Y10) + ROUND_0_TO_15(Y0,Y1,Y2,Y3,Y4,Y5,Y6,15,Y10) + VMOVDQU (AX),Y9 + VMOVDQU 32(AX),Y8 + ROUND_16_TO_19(Y4,Y0,Y1,Y2,Y3,Y5,Y6,16,Y10,Y7,Y8,Y9) + ROUND_16_TO_19(Y3,Y4,Y0,Y1,Y2,Y5,Y6,17,Y10,Y9,Y7,Y8) + ROUND_16_TO_19(Y2,Y3,Y4,Y0,Y1,Y5,Y6,18,Y10,Y8,Y9,Y7) + ROUND_16_TO_19(Y1,Y2,Y3,Y4,Y0,Y5,Y6,19,Y10,Y7,Y8,Y9) + VMOVDQU 32(BX), Y10 // contants for rounds 20-39 + ROUND_20_TO_39(Y0,Y1,Y2,Y3,Y4,Y5,Y6,20,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y4,Y0,Y1,Y2,Y3,Y5,Y6,21,Y10,Y8,Y9,Y7) + ROUND_20_TO_39(Y3,Y4,Y0,Y1,Y2,Y5,Y6,22,Y10,Y7,Y8,Y9) + ROUND_20_TO_39(Y2,Y3,Y4,Y0,Y1,Y5,Y6,23,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y1,Y2,Y3,Y4,Y0,Y5,Y6,24,Y10,Y8,Y9,Y7) + ROUND_20_TO_39(Y0,Y1,Y2,Y3,Y4,Y5,Y6,25,Y10,Y7,Y8,Y9) + ROUND_20_TO_39(Y4,Y0,Y1,Y2,Y3,Y5,Y6,26,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y3,Y4,Y0,Y1,Y2,Y5,Y6,27,Y10,Y8,Y9,Y7) + ROUND_20_TO_39(Y2,Y3,Y4,Y0,Y1,Y5,Y6,28,Y10,Y7,Y8,Y9) + ROUND_20_TO_39(Y1,Y2,Y3,Y4,Y0,Y5,Y6,29,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y0,Y1,Y2,Y3,Y4,Y5,Y6,30,Y10,Y8,Y9,Y7) + ROUND_20_TO_39(Y4,Y0,Y1,Y2,Y3,Y5,Y6,31,Y10,Y7,Y8,Y9) + ROUND_20_TO_39(Y3,Y4,Y0,Y1,Y2,Y5,Y6,32,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y2,Y3,Y4,Y0,Y1,Y5,Y6,33,Y10,Y8,Y9,Y7) + ROUND_20_TO_39(Y1,Y2,Y3,Y4,Y0,Y5,Y6,34,Y10,Y7,Y8,Y9) + ROUND_20_TO_39(Y0,Y1,Y2,Y3,Y4,Y5,Y6,35,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y4,Y0,Y1,Y2,Y3,Y5,Y6,36,Y10,Y8,Y9,Y7) + ROUND_20_TO_39(Y3,Y4,Y0,Y1,Y2,Y5,Y6,37,Y10,Y7,Y8,Y9) + ROUND_20_TO_39(Y2,Y3,Y4,Y0,Y1,Y5,Y6,38,Y10,Y9,Y7,Y8) + ROUND_20_TO_39(Y1,Y2,Y3,Y4,Y0,Y5,Y6,39,Y10,Y8,Y9,Y7) + VMOVDQU 64(BX), Y10 // contants for rounds 40-59 + ROUND_40_TO_59(Y0,Y1,Y2,Y3,Y4,Y5,Y6,40,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y4,Y0,Y1,Y2,Y3,Y5,Y6,41,Y10,Y9,Y7,Y8) + ROUND_40_TO_59(Y3,Y4,Y0,Y1,Y2,Y5,Y6,42,Y10,Y8,Y9,Y7) + ROUND_40_TO_59(Y2,Y3,Y4,Y0,Y1,Y5,Y6,43,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y1,Y2,Y3,Y4,Y0,Y5,Y6,44,Y10,Y9,Y7,Y8) + ROUND_40_TO_59(Y0,Y1,Y2,Y3,Y4,Y5,Y6,45,Y10,Y8,Y9,Y7) + ROUND_40_TO_59(Y4,Y0,Y1,Y2,Y3,Y5,Y6,46,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y3,Y4,Y0,Y1,Y2,Y5,Y6,47,Y10,Y9,Y7,Y8) + ROUND_40_TO_59(Y2,Y3,Y4,Y0,Y1,Y5,Y6,48,Y10,Y8,Y9,Y7) + ROUND_40_TO_59(Y1,Y2,Y3,Y4,Y0,Y5,Y6,49,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y0,Y1,Y2,Y3,Y4,Y5,Y6,50,Y10,Y9,Y7,Y8) + ROUND_40_TO_59(Y4,Y0,Y1,Y2,Y3,Y5,Y6,51,Y10,Y8,Y9,Y7) + ROUND_40_TO_59(Y3,Y4,Y0,Y1,Y2,Y5,Y6,52,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y2,Y3,Y4,Y0,Y1,Y5,Y6,53,Y10,Y9,Y7,Y8) + ROUND_40_TO_59(Y1,Y2,Y3,Y4,Y0,Y5,Y6,54,Y10,Y8,Y9,Y7) + ROUND_40_TO_59(Y0,Y1,Y2,Y3,Y4,Y5,Y6,55,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y4,Y0,Y1,Y2,Y3,Y5,Y6,56,Y10,Y9,Y7,Y8) + ROUND_40_TO_59(Y3,Y4,Y0,Y1,Y2,Y5,Y6,57,Y10,Y8,Y9,Y7) + ROUND_40_TO_59(Y2,Y3,Y4,Y0,Y1,Y5,Y6,58,Y10,Y7,Y8,Y9) + ROUND_40_TO_59(Y1,Y2,Y3,Y4,Y0,Y5,Y6,59,Y10,Y9,Y7,Y8) + VMOVDQU 96(BX), Y10 // contants for rounds 60-79 + ROUND_60_TO_79(Y0,Y1,Y2,Y3,Y4,Y5,Y6,60,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y4,Y0,Y1,Y2,Y3,Y5,Y6,61,Y10,Y7,Y8,Y9) + ROUND_60_TO_79(Y3,Y4,Y0,Y1,Y2,Y5,Y6,62,Y10,Y9,Y7,Y8) + ROUND_60_TO_79(Y2,Y3,Y4,Y0,Y1,Y5,Y6,63,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y1,Y2,Y3,Y4,Y0,Y5,Y6,64,Y10,Y7,Y8,Y9) + ROUND_60_TO_79(Y0,Y1,Y2,Y3,Y4,Y5,Y6,65,Y10,Y9,Y7,Y8) + ROUND_60_TO_79(Y4,Y0,Y1,Y2,Y3,Y5,Y6,66,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y3,Y4,Y0,Y1,Y2,Y5,Y6,67,Y10,Y7,Y8,Y9) + ROUND_60_TO_79(Y2,Y3,Y4,Y0,Y1,Y5,Y6,68,Y10,Y9,Y7,Y8) + ROUND_60_TO_79(Y1,Y2,Y3,Y4,Y0,Y5,Y6,69,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y0,Y1,Y2,Y3,Y4,Y5,Y6,70,Y10,Y7,Y8,Y9) + ROUND_60_TO_79(Y4,Y0,Y1,Y2,Y3,Y5,Y6,71,Y10,Y9,Y7,Y8) + ROUND_60_TO_79(Y3,Y4,Y0,Y1,Y2,Y5,Y6,72,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y2,Y3,Y4,Y0,Y1,Y5,Y6,73,Y10,Y7,Y8,Y9) + ROUND_60_TO_79(Y1,Y2,Y3,Y4,Y0,Y5,Y6,74,Y10,Y9,Y7,Y8) + ROUND_60_TO_79(Y0,Y1,Y2,Y3,Y4,Y5,Y6,75,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y4,Y0,Y1,Y2,Y3,Y5,Y6,76,Y10,Y7,Y8,Y9) + ROUND_60_TO_79(Y3,Y4,Y0,Y1,Y2,Y5,Y6,77,Y10,Y9,Y7,Y8) + ROUND_60_TO_79(Y2,Y3,Y4,Y0,Y1,Y5,Y6,78,Y10,Y8,Y9,Y7) + ROUND_60_TO_79(Y1,Y2,Y3,Y4,Y0,Y5,Y6,79,Y10,Y7,Y8,Y9) + VPADDD Y11,Y0,Y0 + VPADDD Y12,Y1,Y1 + VPADDD Y13,Y2,Y2 + VPADDD Y14,Y3,Y3 + VPADDD Y15,Y4,Y4 + VMOVDQU Y0,Y11 // make a copy of A,B,C,D,E + VMOVDQU Y1,Y12 + VMOVDQU Y2,Y13 + VMOVDQU Y3,Y14 + VMOVDQU Y4,Y15 + ADDQ $64,CX // i+=64 + JMP loop +done: + VMOVDQU Y0,8(DX) + VMOVDQU Y1,40(DX) + VMOVDQU Y2,72(DX) + VMOVDQU Y3,104(DX) + VMOVDQU Y4,136(DX) + VZEROUPPER + RET + +DATA K_XMM_AR<>+0x00(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x04(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x08(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x0c(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x10(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x14(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x18(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x1c(SB)/4,$0x5a827999 +DATA K_XMM_AR<>+0x20(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x24(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x28(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x2c(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x30(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x34(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x38(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x3c(SB)/4,$0x6ed9eba1 +DATA K_XMM_AR<>+0x40(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x44(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x48(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x4c(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x50(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x54(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x58(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x5c(SB)/4,$0x8f1bbcdc +DATA K_XMM_AR<>+0x60(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x64(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x68(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x6c(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x70(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x74(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x78(SB)/4,$0xca62c1d6 +DATA K_XMM_AR<>+0x7c(SB)/4,$0xca62c1d6 +GLOBL K_XMM_AR<>(SB),RODATA,$128 + +DATA BSWAP_SHUFB_CTL<>+0x00(SB)/4,$0x00010203 +DATA BSWAP_SHUFB_CTL<>+0x04(SB)/4,$0x04050607 +DATA BSWAP_SHUFB_CTL<>+0x08(SB)/4,$0x08090a0b +DATA BSWAP_SHUFB_CTL<>+0x0c(SB)/4,$0x0c0d0e0f +DATA BSWAP_SHUFB_CTL<>+0x10(SB)/4,$0x00010203 +DATA BSWAP_SHUFB_CTL<>+0x14(SB)/4,$0x04050607 +DATA BSWAP_SHUFB_CTL<>+0x18(SB)/4,$0x08090a0b +DATA BSWAP_SHUFB_CTL<>+0x1c(SB)/4,$0x0c0d0e0f +GLOBL BSWAP_SHUFB_CTL<>(SB),RODATA,$32 diff --git a/examples/ipsec/crypto_mb/sha1_test.go b/examples/ipsec/crypto_mb/sha1_test.go new file mode 100644 index 00000000..8aa41dfc --- /dev/null +++ b/examples/ipsec/crypto_mb/sha1_test.go @@ -0,0 +1,124 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package crypto_mb + +//TODO Separate test package? + +import ( + "fmt" + "strconv" + "testing" +) + +type sha1Test struct { + out string + in string +} + +var golden = []sha1Test{ + {"76245dbf96f661bd221046197ab8b9f063f11bad", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, + {"da39a3ee5e6b4b0d3255bfef95601890afd80709", ""}, + {"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", "a"}, + {"da23614e02469a0d7c7bd1bdab5c9c474b1904dc", "ab"}, + {"a9993e364706816aba3e25717850c26c9cd0d89d", "abc"}, + {"81fe8bfe87576c3ecb22426f8e57847382917acf", "abcd"}, + {"03de6c570bfe24bfc328ccd7ca46b76eadaf4334", "abcde"}, + {"1f8ac10f23c5b5bc1167bda84b833e5c057a77d2", "abcdef"}, + {"2fb5e13419fc89246865e7a324f476ec624e8740", "abcdefg"}, + {"425af12a0743502b322e93a015bcf868e324d56a", "abcdefgh"}, + {"c63b19f1e4c8b5f76b25c49b8b87f57d8e4872a1", "abcdefghi"}, + {"d68c19a0a345b7eab78d5e11e991c026ec60db63", "abcdefghij"}, + {"ebf81ddcbe5bf13aaabdc4d65354fdf2044f38a7", "Discard medicine more than two years old."}, + {"e5dea09392dd886ca63531aaa00571dc07554bb6", "He who has a shady past knows that nice guys finish last."}, + {"45988f7234467b94e3e9494434c96ee3609d8f8f", "I wouldn't marry him with a ten foot pole."}, + {"55dee037eb7460d5a692d1ce11330b260e40c988", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, + {"b7bc5fb91080c7de6b582ea281f8a396d7c0aee8", "The days of the digital watch are numbered. -Tom Stoppard"}, + {"c3aed9358f7c77f523afe86135f06b95b3999797", "Nepal premier won't resign."}, + {"6e29d302bf6e3a5e4305ff318d983197d6906bb9", "For every action there is an equal and opposite government program."}, + {"597f6a540010f94c15d71806a99a2c8710e747bd", "His money is twice tainted: 'taint yours and 'taint mine."}, + {"6859733b2590a8a091cecf50086febc5ceef1e80", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, + {"514b2630ec089b8aee18795fc0cf1f4860cdacad", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, + {"c5ca0d4a7b6676fc7aa72caa41cc3d5df567ed69", "size: a.out: bad magic"}, + {"74c51fa9a04eadc8c1bbeaa7fc442f834b90a00a", "The major problem is with sendmail. -Mark Horton"}, + {"0b4c4ce5f52c3ad2821852a8dc00217fa18b8b66", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, + {"3ae7937dd790315beb0f48330e8642237c61550a", "If the enemy is within range, then so are you."}, + {"410a2b296df92b9a47412b13281df8f830a9f44b", "It's well we cannot hear the screams/That we create in others' dreams."}, + {"841e7c85ca1adcddbdd0187f1289acb5c642f7f5", "You remind me of a TV show, but that's all right: I watch it anyway."}, + {"163173b825d03b952601376b25212df66763e1db", "C is as portable as Stonehedge!!"}, + {"32b0377f2687eb88e22106f133c586ab314d5279", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, + {"0885aaf99b569542fd165fa44e322718f4a984e0", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, + {"6627d6904d71420b0bf3886ab629623538689f45", "How can you write a big system without C++? -Paul Glick"}, +} + +func TestGolden(t *testing.T) { + for i := 0; i < len(golden); i++ { + g := golden[i] + inp := make([][]byte, 8) + for x := range inp { + inp[x] = make([]byte, len(g.in)) + copy(inp[x], []byte(g.in)) + } + c := New() + c.Write(inp) + sum := c.Sum(nil) + for x := range sum { + s := fmt.Sprintf("%x", sum[x]) + if s != g.out { + t.Fatalf("For input %s got %s want %s in lane %d", g.in, s, g.out, x) + } + } + } +} + +func TestGoldenTwoParts(t *testing.T) { + for i := 0; i < len(golden); i++ { + g := golden[i] + //TODO replace 8 with vecsize? + inp := make([][]byte, 8) + inp2 := make([][]byte, 8) + for x := range inp { + inp[x] = make([]byte, len(g.in)/2) + inp2[x] = make([]byte, len(g.in)-len(g.in)/2) + copy(inp[x], []byte(g.in)[0:len(g.in)/2]) + copy(inp2[x], []byte(g.in)[len(g.in)/2:]) + } + c := New() + c.Write(inp) + c.Sum(nil) + c.Write(inp2) + sum := c.Sum(nil) + for x := range sum { + s := fmt.Sprintf("%x", sum[x]) + if s != g.out { + t.Fatalf("For input %s got %s want %s in lane %d", g.in, s, g.out, x) + } + } + } +} + +func BenchmarkSha1(b *testing.B) { + sizes := []int{8, 320, 1024, 8096} + for i := range sizes { + size := sizes[i] + b.Run(strconv.Itoa(size), func(b *testing.B) { + b.SetBytes(int64(size) * 8) + inp := make([][]byte, 8) + for x := range inp { + inp[x] = make([]byte, size) + } + hasher := New() + sum := make([][]byte, 8) + for i := 0; i < b.N; i++ { + inp2 := make([][]byte, 8) + for x := range inp2 { + inp2[x] = inp[x][:size] + } + hasher.Reset() + hasher.Write(inp2) + hasher.Sum(sum) + } + }) + } +} diff --git a/examples/ipsec/ipsec_kernel.go b/examples/ipsec/ipsec_kernel.go new file mode 100644 index 00000000..46e312be --- /dev/null +++ b/examples/ipsec/ipsec_kernel.go @@ -0,0 +1,195 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Only IPv4, Only tunnel, Only ESP, Only AES-128-CBC +package ipsec + +import "github.com/intel-go/nff-go/packet" +import "github.com/intel-go/nff-go/flow" +import "github.com/intel-go/nff-go/common" +import "bytes" +import "unsafe" +import "crypto/aes" + +const esp = 0x32 +const mode1234 = 1234 +const espHeadLen = 24 +const authLen = 12 +const espTailLen = authLen + 2 +const etherLen = common.EtherLen +const outerIPLen = common.IPv4MinLen + +type espHeader struct { + SPI uint32 + SEQ uint32 + IV [16]byte +} + +type espTail struct { + paddingLen uint8 + nextIP uint8 + Auth [authLen]byte +} + +// General decapsulation +func Decapsulation(currentPacket *packet.Packet, context flow.UserContext) bool { + length := currentPacket.GetPacketLen() + currentESPHeader := (*espHeader)(currentPacket.StartAtOffset(etherLen + outerIPLen)) + currentESPTail := (*espTail)(unsafe.Pointer(currentPacket.StartAtOffset(uintptr(length) - espTailLen))) + // Security Association + switch packet.SwapBytesUint32(currentESPHeader.SPI) { + case mode1234: + encryptionPart := (*[common.MaxLength]byte)(unsafe.Pointer(currentPacket.StartAtOffset(0)))[etherLen+outerIPLen+espHeadLen : length-authLen] + authPart := (*[common.MaxLength]byte)(unsafe.Pointer(currentPacket.StartAtOffset(0)))[etherLen+outerIPLen : length-authLen] + if decapsulationSPI123(authPart, currentESPTail.Auth, currentESPHeader.IV, encryptionPart, context) == false { + return false + } + default: + return false + } + // Decapsulate + currentPacket.DecapsulateHead(etherLen, outerIPLen+espHeadLen) + currentPacket.DecapsulateTail(length-espTailLen-uint(currentESPTail.paddingLen), uint(currentESPTail.paddingLen)+espTailLen) + + return true +} + +// Specific decapsulation +func decapsulationSPI123(currentAuth []byte, Auth [authLen]byte, iv [16]byte, ciphertext []byte, context0 flow.UserContext) bool { + context := (context0).(*SContext) + + context.mac123.Reset() + context.mac123.Write(currentAuth) + if bytes.Equal(context.mac123.Sum(nil)[0:12], Auth[:]) == false { + return false + } + + // Decryption + if len(ciphertext) < aes.BlockSize || len(ciphertext)%aes.BlockSize != 0 { + return false + } + context.modeDec.(SetIVer).SetIV(iv[:]) + context.modeDec.CryptBlocks(ciphertext, ciphertext) + return true +} + +// General encapsulation +func VectorEncapsulation(currentPackets []*packet.Packet, mask *[32]bool, notDrop *[32]bool, context flow.UserContext) { + n := uint(0) + for i := uint(0); i < 32; i++ { + if (*mask)[i] == true { + currentPackets[i].EncapsulateHead(etherLen, outerIPLen+espHeadLen) + currentPackets[i].ParseL3() + ipv4 := currentPackets[i].GetIPv4NoCheck() + ipv4.SrcAddr = packet.BytesToIPv4(111, 22, 3, 0) + ipv4.DstAddr = packet.BytesToIPv4(3, 22, 111, 0) + ipv4.VersionIhl = 0x45 + ipv4.NextProtoID = esp + notDrop[i] = true + n++ + } + } + // TODO All packets will be encapsulated as 1234 + vectorEncapsulationSPI123(currentPackets, n, context) +} + +// Specific encapsulation +func vectorEncapsulationSPI123(currentPackets []*packet.Packet, n uint, context0 flow.UserContext) { + context := context0.(*VContext) + s := VECTOR * (n/VECTOR + 1) + var Z uint + + // TODO Only for equal length + length := currentPackets[0].GetPacketLen() + paddingLength := uint8((16 - (length-(etherLen+outerIPLen+espHeadLen)-espTailLen)%16) % 16) + newLength := length + uint(paddingLength) + espTailLen + + for i := uint(0); i < s; i += VECTOR { + if i == s-VECTOR { + Z = n % VECTOR + } else { + Z = VECTOR + } + for t := uint(0); t < Z; t++ { + currentPackets[i+t].GetIPv4NoCheck().TotalLength = packet.SwapBytesUint16(uint16(newLength) - etherLen) + currentPackets[i+t].EncapsulateTail(length, uint(paddingLength)+espTailLen) + + currentESPHeader := (*espHeader)(unsafe.Pointer(currentPackets[i+t].StartAtOffset(etherLen + outerIPLen))) + currentESPHeader.SPI = packet.SwapBytesUint32(mode1234) + // TODO should be random + currentESPHeader.IV = [16]byte{0x90, 0x9d, 0x78, 0xa8, 0x72, 0x70, 0x68, 0x00, 0x8f, 0xdc, 0x55, 0x73, 0xa3, 0x75, 0xb5, 0xa7} + + currentESPTail := (*espTail)(unsafe.Pointer(currentPackets[i+t].StartAtOffset(uintptr(newLength) - espTailLen))) + if paddingLength > 0 { + // 1 2 3 4 5 6 7 8 + *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(currentESPTail)) - uintptr(paddingLength))) = 578437695752307201 + if paddingLength > 8 { + // 9 10 11 12 13 14 15 16 + *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(currentESPTail)) - uintptr(paddingLength) + 8)) = 1157159078456920585 + } + } + currentESPTail.paddingLen = paddingLength + currentESPTail.nextIP = common.IPNumber + + context.vectorEncryptionPart[t] = (*[common.MaxLength]byte)(unsafe.Pointer(currentPackets[i+t].StartAtOffset(0)))[etherLen+outerIPLen+espHeadLen : newLength-authLen] + context.vectorIV[t] = currentESPHeader.IV[:] + context.vectorAuthPart[t] = (*[common.MaxLength]byte)(unsafe.Pointer(currentPackets[i+t].StartAtOffset(0)))[etherLen+outerIPLen : newLength-authLen] + context.vectorAuthPlace[t] = currentESPTail.Auth[:] + } + Encrypt(context.vectorEncryptionPart, context.vectorEncryptionPart, context.vectorIV, Z, context) + Authenticate(context.vectorAuthPart, context.vectorAuthPlace, Z, context) + } +} + +// General encapsulation +func ScalarEncapsulation(currentPacket *packet.Packet, context flow.UserContext) bool { + currentPacket.EncapsulateHead(etherLen, outerIPLen+espHeadLen) + + currentPacket.ParseL3() + ipv4 := currentPacket.GetIPv4NoCheck() + ipv4.SrcAddr = packet.BytesToIPv4(111, 22, 3, 0) + ipv4.DstAddr = packet.BytesToIPv4(3, 22, 111, 0) + ipv4.VersionIhl = 0x45 + ipv4.NextProtoID = esp + + // TODO All packets will be encapsulated as 1234 + scalarEncapsulationSPI123(currentPacket, context) + return true +} + +// Specific encapsulation +func scalarEncapsulationSPI123(currentPacket *packet.Packet, context0 flow.UserContext) { + context := (context0).(*SContext) + length := currentPacket.GetPacketLen() + paddingLength := uint8((16 - (length-(etherLen+outerIPLen+espHeadLen)-espTailLen)%16) % 16) + newLength := length + uint(paddingLength) + espTailLen + currentPacket.GetIPv4NoCheck().TotalLength = packet.SwapBytesUint16(uint16(newLength) - etherLen) + currentPacket.EncapsulateTail(length, uint(paddingLength)+espTailLen) + + currentESPHeader := (*espHeader)(currentPacket.StartAtOffset(etherLen + outerIPLen)) + currentESPHeader.SPI = packet.SwapBytesUint32(mode1234) + // TODO should be random + currentESPHeader.IV = [16]byte{0x90, 0x9d, 0x78, 0xa8, 0x72, 0x70, 0x68, 0x00, 0x8f, 0xdc, 0x55, 0x73, 0xa3, 0x75, 0xb5, 0xa7} + + currentESPTail := (*espTail)(currentPacket.StartAtOffset(uintptr(newLength) - espTailLen)) + if paddingLength > 0 { + *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(currentESPTail)) - uintptr(paddingLength))) = 578437695752307201 + if paddingLength > 8 { + *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(currentESPTail)) - uintptr(paddingLength) + 8)) = 1157159078456920585 + } + } + currentESPTail.paddingLen = paddingLength + currentESPTail.nextIP = common.IPNumber + + // Encryption + EncryptionPart := (*[common.MaxLength]byte)(currentPacket.StartAtOffset(0))[etherLen+outerIPLen+espHeadLen : newLength-authLen] + context.modeEnc.(SetIVer).SetIV(currentESPHeader.IV[:]) + context.modeEnc.CryptBlocks(EncryptionPart, EncryptionPart) + + // Authentication + context.mac123.Reset() + AuthPart := (*[common.MaxLength]byte)(currentPacket.StartAtOffset(0))[etherLen+outerIPLen : newLength-authLen] + context.mac123.Write(AuthPart) + copy(currentESPTail.Auth[:], context.mac123.Sum(nil)) +} diff --git a/examples/ipsec/perf/.gitignore b/examples/ipsec/perf/.gitignore new file mode 100644 index 00000000..70025a7f --- /dev/null +++ b/examples/ipsec/perf/.gitignore @@ -0,0 +1 @@ +ipsec diff --git a/examples/ipsec/perf/Dockerfile b/examples/ipsec/perf/Dockerfile new file mode 100644 index 00000000..c0445c28 --- /dev/null +++ b/examples/ipsec/perf/Dockerfile @@ -0,0 +1,11 @@ +# Copyright 2019 Intel Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +ARG USER_NAME +FROM ${USER_NAME}/nff-go-base + +LABEL RUN docker run -it --privileged -v /sys/bus/pci/drivers:/sys/bus/pci/drivers -v /sys/kernel/mm/hugepages:/sys/kernel/mm/hugepages -v /sys/devices/system/node:/sys/devices/system/node -v /dev:/dev --name NAME -e NAME=NAME -e IMAGE=IMAGE IMAGE + +WORKDIR /workdir +COPY perf . diff --git a/examples/ipsec/perf/Makefile b/examples/ipsec/perf/Makefile new file mode 100644 index 00000000..636e9002 --- /dev/null +++ b/examples/ipsec/perf/Makefile @@ -0,0 +1,8 @@ +# Copyright 2019 Intel Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +PATH_TO_MK = ../../../mk +IMAGENAME = nff-go-examples +EXECUTABLES = ipsec +include $(PATH_TO_MK)/leaf.mk diff --git a/examples/ipsec/perf/ipsec.go b/examples/ipsec/perf/ipsec.go new file mode 100644 index 00000000..598d25d8 --- /dev/null +++ b/examples/ipsec/perf/ipsec.go @@ -0,0 +1,39 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "github.com/intel-go/nff-go/examples/ipsec" +import "github.com/intel-go/nff-go/flow" +import "flag" + +func main() { + outport := flag.Uint("outport", 1, "port for sender") + inport := flag.Uint("inport", 0, "port for receiver") + noscheduler := flag.Bool("no-scheduler", false, "disable scheduler") + dpdkLogLevel := flag.String("dpdk", "--log-level=0", "Passes an arbitrary argument to dpdk EAL") + cores := flag.String("cores", "0-10", "Cores mask. Avoid hyperthreading here") + vector := flag.Bool("v", false, "vector version") + dec := flag.Bool("d", false, "decapsulate after encapsulation") + + flag.Parse() + + config := flow.Config{ + DisableScheduler: *noscheduler, + DPDKArgs: []string{*dpdkLogLevel}, + CPUList: *cores, + } + flow.SystemInit(&config) + input, _ := flow.SetReceiver(uint16(*inport)) + if *vector { + flow.SetVectorHandlerDrop(input, ipsec.VectorEncapsulation, ipsec.VContext{}) + } else { + flow.SetHandlerDrop(input, ipsec.ScalarEncapsulation, ipsec.SContext{}) + } + if *dec { + flow.SetHandlerDrop(input, ipsec.Decapsulation, ipsec.SContext{}) + } + flow.SetSender(input, uint16(*outport)) + flow.SystemStart() +} diff --git a/examples/ipsec/stability/.gitignore b/examples/ipsec/stability/.gitignore new file mode 100644 index 00000000..2cad83dc --- /dev/null +++ b/examples/ipsec/stability/.gitignore @@ -0,0 +1 @@ +stability diff --git a/examples/ipsec/stability/Dockerfile b/examples/ipsec/stability/Dockerfile new file mode 100644 index 00000000..6c77e9ca --- /dev/null +++ b/examples/ipsec/stability/Dockerfile @@ -0,0 +1,11 @@ +# Copyright 2019 Intel Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +ARG USER_NAME +FROM ${USER_NAME}/nff-go-base + +LABEL RUN docker run -it --privileged -v /sys/bus/pci/drivers:/sys/bus/pci/drivers -v /sys/kernel/mm/hugepages:/sys/kernel/mm/hugepages -v /sys/devices/system/node:/sys/devices/system/node -v /dev:/dev --name NAME -e NAME=NAME -e IMAGE=IMAGE IMAGE + +WORKDIR /workdir +COPY stability . diff --git a/examples/ipsec/stability/Makefile b/examples/ipsec/stability/Makefile new file mode 100644 index 00000000..06952023 --- /dev/null +++ b/examples/ipsec/stability/Makefile @@ -0,0 +1,8 @@ +# Copyright 2019 Intel Corporation. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +PATH_TO_MK = ../../../mk +IMAGENAME = nff-go-examples +EXECUTABLES = stability +include $(PATH_TO_MK)/leaf.mk diff --git a/examples/ipsec/stability/ipsec_test.go b/examples/ipsec/stability/ipsec_test.go new file mode 100644 index 00000000..390bf497 --- /dev/null +++ b/examples/ipsec/stability/ipsec_test.go @@ -0,0 +1,106 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "github.com/intel-go/nff-go/examples/ipsec" +import "github.com/intel-go/nff-go/flow" +import "github.com/intel-go/nff-go/packet" +import "unsafe" +import "testing" +import "time" + +var t *testing.T +var n1 int +var n2 int +var s = make(chan int) +var s1 = make(chan int) + +func init() { + config := flow.Config{ + CPUList: "0-15", + MbufNumber: 8191 * 4, + RingSize: 64 * 8, + } + flow.SystemInit(&config) +} + +func TestVector(m *testing.T) { + t = m + n1 = 0 + n2 = 0 + input1 := flow.SetGenerator(generatePacket, nil) + flow.SetVectorHandlerDrop(input1, ipsec.VectorEncapsulation, ipsec.VContext{}) + flow.SetHandlerDrop(input1, ipsec.Decapsulation, ipsec.SContext{}) + flow.SetHandler(input1, check, nil) + flow.SetStopper(input1) + + go flow.SystemStart() + <-s1 + flow.SystemStop() +} + +func TestScalar(m *testing.T) { + t = m + n1 = 0 + n2 = 0 + input2 := flow.SetGenerator(generatePacket, nil) + flow.SetHandlerDrop(input2, ipsec.ScalarEncapsulation, ipsec.SContext{}) + flow.SetHandlerDrop(input2, decapsulation, sContext{}) + flow.SetHandler(input2, check, nil) + flow.SetStopper(input2) + + go flow.SystemStart() + <-s1 + flow.SystemStop() +} + +func generatePacket(pkt *packet.Packet, context flow.UserContext) { + packet.InitEmptyIPv4TCPPacket(pkt, 6) + + for i := 0; i < 60; i++ { + // This will full rewrite packet. No parsing methods are allowed + // Because EtherType and VersionIhl are wrong now. + (*((*[60]byte)(unsafe.Pointer(pkt.StartAtOffset(0)))))[i] = byte(n1 % 10) + } + n1++ + if n1 == 10001 { + <-s + s1 <- 1 + time.Sleep(10000) + } + + pkt.Ether.DAddr = [6]uint8{0x11, 0x22, 0x33, 0x44, 0x55, 0x66} + pkt.Ether.SAddr = [6]uint8{0x66, 0x55, 0x44, 0x33, 0x22, 0x11} + pkt.GetIPv4NoCheck().SrcAddr = packet.BytesToIPv4(123, 45, 6, 0) + pkt.GetIPv4NoCheck().DstAddr = packet.BytesToIPv4(5, 43, 210, 0) + pkt.GetTCPNoCheck().SrcPort = packet.SwapBytesUint16(999) + pkt.GetTCPNoCheck().DstPort = packet.SwapBytesUint16(111) +} + +var groundTruth = [][]byte{{17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}, + {17, 34, 51, 68, 85, 102, 102, 85, 68, 51, 34, 17, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 123, 45, 6, 0, 5, 43, 210, 0, 3, 231, 0, 111, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}} + +func check(currentPacket *packet.Packet, context flow.UserContext) { + W := currentPacket.GetRawPacketBytes() + for i := 0; i < 60; i++ { + if W[i] != groundTruth[n2%10][i] { + if n2 < 10000 { + t.Errorf("Raw truth=%x\nRaw bytes=%x\n", groundTruth[n2%10], W) + } + } + } + n2++ + if n2 == 10000 { + s <- 1 + } +} diff --git a/examples/ipsec/stability/stability.go b/examples/ipsec/stability/stability.go new file mode 100644 index 00000000..add0698c --- /dev/null +++ b/examples/ipsec/stability/stability.go @@ -0,0 +1,74 @@ +// Copyright 2019 Intel Corporation. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "github.com/intel-go/nff-go/flow" +import "github.com/intel-go/nff-go/packet" +import "github.com/intel-go/nff-go/examples/ipsec" +import "flag" +import "fmt" +import "time" + +var step int + +func main() { + vector := flag.Bool("v", false, "vector version") + mode := flag.Bool("m", false, "check encapsulation") + flag.Parse() + + config := flow.Config{ + DisableScheduler: true, + } + flow.SystemInit(&config) + + var input *flow.Flow + gen := flow.SetGenerator(gen, nil) + flow.SetHandler(gen, dump_before, nil) + if *mode { + if *vector { + flow.SetVectorHandlerDrop(gen, ipsec.VectorEncapsulation, ipsec.VContext{}) + } else { + flow.SetHandlerDrop(gen, ipsec.ScalarEncapsulation, ipsec.SContext{}) + } + flow.SetSender(gen, 1) + input, _ = flow.SetReceiver(0) + } else { + flow.SetSender(gen, 0) + input, _ = flow.SetReceiver(1) + flow.SetHandlerDrop(input, ipsec.Decapsulation, ipsec.SContext{}) + } + flow.SetHandler(input, dump_after, nil) + flow.SetStopper(input) + flow.SystemStart() +} + +func gen(pkt *packet.Packet, context flow.UserContext) { + packet.InitEmptyIPv4TCPPacket(pkt, 50) + ipv4 := pkt.GetIPv4() + tcp := pkt.GetTCPForIPv4() + + pkt.Ether.DAddr = [6]uint8{1,2,3,4,5,6} + pkt.Ether.SAddr = [6]uint8{1,2,3,4,5,6} + + ipv4.SrcAddr = packet.BytesToIPv4(111,111,111,111) + ipv4.DstAddr = packet.BytesToIPv4(222,222,222,222) + + tcp.SrcPort = packet.SwapBytesUint16(25) + tcp.DstPort = packet.SwapBytesUint16(35) + + step++ + if step == 100 { + time.Sleep(100 * time.Millisecond) + step = 0 + } +} + +func dump_before(currentPacket *packet.Packet, context flow.UserContext) { + fmt.Printf("Raw bytes before=%x\n", currentPacket.GetRawPacketBytes()) +} + +func dump_after(currentPacket *packet.Packet, context flow.UserContext) { + fmt.Printf("Raw bytes after =%x\n", currentPacket.GetRawPacketBytes()) +} diff --git a/examples/ipsec/stability/test.conf b/examples/ipsec/stability/test.conf new file mode 100644 index 00000000..491afa09 --- /dev/null +++ b/examples/ipsec/stability/test.conf @@ -0,0 +1,10 @@ +sp ipv4 out esp protect 1234 pri 1 dst 222.222.222.0/24 sport 0:65535 dport 0:65535 +sa out 1234 cipher_algo aes-128-cbc cipher_key 41:45:53:31:32:38:4b:65:79:2d:31:36:43:68:61:72 \ + auth_algo sha1-hmac auth_key 71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71 \ + mode ipv4-tunnel src 111.22.3.0 dst 3.22.111.0 +rt ipv4 dst 3.22.111.0/24 port 1 + +sa in 1234 cipher_algo aes-128-cbc cipher_key 41:45:53:31:32:38:4b:65:79:2d:31:36:43:68:61:72 \ + auth_algo sha1-hmac auth_key 71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71:71 \ + mode ipv4-tunnel src 111.22.3.0 dst 3.22.111.0 +rt ipv4 dst 222.222.222.222/24 port 0 diff --git a/examples/ipsec/stability/test.sh b/examples/ipsec/stability/test.sh new file mode 100644 index 00000000..332bdfcb --- /dev/null +++ b/examples/ipsec/stability/test.sh @@ -0,0 +1,3 @@ +# instruction for crypt library in DPDK: https://doc.dpdk.org/guides/cryptodevs/aesni_mb.html +# instruction for ipsec application: https://doc.dpdk.org/guides/sample_app_ug/ipsec_secgw.html +./build/ipsec-secgw -l 4,5 -n 4 --socket-mem 0,1024 --vdev "crypto_aesni_mb" -- -p 0xf -P -u 0x2 --config="(0,0,4),(1,0,5)" -f test.conf From 4c61f5fc34628abb9ae7696b35ef4be444261b0b Mon Sep 17 00:00:00 2001 From: Gregory Shimansky Date: Fri, 25 Jan 2019 13:55:45 -0600 Subject: [PATCH 19/20] Prepend reading scripts instead of appending because of Ubuntu checks --- vagrant/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index 88f7e904..c373d107 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -130,7 +130,7 @@ echo Unpacking Go language into /opt mkdir go chmod +x ~/scripts.sh . ~/scripts.sh -echo . ~/scripts.sh >> .bashrc +echo -e ". ~/scripts.sh\n$(cat .bashrc)" > .bashrc setuptesthost echo Downloading and building NFF-GO framework From 27f4aa0153df96f956b89ec498315535d764f0dd Mon Sep 17 00:00:00 2001 From: Ilia Filippov Date: Fri, 25 Jan 2019 15:29:13 -0600 Subject: [PATCH 20/20] Fix problem with allocating to much TX queues --- examples/ipsec/perf/Dockerfile | 2 +- low/low.h | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/examples/ipsec/perf/Dockerfile b/examples/ipsec/perf/Dockerfile index c0445c28..29259f7b 100644 --- a/examples/ipsec/perf/Dockerfile +++ b/examples/ipsec/perf/Dockerfile @@ -8,4 +8,4 @@ FROM ${USER_NAME}/nff-go-base LABEL RUN docker run -it --privileged -v /sys/bus/pci/drivers:/sys/bus/pci/drivers -v /sys/kernel/mm/hugepages:/sys/kernel/mm/hugepages -v /sys/devices/system/node:/sys/devices/system/node -v /dev:/dev --name NAME -e NAME=NAME -e IMAGE=IMAGE IMAGE WORKDIR /workdir -COPY perf . +COPY ipsec . diff --git a/low/low.h b/low/low.h index 76a69355..6bbf350f 100644 --- a/low/low.h +++ b/low/low.h @@ -172,6 +172,13 @@ int check_port_rss(uint16_t port) { return dev_info.max_rx_queues; } +int check_port_tx(uint16_t port) { + struct rte_eth_dev_info dev_info; + memset(&dev_info, 0, sizeof(dev_info)); + rte_eth_dev_info_get(port, &dev_info); + return dev_info.max_tx_queues; +} + // Initializes a given port using global settings and with the RX buffers // coming from the mbuf_pool passed as a parameter. int port_init(uint16_t port, bool willReceive, struct rte_mempool **mbuf_pools, bool promiscuous, bool hwtxchecksum, int32_t inIndex) { @@ -181,17 +188,15 @@ int port_init(uint16_t port, bool willReceive, struct rte_mempool **mbuf_pools, memset(&dev_info, 0, sizeof(dev_info)); rte_eth_dev_info_get(port, &dev_info); + if (tx_rings > dev_info.max_tx_queues) { + tx_rings = check_port_tx(port); + } + if (willReceive) { rx_rings = inIndex; - if (tx_rings == 0) { - // All receive ports should have at least one send queue to handle ARP - tx_rings = 1; - } } else { rx_rings = 0; } - int retval; - uint16_t q; if (port >= rte_eth_dev_count()) return -1; @@ -210,12 +215,12 @@ int port_init(uint16_t port, bool willReceive, struct rte_mempool **mbuf_pools, } /* Configure the Ethernet device. */ - retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf_default); + int retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf_default); if (retval != 0) return retval; /* Allocate and set up RX queues per Ethernet port. */ - for (q = 0; q < rx_rings; q++) { + for (uint16_t q = 0; q < rx_rings; q++) { retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE, rte_eth_dev_socket_id(port), NULL, mbuf_pools[q]); if (retval < 0) @@ -223,7 +228,7 @@ int port_init(uint16_t port, bool willReceive, struct rte_mempool **mbuf_pools, } /* Allocate and set up TX queues per Ethernet port. */ - for (q = 0; q < tx_rings; q++) { + for (uint16_t q = 0; q < tx_rings; q++) { retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE, rte_eth_dev_socket_id(port), &dev_info.default_txconf); if (retval < 0) @@ -409,6 +414,7 @@ void nff_go_send(uint16_t port, struct rte_ring **in_rings, int32_t inIndexNumbe uint16_t buf; uint16_t tx_pkts_number; int16_t queue = 0; + bool switchQueue = (check_port_tx(port) > 1) && (anyway || inIndexNumber > 1); while (*flag == process) { for (int q = 0; q < inIndexNumber; q++) { // Get packets for TX from ring @@ -420,7 +426,7 @@ void nff_go_send(uint16_t port, struct rte_ring **in_rings, int32_t inIndexNumbe tx_pkts_number = rte_eth_tx_burst(port, queue, bufs, pkts_for_tx_number); // inIndexNumber must be "1" or even. This prevents any reordering. // anyway allows reordering explicitly - if (anyway || inIndexNumber > 1) { + if (switchQueue) { queue = !queue; } // Free any unsent packets