/* 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 void update_port(struct ofproto *, const char *devname);
+static int update_port(struct ofproto *, const char *devname);
static int init_ports(struct ofproto *);
static void reinit_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) {
simap_put(&ofproto->ofp_requests, netdev_name,
ofp_to_u16(ofp_port));
- update_port(ofproto, netdev_name);
+ error = update_port(ofproto, netdev_name);
}
if (ofp_portp) {
*ofp_portp = OFPP_NONE;
/* Adds an ofport to 'p' initialized based on the given 'netdev' and 'opp'.
* The caller must ensure that 'p' does not have a conflicting ofport (that is,
* one with the same name or port number). */
-static void
+static int
ofport_install(struct ofproto *p,
struct netdev *netdev, const struct ofputil_phy_port *pp)
{
goto error;
}
connmgr_send_port_status(p->connmgr, NULL, pp, OFPPR_ADD);
- return;
+ return 0;
error:
VLOG_WARN_RL(&rl, "%s: could not add port %s (%s)",
} else {
netdev_close(netdev);
}
+ return error;
}
/* Removes 'ofport' from 'p' and destroys it. */
{
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);
}
}
return error;
}
-static void
+static int
update_port(struct ofproto *ofproto, const char *name)
{
struct ofproto_port ofproto_port;
struct ofputil_phy_port pp;
struct netdev *netdev;
struct ofport *port;
+ int error = 0;
COVERAGE_INC(ofproto_update_port);
ofport_remove(port);
}
ofport_remove_with_name(ofproto, name);
- ofport_install(ofproto, netdev, &pp);
+ error = ofport_install(ofproto, netdev, &pp);
}
} else {
/* Any port named 'name' is gone now. */
ofport_remove_with_name(ofproto, name);
}
ofproto_port_destroy(&ofproto_port);
+
+ return error;
}
static int
/* Get payload. */
if (po.buffer_id != UINT32_MAX) {
error = ofconn_pktbuf_retrieve(ofconn, po.buffer_id, &payload, NULL);
- if (error || !payload) {
+ if (error) {
goto exit_free_ofpacts;
}
} else {
static enum ofperr
handle_nxt_set_async_config(struct ofconn *ofconn, const struct ofp_header *oh)
{
+ struct ofputil_async_cfg basis = ofconn_get_async_config(ofconn);
+ struct ofputil_async_cfg ac;
enum ofperr error;
- uint32_t master[OAM_N_TYPES] = {0};
- uint32_t slave[OAM_N_TYPES] = {0};
- error = ofputil_decode_set_async_config(oh, master, slave, false);
+ error = ofputil_decode_set_async_config(oh, false, &basis, &ac);
if (error) {
return error;
}
- ofconn_set_async_config(ofconn, master, slave);
+ ofconn_set_async_config(ofconn, &ac);
if (ofconn_get_type(ofconn) == OFCONN_SERVICE &&
!ofconn_get_miss_send_len(ofconn)) {
ofconn_set_miss_send_len(ofconn, OFP_DEFAULT_MISS_SEND_LEN);
static enum ofperr
handle_nxt_get_async_request(struct ofconn *ofconn, const struct ofp_header *oh)
{
- struct ofpbuf *buf;
- uint32_t master[OAM_N_TYPES];
- uint32_t slave[OAM_N_TYPES];
-
- ofconn_get_async_config(ofconn, master, slave);
-
- buf = ofputil_encode_get_async_config(oh, master, slave);
- ofconn_send_reply(ofconn, buf);
+ struct ofputil_async_cfg ac = ofconn_get_async_config(ofconn);
+ ofconn_send_reply(ofconn, ofputil_encode_get_async_reply(oh, &ac));
return 0;
}