From 1dd16b9a274afbde46c9d9a4052d720d4cf3c3e2 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Thu, 22 Aug 2013 14:24:18 -0700 Subject: [PATCH] dpif: Change get_max_ports() to return uint32_t. The declaration of 'get_max_ports()' to return odp_port_t adds unwanted complexity to coding. This commit changes it back to return uint32_t type. Signed-off-by: Alex Wang Signed-off-by: Ben Pfaff --- lib/dpif-linux.c | 4 ++-- lib/dpif-netdev.c | 4 ++-- lib/dpif-provider.h | 2 +- lib/dpif.c | 2 +- lib/dpif.h | 2 +- ofproto/ofproto-dpif.c | 5 ++--- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index a95ece16d..ca5f496d0 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -655,10 +655,10 @@ dpif_linux_port_query_by_name(const struct dpif *dpif, const char *devname, return dpif_linux_port_query__(dpif, 0, devname, dpif_port); } -static odp_port_t +static uint32_t dpif_linux_get_max_ports(const struct dpif *dpif OVS_UNUSED) { - return u32_to_odp(MAX_PORTS); + return MAX_PORTS; } static uint32_t diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 8f79128c2..46eb743aa 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -608,10 +608,10 @@ dpif_netdev_port_query_by_name(const struct dpif *dpif, const char *devname, return error; } -static odp_port_t +static uint32_t dpif_netdev_get_max_ports(const struct dpif *dpif OVS_UNUSED) { - return u32_to_odp(MAX_PORTS); + return MAX_PORTS; } static void diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h index d6315ed61..1afac99e4 100644 --- a/lib/dpif-provider.h +++ b/lib/dpif-provider.h @@ -146,7 +146,7 @@ struct dpif_class { /* Returns one greater than the largest port number accepted in flow * actions. */ - odp_port_t (*get_max_ports)(const struct dpif *dpif); + uint32_t (*get_max_ports)(const struct dpif *dpif); /* Returns the Netlink PID value to supply in OVS_ACTION_ATTR_USERSPACE * actions as the OVS_USERSPACE_ATTR_PID attribute's value, for use in diff --git a/lib/dpif.c b/lib/dpif.c index ae4da6201..02cc36a66 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -634,7 +634,7 @@ dpif_port_query_by_name(const struct dpif *dpif, const char *devname, /* Returns one greater than the maximum port number accepted in flow * actions. */ -odp_port_t +uint32_t dpif_get_max_ports(const struct dpif *dpif) { return dpif->dpif_class->get_max_ports(dpif); diff --git a/lib/dpif.h b/lib/dpif.h index d0280858d..7a258c70b 100644 --- a/lib/dpif.h +++ b/lib/dpif.h @@ -415,7 +415,7 @@ int dpif_port_query_by_name(const struct dpif *, const char *devname, struct dpif_port *); int dpif_port_get_name(struct dpif *, odp_port_t port_no, char *name, size_t name_size); -odp_port_t dpif_get_max_ports(const struct dpif *); +uint32_t dpif_get_max_ports(const struct dpif *); uint32_t dpif_port_get_pid(const struct dpif *, odp_port_t port_no); struct dpif_port_dump { diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index c5414f3be..80c7c4c1e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1248,7 +1248,7 @@ construct(struct ofproto *ofproto_) { struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_); struct shash_node *node, *next; - odp_port_t max_ports; + uint32_t max_ports; int error; error = open_dpif_backer(ofproto->up.type, &ofproto->backer); @@ -1257,8 +1257,7 @@ construct(struct ofproto *ofproto_) } max_ports = dpif_get_max_ports(ofproto->backer->dpif); - ofproto_init_max_ports(ofproto_, u16_to_ofp(MIN(odp_to_u32(max_ports), - ofp_to_u16(OFPP_MAX)))); + ofproto_init_max_ports(ofproto_, MIN(max_ports, ofp_to_u16(OFPP_MAX))); ofproto->netflow = NULL; ofproto->sflow = NULL; -- 2.43.0