2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

Always treat datapath ports as 32 bits.

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@nicira.com>
This commit is contained in:
Justin Pettit
2012-09-26 16:22:47 -07:00
parent 6822daf206
commit 9b56fe137d
10 changed files with 66 additions and 66 deletions

View File

@@ -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) {