&dpif_linux_class,
#endif
&dpif_netdev_class,
+ &dpif_planetlab_class,
};
struct registered_dpif_class {
return error;
}
-/* Attempts to add 'netdev' as a port on 'dpif'. 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 non-null). */
+/* 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
+ * 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
+ * non-null). */
int
dpif_port_add(struct dpif *dpif, struct netdev *netdev, uint16_t *port_nop)
{
const char *netdev_name = netdev_get_name(netdev);
- uint16_t port_no;
+ uint16_t port_no = UINT16_MAX;
int error;
COVERAGE_INC(dpif_port_add);
+ if (port_nop) {
+ port_no = *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,
}
/* Extracts the flow stats for a packet. The 'flow' and 'packet'
- * arguments must have been initialized through a call to flow_extract(). */
+ * arguments must have been initialized through a call to flow_extract().
+ * 'used' is stored into stats->used. */
void
dpif_flow_stats_extract(const struct flow *flow, const struct ofpbuf *packet,
- struct dpif_flow_stats *stats)
+ long long int used, struct dpif_flow_stats *stats)
{
stats->tcp_flags = packet_get_tcp_flags(packet, flow);
stats->n_bytes = packet->size;
stats->n_packets = 1;
- stats->used = time_msec();
+ stats->used = used;
}
/* Appends a human-readable representation of 'stats' to 's'. */