if (limit) {
n_handler_threads = limit;
} else {
- int n_proc = sysconf(_SC_NPROCESSORS_ONLN);
+ int n_proc = count_cpu_cores();
n_handler_threads = n_proc > 2 ? n_proc - 2 : 1;
}
}
? ofproto->ofproto_class->get_stp_port_status(ofport, s)
: EOPNOTSUPP);
}
+
+/* Retrieves STP port statistics of 'ofp_port' on 'ofproto' and stores it in
+ * 's'. If the 'enabled' member in 's' is false, then the other members
+ * are not meaningful.
+ *
+ * Returns 0 if successful, otherwise a positive errno value.*/
+int
+ofproto_port_get_stp_stats(struct ofproto *ofproto, ofp_port_t ofp_port,
+ struct ofproto_port_stp_stats *s)
+{
+ struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
+ if (!ofport) {
+ VLOG_WARN_RL(&rl, "%s: cannot get STP stats on nonexistent "
+ "port %"PRIu16, ofproto->name, ofp_port);
+ return ENODEV;
+ }
+
+ return (ofproto->ofproto_class->get_stp_port_stats
+ ? ofproto->ofproto_class->get_stp_port_stats(ofport, s)
+ : EOPNOTSUPP);
+}
\f
/* Queue DSCP configuration. */
}
table->max_flows = s->max_flows;
- ovs_rwlock_rdlock(&table->cls.rwlock);
+ ovs_rwlock_wrlock(&table->cls.rwlock);
if (classifier_count(&table->cls) > table->max_flows
&& table->eviction_fields) {
/* 'table' contains more flows than allowed. We might not be able to
break;
}
}
+
+ classifier_set_prefix_fields(&table->cls,
+ s->prefix_fields, s->n_prefix_fields);
+
ovs_rwlock_unlock(&table->cls.rwlock);
}
\f
update_port(ofproto, netdev_name);
}
if (ofp_portp) {
- struct ofproto_port ofproto_port;
-
- ofproto_port_query_by_name(ofproto, netdev_get_name(netdev),
- &ofproto_port);
- *ofp_portp = error ? OFPP_NONE : ofproto_port.ofp_port;
- ofproto_port_destroy(&ofproto_port);
+ *ofp_portp = OFPP_NONE;
+ if (!error) {
+ struct ofproto_port ofproto_port;
+
+ error = ofproto_port_query_by_name(ofproto,
+ netdev_get_name(netdev),
+ &ofproto_port);
+ if (!error) {
+ *ofp_portp = ofproto_port.ofp_port;
+ ofproto_port_destroy(&ofproto_port);
+ }
+ }
}
return error;
}
ots = xcalloc(p->n_tables, sizeof *ots);
for (i = 0; i < p->n_tables; i++) {
ots[i].table_id = i;
- sprintf(ots[i].name, "table%zu", i);
+ sprintf(ots[i].name, "table%"PRIuSIZE, i);
ots[i].match = htonll(OFPXMT13_MASK);
ots[i].wildcards = htonll(OFPXMT13_MASK);
ots[i].write_actions = htonl(OFPAT11_OUTPUT);
oftable_init(struct oftable *table)
{
memset(table, 0, sizeof *table);
- classifier_init(&table->cls);
+ classifier_init(&table->cls, flow_segment_u32s);
table->max_flows = UINT_MAX;
}