Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com> --- lib/rstp.c | 34 ---------------------------------- lib/rstp.h | 42 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/lib/rstp.c b/lib/rstp.c index c674105..80479fb 100644 --- a/lib/rstp.c +++ b/lib/rstp.c @@ -1140,40 +1140,6 @@ rstp_port_get_aux(struct rstp_port *p) return aux; } -/* Returns true if 'state' is one in which BPDU packets should be received - * and transmitted on a port, false otherwise. - */ - bool - rstp_should_manage_bpdu(enum rstp_state state) - { - return (state == RSTP_DISCARDING || state == RSTP_LEARNING || - state == RSTP_FORWARDING); - } - -/* Returns true if 'state' is one in which packets received on a port should - * be forwarded, false otherwise. - * - * Returns true if 'state' is RSTP_DISABLED, since presumably in that case the - * port should still work, just not have RSTP applied to it. - */ -bool -rstp_forward_in_state(enum rstp_state state) -{ - return (state == RSTP_DISABLED || state == RSTP_FORWARDING); -} - -/* Returns true if 'state' is one in which MAC learning should be done on - * packets received on a port, false otherwise. - * - * Returns true if 'state' is RSTP_DISABLED, since presumably in that case the - * port should still work, just not have RSTP applied to it. */ -bool -rstp_learn_in_state(enum rstp_state state) -{ - return (state == RSTP_DISABLED || state == RSTP_LEARNING || - state == RSTP_FORWARDING); -} - /* Unixctl. */ static struct rstp * rstp_find(const char *name) diff --git a/lib/rstp.h b/lib/rstp.h index 5d7c7f4..0e8d101 100644 --- a/lib/rstp.h +++ b/lib/rstp.h @@ -119,9 +119,9 @@ struct rstp_port; struct ofproto_rstp_settings; const char *rstp_state_name(enum rstp_state); -bool rstp_forward_in_state(enum rstp_state); -bool rstp_learn_in_state(enum rstp_state); -bool rstp_should_manage_bpdu(enum rstp_state state); +static inline bool rstp_forward_in_state(enum rstp_state); +static inline bool rstp_learn_in_state(enum rstp_state); +static inline bool rstp_should_manage_bpdu(enum rstp_state state); const char *rstp_port_role_name(enum rstp_port_role); void rstp_init(void); @@ -198,4 +198,40 @@ enum rstp_port_role rstp_port_get_role(const struct rstp_port *); void rstp_port_get_counts(const struct rstp_port *, int *tx_count, int *rx_count, int *error_count, int *uptime); void * rstp_port_get_aux(struct rstp_port *); + +/* Inline functions. */ +/* Returns true if 'state' is one in which BPDU packets should be received + * and transmitted on a port, false otherwise. + */ +static inline bool +rstp_should_manage_bpdu(enum rstp_state state) +{ + return (state == RSTP_DISCARDING || state == RSTP_LEARNING || + state == RSTP_FORWARDING); +} + +/* Returns true if 'state' is one in which packets received on a port should + * be forwarded, false otherwise. + * + * Returns true if 'state' is RSTP_DISABLED, since presumably in that case the + * port should still work, just not have RSTP applied to it. + */ +static inline bool +rstp_forward_in_state(enum rstp_state state) +{ + return (state == RSTP_DISABLED || state == RSTP_FORWARDING); +} + +/* Returns true if 'state' is one in which MAC learning should be done on + * packets received on a port, false otherwise. + * + * Returns true if 'state' is RSTP_DISABLED, since presumably in that case the + * port should still work, just not have RSTP applied to it. */ +static inline bool +rstp_learn_in_state(enum rstp_state state) +{ + return (state == RSTP_DISABLED || state == RSTP_LEARNING || + state == RSTP_FORWARDING); +} + #endif /* rstp.h */ -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev