On Mon, Mar 21, 2011 at 10:59 AM, Ben Pfaff <[email protected]> wrote:
> Adding and removing ports is fairly common in a virtual environment,
> because it happens whenever a VM boots or shuts down.  It is best to
> avoid flushing the whole MAC learning table when that happens, because
> that means that, briefly, every packet will get flooded, wasting CPU cycles
> and network bandwidth.
>
> This commit breaks flushing the MAC table out of bridge_flush().  Instead,
> each caller is now responsible for flushing the MAC table if it is
> necessary.  In a few cases, no flushing was necessary, so those callers
> were not modified.  In the case of removing a port or modifying its VLAN
> assignments, it is necessary to expire all of the MAC learning entries
> associated with that port, so this commit does that.  Finally, some
> operations do require a MAC learning flush but they are rare enough that
> in my opinion it's not worth taking care to avoid a MAC table flush.
>
> Bug #891.

Whoa, old school.


>     /* Learned port. */
>     union {
> +        void *p;
>         int i;
>     } port;
>  };

Looks like we found our missing void *.

> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index e18e2ce..52b4c95 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -1497,7 +1497,6 @@ bridge_flush(struct bridge *br)
>  {
>     COVERAGE_INC(bridge_flush);
>     br->flush = true;
> -    mac_learning_flush(br->ml);
>  }
>
>  /* Bridge unixctl user interface functions. */
> @@ -1519,7 +1518,7 @@ bridge_unixctl_fdb_show(struct unixctl_conn *conn,
>     LIST_FOR_EACH (e, lru_node, &br->ml->lrus) {
>         struct port *port = e->port.p;
>         ds_put_format(&ds, "%5d  %4d  "ETH_ADDR_FMT"  %3d\n",
> -                      port_get_an_iface(br->ports[port])->dp_ifidx,
> +                      port_get_an_iface(port)->dp_ifidx,
>                       e->vlan, ETH_ADDR_ARGS(e->mac), mac_entry_age(e));
>     }

This may have belonged in a previous commit as well.
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to