DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports.
@ 2016-08-05 14:30 Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 2/7] vswitchd: Introduce 'mtu_request' column in Interface Mark Kavanagh
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets

From: Daniele Di Proietto <diproiettod@vmware.com>

Interfaces with type "internal" end up having a netdev with type "tap"
in the dpif-netdev datapath, so a strcmp will fail to match internal
interfaces.

We can translate the types with ofproto_port_open_type() before calling
strcmp to fix this.

This fixes a minor issue where internal interfaces are considered
non-internal in the userspace datapath for the purpose of adjusting the
MTU.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
 ofproto/ofproto.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 8e59c69..088f91a 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -220,7 +220,8 @@ static void learned_cookies_flush(struct ofproto *, struct ovs_list *dead_cookie
 /* ofport. */
 static void ofport_destroy__(struct ofport *) OVS_EXCLUDED(ofproto_mutex);
 static void ofport_destroy(struct ofport *, bool del);
-static inline bool ofport_is_internal(const struct ofport *);
+static inline bool ofport_is_internal(const struct ofproto *,
+                                      const struct ofport *);
 
 static int update_port(struct ofproto *, const char *devname);
 static int init_ports(struct ofproto *);
@@ -2465,7 +2466,7 @@ static void
 ofport_remove(struct ofport *ofport)
 {
     struct ofproto *p = ofport->ofproto;
-    bool is_internal = ofport_is_internal(ofport);
+    bool is_internal = ofport_is_internal(p, ofport);
 
     connmgr_send_port_status(ofport->ofproto->connmgr, NULL, &ofport->pp,
                              OFPPR_DELETE);
@@ -2751,9 +2752,10 @@ init_ports(struct ofproto *p)
 }
 
 static inline bool
-ofport_is_internal(const struct ofport *port)
+ofport_is_internal(const struct ofproto *p, const struct ofport *port)
 {
-    return !strcmp(netdev_get_type(port->netdev), "internal");
+    return !strcmp(netdev_get_type(port->netdev),
+                   ofproto_port_open_type(p->type, "internal"));
 }
 
 /* Find the minimum MTU of all non-datapath devices attached to 'p'.
@@ -2770,7 +2772,7 @@ find_min_mtu(struct ofproto *p)
 
         /* Skip any internal ports, since that's what we're trying to
          * set. */
-        if (ofport_is_internal(ofport)) {
+        if (ofport_is_internal(p, ofport)) {
             continue;
         }
 
@@ -2797,7 +2799,7 @@ update_mtu(struct ofproto *p, struct ofport *port)
         port->mtu = 0;
         return;
     }
-    if (ofport_is_internal(port)) {
+    if (ofport_is_internal(p, port)) {
         if (dev_mtu > p->min_mtu) {
            if (!netdev_set_mtu(port->netdev, p->min_mtu)) {
                dev_mtu = p->min_mtu;
@@ -2827,7 +2829,7 @@ update_mtu_ofproto(struct ofproto *p)
     HMAP_FOR_EACH (ofport, hmap_node, &p->ports) {
         struct netdev *netdev = ofport->netdev;
 
-        if (ofport_is_internal(ofport)) {
+        if (ofport_is_internal(p, ofport)) {
             if (!netdev_set_mtu(netdev, p->min_mtu)) {
                 ofport->mtu = p->min_mtu;
             }
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 2/7] vswitchd: Introduce 'mtu_request' column in Interface.
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
@ 2016-08-05 14:30 ` Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 3/7] netdev: Pass 'netdev_class' to ->run() and ->wait() Mark Kavanagh
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets

From: Daniele Di Proietto <diproiettod@vmware.com>

The 'mtu_request' column can be used to set the MTU of a specific
interface.

This column is useful because it will allow changing the MTU of DPDK
devices (implemented in a future commit), which are not accessible
outside the ovs-vswitchd process, but it can be used for kernel
interfaces as well.

The current implementation of set_mtu() in netdev-dpdk is removed
because it's broken.  It will be reintroduced by a subsequent commit on
this series.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
 NEWS                       |  2 ++
 lib/netdev-dpdk.c          | 53 +---------------------------------------------
 vswitchd/bridge.c          |  9 ++++++++
 vswitchd/vswitch.ovsschema | 10 +++++++--
 vswitchd/vswitch.xml       | 52 +++++++++++++++++++++++++++++++++------------
 5 files changed, 58 insertions(+), 68 deletions(-)

diff --git a/NEWS b/NEWS
index c2ed71d..ce10982 100644
--- a/NEWS
+++ b/NEWS
@@ -101,6 +101,8 @@ Post-v2.5.0
    - ovs-pki: Changed message digest algorithm from SHA-1 to SHA-512 because
      SHA-1 is no longer secure and some operating systems have started to
      disable it in OpenSSL.
+   - Add 'mtu_request' column to the Interface table. It can be used to
+     configure the MTU of non-internal ports.
 
 
 v2.5.0 - 26 Feb 2016
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index f37ec1c..60db568 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1639,57 +1639,6 @@ netdev_dpdk_get_mtu(const struct netdev *netdev, int *mtup)
 }
 
 static int
-netdev_dpdk_set_mtu(const struct netdev *netdev, int mtu)
-{
-    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
-    int old_mtu, err, dpdk_mtu;
-    struct dpdk_mp *old_mp;
-    struct dpdk_mp *mp;
-    uint32_t buf_size;
-
-    ovs_mutex_lock(&dpdk_mutex);
-    ovs_mutex_lock(&dev->mutex);
-    if (dev->mtu == mtu) {
-        err = 0;
-        goto out;
-    }
-
-    buf_size = dpdk_buf_size(mtu);
-    dpdk_mtu = FRAME_LEN_TO_MTU(buf_size);
-
-    mp = dpdk_mp_get(dev->socket_id, dpdk_mtu);
-    if (!mp) {
-        err = ENOMEM;
-        goto out;
-    }
-
-    rte_eth_dev_stop(dev->port_id);
-
-    old_mtu = dev->mtu;
-    old_mp = dev->dpdk_mp;
-    dev->dpdk_mp = mp;
-    dev->mtu = mtu;
-    dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
-
-    err = dpdk_eth_dev_init(dev);
-    if (err) {
-        dpdk_mp_put(mp);
-        dev->mtu = old_mtu;
-        dev->dpdk_mp = old_mp;
-        dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
-        dpdk_eth_dev_init(dev);
-        goto out;
-    }
-
-    dpdk_mp_put(old_mp);
-    netdev_change_seq_changed(netdev);
-out:
-    ovs_mutex_unlock(&dev->mutex);
-    ovs_mutex_unlock(&dpdk_mutex);
-    return err;
-}
-
-static int
 netdev_dpdk_get_carrier(const struct netdev *netdev, bool *carrier);
 
 static int
@@ -2964,7 +2913,7 @@ netdev_dpdk_vhost_cuse_reconfigure(struct netdev *netdev)
     netdev_dpdk_set_etheraddr,                                \
     netdev_dpdk_get_etheraddr,                                \
     netdev_dpdk_get_mtu,                                      \
-    netdev_dpdk_set_mtu,                                      \
+    NULL,                       /* set_mtu */                 \
     netdev_dpdk_get_ifindex,                                  \
     GET_CARRIER,                                              \
     netdev_dpdk_get_carrier_resets,                           \
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index ddf1fe5..397be70 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -775,6 +775,15 @@ bridge_delete_or_reconfigure_ports(struct bridge *br)
             goto delete;
         }
 
+        if (iface->cfg->n_mtu_request == 1
+            && strcmp(iface->type,
+                      ofproto_port_open_type(br->type, "internal"))) {
+            /* Try to set the MTU to the requested value.  This is not done
+             * for internal interfaces, since their MTU is decided by the
+             * ofproto module, based on other ports in the bridge. */
+            netdev_set_mtu(iface->netdev, *iface->cfg->mtu_request);
+        }
+
         /* If the requested OpenFlow port for 'iface' changed, and it's not
          * already the correct port, then we might want to temporarily delete
          * this interface, so we can add it back again with the new OpenFlow
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index 32fdf28..8966803 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
 {"name": "Open_vSwitch",
- "version": "7.13.0",
- "cksum": "889248633 22774",
+ "version": "7.14.0",
+ "cksum": "3974332717 22936",
  "tables": {
    "Open_vSwitch": {
      "columns": {
@@ -321,6 +321,12 @@
        "mtu": {
          "type": {"key": "integer", "min": 0, "max": 1},
          "ephemeral": true},
+       "mtu_request": {
+         "type": {
+           "key": {"type": "integer",
+                   "minInteger": 1},
+           "min": 0,
+           "max": 1}},
        "error": {
          "type": {"key": "string", "min": 0, "max": 1}}},
      "indexes": [["name"]]},
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 65acdc7..780bd2d 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2380,6 +2380,44 @@
       </column>
     </group>
 
+    <group title="MTU">
+      <p>
+        The MTU (maximum transmission unit) is the largest amount of data
+        that can fit into a single Ethernet frame.  The standard Ethernet
+        MTU is 1500 bytes.  Some physical media and many kinds of virtual
+        interfaces can be configured with higher MTUs.
+      </p>
+
+      <p>
+        A client may change a non-internal interface MTU by filling in
+        <ref column="mtu_request"/>.  Internal interfaces MTU, instead, is set
+        by Open vSwitch to the minimum of non-internal interfaces MTU in the
+        bridge. In any case, Open vSwitch then reports in <ref column="mtu"/>
+        the currently configured value.
+      </p>
+
+      <column name="mtu">
+        <p>
+          This column will be empty for an interface that does not
+          have an MTU as, for example, some kinds of tunnels do not.
+        </p>
+
+        <p>
+          Open vSwitch sets this column's value, so other clients should treat
+          it as read-only.
+        </p>
+      </column>
+
+      <column name="mtu_request"
+              type='{"type": "integer", "minInteger": 1}'>
+        <p>
+          Requested MTU (Maximum Transmission Unit) for the interface. A client
+          can fill this column to change the MTU of a non-internal interface.
+        </p>
+    </column>
+
+    </group>
+
     <group title="Interface Status">
       <p>
         Status information about interfaces attached to bridges, updated every
@@ -2422,20 +2460,6 @@
         </p>
       </column>
 
-      <column name="mtu">
-        <p>
-          The MTU (maximum transmission unit); i.e. the largest
-          amount of data that can fit into a single Ethernet frame.
-          The standard Ethernet MTU is 1500 bytes.  Some physical media
-          and many kinds of virtual interfaces can be configured with
-          higher MTUs.
-        </p>
-        <p>
-          This column will be empty for an interface that does not
-          have an MTU as, for example, some kinds of tunnels do not.
-        </p>
-      </column>
-
       <column name="lacp_current">
         Boolean value indicating LACP status for this interface.  If true, this
         interface has current LACP information about its LACP partner.  This
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 3/7] netdev: Pass 'netdev_class' to ->run() and ->wait().
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 2/7] vswitchd: Introduce 'mtu_request' column in Interface Mark Kavanagh
@ 2016-08-05 14:30 ` Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 4/7] netdev-dummy: Add dummy-internal class Mark Kavanagh
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets

From: Daniele Di Proietto <diproiettod@vmware.com>

This will allow run() and wait() methods to be shared between different
classes and still perform class-specific work.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
 lib/netdev-bsd.c      |  6 +++---
 lib/netdev-dummy.c    |  4 ++--
 lib/netdev-linux.c    |  6 +++---
 lib/netdev-provider.h | 14 ++++++++++----
 lib/netdev-vport.c    |  4 ++--
 lib/netdev.c          |  4 ++--
 6 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c
index 2bba0ed..75a330b 100644
--- a/lib/netdev-bsd.c
+++ b/lib/netdev-bsd.c
@@ -146,7 +146,7 @@ static void ifr_set_flags(struct ifreq *, int flags);
 static int af_link_ioctl(unsigned long command, const void *arg);
 #endif
 
-static void netdev_bsd_run(void);
+static void netdev_bsd_run(const struct netdev_class *);
 static int netdev_bsd_get_mtu(const struct netdev *netdev_, int *mtup);
 
 static bool
@@ -180,7 +180,7 @@ netdev_get_kernel_name(const struct netdev *netdev)
  * interface status changes, and eventually calls all the user callbacks.
  */
 static void
-netdev_bsd_run(void)
+netdev_bsd_run(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     rtbsd_notifier_run();
 }
@@ -190,7 +190,7 @@ netdev_bsd_run(void)
  * be called.
  */
 static void
-netdev_bsd_wait(void)
+netdev_bsd_wait(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     rtbsd_notifier_wait();
 }
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index a950409..2a6aa56 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -622,7 +622,7 @@ dummy_netdev_get_conn_state(struct dummy_packet_conn *conn)
 }
 
 static void
-netdev_dummy_run(void)
+netdev_dummy_run(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     struct netdev_dummy *dev;
 
@@ -636,7 +636,7 @@ netdev_dummy_run(void)
 }
 
 static void
-netdev_dummy_wait(void)
+netdev_dummy_wait(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     struct netdev_dummy *dev;
 
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index fa37bcf..1b5f7c1 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -526,7 +526,7 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
  * changes in the device miimon status, so we can use atomic_count. */
 static atomic_count miimon_cnt = ATOMIC_COUNT_INIT(0);
 
-static void netdev_linux_run(void);
+static void netdev_linux_run(const struct netdev_class *);
 
 static int netdev_linux_do_ethtool(const char *name, struct ethtool_cmd *,
                                    int cmd, const char *cmd_name);
@@ -623,7 +623,7 @@ netdev_linux_miimon_enabled(void)
 }
 
 static void
-netdev_linux_run(void)
+netdev_linux_run(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     struct nl_sock *sock;
     int error;
@@ -697,7 +697,7 @@ netdev_linux_run(void)
 }
 
 static void
-netdev_linux_wait(void)
+netdev_linux_wait(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     struct nl_sock *sock;
 
diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index ae390cb..5bcfeba 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -236,15 +236,21 @@ struct netdev_class {
     int (*init)(void);
 
     /* Performs periodic work needed by netdevs of this class.  May be null if
-     * no periodic work is necessary. */
-    void (*run)(void);
+     * no periodic work is necessary.
+     *
+     * 'netdev_class' points to the class.  It is useful in case the same
+     * function is used to implement different classes. */
+    void (*run)(const struct netdev_class *netdev_class);
 
     /* Arranges for poll_block() to wake up if the "run" member function needs
      * to be called.  Implementations are additionally required to wake
      * whenever something changes in any of its netdevs which would cause their
      * ->change_seq() function to change its result.  May be null if nothing is
-     * needed here. */
-    void (*wait)(void);
+     * needed here.
+     *
+     * 'netdev_class' points to the class.  It is useful in case the same
+     * function is used to implement different classes. */
+    void (*wait)(const struct netdev_class *netdev_class);
 
 /* ## ---------------- ## */
 /* ## netdev Functions ## */
diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 87a30f8..7eabd2c 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -321,7 +321,7 @@ netdev_vport_update_flags(struct netdev *netdev OVS_UNUSED,
 }
 
 static void
-netdev_vport_run(void)
+netdev_vport_run(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     uint64_t seq;
 
@@ -334,7 +334,7 @@ netdev_vport_run(void)
 }
 
 static void
-netdev_vport_wait(void)
+netdev_vport_wait(const struct netdev_class *netdev_class OVS_UNUSED)
 {
     uint64_t seq;
 
diff --git a/lib/netdev.c b/lib/netdev.c
index 75bf1cb..589d37c 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -160,7 +160,7 @@ netdev_run(void)
     struct netdev_registered_class *rc;
     CMAP_FOR_EACH (rc, cmap_node, &netdev_classes) {
         if (rc->class->run) {
-            rc->class->run();
+            rc->class->run(rc->class);
         }
     }
 }
@@ -178,7 +178,7 @@ netdev_wait(void)
     struct netdev_registered_class *rc;
     CMAP_FOR_EACH (rc, cmap_node, &netdev_classes) {
         if (rc->class->wait) {
-            rc->class->wait();
+            rc->class->wait(rc->class);
         }
     }
 }
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 4/7] netdev-dummy: Add dummy-internal class.
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 2/7] vswitchd: Introduce 'mtu_request' column in Interface Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 3/7] netdev: Pass 'netdev_class' to ->run() and ->wait() Mark Kavanagh
@ 2016-08-05 14:30 ` Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 5/7] tests: Add a new MTU test Mark Kavanagh
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets

From: Daniele Di Proietto <diproiettod@vmware.com>

"internal" netdevs are treated specially in OVS (e.g. for MTU), but
the dummy datapath remaps both "system" and "internal" devices to the
same "dummy" netdev class, so there's no way to discern those in tests.

This commit adds a new "dummy-internal" netdev type, which will be used
by the dummy datapath for internal ports, so that other parts of the
code can understand which ports are internal just by looking at the
netdev object.

The alternative solution, using the original interface type ("internal")
instead of the translated netdev type ("dummy"), is harder to implement,
because in so many places only the netdev object is available.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
 lib/dpif-netdev.c             |  2 +-
 lib/netdev-dummy.c            | 14 ++++++++++++--
 tests/bridge.at               |  6 +++---
 tests/dpctl.at                | 12 ++++++------
 tests/mpls-xlate.at           |  4 ++--
 tests/netdev-type.at          |  2 +-
 tests/ofproto-dpif.at         | 18 +++++++++---------
 tests/ovs-vswitchd.at         |  6 +++---
 tests/pmd.at                  |  8 ++++----
 tests/tunnel-push-pop-ipv6.at |  4 ++--
 tests/tunnel-push-pop.at      |  4 ++--
 tests/tunnel.at               | 28 ++++++++++++++--------------
 12 files changed, 59 insertions(+), 49 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index e39362e..6f2e07d 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -888,7 +888,7 @@ static const char *
 dpif_netdev_port_open_type(const struct dpif_class *class, const char *type)
 {
     return strcmp(type, "internal") ? type
-                  : dpif_netdev_class_is_dummy(class) ? "dummy"
+                  : dpif_netdev_class_is_dummy(class) ? "dummy-internal"
                   : "tap";
 }
 
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 2a6aa56..92af15f 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -622,12 +622,15 @@ dummy_netdev_get_conn_state(struct dummy_packet_conn *conn)
 }
 
 static void
-netdev_dummy_run(const struct netdev_class *netdev_class OVS_UNUSED)
+netdev_dummy_run(const struct netdev_class *netdev_class)
 {
     struct netdev_dummy *dev;
 
     ovs_mutex_lock(&dummy_list_mutex);
     LIST_FOR_EACH (dev, list_node, &dummy_list) {
+        if (netdev_get_class(&dev->up) != netdev_class) {
+            continue;
+        }
         ovs_mutex_lock(&dev->mutex);
         dummy_packet_conn_run(dev);
         ovs_mutex_unlock(&dev->mutex);
@@ -636,12 +639,15 @@ netdev_dummy_run(const struct netdev_class *netdev_class OVS_UNUSED)
 }
 
 static void
-netdev_dummy_wait(const struct netdev_class *netdev_class OVS_UNUSED)
+netdev_dummy_wait(const struct netdev_class *netdev_class)
 {
     struct netdev_dummy *dev;
 
     ovs_mutex_lock(&dummy_list_mutex);
     LIST_FOR_EACH (dev, list_node, &dummy_list) {
+        if (netdev_get_class(&dev->up) != netdev_class) {
+            continue;
+        }
         ovs_mutex_lock(&dev->mutex);
         dummy_packet_conn_wait(&dev->conn);
         ovs_mutex_unlock(&dev->mutex);
@@ -1380,6 +1386,9 @@ netdev_dummy_update_flags(struct netdev *netdev_,
 static const struct netdev_class dummy_class =
     NETDEV_DUMMY_CLASS("dummy", false, NULL);
 
+static const struct netdev_class dummy_internal_class =
+    NETDEV_DUMMY_CLASS("dummy-internal", false, NULL);
+
 static const struct netdev_class dummy_pmd_class =
     NETDEV_DUMMY_CLASS("dummy-pmd", true,
                        netdev_dummy_reconfigure);
@@ -1751,6 +1760,7 @@ netdev_dummy_register(enum dummy_level level)
         netdev_dummy_override("system");
     }
     netdev_register_provider(&dummy_class);
+    netdev_register_provider(&dummy_internal_class);
     netdev_register_provider(&dummy_pmd_class);
 
     netdev_vport_tunnel_register();
diff --git a/tests/bridge.at b/tests/bridge.at
index 37c55ba..3dbabe5 100644
--- a/tests/bridge.at
+++ b/tests/bridge.at
@@ -12,7 +12,7 @@ add_of_ports br0 1 2
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (dummy)
 		p2 2/2: (dummy)
 ])
@@ -23,7 +23,7 @@ AT_CHECK([ovs-appctl dpctl/del-if dummy@ovs-dummy p1])
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p2 2/2: (dummy)
 ])
 
@@ -32,7 +32,7 @@ AT_CHECK([ovs-vsctl del-port p2])
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (dummy)
 ])
 OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
diff --git a/tests/dpctl.at b/tests/dpctl.at
index b6d5dd6..8c761c8 100644
--- a/tests/dpctl.at
+++ b/tests/dpctl.at
@@ -23,14 +23,14 @@ AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
 dummy@br0:
 	lookups: hit:0 missed:0 lost:0
 	flows: 0
-	port 0: br0 (dummy)
+	port 0: br0 (dummy-internal)
 ])
 AT_CHECK([ovs-appctl dpctl/add-if dummy@br0 vif1.0,type=dummy,port_no=5])
 AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
 dummy@br0:
 	lookups: hit:0 missed:0 lost:0
 	flows: 0
-	port 0: br0 (dummy)
+	port 0: br0 (dummy-internal)
 	port 5: vif1.0 (dummy)
 ])
 AT_CHECK([ovs-appctl dpctl/add-if dummy@br0 vif1.0,type=dummy], [2], [],
@@ -44,9 +44,9 @@ AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 vif1.0,type=system], [2], [],
   [ovs-vswitchd: vif1.0: can't change type from dummy to system
 ovs-appctl: ovs-vswitchd: server returned an error
 ])
-AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=dummy], [0])
+AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=dummy-internal], [0])
 AT_CHECK([ovs-appctl dpctl/set-if dummy@br0 br0,type=internal], [2], [],
-  [ovs-vswitchd: br0: can't change type from dummy to internal
+  [ovs-vswitchd: br0: can't change type from dummy-internal to internal
 ovs-appctl: ovs-vswitchd: server returned an error
 ])
 AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 vif1.0])
@@ -54,7 +54,7 @@ AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
 dummy@br0:
 	lookups: hit:0 missed:0 lost:0
 	flows: 0
-	port 0: br0 (dummy)
+	port 0: br0 (dummy-internal)
 ])
 AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 vif1.0], [2], [],
   [ovs-vswitchd: no port named vif1.0
@@ -64,7 +64,7 @@ AT_CHECK([ovs-appctl dpctl/show dummy@br0], [0], [dnl
 dummy@br0:
 	lookups: hit:0 missed:0 lost:0
 	flows: 0
-	port 0: br0 (dummy)
+	port 0: br0 (dummy-internal)
 ])
 AT_CHECK([ovs-appctl dpctl/del-if dummy@br0 nonexistent], [2], [],
   [ovs-vswitchd: no port named nonexistent
diff --git a/tests/mpls-xlate.at b/tests/mpls-xlate.at
index a9a3cf5..598a05a 100644
--- a/tests/mpls-xlate.at
+++ b/tests/mpls-xlate.at
@@ -16,11 +16,11 @@ OVS_VSWITCHD_START(
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy)
 		p1 2/none: (patch: peer=p2)
 	br1:
-		br1 65534/101: (dummy)
+		br1 65534/101: (dummy-internal)
 		p2 1/none: (patch: peer=p1)
 ])
 
diff --git a/tests/netdev-type.at b/tests/netdev-type.at
index 184031b..5450f33 100644
--- a/tests/netdev-type.at
+++ b/tests/netdev-type.at
@@ -9,7 +9,7 @@ add_of_ports br0 1
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (dummy)
 ])
 #
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 2c35fe1..a46fc81 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -5657,7 +5657,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
 		p2 2/2: (dummy)
 ])
@@ -5829,10 +5829,10 @@ AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy: ifindex=1010)
 	int-br:
-		int-br 65534/2: (dummy)
+		int-br 65534/2: (dummy-internal)
 		t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
 		vm1 5/3: (dummy: ifindex=2011)
 ])
@@ -6573,11 +6573,11 @@ add_of_ports br1 3
 AT_CHECK([ovs-appctl dpif/show | sed 's/\(dummy-pmd: \).*)/\1<cleared>)/'], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (dummy-pmd: <cleared>)
 		p2 2/2: (dummy-pmd: <cleared>)
 	br1:
-		br1 65534/101: (dummy)
+		br1 65534/101: (dummy-internal)
 		p3 3/3: (dummy)
 ])
 OVS_VSWITCHD_STOP
@@ -6757,11 +6757,11 @@ sleep 1  # wait for log writer
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:13 missed:2
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p2 2/2: (dummy)
 		pbr0 1/none: (patch: peer=pbr1)
 	br1:
-		br1 65534/101: (dummy)
+		br1 65534/101: (dummy-internal)
 		p3 3/3: (dummy)
 		pbr1 1/none: (patch: peer=pbr0)
 ])
@@ -6822,11 +6822,11 @@ OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:1
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p2 2/2: (dummy)
 		pbr0 1/none: (patch: peer=pbr1)
 	br1:
-		br1 65534/101: (dummy)
+		br1 65534/101: (dummy-internal)
 		p3 3/3: (dummy)
 		pbr1 1/none: (patch: peer=pbr0)
 ])
diff --git a/tests/ovs-vswitchd.at b/tests/ovs-vswitchd.at
index 21c14d2..a4e6a59 100644
--- a/tests/ovs-vswitchd.at
+++ b/tests/ovs-vswitchd.at
@@ -186,9 +186,9 @@ AT_CHECK([ovs-vsctl add-port br0 p1  -- set interface p1 type=internal])
 
 dnl ovs-vswitchd should still 'see' ovsdb change with the 'monitor' method
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
-		p0 1/1: (dummy)
-		p1 2/2: (dummy)
+		br0 65534/100: (dummy-internal)
+		p0 1/1: (dummy-internal)
+		p1 2/2: (dummy-internal)
 ])
 OVS_VSWITCHD_STOP
 AT_CLEANUP
diff --git a/tests/pmd.at b/tests/pmd.at
index 2188ea1..5a10255 100644
--- a/tests/pmd.at
+++ b/tests/pmd.at
@@ -70,7 +70,7 @@ pmd thread numa_id <cleared> core_id <cleared>:
 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy-pmd: configured_rx_queues=1, configured_tx_queues=<cleared>, requested_rx_queues=1, requested_tx_queues=<cleared>)
 ])
 
@@ -88,7 +88,7 @@ AT_CHECK([ovs-vsctl set interface p0 options:n_rxq=8])
 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy-pmd: configured_rx_queues=8, configured_tx_queues=<cleared>, requested_rx_queues=8, requested_tx_queues=<cleared>)
 ])
 
@@ -112,7 +112,7 @@ CHECK_PMD_THREADS_CREATED()
 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy-pmd: configured_rx_queues=8, configured_tx_queues=<cleared>, requested_rx_queues=8, requested_tx_queues=<cleared>)
 ])
 
@@ -164,7 +164,7 @@ sleep 1
 AT_CHECK([ovs-appctl dpif/show | sed 's/\(tx_queues=\)[[0-9]]*/\1<cleared>/g'], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 7/1: (dummy-pmd: configured_rx_queues=4, configured_tx_queues=<cleared>, requested_rx_queues=4, requested_tx_queues=<cleared>)
 ])
 
diff --git a/tests/tunnel-push-pop-ipv6.at b/tests/tunnel-push-pop-ipv6.at
index e88776c..e47eb50 100644
--- a/tests/tunnel-push-pop-ipv6.at
+++ b/tests/tunnel-push-pop-ipv6.at
@@ -17,10 +17,10 @@ AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy)
 	int-br:
-		int-br 65534/2: (dummy)
+		int-br 65534/2: (dummy-internal)
 		t1 3/3: (gre: key=456, remote_ip=2001:cafe::92)
 		t2 2/4789: (vxlan: key=123, remote_ip=2001:cafe::92)
 		t3 4/4789: (vxlan: csum=true, out_key=flow, remote_ip=2001:cafe::93)
diff --git a/tests/tunnel-push-pop.at b/tests/tunnel-push-pop.at
index 40c2058..ee29594 100644
--- a/tests/tunnel-push-pop.at
+++ b/tests/tunnel-push-pop.at
@@ -17,10 +17,10 @@ AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
 dummy@ovs-dummy: hit:0 missed:0
 	br0:
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p0 1/1: (dummy)
 	int-br:
-		int-br 65534/2: (dummy)
+		int-br 65534/2: (dummy-internal)
 		t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
 		t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
 		t3 4/4789: (vxlan: csum=true, out_key=flow, remote_ip=1.1.2.93)
diff --git a/tests/tunnel.at b/tests/tunnel.at
index 15ae5cf..477517e 100644
--- a/tests/tunnel.at
+++ b/tests/tunnel.at
@@ -16,7 +16,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: remote_ip=1.1.1.1)
 		p2 2/1: (gre: local_ip=2.2.2.2, remote_ip=1.1.1.1)
 		p3 3/1: (gre: remote_ip=2.2.2.2)
@@ -39,7 +39,7 @@ AT_CHECK([ovs-vsctl set Interface p2 type=gre options:local_ip=2.2.2.3 \
           options:df_default=false options:ttl=1 options:csum=true \
           -- set Interface p3 type=vxlan])
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: remote_ip=1.1.1.1)
 		p2 2/1: (gre: csum=true, df_default=false, local_ip=2.2.2.3, remote_ip=1.1.1.1, ttl=1)
 		p3 3/4789: (vxlan: remote_ip=2.2.2.2)
@@ -74,7 +74,7 @@ actions=2
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: remote_ip=1.1.1.1)
 		p2 2/2: (dummy)
 ])
@@ -123,7 +123,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
 		p2 2/2: (dummy)
 ])
@@ -276,7 +276,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
 		p2 2/2: (dummy)
 ])
@@ -319,7 +319,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
 		p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
 		p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
@@ -352,7 +352,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
 		p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
 		p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
@@ -405,7 +405,7 @@ OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
 		p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
 		p3 3/3: (dummy)
@@ -441,7 +441,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
                     options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=5000])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
 ])
 
@@ -453,7 +453,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
                     options:remote_ip=1.1.1.1 ofport_request=1])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/4789: (vxlan: remote_ip=1.1.1.1)
 ])
 
@@ -465,7 +465,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
                     options:remote_ip=1.1.1.1 ofport_request=1])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/4341: (lisp: remote_ip=1.1.1.1)
 ])
 
@@ -477,7 +477,7 @@ OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
                     options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
 ])
 
@@ -486,7 +486,7 @@ dnl change UDP port
 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
 ])
 
@@ -495,7 +495,7 @@ dnl change UDP port to default
 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
 
 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
-		br0 65534/100: (dummy)
+		br0 65534/100: (dummy-internal)
 		p1 1/4789: (vxlan: remote_ip=1.1.1.1)
 ])
 OVS_VSWITCHD_STOP
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 5/7] tests: Add a new MTU test.
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
                   ` (2 preceding siblings ...)
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 4/7] netdev-dummy: Add dummy-internal class Mark Kavanagh
@ 2016-08-05 14:30 ` Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 6/7] netdev: Make netdev_set_mtu() netdev parameter non-const Mark Kavanagh
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets

From: Daniele Di Proietto <diproiettod@vmware.com>

Also, netdev-dummy needs to call netdev_change_seq_changed() in
set_mtu().

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
 lib/netdev-dummy.c    |  5 ++++-
 tests/ofproto-dpif.at | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 92af15f..c8f82b7 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -1155,7 +1155,10 @@ netdev_dummy_set_mtu(const struct netdev *netdev, int mtu)
     struct netdev_dummy *dev = netdev_dummy_cast(netdev);
 
     ovs_mutex_lock(&dev->mutex);
-    dev->mtu = mtu;
+    if (dev->mtu != mtu) {
+        dev->mtu = mtu;
+        netdev_change_seq_changed(netdev);
+    }
     ovs_mutex_unlock(&dev->mutex);
 
     return 0;
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index a46fc81..3638063 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -8859,3 +8859,33 @@ n_packets=0
 
 OVS_VSWITCHD_STOP
 AT_CLEANUP
+
+AT_SETUP([ofproto - set mtu])
+OVS_VSWITCHD_START
+
+add_of_ports br0 1
+
+# Check that initial MTU is 1500 for 'br0' and 'p1'.
+AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl
+1500
+])
+AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl
+1500
+])
+
+# Request new MTU for 'p1'
+AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600])
+
+# Check that the new MTU is applied
+AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600])
+# The internal port 'br0' should have the same MTU value as p1, becase it's
+# the new bridge minimum.
+AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600])
+
+AT_CHECK([ovs-vsctl del-port br0 p1])
+
+# When 'p1' is deleted, the internal port should return to the default MTU
+AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 6/7] netdev: Make netdev_set_mtu() netdev parameter non-const.
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
                   ` (3 preceding siblings ...)
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 5/7] tests: Add a new MTU test Mark Kavanagh
@ 2016-08-05 14:30 ` Mark Kavanagh
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 7/7] netdev-dpdk: add support for Jumbo Frames Mark Kavanagh
  2016-08-05 14:41 ` [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Kavanagh, Mark B
  6 siblings, 0 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets

From: Daniele Di Proietto <diproiettod@vmware.com>

Every provider silently drops the const attribute when converting the
parameter to the appropriate subclass.  Might as well drop the const
attribute from the parameter, since this is a "set" function.

Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---
v2->v1: add missing 'Signed-off-by' field in commit message.

 lib/netdev-dummy.c    | 2 +-
 lib/netdev-linux.c    | 2 +-
 lib/netdev-provider.h | 2 +-
 lib/netdev.c          | 2 +-
 lib/netdev.h          | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index c8f82b7..dec1a8e 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -1150,7 +1150,7 @@ netdev_dummy_get_mtu(const struct netdev *netdev, int *mtup)
 }
 
 static int
-netdev_dummy_set_mtu(const struct netdev *netdev, int mtu)
+netdev_dummy_set_mtu(struct netdev *netdev, int mtu)
 {
     struct netdev_dummy *dev = netdev_dummy_cast(netdev);
 
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 1b5f7c1..20b5cc7 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1382,7 +1382,7 @@ netdev_linux_get_mtu(const struct netdev *netdev_, int *mtup)
  * networking ioctl interface.
  */
 static int
-netdev_linux_set_mtu(const struct netdev *netdev_, int mtu)
+netdev_linux_set_mtu(struct netdev *netdev_, int mtu)
 {
     struct netdev_linux *netdev = netdev_linux_cast(netdev_);
     struct ifreq ifr;
diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index 5bcfeba..cd04ae9 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -389,7 +389,7 @@ struct netdev_class {
      * If 'netdev' does not have an MTU (e.g. as some tunnels do not), then
      * this function should return EOPNOTSUPP.  This function may be set to
      * null if it would always return EOPNOTSUPP. */
-    int (*set_mtu)(const struct netdev *netdev, int mtu);
+    int (*set_mtu)(struct netdev *netdev, int mtu);
 
     /* Returns the ifindex of 'netdev', if successful, as a positive number.
      * On failure, returns a negative errno value.
diff --git a/lib/netdev.c b/lib/netdev.c
index 589d37c..5cf8bbb 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -869,7 +869,7 @@ netdev_get_mtu(const struct netdev *netdev, int *mtup)
  * MTU (as e.g. some tunnels do not).  On other failure, returns a positive
  * errno value. */
 int
-netdev_set_mtu(const struct netdev *netdev, int mtu)
+netdev_set_mtu(struct netdev *netdev, int mtu)
 {
     const struct netdev_class *class = netdev->netdev_class;
     int error;
diff --git a/lib/netdev.h b/lib/netdev.h
index dc7ede8..d8ec627 100644
--- a/lib/netdev.h
+++ b/lib/netdev.h
@@ -132,7 +132,7 @@ const char *netdev_get_name(const struct netdev *);
 const char *netdev_get_type(const struct netdev *);
 const char *netdev_get_type_from_name(const char *);
 int netdev_get_mtu(const struct netdev *, int *mtup);
-int netdev_set_mtu(const struct netdev *, int mtu);
+int netdev_set_mtu(struct netdev *, int mtu);
 int netdev_get_ifindex(const struct netdev *);
 int netdev_set_tx_multiq(struct netdev *, unsigned int n_txq);
 
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 7/7] netdev-dpdk: add support for Jumbo Frames
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
                   ` (4 preceding siblings ...)
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 6/7] netdev: Make netdev_set_mtu() netdev parameter non-const Mark Kavanagh
@ 2016-08-05 14:30 ` Mark Kavanagh
  2016-08-05 14:41 ` [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Kavanagh, Mark B
  6 siblings, 0 replies; 8+ messages in thread
From: Mark Kavanagh @ 2016-08-05 14:30 UTC (permalink / raw)
  To: dev, diproiettod; +Cc: i.maximets, Mark Kavanagh

Add support for Jumbo Frames to DPDK-enabled port types,
using single-segment-mbufs.

Using this approach, the amount of memory allocated to each mbuf
to store frame data is increased to a value greater than 1518B
(typical Ethernet maximum frame length). The increased space
available in the mbuf means that an entire Jumbo Frame of a specific
size can be carried in a single mbuf, as opposed to partitioning
it across multiple mbuf segments.

The amount of space allocated to each mbuf to hold frame data is
defined dynamically by the user with ovs-vsctl, via the 'mtu_request'
parameter.

Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
[diproiettod@vmware.com rebased]
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
---

Previous: http://openvswitch.org/pipermail/dev/2016-July/076845.html

v2->v1:
    - rebase to HEAD of master
    - fall back to previous 'good' MTU if reconfigure fails
    - introduce new field 'last_mtu' in struct netdev-dpdk to facilitate
      fall-back
    - rename 'mtu_request' to 'requested_mtu' in struct netdev_dpdk
    - remove rebasing artifact in INSTALL.DPDK-Advanced.md
    - remove superflous variable in dpdk_mp_configure
    - fix minor coding style infraction

 INSTALL.DPDK-ADVANCED.md |  58 ++++++++++++++++-
 INSTALL.DPDK.md          |   1 -
 NEWS                     |   1 +
 lib/netdev-dpdk.c        | 165 ++++++++++++++++++++++++++++++++++++++++-------
 4 files changed, 197 insertions(+), 28 deletions(-)

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index 0ab43d4..5e758ce 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -1,5 +1,5 @@
 OVS DPDK ADVANCED INSTALL GUIDE
-=================================
+===============================
 
 ## Contents
 
@@ -12,7 +12,8 @@ OVS DPDK ADVANCED INSTALL GUIDE
 7. [QOS](#qos)
 8. [Rate Limiting](#rl)
 9. [Flow Control](#fc)
-10. [Vsperf](#vsperf)
+10. [Jumbo Frames](#jumbo)
+11. [Vsperf](#vsperf)
 
 ## <a name="overview"></a> 1. Overview
 
@@ -862,7 +863,58 @@ respective parameter. To disable the flow control at tx side,
 
 `ovs-vsctl set Interface dpdk0 options:tx-flow-ctrl=false`
 
-## <a name="vsperf"></a> 10. Vsperf
+## <a name="jumbo"></a> 10. Jumbo Frames
+
+By default, DPDK ports are configured with standard Ethernet MTU (1500B). To
+enable Jumbo Frames support for a DPDK port, change the Interface's `mtu_request`
+attribute to a sufficiently large value.
+
+e.g. Add a DPDK Phy port with MTU of 9000:
+
+`ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk -- set Interface dpdk0 mtu_request=9000`
+
+e.g. Change the MTU of an existing port to 6200:
+
+`ovs-vsctl set Interface dpdk0 mtu_request=6200`
+
+When Jumbo Frames are enabled, the size of a DPDK port's mbuf segments are
+increased, such that a full Jumbo Frame of a specific size may be accommodated
+within a single mbuf segment.
+
+Jumbo frame support has been validated against 9728B frames (largest frame size
+supported by Fortville NIC), using the DPDK `i40e` driver, but larger frames
+(particularly in use cases involving East-West traffic only), and other DPDK NIC
+drivers may be supported.
+
+### 9.1 vHost Ports and Jumbo Frames
+
+Some additional configuration is needed to take advantage of jumbo frames with
+vhost ports:
+
+    1. `mergeable buffers` must be enabled for vHost ports, as demonstrated in
+        the QEMU command line snippet below:
+
+        ```
+        '-netdev type=vhost-user,id=mynet1,chardev=char0,vhostforce \'
+        '-device virtio-net-pci,mac=00:00:00:00:00:01,netdev=mynet1,mrg_rxbuf=on'
+        ```
+
+    2. Where virtio devices are bound to the Linux kernel driver in a guest
+       environment (i.e. interfaces are not bound to an in-guest DPDK driver),
+       the MTU of those logical network interfaces must also be increased to a
+       sufficiently large value. This avoids segmentation of Jumbo Frames
+       received in the guest. Note that 'MTU' refers to the length of the IP
+       packet only, and not that of the entire frame.
+
+       To calculate the exact MTU of a standard IPv4 frame, subtract the L2
+       header and CRC lengths (i.e. 18B) from the max supported frame size.
+       So, to set the MTU for a 9018B Jumbo Frame:
+
+       ```
+       ifconfig eth1 mtu 9000
+       ```
+
+## <a name="vsperf"></a> 11. Vsperf
 
 Vsperf project goal is to develop vSwitch test framework that can be used to
 validate the suitability of different vSwitch implementations in a Telco deployment
diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md
index 253d022..a810ac8 100644
--- a/INSTALL.DPDK.md
+++ b/INSTALL.DPDK.md
@@ -590,7 +590,6 @@ can be found in [Vhost Walkthrough].
 
 ## <a name="ovslimits"></a> 6. Limitations
 
-  - Supports MTU size 1500, MTU setting for DPDK netdevs will be in future OVS release.
   - Currently DPDK ports does not use HW offload functionality.
   - Network Interface Firmware requirements:
     Each release of DPDK is validated against a specific firmware version for
diff --git a/NEWS b/NEWS
index ce10982..53c816b 100644
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,7 @@ Post-v2.5.0
      * Basic connection tracking for the userspace datapath (no ALG,
        fragmentation or NAT support yet)
      * Support for DPDK 16.07
+     * Jumbo frame support
    - Increase number of registers to 16.
    - ovs-benchmark: This utility has been removed due to lack of use and
      bitrot.
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 60db568..c22828d 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -81,6 +81,7 @@ static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
                                     + sizeof(struct dp_packet)    \
                                     + RTE_PKTMBUF_HEADROOM)
 #define NETDEV_DPDK_MBUF_ALIGN      1024
+#define NETDEV_DPDK_MAX_PKT_LEN     9728
 
 /* Max and min number of packets in the mempool.  OVS tries to allocate a
  * mempool with MAX_NB_MBUF: if this fails (because the system doesn't have
@@ -337,6 +338,8 @@ struct netdev_dpdk {
 
     struct dpdk_mp *dpdk_mp;
     int mtu;
+    int requested_mtu;
+    int last_mtu;
     int socket_id;
     int buf_size;
     struct netdev_stats stats;
@@ -477,10 +480,19 @@ dpdk_mp_get(int socket_id, int mtu) OVS_REQUIRES(dpdk_mutex)
     dmp->mtu = mtu;
     dmp->refcount = 1;
     mbp_priv.mbuf_data_room_size = MBUF_SIZE(mtu) - sizeof(struct dp_packet);
-    mbp_priv.mbuf_priv_size = sizeof (struct dp_packet) -
-                              sizeof (struct rte_mbuf);
+    mbp_priv.mbuf_priv_size = sizeof (struct dp_packet)
+                              - sizeof (struct rte_mbuf);
+    /* XXX: this is a really rough method of provisioning memory.
+     * It's impossible to determine what the exact memory requirements are when
+     * the number of ports and rxqs that utilize a particular mempool can change
+     * dynamically at runtime. For the moment, use this rough heurisitic.
+     */
+    if (mtu >= ETHER_MTU) {
+        mp_size = MAX_NB_MBUF;
+    } else {
+        mp_size = MIN_NB_MBUF;
+    }
 
-    mp_size = MAX_NB_MBUF;
     do {
         if (snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_mp_%d_%d_%u",
                      dmp->mtu, dmp->socket_id, mp_size) < 0) {
@@ -520,6 +532,28 @@ dpdk_mp_put(struct dpdk_mp *dmp) OVS_REQUIRES(dpdk_mutex)
     }
 }
 
+static int
+dpdk_mp_configure(struct netdev_dpdk *dev)
+    OVS_REQUIRES(dpdk_mutex)
+    OVS_REQUIRES(dev->mutex)
+{
+    uint32_t buf_size = dpdk_buf_size(dev->mtu);
+    struct dpdk_mp *mp;
+
+    mp = dpdk_mp_get(dev->socket_id, FRAME_LEN_TO_MTU(buf_size));
+    if (!mp) {
+        VLOG_ERR("Insufficient memory to create memory pool for netdev %s\n",
+                 dev->up.name);
+        return ENOMEM;
+    } else {
+        dpdk_mp_put(dev->dpdk_mp);
+        dev->dpdk_mp = mp;
+        dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
+    }
+
+    return 0;
+}
+
 static void
 check_link_status(struct netdev_dpdk *dev)
 {
@@ -571,7 +605,15 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
 {
     int diag = 0;
     int i;
+    struct rte_eth_conf conf = port_conf;
 
+    if (dev->mtu > ETHER_MTU) {
+        conf.rxmode.jumbo_frame = 1;
+        conf.rxmode.max_rx_pkt_len = dev->max_packet_len;
+    } else {
+        conf.rxmode.jumbo_frame = 0;
+        conf.rxmode.max_rx_pkt_len = 0;
+    }
     /* A device may report more queues than it makes available (this has
      * been observed for Intel xl710, which reserves some of them for
      * SRIOV):  rte_eth_*_queue_setup will fail if a queue is not
@@ -582,8 +624,10 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
             VLOG_INFO("Retrying setup with (rxq:%d txq:%d)", n_rxq, n_txq);
         }
 
-        diag = rte_eth_dev_configure(dev->port_id, n_rxq, n_txq, &port_conf);
+        diag = rte_eth_dev_configure(dev->port_id, n_rxq, n_txq, &conf);
         if (diag) {
+            VLOG_WARN("Interface %s eth_dev setup error %s\n",
+                      dev->up.name, rte_strerror(-diag));
             break;
         }
 
@@ -736,7 +780,6 @@ netdev_dpdk_init(struct netdev *netdev, unsigned int port_no,
     struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
     int sid;
     int err = 0;
-    uint32_t buf_size;
 
     ovs_mutex_init(&dev->mutex);
     ovs_mutex_lock(&dev->mutex);
@@ -757,15 +800,13 @@ netdev_dpdk_init(struct netdev *netdev, unsigned int port_no,
     dev->port_id = port_no;
     dev->type = type;
     dev->flags = 0;
-    dev->mtu = ETHER_MTU;
+    dev->requested_mtu = dev->mtu = dev->last_mtu = ETHER_MTU;
     dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
     ovsrcu_index_init(&dev->vid, -1);
     dev->vhost_reconfigured = false;
 
-    buf_size = dpdk_buf_size(dev->mtu);
-    dev->dpdk_mp = dpdk_mp_get(dev->socket_id, FRAME_LEN_TO_MTU(buf_size));
-    if (!dev->dpdk_mp) {
-        err = ENOMEM;
+    err = dpdk_mp_configure(dev);
+    if (err) {
         goto unlock;
     }
 
@@ -991,6 +1032,7 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args)
     smap_add_format(args, "configured_rx_queues", "%d", netdev->n_rxq);
     smap_add_format(args, "requested_tx_queues", "%d", dev->requested_n_txq);
     smap_add_format(args, "configured_tx_queues", "%d", netdev->n_txq);
+    smap_add_format(args, "mtu", "%d", dev->mtu);
     ovs_mutex_unlock(&dev->mutex);
 
     return 0;
@@ -1366,6 +1408,7 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
     struct rte_mbuf **cur_pkts = (struct rte_mbuf **) pkts;
     unsigned int total_pkts = cnt;
     unsigned int qos_pkts = cnt;
+    unsigned int mtu_dropped = 0;
     int retries = 0;
 
     qid = dev->tx_q[qid % netdev->n_txq].map;
@@ -1387,25 +1430,41 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
     do {
         int vhost_qid = qid * VIRTIO_QNUM + VIRTIO_RXQ;
         unsigned int tx_pkts;
+        unsigned int try_tx_pkts = cnt;
 
+        for (unsigned int i = 0; i < cnt; i++) {
+            if (cur_pkts[i]->pkt_len > dev->max_packet_len) {
+                try_tx_pkts = i;
+                break;
+            }
+        }
+        if (!try_tx_pkts) {
+            cur_pkts++;
+            mtu_dropped++;
+            cnt--;
+            continue;
+        }
         tx_pkts = rte_vhost_enqueue_burst(netdev_dpdk_get_vid(dev),
-                                          vhost_qid, cur_pkts, cnt);
+                                          vhost_qid, cur_pkts, try_tx_pkts);
         if (OVS_LIKELY(tx_pkts)) {
             /* Packets have been sent.*/
             cnt -= tx_pkts;
             /* Prepare for possible retry.*/
             cur_pkts = &cur_pkts[tx_pkts];
+            if (tx_pkts != try_tx_pkts) {
+                retries++;
+            }
         } else {
             /* No packets sent - do not retry.*/
             break;
         }
-    } while (cnt && (retries++ < VHOST_ENQ_RETRY_NUM));
+    } while (cnt && (retries <= VHOST_ENQ_RETRY_NUM));
 
     rte_spinlock_unlock(&dev->tx_q[qid].tx_lock);
 
     rte_spinlock_lock(&dev->stats_lock);
-    cnt += qos_pkts;
-    netdev_dpdk_vhost_update_tx_counters(&dev->stats, pkts, total_pkts, cnt);
+    netdev_dpdk_vhost_update_tx_counters(&dev->stats, pkts, total_pkts,
+                                         cnt + mtu_dropped + qos_pkts);
     rte_spinlock_unlock(&dev->stats_lock);
 
 out:
@@ -1639,6 +1698,26 @@ netdev_dpdk_get_mtu(const struct netdev *netdev, int *mtup)
 }
 
 static int
+netdev_dpdk_set_mtu(struct netdev *netdev, int mtu)
+{
+    struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+
+    if (MTU_TO_FRAME_LEN(mtu) > NETDEV_DPDK_MAX_PKT_LEN) {
+        VLOG_WARN("Unsupported MTU (%d)\n", mtu);
+        return EINVAL;
+    }
+
+    ovs_mutex_lock(&dev->mutex);
+    if (dev->requested_mtu != mtu) {
+        dev->requested_mtu = mtu;
+        netdev_request_reconfigure(netdev);
+    }
+    ovs_mutex_unlock(&dev->mutex);
+
+    return 0;
+}
+
+static int
 netdev_dpdk_get_carrier(const struct netdev *netdev, bool *carrier);
 
 static int
@@ -2803,7 +2882,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
     ovs_mutex_lock(&dev->mutex);
 
     if (netdev->n_txq == dev->requested_n_txq
-        && netdev->n_rxq == dev->requested_n_rxq) {
+        && netdev->n_rxq == dev->requested_n_rxq
+        && dev->mtu == dev->requested_mtu) {
         /* Reconfiguration is unnecessary */
 
         goto out;
@@ -2811,6 +2891,19 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
 
     rte_eth_dev_stop(dev->port_id);
 
+    if (dev->mtu != dev->requested_mtu) {
+        int temp = dev->last_mtu;
+        dev->last_mtu = dev->mtu;
+        dev->mtu = dev->requested_mtu;
+        err = dpdk_mp_configure(dev);
+        if (err) {
+            /* Revert to previous configuration */
+            dev->mtu = dev->last_mtu;
+            dev->last_mtu = temp;
+            goto out;
+        }
+    }
+
     netdev->n_txq = dev->requested_n_txq;
     netdev->n_rxq = dev->requested_n_rxq;
 
@@ -2818,12 +2911,14 @@ netdev_dpdk_reconfigure(struct netdev *netdev)
     err = dpdk_eth_dev_init(dev);
     netdev_dpdk_alloc_txq(dev, netdev->n_txq);
 
+    netdev_change_seq_changed(netdev);
+
 out:
 
     ovs_mutex_unlock(&dev->mutex);
     ovs_mutex_unlock(&dpdk_mutex);
 
-    return err;
+    return 0;
 }
 
 static int
@@ -2845,30 +2940,38 @@ netdev_dpdk_vhost_user_reconfigure(struct netdev *netdev)
 
     netdev_dpdk_remap_txqs(dev);
 
-    if (dev->requested_socket_id != dev->socket_id) {
+    if (dev->requested_socket_id != dev->socket_id
+        || dev->requested_mtu != dev->mtu) {
+        int temp = dev->last_mtu;
         dev->socket_id = dev->requested_socket_id;
-        /* Change mempool to new NUMA Node */
-        dpdk_mp_put(dev->dpdk_mp);
-        dev->dpdk_mp = dpdk_mp_get(dev->socket_id, dev->mtu);
-        if (!dev->dpdk_mp) {
-            err = ENOMEM;
+        dev->last_mtu = dev->mtu;
+        dev->mtu = dev->requested_mtu;
+        /* Change mempool to new NUMA Node and to new MTU. */
+        err = dpdk_mp_configure(dev);
+        if (err) {
+            dev->mtu = dev->last_mtu;
+            dev->last_mtu = temp;
+            goto out;
         }
+        netdev_change_seq_changed(netdev);
     }
 
     if (netdev_dpdk_get_vid(dev) >= 0) {
         dev->vhost_reconfigured = true;
     }
 
+out:
     ovs_mutex_unlock(&dev->mutex);
     ovs_mutex_unlock(&dpdk_mutex);
 
-    return err;
+    return 0;
 }
 
 static int
 netdev_dpdk_vhost_cuse_reconfigure(struct netdev *netdev)
 {
     struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+    int err = 0;
 
     ovs_mutex_lock(&dpdk_mutex);
     ovs_mutex_lock(&dev->mutex);
@@ -2876,6 +2979,20 @@ netdev_dpdk_vhost_cuse_reconfigure(struct netdev *netdev)
     netdev->n_txq = dev->requested_n_txq;
     netdev->n_rxq = 1;
 
+    if (dev->requested_mtu != dev->mtu) {
+        /* Change mempool to new MTU. */
+        int temp = dev->last_mtu;
+        dev->last_mtu = dev->mtu;
+        dev->mtu = dev->requested_mtu;
+        err = dpdk_mp_configure(dev);
+        if (err) {
+           dev->mtu = dev->last_mtu;
+           dev->last_mtu = temp;
+        } else {
+            netdev_change_seq_changed(netdev);
+        }
+    }
+
     ovs_mutex_unlock(&dev->mutex);
     ovs_mutex_unlock(&dpdk_mutex);
 
@@ -2913,7 +3030,7 @@ netdev_dpdk_vhost_cuse_reconfigure(struct netdev *netdev)
     netdev_dpdk_set_etheraddr,                                \
     netdev_dpdk_get_etheraddr,                                \
     netdev_dpdk_get_mtu,                                      \
-    NULL,                       /* set_mtu */                 \
+    netdev_dpdk_set_mtu,                                      \
     netdev_dpdk_get_ifindex,                                  \
     GET_CARRIER,                                              \
     netdev_dpdk_get_carrier_resets,                           \
-- 
1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports.
  2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
                   ` (5 preceding siblings ...)
  2016-08-05 14:30 ` [dpdk-dev] [PATCH 7/7] netdev-dpdk: add support for Jumbo Frames Mark Kavanagh
@ 2016-08-05 14:41 ` Kavanagh, Mark B
  6 siblings, 0 replies; 8+ messages in thread
From: Kavanagh, Mark B @ 2016-08-05 14:41 UTC (permalink / raw)
  To: dev; +Cc: 'Ilya Maximets', 'Daniele Di Proietto'

Please disregard this patchset - it was sent erroneously to the incorrect mailing list.

I've already removed the related patches from Patchwork.

Cheers,
Mark 

>-----Original Message-----
>From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Mark Kavanagh
>Sent: Friday, August 5, 2016 3:30 PM
>To: dev@dpdk.org; diproiettod@vmware.com
>Cc: i.maximets@samsung.com
>Subject: [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal
>ports.
>
>From: Daniele Di Proietto <diproiettod@vmware.com>
>
>Interfaces with type "internal" end up having a netdev with type "tap"
>in the dpif-netdev datapath, so a strcmp will fail to match internal
>interfaces.
>
>We can translate the types with ofproto_port_open_type() before calling
>strcmp to fix this.
>
>This fixes a minor issue where internal interfaces are considered
>non-internal in the userspace datapath for the purpose of adjusting the
>MTU.
>
>Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
>---
> ofproto/ofproto.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
>diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
>index 8e59c69..088f91a 100644
>--- a/ofproto/ofproto.c
>+++ b/ofproto/ofproto.c
>@@ -220,7 +220,8 @@ static void learned_cookies_flush(struct ofproto *, struct ovs_list
>*dead_cookie
> /* ofport. */
> static void ofport_destroy__(struct ofport *) OVS_EXCLUDED(ofproto_mutex);
> static void ofport_destroy(struct ofport *, bool del);
>-static inline bool ofport_is_internal(const struct ofport *);
>+static inline bool ofport_is_internal(const struct ofproto *,
>+                                      const struct ofport *);
>
> static int update_port(struct ofproto *, const char *devname);
> static int init_ports(struct ofproto *);
>@@ -2465,7 +2466,7 @@ static void
> ofport_remove(struct ofport *ofport)
> {
>     struct ofproto *p = ofport->ofproto;
>-    bool is_internal = ofport_is_internal(ofport);
>+    bool is_internal = ofport_is_internal(p, ofport);
>
>     connmgr_send_port_status(ofport->ofproto->connmgr, NULL, &ofport->pp,
>                              OFPPR_DELETE);
>@@ -2751,9 +2752,10 @@ init_ports(struct ofproto *p)
> }
>
> static inline bool
>-ofport_is_internal(const struct ofport *port)
>+ofport_is_internal(const struct ofproto *p, const struct ofport *port)
> {
>-    return !strcmp(netdev_get_type(port->netdev), "internal");
>+    return !strcmp(netdev_get_type(port->netdev),
>+                   ofproto_port_open_type(p->type, "internal"));
> }
>
> /* Find the minimum MTU of all non-datapath devices attached to 'p'.
>@@ -2770,7 +2772,7 @@ find_min_mtu(struct ofproto *p)
>
>         /* Skip any internal ports, since that's what we're trying to
>          * set. */
>-        if (ofport_is_internal(ofport)) {
>+        if (ofport_is_internal(p, ofport)) {
>             continue;
>         }
>
>@@ -2797,7 +2799,7 @@ update_mtu(struct ofproto *p, struct ofport *port)
>         port->mtu = 0;
>         return;
>     }
>-    if (ofport_is_internal(port)) {
>+    if (ofport_is_internal(p, port)) {
>         if (dev_mtu > p->min_mtu) {
>            if (!netdev_set_mtu(port->netdev, p->min_mtu)) {
>                dev_mtu = p->min_mtu;
>@@ -2827,7 +2829,7 @@ update_mtu_ofproto(struct ofproto *p)
>     HMAP_FOR_EACH (ofport, hmap_node, &p->ports) {
>         struct netdev *netdev = ofport->netdev;
>
>-        if (ofport_is_internal(ofport)) {
>+        if (ofport_is_internal(p, ofport)) {
>             if (!netdev_set_mtu(netdev, p->min_mtu)) {
>                 ofport->mtu = p->min_mtu;
>             }
>--
>1.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-08-05 14:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05 14:30 [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Mark Kavanagh
2016-08-05 14:30 ` [dpdk-dev] [PATCH 2/7] vswitchd: Introduce 'mtu_request' column in Interface Mark Kavanagh
2016-08-05 14:30 ` [dpdk-dev] [PATCH 3/7] netdev: Pass 'netdev_class' to ->run() and ->wait() Mark Kavanagh
2016-08-05 14:30 ` [dpdk-dev] [PATCH 4/7] netdev-dummy: Add dummy-internal class Mark Kavanagh
2016-08-05 14:30 ` [dpdk-dev] [PATCH 5/7] tests: Add a new MTU test Mark Kavanagh
2016-08-05 14:30 ` [dpdk-dev] [PATCH 6/7] netdev: Make netdev_set_mtu() netdev parameter non-const Mark Kavanagh
2016-08-05 14:30 ` [dpdk-dev] [PATCH 7/7] netdev-dpdk: add support for Jumbo Frames Mark Kavanagh
2016-08-05 14:41 ` [dpdk-dev] [PATCH 1/7] ofproto: Consider datapath_type when looking for internal ports Kavanagh, Mark B

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).