-
Notifications
You must be signed in to change notification settings - Fork 157
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
Allows specifying socket/numa node for BESS #946
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ | |
|
||
#include "../utils/ether.h" | ||
#include "../utils/format.h" | ||
#include "../opts.h" | ||
|
||
/*! | ||
* The following are deprecated. Ignore us. | ||
|
@@ -266,11 +267,19 @@ CommandResponse PMDPort::Init(const bess::pb::PMDPortArg &arg) { | |
} | ||
rte_eth_promiscuous_enable(ret_port_id); | ||
|
||
int sid = rte_eth_dev_socket_id(ret_port_id); | ||
|
||
/* if socket_id is invalid, set to arg */ | ||
if (sid < 0 || sid > RTE_MAX_NUMA_NODES) { | ||
sid = FLAGS_n; | ||
LOG(WARNING) << "Unable to detect socket ID, defaulting to: " << sid; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps include the name of PMDPort being configured in this log? |
||
} else { | ||
LOG(INFO) << "socket ID in pmd is: " <<sid; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same thing about including the port name here |
||
} | ||
|
||
// NOTE: As of DPDK 17.02, TX queues should be initialized first. | ||
// Otherwise the DPDK virtio PMD will crash in rte_eth_rx_burst() later. | ||
for (i = 0; i < num_txq; i++) { | ||
int sid = 0; /* XXX */ | ||
|
||
ret = rte_eth_tx_queue_setup(ret_port_id, i, queue_size[PACKET_DIR_OUT], | ||
sid, ð_txconf); | ||
if (ret != 0) { | ||
|
@@ -279,13 +288,6 @@ CommandResponse PMDPort::Init(const bess::pb::PMDPortArg &arg) { | |
} | ||
|
||
for (i = 0; i < num_rxq; i++) { | ||
int sid = rte_eth_dev_socket_id(ret_port_id); | ||
|
||
/* if socket_id is invalid, set to 0 */ | ||
if (sid < 0 || sid > RTE_MAX_NUMA_NODES) { | ||
sid = 0; | ||
} | ||
|
||
ret = rte_eth_rx_queue_setup(ret_port_id, i, queue_size[PACKET_DIR_INC], | ||
sid, ð_rxconf, | ||
bess::PacketPool::GetDefaultPool(sid)->pool()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,15 +290,20 @@ void *Worker::Run(void *_arg) { | |
/* for workers, wid == rte_lcore_id() */ | ||
wid_ = arg->wid; | ||
core_ = arg->core; | ||
socket_ = rte_socket_id(); | ||
socket_ = FLAGS_n; | ||
|
||
// For some reason, rte_socket_id() does not return a correct NUMA ID. | ||
// Nevertheless, BESS should not crash. | ||
if (socket_ == SOCKET_ID_ANY) { | ||
LOG(WARNING) << "rte_socket_id() returned -1 for " << arg->core; | ||
socket_ = 0; | ||
if (rte_lcore_to_socket_id((unsigned int) core_) != (unsigned int) socket_) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style guide nit: could you explicitly brace initialize, or perhaps |
||
LOG(ERROR) << "Core specified: " << core_ << " does not exist on socket: " | ||
<< socket_ << ". Cannot create worker"; | ||
|
||
delete scheduler_; | ||
delete rand_; | ||
|
||
return nullptr; | ||
} | ||
|
||
LOG(INFO) << "Running worker: " << wid_ << " on core " << core_ << " on socket " << socket_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: perhaps demote this to |
||
|
||
fd_event_ = eventfd(0, 0); | ||
CHECK_GE(fd_event_, 0); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style guide nit: could you explicitly brace initialize, or perhaps
static_cast
, here instead of c-style casting?