]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/staging/rdma/hfi1/qp.h
staging/rdma/hfi1: Use rdmavt send flags and recv flags
[mirror_ubuntu-artful-kernel.git] / drivers / staging / rdma / hfi1 / qp.h
index 62a94c5d7dcaab9bc12182064440543e69fddea5..9efa4bc634e7f03483c95fc8c9353978995acc2e 100644 (file)
@@ -54,7 +54,7 @@
 #include "verbs.h"
 #include "sdma.h"
 
-#define QPN_MAX                 (1 << 24)
+#define QPN_MAX                 BIT(24)
 #define QPNMAP_ENTRIES          (QPN_MAX / PAGE_SIZE / BITS_PER_BYTE)
 
 /*
@@ -80,7 +80,7 @@ struct hfi1_qpn_table {
 struct hfi1_qp_ibdev {
        u32 qp_table_size;
        u32 qp_table_bits;
-       struct hfi1_qp __rcu **qp_table;
+       struct rvt_qp __rcu **qp_table;
        spinlock_t qpt_lock;
        struct hfi1_qpn_table qpn_table;
 };
@@ -98,13 +98,13 @@ static inline u32 qpn_hash(struct hfi1_qp_ibdev *dev, u32 qpn)
  * The caller must hold the rcu_read_lock(), and keep the lock until
  * the returned qp is no longer in use.
  */
-static inline struct hfi1_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,
-                               u32 qpn) __must_hold(RCU)
+static inline struct rvt_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,
+                                            u32 qpn) __must_hold(RCU)
 {
-       struct hfi1_qp *qp = NULL;
+       struct rvt_qp *qp = NULL;
 
        if (unlikely(qpn <= 1)) {
-               qp = rcu_dereference(ibp->qp[qpn]);
+               qp = rcu_dereference(ibp->rvp.qp[qpn]);
        } else {
                struct hfi1_ibdev *dev = &ppd_from_ibp(ibp)->dd->verbs_dev;
                u32 n = qpn_hash(dev->qp_dev, qpn);
@@ -117,16 +117,17 @@ static inline struct hfi1_qp *hfi1_lookup_qpn(struct hfi1_ibport *ibp,
        return qp;
 }
 
-/**
- * clear_ahg - reset ahg status in qp
- * @qp - qp pointer
+/*
+ * free_ahg - clear ahg from QP
  */
-static inline void clear_ahg(struct hfi1_qp *qp)
+static inline void clear_ahg(struct rvt_qp *qp)
 {
-       qp->s_hdr->ahgcount = 0;
-       qp->s_flags &= ~(HFI1_S_AHG_VALID | HFI1_S_AHG_CLEAR);
-       if (qp->s_sde && qp->s_ahgidx >= 0)
-               sdma_ahg_free(qp->s_sde, qp->s_ahgidx);
+       struct hfi1_qp_priv *priv = qp->priv;
+
+       priv->s_hdr->ahgcount = 0;
+       qp->s_flags &= ~(RVT_S_AHG_VALID | RVT_S_AHG_CLEAR);
+       if (priv->s_sde && qp->s_ahgidx >= 0)
+               sdma_ahg_free(priv->s_sde, qp->s_ahgidx);
        qp->s_ahgidx = -1;
 }
 
@@ -140,7 +141,7 @@ static inline void clear_ahg(struct hfi1_qp *qp)
  * The QP r_lock and s_lock should be held and interrupts disabled.
  * If we are already in error state, just return.
  */
-int hfi1_error_qp(struct hfi1_qp *qp, enum ib_wc_status err);
+int hfi1_error_qp(struct rvt_qp *qp, enum ib_wc_status err);
 
 /**
  * hfi1_modify_qp - modify the attributes of a queue pair
@@ -163,7 +164,7 @@ int hfi1_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  *
  * Returns the AETH.
  */
-__be32 hfi1_compute_aeth(struct hfi1_qp *qp);
+__be32 hfi1_compute_aeth(struct rvt_qp *qp);
 
 /**
  * hfi1_create_qp - create a queue pair for a device
@@ -196,7 +197,7 @@ int hfi1_destroy_qp(struct ib_qp *ibqp);
  *
  * The QP s_lock should be held.
  */
-void hfi1_get_credit(struct hfi1_qp *qp, u32 aeth);
+void hfi1_get_credit(struct rvt_qp *qp, u32 aeth);
 
 /**
  * hfi1_qp_init - allocate QP tables
@@ -215,9 +216,9 @@ void hfi1_qp_exit(struct hfi1_ibdev *dev);
  * @qp: the QP
  * @flag: flag the qp on which the qp is stalled
  */
-void hfi1_qp_wakeup(struct hfi1_qp *qp, u32 flag);
+void hfi1_qp_wakeup(struct rvt_qp *qp, u32 flag);
 
-struct sdma_engine *qp_to_sdma_engine(struct hfi1_qp *qp, u8 sc5);
+struct sdma_engine *qp_to_sdma_engine(struct rvt_qp *qp, u8 sc5);
 
 struct qp_iter;
 
@@ -244,7 +245,7 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter);
  * qp_comm_est - handle trap with QP established
  * @qp: the QP
  */
-void qp_comm_est(struct hfi1_qp *qp);
+void qp_comm_est(struct rvt_qp *qp);
 
 /**
  * _hfi1_schedule_send - schedule progress
@@ -255,16 +256,17 @@ void qp_comm_est(struct hfi1_qp *qp);
  * It is only used in the post send, which doesn't hold
  * the s_lock.
  */
-static inline void _hfi1_schedule_send(struct hfi1_qp *qp)
+static inline void _hfi1_schedule_send(struct rvt_qp *qp)
 {
+       struct hfi1_qp_priv *priv = qp->priv;
        struct hfi1_ibport *ibp =
                to_iport(qp->ibqp.device, qp->port_num);
        struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
        struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device);
 
-       iowait_schedule(&qp->s_iowait, ppd->hfi1_wq,
-                       qp->s_sde ?
-                       qp->s_sde->cpu :
+       iowait_schedule(&priv->s_iowait, ppd->hfi1_wq,
+                       priv->s_sde ?
+                       priv->s_sde->cpu :
                        cpumask_first(cpumask_of_node(dd->assigned_node_id)));
 }
 
@@ -275,12 +277,12 @@ static inline void _hfi1_schedule_send(struct hfi1_qp *qp)
  * This schedules qp progress and caller should hold
  * the s_lock.
  */
-static inline void hfi1_schedule_send(struct hfi1_qp *qp)
+static inline void hfi1_schedule_send(struct rvt_qp *qp)
 {
        if (hfi1_send_ok(qp))
                _hfi1_schedule_send(qp);
 }
 
-void hfi1_migrate_qp(struct hfi1_qp *qp);
+void hfi1_migrate_qp(struct rvt_qp *qp);
 
 #endif /* _QP_H */