Skip to content

Commit

Permalink
The interface for receiving basic counters via bus has been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
stal76 authored and GeorgyKirichenko committed Sep 18, 2024
1 parent 766505f commit 6a6af73
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 291 deletions.
20 changes: 0 additions & 20 deletions common/idataplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,11 @@ class dataPlane
return get<common::idp::requestType::clearFWState, eResult>();
}

common::idp::getAclCounters::response getAclCounters() const
{
return get<common::idp::requestType::getAclCounters, common::idp::getAclCounters::response>();
}

common::idp::getPortStatsEx::response getPortStatsEx() const
{
return get<common::idp::requestType::getPortStatsEx, common::idp::getPortStatsEx::response>();
}

common::idp::getCounters::response getCounters(const common::idp::getCounters::request& request) const
{
return get<common::idp::requestType::getCounters, common::idp::getCounters::response>(request);
}

common::idp::getOtherStats::response getOtherStats() const
{
return get<common::idp::requestType::getOtherStats, common::idp::getOtherStats::response>();
}

common::idp::getConfig::response getConfig() const
{
return get<common::idp::requestType::getConfig, common::idp::getConfig::response>();
Expand Down Expand Up @@ -193,11 +178,6 @@ class dataPlane
return get<common::idp::requestType::version, common::idp::version::response>();
}

auto get_counter_by_name(const common::idp::get_counter_by_name::request& request) const
{
return get<common::idp::requestType::get_counter_by_name, common::idp::get_counter_by_name::response>(request);
}

auto get_shm_info() const
{
return get<common::idp::requestType::get_shm_info, common::idp::get_shm_info::response>();
Expand Down
35 changes: 0 additions & 35 deletions common/idp.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ enum class requestType : uint32_t
get_ports_stats_extended,
getControlPlanePortStats,
getPortStatsEx,
getCounters,
getFragmentationStats,
getFWState,
getFWStateStats,
clearFWState,
getAclCounters,
getOtherStats,
getConfig,
getErrors,
getReport,
Expand All @@ -70,7 +67,6 @@ enum class requestType : uint32_t
unrdup_vip_to_balancers,
update_vip_vport_proto,
version,
get_counter_by_name,
get_shm_info,
get_shm_tsc_info,
set_shm_tsc_state,
Expand Down Expand Up @@ -663,13 +659,6 @@ namespace getPortStatsEx
using response = ::common::getPortStatsEx::response;
}

namespace getCounters
{
using request = std::vector<tCounterId>;

using response = std::vector<uint64_t>;
}

namespace getFragmentationStats
{
using response = fragmentation::stats_t;
Expand Down Expand Up @@ -703,18 +692,6 @@ namespace getFWStateStats
using response = fwstate::stats_t;
}

namespace getAclCounters
{
using response = std::vector<uint64_t>;
}

namespace getOtherStats
{
using worker = std::tuple<std::array<uint64_t, CONFIG_YADECAP_MBUFS_BURST_SIZE + 1>>; ///< bursts

using response = std::tuple<std::map<tCoreId, worker>>;
}

namespace getConfig
{
enum class value_type ///< @todo: delete
Expand Down Expand Up @@ -863,13 +840,6 @@ using response = std::tuple<unsigned int, ///< major
std::string>; ///< custom
}

namespace get_counter_by_name
{
using request = std::tuple<std::string, std::optional<tCoreId>>;

using response = std::map<tCoreId, uint64_t>;
}

namespace get_shm_info
{
using dump_meta = std::tuple<std::string, ///< ring name
Expand Down Expand Up @@ -1002,15 +972,13 @@ using request = std::tuple<requestType,
getGlobalBase::request,
getControlPlanePortStats::request,
getWorkerStats::request,
getCounters::request,
lpm4LookupAddress::request,
lpm6LookupAddress::request,
nat64stateful_state::request,
balancer_connection::request,
debug_latch_update::request,
unrdup_vip_to_balancers::request,
update_vip_vport_proto::request,
get_counter_by_name::request,
dump_physical_port::request,
neighbor_insert::request,
neighbor_remove::request,
Expand All @@ -1027,11 +995,9 @@ using response = std::variant<std::tuple<>,
get_ports_stats::response, ///< + getControlPlanePortStats::response
get_ports_stats_extended::response,
getPortStatsEx::response,
getOtherStats::response,
getFragmentationStats::response,
getFWState::response,
getFWStateStats::response,
getAclCounters::response, ///< + getCounters::response
getConfig::response,
getErrors::response,
getReport::response,
Expand All @@ -1044,7 +1010,6 @@ using response = std::variant<std::tuple<>,
version::response,
limits::response,
samples::response,
get_counter_by_name::response,
get_shm_info::response,
get_shm_tsc_info::response,
neighbor_show::response,
Expand Down
16 changes: 0 additions & 16 deletions dataplane/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,6 @@ void cBus::clientThread(int clientSocket)
{
response = callWithResponse(&cControlPlane::clearFWState, request);
}
else if (type == common::idp::requestType::getCounters)
{
response = callWithResponse(&cControlPlane::getCounters, request);
}
else if (type == common::idp::requestType::getOtherStats)
{
response = callWithResponse(&cControlPlane::getOtherStats, request);
}
else if (type == common::idp::requestType::getConfig)
{
response = callWithResponse(&cControlPlane::getConfig, request);
Expand All @@ -301,10 +293,6 @@ void cBus::clientThread(int clientSocket)
{
response = callWithResponse(&cControlPlane::limits, request);
}
else if (type == common::idp::requestType::getAclCounters)
{
response = callWithResponse(&cControlPlane::getAclCounters, request);
}
else if (type == common::idp::requestType::balancer_connection)
{
response = callWithResponse(&cControlPlane::balancer_connection, request);
Expand Down Expand Up @@ -337,10 +325,6 @@ void cBus::clientThread(int clientSocket)
{
response = callWithResponse(&cControlPlane::version, request);
}
else if (type == common::idp::requestType::get_counter_by_name)
{
response = callWithResponse(&cControlPlane::get_counter_by_name, request);
}
else if (type == common::idp::requestType::nat64stateful_state)
{
response = callWithResponse(&cControlPlane::nat64stateful_state, request);
Expand Down
105 changes: 0 additions & 105 deletions dataplane/controlplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,25 +176,6 @@ common::idp::getGlobalBase::response cControlPlane::getGlobalBase(const common::
return response;
}

common::idp::getOtherStats::response cControlPlane::getOtherStats()
{
common::idp::getOtherStats::response response;
auto& [response_workers] = response;

/// workers
{
for (const cWorker* worker : dataPlane->workers_vector)
{
std::array<uint64_t, CONFIG_YADECAP_MBUFS_BURST_SIZE + 1> bursts;
memcpy(&bursts[0], worker->bursts, (CONFIG_YADECAP_MBUFS_BURST_SIZE + 1) * sizeof(uint64_t));

response_workers[worker->coreId] = {bursts};
}
}

return response;
}

common::idp::getWorkerStats::response cControlPlane::getWorkerStats(const common::idp::getWorkerStats::request& request)
{
/// unsafe
Expand Down Expand Up @@ -572,24 +553,6 @@ eResult cControlPlane::clearFWState()
return common::result_e::success;
}

common::idp::getAclCounters::response cControlPlane::getAclCounters()
{
std::lock_guard<std::mutex> guard(mutex);

common::idp::getAclCounters::response response;

response.resize(YANET_CONFIG_ACL_COUNTERS_SIZE);
for (const cWorker* worker : dataPlane->workers_vector)
{
for (size_t i = 0; i < YANET_CONFIG_ACL_COUNTERS_SIZE; i++)
{
response[i] += worker->aclCounters[i];
}
}

return response;
}

common::idp::getPortStatsEx::response cControlPlane::getPortStatsEx()
{
common::idp::getPortStatsEx::response response;
Expand Down Expand Up @@ -625,33 +588,6 @@ common::idp::getPortStatsEx::response cControlPlane::getPortStatsEx()
return response;
}

common::idp::getCounters::response cControlPlane::getCounters(const common::idp::getCounters::request& request)
{
common::idp::getCounters::response response;
response.resize(request.size());

for (size_t i = 0;
i < request.size();
i++)
{
const auto& counter_id = request[i];

if (counter_id >= YANET_CONFIG_COUNTERS_SIZE)
{
std::lock_guard<std::mutex> guard(mutex);
++errors["getCounters: invalid counterId"];
continue;
}

response[i] = accumulateWorkerStats(
[counter_id](cWorker* worker) {
return worker->counters[counter_id];
});
}

return response;
}

common::idp::getConfig::response cControlPlane::getConfig() const
{
common::idp::getConfig::response response;
Expand Down Expand Up @@ -1092,47 +1028,6 @@ common::idp::version::response cControlPlane::version()
version_custom()};
}

common::idp::get_counter_by_name::response cControlPlane::get_counter_by_name(const common::idp::get_counter_by_name::request& request)
{
common::idp::get_counter_by_name::response response;

const auto& [counter_name, optional_core_id] = request;

if (optional_core_id.has_value())
{
std::optional<uint64_t> counter_val = dataPlane->getCounterValueByName(counter_name, optional_core_id.value());
if (counter_val.has_value())
{
response[optional_core_id.value()] = counter_val.value();
}

// if counter with provided name does not exist, empty map will be returned, and its emptiness should be checked on another end
return response;
}

// core_id was not specified, return counter for each core_id
for (const cWorker* worker : dataPlane->workers_vector)
{
std::optional<uint64_t> counter_val = dataPlane->getCounterValueByName(counter_name, worker->coreId);
if (counter_val.has_value())
{
response[worker->coreId] = counter_val.value();
}
}

for (const auto& [core_id, worker_gc] : dataPlane->worker_gcs)
{
(void)worker_gc;
std::optional<uint64_t> counter_val = dataPlane->getCounterValueByName(counter_name, core_id);
if (counter_val.has_value())
{
response[core_id] = counter_val.value();
}
}

return response;
}

common::idp::get_shm_info::response cControlPlane::get_shm_info()
{
common::idp::get_shm_info::response response;
Expand Down
4 changes: 0 additions & 4 deletions dataplane/controlplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ class cControlPlane ///< @todo: move to cDataPlane
common::idp::getFWState::response getFWState();
common::idp::getFWStateStats::response getFWStateStats();
eResult clearFWState();
common::idp::getAclCounters::response getAclCounters();
common::idp::getCounters::response getCounters(const common::idp::getCounters::request& request);
common::idp::getOtherStats::response getOtherStats();
common::idp::getConfig::response getConfig() const;
common::idp::getErrors::response getErrors();
common::idp::getReport::response getReport();
Expand All @@ -84,7 +81,6 @@ class cControlPlane ///< @todo: move to cDataPlane
eResult unrdup_vip_to_balancers(const common::idp::unrdup_vip_to_balancers::request& request);
eResult update_vip_vport_proto(const common::idp::update_vip_vport_proto::request& request);
common::idp::version::response version();
common::idp::get_counter_by_name::response get_counter_by_name(const common::idp::get_counter_by_name::request& request);
common::idp::nat64stateful_state::response nat64stateful_state(const common::idp::nat64stateful_state::request& request);
common::idp::get_shm_info::response get_shm_info();
common::idp::get_shm_tsc_info::response get_shm_tsc_info();
Expand Down
22 changes: 0 additions & 22 deletions dataplane/dataplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,6 @@ eResult cDataPlane::initWorkers()
return result;
}

worker->fillStatsNamesToAddrsTable(coreId_to_stats_tables[coreId]);
workers[coreId] = worker;
workers_vector.emplace_back(worker);

Expand Down Expand Up @@ -1095,7 +1094,6 @@ eResult cDataPlane::initWorkers()
return result;
}

worker->fillStatsNamesToAddrsTable(coreId_to_stats_tables[core_id]);
worker_gcs[core_id] = worker;
socket_worker_gcs[socket_id] = worker;
}
Expand Down Expand Up @@ -1141,8 +1139,6 @@ eResult cDataPlane::InitSlowWorker(const tCoreId core, const CPlaneWorkerConfig&
return result;
}

worker->fillStatsNamesToAddrsTable(coreId_to_stats_tables[core]);

workers_vector.emplace_back(worker);

std::vector<dataplane::KernelInterfaceBundleConfig> kni_bundleconf;
Expand Down Expand Up @@ -1238,24 +1234,6 @@ eResult cDataPlane::InitSlowWorkers()
return eResult::success;
}

std::optional<uint64_t> cDataPlane::getCounterValueByName(const std::string& counter_name, uint32_t coreId)
{
if (coreId_to_stats_tables.count(coreId) == 0)
{
return std::optional<uint64_t>();
}

const auto& specific_core_table = coreId_to_stats_tables[coreId];

if (specific_core_table.count(counter_name) == 0)
{
return std::optional<uint64_t>();
}

uint64_t counter_value = *(specific_core_table.at(counter_name));
return std::optional<uint64_t>(counter_value);
}

eResult cDataPlane::InitTxQueues()
{
for (const auto& portIter : ports)
Expand Down
Loading

0 comments on commit 6a6af73

Please sign in to comment.