/* ofport. */
static void ofport_destroy__(struct ofport *) OVS_EXCLUDED(ofproto_mutex);
-static void ofport_destroy(struct ofport *);
+static void ofport_destroy(struct ofport *, bool del);
static int update_port(struct ofproto *, const char *devname);
static int init_ports(struct ofproto *);
unsigned ofproto_max_idle = OFPROTO_MAX_IDLE_DEFAULT;
size_t n_handlers, n_revalidators;
-size_t n_dpdk_rxqs;
char *pmd_cpu_mask;
/* Map from datapath name to struct ofproto, for use by unixctl commands. */
: EOPNOTSUPP);
}
-void
-ofproto_set_n_dpdk_rxqs(int n_rxqs)
-{
- n_dpdk_rxqs = MAX(n_rxqs, 0);
-}
-
void
ofproto_set_cpu_mask(const char *cmask)
{
}
void
-ofproto_destroy(struct ofproto *p)
+ofproto_destroy(struct ofproto *p, bool del)
OVS_EXCLUDED(ofproto_mutex)
{
struct ofport *ofport, *next_ofport;
ofproto_flush__(p);
HMAP_FOR_EACH_SAFE (ofport, next_ofport, hmap_node, &p->ports) {
- ofport_destroy(ofport);
+ ofport_destroy(ofport, del);
}
HMAP_FOR_EACH_SAFE (usage, next_usage, hmap_node, &p->ofport_usage) {
{
connmgr_send_port_status(ofport->ofproto->connmgr, NULL, &ofport->pp,
OFPPR_DELETE);
- ofport_destroy(ofport);
+ ofport_destroy(ofport, true);
}
/* If 'ofproto' contains an ofport named 'name', removes it from 'ofproto' and
}
static void
-ofport_destroy(struct ofport *port)
+ofport_destroy(struct ofport *port, bool del)
{
if (port) {
dealloc_ofp_port(port->ofproto, port->ofp_port);
- port->ofproto->ofproto_class->port_destruct(port);
+ port->ofproto->ofproto_class->port_destruct(port, del);
ofport_destroy__(port);
}
}
const struct ofp_header *request)
{
struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
- struct ofputil_table_features *features;
- struct ovs_list replies;
- struct ofpbuf msg;
- size_t i;
-
- ofpbuf_use_const(&msg, request, ntohs(request->length));
+ struct ofpbuf msg = ofpbuf_const_initializer(request,
+ ntohs(request->length));
ofpraw_pull_assert(&msg);
if (msg.size || ofpmp_more(request)) {
return OFPERR_OFPTFFC_EPERM;
}
+ struct ofputil_table_features *features;
query_tables(ofproto, &features, NULL);
+ struct ovs_list replies;
ofpmp_init(&replies, request);
- for (i = 0; i < ofproto->n_tables; i++) {
+ for (size_t i = 0; i < ofproto->n_tables; i++) {
if (!(ofproto->tables[i].flags & OFTABLE_HIDDEN)) {
ofputil_append_table_features_reply(&features[i], &replies);
}
uint32_t format;
format = ntohl(msg->format);
- if (format != NXPIF_OPENFLOW10 && format != NXPIF_NXM) {
+ if (!ofputil_packet_in_format_is_valid(format)) {
return OFPERR_OFPBRC_EPERM;
}
OVS_EXCLUDED(ofproto_mutex)
{
struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
- struct ofmonitor **monitors;
- size_t n_monitors, allocated_monitors;
- struct rule_collection rules;
- struct ovs_list replies;
- enum ofperr error;
- struct ofpbuf b;
- size_t i;
- ofpbuf_use_const(&b, oh, ntohs(oh->length));
- monitors = NULL;
- n_monitors = allocated_monitors = 0;
+ struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length));
+
+ struct ofmonitor **monitors = NULL;
+ size_t allocated_monitors = 0;
+ size_t n_monitors = 0;
+
+ enum ofperr error;
ovs_mutex_lock(&ofproto_mutex);
for (;;) {
monitors[n_monitors++] = m;
}
+ struct rule_collection rules;
rule_collection_init(&rules);
- for (i = 0; i < n_monitors; i++) {
+ for (size_t i = 0; i < n_monitors; i++) {
ofproto_collect_ofmonitor_initial_rules(monitors[i], &rules);
}
+ struct ovs_list replies;
ofpmp_init(&replies, oh);
ofmonitor_compose_refresh_updates(&rules, &replies);
ovs_mutex_unlock(&ofproto_mutex);
return 0;
error:
- for (i = 0; i < n_monitors; i++) {
+ for (size_t i = 0; i < n_monitors; i++) {
ofmonitor_destroy(monitors[i]);
}
free(monitors);