From: Tonghao Zhang Date: Wed, 6 Nov 2019 16:34:28 +0000 (+0800) Subject: net: openvswitch: select vport upcall portid directly X-Git-Tag: v5.10.7~3838^2~197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90ce9f23a886bdef7a4b7a9bd52c7a50a6a81635;p=platform%2Fkernel%2Flinux-rpi.git net: openvswitch: select vport upcall portid directly The commit 69c51582ff786 ("dpif-netlink: don't allocate per thread netlink sockets"), in Open vSwitch ovs-vswitchd, has changed the number of allocated sockets to just one per port by moving the socket array from a per handler structure to a per datapath one. In the kernel datapath, a vport will have only one socket in most case, if so select it directly in fast-path. Signed-off-by: Tonghao Zhang Acked-by: Pravin B Shelar Signed-off-by: David S. Miller --- diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 3fc38d1..5da9392 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -403,8 +403,9 @@ u32 ovs_vport_find_upcall_portid(const struct vport *vport, struct sk_buff *skb) ids = rcu_dereference(vport->upcall_portids); - if (ids->n_ids == 1 && ids->ids[0] == 0) - return 0; + /* If there is only one portid, select it in the fast-path. */ + if (ids->n_ids == 1) + return ids->ids[0]; hash = skb_get_hash(skb); ids_index = hash - ids->n_ids * reciprocal_divide(hash, ids->rn_ids);