netdev: New function netdev_get_dpif_port().
[sliver-openvswitch.git] / lib / dpif-linux.c
index cde1167..3dc94c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -426,7 +426,7 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
                     uint32_t *port_nop)
 {
     struct dpif_linux *dpif = dpif_linux_cast(dpif_);
-    const char *name = netdev_get_name(netdev);
+    const char *name = netdev_vport_get_dpif_port(netdev);
     const char *type = netdev_get_type(netdev);
     struct dpif_linux_vport request, reply;
     const struct ofpbuf *options;
@@ -474,9 +474,11 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
         *port_nop = reply.port_no;
         VLOG_DBG("%s: assigning port %"PRIu32" to netlink pid %"PRIu32,
                  dpif_name(dpif_), reply.port_no, upcall_pid);
-    } else if (error == EBUSY && *port_nop != UINT32_MAX) {
-        VLOG_INFO("%s: requested port %"PRIu32" is in use",
-                  dpif_name(dpif_), *port_nop);
+    } else {
+        if (error == EBUSY && *port_nop != UINT32_MAX) {
+            VLOG_INFO("%s: requested port %"PRIu32" is in use",
+                      dpif_name(dpif_), *port_nop);
+        }
         nl_sock_destroy(sock);
         ofpbuf_delete(buf);
         return error;
@@ -1463,10 +1465,6 @@ dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport,
         [OVS_VPORT_ATTR_UPCALL_PID] = { .type = NL_A_U32 },
         [OVS_VPORT_ATTR_STATS] = { NL_POLICY_FOR(struct ovs_vport_stats),
                                    .optional = true },
-        [OVS_VPORT_ATTR_ADDRESS] = { .type = NL_A_UNSPEC,
-                                     .min_len = ETH_ADDR_LEN,
-                                     .max_len = ETH_ADDR_LEN,
-                                     .optional = true },
         [OVS_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true },
     };
 
@@ -1500,9 +1498,6 @@ dpif_linux_vport_from_ofpbuf(struct dpif_linux_vport *vport,
     if (a[OVS_VPORT_ATTR_STATS]) {
         vport->stats = nl_attr_get(a[OVS_VPORT_ATTR_STATS]);
     }
-    if (a[OVS_VPORT_ATTR_ADDRESS]) {
-        vport->address = nl_attr_get(a[OVS_VPORT_ATTR_ADDRESS]);
-    }
     if (a[OVS_VPORT_ATTR_OPTIONS]) {
         vport->options = nl_attr_get(a[OVS_VPORT_ATTR_OPTIONS]);
         vport->options_len = nl_attr_get_size(a[OVS_VPORT_ATTR_OPTIONS]);
@@ -1545,11 +1540,6 @@ dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *vport,
                           vport->stats, sizeof *vport->stats);
     }
 
-    if (vport->address) {
-        nl_msg_put_unspec(buf, OVS_VPORT_ATTR_ADDRESS,
-                          vport->address, ETH_ADDR_LEN);
-    }
-
     if (vport->options) {
         nl_msg_put_nested(buf, OVS_VPORT_ATTR_OPTIONS,
                           vport->options, vport->options_len);
@@ -1927,7 +1917,7 @@ report_loss(struct dpif *dpif_, struct dpif_channel *ch)
     static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
     struct ds s;
 
-    if (VLOG_DROP_ERR(&rl)) {
+    if (VLOG_DROP_WARN(&rl)) {
         return;
     }