This is simpler and shorter than handling each of these by itself.
CC: Niels van Adrichem <N.L.M.vanAdrichem@tudelft.nl>
Suggested-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
static bool
odp_port_is_alive(const struct xlate_ctx *ctx, ofp_port_t ofp_port)
{
- struct xport *xport;
- struct bfd *bfd;
-
- xport = get_ofp_port(ctx->xbridge, ofp_port);
- if (!xport || xport->config & OFPUTIL_PC_PORT_DOWN ||
- xport->state & OFPUTIL_PS_LINK_DOWN) {
- return false;
- }
-
- bfd = xport->bfd;
- if (bfd && !bfd_forwarding(bfd)) {
- return false;
- }
-
- return true;
+ struct xport *xport = get_ofp_port(ctx->xbridge, ofp_port);
+ return xport && xport->may_enable;
}
static struct ofputil_bucket *