diff options
| -rw-r--r-- | drivers/infiniband/hw/hfi1/iowait.h | 9 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/qp.c | 4 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/qp.h | 13 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/rc.c | 10 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/ruc.c | 23 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/uc.c | 6 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/ud.c | 27 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/verbs.c | 10 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/verbs.h | 11 | ||||
| -rw-r--r-- | drivers/infiniband/hw/hfi1/verbs_txreq.h | 7 |
10 files changed, 61 insertions, 59 deletions
diff --git a/drivers/infiniband/hw/hfi1/iowait.h b/drivers/infiniband/hw/hfi1/iowait.h index 591697d85eed..3d9c32c7c340 100644 --- a/drivers/infiniband/hw/hfi1/iowait.h +++ b/drivers/infiniband/hw/hfi1/iowait.h | |||
| @@ -371,4 +371,13 @@ static inline void iowait_starve_find_max(struct iowait *w, u8 *max, | |||
| 371 | } | 371 | } |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | /** | ||
| 375 | * iowait_packet_queued() - determine if a packet is already built | ||
| 376 | * @wait: the wait structure | ||
| 377 | */ | ||
| 378 | static inline bool iowait_packet_queued(struct iowait *wait) | ||
| 379 | { | ||
| 380 | return !list_empty(&wait->tx_head); | ||
| 381 | } | ||
| 382 | |||
| 374 | #endif | 383 | #endif |
diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c index 5507910e8b8a..d30dd1a5b0a6 100644 --- a/drivers/infiniband/hw/hfi1/qp.c +++ b/drivers/infiniband/hw/hfi1/qp.c | |||
| @@ -565,7 +565,7 @@ void qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter) | |||
| 565 | if (qp->s_ack_queue) | 565 | if (qp->s_ack_queue) |
| 566 | e = &qp->s_ack_queue[qp->s_tail_ack_queue]; | 566 | e = &qp->s_ack_queue[qp->s_tail_ack_queue]; |
| 567 | seq_printf(s, | 567 | seq_printf(s, |
| 568 | "N %d %s QP %x R %u %s %u %u %u f=%x %u %u %u %u %u %u SPSN %x %x %x %x %x RPSN %x S(%u %u %u %u %u %u %u) R(%u %u %u) RQP %x LID %x SL %u MTU %u %u %u %u %u SDE %p,%u SC %p,%u SCQ %u %u PID %d OS %x %x E %x %x %x RNR %d %s %d\n", | 568 | "N %d %s QP %x R %u %s %u %u f=%x %u %u %u %u %u %u SPSN %x %x %x %x %x RPSN %x S(%u %u %u %u %u %u %u) R(%u %u %u) RQP %x LID %x SL %u MTU %u %u %u %u %u SDE %p,%u SC %p,%u SCQ %u %u PID %d OS %x %x E %x %x %x RNR %d %s %d\n", |
| 569 | iter->n, | 569 | iter->n, |
| 570 | qp_idle(qp) ? "I" : "B", | 570 | qp_idle(qp) ? "I" : "B", |
| 571 | qp->ibqp.qp_num, | 571 | qp->ibqp.qp_num, |
| @@ -573,7 +573,6 @@ void qp_iter_print(struct seq_file *s, struct rvt_qp_iter *iter) | |||
| 573 | qp_type_str[qp->ibqp.qp_type], | 573 | qp_type_str[qp->ibqp.qp_type], |
| 574 | qp->state, | 574 | qp->state, |
| 575 | wqe ? wqe->wr.opcode : 0, | 575 | wqe ? wqe->wr.opcode : 0, |
| 576 | qp->s_hdrwords, | ||
| 577 | qp->s_flags, | 576 | qp->s_flags, |
| 578 | iowait_sdma_pending(&priv->s_iowait), | 577 | iowait_sdma_pending(&priv->s_iowait), |
| 579 | iowait_pio_pending(&priv->s_iowait), | 578 | iowait_pio_pending(&priv->s_iowait), |
| @@ -795,7 +794,6 @@ void notify_error_qp(struct rvt_qp *qp) | |||
| 795 | } | 794 | } |
| 796 | 795 | ||
| 797 | if (!(qp->s_flags & RVT_S_BUSY)) { | 796 | if (!(qp->s_flags & RVT_S_BUSY)) { |
| 798 | qp->s_hdrwords = 0; | ||
| 799 | if (qp->s_rdma_mr) { | 797 | if (qp->s_rdma_mr) { |
| 800 | rvt_put_mr(qp->s_rdma_mr); | 798 | rvt_put_mr(qp->s_rdma_mr); |
| 801 | qp->s_rdma_mr = NULL; | 799 | qp->s_rdma_mr = NULL; |
diff --git a/drivers/infiniband/hw/hfi1/qp.h b/drivers/infiniband/hw/hfi1/qp.h index c06d2f8348e0..b2d4cba8d15b 100644 --- a/drivers/infiniband/hw/hfi1/qp.h +++ b/drivers/infiniband/hw/hfi1/qp.h | |||
| @@ -51,12 +51,25 @@ | |||
| 51 | #include <rdma/rdmavt_qp.h> | 51 | #include <rdma/rdmavt_qp.h> |
| 52 | #include "verbs.h" | 52 | #include "verbs.h" |
| 53 | #include "sdma.h" | 53 | #include "sdma.h" |
| 54 | #include "verbs_txreq.h" | ||
| 54 | 55 | ||
| 55 | extern unsigned int hfi1_qp_table_size; | 56 | extern unsigned int hfi1_qp_table_size; |
| 56 | 57 | ||
| 57 | extern const struct rvt_operation_params hfi1_post_parms[]; | 58 | extern const struct rvt_operation_params hfi1_post_parms[]; |
| 58 | 59 | ||
| 59 | /* | 60 | /* |
| 61 | * Send if not busy or waiting for I/O and either | ||
| 62 | * a RC response is pending or we can process send work requests. | ||
| 63 | */ | ||
| 64 | static inline int hfi1_send_ok(struct rvt_qp *qp) | ||
| 65 | { | ||
| 66 | return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) && | ||
| 67 | (verbs_txreq_queued(qp) || | ||
| 68 | (qp->s_flags & RVT_S_RESP_PENDING) || | ||
| 69 | !(qp->s_flags & RVT_S_ANY_WAIT_SEND)); | ||
| 70 | } | ||
| 71 | |||
| 72 | /* | ||
| 60 | * free_ahg - clear ahg from QP | 73 | * free_ahg - clear ahg from QP |
| 61 | */ | 74 | */ |
| 62 | static inline void clear_ahg(struct rvt_qp *qp) | 75 | static inline void clear_ahg(struct rvt_qp *qp) |
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c index 68d5c3cce2eb..524c12f04bd9 100644 --- a/drivers/infiniband/hw/hfi1/rc.c +++ b/drivers/infiniband/hw/hfi1/rc.c | |||
| @@ -226,12 +226,10 @@ normal: | |||
| 226 | bth2 = mask_psn(qp->s_ack_psn); | 226 | bth2 = mask_psn(qp->s_ack_psn); |
| 227 | } | 227 | } |
| 228 | qp->s_rdma_ack_cnt++; | 228 | qp->s_rdma_ack_cnt++; |
| 229 | qp->s_hdrwords = hwords; | ||
| 230 | ps->s_txreq->sde = priv->s_sde; | 229 | ps->s_txreq->sde = priv->s_sde; |
| 231 | ps->s_txreq->s_cur_size = len; | 230 | ps->s_txreq->s_cur_size = len; |
| 231 | ps->s_txreq->hdr_dwords = hwords; | ||
| 232 | hfi1_make_ruc_header(qp, ohdr, bth0, bth2, middle, ps); | 232 | hfi1_make_ruc_header(qp, ohdr, bth0, bth2, middle, ps); |
| 233 | /* pbc */ | ||
| 234 | ps->s_txreq->hdr_dwords = qp->s_hdrwords + 2; | ||
| 235 | return 1; | 233 | return 1; |
| 236 | 234 | ||
| 237 | bail: | 235 | bail: |
| @@ -387,7 +385,6 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) | |||
| 387 | : IB_WC_SUCCESS); | 385 | : IB_WC_SUCCESS); |
| 388 | if (local_ops) | 386 | if (local_ops) |
| 389 | atomic_dec(&qp->local_ops_pending); | 387 | atomic_dec(&qp->local_ops_pending); |
| 390 | qp->s_hdrwords = 0; | ||
| 391 | goto done_free_tx; | 388 | goto done_free_tx; |
| 392 | } | 389 | } |
| 393 | 390 | ||
| @@ -690,7 +687,7 @@ no_flow_control: | |||
| 690 | bth2 |= IB_BTH_REQ_ACK; | 687 | bth2 |= IB_BTH_REQ_ACK; |
| 691 | } | 688 | } |
| 692 | qp->s_len -= len; | 689 | qp->s_len -= len; |
| 693 | qp->s_hdrwords = hwords; | 690 | ps->s_txreq->hdr_dwords = hwords; |
| 694 | ps->s_txreq->sde = priv->s_sde; | 691 | ps->s_txreq->sde = priv->s_sde; |
| 695 | ps->s_txreq->ss = ss; | 692 | ps->s_txreq->ss = ss; |
| 696 | ps->s_txreq->s_cur_size = len; | 693 | ps->s_txreq->s_cur_size = len; |
| @@ -701,8 +698,6 @@ no_flow_control: | |||
| 701 | bth2, | 698 | bth2, |
| 702 | middle, | 699 | middle, |
| 703 | ps); | 700 | ps); |
| 704 | /* pbc */ | ||
| 705 | ps->s_txreq->hdr_dwords = qp->s_hdrwords + 2; | ||
| 706 | return 1; | 701 | return 1; |
| 707 | 702 | ||
| 708 | done_free_tx: | 703 | done_free_tx: |
| @@ -716,7 +711,6 @@ bail: | |||
| 716 | bail_no_tx: | 711 | bail_no_tx: |
| 717 | ps->s_txreq = NULL; | 712 | ps->s_txreq = NULL; |
| 718 | qp->s_flags &= ~RVT_S_BUSY; | 713 | qp->s_flags &= ~RVT_S_BUSY; |
| 719 | qp->s_hdrwords = 0; | ||
| 720 | return 0; | 714 | return 0; |
| 721 | } | 715 | } |
| 722 | 716 | ||
diff --git a/drivers/infiniband/hw/hfi1/ruc.c b/drivers/infiniband/hw/hfi1/ruc.c index 2c7fc6e331ea..0cced9a4a345 100644 --- a/drivers/infiniband/hw/hfi1/ruc.c +++ b/drivers/infiniband/hw/hfi1/ruc.c | |||
| @@ -757,8 +757,9 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, | |||
| 757 | u32 slid; | 757 | u32 slid; |
| 758 | u16 pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); | 758 | u16 pkey = hfi1_get_pkey(ibp, qp->s_pkey_index); |
| 759 | u8 l4 = OPA_16B_L4_IB_LOCAL; | 759 | u8 l4 = OPA_16B_L4_IB_LOCAL; |
| 760 | u8 extra_bytes = hfi1_get_16b_padding((qp->s_hdrwords << 2), | 760 | u8 extra_bytes = hfi1_get_16b_padding( |
| 761 | ps->s_txreq->s_cur_size); | 761 | (ps->s_txreq->hdr_dwords << 2), |
| 762 | ps->s_txreq->s_cur_size); | ||
| 762 | u32 nwords = SIZE_OF_CRC + ((ps->s_txreq->s_cur_size + | 763 | u32 nwords = SIZE_OF_CRC + ((ps->s_txreq->s_cur_size + |
| 763 | extra_bytes + SIZE_OF_LT) >> 2); | 764 | extra_bytes + SIZE_OF_LT) >> 2); |
| 764 | u8 becn = 0; | 765 | u8 becn = 0; |
| @@ -778,9 +779,9 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, | |||
| 778 | grd->sgid_index = 0; | 779 | grd->sgid_index = 0; |
| 779 | grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; | 780 | grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; |
| 780 | l4 = OPA_16B_L4_IB_GLOBAL; | 781 | l4 = OPA_16B_L4_IB_GLOBAL; |
| 781 | hdrwords = qp->s_hdrwords - 4; | 782 | hdrwords = ps->s_txreq->hdr_dwords - 4; |
| 782 | qp->s_hdrwords += hfi1_make_grh(ibp, grh, grd, | 783 | ps->s_txreq->hdr_dwords += hfi1_make_grh(ibp, grh, grd, |
| 783 | hdrwords, nwords); | 784 | hdrwords, nwords); |
| 784 | middle = 0; | 785 | middle = 0; |
| 785 | } | 786 | } |
| 786 | 787 | ||
| @@ -814,7 +815,7 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, | |||
| 814 | slid, | 815 | slid, |
| 815 | opa_get_lid(rdma_ah_get_dlid(&qp->remote_ah_attr), | 816 | opa_get_lid(rdma_ah_get_dlid(&qp->remote_ah_attr), |
| 816 | 16B), | 817 | 16B), |
| 817 | (qp->s_hdrwords + nwords) >> 1, | 818 | (ps->s_txreq->hdr_dwords + nwords) >> 1, |
| 818 | pkey, becn, 0, l4, priv->s_sc); | 819 | pkey, becn, 0, l4, priv->s_sc); |
| 819 | } | 820 | } |
| 820 | 821 | ||
| @@ -834,10 +835,10 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp, | |||
| 834 | 835 | ||
| 835 | if (unlikely(rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH)) { | 836 | if (unlikely(rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH)) { |
| 836 | struct ib_grh *grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; | 837 | struct ib_grh *grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; |
| 837 | int hdrwords = qp->s_hdrwords - 2; | 838 | int hdrwords = ps->s_txreq->hdr_dwords - 2; |
| 838 | 839 | ||
| 839 | lrh0 = HFI1_LRH_GRH; | 840 | lrh0 = HFI1_LRH_GRH; |
| 840 | qp->s_hdrwords += | 841 | ps->s_txreq->hdr_dwords += |
| 841 | hfi1_make_grh(ibp, grh, | 842 | hfi1_make_grh(ibp, grh, |
| 842 | rdma_ah_read_grh(&qp->remote_ah_attr), | 843 | rdma_ah_read_grh(&qp->remote_ah_attr), |
| 843 | hdrwords, nwords); | 844 | hdrwords, nwords); |
| @@ -866,7 +867,7 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp, | |||
| 866 | hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2); | 867 | hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2); |
| 867 | hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh, | 868 | hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh, |
| 868 | lrh0, | 869 | lrh0, |
| 869 | qp->s_hdrwords + nwords, | 870 | ps->s_txreq->hdr_dwords + nwords, |
| 870 | opa_get_lid(rdma_ah_get_dlid(&qp->remote_ah_attr), 9B), | 871 | opa_get_lid(rdma_ah_get_dlid(&qp->remote_ah_attr), 9B), |
| 871 | ppd_from_ibp(ibp)->lid | | 872 | ppd_from_ibp(ibp)->lid | |
| 872 | rdma_ah_get_path_bits(&qp->remote_ah_attr)); | 873 | rdma_ah_get_path_bits(&qp->remote_ah_attr)); |
| @@ -1031,7 +1032,7 @@ void hfi1_do_send(struct rvt_qp *qp, bool in_thread) | |||
| 1031 | ps.s_txreq = get_waiting_verbs_txreq(qp); | 1032 | ps.s_txreq = get_waiting_verbs_txreq(qp); |
| 1032 | do { | 1033 | do { |
| 1033 | /* Check for a constructed packet to be sent. */ | 1034 | /* Check for a constructed packet to be sent. */ |
| 1034 | if (qp->s_hdrwords != 0) { | 1035 | if (ps.s_txreq) { |
| 1035 | spin_unlock_irqrestore(&qp->s_lock, ps.flags); | 1036 | spin_unlock_irqrestore(&qp->s_lock, ps.flags); |
| 1036 | /* | 1037 | /* |
| 1037 | * If the packet cannot be sent now, return and | 1038 | * If the packet cannot be sent now, return and |
| @@ -1039,8 +1040,6 @@ void hfi1_do_send(struct rvt_qp *qp, bool in_thread) | |||
| 1039 | */ | 1040 | */ |
| 1040 | if (hfi1_verbs_send(qp, &ps)) | 1041 | if (hfi1_verbs_send(qp, &ps)) |
| 1041 | return; | 1042 | return; |
| 1042 | /* Record that s_ahg is empty. */ | ||
| 1043 | qp->s_hdrwords = 0; | ||
| 1044 | /* allow other tasks to run */ | 1043 | /* allow other tasks to run */ |
| 1045 | if (schedule_send_yield(qp, &ps)) | 1044 | if (schedule_send_yield(qp, &ps)) |
| 1046 | return; | 1045 | return; |
diff --git a/drivers/infiniband/hw/hfi1/uc.c b/drivers/infiniband/hw/hfi1/uc.c index 991bbee04821..fef69d98386c 100644 --- a/drivers/infiniband/hw/hfi1/uc.c +++ b/drivers/infiniband/hw/hfi1/uc.c | |||
| @@ -146,7 +146,6 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) | |||
| 146 | : IB_WC_SUCCESS); | 146 | : IB_WC_SUCCESS); |
| 147 | if (local_ops) | 147 | if (local_ops) |
| 148 | atomic_dec(&qp->local_ops_pending); | 148 | atomic_dec(&qp->local_ops_pending); |
| 149 | qp->s_hdrwords = 0; | ||
| 150 | goto done_free_tx; | 149 | goto done_free_tx; |
| 151 | } | 150 | } |
| 152 | /* | 151 | /* |
| @@ -269,14 +268,12 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) | |||
| 269 | break; | 268 | break; |
| 270 | } | 269 | } |
| 271 | qp->s_len -= len; | 270 | qp->s_len -= len; |
| 272 | qp->s_hdrwords = hwords; | 271 | ps->s_txreq->hdr_dwords = hwords; |
| 273 | ps->s_txreq->sde = priv->s_sde; | 272 | ps->s_txreq->sde = priv->s_sde; |
| 274 | ps->s_txreq->ss = &qp->s_sge; | 273 | ps->s_txreq->ss = &qp->s_sge; |
| 275 | ps->s_txreq->s_cur_size = len; | 274 | ps->s_txreq->s_cur_size = len; |
| 276 | hfi1_make_ruc_header(qp, ohdr, bth0 | (qp->s_state << 24), | 275 | hfi1_make_ruc_header(qp, ohdr, bth0 | (qp->s_state << 24), |
| 277 | mask_psn(qp->s_psn++), middle, ps); | 276 | mask_psn(qp->s_psn++), middle, ps); |
| 278 | /* pbc */ | ||
| 279 | ps->s_txreq->hdr_dwords = qp->s_hdrwords + 2; | ||
| 280 | return 1; | 277 | return 1; |
| 281 | 278 | ||
| 282 | done_free_tx: | 279 | done_free_tx: |
| @@ -290,7 +287,6 @@ bail: | |||
| 290 | bail_no_tx: | 287 | bail_no_tx: |
| 291 | ps->s_txreq = NULL; | 288 | ps->s_txreq = NULL; |
| 292 | qp->s_flags &= ~RVT_S_BUSY; | 289 | qp->s_flags &= ~RVT_S_BUSY; |
| 293 | qp->s_hdrwords = 0; | ||
| 294 | return 0; | 290 | return 0; |
| 295 | } | 291 | } |
| 296 | 292 | ||
diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c index beb5091eccca..6b5cd3a86be4 100644 --- a/drivers/infiniband/hw/hfi1/ud.c +++ b/drivers/infiniband/hw/hfi1/ud.c | |||
| @@ -340,15 +340,15 @@ void hfi1_make_ud_req_9B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 340 | extra_bytes = -wqe->length & 3; | 340 | extra_bytes = -wqe->length & 3; |
| 341 | nwords = ((wqe->length + extra_bytes) >> 2) + SIZE_OF_CRC; | 341 | nwords = ((wqe->length + extra_bytes) >> 2) + SIZE_OF_CRC; |
| 342 | /* header size in dwords LRH+BTH+DETH = (8+12+8)/4. */ | 342 | /* header size in dwords LRH+BTH+DETH = (8+12+8)/4. */ |
| 343 | qp->s_hdrwords = 7; | 343 | ps->s_txreq->hdr_dwords = 7; |
| 344 | if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) | 344 | if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) |
| 345 | qp->s_hdrwords++; | 345 | ps->s_txreq->hdr_dwords++; |
| 346 | 346 | ||
| 347 | if (rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH) { | 347 | if (rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH) { |
| 348 | grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; | 348 | grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh; |
| 349 | qp->s_hdrwords += hfi1_make_grh(ibp, grh, | 349 | ps->s_txreq->hdr_dwords += |
| 350 | rdma_ah_read_grh(ah_attr), | 350 | hfi1_make_grh(ibp, grh, rdma_ah_read_grh(ah_attr), |
| 351 | qp->s_hdrwords - 2, nwords); | 351 | ps->s_txreq->hdr_dwords - 2, nwords); |
| 352 | lrh0 = HFI1_LRH_GRH; | 352 | lrh0 = HFI1_LRH_GRH; |
| 353 | ohdr = &ps->s_txreq->phdr.hdr.ibh.u.l.oth; | 353 | ohdr = &ps->s_txreq->phdr.hdr.ibh.u.l.oth; |
| 354 | } else { | 354 | } else { |
| @@ -381,7 +381,7 @@ void hfi1_make_ud_req_9B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 381 | } | 381 | } |
| 382 | } | 382 | } |
| 383 | hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, false); | 383 | hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, false); |
| 384 | len = qp->s_hdrwords + nwords; | 384 | len = ps->s_txreq->hdr_dwords + nwords; |
| 385 | 385 | ||
| 386 | /* Setup the packet */ | 386 | /* Setup the packet */ |
| 387 | ps->s_txreq->phdr.hdr.hdr_type = HFI1_PKT_TYPE_9B; | 387 | ps->s_txreq->phdr.hdr.hdr_type = HFI1_PKT_TYPE_9B; |
| @@ -405,12 +405,12 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 405 | ppd = ppd_from_ibp(ibp); | 405 | ppd = ppd_from_ibp(ibp); |
| 406 | ah_attr = &ibah_to_rvtah(wqe->ud_wr.ah)->attr; | 406 | ah_attr = &ibah_to_rvtah(wqe->ud_wr.ah)->attr; |
| 407 | /* header size in dwords 16B LRH+BTH+DETH = (16+12+8)/4. */ | 407 | /* header size in dwords 16B LRH+BTH+DETH = (16+12+8)/4. */ |
| 408 | qp->s_hdrwords = 9; | 408 | ps->s_txreq->hdr_dwords = 9; |
| 409 | if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) | 409 | if (wqe->wr.opcode == IB_WR_SEND_WITH_IMM) |
| 410 | qp->s_hdrwords++; | 410 | ps->s_txreq->hdr_dwords++; |
| 411 | 411 | ||
| 412 | /* SW provides space for CRC and LT for bypass packets. */ | 412 | /* SW provides space for CRC and LT for bypass packets. */ |
| 413 | extra_bytes = hfi1_get_16b_padding((qp->s_hdrwords << 2), | 413 | extra_bytes = hfi1_get_16b_padding((ps->s_txreq->hdr_dwords << 2), |
| 414 | wqe->length); | 414 | wqe->length); |
| 415 | nwords = ((wqe->length + extra_bytes + SIZE_OF_LT) >> 2) + SIZE_OF_CRC; | 415 | nwords = ((wqe->length + extra_bytes + SIZE_OF_LT) >> 2) + SIZE_OF_CRC; |
| 416 | 416 | ||
| @@ -428,8 +428,8 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 428 | grd->sgid_index = 0; | 428 | grd->sgid_index = 0; |
| 429 | } | 429 | } |
| 430 | grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; | 430 | grh = &ps->s_txreq->phdr.hdr.opah.u.l.grh; |
| 431 | qp->s_hdrwords += hfi1_make_grh(ibp, grh, grd, | 431 | ps->s_txreq->hdr_dwords += hfi1_make_grh(ibp, grh, grd, |
| 432 | qp->s_hdrwords - 4, nwords); | 432 | ps->s_txreq->hdr_dwords - 4, nwords); |
| 433 | ohdr = &ps->s_txreq->phdr.hdr.opah.u.l.oth; | 433 | ohdr = &ps->s_txreq->phdr.hdr.opah.u.l.oth; |
| 434 | l4 = OPA_16B_L4_IB_GLOBAL; | 434 | l4 = OPA_16B_L4_IB_GLOBAL; |
| 435 | } else { | 435 | } else { |
| @@ -452,7 +452,7 @@ void hfi1_make_ud_req_16B(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 452 | 452 | ||
| 453 | hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, true); | 453 | hfi1_make_bth_deth(qp, wqe, ohdr, &pkey, extra_bytes, true); |
| 454 | /* Convert dwords to flits */ | 454 | /* Convert dwords to flits */ |
| 455 | len = (qp->s_hdrwords + nwords) >> 1; | 455 | len = (ps->s_txreq->hdr_dwords + nwords) >> 1; |
| 456 | 456 | ||
| 457 | /* Setup the packet */ | 457 | /* Setup the packet */ |
| 458 | ps->s_txreq->phdr.hdr.hdr_type = HFI1_PKT_TYPE_16B; | 458 | ps->s_txreq->phdr.hdr.hdr_type = HFI1_PKT_TYPE_16B; |
| @@ -564,8 +564,6 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) | |||
| 564 | priv->s_ahg->ahgcount = 0; | 564 | priv->s_ahg->ahgcount = 0; |
| 565 | priv->s_ahg->ahgidx = 0; | 565 | priv->s_ahg->ahgidx = 0; |
| 566 | priv->s_ahg->tx_flags = 0; | 566 | priv->s_ahg->tx_flags = 0; |
| 567 | /* pbc */ | ||
| 568 | ps->s_txreq->hdr_dwords = qp->s_hdrwords + 2; | ||
| 569 | 567 | ||
| 570 | return 1; | 568 | return 1; |
| 571 | 569 | ||
| @@ -580,7 +578,6 @@ bail: | |||
| 580 | bail_no_tx: | 578 | bail_no_tx: |
| 581 | ps->s_txreq = NULL; | 579 | ps->s_txreq = NULL; |
| 582 | qp->s_flags &= ~RVT_S_BUSY; | 580 | qp->s_flags &= ~RVT_S_BUSY; |
| 583 | qp->s_hdrwords = 0; | ||
| 584 | return 0; | 581 | return 0; |
| 585 | } | 582 | } |
| 586 | 583 | ||
diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c index b8776a362a91..471d55c50066 100644 --- a/drivers/infiniband/hw/hfi1/verbs.c +++ b/drivers/infiniband/hw/hfi1/verbs.c | |||
| @@ -835,7 +835,7 @@ static int build_verbs_tx_desc( | |||
| 835 | { | 835 | { |
| 836 | int ret = 0; | 836 | int ret = 0; |
| 837 | struct hfi1_sdma_header *phdr = &tx->phdr; | 837 | struct hfi1_sdma_header *phdr = &tx->phdr; |
| 838 | u16 hdrbytes = tx->hdr_dwords << 2; | 838 | u16 hdrbytes = (tx->hdr_dwords + sizeof(pbc) / 4) << 2; |
| 839 | u8 extra_bytes = 0; | 839 | u8 extra_bytes = 0; |
| 840 | 840 | ||
| 841 | if (tx->phdr.hdr.hdr_type) { | 841 | if (tx->phdr.hdr.hdr_type) { |
| @@ -901,7 +901,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 901 | { | 901 | { |
| 902 | struct hfi1_qp_priv *priv = qp->priv; | 902 | struct hfi1_qp_priv *priv = qp->priv; |
| 903 | struct hfi1_ahg_info *ahg_info = priv->s_ahg; | 903 | struct hfi1_ahg_info *ahg_info = priv->s_ahg; |
| 904 | u32 hdrwords = qp->s_hdrwords; | 904 | u32 hdrwords = ps->s_txreq->hdr_dwords; |
| 905 | u32 len = ps->s_txreq->s_cur_size; | 905 | u32 len = ps->s_txreq->s_cur_size; |
| 906 | u32 plen; | 906 | u32 plen; |
| 907 | struct hfi1_ibdev *dev = ps->dev; | 907 | struct hfi1_ibdev *dev = ps->dev; |
| @@ -919,7 +919,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 919 | } else { | 919 | } else { |
| 920 | dwords = (len + 3) >> 2; | 920 | dwords = (len + 3) >> 2; |
| 921 | } | 921 | } |
| 922 | plen = hdrwords + dwords + 2; | 922 | plen = hdrwords + dwords + sizeof(pbc) / 4; |
| 923 | 923 | ||
| 924 | tx = ps->s_txreq; | 924 | tx = ps->s_txreq; |
| 925 | if (!sdma_txreq_built(&tx->txreq)) { | 925 | if (!sdma_txreq_built(&tx->txreq)) { |
| @@ -1038,7 +1038,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 1038 | u64 pbc) | 1038 | u64 pbc) |
| 1039 | { | 1039 | { |
| 1040 | struct hfi1_qp_priv *priv = qp->priv; | 1040 | struct hfi1_qp_priv *priv = qp->priv; |
| 1041 | u32 hdrwords = qp->s_hdrwords; | 1041 | u32 hdrwords = ps->s_txreq->hdr_dwords; |
| 1042 | struct rvt_sge_state *ss = ps->s_txreq->ss; | 1042 | struct rvt_sge_state *ss = ps->s_txreq->ss; |
| 1043 | u32 len = ps->s_txreq->s_cur_size; | 1043 | u32 len = ps->s_txreq->s_cur_size; |
| 1044 | u32 dwords; | 1044 | u32 dwords; |
| @@ -1064,7 +1064,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, | |||
| 1064 | dwords = (len + 3) >> 2; | 1064 | dwords = (len + 3) >> 2; |
| 1065 | hdr = (u32 *)&ps->s_txreq->phdr.hdr.ibh; | 1065 | hdr = (u32 *)&ps->s_txreq->phdr.hdr.ibh; |
| 1066 | } | 1066 | } |
| 1067 | plen = hdrwords + dwords + 2; | 1067 | plen = hdrwords + dwords + sizeof(pbc) / 4; |
| 1068 | 1068 | ||
| 1069 | /* only RC/UC use complete */ | 1069 | /* only RC/UC use complete */ |
| 1070 | switch (qp->ibqp.qp_type) { | 1070 | switch (qp->ibqp.qp_type) { |
diff --git a/drivers/infiniband/hw/hfi1/verbs.h b/drivers/infiniband/hw/hfi1/verbs.h index 87d1285a3340..c2aeb32bf482 100644 --- a/drivers/infiniband/hw/hfi1/verbs.h +++ b/drivers/infiniband/hw/hfi1/verbs.h | |||
| @@ -246,17 +246,6 @@ static inline struct rvt_qp *iowait_to_qp(struct iowait *s_iowait) | |||
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | /* | 248 | /* |
| 249 | * Send if not busy or waiting for I/O and either | ||
| 250 | * a RC response is pending or we can process send work requests. | ||
| 251 | */ | ||
| 252 | static inline int hfi1_send_ok(struct rvt_qp *qp) | ||
| 253 | { | ||
| 254 | return !(qp->s_flags & (RVT_S_BUSY | RVT_S_ANY_WAIT_IO)) && | ||
| 255 | (qp->s_hdrwords || (qp->s_flags & RVT_S_RESP_PENDING) || | ||
| 256 | !(qp->s_flags & RVT_S_ANY_WAIT_SEND)); | ||
| 257 | } | ||
| 258 | |||
| 259 | /* | ||
| 260 | * This must be called with s_lock held. | 249 | * This must be called with s_lock held. |
| 261 | */ | 250 | */ |
| 262 | void hfi1_bad_pkey(struct hfi1_ibport *ibp, u32 key, u32 sl, | 251 | void hfi1_bad_pkey(struct hfi1_ibport *ibp, u32 key, u32 sl, |
diff --git a/drivers/infiniband/hw/hfi1/verbs_txreq.h b/drivers/infiniband/hw/hfi1/verbs_txreq.h index cec7a4b34d16..729244c3086c 100644 --- a/drivers/infiniband/hw/hfi1/verbs_txreq.h +++ b/drivers/infiniband/hw/hfi1/verbs_txreq.h | |||
| @@ -113,6 +113,13 @@ static inline struct verbs_txreq *get_waiting_verbs_txreq(struct rvt_qp *qp) | |||
| 113 | return NULL; | 113 | return NULL; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline bool verbs_txreq_queued(struct rvt_qp *qp) | ||
| 117 | { | ||
| 118 | struct hfi1_qp_priv *priv = qp->priv; | ||
| 119 | |||
| 120 | return iowait_packet_queued(&priv->s_iowait); | ||
| 121 | } | ||
| 122 | |||
| 116 | void hfi1_put_txreq(struct verbs_txreq *tx); | 123 | void hfi1_put_txreq(struct verbs_txreq *tx); |
| 117 | int verbs_txreq_init(struct hfi1_ibdev *dev); | 124 | int verbs_txreq_init(struct hfi1_ibdev *dev); |
| 118 | void verbs_txreq_exit(struct hfi1_ibdev *dev); | 125 | void verbs_txreq_exit(struct hfi1_ibdev *dev); |
