Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions core/drivers/pmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "../utils/ether.h"
#include "../utils/format.h"
#include "../opts.h"

/*!
* The following are deprecated. Ignore us.
Expand Down Expand Up @@ -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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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, &eth_txconf);
if (ret != 0) {
Expand All @@ -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, &eth_rxconf,
bess::PacketPool::GetDefaultPool(sid)->pool());
Expand Down
17 changes: 11 additions & 6 deletions core/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {

Copy link
Copy Markdown
Contributor

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?

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_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: perhaps demote this to VLOG(1)


fd_event_ = eventfd(0, 0);
CHECK_GE(fd_event_, 0);

Expand Down