[ovs-dev] [Single DP 03/15] Always treat datapath ports as 32 bits.

Justin Pettit jpettit at nicira.com
Thu Oct 18 19:51:48 UTC 2012


Most of the code referred to datapath ports as 32-bit values, but a few
places still used 16-bit references.

Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 lib/dpif-linux.c             |   22 +++++++++++-----------
 lib/dpif-netdev.c            |   24 ++++++++++++------------
 lib/dpif-provider.h          |   12 ++++++------
 lib/dpif.c                   |   30 +++++++++++++++---------------
 lib/dpif.h                   |   10 +++++-----
 lib/odp-util.h               |    6 +++---
 ofproto/ofproto-dpif-sflow.c |    8 ++++----
 ofproto/ofproto-dpif-sflow.h |    4 ++--
 ofproto/ofproto-dpif.c       |   10 +++++-----
 utilities/ovs-dpctl.c        |    6 +++---
 10 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 3a4a4e6..f043f8a 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -200,7 +200,7 @@ struct dpif_linux {
     bool change_error;
 
     /* Port number allocation. */
-    uint16_t alloc_port_no;
+    uint32_t alloc_port_no;
 };
 
 static struct vlog_rate_limit error_rl = VLOG_RATE_LIMIT_INIT(9999, 5);
@@ -219,7 +219,7 @@ static int dpif_linux_init(void);
 static void open_dpif(const struct dpif_linux_dp *, struct dpif **);
 static bool dpif_linux_nln_parse(struct ofpbuf *, void *);
 static void dpif_linux_port_changed(const void *vport, void *dpif);
-static uint32_t dpif_linux_port_get_pid(const struct dpif *, uint16_t port_no);
+static uint32_t dpif_linux_port_get_pid(const struct dpif *, uint32_t port_no);
 
 static void dpif_linux_vport_to_ofpbuf(const struct dpif_linux_vport *,
                                        struct ofpbuf *);
@@ -392,7 +392,7 @@ dpif_linux_get_stats(const struct dpif *dpif_, struct dpif_dp_stats *stats)
 
 static int
 dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
-                    uint16_t *port_nop)
+                    uint32_t *port_nop)
 {
     struct dpif_linux *dpif = dpif_linux_cast(dpif_);
     const char *name = netdev_get_name(netdev);
@@ -429,7 +429,7 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
     do {
         uint32_t upcall_pid;
 
-        request.port_no = *port_nop != UINT16_MAX ? *port_nop
+        request.port_no = *port_nop != UINT32_MAX ? *port_nop
                           : ++dpif->alloc_port_no;
         upcall_pid = dpif_linux_port_get_pid(dpif_, request.port_no);
         request.upcall_pid = &upcall_pid;
@@ -443,20 +443,20 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
             /* Older datapath has lower limit. */
             max_ports = dpif->alloc_port_no;
             dpif->alloc_port_no = 0;
-        } else if (error == EBUSY && *port_nop != UINT16_MAX) {
-            VLOG_INFO("%s: requested port %"PRIu16" is in use",
+        } else if (error == EBUSY && *port_nop != UINT32_MAX) {
+            VLOG_INFO("%s: requested port %"PRIu32" is in use",
                      dpif_name(dpif_), *port_nop);
         }
 
         ofpbuf_delete(buf);
-    } while ((*port_nop == UINT16_MAX) && (i++ < max_ports)
+    } while ((*port_nop == UINT32_MAX) && (i++ < max_ports)
              && (error == EBUSY || error == EFBIG));
 
     return error;
 }
 
 static int
-dpif_linux_port_del(struct dpif *dpif_, uint16_t port_no)
+dpif_linux_port_del(struct dpif *dpif_, uint32_t port_no)
 {
     struct dpif_linux *dpif = dpif_linux_cast(dpif_);
     struct dpif_linux_vport vport;
@@ -503,7 +503,7 @@ dpif_linux_port_query__(const struct dpif *dpif, uint32_t port_no,
 }
 
 static int
-dpif_linux_port_query_by_number(const struct dpif *dpif, uint16_t port_no,
+dpif_linux_port_query_by_number(const struct dpif *dpif, uint32_t port_no,
                                 struct dpif_port *dpif_port)
 {
     return dpif_linux_port_query__(dpif, port_no, NULL, dpif_port);
@@ -523,7 +523,7 @@ dpif_linux_get_max_ports(const struct dpif *dpif OVS_UNUSED)
 }
 
 static uint32_t
-dpif_linux_port_get_pid(const struct dpif *dpif_, uint16_t port_no)
+dpif_linux_port_get_pid(const struct dpif *dpif_, uint32_t port_no)
 {
     struct dpif_linux *dpif = dpif_linux_cast(dpif_);
 
@@ -532,7 +532,7 @@ dpif_linux_port_get_pid(const struct dpif *dpif_, uint16_t port_no)
     } else {
         int idx;
 
-        idx = (port_no != UINT16_MAX
+        idx = (port_no != UINT32_MAX
                ? 1 + (port_no & (N_CHANNELS - 2))
                : 0);
         return nl_sock_pid(dpif->channels[idx].sock);
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c9e3210..0ac7da7 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -138,15 +138,15 @@ static struct shash dp_netdevs = SHASH_INITIALIZER(&dp_netdevs);
 /* Maximum port MTU seen so far. */
 static int max_mtu = ETH_PAYLOAD_MAX;
 
-static int get_port_by_number(struct dp_netdev *, uint16_t port_no,
+static int get_port_by_number(struct dp_netdev *, uint32_t port_no,
                               struct dp_netdev_port **portp);
 static int get_port_by_name(struct dp_netdev *, const char *devname,
                             struct dp_netdev_port **portp);
 static void dp_netdev_free(struct dp_netdev *);
 static void dp_netdev_flow_flush(struct dp_netdev *);
 static int do_add_port(struct dp_netdev *, const char *devname,
-                       const char *type, uint16_t port_no);
-static int do_del_port(struct dp_netdev *, uint16_t port_no);
+                       const char *type, uint32_t port_no);
+static int do_del_port(struct dp_netdev *, uint32_t port_no);
 static int dpif_netdev_open(const struct dpif_class *, const char *name,
                             bool create, struct dpif **);
 static int dp_netdev_output_userspace(struct dp_netdev *, const struct ofpbuf *,
@@ -318,7 +318,7 @@ dpif_netdev_get_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
 
 static int
 do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
-            uint16_t port_no)
+            uint32_t port_no)
 {
     struct dp_netdev_port *port;
     struct netdev *netdev;
@@ -405,12 +405,12 @@ choose_port(struct dpif *dpif, struct netdev *netdev)
 
 static int
 dpif_netdev_port_add(struct dpif *dpif, struct netdev *netdev,
-                     uint16_t *port_nop)
+                     uint32_t *port_nop)
 {
     struct dp_netdev *dp = get_dp_netdev(dpif);
     int port_no;
 
-    if (*port_nop != UINT16_MAX) {
+    if (*port_nop != UINT32_MAX) {
         if (*port_nop >= MAX_PORTS) {
             return EFBIG;
         } else if (dp->ports[*port_nop]) {
@@ -429,21 +429,21 @@ dpif_netdev_port_add(struct dpif *dpif, struct netdev *netdev,
 }
 
 static int
-dpif_netdev_port_del(struct dpif *dpif, uint16_t port_no)
+dpif_netdev_port_del(struct dpif *dpif, uint32_t port_no)
 {
     struct dp_netdev *dp = get_dp_netdev(dpif);
     return port_no == OVSP_LOCAL ? EINVAL : do_del_port(dp, port_no);
 }
 
 static bool
-is_valid_port_number(uint16_t port_no)
+is_valid_port_number(uint32_t port_no)
 {
     return port_no < MAX_PORTS;
 }
 
 static int
 get_port_by_number(struct dp_netdev *dp,
-                   uint16_t port_no, struct dp_netdev_port **portp)
+                   uint32_t port_no, struct dp_netdev_port **portp)
 {
     if (!is_valid_port_number(port_no)) {
         *portp = NULL;
@@ -470,7 +470,7 @@ get_port_by_name(struct dp_netdev *dp,
 }
 
 static int
-do_del_port(struct dp_netdev *dp, uint16_t port_no)
+do_del_port(struct dp_netdev *dp, uint32_t port_no)
 {
     struct dp_netdev_port *port;
     char *name;
@@ -505,7 +505,7 @@ answer_port_query(const struct dp_netdev_port *port,
 }
 
 static int
-dpif_netdev_port_query_by_number(const struct dpif *dpif, uint16_t port_no,
+dpif_netdev_port_query_by_number(const struct dpif *dpif, uint32_t port_no,
                                  struct dpif_port *dpif_port)
 {
     struct dp_netdev *dp = get_dp_netdev(dpif);
@@ -1077,7 +1077,7 @@ dp_netdev_set_dl(struct ofpbuf *packet, const struct ovs_key_ethernet *eth_key)
 
 static void
 dp_netdev_output_port(struct dp_netdev *dp, struct ofpbuf *packet,
-                      uint16_t out_port)
+                      uint32_t out_port)
 {
     struct dp_netdev_port *p = dp->ports[out_port];
     if (p) {
diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h
index ffe084a..c51b1df 100644
--- a/lib/dpif-provider.h
+++ b/lib/dpif-provider.h
@@ -111,23 +111,23 @@ struct dpif_class {
     int (*get_stats)(const struct dpif *dpif, struct dpif_dp_stats *stats);
 
     /* Adds 'netdev' as a new port in 'dpif'.  If '*port_no' is not
-     * UINT16_MAX, attempts to use that as the port's port number.
+     * UINT32_MAX, attempts to use that as the port's port number.
      *
      * If port is successfully added, sets '*port_no' to the new port's
      * port number.  Returns EBUSY if caller attempted to choose a port
      * number, and it was in use. */
     int (*port_add)(struct dpif *dpif, struct netdev *netdev,
-                    uint16_t *port_no);
+                    uint32_t *port_no);
 
     /* Removes port numbered 'port_no' from 'dpif'. */
-    int (*port_del)(struct dpif *dpif, uint16_t port_no);
+    int (*port_del)(struct dpif *dpif, uint32_t port_no);
 
     /* Queries 'dpif' for a port with the given 'port_no' or 'devname'.  Stores
      * information about the port into '*port' if successful.
      *
      * The caller takes ownership of data in 'port' and must free it with
      * dpif_port_destroy() when it is no longer needed. */
-    int (*port_query_by_number)(const struct dpif *dpif, uint16_t port_no,
+    int (*port_query_by_number)(const struct dpif *dpif, uint32_t port_no,
                                 struct dpif_port *port);
     int (*port_query_by_name)(const struct dpif *dpif, const char *devname,
                               struct dpif_port *port);
@@ -140,7 +140,7 @@ struct dpif_class {
      * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in
      * flows whose packets arrived on port 'port_no'.
      *
-     * A 'port_no' of UINT16_MAX should be treated as a special case.  The
+     * A 'port_no' of UINT32_MAX should be treated as a special case.  The
      * implementation should return a reserved PID, not allocated to any port,
      * that the client may use for special purposes.
      *
@@ -150,7 +150,7 @@ struct dpif_class {
      *
      * A dpif provider that doesn't have meaningful Netlink PIDs can use NULL
      * for this function.  This is equivalent to always returning 0. */
-    uint32_t (*port_get_pid)(const struct dpif *dpif, uint16_t port_no);
+    uint32_t (*port_get_pid)(const struct dpif *dpif, uint32_t port_no);
 
     /* Attempts to begin dumping the ports in a dpif.  On success, returns 0
      * and initializes '*statep' with any data needed for iteration.  On
diff --git a/lib/dpif.c b/lib/dpif.c
index fa9b30a..d8ca061 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -411,18 +411,18 @@ dpif_get_dp_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
 }
 
 /* Attempts to add 'netdev' as a port on 'dpif'.  If 'port_nop' is
- * non-null and its value is not UINT16_MAX, then attempts to use the
+ * non-null and its value is not UINT32_MAX, then attempts to use the
  * value as the port number.
  *
  * If successful, returns 0 and sets '*port_nop' to the new port's port
  * number (if 'port_nop' is non-null).  On failure, returns a positive
- * errno value and sets '*port_nop' to UINT16_MAX (if 'port_nop' is
+ * errno value and sets '*port_nop' to UINT32_MAX (if 'port_nop' is
  * non-null). */
 int
-dpif_port_add(struct dpif *dpif, struct netdev *netdev, uint16_t *port_nop)
+dpif_port_add(struct dpif *dpif, struct netdev *netdev, uint32_t *port_nop)
 {
     const char *netdev_name = netdev_get_name(netdev);
-    uint16_t port_no = UINT16_MAX;
+    uint32_t port_no = UINT32_MAX;
     int error;
 
     COVERAGE_INC(dpif_port_add);
@@ -433,12 +433,12 @@ dpif_port_add(struct dpif *dpif, struct netdev *netdev, uint16_t *port_nop)
 
     error = dpif->dpif_class->port_add(dpif, netdev, &port_no);
     if (!error) {
-        VLOG_DBG_RL(&dpmsg_rl, "%s: added %s as port %"PRIu16,
+        VLOG_DBG_RL(&dpmsg_rl, "%s: added %s as port %"PRIu32,
                     dpif_name(dpif), netdev_name, port_no);
     } else {
         VLOG_WARN_RL(&error_rl, "%s: failed to add %s as port: %s",
                      dpif_name(dpif), netdev_name, strerror(error));
-        port_no = UINT16_MAX;
+        port_no = UINT32_MAX;
     }
     if (port_nop) {
         *port_nop = port_no;
@@ -449,7 +449,7 @@ dpif_port_add(struct dpif *dpif, struct netdev *netdev, uint16_t *port_nop)
 /* Attempts to remove 'dpif''s port number 'port_no'.  Returns 0 if successful,
  * otherwise a positive errno value. */
 int
-dpif_port_del(struct dpif *dpif, uint16_t port_no)
+dpif_port_del(struct dpif *dpif, uint32_t port_no)
 {
     int error;
 
@@ -457,7 +457,7 @@ dpif_port_del(struct dpif *dpif, uint16_t port_no)
 
     error = dpif->dpif_class->port_del(dpif, port_no);
     if (!error) {
-        VLOG_DBG_RL(&dpmsg_rl, "%s: port_del(%"PRIu16")",
+        VLOG_DBG_RL(&dpmsg_rl, "%s: port_del(%"PRIu32")",
                     dpif_name(dpif), port_no);
     } else {
         log_operation(dpif, "port_del", error);
@@ -493,16 +493,16 @@ dpif_port_destroy(struct dpif_port *dpif_port)
  * The caller owns the data in 'port' and must free it with
  * dpif_port_destroy() when it is no longer needed. */
 int
-dpif_port_query_by_number(const struct dpif *dpif, uint16_t port_no,
+dpif_port_query_by_number(const struct dpif *dpif, uint32_t port_no,
                           struct dpif_port *port)
 {
     int error = dpif->dpif_class->port_query_by_number(dpif, port_no, port);
     if (!error) {
-        VLOG_DBG_RL(&dpmsg_rl, "%s: port %"PRIu16" is device %s",
+        VLOG_DBG_RL(&dpmsg_rl, "%s: port %"PRIu32" is device %s",
                     dpif_name(dpif), port_no, port->name);
     } else {
         memset(port, 0, sizeof *port);
-        VLOG_WARN_RL(&error_rl, "%s: failed to query port %"PRIu16": %s",
+        VLOG_WARN_RL(&error_rl, "%s: failed to query port %"PRIu32": %s",
                      dpif_name(dpif), port_no, strerror(error));
     }
     return error;
@@ -520,7 +520,7 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname,
 {
     int error = dpif->dpif_class->port_query_by_name(dpif, devname, port);
     if (!error) {
-        VLOG_DBG_RL(&dpmsg_rl, "%s: device %s is on port %"PRIu16,
+        VLOG_DBG_RL(&dpmsg_rl, "%s: device %s is on port %"PRIu32,
                     dpif_name(dpif), devname, port->port_no);
     } else {
         memset(port, 0, sizeof *port);
@@ -549,7 +549,7 @@ dpif_get_max_ports(const struct dpif *dpif)
  * as the OVS_USERSPACE_ATTR_PID attribute's value, for use in flows whose
  * packets arrived on port 'port_no'.
  *
- * A 'port_no' of UINT16_MAX is a special case: it returns a reserved PID, not
+ * A 'port_no' of UINT32_MAX is a special case: it returns a reserved PID, not
  * allocated to any port, that the client may use for special purposes.
  *
  * The return value is only meaningful when DPIF_UC_ACTION has been enabled in
@@ -558,7 +558,7 @@ dpif_get_max_ports(const struct dpif *dpif)
  * update all of the flows that it installed that contain
  * OVS_ACTION_ATTR_USERSPACE actions. */
 uint32_t
-dpif_port_get_pid(const struct dpif *dpif, uint16_t port_no)
+dpif_port_get_pid(const struct dpif *dpif, uint32_t port_no)
 {
     return (dpif->dpif_class->port_get_pid
             ? (dpif->dpif_class->port_get_pid)(dpif, port_no)
@@ -570,7 +570,7 @@ dpif_port_get_pid(const struct dpif *dpif, uint16_t port_no)
  * result is null-terminated.  On failure, returns a positive errno value and
  * makes 'name' the empty string. */
 int
-dpif_port_get_name(struct dpif *dpif, uint16_t port_no,
+dpif_port_get_name(struct dpif *dpif, uint32_t port_no,
                    char *name, size_t name_size)
 {
     struct dpif_port port;
diff --git a/lib/dpif.h b/lib/dpif.h
index d6d1694..db08d78 100644
--- a/lib/dpif.h
+++ b/lib/dpif.h
@@ -72,8 +72,8 @@ int dpif_get_dp_stats(const struct dpif *, struct dpif_dp_stats *);
 
 /* Port operations. */
 
-int dpif_port_add(struct dpif *, struct netdev *, uint16_t *port_nop);
-int dpif_port_del(struct dpif *, uint16_t port_no);
+int dpif_port_add(struct dpif *, struct netdev *, uint32_t *port_nop);
+int dpif_port_del(struct dpif *, uint32_t port_no);
 
 /* A port within a datapath.
  *
@@ -85,14 +85,14 @@ struct dpif_port {
 };
 void dpif_port_clone(struct dpif_port *, const struct dpif_port *);
 void dpif_port_destroy(struct dpif_port *);
-int dpif_port_query_by_number(const struct dpif *, uint16_t port_no,
+int dpif_port_query_by_number(const struct dpif *, uint32_t port_no,
                               struct dpif_port *);
 int dpif_port_query_by_name(const struct dpif *, const char *devname,
                             struct dpif_port *);
-int dpif_port_get_name(struct dpif *, uint16_t port_no,
+int dpif_port_get_name(struct dpif *, uint32_t port_no,
                        char *name, size_t name_size);
 int dpif_get_max_ports(const struct dpif *);
-uint32_t dpif_port_get_pid(const struct dpif *, uint16_t port_no);
+uint32_t dpif_port_get_pid(const struct dpif *, uint32_t port_no);
 
 struct dpif_port_dump {
     const struct dpif *dpif;
diff --git a/lib/odp-util.h b/lib/odp-util.h
index 16f2b15..3ec8029 100644
--- a/lib/odp-util.h
+++ b/lib/odp-util.h
@@ -32,9 +32,9 @@ struct nlattr;
 struct ofpbuf;
 struct simap;
 
-#define OVSP_NONE UINT16_MAX
+#define OVSP_NONE UINT32_MAX
 
-static inline uint16_t
+static inline uint32_t
 ofp_port_to_odp_port(uint16_t ofp_port)
 {
     switch (ofp_port) {
@@ -48,7 +48,7 @@ ofp_port_to_odp_port(uint16_t ofp_port)
 }
 
 static inline uint16_t
-odp_port_to_ofp_port(uint16_t odp_port)
+odp_port_to_ofp_port(uint32_t odp_port)
 {
     switch (odp_port) {
     case OVSP_LOCAL:
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 23f5498..999e55b 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -142,7 +142,7 @@ sflow_agent_send_packet_cb(void *ds_, SFLAgent *agent OVS_UNUSED,
 }
 
 static struct dpif_sflow_port *
-dpif_sflow_find_port(const struct dpif_sflow *ds, uint16_t odp_port)
+dpif_sflow_find_port(const struct dpif_sflow *ds, uint32_t odp_port)
 {
     struct dpif_sflow_port *dsp;
 
@@ -356,7 +356,7 @@ void
 dpif_sflow_add_port(struct dpif_sflow *ds, struct ofport *ofport)
 {
     struct dpif_sflow_port *dsp;
-    uint16_t odp_port = ofp_port_to_odp_port(ofport->ofp_port);
+    uint32_t odp_port = ofp_port_to_odp_port(ofport->ofp_port);
     uint32_t ifindex;
 
     dpif_sflow_del_port(ds, odp_port);
@@ -390,7 +390,7 @@ dpif_sflow_del_port__(struct dpif_sflow *ds, struct dpif_sflow_port *dsp)
 }
 
 void
-dpif_sflow_del_port(struct dpif_sflow *ds, uint16_t odp_port)
+dpif_sflow_del_port(struct dpif_sflow *ds, uint32_t odp_port)
 {
     struct dpif_sflow_port *dsp = dpif_sflow_find_port(ds, odp_port);
     if (dsp) {
@@ -483,7 +483,7 @@ dpif_sflow_set_options(struct dpif_sflow *ds,
 
 int
 dpif_sflow_odp_port_to_ifindex(const struct dpif_sflow *ds,
-                               uint16_t odp_port)
+                               uint32_t odp_port)
 {
     struct dpif_sflow_port *dsp = dpif_sflow_find_port(ds, odp_port);
     return dsp ? SFL_DS_INDEX(dsp->dsi) : 0;
diff --git a/ofproto/ofproto-dpif-sflow.h b/ofproto/ofproto-dpif-sflow.h
index 6af8dc0..3555bc5 100644
--- a/ofproto/ofproto-dpif-sflow.h
+++ b/ofproto/ofproto-dpif-sflow.h
@@ -38,7 +38,7 @@ void dpif_sflow_clear(struct dpif_sflow *);
 bool dpif_sflow_is_enabled(const struct dpif_sflow *);
 
 void dpif_sflow_add_port(struct dpif_sflow *ds, struct ofport *ofport);
-void dpif_sflow_del_port(struct dpif_sflow *, uint16_t ovs_port);
+void dpif_sflow_del_port(struct dpif_sflow *, uint32_t odp_port);
 
 void dpif_sflow_run(struct dpif_sflow *);
 void dpif_sflow_wait(struct dpif_sflow *);
@@ -48,6 +48,6 @@ void dpif_sflow_received(struct dpif_sflow *,
                          const struct flow *,
                          const union user_action_cookie *);
 
-int dpif_sflow_odp_port_to_ifindex(const struct dpif_sflow *, uint16_t);
+int dpif_sflow_odp_port_to_ifindex(const struct dpif_sflow *, uint32_t);
 
 #endif /* ofproto/ofproto-dpif-sflow.h */
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 0c954df..1abc34e 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -277,7 +277,7 @@ struct action_xlate_ctx {
     uint32_t orig_skb_priority; /* Priority when packet arrived. */
     uint8_t table_id;           /* OpenFlow table ID where flow was found. */
     uint32_t sflow_n_outputs;   /* Number of output ports. */
-    uint16_t sflow_odp_port;    /* Output port for composing sFlow action. */
+    uint32_t sflow_odp_port;    /* Output port for composing sFlow action. */
     uint16_t user_cookie_offset;/* Used for user_action_cookie fixup. */
     bool exit;                  /* No further actions should be processed. */
     struct flow orig_flow;      /* Copy of original flow. */
@@ -2531,7 +2531,7 @@ static int
 port_add(struct ofproto *ofproto_, struct netdev *netdev, uint16_t *ofp_portp)
 {
     struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
-    uint16_t odp_port = UINT16_MAX;
+    uint32_t odp_port = UINT32_MAX;
     int error;
 
     error = dpif_port_add(ofproto->dpif, netdev, &odp_port);
@@ -4760,7 +4760,7 @@ send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet)
     const struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto);
     struct ofpbuf key, odp_actions;
     struct odputil_keybuf keybuf;
-    uint16_t odp_port;
+    uint32_t odp_port;
     struct flow flow;
     int error;
 
@@ -4950,7 +4950,7 @@ compose_output_action__(struct action_xlate_ctx *ctx, uint16_t ofp_port,
                         bool check_stp)
 {
     const struct ofport_dpif *ofport = get_ofp_port(ctx->ofproto, ofp_port);
-    uint16_t odp_port = ofp_port_to_odp_port(ofp_port);
+    uint32_t odp_port = ofp_port_to_odp_port(ofp_port);
     ovs_be16 flow_vlan_tci = ctx->flow.vlan_tci;
     uint8_t flow_nw_tos = ctx->flow.nw_tos;
     uint16_t out_port;
@@ -6783,7 +6783,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[],
         const char *tun_id_s = argv[3];
         const char *in_port_s = argv[4];
         const char *packet_s = argv[5];
-        uint16_t in_port = ofp_port_to_odp_port(atoi(in_port_s));
+        uint32_t in_port = ofp_port_to_odp_port(atoi(in_port_s));
         ovs_be64 tun_id = htonll(strtoull(tun_id_s, NULL, 0));
         uint32_t priority = atoi(priority_s);
         const char *msg;
diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c
index 6224237..52441b9 100644
--- a/utilities/ovs-dpctl.c
+++ b/utilities/ovs-dpctl.c
@@ -248,7 +248,7 @@ dpctl_add_if(int argc OVS_UNUSED, char *argv[])
         char *save_ptr = NULL;
         struct netdev *netdev = NULL;
         struct smap args;
-        uint16_t port_no = UINT16_MAX;
+        uint32_t port_no = UINT32_MAX;
         char *option;
         int error;
 
@@ -416,7 +416,7 @@ next:
 }
 
 static bool
-get_port_number(struct dpif *dpif, const char *name, uint16_t *port)
+get_port_number(struct dpif *dpif, const char *name, uint32_t *port)
 {
     struct dpif_port dpif_port;
 
@@ -440,7 +440,7 @@ dpctl_del_if(int argc OVS_UNUSED, char *argv[])
     run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
     for (i = 2; i < argc; i++) {
         const char *name = argv[i];
-        uint16_t port;
+        uint32_t port;
         int error;
 
         if (!name[strspn(name, "0123456789")]) {
-- 
1.7.5.4




More information about the dev mailing list