|
@@ -530,82 +530,6 @@ struct send_context *qp_to_send_context(struct rvt_qp *qp, u8 sc5)
|
|
|
sc5);
|
|
|
}
|
|
|
|
|
|
-struct qp_iter {
|
|
|
- struct hfi1_ibdev *dev;
|
|
|
- struct rvt_qp *qp;
|
|
|
- int specials;
|
|
|
- int n;
|
|
|
-};
|
|
|
-
|
|
|
-struct qp_iter *qp_iter_init(struct hfi1_ibdev *dev)
|
|
|
-{
|
|
|
- struct qp_iter *iter;
|
|
|
-
|
|
|
- iter = kzalloc(sizeof(*iter), GFP_KERNEL);
|
|
|
- if (!iter)
|
|
|
- return NULL;
|
|
|
-
|
|
|
- iter->dev = dev;
|
|
|
- iter->specials = dev->rdi.ibdev.phys_port_cnt * 2;
|
|
|
-
|
|
|
- return iter;
|
|
|
-}
|
|
|
-
|
|
|
-int qp_iter_next(struct qp_iter *iter)
|
|
|
-{
|
|
|
- struct hfi1_ibdev *dev = iter->dev;
|
|
|
- int n = iter->n;
|
|
|
- int ret = 1;
|
|
|
- struct rvt_qp *pqp = iter->qp;
|
|
|
- struct rvt_qp *qp;
|
|
|
-
|
|
|
- /*
|
|
|
- * The approach is to consider the special qps
|
|
|
- * as an additional table entries before the
|
|
|
- * real hash table. Since the qp code sets
|
|
|
- * the qp->next hash link to NULL, this works just fine.
|
|
|
- *
|
|
|
- * iter->specials is 2 * # ports
|
|
|
- *
|
|
|
- * n = 0..iter->specials is the special qp indices
|
|
|
- *
|
|
|
- * n = iter->specials..dev->rdi.qp_dev->qp_table_size+iter->specials are
|
|
|
- * the potential hash bucket entries
|
|
|
- *
|
|
|
- */
|
|
|
- for (; n < dev->rdi.qp_dev->qp_table_size + iter->specials; n++) {
|
|
|
- if (pqp) {
|
|
|
- qp = rcu_dereference(pqp->next);
|
|
|
- } else {
|
|
|
- if (n < iter->specials) {
|
|
|
- struct hfi1_pportdata *ppd;
|
|
|
- struct hfi1_ibport *ibp;
|
|
|
- int pidx;
|
|
|
-
|
|
|
- pidx = n % dev->rdi.ibdev.phys_port_cnt;
|
|
|
- ppd = &dd_from_dev(dev)->pport[pidx];
|
|
|
- ibp = &ppd->ibport_data;
|
|
|
-
|
|
|
- if (!(n & 1))
|
|
|
- qp = rcu_dereference(ibp->rvp.qp[0]);
|
|
|
- else
|
|
|
- qp = rcu_dereference(ibp->rvp.qp[1]);
|
|
|
- } else {
|
|
|
- qp = rcu_dereference(
|
|
|
- dev->rdi.qp_dev->qp_table[
|
|
|
- (n - iter->specials)]);
|
|
|
- }
|
|
|
- }
|
|
|
- pqp = qp;
|
|
|
- if (qp) {
|
|
|
- iter->qp = qp;
|
|
|
- iter->n = n;
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
static const char * const qp_type_str[] = {
|
|
|
"SMI", "GSI", "RC", "UC", "UD",
|
|
|
};
|
|
@@ -619,7 +543,12 @@ static int qp_idle(struct rvt_qp *qp)
|
|
|
qp->s_tail == qp->s_head;
|
|
|
}
|
|
|
|
|
|
-void qp_iter_print(struct seq_file *s, struct qp_iter *iter)
|
|
|
+/**
|
|
|
+ * qp_iter_print - print the qp information to seq_file
|
|
|
+ * @s: the seq_file to emit the qp information on
|
|
|
+ * @iter: the iterator for the qp hash list
|
|
|
+ */
|
|
|
+void qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter)
|
|
|
{
|
|
|
struct rvt_swqe *wqe;
|
|
|
struct rvt_qp *qp = iter->qp;
|