Add multi-core concurrent packet processing

This commit is contained in:
Joseph Henry 2024-02-23 09:57:39 -08:00
parent ac6d532651
commit 683d332abc
No known key found for this signature in database
GPG key ID: C45B33FF5EBC9344
12 changed files with 400 additions and 190 deletions

View file

@ -306,6 +306,7 @@ static Mutex globalTapCreateLock;
MacKextEthernetTap::MacKextEthernetTap(
const char *homePath,
unsigned int concurrency,
const MAC &mac,
unsigned int mtu,
unsigned int metric,
@ -317,6 +318,7 @@ MacKextEthernetTap::MacKextEthernetTap(
_arg(arg),
_nwid(nwid),
_homePath(homePath),
_concurrency(concurrency),
_mtu(mtu),
_metric(metric),
_fd(0),
@ -447,7 +449,9 @@ MacKextEthernetTap::~MacKextEthernetTap()
::write(_shutdownSignalPipe[1],"\0",1); // causes thread to exit
Thread::join(_thread);
for (std::thread &t : _rxThreads) {
t.join();
}
::close(_fd);
::close(_shutdownSignalPipe[0]);
::close(_shutdownSignalPipe[1]);