Commit e490974e authored by Jubin John's avatar Jubin John Committed by Doug Ledford

staging/rdma/hfi1: Add braces on all arms of statement

Add braces on all arms of statements to fix checkpatch check:
CHECK: braces {} should be used on all arms of this statement
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: default avatarJubin John <jubin.john@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 17fb4f29
...@@ -13829,9 +13829,9 @@ int hfi1_set_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt, u16 pkey) ...@@ -13829,9 +13829,9 @@ int hfi1_set_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt, u16 pkey)
int ret = 0; int ret = 0;
u64 reg; u64 reg;
if (ctxt < dd->num_rcv_contexts) if (ctxt < dd->num_rcv_contexts) {
rcd = dd->rcd[ctxt]; rcd = dd->rcd[ctxt];
else { } else {
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
...@@ -13857,9 +13857,9 @@ int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt) ...@@ -13857,9 +13857,9 @@ int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt)
int ret = 0; int ret = 0;
u64 reg; u64 reg;
if (ctxt < dd->num_rcv_contexts) if (ctxt < dd->num_rcv_contexts) {
rcd = dd->rcd[ctxt]; rcd = dd->rcd[ctxt];
else { } else {
ret = -EINVAL; ret = -EINVAL;
goto done; goto done;
} }
......
...@@ -302,9 +302,9 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, ...@@ -302,9 +302,9 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,
goto drop; goto drop;
/* Check for GRH */ /* Check for GRH */
if (lnh == HFI1_LRH_BTH) if (lnh == HFI1_LRH_BTH) {
ohdr = &hdr->u.oth; ohdr = &hdr->u.oth;
else if (lnh == HFI1_LRH_GRH) { } else if (lnh == HFI1_LRH_GRH) {
u32 vtf; u32 vtf;
ohdr = &hdr->u.l.oth; ohdr = &hdr->u.l.oth;
...@@ -314,9 +314,9 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, ...@@ -314,9 +314,9 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,
if ((vtf >> IB_GRH_VERSION_SHIFT) != IB_GRH_VERSION) if ((vtf >> IB_GRH_VERSION_SHIFT) != IB_GRH_VERSION)
goto drop; goto drop;
rcv_flags |= HFI1_HAS_GRH; rcv_flags |= HFI1_HAS_GRH;
} else } else {
goto drop; goto drop;
}
/* Get the destination QP number. */ /* Get the destination QP number. */
qp_num = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK; qp_num = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK;
if (lid < be16_to_cpu(IB_MULTICAST_LID_BASE)) { if (lid < be16_to_cpu(IB_MULTICAST_LID_BASE)) {
...@@ -618,14 +618,14 @@ static void __prescan_rxq(struct hfi1_packet *packet) ...@@ -618,14 +618,14 @@ static void __prescan_rxq(struct hfi1_packet *packet)
hfi1_get_msgheader(dd, rhf_addr); hfi1_get_msgheader(dd, rhf_addr);
lnh = be16_to_cpu(hdr->lrh[0]) & 3; lnh = be16_to_cpu(hdr->lrh[0]) & 3;
if (lnh == HFI1_LRH_BTH) if (lnh == HFI1_LRH_BTH) {
ohdr = &hdr->u.oth; ohdr = &hdr->u.oth;
else if (lnh == HFI1_LRH_GRH) { } else if (lnh == HFI1_LRH_GRH) {
ohdr = &hdr->u.l.oth; ohdr = &hdr->u.l.oth;
grh = &hdr->u.l.grh; grh = &hdr->u.l.grh;
} else } else {
goto next; /* just in case */ goto next; /* just in case */
}
bth1 = be32_to_cpu(ohdr->bth[1]); bth1 = be32_to_cpu(ohdr->bth[1]);
is_ecn = !!(bth1 & (HFI1_FECN_SMASK | HFI1_BECN_SMASK)); is_ecn = !!(bth1 & (HFI1_FECN_SMASK | HFI1_BECN_SMASK));
......
...@@ -399,8 +399,9 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data, ...@@ -399,8 +399,9 @@ static ssize_t hfi1_file_write(struct file *fp, const char __user *data,
ret = sc_enable(sc); ret = sc_enable(sc);
hfi1_rcvctrl(dd, HFI1_RCVCTRL_CTXT_ENB, hfi1_rcvctrl(dd, HFI1_RCVCTRL_CTXT_ENB,
uctxt->ctxt); uctxt->ctxt);
} else } else {
ret = sc_restart(sc); ret = sc_restart(sc);
}
if (!ret) if (!ret)
sc_return_credits(sc); sc_return_credits(sc);
break; break;
...@@ -1409,8 +1410,9 @@ static unsigned int poll_next(struct file *fp, ...@@ -1409,8 +1410,9 @@ static unsigned int poll_next(struct file *fp,
set_bit(HFI1_CTXT_WAITING_RCV, &uctxt->event_flags); set_bit(HFI1_CTXT_WAITING_RCV, &uctxt->event_flags);
hfi1_rcvctrl(dd, HFI1_RCVCTRL_INTRAVAIL_ENB, uctxt->ctxt); hfi1_rcvctrl(dd, HFI1_RCVCTRL_INTRAVAIL_ENB, uctxt->ctxt);
pollflag = 0; pollflag = 0;
} else } else {
pollflag = POLLIN | POLLRDNORM; pollflag = POLLIN | POLLRDNORM;
}
spin_unlock_irq(&dd->uctxt_lock); spin_unlock_irq(&dd->uctxt_lock);
return pollflag; return pollflag;
...@@ -1488,8 +1490,9 @@ static int manage_rcvq(struct hfi1_ctxtdata *uctxt, unsigned subctxt, ...@@ -1488,8 +1490,9 @@ static int manage_rcvq(struct hfi1_ctxtdata *uctxt, unsigned subctxt,
if (uctxt->rcvhdrtail_kvaddr) if (uctxt->rcvhdrtail_kvaddr)
clear_rcvhdrtail(uctxt); clear_rcvhdrtail(uctxt);
rcvctrl_op = HFI1_RCVCTRL_CTXT_ENB; rcvctrl_op = HFI1_RCVCTRL_CTXT_ENB;
} else } else {
rcvctrl_op = HFI1_RCVCTRL_CTXT_DIS; rcvctrl_op = HFI1_RCVCTRL_CTXT_DIS;
}
hfi1_rcvctrl(dd, rcvctrl_op, uctxt->ctxt); hfi1_rcvctrl(dd, rcvctrl_op, uctxt->ctxt);
/* always; new head should be equal to new tail; see above */ /* always; new head should be equal to new tail; see above */
bail: bail:
......
...@@ -1713,8 +1713,9 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd) ...@@ -1713,8 +1713,9 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd)
rcd->egrbufs.buffers[j].len)) { rcd->egrbufs.buffers[j].len)) {
j++; j++;
offset = 0; offset = 0;
} else } else {
offset += new_size; offset += new_size;
}
} }
rcd->egrbufs.rcvtid_size = new_size; rcd->egrbufs.rcvtid_size = new_size;
} }
......
...@@ -135,15 +135,16 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len) ...@@ -135,15 +135,16 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, unsigned len)
struct ib_ah *ah; struct ib_ah *ah;
ah = hfi1_create_qp0_ah(ibp, ibp->rvp.sm_lid); ah = hfi1_create_qp0_ah(ibp, ibp->rvp.sm_lid);
if (IS_ERR(ah)) if (IS_ERR(ah)) {
ret = PTR_ERR(ah); ret = PTR_ERR(ah);
else { } else {
send_buf->ah = ah; send_buf->ah = ah;
ibp->rvp.sm_ah = ibah_to_rvtah(ah); ibp->rvp.sm_ah = ibah_to_rvtah(ah);
ret = 0; ret = 0;
} }
} else } else {
ret = -EINVAL; ret = -EINVAL;
}
} else { } else {
send_buf->ah = &ibp->rvp.sm_ah->ibah; send_buf->ah = &ibp->rvp.sm_ah->ibah;
ret = 0; ret = 0;
...@@ -769,9 +770,9 @@ static int __subn_get_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data, ...@@ -769,9 +770,9 @@ static int __subn_get_opa_pkeytable(struct opa_smp *smp, u32 am, u8 *data,
p[i] = cpu_to_be16(q[i]); p[i] = cpu_to_be16(q[i]);
if (resp_len) if (resp_len)
*resp_len += size; *resp_len += size;
} else } else {
smp->status |= IB_SMP_INVALID_FIELD; smp->status |= IB_SMP_INVALID_FIELD;
}
return reply((struct ib_mad_hdr *)smp); return reply((struct ib_mad_hdr *)smp);
} }
...@@ -977,15 +978,15 @@ static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp, ...@@ -977,15 +978,15 @@ static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
break; break;
/* FALLTHROUGH */ /* FALLTHROUGH */
case IB_PORT_DOWN: case IB_PORT_DOWN:
if (phys_state == IB_PORTPHYSSTATE_NOP) if (phys_state == IB_PORTPHYSSTATE_NOP) {
link_state = HLS_DN_DOWNDEF; link_state = HLS_DN_DOWNDEF;
else if (phys_state == IB_PORTPHYSSTATE_POLLING) { } else if (phys_state == IB_PORTPHYSSTATE_POLLING) {
link_state = HLS_DN_POLL; link_state = HLS_DN_POLL;
set_link_down_reason(ppd, OPA_LINKDOWN_REASON_FM_BOUNCE, set_link_down_reason(ppd, OPA_LINKDOWN_REASON_FM_BOUNCE,
0, OPA_LINKDOWN_REASON_FM_BOUNCE); 0, OPA_LINKDOWN_REASON_FM_BOUNCE);
} else if (phys_state == IB_PORTPHYSSTATE_DISABLED) } else if (phys_state == IB_PORTPHYSSTATE_DISABLED) {
link_state = HLS_DN_DISABLE; link_state = HLS_DN_DISABLE;
else { } else {
pr_warn("SubnSet(OPA_PortInfo) invalid physical state 0x%x\n", pr_warn("SubnSet(OPA_PortInfo) invalid physical state 0x%x\n",
phys_state); phys_state);
smp->status |= IB_SMP_INVALID_FIELD; smp->status |= IB_SMP_INVALID_FIELD;
...@@ -1193,9 +1194,9 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data, ...@@ -1193,9 +1194,9 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
set_link_width_downgrade_enabled(ppd, lwe); set_link_width_downgrade_enabled(ppd, lwe);
call_link_downgrade_policy = 1; call_link_downgrade_policy = 1;
} }
} else } else {
smp->status |= IB_SMP_INVALID_FIELD; smp->status |= IB_SMP_INVALID_FIELD;
}
lse = be16_to_cpu(pi->link_speed.enabled); lse = be16_to_cpu(pi->link_speed.enabled);
if (lse) { if (lse) {
if (lse & be16_to_cpu(pi->link_speed.supported)) if (lse & be16_to_cpu(pi->link_speed.supported))
......
...@@ -123,8 +123,9 @@ int hfi1_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -123,8 +123,9 @@ int hfi1_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)
goto bail; goto bail;
} }
ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
} else } else {
ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
}
if (ret) { if (ret) {
hfi1_early_err(&pdev->dev, hfi1_early_err(&pdev->dev,
"Unable to set DMA consistent mask: %d\n", ret); "Unable to set DMA consistent mask: %d\n", ret);
......
...@@ -326,12 +326,15 @@ __be32 hfi1_compute_aeth(struct rvt_qp *qp) ...@@ -326,12 +326,15 @@ __be32 hfi1_compute_aeth(struct rvt_qp *qp)
x = (min + max) / 2; x = (min + max) / 2;
if (credit_table[x] == credits) if (credit_table[x] == credits)
break; break;
if (credit_table[x] > credits) if (credit_table[x] > credits) {
max = x; max = x;
else if (min == x) } else {
break; if (min == x) {
else break;
min = x; } else {
min = x;
}
}
} }
aeth |= x << HFI1_AETH_CREDIT_SHIFT; aeth |= x << HFI1_AETH_CREDIT_SHIFT;
} }
......
...@@ -505,9 +505,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -505,9 +505,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
len = pmtu; len = pmtu;
break; break;
} }
if (wqe->wr.opcode == IB_WR_SEND) if (wqe->wr.opcode == IB_WR_SEND) {
qp->s_state = OP(SEND_ONLY); qp->s_state = OP(SEND_ONLY);
else { } else {
qp->s_state = OP(SEND_ONLY_WITH_IMMEDIATE); qp->s_state = OP(SEND_ONLY_WITH_IMMEDIATE);
/* Immediate data comes after the BTH */ /* Immediate data comes after the BTH */
ohdr->u.imm_data = wqe->wr.ex.imm_data; ohdr->u.imm_data = wqe->wr.ex.imm_data;
...@@ -542,9 +542,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -542,9 +542,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
len = pmtu; len = pmtu;
break; break;
} }
if (wqe->wr.opcode == IB_WR_RDMA_WRITE) if (wqe->wr.opcode == IB_WR_RDMA_WRITE) {
qp->s_state = OP(RDMA_WRITE_ONLY); qp->s_state = OP(RDMA_WRITE_ONLY);
else { } else {
qp->s_state = qp->s_state =
OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE); OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE);
/* Immediate data comes after RETH */ /* Immediate data comes after RETH */
...@@ -672,9 +672,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -672,9 +672,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
middle = HFI1_CAP_IS_KSET(SDMA_AHG); middle = HFI1_CAP_IS_KSET(SDMA_AHG);
break; break;
} }
if (wqe->wr.opcode == IB_WR_SEND) if (wqe->wr.opcode == IB_WR_SEND) {
qp->s_state = OP(SEND_LAST); qp->s_state = OP(SEND_LAST);
else { } else {
qp->s_state = OP(SEND_LAST_WITH_IMMEDIATE); qp->s_state = OP(SEND_LAST_WITH_IMMEDIATE);
/* Immediate data comes after the BTH */ /* Immediate data comes after the BTH */
ohdr->u.imm_data = wqe->wr.ex.imm_data; ohdr->u.imm_data = wqe->wr.ex.imm_data;
...@@ -712,9 +712,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -712,9 +712,9 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
middle = HFI1_CAP_IS_KSET(SDMA_AHG); middle = HFI1_CAP_IS_KSET(SDMA_AHG);
break; break;
} }
if (wqe->wr.opcode == IB_WR_RDMA_WRITE) if (wqe->wr.opcode == IB_WR_RDMA_WRITE) {
qp->s_state = OP(RDMA_WRITE_LAST); qp->s_state = OP(RDMA_WRITE_LAST);
else { } else {
qp->s_state = OP(RDMA_WRITE_LAST_WITH_IMMEDIATE); qp->s_state = OP(RDMA_WRITE_LAST_WITH_IMMEDIATE);
/* Immediate data comes after the BTH */ /* Immediate data comes after the BTH */
ohdr->u.imm_data = wqe->wr.ex.imm_data; ohdr->u.imm_data = wqe->wr.ex.imm_data;
...@@ -1013,10 +1013,12 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait) ...@@ -1013,10 +1013,12 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait)
hfi1_send_complete(qp, wqe, IB_WC_RETRY_EXC_ERR); hfi1_send_complete(qp, wqe, IB_WC_RETRY_EXC_ERR);
rvt_error_qp(qp, IB_WC_WR_FLUSH_ERR); rvt_error_qp(qp, IB_WC_WR_FLUSH_ERR);
return; return;
} else /* need to handle delayed completion */ } else { /* need to handle delayed completion */
return; return;
} else }
} else {
qp->s_retry--; qp->s_retry--;
}
ibp = to_iport(qp->ibqp.device, qp->port_num); ibp = to_iport(qp->ibqp.device, qp->port_num);
if (wqe->wr.opcode == IB_WR_RDMA_READ) if (wqe->wr.opcode == IB_WR_RDMA_READ)
...@@ -1612,8 +1614,9 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp, ...@@ -1612,8 +1614,9 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,
val = ((u64)be32_to_cpu(p[0]) << 32) | val = ((u64)be32_to_cpu(p[0]) << 32) |
be32_to_cpu(p[1]); be32_to_cpu(p[1]);
} else } else {
val = 0; val = 0;
}
if (!do_rc_ack(qp, aeth, psn, opcode, val, rcd) || if (!do_rc_ack(qp, aeth, psn, opcode, val, rcd) ||
opcode != OP(RDMA_READ_RESPONSE_FIRST)) opcode != OP(RDMA_READ_RESPONSE_FIRST))
goto ack_done; goto ack_done;
......
...@@ -2009,8 +2009,9 @@ static int sdma_check_progress( ...@@ -2009,8 +2009,9 @@ static int sdma_check_progress(
ret = wait->sleep(sde, wait, tx, seq); ret = wait->sleep(sde, wait, tx, seq);
if (ret == -EAGAIN) if (ret == -EAGAIN)
sde->desc_avail = sdma_descq_freecnt(sde); sde->desc_avail = sdma_descq_freecnt(sde);
} else } else {
ret = -EBUSY; ret = -EBUSY;
}
return ret; return ret;
} }
......
...@@ -119,9 +119,9 @@ static void scl_out(struct hfi1_devdata *dd, u32 target, u8 bit) ...@@ -119,9 +119,9 @@ static void scl_out(struct hfi1_devdata *dd, u32 target, u8 bit)
* Allow for slow slaves by simple * Allow for slow slaves by simple
* delay for falling edge, sampling on rise. * delay for falling edge, sampling on rise.
*/ */
if (!bit) if (!bit) {
udelay(2); udelay(2);
else { } else {
int rise_usec; int rise_usec;
for (rise_usec = SCL_WAIT_USEC; rise_usec > 0; rise_usec -= 2) { for (rise_usec = SCL_WAIT_USEC; rise_usec > 0; rise_usec -= 2) {
......
...@@ -139,9 +139,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -139,9 +139,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
len = pmtu; len = pmtu;
break; break;
} }
if (wqe->wr.opcode == IB_WR_SEND) if (wqe->wr.opcode == IB_WR_SEND) {
qp->s_state = OP(SEND_ONLY); qp->s_state = OP(SEND_ONLY);
else { } else {
qp->s_state = qp->s_state =
OP(SEND_ONLY_WITH_IMMEDIATE); OP(SEND_ONLY_WITH_IMMEDIATE);
/* Immediate data comes after the BTH */ /* Immediate data comes after the BTH */
...@@ -168,9 +168,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -168,9 +168,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
len = pmtu; len = pmtu;
break; break;
} }
if (wqe->wr.opcode == IB_WR_RDMA_WRITE) if (wqe->wr.opcode == IB_WR_RDMA_WRITE) {
qp->s_state = OP(RDMA_WRITE_ONLY); qp->s_state = OP(RDMA_WRITE_ONLY);
else { } else {
qp->s_state = qp->s_state =
OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE); OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE);
/* Immediate data comes after the RETH */ /* Immediate data comes after the RETH */
...@@ -199,9 +199,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -199,9 +199,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
middle = HFI1_CAP_IS_KSET(SDMA_AHG); middle = HFI1_CAP_IS_KSET(SDMA_AHG);
break; break;
} }
if (wqe->wr.opcode == IB_WR_SEND) if (wqe->wr.opcode == IB_WR_SEND) {
qp->s_state = OP(SEND_LAST); qp->s_state = OP(SEND_LAST);
else { } else {
qp->s_state = OP(SEND_LAST_WITH_IMMEDIATE); qp->s_state = OP(SEND_LAST_WITH_IMMEDIATE);
/* Immediate data comes after the BTH */ /* Immediate data comes after the BTH */
ohdr->u.imm_data = wqe->wr.ex.imm_data; ohdr->u.imm_data = wqe->wr.ex.imm_data;
...@@ -224,9 +224,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -224,9 +224,9 @@ int hfi1_make_uc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
middle = HFI1_CAP_IS_KSET(SDMA_AHG); middle = HFI1_CAP_IS_KSET(SDMA_AHG);
break; break;
} }
if (wqe->wr.opcode == IB_WR_RDMA_WRITE) if (wqe->wr.opcode == IB_WR_RDMA_WRITE) {
qp->s_state = OP(RDMA_WRITE_LAST); qp->s_state = OP(RDMA_WRITE_LAST);
else { } else {
qp->s_state = qp->s_state =
OP(RDMA_WRITE_LAST_WITH_IMMEDIATE); OP(RDMA_WRITE_LAST_WITH_IMMEDIATE);
/* Immediate data comes after the BTH */ /* Immediate data comes after the BTH */
...@@ -353,8 +353,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) ...@@ -353,8 +353,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
qp->r_state == OP(SEND_MIDDLE)) { qp->r_state == OP(SEND_MIDDLE)) {
set_bit(RVT_R_REWIND_SGE, &qp->r_aflags); set_bit(RVT_R_REWIND_SGE, &qp->r_aflags);
qp->r_sge.num_sge = 0; qp->r_sge.num_sge = 0;
} else } else {
rvt_put_ss(&qp->r_sge); rvt_put_ss(&qp->r_sge);
}
qp->r_state = OP(SEND_LAST); qp->r_state = OP(SEND_LAST);
switch (opcode) { switch (opcode) {
case OP(SEND_FIRST): case OP(SEND_FIRST):
...@@ -410,9 +411,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) ...@@ -410,9 +411,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
case OP(SEND_ONLY): case OP(SEND_ONLY):
case OP(SEND_ONLY_WITH_IMMEDIATE): case OP(SEND_ONLY_WITH_IMMEDIATE):
send_first: send_first:
if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) {
qp->r_sge = qp->s_rdma_read_sge; qp->r_sge = qp->s_rdma_read_sge;
else { } else {
ret = hfi1_rvt_get_rwqe(qp, 0); ret = hfi1_rvt_get_rwqe(qp, 0);
if (ret < 0) if (ret < 0)
goto op_err; goto op_err;
...@@ -523,9 +524,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) ...@@ -523,9 +524,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
qp->r_sge.sge.length = 0; qp->r_sge.sge.length = 0;
qp->r_sge.sge.sge_length = 0; qp->r_sge.sge.sge_length = 0;
} }
if (opcode == OP(RDMA_WRITE_ONLY)) if (opcode == OP(RDMA_WRITE_ONLY)) {
goto rdma_last; goto rdma_last;
else if (opcode == OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE)) { } else if (opcode == OP(RDMA_WRITE_ONLY_WITH_IMMEDIATE)) {
wc.ex.imm_data = ohdr->u.rc.imm_data; wc.ex.imm_data = ohdr->u.rc.imm_data;
goto rdma_last_imm; goto rdma_last_imm;
} }
...@@ -555,9 +556,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet) ...@@ -555,9 +556,9 @@ void hfi1_uc_rcv(struct hfi1_packet *packet)
tlen -= (hdrsize + pad + 4); tlen -= (hdrsize + pad + 4);
if (unlikely(tlen + qp->r_rcv_len != qp->r_len)) if (unlikely(tlen + qp->r_rcv_len != qp->r_len))
goto drop; goto drop;
if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) if (test_and_clear_bit(RVT_R_REWIND_SGE, &qp->r_aflags)) {
rvt_put_ss(&qp->s_rdma_read_sge); rvt_put_ss(&qp->s_rdma_read_sge);
else { } else {
ret = hfi1_rvt_get_rwqe(qp, 1); ret = hfi1_rvt_get_rwqe(qp, 1);
if (ret < 0) if (ret < 0)
goto op_err; goto op_err;
......
...@@ -163,9 +163,9 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) ...@@ -163,9 +163,9 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
/* /*
* Get the next work request entry to find where to put the data. * Get the next work request entry to find where to put the data.
*/ */
if (qp->r_flags & RVT_R_REUSE_SGE) if (qp->r_flags & RVT_R_REUSE_SGE) {
qp->r_flags &= ~RVT_R_REUSE_SGE; qp->r_flags &= ~RVT_R_REUSE_SGE;
else { } else {
int ret; int ret;
ret = hfi1_rvt_get_rwqe(qp, 0); ret = hfi1_rvt_get_rwqe(qp, 0);
...@@ -190,8 +190,9 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe) ...@@ -190,8 +190,9 @@ static void ud_loopback(struct rvt_qp *sqp, struct rvt_swqe *swqe)
hfi1_copy_sge(&qp->r_sge, &ah_attr->grh, hfi1_copy_sge(&qp->r_sge, &ah_attr->grh,
sizeof(struct ib_grh), 1, 0); sizeof(struct ib_grh), 1, 0);
wc.wc_flags |= IB_WC_GRH; wc.wc_flags |= IB_WC_GRH;
} else } else {
hfi1_skip_sge(&qp->r_sge, sizeof(struct ib_grh), 1); hfi1_skip_sge(&qp->r_sge, sizeof(struct ib_grh), 1);
}
ssge.sg_list = swqe->sg_list + 1; ssge.sg_list = swqe->sg_list + 1;
ssge.sge = *swqe->sg_list; ssge.sge = *swqe->sg_list;
ssge.num_sge = swqe->wr.num_sge; ssge.num_sge = swqe->wr.num_sge;
...@@ -383,8 +384,9 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps) ...@@ -383,8 +384,9 @@ int hfi1_make_ud_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
qp->s_hdrwords++; qp->s_hdrwords++;
ohdr->u.ud.imm_data = wqe->wr.ex.imm_data; ohdr->u.ud.imm_data = wqe->wr.ex.imm_data;
bth0 = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE << 24; bth0 = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE << 24;
} else } else {
bth0 = IB_OPCODE_UD_SEND_ONLY << 24; bth0 = IB_OPCODE_UD_SEND_ONLY << 24;
}
sc5 = ibp->sl_to_sc[ah_attr->sl]; sc5 = ibp->sl_to_sc[ah_attr->sl];
lrh0 |= (ah_attr->sl & 0xf) << 4; lrh0 |= (ah_attr->sl & 0xf) << 4;
if (qp->ibqp.qp_type == IB_QPT_SMI) { if (qp->ibqp.qp_type == IB_QPT_SMI) {
...@@ -820,8 +822,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -820,8 +822,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
} else if (opcode == IB_OPCODE_UD_SEND_ONLY) { } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
wc.ex.imm_data = 0; wc.ex.imm_data = 0;
wc.wc_flags = 0; wc.wc_flags = 0;
} else } else {
goto drop; goto drop;
}
/* /*
* A GRH is expected to precede the data even if not * A GRH is expected to precede the data even if not
...@@ -832,9 +835,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -832,9 +835,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
/* /*
* Get the next work request entry to find where to put the data. * Get the next work request entry to find where to put the data.
*/ */
if (qp->r_flags & RVT_R_REUSE_SGE) if (qp->r_flags & RVT_R_REUSE_SGE) {
qp->r_flags &= ~RVT_R_REUSE_SGE; qp->r_flags &= ~RVT_R_REUSE_SGE;
else { } else {
int ret; int ret;
ret = hfi1_rvt_get_rwqe(qp, 0); ret = hfi1_rvt_get_rwqe(qp, 0);
...@@ -857,8 +860,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -857,8 +860,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
hfi1_copy_sge(&qp->r_sge, &hdr->u.l.grh, hfi1_copy_sge(&qp->r_sge, &hdr->u.l.grh,
sizeof(struct ib_grh), 1, 0); sizeof(struct ib_grh), 1, 0);
wc.wc_flags |= IB_WC_GRH; wc.wc_flags |= IB_WC_GRH;
} else } else {
hfi1_skip_sge(&qp->r_sge, sizeof(struct ib_grh), 1); hfi1_skip_sge(&qp->r_sge, sizeof(struct ib_grh), 1);
}
hfi1_copy_sge(&qp->r_sge, data, wc.byte_len - sizeof(struct ib_grh), hfi1_copy_sge(&qp->r_sge, data, wc.byte_len - sizeof(struct ib_grh),
1, 0); 1, 0);
rvt_put_ss(&qp->r_sge); rvt_put_ss(&qp->r_sge);
...@@ -884,8 +888,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) ...@@ -884,8 +888,9 @@ void hfi1_ud_rcv(struct hfi1_packet *packet)
} }
} }
wc.pkey_index = (unsigned)mgmt_pkey_idx; wc.pkey_index = (unsigned)mgmt_pkey_idx;
} else } else {
wc.pkey_index = 0; wc.pkey_index = 0;
}
wc.slid = be16_to_cpu(hdr->lrh[3]); wc.slid = be16_to_cpu(hdr->lrh[3]);
sc = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf; sc = (be16_to_cpu(hdr->lrh[0]) >> 12) & 0xf;
......
...@@ -765,8 +765,9 @@ static inline u32 compute_data_length(struct user_sdma_request *req, ...@@ -765,8 +765,9 @@ static inline u32 compute_data_length(struct user_sdma_request *req,
* remaining. * remaining.
*/ */
len = min(len, req->data_len - req->sent); len = min(len, req->data_len - req->sent);
} else } else {
len = min(req->data_len - req->sent, (u32)req->info.fragsize); len = min(req->data_len - req->sent, (u32)req->info.fragsize);
}
SDMA_DBG(req, "Data Length = %u", len); SDMA_DBG(req, "Data Length = %u", len);
return len; return len;
} }
...@@ -1337,8 +1338,9 @@ static int set_txreq_header_ahg(struct user_sdma_request *req, ...@@ -1337,8 +1338,9 @@ static int set_txreq_header_ahg(struct user_sdma_request *req,
INTR) >> 16); INTR) >> 16);
val &= cpu_to_le16(~(1U << 13)); val &= cpu_to_le16(~(1U << 13));
AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val); AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val);
} else } else {
AHG_HEADER_SET(req->ahg, diff, 7, 16, 12, val); AHG_HEADER_SET(req->ahg, diff, 7, 16, 12, val);
}
} }
trace_hfi1_sdma_user_header_ahg(pq->dd, pq->ctxt, pq->subctxt, trace_hfi1_sdma_user_header_ahg(pq->dd, pq->ctxt, pq->subctxt,
......
...@@ -400,9 +400,9 @@ void hfi1_ib_rcv(struct hfi1_packet *packet) ...@@ -400,9 +400,9 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)
/* Check for GRH */ /* Check for GRH */
lnh = be16_to_cpu(hdr->lrh[0]) & 3; lnh = be16_to_cpu(hdr->lrh[0]) & 3;
if (lnh == HFI1_LRH_BTH) if (lnh == HFI1_LRH_BTH) {
packet->ohdr = &hdr->u.oth; packet->ohdr = &hdr->u.oth;
else if (lnh == HFI1_LRH_GRH) { } else if (lnh == HFI1_LRH_GRH) {
u32 vtf; u32 vtf;
packet->ohdr = &hdr->u.l.oth; packet->ohdr = &hdr->u.l.oth;
...@@ -412,8 +412,9 @@ void hfi1_ib_rcv(struct hfi1_packet *packet) ...@@ -412,8 +412,9 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)
if ((vtf >> IB_GRH_VERSION_SHIFT) != IB_GRH_VERSION) if ((vtf >> IB_GRH_VERSION_SHIFT) != IB_GRH_VERSION)
goto drop; goto drop;
packet->rcv_flags |= HFI1_HAS_GRH; packet->rcv_flags |= HFI1_HAS_GRH;
} else } else {
goto drop; goto drop;
}
trace_input_ibhdr(rcd->dd, hdr); trace_input_ibhdr(rcd->dd, hdr);
...@@ -528,9 +529,9 @@ static void verbs_sdma_complete( ...@@ -528,9 +529,9 @@ static void verbs_sdma_complete(
struct rvt_qp *qp = tx->qp; struct rvt_qp *qp = tx->qp;
spin_lock(&qp->s_lock); spin_lock(&qp->s_lock);
if (tx->wqe) if (tx->wqe) {
hfi1_send_complete(qp, tx->wqe, IB_WC_SUCCESS); hfi1_send_complete(qp, tx->wqe, IB_WC_SUCCESS);
else if (qp->ibqp.qp_type == IB_QPT_RC) { } else if (qp->ibqp.qp_type == IB_QPT_RC) {
struct hfi1_ib_header *hdr; struct hfi1_ib_header *hdr;
hdr = &tx->phdr.hdr; hdr = &tx->phdr.hdr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment