diff mbox series

hw/rdma: Delete unused struct member

Message ID 20190109201956.3982-1-yuval.shaia@oracle.com (mailing list archive)
State New, archived
Headers show
Series hw/rdma: Delete unused struct member | expand

Commit Message

Yuval Shaia Jan. 9, 2019, 8:19 p.m. UTC
This member is used only in init_device_caps function, make it local.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 hw/rdma/rdma_backend.c      | 26 ++++++++++++++------------
 hw/rdma/rdma_backend_defs.h |  1 -
 2 files changed, 14 insertions(+), 13 deletions(-)

Comments

Marcel Apfelbaum Jan. 12, 2019, 3:12 p.m. UTC | #1
On 1/9/19 10:19 PM, Yuval Shaia wrote:
> This member is used only in init_device_caps function, make it local.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>   hw/rdma/rdma_backend.c      | 26 ++++++++++++++------------
>   hw/rdma/rdma_backend_defs.h |  1 -
>   2 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index 16dca69ee9..b49edaacaf 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -917,23 +917,25 @@ void rdma_backend_destroy_qp(RdmaBackendQP *qp)
>   static int init_device_caps(RdmaBackendDev *backend_dev,
>                               struct ibv_device_attr *dev_attr)
>   {
> -    if (ibv_query_device(backend_dev->context, &backend_dev->dev_attr)) {
> +    struct ibv_device_attr bk_dev_attr;
> +
> +    if (ibv_query_device(backend_dev->context, &bk_dev_attr)) {
>           return -EIO;
>       }
>   
>       dev_attr->max_sge = MAX_SGE;
>   
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_mr_size, "%" PRId64);
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_sge, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_wr, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_cq, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_cqe, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_mr, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_pd, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_rd_atom, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_init_rd_atom, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_ah, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_mr_size, "%" PRId64);
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_sge, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_wr, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_cq, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_cqe, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_mr, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_pd, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_rd_atom, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_init_rd_atom, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_ah, "%d");
>   
>       return 0;
>   }
> diff --git a/hw/rdma/rdma_backend_defs.h b/hw/rdma/rdma_backend_defs.h
> index 1e5c3dd3bf..15ae8b970e 100644
> --- a/hw/rdma/rdma_backend_defs.h
> +++ b/hw/rdma/rdma_backend_defs.h
> @@ -41,7 +41,6 @@ typedef struct RdmaCmMux {
>   } RdmaCmMux;
>   
>   typedef struct RdmaBackendDev {
> -    struct ibv_device_attr dev_attr;
>       RdmaBackendThread comp_thread;
>       PCIDevice *dev;
>       RdmaDeviceResources *rdma_dev_res;

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

Thanks,
Marcel
Philippe Mathieu-Daudé Jan. 14, 2019, 10:49 a.m. UTC | #2
On 1/9/19 9:19 PM, Yuval Shaia wrote:
> This member is used only in init_device_caps function, make it local.
> 
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/rdma/rdma_backend.c      | 26 ++++++++++++++------------
>  hw/rdma/rdma_backend_defs.h |  1 -
>  2 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index 16dca69ee9..b49edaacaf 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -917,23 +917,25 @@ void rdma_backend_destroy_qp(RdmaBackendQP *qp)
>  static int init_device_caps(RdmaBackendDev *backend_dev,
>                              struct ibv_device_attr *dev_attr)
>  {
> -    if (ibv_query_device(backend_dev->context, &backend_dev->dev_attr)) {
> +    struct ibv_device_attr bk_dev_attr;
> +
> +    if (ibv_query_device(backend_dev->context, &bk_dev_attr)) {
>          return -EIO;
>      }
>  
>      dev_attr->max_sge = MAX_SGE;
>  
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_mr_size, "%" PRId64);
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_sge, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_wr, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_cq, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_cqe, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_mr, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_pd, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_rd_atom, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_init_rd_atom, "%d");
> -    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_ah, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_mr_size, "%" PRId64);
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_sge, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_wr, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_cq, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_cqe, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_mr, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_pd, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_rd_atom, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_init_rd_atom, "%d");
> +    CHK_ATTR(dev_attr, bk_dev_attr, max_ah, "%d");
>  
>      return 0;
>  }
> diff --git a/hw/rdma/rdma_backend_defs.h b/hw/rdma/rdma_backend_defs.h
> index 1e5c3dd3bf..15ae8b970e 100644
> --- a/hw/rdma/rdma_backend_defs.h
> +++ b/hw/rdma/rdma_backend_defs.h
> @@ -41,7 +41,6 @@ typedef struct RdmaCmMux {
>  } RdmaCmMux;
>  
>  typedef struct RdmaBackendDev {
> -    struct ibv_device_attr dev_attr;
>      RdmaBackendThread comp_thread;
>      PCIDevice *dev;
>      RdmaDeviceResources *rdma_dev_res;
>
diff mbox series

Patch

diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
index 16dca69ee9..b49edaacaf 100644
--- a/hw/rdma/rdma_backend.c
+++ b/hw/rdma/rdma_backend.c
@@ -917,23 +917,25 @@  void rdma_backend_destroy_qp(RdmaBackendQP *qp)
 static int init_device_caps(RdmaBackendDev *backend_dev,
                             struct ibv_device_attr *dev_attr)
 {
-    if (ibv_query_device(backend_dev->context, &backend_dev->dev_attr)) {
+    struct ibv_device_attr bk_dev_attr;
+
+    if (ibv_query_device(backend_dev->context, &bk_dev_attr)) {
         return -EIO;
     }
 
     dev_attr->max_sge = MAX_SGE;
 
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_mr_size, "%" PRId64);
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_sge, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_wr, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_cq, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_cqe, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_mr, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_pd, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_rd_atom, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_qp_init_rd_atom, "%d");
-    CHK_ATTR(dev_attr, backend_dev->dev_attr, max_ah, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_mr_size, "%" PRId64);
+    CHK_ATTR(dev_attr, bk_dev_attr, max_qp, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_sge, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_wr, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_cq, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_cqe, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_mr, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_pd, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_rd_atom, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_qp_init_rd_atom, "%d");
+    CHK_ATTR(dev_attr, bk_dev_attr, max_ah, "%d");
 
     return 0;
 }
diff --git a/hw/rdma/rdma_backend_defs.h b/hw/rdma/rdma_backend_defs.h
index 1e5c3dd3bf..15ae8b970e 100644
--- a/hw/rdma/rdma_backend_defs.h
+++ b/hw/rdma/rdma_backend_defs.h
@@ -41,7 +41,6 @@  typedef struct RdmaCmMux {
 } RdmaCmMux;
 
 typedef struct RdmaBackendDev {
-    struct ibv_device_attr dev_attr;
     RdmaBackendThread comp_thread;
     PCIDevice *dev;
     RdmaDeviceResources *rdma_dev_res;