Miscellaneous helper functions.
More...
#include <endian.h>
#include <enso/consts.h>
#include <enso/internals.h>
#include <enso/ixy_helpers.h>
#include <immintrin.h>
#include <netinet/ether.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <pthread.h>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <thread>
#include <vector>
Go to the source code of this file.
Miscellaneous helper functions.
- Author
- Hugo Sadok sadok.nosp@m.@cmu.nosp@m..edu
Definition in file helpers.h.
◆ _enso_always_inline
#define _enso_always_inline __attribute__((always_inline)) inline |
◆ _enso_compiler_memory_barrier
#define _enso_compiler_memory_barrier |
( |
| ) |
|
Value: do { \
asm volatile("" : : : "memory"); \
} while (0)
Definition at line 73 of file helpers.h.
◆ likely
#define likely |
( |
|
x | ) |
__builtin_expect((x), 1) |
◆ unlikely
#define unlikely |
( |
|
x | ) |
__builtin_expect((x), 0) |
◆ be_to_le_16()
constexpr uint16_t enso::be_to_le_16 |
( |
const uint16_t |
le | ) |
|
|
constexpr |
◆ get_bdf_from_pcie_addr()
uint16_t enso::get_bdf_from_pcie_addr |
( |
const std::string & |
pcie_addr | ) |
|
◆ get_next_pkt()
_enso_always_inline uint8_t * enso::get_next_pkt |
( |
uint8_t * |
pkt | ) |
|
◆ get_pkt_len()
_enso_always_inline uint16_t enso::get_pkt_len |
( |
const uint8_t * |
addr | ) |
|
◆ get_pkt_rtt()
uint32_t enso::get_pkt_rtt |
( |
const uint8_t * |
pkt, |
|
|
const uint8_t |
rtt_offset = kDefaultRttOffset |
|
) |
| |
|
inline |
Returns RTT, in number of cycles, for a given packet.
This assumes that the packet has been timestamped by hardware. To enable timestamping call the Device::EnableTimeStamping
method.
To convert from number of cycles to ns. Do cycles * kNsPerTimestampCycle
.
- Parameters
-
pkt | Packet to retrieve the RTT from. |
rtt_offset | Offset in bytes where the RTT is stored. |
- Returns
- Return RTT measure for the packet in number of cycles. If timestamp is not enabled on the NIC, the value returned is undefined.
Definition at line 99 of file helpers.h.
◆ memcpy_64_align()
_enso_always_inline void enso::memcpy_64_align |
( |
void * |
dst, |
|
|
const void * |
src, |
|
|
size_t |
n |
|
) |
| |
Copies data from src to dst.
- Parameters
-
dst | Destination address. |
src | Source address. |
n | 64-byte aligned number of bytes to copy. |
Definition at line 172 of file helpers.h.
◆ mov64()
_enso_always_inline void enso::mov64 |
( |
uint8_t * |
dst, |
|
|
const uint8_t * |
src |
|
) |
| |
◆ print_buf()
void enso::print_buf |
( |
void * |
buf, |
|
|
const uint32_t |
nb_cache_lines |
|
) |
| |
◆ print_ip()
void enso::print_ip |
( |
uint32_t |
ip | ) |
|
◆ print_pkt_header()
void enso::print_pkt_header |
( |
uint8_t * |
pkt | ) |
|
◆ print_pkt_ips()
void enso::print_pkt_ips |
( |
uint8_t * |
pkt | ) |
|
◆ set_core_id()
int enso::set_core_id |
( |
std::thread & |
thread, |
|
|
int |
core_id |
|
) |
| |
◆ show_stats()
void enso::show_stats |
( |
const std::vector< stats_t > & |
thread_stats, |
|
|
volatile bool * |
keep_running |
|
) |
| |