Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tools/ft-analyzer/ftanalyzer/common/fast_analyzer_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
)
from ftanalyzer.reports.statistical_report import StatisticalReport

SITE_PACKAGES_PREFIX = sysconfig.get_path("stdlib")
GLOBAL_IMPORT_DIR = f"{SITE_PACKAGES_PREFIX}/site-packages/flowtest"
GLOBAL_IMPORT_DIR = os.path.join(sysconfig.get_path("platlib"), "flowtest")


def fast_analyzer_available() -> bool:
Expand Down
2 changes: 1 addition & 1 deletion tools/ft-fast-analyzer/src/statisticalmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct SMSubnetSegment final : public SMSegment {

std::optional<IPNetwork> source; ///< Source subnet.
std::optional<IPNetwork> dest; ///< Destination subnet.
bool bidir; ///< Bidirectional flag.
bool bidir = false; ///< Bidirectional flag.
};

/**
Expand Down
2 changes: 1 addition & 1 deletion tools/ft-generator/src/config/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ uint64_t ParseSpeedUnit(const YAML::Node& node)
throw ConfigError(node, "invalid speed unit value");
}

return OverflowCheckedMultiply(*value, multiplier * 8);
return OverflowCheckedMultiply(*value, multiplier);
}

void ConfigError::PrintPrettyError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def calc_min_gap_nanos(packet_size, link_speed_gbps, min_packet_gap_ns):

transfer_nanos = frame_total * 1_000_000_000 / (link_speed_gbps * 1_000_000_000)

return min(transfer_nanos, min_packet_gap_ns)
return transfer_nanos + min_packet_gap_ns


def test_timestamp(ft_generator: Generator):
Expand Down
2 changes: 1 addition & 1 deletion tools/ft-profile-sampler/src/biflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void Biflow::CreateHistogram(ft::Timestamp start, ft::Timestamp interval, unsign
double Biflow::GetHistogramBin(unsigned idx) const
{
if (pkt_hist.size() == 0) {
std::runtime_error("packet histogram has not been created");
throw std::runtime_error("packet histogram has not been created");
}

if (idx >= start_window_idx && idx <= end_window_idx) {
Expand Down
4 changes: 2 additions & 2 deletions tools/ft-profile-sampler/src/evolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void Evolution::CreateInitialPopulation()
}

for (auto& fut : futures) {
fut.wait();
fut.get();
}

UpdateFitnessStats();
Expand All @@ -46,7 +46,7 @@ void Evolution::InitialPopulationWorker(uint64_t seed)
uint64_t profileSize = _profile->GetSize();
std::mt19937_64 rnd(seed);
std::uniform_int_distribution<uint64_t> geneCountDistrib(_minGenesCnt, _maxGenesCnt);
std::uniform_int_distribution<uint64_t> geneDistrib(0, profileSize);
std::uniform_int_distribution<uint64_t> geneDistrib(0, profileSize - 1);
while (true) {
{
std::lock_guard<std::mutex> lock(_mtx);
Expand Down
2 changes: 1 addition & 1 deletion tools/ft-profile-sampler/src/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void Metrics::GatherWindowStats(const std::vector<Biflow>& data, unsigned histSi
}
const auto& biflow = data[i];
for (unsigned windowIndex = biflow.start_window_idx / WINDOW_SIZE;
windowIndex <= biflow.end_window_idx / WINDOW_SIZE + 1;
windowIndex <= biflow.end_window_idx / WINDOW_SIZE;
windowIndex++) {
double pkts = 0;
for (unsigned j = 0; j < WINDOW_SIZE; j++) {
Expand Down
7 changes: 5 additions & 2 deletions tools/ft-replay/src/dpdkPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

namespace replay {

// Ethernet frame overhead: 14-byte header + 4-byte FCS
static constexpr size_t ETH_OVERHEAD = 18;

// register the dpdk plugin to the factory
OutputPluginFactoryRegistrator<DpdkPlugin> dpdkPluginRegistration("dpdk");

Expand Down Expand Up @@ -146,7 +149,7 @@ int DpdkPlugin::GetDpdkPort(const std::string& PCIAddress, struct rte_eth_dev_in
throwErr();
}

if (_MTUSize < devInfo->min_mtu || _MTUSize > devInfo->max_mtu) {
if ((_MTUSize - ETH_OVERHEAD) < devInfo->min_mtu || (_MTUSize - ETH_OVERHEAD) > devInfo->max_mtu) {
_logger->error(
"MTU size of out NIC supported range {}-{}",
devInfo->min_mtu,
Expand Down Expand Up @@ -185,7 +188,7 @@ void DpdkPlugin::ConfigureDpdkPort(uint16_t portId)
}
}

ret = rte_eth_dev_set_mtu(portId, _MTUSize);
ret = rte_eth_dev_set_mtu(portId, _MTUSize - ETH_OVERHEAD);
if (ret < 0) {
_logger->error("rte_eth_dev_set_mtu() has failed with code {}", ret);
throwErr();
Expand Down
6 changes: 3 additions & 3 deletions tools/ft-replay/src/packet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ enum class OutInterface {
*
*/
struct PacketInfo {
enum L3Type l3Type;
L3Type l3Type;
uint16_t l3Offset;

enum L4Type l4Type;
L4Type l4Type;
uint16_t l4Offset; //< Zero if l4type == L4Type::NotFound

uint16_t ipAddressesChecksum; //< checksum of IP addresses in host byte order

enum OutInterface outInterface; //< used for multi-port replaying
OutInterface outInterface; //< used for multi-port replaying
};

/**
Expand Down
4 changes: 2 additions & 2 deletions tools/ft-replay/src/packetBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void PacketBuilder::PresetHwChecksum(Packet& packet)
}
}

int PacketBuilder::DecidePort(const std::byte* rawData, enum L3Type l3Type, uint16_t l3Offset) const
int PacketBuilder::DecidePort(const std::byte* rawData, L3Type l3Type, uint16_t l3Offset) const
{
if (l3Type == L3Type::IPv4) {
const iphdr* ipHeader = reinterpret_cast<const iphdr*>(rawData + l3Offset);
Expand Down Expand Up @@ -254,7 +254,7 @@ PacketInfo PacketBuilder::GetPacketInfo(const RawPacket* rawPacket) const
info.l4Type = LayerToL4Protocol(l4Layer._type);
}

if (DecidePort(rawPacket->data, info.l3Type, info.l3Offset) < 0) {
if (DecidePort(rawPacket->data, info.l3Type, info.l3Offset) <= 0) {
info.outInterface = OutInterface::Interface0;
} else {
info.outInterface = OutInterface::Interface1;
Expand Down
2 changes: 1 addition & 1 deletion tools/ft-replay/src/packetBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class PacketBuilder {
std::unique_ptr<std::byte[]> GetDataCopyWithVlan(const std::byte* rawData, uint16_t dataLen);
void ValidatePacketLength(uint16_t packetLength) const;
void PresetHwChecksum(Packet& packet);
int DecidePort(const std::byte* rawData, enum L3Type l3Type, uint16_t l3Offset) const;
int DecidePort(const std::byte* rawData, L3Type l3Type, uint16_t l3Offset) const;

uint16_t _vlanID = 0;
double _timeMultiplier = 1.0;
Expand Down