Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes updated slow worker mixing up packets between interfaces #255

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

TheRandomCharacter
Copy link
Collaborator

No description provided.

Comment on lines 1152 to 1177
const auto name = std::get<0>(config.ports.at(iface.data())).c_str();
if (rte_eth_dev_get_port_by_name(name, &port))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mb add a method analogous to std::string InterfaceNameFromPort(tPortId id) { return std::get<0>(ports[id]); }; from cDataPlane class, this looks very similar

dataplane/dataplane.h Outdated Show resolved Hide resolved
dataplane/worker.cpp Outdated Show resolved Hide resolved
Comment on lines +32 to +49

PortMapper(const PortMapper& other)
{
*this = other;
}

PortMapper& operator=(const PortMapper& other)
{
ports_count_ = other.ports_count_;
std::copy(std::begin(other.dpdk_ports_),
std::end(other.dpdk_ports_),
std::begin(dpdk_ports_));
std::copy(std::begin(other.logical_ports_),
std::end(other.logical_ports_),
std::begin(logical_ports_));
return *this;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just use std::array instead of c-style arrays.

std::array<tPortId, std::numeric_limits<tPortId>::max() + 1> dpdk_ports_{INVALID_PORT_ID};
std::array<tPortId, std::numeric_limits<tPortId>::max() + 1> logical_ports_{INVALID_PORT_ID};

std::array has default = operator, your code will become

PortMapper(const PortMapper& other) = default;
PortMapper& operator=(const PortMapper& other) = default;

Plus the default constructor could be implemented with .fill method:

	PortMapper()
	{
		dpdk_ports_.fill(INVALID_PORT_ID);
		logical_ports_.fill(INVALID_PORT_ID);
	}

dataplane/base.h Show resolved Hide resolved
dataplane/dpdk.cpp Outdated Show resolved Hide resolved
dataplane/kernel_interface_handler.cpp Outdated Show resolved Hide resolved
dataplane/dataplane.cpp Outdated Show resolved Hide resolved
dataplane/dataplane.h Outdated Show resolved Hide resolved
Comment on lines +8 to +9
char cname[256];
if (int res = rte_eth_dev_get_name_by_port(pid, cname); res)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
char cname[256];
if (int res = rte_eth_dev_get_name_by_port(pid, cname); res)
std::array<char, 256> cname;
if (int res = rte_eth_dev_get_name_by_port(pid, cname.data()); res)

Wow, found new github feature, didn't know about that

for each controlplane worker one needs to provide only the core used for
the worker and list of fast worker cores serviced.

"controlPlaneWorkers": [
    {
        "core": 42,
        "serviced_cores": [4, 2]
    }
]
@GeorgyKirichenko GeorgyKirichenko merged commit eab59db into yanet-platform:main Oct 16, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants