diff mbox

[ovs-dev,v3] netdev-dummy: Limits the number of tx/rx queues.

Message ID 1484027774-24595-1-git-send-email-nic@opencloud.tech
State Accepted
Delegated to: Daniele Di Proietto
Headers show

Commit Message

nickcooper-zhangtonghao Jan. 10, 2017, 5:56 a.m. UTC
This patch avoids the ovs_rcu to report WARN, caused by blocked
for a long time, when ovs-vswitchd processes a port with many
rx/tx queues. The number of tx/rx queues per port may be appropriate,
because the dpdk uses it as an default max value.

Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>
---
v3:
* Limits the number of tx/rx queues in set_config().
* Adds the WARN log when exceeds DUMMY_MAX_QUEUES_PER_PORT.
---
 lib/netdev-dummy.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Daniele Di Proietto Jan. 11, 2017, 7:01 a.m. UTC | #1
2017-01-09 21:56 GMT-08:00 nickcooper-zhangtonghao <nic@opencloud.tech>:
> This patch avoids the ovs_rcu to report WARN, caused by blocked
> for a long time, when ovs-vswitchd processes a port with many
> rx/tx queues. The number of tx/rx queues per port may be appropriate,
> because the dpdk uses it as an default max value.
>
> Signed-off-by: nickcooper-zhangtonghao <nic@opencloud.tech>

Applied to master, thanks

> ---
> v3:
> * Limits the number of tx/rx queues in set_config().
> * Adds the WARN log when exceeds DUMMY_MAX_QUEUES_PER_PORT.
> ---
>  lib/netdev-dummy.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
> index bdb77e1..4a23cba 100644
> --- a/lib/netdev-dummy.c
> +++ b/lib/netdev-dummy.c
> @@ -827,6 +827,8 @@ netdev_dummy_set_in6(struct netdev *netdev_, struct in6_addr *in6,
>      return 0;
>  }
>
> +#define DUMMY_MAX_QUEUES_PER_PORT 1024
> +
>  static int
>  netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
>  {
> @@ -870,6 +872,21 @@ netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
>
>      new_n_rxq = MAX(smap_get_int(args, "n_rxq", NR_QUEUE), 1);
>      new_n_txq = MAX(smap_get_int(args, "n_txq", NR_QUEUE), 1);
> +
> +    if (new_n_rxq > DUMMY_MAX_QUEUES_PER_PORT ||
> +        new_n_txq > DUMMY_MAX_QUEUES_PER_PORT) {
> +        VLOG_WARN("The one or both of interface %s queues"
> +                  "(rxq: %d, txq: %d) exceed %d. Sets it %d.\n",
> +                  netdev->up.name,
> +                  new_n_rxq,
> +                  new_n_txq,
> +                  DUMMY_MAX_QUEUES_PER_PORT,
> +                  DUMMY_MAX_QUEUES_PER_PORT);
> +
> +        new_n_rxq = MIN(DUMMY_MAX_QUEUES_PER_PORT, new_n_rxq);
> +        new_n_txq = MIN(DUMMY_MAX_QUEUES_PER_PORT, new_n_txq);
> +    }
> +
>      new_numa_id = smap_get_int(args, "numa_id", 0);
>      if (new_n_rxq != netdev->requested_n_rxq
>          || new_n_txq != netdev->requested_n_txq
> --
> 1.8.3.1
>
>
>
diff mbox

Patch

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index bdb77e1..4a23cba 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -827,6 +827,8 @@  netdev_dummy_set_in6(struct netdev *netdev_, struct in6_addr *in6,
     return 0;
 }
 
+#define DUMMY_MAX_QUEUES_PER_PORT 1024
+
 static int
 netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
 {
@@ -870,6 +872,21 @@  netdev_dummy_set_config(struct netdev *netdev_, const struct smap *args)
 
     new_n_rxq = MAX(smap_get_int(args, "n_rxq", NR_QUEUE), 1);
     new_n_txq = MAX(smap_get_int(args, "n_txq", NR_QUEUE), 1);
+
+    if (new_n_rxq > DUMMY_MAX_QUEUES_PER_PORT ||
+        new_n_txq > DUMMY_MAX_QUEUES_PER_PORT) {
+        VLOG_WARN("The one or both of interface %s queues"
+                  "(rxq: %d, txq: %d) exceed %d. Sets it %d.\n",
+                  netdev->up.name,
+                  new_n_rxq,
+                  new_n_txq,
+                  DUMMY_MAX_QUEUES_PER_PORT,
+                  DUMMY_MAX_QUEUES_PER_PORT);
+
+        new_n_rxq = MIN(DUMMY_MAX_QUEUES_PER_PORT, new_n_rxq);
+        new_n_txq = MIN(DUMMY_MAX_QUEUES_PER_PORT, new_n_txq);
+    }
+
     new_numa_id = smap_get_int(args, "numa_id", 0);
     if (new_n_rxq != netdev->requested_n_rxq
         || new_n_txq != netdev->requested_n_txq