[ovs-dev] [PATCH v6 03/18] lib/stp: Some debugging support.
Daniele Venturino
venturino.daniele at gmail.com
Tue Sep 9 10:30:27 UTC 2014
Acked-by: Daniele Venturino <daniele.venturino at m3s.it>
2014-08-21 1:57 GMT+02:00 Jarno Rajahalme <jrajahalme at nicira.com>:
> Set the stp port name before enabling it, so that debugging messages
> have the name to print out.
>
> Do not treat the first state initialization as a state change. Zero
> is not a valid state, so changing from zero to STP_DISABLED is not a
> state change.
>
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> ---
> lib/stp.c | 7 ++++++-
> ofproto/ofproto-dpif.c | 5 ++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/lib/stp.c b/lib/stp.c
> index 1bf1f89..8f904c0 100644
> --- a/lib/stp.c
> +++ b/lib/stp.c
> @@ -1469,7 +1469,12 @@ stp_initialize_port(struct stp_port *p, enum
> stp_state state)
> {
> ovs_assert(state & (STP_DISABLED | STP_BLOCKING));
> stp_become_designated_port(p);
> - stp_set_port_state(p, state);
> +
> + if (!p->state && state == STP_DISABLED) {
> + p->state = state; /* Do not trigger state change when
> initializing. */
> + } else {
> + stp_set_port_state(p, state);
> + }
> p->topology_change_ack = false;
> p->config_pending = false;
> p->change_detection_enabled = true;
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 4da16f4..953b8d1 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -2218,9 +2218,12 @@ set_stp_port(struct ofport *ofport_,
> }
>
> sp = ofport->stp_port = stp_get_port(ofproto->stp, s->port_num);
> - stp_port_enable(sp);
>
> + /* Set name before enabling the port so that debugging messages can
> print
> + * the name. */
> stp_port_set_name(sp, netdev_get_name(ofport->up.netdev));
> + stp_port_enable(sp);
> +
> stp_port_set_aux(sp, ofport);
> stp_port_set_priority(sp, s->priority);
> stp_port_set_path_cost(sp, s->path_cost);
> --
> 1.7.10.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
More information about the dev
mailing list