diff mbox series

[ovs-dev] dpif-netdev:Delete port check in do_add_port

Message ID 1524726771-17384-1-git-send-email-haifeng.lin@huawei.com
State Superseded
Headers show
Series [ovs-dev] dpif-netdev:Delete port check in do_add_port | expand

Commit Message

Linhaifeng April 26, 2018, 7:12 a.m. UTC
It is not need check port exist in do_add_port
because it had check in port_add.

Change-Id: Ie66206b40e305cef5f5b20af765c3128ccec6782
Signed-off-by: Haifeng Lin <haifeng.lin@huawei.com>
---
 lib/dpif-netdev.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Ben Pfaff May 9, 2018, 9:09 p.m. UTC | #1
On Thu, Apr 26, 2018 at 03:12:51PM +0800, Haifeng Lin wrote:
> It is not need check port exist in do_add_port
> because it had check in port_add.
> 
> Change-Id: Ie66206b40e305cef5f5b20af765c3128ccec6782
> Signed-off-by: Haifeng Lin <haifeng.lin@huawei.com>

Can you explain the problem and the solution in a little more detail?

Thanks,

Ben.
Linhaifeng June 21, 2018, 6:24 a.m. UTC | #2
For the performance problem. When add 3000 or more ports it costs too more time and it is not needed.

port_add function in ofproto-dpif.c have checked it used dpif_port_exists so we really not need to check it again in do_add_port

-----邮件原件-----
发件人: Ben Pfaff [mailto:blp@ovn.org] 
发送时间: 2018年5月10日 5:10
收件人: Linhaifeng <haifeng.lin@huawei.com>
抄送: dev@openvswitch.org
主题: Re: [ovs-dev] [PATCH] dpif-netdev:Delete port check in do_add_port

On Thu, Apr 26, 2018 at 03:12:51PM +0800, Haifeng Lin wrote:
> It is not need check port exist in do_add_port because it had check in 
> port_add.
> 
> Change-Id: Ie66206b40e305cef5f5b20af765c3128ccec6782
> Signed-off-by: Haifeng Lin <haifeng.lin@huawei.com>

Can you explain the problem and the solution in a little more detail?

Thanks,

Ben.
Ben Pfaff June 21, 2018, 10:56 p.m. UTC | #3
OK.

I think that it's the dpif itself that should really be doing the check
(the kernel datapath especially needs to do this for itself), so I sent
an alternative patch that works that way:
        https://patchwork.ozlabs.org/patch/932991/

Will you test it?

Thanks,

Ben.

On Thu, Jun 21, 2018 at 06:24:09AM +0000, Linhaifeng wrote:
> For the performance problem. When add 3000 or more ports it costs too more time and it is not needed.
> 
> port_add function in ofproto-dpif.c have checked it used dpif_port_exists so we really not need to check it again in do_add_port
> 
> -----邮件原件-----
> 发件人: Ben Pfaff [mailto:blp@ovn.org] 
> 发送时间: 2018年5月10日 5:10
> 收件人: Linhaifeng <haifeng.lin@huawei.com>
> 抄送: dev@openvswitch.org
> 主题: Re: [ovs-dev] [PATCH] dpif-netdev:Delete port check in do_add_port
> 
> On Thu, Apr 26, 2018 at 03:12:51PM +0800, Haifeng Lin wrote:
> > It is not need check port exist in do_add_port because it had check in 
> > port_add.
> > 
> > Change-Id: Ie66206b40e305cef5f5b20af765c3128ccec6782
> > Signed-off-by: Haifeng Lin <haifeng.lin@huawei.com>
> 
> Can you explain the problem and the solution in a little more detail?
> 
> Thanks,
> 
> Ben.
Linhaifeng June 23, 2018, 7:19 a.m. UTC | #4
It's good. If get_port_by_name  in dpif-netdev use string hash replace of HMAP_FOR_EACH the performance would better.

-----邮件原件-----
发件人: Ben Pfaff [mailto:blp@ovn.org] 
发送时间: 2018年6月22日 6:56
收件人: Linhaifeng <haifeng.lin@huawei.com>
抄送: dev@openvswitch.org
主题: Re: 答复: [ovs-dev] [PATCH] dpif-netdev:Delete port check in do_add_port

OK.

I think that it's the dpif itself that should really be doing the check (the kernel datapath especially needs to do this for itself), so I sent an alternative patch that works that way:
        https://patchwork.ozlabs.org/patch/932991/

Will you test it?

Thanks,

Ben.

On Thu, Jun 21, 2018 at 06:24:09AM +0000, Linhaifeng wrote:
> For the performance problem. When add 3000 or more ports it costs too more time and it is not needed.
> 
> port_add function in ofproto-dpif.c have checked it used 
> dpif_port_exists so we really not need to check it again in 
> do_add_port
> 
> -----邮件原件-----
> 发件人: Ben Pfaff [mailto:blp@ovn.org]
> 发送时间: 2018年5月10日 5:10
> 收件人: Linhaifeng <haifeng.lin@huawei.com>
> 抄送: dev@openvswitch.org
> 主题: Re: [ovs-dev] [PATCH] dpif-netdev:Delete port check in do_add_port
> 
> On Thu, Apr 26, 2018 at 03:12:51PM +0800, Haifeng Lin wrote:
> > It is not need check port exist in do_add_port because it had check 
> > in port_add.
> > 
> > Change-Id: Ie66206b40e305cef5f5b20af765c3128ccec6782
> > Signed-off-by: Haifeng Lin <haifeng.lin@huawei.com>
> 
> Can you explain the problem and the solution in a little more detail?
> 
> Thanks,
> 
> Ben.
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index be31fd0..f7976b1 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -1568,11 +1568,6 @@  do_add_port(struct dp_netdev *dp, const char *devname, const char *type,
     struct dp_netdev_port *port;
     int error;
 
-    /* Reject devices already in 'dp'. */
-    if (!get_port_by_name(dp, devname, &port)) {
-        return EEXIST;
-    }
-
     error = port_create(devname, type, port_no, &port);
     if (error) {
         return error;