There's only a small race window on datapath creation when get_dpfindex() can return 0, so it's pretty unlikely.
Found by inspection. Signed-off-by: Ben Pfaff <[email protected]> --- datapath/datapath.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 4d40ac3..f0074f9 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -132,7 +132,7 @@ static int get_dpifindex(struct datapath *dp) rcu_read_lock(); local = get_vport_protected(dp, OVSP_LOCAL); - if (local) + if (likely(local)) ifindex = vport_get_ifindex(local); else ifindex = 0; @@ -426,7 +426,7 @@ static int queue_userspace_packets(struct datapath *dp, u32 pid, int err; dp_ifindex = get_dpifindex(dp); - if (!dp_ifindex) { + if (unlikely(!dp_ifindex)) { err = -ENODEV; nskb = skb->next; goto err_kfree_skbs; -- 1.7.4.4 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
