Skip to contentSkip to conversation

netdev-dpdk: Remove dpdk watchdog thread

PATCH Traynor, Kevin 1 participant 1 message May 20, 2016 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): BC0FEEC7D7650749874CEC11314A88F74555BDA7@IRSMSX104.ger.corp.intel.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 75A2C3A32D53AE4DB1E381A9DCA515E3371394B6-qwxyFZj4/[email protected]

#5 lore raw

[cross-posting to dpdk mailing list]

Quoted 52 lines

-----Original Message-----
From: Torgny Lindberg [mailto:[email protected]]
Sent: Thursday, May 19, 2016 8:26 AM
To: Traynor, Kevin <[email protected]>; Loftus, Ciara <[email protected]>; [email protected]
Subject: RE: [ovs-dev] [PATCH v3 1/3] netdev-dpdk: Remove dpdk watchdog thread

Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Traynor, Kevin
Sent: den 13 maj 2016 12:47
To: Loftus, Ciara; [email protected]
Subject: Re: [ovs-dev] [PATCH v3 1/3] netdev-dpdk: Remove dpdk

watchdog

Quoted 9 lines

thread

Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ciara Loftus
Sent: Wednesday, May 11, 2016 4:31 PM
To: [email protected]
Subject: [ovs-dev] [PATCH v3 1/3] netdev-dpdk: Remove dpdk

watchdog

Quoted 4 lines
Quoted 4 lines

thread

Instead of continuously polling for link status changes on 'dpdk' ports, register a callback function that will be triggered when

DPDK

Quoted 3 lines
Quoted 1 line

detects that the link status of that port has changed.

rte_eth_link_get_nowait() returns void, so polling it in a thread

won't

Quoted 1 line

indicate some kind of error in dpdk. I can't see any benefit of the

thread

Quoted 4 lines

- using the callback means one less thread and less locking.

With this patch a 4s delay before detecting link-down would be introduced,
which is from the viewpoint of many use cases an unacceptably long delay.
I would like to suggest that the existing poll method is kept as it detects
and acts on link failures much faster (millisecond time scale), alternatively that both poll and interrupt methods are supported and the one to use is selected by configuration.

Quoted 3 lines

The delay occurs inside the dpdk driver.
(See e.g. dpdk, ixgbe_ethdev.c, IXGBE_LINK_DOWN_CHECK_TIMEOUT)

Hi Torgny,

Thanks for pointing that out, I hadn't realized the additional delay. Do you think the default should be changed in DPDK?

Kevin.

Quoted 124 lines

Best regards,
Torgny Lindberg

Quoted 5 lines
Quoted 5 lines
---
 lib/netdev-dpdk.c | 55 ++++++++++++++++++++++++++++++------------

---

Quoted 12 lines

-

Quoted 11 lines

---------

 1 file changed, 30 insertions(+), 25 deletions(-)
lib/netdev-dpdk.c +0 -0
index af86d19..89d783a 100644
@@ -62,8 +62,6 @@
 VLOG_DEFINE_THIS_MODULE(dpdk);
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
 
Quoted 6 lines

lib/netdev-dpdk.c static int netdev_dpdk_construct(struct netdev

Quoted 6 lines
lib/netdev-dpdk.c +0 -2
-#define DPDK_PORT_WATCHDOG_INTERVAL 5
-
 #define OVS_CACHE_LINE_SIZE CACHE_LINE_SIZE
 #define OVS_VPORT_DPDK "ovs_dpdk"
 
@@ -386,6 +384,9 @@ static int netdev_dpdk_construct(struct netdev

*);

Quoted 2 lines

lib/netdev-dpdk.c static int netdev_dpdk_construct(struct netdev · line 384

Quoted 2 lines
lib/netdev-dpdk.c +0 -0
 struct virtio_net * netdev_dpdk_get_virtio(const struct

netdev_dpdk

Quoted 31 lines
Quoted 31 lines
lib/netdev-dpdk.c +3 -0
 *dev);
 
+void link_status_changed_callback(uint8_t port_id,
+        enum rte_eth_event_type type OVS_UNUSED, void *param
 OVS_UNUSED);
+
 static bool
 is_dpdk_class(const struct netdev_class *class)

{

lib/netdev-dpdk.c +0 -18
@@ -536,27 +537,6 @@ check_link_status(struct netdev_dpdk *dev)
     }
 }
 
-static void *
-dpdk_watchdog(void *dummy OVS_UNUSED)
-{
-    struct netdev_dpdk *dev;
-
-    pthread_detach(pthread_self());
-
-    for (;;) {
-        ovs_mutex_lock(&dpdk_mutex);
-        LIST_FOR_EACH (dev, list_node, &dpdk_list) {
-            ovs_mutex_lock(&dev->mutex);
-            check_link_status(dev);
-            ovs_mutex_unlock(&dev->mutex);
-        }
-        ovs_mutex_unlock(&dpdk_mutex);
-        xsleep(DPDK_PORT_WATCHDOG_INTERVAL);
-    }
-
Quoted 8 lines

lib/netdev-dpdk.c netdev_dpdk_alloc_txq(struct netdev_dpdk

Quoted 8 lines
lib/netdev-dpdk.c +0 -3
-    return NULL;
-}
-
 static int
 dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int
 n_txq)

{

lib/netdev-dpdk.c +0 -0
@@ -717,6 +697,27 @@ netdev_dpdk_alloc_txq(struct netdev_dpdk

*dev,

Quoted 51 lines

lib/netdev-dpdk.c netdev_dpdk_init(struct netdev *netdev,

Quoted 30 lines
lib/netdev-dpdk.c +21 -0
 unsigned int n_txqs)
     }
 }
 
+void
+link_status_changed_callback(uint8_t port_id,
+                              enum rte_eth_event_type type
 OVS_UNUSED,
+                              void *param OVS_UNUSED)
+{
+    struct netdev_dpdk *dev;
+
+    ovs_mutex_lock(&dpdk_mutex);
+    LIST_FOR_EACH (dev, list_node, &dpdk_list) {
+        if (port_id == dev->port_id) {
+            ovs_mutex_lock(&dev->mutex);
+            check_link_status(dev);
+            ovs_mutex_unlock(&dev->mutex);
+            break;
+        }
+    }
+    ovs_mutex_unlock(&dpdk_mutex);
+
+    return;
+}
+
 static int

netdev_dpdk_init(struct netdev *netdev, unsigned int port_no,
enum dpdk_dev_type type)

lib/netdev-dpdk.c +0 -0
@@ -774,6 +775,12 @@ netdev_dpdk_init(struct netdev *netdev,

unsigned

lib/netdev-dpdk.c dpdk_init__(const struct smap

Quoted 16 lines
lib/netdev-dpdk.c +6 -0
 int port_no,
         netdev_dpdk_alloc_txq(dev, OVS_VHOST_MAX_QUEUE_NUM);
     }
 
+    if (type == DPDK_DEV_ETH) {
+        rte_eth_dev_callback_register(port_no,
 RTE_ETH_EVENT_INTR_LSC,
+
 (void*)link_status_changed_callback,
+                                      NULL);
+    }
+
     ovs_list_push_back(&dpdk_list, &dev->list_node);

unlock:

lib/netdev-dpdk.c +0 -0
@@ -3207,8 +3214,6 @@ dpdk_init__(const struct smap

*ovs_other_config)

Quoted 3 lines
lib/netdev-dpdk.c +0 -0
     /* We are called from the main thread here */
     RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID;
 
Quoted 17 lines
Quoted 5 lines

lib/netdev-dpdk.c dpdk_init__(const struct smap · line 3219

Quoted 5 lines
lib/netdev-dpdk.c +0 -2
-    ovs_thread_create("dpdk_watchdog", dpdk_watchdog, NULL);
-
 #ifdef VHOST_CUSE
     /* Register CUSE device to handle IOCTLs.
      * Unless otherwise specified, cuse_dev_name is set to vhost-

net.

Quoted 11 lines
Quoted 7 lines

--
2.4.3

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev