netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: openvswitch: select vport upcall portid directly
@ 2019-11-06 16:34 xiangxia.m.yue
  2019-11-07  3:01 ` Pravin Shelar
  2019-11-07  5:25 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: xiangxia.m.yue @ 2019-11-06 16:34 UTC (permalink / raw)
  To: ee07b291, pshelar; +Cc: netdev, dev, Tonghao Zhang

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

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 <xiangxia.m.yue@gmail.com>
---
v2: drectly -> directly in the commit title
---
 net/openvswitch/vport.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 3fc38d16c456..5da9392b03d6 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);
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] net: openvswitch: select vport upcall portid directly
  2019-11-06 16:34 [PATCH net-next v2] net: openvswitch: select vport upcall portid directly xiangxia.m.yue
@ 2019-11-07  3:01 ` Pravin Shelar
  2019-11-07  5:25 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Pravin Shelar @ 2019-11-07  3:01 UTC (permalink / raw)
  To: Tonghao Zhang; +Cc: ee07b291, Linux Kernel Network Developers, ovs dev

On Wed, Nov 6, 2019 at 8:34 AM <xiangxia.m.yue@gmail.com> wrote:
>
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>
> 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 <xiangxia.m.yue@gmail.com>

Acked-by: Pravin B Shelar <pshelar@ovn.org>

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] net: openvswitch: select vport upcall portid directly
  2019-11-06 16:34 [PATCH net-next v2] net: openvswitch: select vport upcall portid directly xiangxia.m.yue
  2019-11-07  3:01 ` Pravin Shelar
@ 2019-11-07  5:25 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-07  5:25 UTC (permalink / raw)
  To: xiangxia.m.yue; +Cc: ee07b291, pshelar, netdev, dev

From: xiangxia.m.yue@gmail.com
Date: Thu,  7 Nov 2019 00:34:28 +0800

> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> 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 <xiangxia.m.yue@gmail.com>
> ---
> v2: drectly -> directly in the commit title

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-07  5:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 16:34 [PATCH net-next v2] net: openvswitch: select vport upcall portid directly xiangxia.m.yue
2019-11-07  3:01 ` Pravin Shelar
2019-11-07  5:25 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).