[ovs-dev] [PATCH v6 04/18] lib/rstp: Better debug messages, style fixes.

Daniele Venturino venturino.daniele at gmail.com
Tue Sep 9 10:31:00 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>:

> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> ---
>  lib/rstp-state-machines.c |   22 ++++++++++++----------
>  ofproto/ofproto-dpif.c    |   11 ++++++-----
>  vswitchd/bridge.c         |   10 +++++-----
>  3 files changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/lib/rstp-state-machines.c b/lib/rstp-state-machines.c
> index 4aea49d..b70b9da 100644
> --- a/lib/rstp-state-machines.c
> +++ b/lib/rstp-state-machines.c
> @@ -110,7 +110,8 @@ process_received_bpdu(struct rstp_port *p, const void
> *bpdu, size_t bpdu_size)
>          rstp->changes = true;
>          move_rstp(rstp);
>      } else {
> -        VLOG_DBG("Bad BPDU received");
> +        VLOG_DBG("%s, port %u: Bad BPDU received", p->rstp->name,
> +                 p->port_number);
>          p->error_count++;
>      }
>  }
> @@ -423,8 +424,8 @@ port_role_selection_sm(struct rstp *r)
>      }
>      if (old_state != r->port_role_selection_sm_state) {
>          r->changes = true;
> -        VLOG_DBG("Port_role_selection_sm %d -> %d", old_state,
> -            r->port_role_selection_sm_state);
> +        VLOG_DBG("%s: Port_role_selection_sm %d -> %d", r->name,
> +                 old_state, r->port_role_selection_sm_state);
>      }
>      return 0;
>  }
> @@ -899,6 +900,8 @@ port_transmit_sm(struct rstp_port *p)
>          /* no break */
>      case PORT_TRANSMIT_SM_IDLE:
>          if (p->role == ROLE_DISABLED) {
> +            VLOG_DBG("%s, port %u: port_transmit_sm ROLE == DISABLED.",
> +                     p->rstp->name, p->port_number);
>              break;
>          }
>          else if (p->send_rstp && p->new_info &&
> @@ -1085,9 +1088,8 @@ port_information_sm(struct rstp_port *p)
>      case PORT_INFORMATION_SM_DISABLED:
>          if (p->port_enabled) {
>              p->port_information_sm_state = PORT_INFORMATION_SM_AGED_EXEC;
> -        }
> -        else if (p->rcvd_msg) {
> -        p->port_information_sm_state = PORT_INFORMATION_SM_DISABLED_EXEC;
> +        } else if (p->rcvd_msg) {
> +            p->port_information_sm_state =
> PORT_INFORMATION_SM_DISABLED_EXEC;
>          }
>          break;
>      case PORT_INFORMATION_SM_AGED_EXEC:
> @@ -1225,8 +1227,8 @@ port_information_sm(struct rstp_port *p)
>      }
>      if (old_state != p->port_information_sm_state) {
>          r->changes = true;
> -        VLOG_DBG("Port_information_sm %d -> %d", old_state,
> -                 p->port_information_sm_state);
> +        VLOG_DBG("%s, port %u: Port_information_sm %d -> %d",
> p->rstp->name,
> +                 p->port_number, old_state, p->port_information_sm_state);
>      }
>      return 0;
>  }
> @@ -1945,8 +1947,8 @@ topology_change_sm(struct rstp_port *p)
>      }
>      if (old_state != p->topology_change_sm_state) {
>          r->changes = true;
> -        VLOG_DBG("Topology_change_sm %d -> %d",old_state,
> -                 p->topology_change_sm_state);
> +        VLOG_DBG("%s, port %u: Topology_change_sm %d -> %d",
> p->rstp->name,
> +                 p->port_number, old_state, p->topology_change_sm_state);
>      }
>      return 0;
>  }
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 953b8d1..32f08dd 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1916,15 +1916,16 @@ rstp_send_bpdu_cb(struct ofpbuf *pkt, int
> port_num, void *ofproto_)
>
>      ofport = rstp_port_get_aux(rp);
>      if (!ofport) {
> -        VLOG_WARN_RL(&rl, "%s: cannot send BPDU on unknown port %d",
> -                ofproto->up.name, port_num);
> +        VLOG_WARN_RL(&rl, "%s: cannot send BPDU on unknown RSTP port %d",
> +                     ofproto->up.name, port_num);
>      } else {
>          struct eth_header *eth = ofpbuf_l2(pkt);
>
>          netdev_get_etheraddr(ofport->up.netdev, eth->eth_src);
>          if (eth_addr_is_zero(eth->eth_src)) {
> -            VLOG_WARN_RL(&rl, "%s: cannot send BPDU on port %d "
> -                    "with unknown MAC", ofproto->up.name, port_num);
> +            VLOG_WARN_RL(&rl, "%s port %d: cannot send BPDU on RSTP port
> %d "
> +                         "with unknown MAC", ofproto->up.name,
> +                         ofp_to_u16(ofport->up.ofp_port), port_num);
>          } else {
>              ofproto_dpif_send_packet(ofport, pkt);
>          }
> @@ -1971,7 +1972,7 @@ set_rstp(struct ofproto *ofproto_, const struct
> ofproto_rstp_settings *s)
>      if (s) {
>          if (!ofproto->rstp) {
>              ofproto->rstp = rstp_create(ofproto_->name, s->address,
> -              rstp_send_bpdu_cb, ofproto);
> +                                        rstp_send_bpdu_cb, ofproto);
>              ofproto->rstp_last_tick = time_msec();
>          }
>          rstp_set_bridge_address(ofproto->rstp, s->address);
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index ba2eb79..8f99d7d 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -1358,16 +1358,14 @@ port_configure_rstp(const struct ofproto *ofproto,
> struct port *port,
>              return;
>          }
>          port_s->port_num = port_num;
> -    }
> -    else {
> +    } else {
>          if (*port_num_counter >= RSTP_MAX_PORTS) {
>              VLOG_ERR("port %s: too many RSTP ports, disabling",
> port->name);
>              port_s->enable = false;
>              return;
>          }
> -        /* If rstp-port-num is not specified, use 0.
> rstp_port_set_port_number
> -         * will look for the first free one.
> -         */
> +        /* If rstp-port-num is not specified, use 0.
> +         * rstp_port_set_port_number() will look for the first free one.
> */
>          port_s->port_num = 0;
>      }
>
> @@ -1403,6 +1401,7 @@ static void
>  bridge_configure_stp(struct bridge *br)
>  {
>      struct ofproto_rstp_status rstp_status;
> +
>      ofproto_get_rstp_status(br->ofproto, &rstp_status);
>      if (!br->cfg->stp_enable) {
>          ofproto_set_stp(br->ofproto, NULL);
> @@ -1504,6 +1503,7 @@ static void
>  bridge_configure_rstp(struct bridge *br)
>  {
>      struct ofproto_stp_status stp_status;
> +
>      ofproto_get_stp_status(br->ofproto, &stp_status);
>      if (!br->cfg->rstp_enable) {
>          ofproto_set_rstp(br->ofproto, NULL);
> --
> 1.7.10.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list