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);
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 *);
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);
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;
/* 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;
}
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);
}
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_);
} 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);
/* 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 *,
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;
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]) {
}
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;
}
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;
}
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);
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) {
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);
* 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.
*
*
* 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
}
/* 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);
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;
/* 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;
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);
* 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;
{
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);
* 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
* 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)
* 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;
\f
/* 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.
*
};
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;
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) {
}
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:
}
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;
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);
}
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) {
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;
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 *);
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 */
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. */
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);
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;
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;
const char *tun_id_s = argv[3];
const char *in_port_s = argv[4];
const char *packet_s = argv[5];
- uint16_t in_port = atoi(in_port_s);
+ uint32_t in_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;
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;
}
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;
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")]) {