i40iw: Move ceq_valid to i40iw_sc_dev structure
authorShiraz Saleem <shiraz.saleem@intel.com>
Mon, 16 Oct 2017 20:46:00 +0000 (15:46 -0500)
committerDoug Ledford <dledford@redhat.com>
Wed, 18 Oct 2017 17:28:46 +0000 (13:28 -0400)
Completion Event Queues are created and destroyed on
a per device basis as opposed to per User-space Direct
Access resource.

Move ceq_valid to the correct place in i40iw_sc_dev
from i40iw_puda_rsrc.

Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/i40iw/i40iw_main.c
drivers/infiniband/hw/i40iw/i40iw_puda.c
drivers/infiniband/hw/i40iw/i40iw_puda.h
drivers/infiniband/hw/i40iw/i40iw_type.h

index 438f5269548b25514d27e9725424d7b40b99994e..dc6b338772e9272e37863a595258e1bfbef92cc8 100644 (file)
@@ -353,6 +353,8 @@ static void i40iw_dele_ceqs(struct i40iw_device *iwdev)
                i40iw_disable_irq(dev, msix_vec, (void *)iwceq);
                i40iw_destroy_ceq(iwdev, iwceq);
        }
+
+       iwdev->sc_dev.ceq_valid = false;
 }
 
 /**
@@ -810,17 +812,16 @@ static enum i40iw_status_code i40iw_setup_ceqs(struct i40iw_device *iwdev,
                i40iw_enable_intr(&iwdev->sc_dev, msix_vec->idx);
                iwdev->ceqs_count++;
        }
-
 exit:
-       if (status) {
-               if (!iwdev->ceqs_count) {
-                       kfree(iwdev->ceqlist);
-                       iwdev->ceqlist = NULL;
-               } else {
-                       status = 0;
-               }
+       if (status && !iwdev->ceqs_count) {
+               kfree(iwdev->ceqlist);
+               iwdev->ceqlist = NULL;
+               return status;
+       } else {
+               iwdev->sc_dev.ceq_valid = true;
+               return 0;
        }
-       return status;
+
 }
 
 /**
index af6d0dc82b8935400e6eeb28d45204f0d9773c75..fee6643d6626eba37b08e98f6f2e1486a26e8c7e 100644 (file)
@@ -611,7 +611,7 @@ static enum i40iw_status_code i40iw_puda_qp_create(struct i40iw_puda_rsrc *rsrc)
        qp->user_pri = 0;
        i40iw_qp_add_qos(qp);
        i40iw_puda_qp_setctx(rsrc);
-       if (rsrc->ceq_valid)
+       if (rsrc->dev->ceq_valid)
                ret = i40iw_cqp_qp_create_cmd(rsrc->dev, qp);
        else
                ret = i40iw_puda_qp_wqe(rsrc->dev, qp);
@@ -704,7 +704,7 @@ static enum i40iw_status_code i40iw_puda_cq_create(struct i40iw_puda_rsrc *rsrc)
        ret = dev->iw_priv_cq_ops->cq_init(cq, &info);
        if (ret)
                goto error;
-       if (rsrc->ceq_valid)
+       if (rsrc->dev->ceq_valid)
                ret = i40iw_cqp_cq_create_cmd(dev, cq);
        else
                ret = i40iw_puda_cq_wqe(dev, cq);
@@ -724,7 +724,7 @@ static void i40iw_puda_free_qp(struct i40iw_puda_rsrc *rsrc)
        struct i40iw_ccq_cqe_info compl_info;
        struct i40iw_sc_dev *dev = rsrc->dev;
 
-       if (rsrc->ceq_valid) {
+       if (rsrc->dev->ceq_valid) {
                i40iw_cqp_qp_destroy_cmd(dev, &rsrc->qp);
                return;
        }
@@ -757,7 +757,7 @@ static void i40iw_puda_free_cq(struct i40iw_puda_rsrc *rsrc)
        struct i40iw_ccq_cqe_info compl_info;
        struct i40iw_sc_dev *dev = rsrc->dev;
 
-       if (rsrc->ceq_valid) {
+       if (rsrc->dev->ceq_valid) {
                i40iw_cqp_cq_destroy_cmd(dev, &rsrc->cq);
                return;
        }
@@ -922,7 +922,6 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
                rsrc->xmit_complete = i40iw_ieq_tx_compl;
        }
 
-       rsrc->ceq_valid = info->ceq_valid;
        rsrc->type = info->type;
        rsrc->sq_wrtrk_array = (struct i40iw_sq_uk_wr_trk_info *)((u8 *)vmem->va + pudasize);
        rsrc->rq_wrid_array = (u64 *)((u8 *)vmem->va + pudasize + sqwridsize);
index dba05ce7d3929db3f1ac55cdba359fec64f29dcd..660aa3edae56e20372640eb32a7cdcbd96e8de22 100644 (file)
@@ -100,7 +100,6 @@ struct i40iw_puda_rsrc_info {
        enum puda_resource_type type;   /* ILQ or IEQ */
        u32 count;
        u16 pd_id;
-       bool ceq_valid;
        u32 cq_id;
        u32 qp_id;
        u32 sq_size;
@@ -125,7 +124,6 @@ struct i40iw_puda_rsrc {
        enum puda_resource_type type;
        u16 buf_size;           /*buffer must be max datalen + tcpip hdr + mac */
        u16 mss;
-       bool ceq_valid;
        u32 cq_id;
        u32 qp_id;
        u32 sq_size;
index f443f2075d6f4c5a02aa84ca82363a62c8f577a5..a27d392c92a27e8497e4a5af9841205d634c10e8 100644 (file)
@@ -505,6 +505,7 @@ struct i40iw_sc_dev {
        u8 hmc_fn_id;
        bool is_pf;
        bool vchnl_up;
+       bool ceq_valid;
        u8 vf_id;
        wait_queue_head_t vf_reqs;
        u64 cqp_cmd_stats[OP_SIZE_CQP_STAT_ARRAY];