summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorxu.binbin1@zte.com.cn <xu.binbin1@zte.com.cn>2017-01-12 22:18:13 +0800
committerDaniele Di Proietto <diproiettod@vmware.com>2017-01-11 18:11:30 -0800
commitbd4e172b287c76bf9fea0a5afa751dc3fe37e2d4 (patch)
tree493f5c47ed870a11fef4bda4c4ebb18de13e70de /lib
parent353fe1e149c631a35f1142fcb97f7d7edcd4c448 (diff)
downloadopenvswitch-bd4e172b287c76bf9fea0a5afa751dc3fe37e2d4.tar.gz
netdev-dpdk: Assign socket id according to device's numa id
We can hotplug attach DPDK ports specified via the 'dpdk-devargs' option now. But the socket id of DPDK ports can't be assigned correctly, it is always 0. The socket id of DPDK ports should be assigned according to the numa id of the device. Fixes: 55e075e65ef9e ("netdev-dpdk: Arbitrary 'dpdk' port naming") Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn> Acked-by: Ciara Loftus <ciara.loftus@intel.com> Acked-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/netdev-dpdk.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 8bb908691..b4869d838 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1241,6 +1241,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args)
netdev_get_name(&dup_dev->up));
err = EADDRINUSE;
} else {
+ int sid = rte_eth_dev_socket_id(new_port_id);
+ dev->requested_socket_id = sid < 0 ? SOCKET0 : sid;
dev->devargs = xstrdup(new_devargs);
dev->port_id = new_port_id;
netdev_request_reconfigure(&dev->up);
@@ -3140,7 +3142,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
&& netdev->n_rxq == dev->requested_n_rxq
&& dev->mtu == dev->requested_mtu
&& dev->rxq_size == dev->requested_rxq_size
- && dev->txq_size == dev->requested_txq_size) {
+ && dev->txq_size == dev->requested_txq_size
+ && dev->socket_id == dev->requested_socket_id) {
/* Reconfiguration is unnecessary */
goto out;
@@ -3148,7 +3151,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
rte_eth_dev_stop(dev->port_id);
- if (dev->mtu != dev->requested_mtu) {
+ if (dev->mtu != dev->requested_mtu
+ || dev->socket_id != dev->requested_socket_id) {
netdev_dpdk_mempool_configure(dev);
}