IB/hfi1,qib: Cleanups and updates for-next
Subsystems (3)
cover IB/hfi1,qib: Cleanups and updates for-next
Hi Doug,
Here are some patches for-next. There are some clean ups to remove unused code and useless initializations. We also continue cleaning up the code by packing more fields into the hfi1_packet to keep them in a single place and adding some enhancements to the input/output header tracing.
These apply on top of the two patches I just sent for RC.
Patches can can also be found in my GitHub repo at:
https://github.com/ddalessa/kernel/tree/for-4.13
---
Don Hiatt (3):
IB/hfi1: Add functions to parse BTH/IB headers IB/hfi1: Separate input/output header tracing IB/hfi1: Setup common IB fields in hfi1_packet struct
Ira Weiny (1):
IB/hfi1: Remove unused mk_qpn function
Mike Marciniszyn (1):
IB/rdmavt: Compress adjacent SGEs in rvt_lkey_ok()
Sebastian Sanchez (1):
IB/hfi1: Remove unnecessary initialization from tx request
drivers/infiniband/hw/hfi1/chip.c | 9 - drivers/infiniband/hw/hfi1/chip.h | 2 drivers/infiniband/hw/hfi1/common.h | 1 drivers/infiniband/hw/hfi1/driver.c | 162 ++++++++++----- drivers/infiniband/hw/hfi1/hfi.h | 68 ++---- drivers/infiniband/hw/hfi1/qp.c | 6 - drivers/infiniband/hw/hfi1/rc.c | 42 +--- drivers/infiniband/hw/hfi1/ruc.c | 91 ++++---- drivers/infiniband/hw/hfi1/trace.c | 58 +++++ drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 322 +++++++++++++++++++---------- drivers/infiniband/hw/hfi1/trace_rx.h | 9 + drivers/infiniband/hw/hfi1/uc.c | 18 -- drivers/infiniband/hw/hfi1/ud.c | 27 +- drivers/infiniband/hw/hfi1/user_sdma.c | 12 + drivers/infiniband/hw/hfi1/verbs.c | 98 ++++----- drivers/infiniband/hw/hfi1/verbs.h | 6 - drivers/infiniband/hw/qib/qib_ruc.c | 2 drivers/infiniband/sw/rdmavt/mr.c | 51 ++++- drivers/infiniband/sw/rdmavt/qp.c | 23 +- drivers/infiniband/sw/rdmavt/trace_mr.h | 62 ++++++ drivers/infiniband/sw/rdmavt/trace_tx.h | 11 + include/rdma/ib_hdrs.h | 84 ++++++++ include/rdma/ib_verbs.h | 2 include/rdma/rdma_vt.h | 3 include/rdma/rdmavt_qp.h | 2 25 files changed, 751 insertions(+), 420 deletions(-)
--
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170512161106.1290.45891.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org
PATCH 1/6 IB/hfi1: Remove unnecessary initialization from tx request
From: Sebastian Sanchez <[email protected]>
The tx request is unnecessarily initialized in the hot code path with memset(), however, there's no need to do this as most fields are initialized later on. this initialization shows to be costly in the profile. Remove unnecessary initialization from tx request and make sure all variables are initialized properly.
--- drivers/infiniband/hw/hfi1/user_sdma.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-)
drivers/infiniband/hw/hfi1/user_sdma.c +11 -1
@@ -607,12 +607,19 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd,hfi1_cdbg (SDMA ,"[%u:%u:%u] Using req/comp entry %u\n" , dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx); req = pq->reqs + info.comp_idx; -memset (req,0 ,sizeof (*req)); req->data_iovs =req_iovcnt (info.ctrl) -1 ;/* subtract header vector */ + req->data_len =0 ; req->pq = pq; req->cq = cq; req->status =-1 ; req->ahg_idx =-1 ; + req->iov_idx =0 ; + req->sent =0 ; + req->seqnum =0 ; + req->seqcomp =0 ; + req->seqsubmitted =0 ; + req->flags =0 ; + req->tids =NULL ;INIT_LIST_HEAD (&req->txps);memcpy (&req->info, &info,sizeof (info));
@@ -701,12 +708,14 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd,/* Save all the IO vector structures */ for (i =0 ; i < req->data_iovs; i++) { + req->iovs[i].offset =0 ;INIT_LIST_HEAD (&req->iovs[i].list);memcpy (&req->iovs[i].iov, iovec + idx++,sizeof (req->iovs[i].iov)); ret =pin_vector_pages (req, &req->iovs[i]);if (ret) { + req->data_iovs = i; req->status = ret; goto free_req; }
@@ -749,6 +758,7 @@ int hfi1_user_sdma_process_request(struct hfi1_filedata *fd, } req->tids = tmp; req->n_tids = ntids; + req->tididx =0 ; idx++; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/6 IB/hfi1: Remove unused mk_qpn function
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
Leftover function that is not used. Remove it.
--- drivers/infiniband/hw/hfi1/qp.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/qp.c +0 -6
@@ -73,12 +73,6 @@ static int iowait_sleep(static void iowait_sdma_drained (struct iowait *wait);static void qp_pio_drain (struct rvt_qp *qp); -static inline unsigned mk_qpn (struct rvt_qpn_table *qpt, -struct rvt_qpn_map *map,unsigned off) -{ -return (map - qpt->map) *RVT_BITS_PER_PAGE + off; -} -const struct rvt_operation_params hfi1_post_parms[RVT_OPERATION_MAX ] = { [IB_WR_RDMA_WRITE ] = { .length =sizeof (struct ib_rdma_wr ),
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/6 IB/hfi1: Add functions to parse BTH/IB headers
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
Improve code readablity by adding inline functions to read specific BTH/IB fields without knowledge of byte offsets.
--- drivers/infiniband/hw/hfi1/driver.c | 6 +-- drivers/infiniband/hw/hfi1/rc.c | 8 ++- drivers/infiniband/hw/hfi1/uc.c | 2 - drivers/infiniband/hw/hfi1/ud.c | 6 +-- drivers/infiniband/hw/hfi1/verbs.c | 6 +-- include/rdma/ib_hdrs.h | 84 +++++++++++++++++++++++++++++++++++ include/rdma/ib_verbs.h | 2 + include/rdma/rdmavt_qp.h | 2 - 8 files changed, 101 insertions(+), 15 deletions(-)
drivers/infiniband/hw/hfi1/driver.c +3 -3
@@ -286,7 +286,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, goto drop; }/* Get the destination QP number. */ - qp_num =be32_to_cpu (ohdr->bth[1 ]) &RVT_QPN_MASK ; + qp_num =ib_bth_get_qpn (ohdr);if (lid <be16_to_cpu (IB_MULTICAST_LID_BASE )) {struct rvt_qp *qp;unsigned long flags;
@@ -438,7 +438,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,case IB_QPT_GSI :case IB_QPT_UD : rlid =ib_get_slid (hdr); - rqpn =be32_to_cpu (ohdr->u.ud.deth[1 ]) &RVT_QPN_MASK ; + rqpn =ib_get_sqpn (ohdr); svc_type =IB_CC_SVCTYPE_UD ; is_mcast = (dlid >be16_to_cpu (IB_MULTICAST_LID_BASE )) && (dlid !=be16_to_cpu (IB_LID_PERMISSIVE ));
@@ -461,7 +461,7 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt, bth1 =be32_to_cpu (ohdr->bth[1 ]);if (do_cnp && (bth1 &IB_FECN_SMASK )) { -u16 pkey = (u16 )be32_to_cpu (ohdr->bth[0 ]); +u16 pkey =ib_bth_get_pkey (ohdr);return_cnp (ibp, qp, rqpn, pkey, dlid, rlid, sc, grh); }
drivers/infiniband/hw/hfi1/rc.c +4 -4
@@ -765,7 +765,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp, ohdr->u.aeth =rvt_compute_aeth (qp); sc5 = ibp->sl_to_sc[rdma_ah_get_sl (&qp->remote_ah_attr)];/* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */ - pbc_flags |= ((!!(sc5 &0x10 )) <<PBC_DC_INFO_SHIFT ); + pbc_flags |= (ib_is_sc5 (sc5) <<PBC_DC_INFO_SHIFT ); lrh0 |= (sc5 &0xf ) <<12 | (rdma_ah_get_sl (&qp->remote_ah_attr) &0xf ) <<4 ; hdr.lrh[0 ] =cpu_to_be16 (lrh0);
@@ -1009,7 +1009,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct ib_header *hdr)return ; } - psn =be32_to_cpu (ohdr->bth[2 ]); + psn =ib_bth_get_psn (ohdr);reset_sending_psn (qp, psn);/*
@@ -1943,7 +1943,7 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) is_fecn =process_ecn (qp, packet, false); - psn =be32_to_cpu (ohdr->bth[2 ]); + psn =ib_bth_get_psn (ohdr); opcode =ib_bth_get_opcode (ohdr);/*
@@ -2388,7 +2388,7 @@ void hfi1_rc_hdrerr(if (hfi1_ruc_check_hdr (ibp, hdr, has_grh, qp, bth0))return ; - psn =be32_to_cpu (ohdr->bth[2 ]); + psn =ib_bth_get_psn (ohdr); opcode =ib_bth_get_opcode (ohdr);/* Only deal with RDMA Writes for now */
drivers/infiniband/hw/hfi1/uc.c +1 -1
@@ -319,7 +319,7 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)process_ecn (qp, packet, true); - psn =be32_to_cpu (ohdr->bth[2 ]); + psn =ib_bth_get_psn (ohdr); opcode =ib_bth_get_opcode (ohdr);/* Compare the PSN verses the expected PSN. */
drivers/infiniband/hw/hfi1/ud.c +3 -3
@@ -549,7 +549,7 @@ void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, hdr.lrh[3 ] =cpu_to_be16 (slid); plen =2 /* PBC */ + hwords; - pbc_flags |= (!!(sc5 &0x10 )) <<PBC_DC_INFO_SHIFT ; + pbc_flags |= (ib_is_sc5 (sc5) <<PBC_DC_INFO_SHIFT ); vl =sc_to_vlt (ppd->dd, sc5); pbc =create_pbc (ppd, pbc_flags, qp->srate_mbps, vl, plen);if (ctxt) {
@@ -689,8 +689,8 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)u16 slid;u8 extra_bytes; - qkey =be32_to_cpu (ohdr->u.ud.deth[0 ]); - src_qp =be32_to_cpu (ohdr->u.ud.deth[1 ]) &RVT_QPN_MASK ; + qkey =ib_get_qkey (ohdr); + src_qp =ib_get_sqpn (ohdr); dlid =ib_get_dlid (hdr); bth1 =be32_to_cpu (ohdr->bth[1 ]); slid =ib_get_slid (hdr);
drivers/infiniband/hw/hfi1/verbs.c +3 -3
@@ -595,7 +595,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)inc_opstats (tlen, &rcd->opstats->stats[opcode]);/* Get the destination QP number. */ - qp_num =be32_to_cpu (packet->ohdr->bth[1 ]) &RVT_QPN_MASK ; + qp_num =ib_bth_get_qpn (packet->ohdr); lid =ib_get_dlid (hdr);if (unlikely ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && (lid !=be16_to_cpu (IB_LID_PERMISSIVE )))) {
@@ -863,7 +863,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,/* No vl15 here */ /* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */ - pbc |= (!!(sc5 &0x10 )) <<PBC_DC_INFO_SHIFT ; + pbc |= (ib_is_sc5 (sc5) <<PBC_DC_INFO_SHIFT );if (unlikely (hfi1_dbg_fault_opcode (qp, opcode, false))) pbc =hfi1_fault_tx (qp, opcode, pbc);
@@ -999,7 +999,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,u8 opcode =get_opcode (&tx->phdr.hdr);/* set PBC_DC_INFO bit (aka SC[4]) in pbc_flags */ - pbc |= (!!(sc5 &0x10 )) <<PBC_DC_INFO_SHIFT ; + pbc |= (ib_is_sc5 (sc5) <<PBC_DC_INFO_SHIFT );if (unlikely (hfi1_dbg_fault_opcode (qp, opcode, false))) pbc =hfi1_fault_tx (qp, opcode, pbc); pbc =create_pbc (ppd, pbc, qp->srate_mbps, vl, plen);
include/rdma/ib_hdrs.h +84 -0
114 lines not on this page · raw message
include/rdma/ib_verbs.h +2 -0
@@ -663,6 +663,8 @@ struct ib_grh { }; }; +#define IB_QPN_MASK 0xFFFFFF +enum {IB_MULTICAST_QPN =0xffffff };
include/rdma/rdmavt_qp.h +1 -1
@@ -396,7 +396,7 @@ struct rvt_srq {#define RVT_QPNMAP_ENTRIES (RVT_QPN_MAX / PAGE_SIZE / BITS_PER_BYTE)#define RVT_BITS_PER_PAGE (PAGE_SIZE * BITS_PER_BYTE)#define RVT_BITS_PER_PAGE_MASK (RVT_BITS_PER_PAGE - 1) -#define RVT_QPN_MASK 0xFFFFFF +#define RVT_QPN_MASK IB_QPN_MASK/* * QPN-map pages start out as NULL, they get allocated upon
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/6 IB/hfi1: Separate input/output header tracing
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
Calls to trace incoming packets will now receive the packet context as parameter. This enables trace support for future packet types.
Header trace output is in the format <field>:<value> which makes parsing easier.
input_ibhdr trace before change:
<idle>-0 [001] d.h. 5904.250925: input_ibhdr: [0000:05:00.0] vl 0
lver 0 sl 0 lnh 2,LRH_BTH dlid 0002 len 18 slid 0001 op 0x64,UD_SEND_ONLY se 0 m 0 pad 0 tver 0 pkey 0xffff f 0 b 0 qpn 0x000001 a 0 psn 0x000001b2 deth qkey 0x80010000 sqpn 0x000001
input_ibhdr trace after change:
<idle>-0 [001] d.h. 6655.714488: input_ibhdr: [0000:05:00.0] (IB)
len:124 sc:0 dlid:0x0001 slid:0x0002 lnh:2,LRH_BTH lver:0 sl:0 age:0 becn:0 fecn:0 l4:0 rc:0 entropy:0 op:0x64,UD_SEND_ONLY se:0 m:0 pad:0 tver:0 pkey:0x7fff f:0 b:0 qpn:0x000001 a:0 psn:0x00000036 hlen:8 deth qkey:0x80010000 sqpn:0x000001
--- drivers/infiniband/hw/hfi1/hfi.h | 49 ---- drivers/infiniband/hw/hfi1/rc.c | 3 drivers/infiniband/hw/hfi1/trace.c | 58 +++++ drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 322 +++++++++++++++++++---------- drivers/infiniband/hw/hfi1/trace_rx.h | 9 + drivers/infiniband/hw/hfi1/verbs.c | 7 - 6 files changed, 279 insertions(+), 169 deletions(-)
drivers/infiniband/hw/hfi1/hfi.h +0 -49
@@ -2087,53 +2087,4 @@ static inline bool is_integrated(struct hfi1_devdata *dd)#define DD_DEV_ENTRY (dd) __string(dev, dev_name(&(dd)->pcidev->dev))#define DD_DEV_ASSIGN (dd) __assign_str(dev, dev_name(&(dd)->pcidev->dev)) - -#define packettype_name (etype) { RHF_RCV_TYPE_##etype, #etype } -#define show_packettype (etype) \ -__print_symbolic(etype, \ - packettype_name(EXPECTED), \ - packettype_name(EAGER), \ - packettype_name(IB), \ - packettype_name(ERROR), \ - packettype_name(BYPASS)) - -#define ib_opcode_name (opcode) { IB_OPCODE_##opcode, #opcode } -#define show_ib_opcode (opcode) \ -__print_symbolic(opcode, \ - ib_opcode_name(RC_SEND_FIRST), \ - ib_opcode_name(RC_SEND_MIDDLE), \ - ib_opcode_name(RC_SEND_LAST), \ - ib_opcode_name(RC_SEND_LAST_WITH_IMMEDIATE), \ - ib_opcode_name(RC_SEND_ONLY), \ - ib_opcode_name(RC_SEND_ONLY_WITH_IMMEDIATE), \ - ib_opcode_name(RC_RDMA_WRITE_FIRST), \ - ib_opcode_name(RC_RDMA_WRITE_MIDDLE), \ - ib_opcode_name(RC_RDMA_WRITE_LAST), \ - ib_opcode_name(RC_RDMA_WRITE_LAST_WITH_IMMEDIATE), \ - ib_opcode_name(RC_RDMA_WRITE_ONLY), \ - ib_opcode_name(RC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ - ib_opcode_name(RC_RDMA_READ_REQUEST), \ - ib_opcode_name(RC_RDMA_READ_RESPONSE_FIRST), \ - ib_opcode_name(RC_RDMA_READ_RESPONSE_MIDDLE), \ - ib_opcode_name(RC_RDMA_READ_RESPONSE_LAST), \ - ib_opcode_name(RC_RDMA_READ_RESPONSE_ONLY), \ - ib_opcode_name(RC_ACKNOWLEDGE), \ - ib_opcode_name(RC_ATOMIC_ACKNOWLEDGE), \ - ib_opcode_name(RC_COMPARE_SWAP), \ - ib_opcode_name(RC_FETCH_ADD), \ - ib_opcode_name(UC_SEND_FIRST), \ - ib_opcode_name(UC_SEND_MIDDLE), \ - ib_opcode_name(UC_SEND_LAST), \ - ib_opcode_name(UC_SEND_LAST_WITH_IMMEDIATE), \ - ib_opcode_name(UC_SEND_ONLY), \ - ib_opcode_name(UC_SEND_ONLY_WITH_IMMEDIATE), \ - ib_opcode_name(UC_RDMA_WRITE_FIRST), \ - ib_opcode_name(UC_RDMA_WRITE_MIDDLE), \ - ib_opcode_name(UC_RDMA_WRITE_LAST), \ - ib_opcode_name(UC_RDMA_WRITE_LAST_WITH_IMMEDIATE), \ - ib_opcode_name(UC_RDMA_WRITE_ONLY), \ - ib_opcode_name(UC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ - ib_opcode_name(UD_SEND_ONLY), \ - ib_opcode_name(UD_SEND_ONLY_WITH_IMMEDIATE), \ - ib_opcode_name(CNP))#endif /* _HFI1_KERNEL_H */
drivers/infiniband/hw/hfi1/rc.c +2 -1
@@ -798,7 +798,8 @@ void hfi1_send_rc_ack(struct hfi1_ctxtdata *rcd, struct rvt_qp *qp, goto queue_ack; } -trace_ack_output_ibhdr (dd_from_ibdev (qp->ibqp.device), &hdr); +trace_ack_output_ibhdr (dd_from_ibdev (qp->ibqp.device), + &hdr,ib_is_sc5 (sc5));/* write the pbc and data */ ppd->dd->pio_inline_send (ppd->dd, pbuf, pbc, &hdr, hwords);
drivers/infiniband/hw/hfi1/trace.c +50 -8
76 lines not on this page · raw message
drivers/infiniband/hw/hfi1/trace_ibhdrs.h +215 -107
362 lines not on this page · raw message
drivers/infiniband/hw/hfi1/trace_rx.h +9 -0
@@ -55,6 +55,15 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM hfi1_rx +#define packettype_name (etype) { RHF_RCV_TYPE_##etype, #etype } +#define show_packettype (etype) \ +__print_symbolic(etype, \ + packettype_name(EXPECTED), \ + packettype_name(EAGER), \ + packettype_name(IB), \ + packettype_name(ERROR), \ + packettype_name(BYPASS)) + TRACE_EVENT(hfi1_rcvhdr, TP_PROTO(struct hfi1_devdata *dd, u32 ctxt,
drivers/infiniband/hw/hfi1/verbs.c +3 -4
@@ -589,8 +589,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet) goto drop; } -trace_input_ibhdr (rcd->dd, hdr); - +trace_input_ibhdr (rcd->dd, packet, !!(packet->rhf &RHF_DC_INFO_SMASK )); opcode =ib_bth_get_opcode (packet->ohdr);inc_opstats (tlen, &rcd->opstats->stats[opcode]);
@@ -885,7 +884,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *qp, struct hfi1_pkt_state *ps,return ret; }trace_sdma_output_ibhdr (dd_from_ibdev (qp->ibqp.device), - &ps->s_txreq->phdr.hdr); + &ps->s_txreq->phdr.hdr,ib_is_sc5 (sc5));return ret; bail_ecomm:
@@ -1058,7 +1057,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, }trace_pio_output_ibhdr (dd_from_ibdev (qp->ibqp.device), - &ps->s_txreq->phdr.hdr); + &ps->s_txreq->phdr.hdr,ib_is_sc5 (sc5)); pio_bail:if (qp->s_wqe) {
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/6 IB/hfi1: Setup common IB fields in hfi1_packet struct
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
We move many common IB fields into the hfi1_packet structure and set them up in a single function. This allows us to set the fields in a single place and not deal with them throughout the driver.
--- drivers/infiniband/hw/hfi1/chip.c | 9 -- drivers/infiniband/hw/hfi1/chip.h | 2 drivers/infiniband/hw/hfi1/common.h | 1 drivers/infiniband/hw/hfi1/driver.c | 158 +++++++++++++++++++++++++---------- drivers/infiniband/hw/hfi1/hfi.h | 21 ++++- drivers/infiniband/hw/hfi1/rc.c | 33 ++----- drivers/infiniband/hw/hfi1/ruc.c | 89 +++++++++----------- drivers/infiniband/hw/hfi1/uc.c | 16 +--- drivers/infiniband/hw/hfi1/ud.c | 23 ++--- drivers/infiniband/hw/hfi1/verbs.c | 89 ++++++++------------ drivers/infiniband/hw/hfi1/verbs.h | 6 - 11 files changed, 236 insertions(+), 211 deletions(-)
drivers/infiniband/hw/hfi1/chip.c +0 -9
@@ -9810,15 +9810,6 @@ void hfi1_clear_tids(struct hfi1_ctxtdata *rcd)hfi1_put_tid (dd, i,PT_INVALID ,0 ,0 ); } -struct ib_header *hfi1_get_msgheader ( -struct hfi1_devdata *dd,__le32 *rhf_addr) -{ -u32 offset =rhf_hdrq_offset (rhf_to_cpu (rhf_addr)); - -return (struct ib_header *) - (rhf_addr - dd->rhf_offset + offset); -} -static const char *const ib_cfg_name_strings[] = {"HFI1_IB_CFG_LIDLMC" ,"HFI1_IB_CFG_LWID_DG_ENB" ,
drivers/infiniband/hw/hfi1/chip.h +0 -2
@@ -1347,8 +1347,6 @@ enum {u64 get_all_cpu_total (u64 __percpu *cntr);void hfi1_start_cleanup (struct hfi1_devdata *dd);void hfi1_clear_tids (struct hfi1_ctxtdata *rcd); -struct ib_header *hfi1_get_msgheader ( -struct hfi1_devdata *dd,__le32 *rhf_addr);void hfi1_init_ctxt (struct send_context *sc);void hfi1_put_tid (struct hfi1_devdata *dd,u32 index,u32 type,unsigned long pa,u16 order);
drivers/infiniband/hw/hfi1/common.h +1 -0
@@ -325,6 +325,7 @@ struct diag_pkt {#define HFI1_LRH_BTH 0x0002/* 1. word of IB LRH - next header: BTH */ /* misc. */ +#define SC15_PACKET 0xF#define SIZE_OF_CRC 1#define LIM_MGMT_P_KEY 0x7FFF
drivers/infiniband/hw/hfi1/driver.c +111 -47
294 lines not on this page · raw message
drivers/infiniband/hw/hfi1/hfi.h +20 -1
@@ -356,17 +356,26 @@ struct hfi1_packet {__le32 *rhf_addr;struct rvt_qp *qp;struct ib_other_headers *ohdr; +struct ib_grh *grh;u64 rhf;u32 maxcnt;u32 rhqoff; +u32 dlid; +u32 slid;u16 tlen;s16 etail;u8 hlen;u8 numpkt;u8 rsize;u8 updegr; -u8 rcv_flags;u8 etype; +u8 extra_byte; +u8 pad; +u8 sc; +u8 sl; +u8 opcode; +bool becn; +bool fecn; };struct rvt_sge_state ;
@@ -2087,4 +2096,14 @@ static inline bool is_integrated(struct hfi1_devdata *dd)#define DD_DEV_ENTRY (dd) __string(dev, dev_name(&(dd)->pcidev->dev))#define DD_DEV_ASSIGN (dd) __assign_str(dev, dev_name(&(dd)->pcidev->dev)) + +/* +* hfi1_check_mcast- Check if the given lid is +* in the IB multicast range. +*/ +static inline bool hfi1_check_mcast (u16 lid) +{ +return ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && + (lid !=be16_to_cpu (IB_LID_PERMISSIVE ))); +}#endif /* _HFI1_KERNEL_H */
drivers/infiniband/hw/hfi1/rc.c +10 -23
@@ -1916,17 +1916,16 @@ void process_becn(struct hfi1_pportdata *ppd, u8 sl, u16 rlid, u32 lqpn,void hfi1_rc_rcv (struct hfi1_packet *packet) {struct hfi1_ctxtdata *rcd = packet->rcd; -struct ib_header *hdr = packet->hdr; -u32 rcv_flags = packet->rcv_flags;void *data = packet->ebuf;u32 tlen = packet->tlen;struct rvt_qp *qp = packet->qp;struct hfi1_ibport *ibp =rcd_to_iport (rcd);struct ib_other_headers *ohdr = packet->ohdr; -u32 bth0, opcode; +u32 bth0; +u32 opcode = packet->opcode;u32 hdrsize = packet->hlen;u32 psn; -u32 pad; +u32 pad = packet->pad;struct ib_wc wc;u32 pmtu = qp->pmtu;int diff;
@@ -1938,14 +1937,13 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)u32 rkey;lockdep_assert_held (&qp->r_lock); + bth0 =be32_to_cpu (ohdr->bth[0 ]); -if (hfi1_ruc_check_hdr (ibp, hdr, rcv_flags &HFI1_HAS_GRH , qp, bth0)) +if (hfi1_ruc_check_hdr (ibp, packet))return ; is_fecn =process_ecn (qp, packet, false); - psn =ib_bth_get_psn (ohdr); - opcode =ib_bth_get_opcode (ohdr);/* * Process responses (ACKs) before anything else. Note that the
@@ -2075,8 +2073,6 @@ void hfi1_rc_rcv(struct hfi1_packet *packet) wc.wc_flags =0 ; wc.ex.imm_data =0 ; send_last: -/* Get the number of bytes the message was padded by. */ - pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
@@ -2369,28 +2365,19 @@ void hfi1_rc_rcv(struct hfi1_packet *packet)void hfi1_rc_hdrerr (struct hfi1_ctxtdata *rcd, -struct ib_header *hdr, -u32 rcv_flags, +struct hfi1_packet *packet,struct rvt_qp *qp) { -int has_grh = rcv_flags &HFI1_HAS_GRH ; -struct ib_other_headers *ohdr;struct hfi1_ibport *ibp =rcd_to_iport (rcd);int diff;u32 opcode; -u32 psn, bth0; - -/* Check for GRH */ - ohdr = &hdr->u.oth; -if (has_grh) - ohdr = &hdr->u.l.oth; +u32 psn; - bth0 =be32_to_cpu (ohdr->bth[0 ]); -if (hfi1_ruc_check_hdr (ibp, hdr, has_grh, qp, bth0)) +if (hfi1_ruc_check_hdr (ibp, packet))return ; - psn =ib_bth_get_psn (ohdr); - opcode =ib_bth_get_opcode (ohdr); + psn =ib_bth_get_psn (packet->ohdr); + opcode =ib_bth_get_opcode (packet->ohdr);/* Only deal with RDMA Writes for now */ if (opcode <IB_OPCODE_RC_RDMA_READ_RESPONSE_FIRST ) {
drivers/infiniband/hw/hfi1/ruc.c +42 -47
142 lines not on this page · raw message
drivers/infiniband/hw/hfi1/uc.c +3 -13
@@ -297,31 +297,25 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)void hfi1_uc_rcv (struct hfi1_packet *packet) {struct hfi1_ibport *ibp =rcd_to_iport (packet->rcd); -struct ib_header *hdr = packet->hdr; -u32 rcv_flags = packet->rcv_flags;void *data = packet->ebuf;u32 tlen = packet->tlen;struct rvt_qp *qp = packet->qp;struct ib_other_headers *ohdr = packet->ohdr; -u32 bth0, opcode; +u32 opcode = packet->opcode;u32 hdrsize = packet->hlen;u32 psn; -u32 pad; +u32 pad = packet->pad;struct ib_wc wc;u32 pmtu = qp->pmtu;struct ib_reth *reth; -int has_grh = rcv_flags &HFI1_HAS_GRH ;int ret; - bth0 =be32_to_cpu (ohdr->bth[0 ]); -if (hfi1_ruc_check_hdr (ibp, hdr, has_grh, qp, bth0)) +if (hfi1_ruc_check_hdr (ibp, packet))return ;process_ecn (qp, packet, true); psn =ib_bth_get_psn (ohdr); - opcode =ib_bth_get_opcode (ohdr); -/* Compare the PSN verses the expected PSN. */ if (unlikely (cmp_psn (psn, qp->r_psn) !=0 )) {/*
@@ -432,8 +426,6 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) wc.ex.imm_data =0 ; wc.wc_flags =0 ; send_last: -/* Get the number of bytes the message was padded by. */ - pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
@@ -527,8 +519,6 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) rdma_last_imm: wc.wc_flags =IB_WC_WITH_IMM ; -/* Get the number of bytes the message was padded by. */ - pad =ib_bth_get_pad (ohdr);/* Check for invalid length. */ /* LAST len should be >= 1 */ if (unlikely (tlen < (hdrsize + pad +4 )))
drivers/infiniband/hw/hfi1/ud.c +9 -14
@@ -668,36 +668,31 @@ static int opa_smp_check(struct hfi1_ibport *ibp, u16 pkey, u8 sc5,void hfi1_ud_rcv (struct hfi1_packet *packet) {struct ib_other_headers *ohdr = packet->ohdr; -int opcode;u32 hdrsize = packet->hlen;struct ib_wc wc;u32 qkey;u32 src_qp; -u16 dlid, pkey; +u16 pkey;int mgmt_pkey_idx =-1 ;struct hfi1_ibport *ibp =rcd_to_iport (packet->rcd);struct hfi1_pportdata *ppd =ppd_from_ibp (ibp);struct ib_header *hdr = packet->hdr; -u32 rcv_flags = packet->rcv_flags;void *data = packet->ebuf;u32 tlen = packet->tlen;struct rvt_qp *qp = packet->qp; -bool has_grh = rcv_flags &HFI1_HAS_GRH ;u8 sc5 =hfi1_9B_get_sc5 (hdr, packet->rhf);u32 bth1; -u8 sl_from_sc, sl; -u16 slid; -u8 extra_bytes; +u8 sl_from_sc; +u8 extra_bytes = packet->pad; +u8 opcode = packet->opcode; +u8 sl = packet->sl; +u32 dlid = packet->dlid; +u32 slid = packet->slid; + bth1 =be32_to_cpu (ohdr->bth[1 ]); qkey =ib_get_qkey (ohdr); src_qp =ib_get_sqpn (ohdr); - dlid =ib_get_dlid (hdr); - bth1 =be32_to_cpu (ohdr->bth[1 ]); - slid =ib_get_slid (hdr); pkey =ib_bth_get_pkey (ohdr); - opcode =ib_bth_get_opcode (ohdr); - sl =ib_get_sl (hdr); - extra_bytes =ib_bth_get_pad (ohdr); extra_bytes += (SIZE_OF_CRC <<2 ); sl_from_sc = ibp->sc_to_sl[sc5];
@@ -811,7 +806,7 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) qp->r_flags |=RVT_R_REUSE_SGE ; goto drop; } -if (has_grh) { +if (packet->grh) {hfi1_copy_sge (&qp->r_sge, &hdr->u.l.grh,sizeof (struct ib_grh ), true, false); wc.wc_flags |=IB_WC_GRH ;
drivers/infiniband/hw/hfi1/verbs.c +38 -51
149 lines not on this page · raw message
drivers/infiniband/hw/hfi1/verbs.h +2 -4
@@ -307,8 +307,7 @@ void hfi1_copy_sge(struct rvt_sge_state *ss, void *data, u32 length,void hfi1_rc_hdrerr (struct hfi1_ctxtdata *rcd, -struct ib_header *hdr, -u32 rcv_flags, +struct hfi1_packet *packet,struct rvt_qp *qp);u8 ah_to_sc (struct ib_device *ibdev,struct rdma_ah_attr *ah_attr);
@@ -346,8 +345,7 @@ static inline u8 get_opcode(struct ib_header *h)return be32_to_cpu (h->u.l.oth.bth[0 ]) >>24 ; } -int hfi1_ruc_check_hdr (struct hfi1_ibport *ibp,struct ib_header *hdr, -int has_grh,struct rvt_qp *qp,u32 bth0); +int hfi1_ruc_check_hdr (struct hfi1_ibport *ibp,struct hfi1_packet *packet);u32 hfi1_make_grh (struct hfi1_ibport *ibp,struct ib_grh *hdr,const struct ib_global_route *grh,u32 hwords,u32 nwords);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/6 IB/rdmavt: Compress adjacent SGEs in rvt_lkey_ok()
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
SGEs that are contiguous needlessly consume driver dependent TX resources.
The lkey validation logic is enhanced to compress the SGE that ends up in the send wqe when consecutive addresses are detected.
The lkey validation API used to return 1 (success) or 0 (fail).
The return value is now an -errno, 0 (compressed), or 1 (uncompressed). A additional argument is added to pass the last SQE for the compression.
Loopback callers always pass a NULL to last_sge since the optimization is of little benefit in that situation.
--- drivers/infiniband/hw/hfi1/ruc.c | 2 + drivers/infiniband/hw/qib/qib_ruc.c | 2 + drivers/infiniband/sw/rdmavt/mr.c | 51 ++++++++++++++++++++++---- drivers/infiniband/sw/rdmavt/qp.c | 23 +++++++----- drivers/infiniband/sw/rdmavt/trace_mr.h | 62 +++++++++++++++++++++++++++++++ drivers/infiniband/sw/rdmavt/trace_tx.h | 11 ++++-- include/rdma/rdma_vt.h | 3 +- 7 files changed, 130 insertions(+), 24 deletions(-)
drivers/infiniband/hw/hfi1/ruc.c +1 -1
@@ -75,7 +75,7 @@ static int init_sge(struct rvt_qp *qp, struct rvt_rwqe *wqe)continue ;/* Check LKEY */ if (!rvt_lkey_ok (rkt, pd, j ? &ss->sg_list[j -1 ] : &ss->sge, - &wqe->sg_list[i],IB_ACCESS_LOCAL_WRITE )) +NULL , &wqe->sg_list[i],IB_ACCESS_LOCAL_WRITE )) goto bad_lkey; qp->r_len += wqe->sg_list[i].length; j++;
drivers/infiniband/hw/qib/qib_ruc.c +1 -1
@@ -59,7 +59,7 @@ static int qib_init_sge(struct rvt_qp *qp, struct rvt_rwqe *wqe)continue ;/* Check LKEY */ if (!rvt_lkey_ok (rkt, pd, j ? &ss->sg_list[j -1 ] : &ss->sge, - &wqe->sg_list[i],IB_ACCESS_LOCAL_WRITE )) +NULL , &wqe->sg_list[i],IB_ACCESS_LOCAL_WRITE )) goto bad_lkey; qp->r_len += wqe->sg_list[i].length; j++;
drivers/infiniband/sw/rdmavt/mr.c +44 -7
97 lines not on this page · raw message
drivers/infiniband/sw/rdmavt/qp.c +13 -10
@@ -1646,7 +1646,7 @@ static int rvt_post_one_wr(struct rvt_qp *qp,struct rvt_pd *pd;struct rvt_dev_info *rdi =ib_to_rvt (qp->ibqp.device);u8 log_pmtu; -int ret; +int ret, incr;size_t cplen;bool reserved_op;int local_ops_delayed =0 ;
@@ -1719,22 +1719,23 @@ static int rvt_post_one_wr(struct rvt_qp *qp, wqe->length =0 ; j =0 ;if (wr->num_sge) { +struct rvt_sge *last_sge =NULL ; + acc = wr->opcode >=IB_WR_RDMA_READ ?IB_ACCESS_LOCAL_WRITE :0 ;for (i =0 ; i < wr->num_sge; i++) {u32 length = wr->sg_list[i].length; -int ok;if (length ==0 )continue ; - ok =rvt_lkey_ok (rkt, pd, &wqe->sg_list[j], - &wr->sg_list[i], acc); -if (!ok) { - ret = -EINVAL ; - goto bail_inval_free; - } + incr =rvt_lkey_ok (rkt, pd, &wqe->sg_list[j], last_sge, + &wr->sg_list[i], acc); +if (unlikely (incr <0 )) + goto bail_lkey_error; wqe->length += length; - j++; +if (incr) + last_sge = &wqe->sg_list[j]; + j += incr; } wqe->wr.num_sge = j; }
@@ -1781,12 +1782,14 @@ static int rvt_post_one_wr(struct rvt_qp *qp, wqe->wr.send_flags &= ~RVT_SEND_RESERVE_USED ; qp->s_avail--; } -trace_rvt_post_one_wr (qp, wqe); +trace_rvt_post_one_wr (qp, wqe, wr->num_sge);smp_wmb ();/* see request builders */ qp->s_head = next;return 0 ; +bail_lkey_error: + ret = incr; bail_inval_free:/* release mr holds */ while (j) {
drivers/infiniband/sw/rdmavt/trace_mr.h +62 -0
68 lines not on this page · raw message
drivers/infiniband/sw/rdmavt/trace_tx.h +7 -4
@@ -84,12 +84,12 @@ wr_opcode_name(RESERVED10))#define POS_PRN \ -"[%s] wqe %p wr_id %llx send_flags %x qpn %x qpt %u psn %x lpsn %x ssn %x length %u opcode 0x%.2x,%s size %u avail %u head %u last %u pid %u num_sge %u" +"[%s] wqe %p wr_id %llx send_flags %x qpn %x qpt %u psn %x lpsn %x ssn %x length %u opcode 0x%.2x,%s size %u avail %u head %u last %u pid %u num_sge %u wr_num_sge %u" TRACE_EVENT( rvt_post_one_wr, - TP_PROTO(struct rvt_qp *qp, struct rvt_swqe *wqe), - TP_ARGS(qp, wqe), + TP_PROTO(struct rvt_qp *qp, struct rvt_swqe *wqe, int wr_num_sge), + TP_ARGS(qp, wqe, wr_num_sge), TP_STRUCT__entry( RDI_DEV_ENTRY(ib_to_rvt(qp->ibqp.device)) __field(u64, wr_id)
@@ -108,6 +108,7 @@ __field(int, send_flags) __field(pid_t, pid) __field(int, num_sge) +__field (int, wr_num_sge) ),TP_fast_assign ( RDI_DEV_ASSIGN(ib_to_rvt(qp->ibqp.device))
@@ -127,6 +128,7 @@ __entry->ssn = wqe->ssn; __entry->send_flags = wqe->wr.send_flags; __entry->num_sge = wqe->wr.num_sge; + __entry->wr_num_sge = wr_num_sge; ), TP_printk( POS_PRN,
@@ -146,7 +148,8 @@ __entry->head, __entry->last, __entry->pid, - __entry->num_sge + __entry->num_sge, + __entry->wr_num_sge ) );
include/rdma/rdma_vt.h +2 -1
@@ -515,7 +515,8 @@ int rvt_fast_reg_mr(struct rvt_qp *qp, struct ib_mr *ibmr, u32 key,int rvt_rkey_ok (struct rvt_qp *qp,struct rvt_sge *sge,u32 len,u64 vaddr,u32 rkey,int acc);int rvt_lkey_ok (struct rvt_lkey_table *rkt,struct rvt_pd *pd, -struct rvt_sge *isge,struct ib_sge *sge,int acc); +struct rvt_sge *isge,struct rvt_sge *last_sge, +struct ib_sge *sge,int acc);struct rvt_mcast *rvt_mcast_find (struct rvt_ibport *ibp,union ib_gid *mgid,u16 lid);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Dennis Dalessandro
Hi Doug,
Here are some patches for-next. There are some clean ups to remove unused code
and useless initializations. We also continue cleaning up the code by packing
more fields into thehfi1_packetto keep them in a single place and adding
some enhancements to the input/output header tracing.
Quoted 4 lines
These apply on top of the two patches I just sent for RC.
Patches can can also be found in my GitHub repo at:
https://github.com/ddalessa/kernel/tree/for-4.13
Hi Denny,
Series applied.
Signature · 8 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html