mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
dpif-netdev: Create multiple tx/rx queues when adding dpdk interface.
Before this commit, ovs creates one tx and one rx queue for each dpdk interface and uses only one poll thread for handling I/O of all dpdk interfaces. An upcoming patch will allow multiple poll threads be created. As a preparation, this commit changes the dpif-netdev to create multiple tx/rx queues when the dpdk interface is added. Specifically, the number of rx queues will still be one per-dpdk interface for this commit. But upcoming work will allow user create multiple rx queues. The number of tx queues will be the number of cpu cores on the machine. Although not all the tx queues will be used, each poll thread will have its own queue for transmission on the dpdk interface. Signed-off-by: Alex Wang <alexw@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "odp-util.h"
|
||||
#include "ofp-print.h"
|
||||
#include "ofpbuf.h"
|
||||
#include "ovs-numa.h"
|
||||
#include "ovs-rcu.h"
|
||||
#include "packet-dpif.h"
|
||||
#include "packets.h"
|
||||
@@ -744,6 +745,21 @@ do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (netdev_is_pmd(netdev)) {
|
||||
int n_cores = ovs_numa_get_n_cores();
|
||||
|
||||
if (n_cores == OVS_CORE_UNSPEC) {
|
||||
VLOG_ERR("%s, cannot get cpu core info", devname);
|
||||
return ENOENT;
|
||||
}
|
||||
/* There can only be ovs_numa_get_n_cores() pmd threads,
|
||||
* so creates a tx_q for each. */
|
||||
error = netdev_set_multiq(netdev, n_cores, NR_QUEUE);
|
||||
if (error) {
|
||||
VLOG_ERR("%s, cannot set multiq", devname);
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
port = xzalloc(sizeof *port);
|
||||
port->port_no = port_no;
|
||||
port->netdev = netdev;
|
||||
|
Reference in New Issue
Block a user