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.binb...@zte.com.cn>
---
 lib/netdev-dpdk.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 8bb9086..57ebdb3 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1197,6 +1197,7 @@ netdev_dpdk_set_config(struct netdev *netdev, const 
struct smap *args)
     bool temp_flag;
     const char *new_devargs;
     int err = 0;
+    int sid;
 
     ovs_mutex_lock(&dpdk_mutex);
     ovs_mutex_lock(&dev->mutex);
@@ -1242,6 +1243,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const 
struct smap *args)
                     err = EADDRINUSE;
                 } else {
                     dev->devargs = xstrdup(new_devargs);
+                    sid = rte_eth_dev_socket_id(new_port_id);
+                    dev->requested_socket_id = sid < 0 ? SOCKET0 : sid;
                     dev->port_id = new_port_id;
                     netdev_request_reconfigure(&dev->up);
                     err = 0;
@@ -3140,7 +3143,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 +3152,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);
     }
 
-- 
1.8.3.1


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to