diff mbox series

[v3,22/23] hw/rdma: Do not call rdma_backend_del_gid on an empty gid

Message ID 20181113071336.6242-23-yuval.shaia@oracle.com (mailing list archive)
State New, archived
Headers show
Series Add support for RDMA MAD | expand

Commit Message

Yuval Shaia Nov. 13, 2018, 7:13 a.m. UTC
When device goes down the function fini_ports loops over all entries in
gid table regardless of the fact whether entry is valid or not. In case
that entry is not valid we'd like to skip from any further processing in
backend device.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 hw/rdma/rdma_rm.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Marcel Apfelbaum Nov. 17, 2018, 12:25 p.m. UTC | #1
On 11/13/18 9:13 AM, Yuval Shaia wrote:
> When device goes down the function fini_ports loops over all entries in
> gid table regardless of the fact whether entry is valid or not. In case
> that entry is not valid we'd like to skip from any further processing in
> backend device.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>   hw/rdma/rdma_rm.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
> index 35a96d9a64..e3f6b2f6ea 100644
> --- a/hw/rdma/rdma_rm.c
> +++ b/hw/rdma/rdma_rm.c
> @@ -555,6 +555,10 @@ int rdma_rm_del_gid(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
>   {
>       int rc;
>   
> +    if (!dev_res->port.gid_tbl[gid_idx].gid.global.interface_id) {
> +        return 0;
> +    }
> +
>       rc = rdma_backend_del_gid(backend_dev, ifname,
>                                 &dev_res->port.gid_tbl[gid_idx].gid);
>       if (rc < 0) {

Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>

Thanks,
Marcel
Yuval Shaia Nov. 18, 2018, 9:42 a.m. UTC | #2
On Sat, Nov 17, 2018 at 02:25:55PM +0200, Marcel Apfelbaum wrote:
> 
> 
> On 11/13/18 9:13 AM, Yuval Shaia wrote:
> > When device goes down the function fini_ports loops over all entries in
> > gid table regardless of the fact whether entry is valid or not. In case
> > that entry is not valid we'd like to skip from any further processing in
> > backend device.
> > 
> > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> > ---
> >   hw/rdma/rdma_rm.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> > 
> > diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
> > index 35a96d9a64..e3f6b2f6ea 100644
> > --- a/hw/rdma/rdma_rm.c
> > +++ b/hw/rdma/rdma_rm.c
> > @@ -555,6 +555,10 @@ int rdma_rm_del_gid(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
> >   {
> >       int rc;
> > +    if (!dev_res->port.gid_tbl[gid_idx].gid.global.interface_id) {
> > +        return 0;
> > +    }
> > +
> >       rc = rdma_backend_del_gid(backend_dev, ifname,
> >                                 &dev_res->port.gid_tbl[gid_idx].gid);
> >       if (rc < 0) {
> 
> Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>

There seems to be a missing space separator between "Apfelbaum" and "<". Is
that ok?

> 
> Thanks,
> Marcel
>
diff mbox series

Patch

diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
index 35a96d9a64..e3f6b2f6ea 100644
--- a/hw/rdma/rdma_rm.c
+++ b/hw/rdma/rdma_rm.c
@@ -555,6 +555,10 @@  int rdma_rm_del_gid(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
 {
     int rc;
 
+    if (!dev_res->port.gid_tbl[gid_idx].gid.global.interface_id) {
+        return 0;
+    }
+
     rc = rdma_backend_del_gid(backend_dev, ifname,
                               &dev_res->port.gid_tbl[gid_idx].gid);
     if (rc < 0) {