Skip to content

Commit

Permalink
net: openvswitch: select vport upcall portid directly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pravin B Shelar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
xpu22 authored and davem330 committed Nov 7, 2019
1 parent eb34e98 commit 90ce9f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/openvswitch/vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 90ce9f2

Please sign in to comment.