Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Af xdp multi threading #5

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

zzxgzgz
Copy link
Collaborator

@zzxgzgz zzxgzgz commented Dec 6, 2022

This PR does the following:

  1. Added AF_XDP support in Arion Agent.
  2. Refactored db_client.h, in order to use it among different files.
  3. Temporarily using std::unordered_map for endpoint querying.
  4. Ported a couple of utility functions from the arion-dp repository.

Performance:

As of 3a5d5b8, Arion Agent is able to achieve the following performance:

10 traffic flows (10 iperfs), all traffic handled by AF_XDP , running for 200 seconds, 10G NIC card:

image

Same test, but all traffic handled by in-kernel XDP:

image

Comparison:

image

What's next:

  1. Investigate on if is it feasible to add multi-threading packet processing in AF_XDP. If so, implement and test it.
  2. Investigate which DB is the most suitable one for Arion Agent. The std::unordered_map shall be replaced by some DB.

zzxgzgz added 15 commits October 4, 2022 17:12
…socket, and able to parse packet until the ARP level
…d tx packets; however, more investigation is needed in order to use the db functions
…emented endpoint cache layer for better lookup performance; refactored functions in af_xdp_user to utils
…eighborInMemory from pointer to value, in order to make the packet correct after modification
@zzxgzgz zzxgzgz self-assigned this Dec 6, 2022
…s; need to investigate how to add use round robin in kernel, how to make iperf work and how to user more threads
…en after trading from bpool. Made a hack to make iperf work.
… it still stops receiving traffic from time to time
…bpf map fd for security group ebpf table; added sample code to insert data into security group ebpf maps
…security_group_port_bindnig info from arion master, and program into the sg_cidr_map ebpf map

struct SecurityGroupPortBindingProgrammingState {
int version;
}; // local db table 2 - security rule ebpf programmed version
Copy link
Collaborator

Choose a reason for hiding this comment

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

"table 4"

@@ -4,14 +4,16 @@ set(SOURCES
./util/dispatch_queue.cpp
./util/segment_lock.cpp
./comm/grpc_client.cpp
)
# db/db_client.cpp
comm/af_xdp_user_multi_thread.cpp )
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation alignment

@@ -25,6 +25,8 @@
#include "marl/event.h"
#include "marl/scheduler.h"
#include "marl/waitgroup.h"
#include "af_xdp_user_multi_thread.h"
#include "grpc_client.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

there's a //#include "grpc_client.h" above, please keep only 1

@@ -138,10 +144,16 @@ int main(int argc, char *argv[]) {
marl::schedule([=] {
g_grpc_client->RunClient(g_arion_master_address,
g_arion_master_port,
g_arion_group,
g_arion_neighbor_table);
g_arion_group,\
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need '' ?

//

// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2020 - 2022 Intel Corporation. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add co-author of Futurewei, just like grpc server/client files?

// lock transaction section
// segment lock allows some level of concurrent manipulations of concurrent version map
// as long as the multi-threading version updates' keys are not hashed to the same slot in segment array
segment_lock.lock(neighbor_key);
Copy link
Collaborator

Choose a reason for hiding this comment

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

you didn't include util\segment_lock.h or .cpp

sg_key.local_ip = local_ip_sock.sin_addr.s_addr;
sg_key.direction = direction == "egress" ? 0 : 1; // going out is 0 and coming in is 1

if (protocol == "TCP") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

should it be lower case?


if (protocol == "TCP") {
sg_key.protocol = IPPROTO_TCP;
} else if (protocol == "UDP") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

}

printf("GPPC: Inserted this sg rule into map: vip: %s, vni: %d\n", vpc_ip.c_str(), vni);

Copy link
Collaborator

Choose a reason for hiding this comment

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

empty line

add_programmed_security_group_port_binding_version_db_stmt);
});
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

empty line

}

}
if (ebpf_rc < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

line break here

Copy link
Collaborator

@lfu-ps lfu-ps left a comment

Choose a reason for hiding this comment

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

After we test with DP E2E, and clean up dead code. Let's review again. Before that, you don't need to address.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants