diff mbox

[ovs-dev,3/3] netdev-dpdk: Restore flags of dpdk netdev

Message ID 20161111134451.2280-3-xu.binbin1@zte.com.cn
State Rejected
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Xu Binbin Nov. 11, 2016, 1:44 p.m. UTC
If the eth device starts failed or vhost port is not running,
the flags of dpdk netdev should be restored.

Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn>
---
 lib/netdev-dpdk.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Daniele Di Proietto Nov. 16, 2016, 12:49 a.m. UTC | #1
2016-11-11 5:44 GMT-08:00 Binbin Xu <xu.binbin1@zte.com.cn>:

> If the eth device starts failed or vhost port is not running,
> the flags of dpdk netdev should be restored.
>
> Signed-off-by: Binbin Xu <xu.binbin1@zte.com.cn>
> ---
>  lib/netdev-dpdk.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 4ed7274..0d8da16 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2151,8 +2151,12 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev,
>      if (dev->type == DPDK_DEV_ETH) {
>          if (dev->flags & NETDEV_UP) {
>              err = rte_eth_dev_start(dev->port_id);
> -            if (err)
> +            if (err) {
> +                VLOG_INFO("Start eth dev %s failed: %d\n",
> +                    dev->up.name, err);
> +                dev->flags = *old_flagsp;
>                  return -err;
> +            }
>          }
>
>          if (dev->flags & NETDEV_PROMISC) {
> @@ -2179,6 +2183,8 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev,
>                  memset(&dev->stats, 0, sizeof dev->stats);
>                  rte_spinlock_unlock(&dev->stats_lock);
>              }
> +        } else {
> +            dev->flags = *old_flagsp;
>          }
>      }


I noticed that if I bring the device up or down while traffic is flowing,
ovs-vswitchd crashes.  I think we're not supposed to call
rte_eth_dev_stop() while the device is running, so I sent a patch that
checks for the flags in the rx/tx routines.
diff mbox

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 4ed7274..0d8da16 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2151,8 +2151,12 @@  netdev_dpdk_update_flags__(struct netdev_dpdk *dev,
     if (dev->type == DPDK_DEV_ETH) {
         if (dev->flags & NETDEV_UP) {
             err = rte_eth_dev_start(dev->port_id);
-            if (err)
+            if (err) {
+                VLOG_INFO("Start eth dev %s failed: %d\n", 
+                    dev->up.name, err);
+                dev->flags = *old_flagsp;
                 return -err;
+            }
         }
 
         if (dev->flags & NETDEV_PROMISC) {
@@ -2179,6 +2183,8 @@  netdev_dpdk_update_flags__(struct netdev_dpdk *dev,
                 memset(&dev->stats, 0, sizeof dev->stats);
                 rte_spinlock_unlock(&dev->stats_lock);
             }
+        } else {
+            dev->flags = *old_flagsp;
         }
     }