Avoids unnecessary hash bucket traversal (ofproto_get_port()), since we
have the ofport_dpif already after odp_port_to_ofport().
Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
[blp@nicira.com simplified the test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
static struct ofport_dpif *
get_odp_port(const struct ofproto_dpif *ofproto, uint32_t odp_port)
{
- return get_ofp_port(ofproto, odp_port_to_ofp_port(ofproto, odp_port));
+ struct ofport_dpif *port = odp_port_to_ofport(ofproto->backer, odp_port);
+ return port && &ofproto->up == port->up.ofproto ? port : NULL;
}
static void