diff options
author | Doug Ledford <dledford@redhat.com> | 2016-12-14 14:44:08 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-12-14 14:44:08 -0500 |
commit | 253f8b22e0ad643edafd75e831e5c765732877f5 (patch) | |
tree | c0e682e339f287a70606927863b9cc622c9952f1 /drivers/infiniband/sw | |
parent | 884fa4f3048c4c43facfa6ba3b710169f7ee162c (diff) | |
parent | 22dccc5454a39427de7b87a080d026b6bf66a7b9 (diff) |
Merge branch 'hfi1' into merge-test
Diffstat (limited to 'drivers/infiniband/sw')
-rw-r--r-- | drivers/infiniband/sw/rdmavt/cq.c | 64 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/mcast.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/mr.c | 22 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/qp.c | 20 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/trace.h | 141 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/trace_mr.h | 112 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/trace_qp.h | 96 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/trace_rvt.h | 81 | ||||
-rw-r--r-- | drivers/infiniband/sw/rdmavt/trace_tx.h | 132 |
9 files changed, 486 insertions, 187 deletions
diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c index 6d9904a4a0ab..4d0b6992e847 100644 --- a/drivers/infiniband/sw/rdmavt/cq.c +++ b/drivers/infiniband/sw/rdmavt/cq.c | |||
@@ -119,18 +119,17 @@ void rvt_cq_enter(struct rvt_cq *cq, struct ib_wc *entry, bool solicited) | |||
119 | if (cq->notify == IB_CQ_NEXT_COMP || | 119 | if (cq->notify == IB_CQ_NEXT_COMP || |
120 | (cq->notify == IB_CQ_SOLICITED && | 120 | (cq->notify == IB_CQ_SOLICITED && |
121 | (solicited || entry->status != IB_WC_SUCCESS))) { | 121 | (solicited || entry->status != IB_WC_SUCCESS))) { |
122 | struct kthread_worker *worker; | ||
123 | /* | 122 | /* |
124 | * This will cause send_complete() to be called in | 123 | * This will cause send_complete() to be called in |
125 | * another thread. | 124 | * another thread. |
126 | */ | 125 | */ |
127 | smp_read_barrier_depends(); /* see rvt_cq_exit */ | 126 | spin_lock(&cq->rdi->n_cqs_lock); |
128 | worker = cq->rdi->worker; | 127 | if (likely(cq->rdi->worker)) { |
129 | if (likely(worker)) { | ||
130 | cq->notify = RVT_CQ_NONE; | 128 | cq->notify = RVT_CQ_NONE; |
131 | cq->triggered++; | 129 | cq->triggered++; |
132 | kthread_queue_work(worker, &cq->comptask); | 130 | kthread_queue_work(cq->rdi->worker, &cq->comptask); |
133 | } | 131 | } |
132 | spin_unlock(&cq->rdi->n_cqs_lock); | ||
134 | } | 133 | } |
135 | 134 | ||
136 | spin_unlock_irqrestore(&cq->lock, flags); | 135 | spin_unlock_irqrestore(&cq->lock, flags); |
@@ -240,15 +239,15 @@ struct ib_cq *rvt_create_cq(struct ib_device *ibdev, | |||
240 | } | 239 | } |
241 | } | 240 | } |
242 | 241 | ||
243 | spin_lock(&rdi->n_cqs_lock); | 242 | spin_lock_irq(&rdi->n_cqs_lock); |
244 | if (rdi->n_cqs_allocated == rdi->dparms.props.max_cq) { | 243 | if (rdi->n_cqs_allocated == rdi->dparms.props.max_cq) { |
245 | spin_unlock(&rdi->n_cqs_lock); | 244 | spin_unlock_irq(&rdi->n_cqs_lock); |
246 | ret = ERR_PTR(-ENOMEM); | 245 | ret = ERR_PTR(-ENOMEM); |
247 | goto bail_ip; | 246 | goto bail_ip; |
248 | } | 247 | } |
249 | 248 | ||
250 | rdi->n_cqs_allocated++; | 249 | rdi->n_cqs_allocated++; |
251 | spin_unlock(&rdi->n_cqs_lock); | 250 | spin_unlock_irq(&rdi->n_cqs_lock); |
252 | 251 | ||
253 | if (cq->ip) { | 252 | if (cq->ip) { |
254 | spin_lock_irq(&rdi->pending_lock); | 253 | spin_lock_irq(&rdi->pending_lock); |
@@ -296,9 +295,9 @@ int rvt_destroy_cq(struct ib_cq *ibcq) | |||
296 | struct rvt_dev_info *rdi = cq->rdi; | 295 | struct rvt_dev_info *rdi = cq->rdi; |
297 | 296 | ||
298 | kthread_flush_work(&cq->comptask); | 297 | kthread_flush_work(&cq->comptask); |
299 | spin_lock(&rdi->n_cqs_lock); | 298 | spin_lock_irq(&rdi->n_cqs_lock); |
300 | rdi->n_cqs_allocated--; | 299 | rdi->n_cqs_allocated--; |
301 | spin_unlock(&rdi->n_cqs_lock); | 300 | spin_unlock_irq(&rdi->n_cqs_lock); |
302 | if (cq->ip) | 301 | if (cq->ip) |
303 | kref_put(&cq->ip->ref, rvt_release_mmap_info); | 302 | kref_put(&cq->ip->ref, rvt_release_mmap_info); |
304 | else | 303 | else |
@@ -504,33 +503,23 @@ int rvt_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry) | |||
504 | */ | 503 | */ |
505 | int rvt_driver_cq_init(struct rvt_dev_info *rdi) | 504 | int rvt_driver_cq_init(struct rvt_dev_info *rdi) |
506 | { | 505 | { |
507 | int ret = 0; | ||
508 | int cpu; | 506 | int cpu; |
509 | struct task_struct *task; | 507 | struct kthread_worker *worker; |
510 | 508 | ||
511 | if (rdi->worker) | 509 | if (rdi->worker) |
512 | return 0; | 510 | return 0; |
511 | |||
513 | spin_lock_init(&rdi->n_cqs_lock); | 512 | spin_lock_init(&rdi->n_cqs_lock); |
514 | rdi->worker = kzalloc(sizeof(*rdi->worker), GFP_KERNEL); | ||
515 | if (!rdi->worker) | ||
516 | return -ENOMEM; | ||
517 | kthread_init_worker(rdi->worker); | ||
518 | task = kthread_create_on_node( | ||
519 | kthread_worker_fn, | ||
520 | rdi->worker, | ||
521 | rdi->dparms.node, | ||
522 | "%s", rdi->dparms.cq_name); | ||
523 | if (IS_ERR(task)) { | ||
524 | kfree(rdi->worker); | ||
525 | rdi->worker = NULL; | ||
526 | return PTR_ERR(task); | ||
527 | } | ||
528 | 513 | ||
529 | set_user_nice(task, MIN_NICE); | ||
530 | cpu = cpumask_first(cpumask_of_node(rdi->dparms.node)); | 514 | cpu = cpumask_first(cpumask_of_node(rdi->dparms.node)); |
531 | kthread_bind(task, cpu); | 515 | worker = kthread_create_worker_on_cpu(cpu, 0, |
532 | wake_up_process(task); | 516 | "%s", rdi->dparms.cq_name); |
533 | return ret; | 517 | if (IS_ERR(worker)) |
518 | return PTR_ERR(worker); | ||
519 | |||
520 | set_user_nice(worker->task, MIN_NICE); | ||
521 | rdi->worker = worker; | ||
522 | return 0; | ||
534 | } | 523 | } |
535 | 524 | ||
536 | /** | 525 | /** |
@@ -541,13 +530,14 @@ void rvt_cq_exit(struct rvt_dev_info *rdi) | |||
541 | { | 530 | { |
542 | struct kthread_worker *worker; | 531 | struct kthread_worker *worker; |
543 | 532 | ||
544 | worker = rdi->worker; | 533 | /* block future queuing from send_complete() */ |
545 | if (!worker) | 534 | spin_lock_irq(&rdi->n_cqs_lock); |
535 | if (!rdi->worker) { | ||
536 | spin_unlock_irq(&rdi->n_cqs_lock); | ||
546 | return; | 537 | return; |
547 | /* blocks future queuing from send_complete() */ | 538 | } |
548 | rdi->worker = NULL; | 539 | rdi->worker = NULL; |
549 | smp_wmb(); /* See rdi_cq_enter */ | 540 | spin_unlock_irq(&rdi->n_cqs_lock); |
550 | kthread_flush_worker(worker); | 541 | |
551 | kthread_stop(worker->task); | 542 | kthread_destroy_worker(worker); |
552 | kfree(worker); | ||
553 | } | 543 | } |
diff --git a/drivers/infiniband/sw/rdmavt/mcast.c b/drivers/infiniband/sw/rdmavt/mcast.c index 983d319ac976..05c8c2afb0e3 100644 --- a/drivers/infiniband/sw/rdmavt/mcast.c +++ b/drivers/infiniband/sw/rdmavt/mcast.c | |||
@@ -81,7 +81,7 @@ static struct rvt_mcast_qp *rvt_mcast_qp_alloc(struct rvt_qp *qp) | |||
81 | goto bail; | 81 | goto bail; |
82 | 82 | ||
83 | mqp->qp = qp; | 83 | mqp->qp = qp; |
84 | atomic_inc(&qp->refcount); | 84 | rvt_get_qp(qp); |
85 | 85 | ||
86 | bail: | 86 | bail: |
87 | return mqp; | 87 | return mqp; |
@@ -92,8 +92,7 @@ static void rvt_mcast_qp_free(struct rvt_mcast_qp *mqp) | |||
92 | struct rvt_qp *qp = mqp->qp; | 92 | struct rvt_qp *qp = mqp->qp; |
93 | 93 | ||
94 | /* Notify hfi1_destroy_qp() if it is waiting. */ | 94 | /* Notify hfi1_destroy_qp() if it is waiting. */ |
95 | if (atomic_dec_and_test(&qp->refcount)) | 95 | rvt_put_qp(qp); |
96 | wake_up(&qp->wait); | ||
97 | 96 | ||
98 | kfree(mqp); | 97 | kfree(mqp); |
99 | } | 98 | } |
diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 46b64970058e..52fd15276ee6 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <rdma/rdma_vt.h> | 51 | #include <rdma/rdma_vt.h> |
52 | #include "vt.h" | 52 | #include "vt.h" |
53 | #include "mr.h" | 53 | #include "mr.h" |
54 | #include "trace.h" | ||
54 | 55 | ||
55 | /** | 56 | /** |
56 | * rvt_driver_mr_init - Init MR resources per driver | 57 | * rvt_driver_mr_init - Init MR resources per driver |
@@ -84,6 +85,7 @@ int rvt_driver_mr_init(struct rvt_dev_info *rdi) | |||
84 | lkey_table_size = rdi->dparms.lkey_table_size; | 85 | lkey_table_size = rdi->dparms.lkey_table_size; |
85 | } | 86 | } |
86 | rdi->lkey_table.max = 1 << lkey_table_size; | 87 | rdi->lkey_table.max = 1 << lkey_table_size; |
88 | rdi->lkey_table.shift = 32 - lkey_table_size; | ||
87 | lk_tab_size = rdi->lkey_table.max * sizeof(*rdi->lkey_table.table); | 89 | lk_tab_size = rdi->lkey_table.max * sizeof(*rdi->lkey_table.table); |
88 | rdi->lkey_table.table = (struct rvt_mregion __rcu **) | 90 | rdi->lkey_table.table = (struct rvt_mregion __rcu **) |
89 | vmalloc_node(lk_tab_size, rdi->dparms.node); | 91 | vmalloc_node(lk_tab_size, rdi->dparms.node); |
@@ -402,6 +404,7 @@ struct ib_mr *rvt_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | |||
402 | } | 404 | } |
403 | mr->mr.map[m]->segs[n].vaddr = vaddr; | 405 | mr->mr.map[m]->segs[n].vaddr = vaddr; |
404 | mr->mr.map[m]->segs[n].length = umem->page_size; | 406 | mr->mr.map[m]->segs[n].length = umem->page_size; |
407 | trace_rvt_mr_user_seg(&mr->mr, m, n, vaddr, umem->page_size); | ||
405 | n++; | 408 | n++; |
406 | if (n == RVT_SEGSZ) { | 409 | if (n == RVT_SEGSZ) { |
407 | m++; | 410 | m++; |
@@ -506,6 +509,7 @@ static int rvt_set_page(struct ib_mr *ibmr, u64 addr) | |||
506 | n = mapped_segs % RVT_SEGSZ; | 509 | n = mapped_segs % RVT_SEGSZ; |
507 | mr->mr.map[m]->segs[n].vaddr = (void *)addr; | 510 | mr->mr.map[m]->segs[n].vaddr = (void *)addr; |
508 | mr->mr.map[m]->segs[n].length = ps; | 511 | mr->mr.map[m]->segs[n].length = ps; |
512 | trace_rvt_mr_page_seg(&mr->mr, m, n, (void *)addr, ps); | ||
509 | mr->mr.length += ps; | 513 | mr->mr.length += ps; |
510 | 514 | ||
511 | return 0; | 515 | return 0; |
@@ -692,6 +696,7 @@ int rvt_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list, | |||
692 | for (i = 0; i < list_len; i++) { | 696 | for (i = 0; i < list_len; i++) { |
693 | fmr->mr.map[m]->segs[n].vaddr = (void *)page_list[i]; | 697 | fmr->mr.map[m]->segs[n].vaddr = (void *)page_list[i]; |
694 | fmr->mr.map[m]->segs[n].length = ps; | 698 | fmr->mr.map[m]->segs[n].length = ps; |
699 | trace_rvt_mr_fmr_seg(&fmr->mr, m, n, (void *)page_list[i], ps); | ||
695 | if (++n == RVT_SEGSZ) { | 700 | if (++n == RVT_SEGSZ) { |
696 | m++; | 701 | m++; |
697 | n = 0; | 702 | n = 0; |
@@ -774,7 +779,6 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, | |||
774 | struct rvt_mregion *mr; | 779 | struct rvt_mregion *mr; |
775 | unsigned n, m; | 780 | unsigned n, m; |
776 | size_t off; | 781 | size_t off; |
777 | struct rvt_dev_info *dev = ib_to_rvt(pd->ibpd.device); | ||
778 | 782 | ||
779 | /* | 783 | /* |
780 | * We use LKEY == zero for kernel virtual addresses | 784 | * We use LKEY == zero for kernel virtual addresses |
@@ -782,12 +786,14 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, | |||
782 | */ | 786 | */ |
783 | rcu_read_lock(); | 787 | rcu_read_lock(); |
784 | if (sge->lkey == 0) { | 788 | if (sge->lkey == 0) { |
789 | struct rvt_dev_info *dev = ib_to_rvt(pd->ibpd.device); | ||
790 | |||
785 | if (pd->user) | 791 | if (pd->user) |
786 | goto bail; | 792 | goto bail; |
787 | mr = rcu_dereference(dev->dma_mr); | 793 | mr = rcu_dereference(dev->dma_mr); |
788 | if (!mr) | 794 | if (!mr) |
789 | goto bail; | 795 | goto bail; |
790 | atomic_inc(&mr->refcount); | 796 | rvt_get_mr(mr); |
791 | rcu_read_unlock(); | 797 | rcu_read_unlock(); |
792 | 798 | ||
793 | isge->mr = mr; | 799 | isge->mr = mr; |
@@ -798,8 +804,7 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, | |||
798 | isge->n = 0; | 804 | isge->n = 0; |
799 | goto ok; | 805 | goto ok; |
800 | } | 806 | } |
801 | mr = rcu_dereference( | 807 | mr = rcu_dereference(rkt->table[sge->lkey >> rkt->shift]); |
802 | rkt->table[(sge->lkey >> (32 - dev->dparms.lkey_table_size))]); | ||
803 | if (unlikely(!mr || atomic_read(&mr->lkey_invalid) || | 808 | if (unlikely(!mr || atomic_read(&mr->lkey_invalid) || |
804 | mr->lkey != sge->lkey || mr->pd != &pd->ibpd)) | 809 | mr->lkey != sge->lkey || mr->pd != &pd->ibpd)) |
805 | goto bail; | 810 | goto bail; |
@@ -809,7 +814,7 @@ int rvt_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd, | |||
809 | off + sge->length > mr->length || | 814 | off + sge->length > mr->length || |
810 | (mr->access_flags & acc) != acc)) | 815 | (mr->access_flags & acc) != acc)) |
811 | goto bail; | 816 | goto bail; |
812 | atomic_inc(&mr->refcount); | 817 | rvt_get_mr(mr); |
813 | rcu_read_unlock(); | 818 | rcu_read_unlock(); |
814 | 819 | ||
815 | off += mr->offset; | 820 | off += mr->offset; |
@@ -887,7 +892,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge, | |||
887 | mr = rcu_dereference(rdi->dma_mr); | 892 | mr = rcu_dereference(rdi->dma_mr); |
888 | if (!mr) | 893 | if (!mr) |
889 | goto bail; | 894 | goto bail; |
890 | atomic_inc(&mr->refcount); | 895 | rvt_get_mr(mr); |
891 | rcu_read_unlock(); | 896 | rcu_read_unlock(); |
892 | 897 | ||
893 | sge->mr = mr; | 898 | sge->mr = mr; |
@@ -899,8 +904,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge, | |||
899 | goto ok; | 904 | goto ok; |
900 | } | 905 | } |
901 | 906 | ||
902 | mr = rcu_dereference( | 907 | mr = rcu_dereference(rkt->table[rkey >> rkt->shift]); |
903 | rkt->table[(rkey >> (32 - dev->dparms.lkey_table_size))]); | ||
904 | if (unlikely(!mr || atomic_read(&mr->lkey_invalid) || | 908 | if (unlikely(!mr || atomic_read(&mr->lkey_invalid) || |
905 | mr->lkey != rkey || qp->ibqp.pd != mr->pd)) | 909 | mr->lkey != rkey || qp->ibqp.pd != mr->pd)) |
906 | goto bail; | 910 | goto bail; |
@@ -909,7 +913,7 @@ int rvt_rkey_ok(struct rvt_qp *qp, struct rvt_sge *sge, | |||
909 | if (unlikely(vaddr < mr->iova || off + len > mr->length || | 913 | if (unlikely(vaddr < mr->iova || off + len > mr->length || |
910 | (mr->access_flags & acc) == 0)) | 914 | (mr->access_flags & acc) == 0)) |
911 | goto bail; | 915 | goto bail; |
912 | atomic_inc(&mr->refcount); | 916 | rvt_get_mr(mr); |
913 | rcu_read_unlock(); | 917 | rcu_read_unlock(); |
914 | 918 | ||
915 | off += mr->offset; | 919 | off += mr->offset; |
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index 6500c3b5a89c..2a13ac660f2b 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c | |||
@@ -76,6 +76,23 @@ const int ib_rvt_state_ops[IB_QPS_ERR + 1] = { | |||
76 | }; | 76 | }; |
77 | EXPORT_SYMBOL(ib_rvt_state_ops); | 77 | EXPORT_SYMBOL(ib_rvt_state_ops); |
78 | 78 | ||
79 | /* | ||
80 | * Translate ib_wr_opcode into ib_wc_opcode. | ||
81 | */ | ||
82 | const enum ib_wc_opcode ib_rvt_wc_opcode[] = { | ||
83 | [IB_WR_RDMA_WRITE] = IB_WC_RDMA_WRITE, | ||
84 | [IB_WR_RDMA_WRITE_WITH_IMM] = IB_WC_RDMA_WRITE, | ||
85 | [IB_WR_SEND] = IB_WC_SEND, | ||
86 | [IB_WR_SEND_WITH_IMM] = IB_WC_SEND, | ||
87 | [IB_WR_RDMA_READ] = IB_WC_RDMA_READ, | ||
88 | [IB_WR_ATOMIC_CMP_AND_SWP] = IB_WC_COMP_SWAP, | ||
89 | [IB_WR_ATOMIC_FETCH_AND_ADD] = IB_WC_FETCH_ADD, | ||
90 | [IB_WR_SEND_WITH_INV] = IB_WC_SEND, | ||
91 | [IB_WR_LOCAL_INV] = IB_WC_LOCAL_INV, | ||
92 | [IB_WR_REG_MR] = IB_WC_REG_MR | ||
93 | }; | ||
94 | EXPORT_SYMBOL(ib_rvt_wc_opcode); | ||
95 | |||
79 | static void get_map_page(struct rvt_qpn_table *qpt, | 96 | static void get_map_page(struct rvt_qpn_table *qpt, |
80 | struct rvt_qpn_map *map, | 97 | struct rvt_qpn_map *map, |
81 | gfp_t gfp) | 98 | gfp_t gfp) |
@@ -884,7 +901,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, | |||
884 | return ret; | 901 | return ret; |
885 | 902 | ||
886 | bail_ip: | 903 | bail_ip: |
887 | kref_put(&qp->ip->ref, rvt_release_mmap_info); | 904 | if (qp->ip) |
905 | kref_put(&qp->ip->ref, rvt_release_mmap_info); | ||
888 | 906 | ||
889 | bail_qpn: | 907 | bail_qpn: |
890 | free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num); | 908 | free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num); |
diff --git a/drivers/infiniband/sw/rdmavt/trace.h b/drivers/infiniband/sw/rdmavt/trace.h index 6c0457db5499..e2d23acb6a7d 100644 --- a/drivers/infiniband/sw/rdmavt/trace.h +++ b/drivers/infiniband/sw/rdmavt/trace.h | |||
@@ -45,143 +45,10 @@ | |||
45 | * | 45 | * |
46 | */ | 46 | */ |
47 | 47 | ||
48 | #undef TRACE_SYSTEM_VAR | ||
49 | #define TRACE_SYSTEM_VAR rdmavt | ||
50 | |||
51 | #if !defined(__RDMAVT_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) | ||
52 | #define __RDMAVT_TRACE_H | ||
53 | |||
54 | #include <linux/tracepoint.h> | ||
55 | #include <linux/trace_seq.h> | ||
56 | |||
57 | #include <rdma/ib_verbs.h> | ||
58 | #include <rdma/rdma_vt.h> | ||
59 | |||
60 | #define RDI_DEV_ENTRY(rdi) __string(dev, rdi->driver_f.get_card_name(rdi)) | 48 | #define RDI_DEV_ENTRY(rdi) __string(dev, rdi->driver_f.get_card_name(rdi)) |
61 | #define RDI_DEV_ASSIGN(rdi) __assign_str(dev, rdi->driver_f.get_card_name(rdi)) | 49 | #define RDI_DEV_ASSIGN(rdi) __assign_str(dev, rdi->driver_f.get_card_name(rdi)) |
62 | 50 | ||
63 | #undef TRACE_SYSTEM | 51 | #include "trace_rvt.h" |
64 | #define TRACE_SYSTEM rdmavt | 52 | #include "trace_qp.h" |
65 | 53 | #include "trace_tx.h" | |
66 | TRACE_EVENT(rvt_dbg, | 54 | #include "trace_mr.h" |
67 | TP_PROTO(struct rvt_dev_info *rdi, | ||
68 | const char *msg), | ||
69 | TP_ARGS(rdi, msg), | ||
70 | TP_STRUCT__entry( | ||
71 | RDI_DEV_ENTRY(rdi) | ||
72 | __string(msg, msg) | ||
73 | ), | ||
74 | TP_fast_assign( | ||
75 | RDI_DEV_ASSIGN(rdi); | ||
76 | __assign_str(msg, msg); | ||
77 | ), | ||
78 | TP_printk("[%s]: %s", __get_str(dev), __get_str(msg)) | ||
79 | ); | ||
80 | |||
81 | #undef TRACE_SYSTEM | ||
82 | #define TRACE_SYSTEM rvt_qphash | ||
83 | DECLARE_EVENT_CLASS(rvt_qphash_template, | ||
84 | TP_PROTO(struct rvt_qp *qp, u32 bucket), | ||
85 | TP_ARGS(qp, bucket), | ||
86 | TP_STRUCT__entry( | ||
87 | RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) | ||
88 | __field(u32, qpn) | ||
89 | __field(u32, bucket) | ||
90 | ), | ||
91 | TP_fast_assign( | ||
92 | RDI_DEV_ASSIGN(ib_to_rvt(qp->ibqp.device)) | ||
93 | __entry->qpn = qp->ibqp.qp_num; | ||
94 | __entry->bucket = bucket; | ||
95 | ), | ||
96 | TP_printk( | ||
97 | "[%s] qpn 0x%x bucket %u", | ||
98 | __get_str(dev), | ||
99 | __entry->qpn, | ||
100 | __entry->bucket | ||
101 | ) | ||
102 | ); | ||
103 | |||
104 | DEFINE_EVENT(rvt_qphash_template, rvt_qpinsert, | ||
105 | TP_PROTO(struct rvt_qp *qp, u32 bucket), | ||
106 | TP_ARGS(qp, bucket)); | ||
107 | |||
108 | DEFINE_EVENT(rvt_qphash_template, rvt_qpremove, | ||
109 | TP_PROTO(struct rvt_qp *qp, u32 bucket), | ||
110 | TP_ARGS(qp, bucket)); | ||
111 | |||
112 | #undef TRACE_SYSTEM | ||
113 | #define TRACE_SYSTEM rvt_tx | ||
114 | |||
115 | #define wr_opcode_name(opcode) { IB_WR_##opcode, #opcode } | ||
116 | #define show_wr_opcode(opcode) \ | ||
117 | __print_symbolic(opcode, \ | ||
118 | wr_opcode_name(RDMA_WRITE), \ | ||
119 | wr_opcode_name(RDMA_WRITE_WITH_IMM), \ | ||
120 | wr_opcode_name(SEND), \ | ||
121 | wr_opcode_name(SEND_WITH_IMM), \ | ||
122 | wr_opcode_name(RDMA_READ), \ | ||
123 | wr_opcode_name(ATOMIC_CMP_AND_SWP), \ | ||
124 | wr_opcode_name(ATOMIC_FETCH_AND_ADD), \ | ||
125 | wr_opcode_name(LSO), \ | ||
126 | wr_opcode_name(SEND_WITH_INV), \ | ||
127 | wr_opcode_name(RDMA_READ_WITH_INV), \ | ||
128 | wr_opcode_name(LOCAL_INV), \ | ||
129 | wr_opcode_name(MASKED_ATOMIC_CMP_AND_SWP), \ | ||
130 | wr_opcode_name(MASKED_ATOMIC_FETCH_AND_ADD)) | ||
131 | |||
132 | #define POS_PRN \ | ||
133 | "[%s] wr_id %llx qpn %x psn 0x%x lpsn 0x%x length %u opcode 0x%.2x,%s size %u avail %u head %u last %u" | ||
134 | |||
135 | TRACE_EVENT( | ||
136 | rvt_post_one_wr, | ||
137 | TP_PROTO(struct rvt_qp *qp, struct rvt_swqe *wqe), | ||
138 | TP_ARGS(qp, wqe), | ||
139 | TP_STRUCT__entry( | ||
140 | RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) | ||
141 | __field(u64, wr_id) | ||
142 | __field(u32, qpn) | ||
143 | __field(u32, psn) | ||
144 | __field(u32, lpsn) | ||
145 | __field(u32, length) | ||
146 | __field(u32, opcode) | ||
147 | __field(u32, size) | ||
148 | __field(u32, avail) | ||
149 | __field(u32, head) | ||
150 | __field(u32, last) | ||
151 | ), | ||
152 | TP_fast_assign( | ||
153 | RDI_DEV_ASSIGN(ib_to_rvt(qp->ibqp.device)) | ||
154 | __entry->wr_id = wqe->wr.wr_id; | ||
155 | __entry->qpn = qp->ibqp.qp_num; | ||
156 | __entry->psn = wqe->psn; | ||
157 | __entry->lpsn = wqe->lpsn; | ||
158 | __entry->length = wqe->length; | ||
159 | __entry->opcode = wqe->wr.opcode; | ||
160 | __entry->size = qp->s_size; | ||
161 | __entry->avail = qp->s_avail; | ||
162 | __entry->head = qp->s_head; | ||
163 | __entry->last = qp->s_last; | ||
164 | ), | ||
165 | TP_printk( | ||
166 | POS_PRN, | ||
167 | __get_str(dev), | ||
168 | __entry->wr_id, | ||
169 | __entry->qpn, | ||
170 | __entry->psn, | ||
171 | __entry->lpsn, | ||
172 | __entry->length, | ||
173 | __entry->opcode, show_wr_opcode(__entry->opcode), | ||
174 | __entry->size, | ||
175 | __entry->avail, | ||
176 | __entry->head, | ||
177 | __entry->last | ||
178 | ) | ||
179 | ); | ||
180 | |||
181 | #endif /* __RDMAVT_TRACE_H */ | ||
182 | |||
183 | #undef TRACE_INCLUDE_PATH | ||
184 | #undef TRACE_INCLUDE_FILE | ||
185 | #define TRACE_INCLUDE_PATH . | ||
186 | #define TRACE_INCLUDE_FILE trace | ||
187 | #include <trace/define_trace.h> | ||
diff --git a/drivers/infiniband/sw/rdmavt/trace_mr.h b/drivers/infiniband/sw/rdmavt/trace_mr.h new file mode 100644 index 000000000000..3318a6c36373 --- /dev/null +++ b/drivers/infiniband/sw/rdmavt/trace_mr.h | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2016 Intel Corporation. | ||
3 | * | ||
4 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
5 | * redistributing this file, you may do so under either license. | ||
6 | * | ||
7 | * GPL LICENSE SUMMARY | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * BSD LICENSE | ||
19 | * | ||
20 | * Redistribution and use in source and binary forms, with or without | ||
21 | * modification, are permitted provided that the following conditions | ||
22 | * are met: | ||
23 | * | ||
24 | * - Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * - Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in | ||
28 | * the documentation and/or other materials provided with the | ||
29 | * distribution. | ||
30 | * - Neither the name of Intel Corporation nor the names of its | ||
31 | * contributors may be used to endorse or promote products derived | ||
32 | * from this software without specific prior written permission. | ||
33 | * | ||
34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
45 | * | ||
46 | */ | ||
47 | #if !defined(__RVT_TRACE_MR_H) || defined(TRACE_HEADER_MULTI_READ) | ||
48 | #define __RVT_TRACE_MR_H | ||
49 | |||
50 | #include <linux/tracepoint.h> | ||
51 | #include <linux/trace_seq.h> | ||
52 | |||
53 | #include <rdma/ib_verbs.h> | ||
54 | #include <rdma/rdma_vt.h> | ||
55 | #include <rdma/rdmavt_mr.h> | ||
56 | |||
57 | #undef TRACE_SYSTEM | ||
58 | #define TRACE_SYSTEM rvt_mr | ||
59 | DECLARE_EVENT_CLASS( | ||
60 | rvt_mr_template, | ||
61 | TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), | ||
62 | TP_ARGS(mr, m, n, v, len), | ||
63 | TP_STRUCT__entry( | ||
64 | RDI_DEV_ENTRY(ib_to_rvt(mr->pd->device)) | ||
65 | __field(void *, vaddr) | ||
66 | __field(struct page *, page) | ||
67 | __field(size_t, len) | ||
68 | __field(u32, lkey) | ||
69 | __field(u16, m) | ||
70 | __field(u16, n) | ||
71 | ), | ||
72 | TP_fast_assign( | ||
73 | RDI_DEV_ASSIGN(ib_to_rvt(mr->pd->device)); | ||
74 | __entry->vaddr = v; | ||
75 | __entry->page = virt_to_page(v); | ||
76 | __entry->m = m; | ||
77 | __entry->n = n; | ||
78 | __entry->len = len; | ||
79 | ), | ||
80 | TP_printk( | ||
81 | "[%s] vaddr %p page %p m %u n %u len %ld", | ||
82 | __get_str(dev), | ||
83 | __entry->vaddr, | ||
84 | __entry->page, | ||
85 | __entry->m, | ||
86 | __entry->n, | ||
87 | __entry->len | ||
88 | ) | ||
89 | ); | ||
90 | |||
91 | DEFINE_EVENT( | ||
92 | rvt_mr_template, rvt_mr_page_seg, | ||
93 | TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), | ||
94 | TP_ARGS(mr, m, n, v, len)); | ||
95 | |||
96 | DEFINE_EVENT( | ||
97 | rvt_mr_template, rvt_mr_fmr_seg, | ||
98 | TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), | ||
99 | TP_ARGS(mr, m, n, v, len)); | ||
100 | |||
101 | DEFINE_EVENT( | ||
102 | rvt_mr_template, rvt_mr_user_seg, | ||
103 | TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), | ||
104 | TP_ARGS(mr, m, n, v, len)); | ||
105 | |||
106 | #endif /* __RVT_TRACE_MR_H */ | ||
107 | |||
108 | #undef TRACE_INCLUDE_PATH | ||
109 | #undef TRACE_INCLUDE_FILE | ||
110 | #define TRACE_INCLUDE_PATH . | ||
111 | #define TRACE_INCLUDE_FILE trace_mr | ||
112 | #include <trace/define_trace.h> | ||
diff --git a/drivers/infiniband/sw/rdmavt/trace_qp.h b/drivers/infiniband/sw/rdmavt/trace_qp.h new file mode 100644 index 000000000000..4c77a3119bda --- /dev/null +++ b/drivers/infiniband/sw/rdmavt/trace_qp.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2016 Intel Corporation. | ||
3 | * | ||
4 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
5 | * redistributing this file, you may do so under either license. | ||
6 | * | ||
7 | * GPL LICENSE SUMMARY | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * BSD LICENSE | ||
19 | * | ||
20 | * Redistribution and use in source and binary forms, with or without | ||
21 | * modification, are permitted provided that the following conditions | ||
22 | * are met: | ||
23 | * | ||
24 | * - Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * - Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in | ||
28 | * the documentation and/or other materials provided with the | ||
29 | * distribution. | ||
30 | * - Neither the name of Intel Corporation nor the names of its | ||
31 | * contributors may be used to endorse or promote products derived | ||
32 | * from this software without specific prior written permission. | ||
33 | * | ||
34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
45 | * | ||
46 | */ | ||
47 | #if !defined(__RVT_TRACE_QP_H) || defined(TRACE_HEADER_MULTI_READ) | ||
48 | #define __RVT_TRACE_QP_H | ||
49 | |||
50 | #include <linux/tracepoint.h> | ||
51 | #include <linux/trace_seq.h> | ||
52 | |||
53 | #include <rdma/ib_verbs.h> | ||
54 | #include <rdma/rdma_vt.h> | ||
55 | |||
56 | #undef TRACE_SYSTEM | ||
57 | #define TRACE_SYSTEM rvt_qp | ||
58 | |||
59 | DECLARE_EVENT_CLASS(rvt_qphash_template, | ||
60 | TP_PROTO(struct rvt_qp *qp, u32 bucket), | ||
61 | TP_ARGS(qp, bucket), | ||
62 | TP_STRUCT__entry( | ||
63 | RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) | ||
64 | __field(u32, qpn) | ||
65 | __field(u32, bucket) | ||
66 | ), | ||
67 | TP_fast_assign( | ||
68 | RDI_DEV_ASSIGN(ib_to_rvt(qp->ibqp.device)) | ||
69 | __entry->qpn = qp->ibqp.qp_num; | ||
70 | __entry->bucket = bucket; | ||
71 | ), | ||
72 | TP_printk( | ||
73 | "[%s] qpn 0x%x bucket %u", | ||
74 | __get_str(dev), | ||
75 | __entry->qpn, | ||
76 | __entry->bucket | ||
77 | ) | ||
78 | ); | ||
79 | |||
80 | DEFINE_EVENT(rvt_qphash_template, rvt_qpinsert, | ||
81 | TP_PROTO(struct rvt_qp *qp, u32 bucket), | ||
82 | TP_ARGS(qp, bucket)); | ||
83 | |||
84 | DEFINE_EVENT(rvt_qphash_template, rvt_qpremove, | ||
85 | TP_PROTO(struct rvt_qp *qp, u32 bucket), | ||
86 | TP_ARGS(qp, bucket)); | ||
87 | |||
88 | |||
89 | #endif /* __RVT_TRACE_QP_H */ | ||
90 | |||
91 | #undef TRACE_INCLUDE_PATH | ||
92 | #undef TRACE_INCLUDE_FILE | ||
93 | #define TRACE_INCLUDE_PATH . | ||
94 | #define TRACE_INCLUDE_FILE trace_qp | ||
95 | #include <trace/define_trace.h> | ||
96 | |||
diff --git a/drivers/infiniband/sw/rdmavt/trace_rvt.h b/drivers/infiniband/sw/rdmavt/trace_rvt.h new file mode 100644 index 000000000000..746f33461d9a --- /dev/null +++ b/drivers/infiniband/sw/rdmavt/trace_rvt.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2016 Intel Corporation. | ||
3 | * | ||
4 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
5 | * redistributing this file, you may do so under either license. | ||
6 | * | ||
7 | * GPL LICENSE SUMMARY | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * BSD LICENSE | ||
19 | * | ||
20 | * Redistribution and use in source and binary forms, with or without | ||
21 | * modification, are permitted provided that the following conditions | ||
22 | * are met: | ||
23 | * | ||
24 | * - Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * - Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in | ||
28 | * the documentation and/or other materials provided with the | ||
29 | * distribution. | ||
30 | * - Neither the name of Intel Corporation nor the names of its | ||
31 | * contributors may be used to endorse or promote products derived | ||
32 | * from this software without specific prior written permission. | ||
33 | * | ||
34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
45 | * | ||
46 | */ | ||
47 | #if !defined(__RVT_TRACE_RVT_H) || defined(TRACE_HEADER_MULTI_READ) | ||
48 | #define __RVT_TRACE_RVT_H | ||
49 | |||
50 | #include <linux/tracepoint.h> | ||
51 | #include <linux/trace_seq.h> | ||
52 | |||
53 | #include <rdma/ib_verbs.h> | ||
54 | #include <rdma/rdma_vt.h> | ||
55 | |||
56 | #undef TRACE_SYSTEM | ||
57 | #define TRACE_SYSTEM rvt | ||
58 | |||
59 | TRACE_EVENT(rvt_dbg, | ||
60 | TP_PROTO(struct rvt_dev_info *rdi, | ||
61 | const char *msg), | ||
62 | TP_ARGS(rdi, msg), | ||
63 | TP_STRUCT__entry( | ||
64 | RDI_DEV_ENTRY(rdi) | ||
65 | __string(msg, msg) | ||
66 | ), | ||
67 | TP_fast_assign( | ||
68 | RDI_DEV_ASSIGN(rdi); | ||
69 | __assign_str(msg, msg); | ||
70 | ), | ||
71 | TP_printk("[%s]: %s", __get_str(dev), __get_str(msg)) | ||
72 | ); | ||
73 | |||
74 | #endif /* __RVT_TRACE_MISC_H */ | ||
75 | |||
76 | #undef TRACE_INCLUDE_PATH | ||
77 | #undef TRACE_INCLUDE_FILE | ||
78 | #define TRACE_INCLUDE_PATH . | ||
79 | #define TRACE_INCLUDE_FILE trace_rvt | ||
80 | #include <trace/define_trace.h> | ||
81 | |||
diff --git a/drivers/infiniband/sw/rdmavt/trace_tx.h b/drivers/infiniband/sw/rdmavt/trace_tx.h new file mode 100644 index 000000000000..0e03173662d8 --- /dev/null +++ b/drivers/infiniband/sw/rdmavt/trace_tx.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * Copyright(c) 2016 Intel Corporation. | ||
3 | * | ||
4 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
5 | * redistributing this file, you may do so under either license. | ||
6 | * | ||
7 | * GPL LICENSE SUMMARY | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * BSD LICENSE | ||
19 | * | ||
20 | * Redistribution and use in source and binary forms, with or without | ||
21 | * modification, are permitted provided that the following conditions | ||
22 | * are met: | ||
23 | * | ||
24 | * - Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * - Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in | ||
28 | * the documentation and/or other materials provided with the | ||
29 | * distribution. | ||
30 | * - Neither the name of Intel Corporation nor the names of its | ||
31 | * contributors may be used to endorse or promote products derived | ||
32 | * from this software without specific prior written permission. | ||
33 | * | ||
34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
35 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
36 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
37 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
38 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
39 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
40 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
41 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
42 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
43 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
44 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
45 | * | ||
46 | */ | ||
47 | #if !defined(__RVT_TRACE_TX_H) || defined(TRACE_HEADER_MULTI_READ) | ||
48 | #define __RVT_TRACE_TX_H | ||
49 | |||
50 | #include <linux/tracepoint.h> | ||
51 | #include <linux/trace_seq.h> | ||
52 | |||
53 | #include <rdma/ib_verbs.h> | ||
54 | #include <rdma/rdma_vt.h> | ||
55 | |||
56 | #undef TRACE_SYSTEM | ||
57 | #define TRACE_SYSTEM rvt_tx | ||
58 | |||
59 | #define wr_opcode_name(opcode) { IB_WR_##opcode, #opcode } | ||
60 | #define show_wr_opcode(opcode) \ | ||
61 | __print_symbolic(opcode, \ | ||
62 | wr_opcode_name(RDMA_WRITE), \ | ||
63 | wr_opcode_name(RDMA_WRITE_WITH_IMM), \ | ||
64 | wr_opcode_name(SEND), \ | ||
65 | wr_opcode_name(SEND_WITH_IMM), \ | ||
66 | wr_opcode_name(RDMA_READ), \ | ||
67 | wr_opcode_name(ATOMIC_CMP_AND_SWP), \ | ||
68 | wr_opcode_name(ATOMIC_FETCH_AND_ADD), \ | ||
69 | wr_opcode_name(LSO), \ | ||
70 | wr_opcode_name(SEND_WITH_INV), \ | ||
71 | wr_opcode_name(RDMA_READ_WITH_INV), \ | ||
72 | wr_opcode_name(LOCAL_INV), \ | ||
73 | wr_opcode_name(MASKED_ATOMIC_CMP_AND_SWP), \ | ||
74 | wr_opcode_name(MASKED_ATOMIC_FETCH_AND_ADD)) | ||
75 | |||
76 | #define POS_PRN \ | ||
77 | "[%s] wr_id %llx qpn %x psn 0x%x lpsn 0x%x length %u opcode 0x%.2x,%s size %u avail %u head %u last %u" | ||
78 | |||
79 | TRACE_EVENT( | ||
80 | rvt_post_one_wr, | ||
81 | TP_PROTO(struct rvt_qp *qp, struct rvt_swqe *wqe), | ||
82 | TP_ARGS(qp, wqe), | ||
83 | TP_STRUCT__entry( | ||
84 | RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) | ||
85 | __field(u64, wr_id) | ||
86 | __field(u32, qpn) | ||
87 | __field(u32, psn) | ||
88 | __field(u32, lpsn) | ||
89 | __field(u32, length) | ||
90 | __field(u32, opcode) | ||
91 | __field(u32, size) | ||
92 | __field(u32, avail) | ||
93 | __field(u32, head) | ||
94 | __field(u32, last) | ||
95 | ), | ||
96 | TP_fast_assign( | ||
97 | RDI_DEV_ASSIGN(ib_to_rvt(qp->ibqp.device)) | ||
98 | __entry->wr_id = wqe->wr.wr_id; | ||
99 | __entry->qpn = qp->ibqp.qp_num; | ||
100 | __entry->psn = wqe->psn; | ||
101 | __entry->lpsn = wqe->lpsn; | ||
102 | __entry->length = wqe->length; | ||
103 | __entry->opcode = wqe->wr.opcode; | ||
104 | __entry->size = qp->s_size; | ||
105 | __entry->avail = qp->s_avail; | ||
106 | __entry->head = qp->s_head; | ||
107 | __entry->last = qp->s_last; | ||
108 | ), | ||
109 | TP_printk( | ||
110 | POS_PRN, | ||
111 | __get_str(dev), | ||
112 | __entry->wr_id, | ||
113 | __entry->qpn, | ||
114 | __entry->psn, | ||
115 | __entry->lpsn, | ||
116 | __entry->length, | ||
117 | __entry->opcode, show_wr_opcode(__entry->opcode), | ||
118 | __entry->size, | ||
119 | __entry->avail, | ||
120 | __entry->head, | ||
121 | __entry->last | ||
122 | ) | ||
123 | ); | ||
124 | |||
125 | #endif /* __RVT_TRACE_TX_H */ | ||
126 | |||
127 | #undef TRACE_INCLUDE_PATH | ||
128 | #undef TRACE_INCLUDE_FILE | ||
129 | #define TRACE_INCLUDE_PATH . | ||
130 | #define TRACE_INCLUDE_FILE trace_tx | ||
131 | #include <trace/define_trace.h> | ||
132 | |||