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.rajaha...@nsn.com> --- ofproto/ofproto-dpif.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 186f0a7..4353c2f 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -2792,7 +2792,12 @@ get_ofp_port(const struct ofproto_dpif *ofproto, uint16_t ofp_port) 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; + + port = odp_port_to_ofport(ofproto->backer, odp_port); + + return (port && ofproto == ofproto_dpif_cast(port->up.ofproto)) + ? port : NULL; } static void -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev