Skip to content
Closed
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
14 changes: 14 additions & 0 deletions ipfixprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,20 @@ bool process_plugin_args(ipxp_conf_t &conf, IpfixprobeOptParser &parser)
throw IPXPError("invalid storage plugin " + storage_name);
}
storage_plugin->set_queue(output_queue);
#ifdef WITH_CTT
size_t device_start = std::min(input_params.find("dev"), input_params.find("d"));
if (device_start == std::string::npos) {
throw PluginError("device name is not found");
}
size_t queue_start = input_params.find(":", device_start);
size_t queue_end = input_params.find(";", device_start);
size_t device_end = std::min(queue_end, queue_start);
std::string queue = "0";
if (queue_start != std::string::npos && queue_start < queue_end) {
queue = input_params.substr(queue_start + 1, queue_end);
}
storage_params += std::string(";ci=") + queue + ";" + input_params.substr(device_start, device_end);
#endif /* WITH_CTT */
storage_plugin->init(storage_params.c_str());
storage_plugin->set_telemetry_dir(pipeline_queue_dir);
conf.active.storage.push_back(storage_plugin);
Expand Down
5 changes: 3 additions & 2 deletions storage/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ void NHTFlowCache::init(const char *params)
m_line_mask = (m_cache_size - 1) & ~(m_line_size - 1);
m_line_new_idx = m_line_size / 2;
#ifdef WITH_CTT
m_ctt_controller.init(parser.m_dev, 0);
std::cout << "Cache created with device=" << parser.m_dev << " and component index=" << parser.m_component_index << "\n";
m_ctt_controller.init(parser.m_dev, parser.m_component_index);
#endif /* WITH_CTT */

if (m_export_queue == nullptr) {
Expand Down Expand Up @@ -752,4 +753,4 @@ std::vector<std::byte> CttController::assemble_state(
return state;
}
#endif // WITH_CTT
}
}
11 changes: 10 additions & 1 deletion storage/cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class CacheOptParser : public OptionsParser
time_t m_frag_cache_timeout;
#ifdef WITH_CTT
std::string m_dev;
uint16_t m_component_index;
#endif /* WITH_CTT */

CacheOptParser() : OptionsParser("cache", "Storage plugin implemented as a hash table"),
Expand Down Expand Up @@ -263,6 +264,14 @@ class CacheOptParser : public OptionsParser
return true;
},
OptionFlags::RequiredArgument);
register_option("ci", "compidx", "NUM", "Index of the ctt component", [this](const char *arg) {
try {
m_component_index = str2num<decltype(m_component_index)>(arg)/16;
} catch(std::invalid_argument &e) {
return false;
}
return true;
});
#endif /* WITH_CTT */

}
Expand Down Expand Up @@ -422,4 +431,4 @@ class NHTFlowCache : TelemetryUtils, public StoragePlugin
};

}
#endif /* IPXP_STORAGE_CACHE_HPP */
#endif /* IPXP_STORAGE_CACHE_HPP */
Loading