projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: Speed up classifier test.
[openvswitch]
/
vswitchd
/
bridge.c
diff --git
a/vswitchd/bridge.c
b/vswitchd/bridge.c
index 7fcfd58eddf5bf57061a9e753363c172e678c1f3..04898f88d9689787c3f344e692b3fc61417668dd 100644
(file)
--- a/
vswitchd/bridge.c
+++ b/
vswitchd/bridge.c
@@
-122,7
+122,8
@@
struct port {
struct bridge *bridge;
size_t port_idx;
int vlan; /* -1=trunk port, else a 12-bit VLAN ID. */
struct bridge *bridge;
size_t port_idx;
int vlan; /* -1=trunk port, else a 12-bit VLAN ID. */
- unsigned long *trunks; /* Bitmap of trunked VLANs, if 'vlan' == -1. */
+ unsigned long *trunks; /* Bitmap of trunked VLANs, if 'vlan' == -1.
+ * NULL if all VLANs are trunked. */
char *name;
/* An ordinary bridge port has 1 interface.
char *name;
/* An ordinary bridge port has 1 interface.
@@
-1985,11
+1986,11
@@
bond_wait(struct bridge *br)
for (j = 0; j < port->n_ifaces; j++) {
struct iface *iface = port->ifaces[j];
if (iface->delay_expires != LLONG_MAX) {
for (j = 0; j < port->n_ifaces; j++) {
struct iface *iface = port->ifaces[j];
if (iface->delay_expires != LLONG_MAX) {
- poll_timer_wait
(iface->delay_expires - time_msec()
);
+ poll_timer_wait
_until(iface->delay_expires
);
}
}
if (port->bond_fake_iface) {
}
}
if (port->bond_fake_iface) {
- poll_timer_wait
(port->bond_next_fake_iface_update - time_msec()
);
+ poll_timer_wait
_until(port->bond_next_fake_iface_update
);
}
}
}
}
}
}
@@
-2073,7
+2074,8
@@
dst_is_duplicate(const struct dst *dsts, size_t n_dsts,
static bool
port_trunks_vlan(const struct port *port, uint16_t vlan)
{
static bool
port_trunks_vlan(const struct port *port, uint16_t vlan)
{
- return port->vlan < 0 && bitmap_is_set(port->trunks, vlan);
+ return (port->vlan < 0
+ && (!port->trunks || bitmap_is_set(port->trunks, vlan)));
}
static bool
}
static bool
@@
-3354,7
+3356,7
@@
port_reconfigure(struct port *port, const struct ovsrec_port *cfg)
/* Get trunked VLANs. */
trunks = NULL;
/* Get trunked VLANs. */
trunks = NULL;
- if (vlan < 0) {
+ if (vlan < 0
&& cfg->n_trunks
) {
size_t n_errors;
size_t i;
size_t n_errors;
size_t i;
@@
-3373,17
+3375,14
@@
port_reconfigure(struct port *port, const struct ovsrec_port *cfg)
port->name, cfg->n_trunks);
}
if (n_errors == cfg->n_trunks) {
port->name, cfg->n_trunks);
}
if (n_errors == cfg->n_trunks) {
- if (n_errors) {
- VLOG_ERR("port %s: no valid trunks, trunking all VLANs",
- port->name);
- }
- bitmap_set_multiple(trunks, 0, 4096, 1);
- }
- } else {
- if (cfg->n_trunks) {
- VLOG_ERR("port %s: ignoring trunks in favor of implicit vlan",
+ VLOG_ERR("port %s: no valid trunks, trunking all VLANs",
port->name);
port->name);
+ bitmap_free(trunks);
+ trunks = NULL;
}
}
+ } else if (vlan >= 0 && cfg->n_trunks) {
+ VLOG_ERR("port %s: ignoring trunks in favor of implicit vlan",
+ port->name);
}
if (trunks == NULL
? port->trunks != NULL
}
if (trunks == NULL
? port->trunks != NULL
@@
-3392,8
+3391,6
@@
port_reconfigure(struct port *port, const struct ovsrec_port *cfg)
}
bitmap_free(port->trunks);
port->trunks = trunks;
}
bitmap_free(port->trunks);
port->trunks = trunks;
-
- shash_destroy(&new_ifaces);
}
static void
}
static void
@@
-3616,6
+3613,8
@@
iface_create(struct port *port, const struct ovsrec_interface *if_cfg)
iface->netdev = NULL;
iface->cfg = if_cfg;
iface->netdev = NULL;
iface->cfg = if_cfg;
+ shash_add_assert(&br->iface_by_name, iface->name, iface);
+
/* Attempt to create the network interface in case it doesn't exist yet. */
if (!iface_is_internal(br, iface->name)) {
error = set_up_iface(if_cfg, iface, true);
/* Attempt to create the network interface in case it doesn't exist yet. */
if (!iface_is_internal(br, iface->name)) {
error = set_up_iface(if_cfg, iface, true);
@@
-3623,14
+3622,13
@@
iface_create(struct port *port, const struct ovsrec_interface *if_cfg)
VLOG_WARN("could not create iface %s: %s", iface->name,
strerror(error));
VLOG_WARN("could not create iface %s: %s", iface->name,
strerror(error));
+ shash_find_and_delete_assert(&br->iface_by_name, iface->name);
free(iface->name);
free(iface);
return NULL;
}
}
free(iface->name);
free(iface);
return NULL;
}
}
- shash_add_assert(&br->iface_by_name, iface->name, iface);
-
if (port->n_ifaces >= port->allocated_ifaces) {
port->ifaces = x2nrealloc(port->ifaces, &port->allocated_ifaces,
sizeof *port->ifaces);
if (port->n_ifaces >= port->allocated_ifaces) {
port->ifaces = x2nrealloc(port->ifaces, &port->allocated_ifaces,
sizeof *port->ifaces);