summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
92cfab8)
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
bool fast; /* True if using fast probe interval. */
bool negotiated; /* True if LACP negotiations were successful. */
bool update; /* True if lacp_update() needs to be called. */
bool fast; /* True if using fast probe interval. */
bool negotiated; /* True if LACP negotiations were successful. */
bool update; /* True if lacp_update() needs to be called. */
lacp = xzalloc(sizeof *lacp);
hmap_init(&lacp->slaves);
list_push_back(&all_lacps, &lacp->node);
lacp = xzalloc(sizeof *lacp);
hmap_init(&lacp->slaves);
list_push_back(&all_lacps, &lacp->node);
+ lacp->ref_cnt = 1;
+ return lacp;
+}
+
+struct lacp *
+lacp_ref(const struct lacp *lacp_)
+{
+ struct lacp *lacp = CONST_CAST(struct lacp *, lacp_);
+ if (lacp) {
+ ovs_assert(lacp->ref_cnt > 0);
+ lacp->ref_cnt++;
+ }
return lacp;
}
/* Destroys 'lacp' and its slaves. Does nothing if 'lacp' is NULL. */
void
return lacp;
}
/* Destroys 'lacp' and its slaves. Does nothing if 'lacp' is NULL. */
void
-lacp_destroy(struct lacp *lacp)
+lacp_unref(struct lacp *lacp)
+ if (!lacp) {
+ return;
+ }
+
+ ovs_assert(lacp->ref_cnt > 0);
+ if (!--lacp->ref_cnt) {
struct slave *slave, *next;
HMAP_FOR_EACH_SAFE (slave, next, node, &lacp->slaves) {
struct slave *slave, *next;
HMAP_FOR_EACH_SAFE (slave, next, node, &lacp->slaves) {
void lacp_init(void);
struct lacp *lacp_create(void);
void lacp_init(void);
struct lacp *lacp_create(void);
-void lacp_destroy(struct lacp *);
+void lacp_unref(struct lacp *);
+struct lacp *lacp_ref(const struct lacp *);
void lacp_configure(struct lacp *, const struct lacp_settings *);
bool lacp_is_active(const struct lacp *);
void lacp_configure(struct lacp *, const struct lacp_settings *);
bool lacp_is_active(const struct lacp *);
hmap_remove(&ofproto->bundles, &bundle->hmap_node);
free(bundle->name);
free(bundle->trunks);
hmap_remove(&ofproto->bundles, &bundle->hmap_node);
free(bundle->name);
free(bundle->trunks);
- lacp_destroy(bundle->lacp);
+ lacp_unref(bundle->lacp);
bond_destroy(bundle->bond);
free(bundle);
}
bond_destroy(bundle->bond);
free(bundle);
}
}
lacp_configure(bundle->lacp, s->lacp);
} else {
}
lacp_configure(bundle->lacp, s->lacp);
} else {
- lacp_destroy(bundle->lacp);
+ lacp_unref(bundle->lacp);