Skip to content

Commit e08f6d4

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: IB/qib: Ensure that LOS and DFE are being turned off RDMA/cxgb4: Couple of abort fixes RDMA/cxgb4: Don't truncate MR lengths RDMA/cxgb4: Don't exceed hw IQ depth limit for user CQs
2 parents 890879c + c7d74b0 commit e08f6d4

File tree

6 files changed

+66
-22
lines changed

6 files changed

+66
-22
lines changed

drivers/infiniband/hw/cxgb4/cm.c

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,9 +1463,9 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb)
14631463
struct c4iw_qp_attributes attrs;
14641464
int disconnect = 1;
14651465
int release = 0;
1466-
int abort = 0;
14671466
struct tid_info *t = dev->rdev.lldi.tids;
14681467
unsigned int tid = GET_TID(hdr);
1468+
int ret;
14691469

14701470
ep = lookup_tid(t, tid);
14711471
PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
@@ -1501,10 +1501,12 @@ static int peer_close(struct c4iw_dev *dev, struct sk_buff *skb)
15011501
start_ep_timer(ep);
15021502
__state_set(&ep->com, CLOSING);
15031503
attrs.next_state = C4IW_QP_STATE_CLOSING;
1504-
abort = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
1504+
ret = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp,
15051505
C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
1506-
peer_close_upcall(ep);
1507-
disconnect = 1;
1506+
if (ret != -ECONNRESET) {
1507+
peer_close_upcall(ep);
1508+
disconnect = 1;
1509+
}
15081510
break;
15091511
case ABORTING:
15101512
disconnect = 0;
@@ -2109,15 +2111,16 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
21092111
break;
21102112
}
21112113

2112-
mutex_unlock(&ep->com.mutex);
21132114
if (close) {
2114-
if (abrupt)
2115-
ret = abort_connection(ep, NULL, gfp);
2116-
else
2115+
if (abrupt) {
2116+
close_complete_upcall(ep);
2117+
ret = send_abort(ep, NULL, gfp);
2118+
} else
21172119
ret = send_halfclose(ep, gfp);
21182120
if (ret)
21192121
fatal = 1;
21202122
}
2123+
mutex_unlock(&ep->com.mutex);
21212124
if (fatal)
21222125
release_ep_resources(ep);
21232126
return ret;
@@ -2301,6 +2304,31 @@ static int fw6_msg(struct c4iw_dev *dev, struct sk_buff *skb)
23012304
return 0;
23022305
}
23032306

2307+
static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb)
2308+
{
2309+
struct cpl_abort_req_rss *req = cplhdr(skb);
2310+
struct c4iw_ep *ep;
2311+
struct tid_info *t = dev->rdev.lldi.tids;
2312+
unsigned int tid = GET_TID(req);
2313+
2314+
ep = lookup_tid(t, tid);
2315+
if (is_neg_adv_abort(req->status)) {
2316+
PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep,
2317+
ep->hwtid);
2318+
kfree_skb(skb);
2319+
return 0;
2320+
}
2321+
PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid,
2322+
ep->com.state);
2323+
2324+
/*
2325+
* Wake up any threads in rdma_init() or rdma_fini().
2326+
*/
2327+
c4iw_wake_up(&ep->com.wr_wait, -ECONNRESET);
2328+
sched(dev, skb);
2329+
return 0;
2330+
}
2331+
23042332
/*
23052333
* Most upcalls from the T4 Core go to sched() to
23062334
* schedule the processing on a work queue.
@@ -2317,7 +2345,7 @@ c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS] = {
23172345
[CPL_PASS_ESTABLISH] = sched,
23182346
[CPL_PEER_CLOSE] = sched,
23192347
[CPL_CLOSE_CON_RPL] = sched,
2320-
[CPL_ABORT_REQ_RSS] = sched,
2348+
[CPL_ABORT_REQ_RSS] = peer_abort_intr,
23212349
[CPL_RDMA_TERMINATE] = sched,
23222350
[CPL_FW4_ACK] = sched,
23232351
[CPL_SET_TCB_RPL] = set_tcb_rpl,

drivers/infiniband/hw/cxgb4/cq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,10 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
801801
if (ucontext) {
802802
memsize = roundup(memsize, PAGE_SIZE);
803803
hwentries = memsize / sizeof *chp->cq.queue;
804+
while (hwentries > T4_MAX_IQ_SIZE) {
805+
memsize -= PAGE_SIZE;
806+
hwentries = memsize / sizeof *chp->cq.queue;
807+
}
804808
}
805809
chp->cq.size = hwentries;
806810
chp->cq.memsize = memsize;

drivers/infiniband/hw/cxgb4/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
625625
mhp->attr.perms = c4iw_ib_to_tpt_access(acc);
626626
mhp->attr.va_fbo = virt;
627627
mhp->attr.page_size = shift - 12;
628-
mhp->attr.len = (u32) length;
628+
mhp->attr.len = length;
629629

630630
err = register_mem(rhp, php, mhp, shift);
631631
if (err)

drivers/infiniband/hw/cxgb4/qp.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,11 +1207,8 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp,
12071207
c4iw_get_ep(&qhp->ep->com);
12081208
}
12091209
ret = rdma_fini(rhp, qhp, ep);
1210-
if (ret) {
1211-
if (internal)
1212-
c4iw_get_ep(&qhp->ep->com);
1210+
if (ret)
12131211
goto err;
1214-
}
12151212
break;
12161213
case C4IW_QP_STATE_TERMINATE:
12171214
set_state(qhp, C4IW_QP_STATE_TERMINATE);

drivers/infiniband/hw/qib/qib_iba7322.c

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ static u8 ib_rate_to_delay[IB_RATE_120_GBPS + 1] = {
469469
#define IB_7322_LT_STATE_RECOVERIDLE 0x0f
470470
#define IB_7322_LT_STATE_CFGENH 0x10
471471
#define IB_7322_LT_STATE_CFGTEST 0x11
472+
#define IB_7322_LT_STATE_CFGWAITRMTTEST 0x12
473+
#define IB_7322_LT_STATE_CFGWAITENH 0x13
472474

473475
/* link state machine states from IBC */
474476
#define IB_7322_L_STATE_DOWN 0x0
@@ -498,8 +500,10 @@ static const u8 qib_7322_physportstate[0x20] = {
498500
IB_PHYSPORTSTATE_LINK_ERR_RECOVER,
499501
[IB_7322_LT_STATE_CFGENH] = IB_PHYSPORTSTATE_CFG_ENH,
500502
[IB_7322_LT_STATE_CFGTEST] = IB_PHYSPORTSTATE_CFG_TRAIN,
501-
[0x12] = IB_PHYSPORTSTATE_CFG_TRAIN,
502-
[0x13] = IB_PHYSPORTSTATE_CFG_WAIT_ENH,
503+
[IB_7322_LT_STATE_CFGWAITRMTTEST] =
504+
IB_PHYSPORTSTATE_CFG_TRAIN,
505+
[IB_7322_LT_STATE_CFGWAITENH] =
506+
IB_PHYSPORTSTATE_CFG_WAIT_ENH,
503507
[0x14] = IB_PHYSPORTSTATE_CFG_TRAIN,
504508
[0x15] = IB_PHYSPORTSTATE_CFG_TRAIN,
505509
[0x16] = IB_PHYSPORTSTATE_CFG_TRAIN,
@@ -1692,7 +1696,9 @@ static void handle_serdes_issues(struct qib_pportdata *ppd, u64 ibcst)
16921696
break;
16931697
}
16941698

1695-
if (ibclt == IB_7322_LT_STATE_CFGTEST &&
1699+
if (((ibclt >= IB_7322_LT_STATE_CFGTEST &&
1700+
ibclt <= IB_7322_LT_STATE_CFGWAITENH) ||
1701+
ibclt == IB_7322_LT_STATE_LINKUP) &&
16961702
(ibcst & SYM_MASK(IBCStatusA_0, LinkSpeedQDR))) {
16971703
force_h1(ppd);
16981704
ppd->cpspec->qdr_reforce = 1;
@@ -7301,12 +7307,17 @@ static void ibsd_wr_allchans(struct qib_pportdata *ppd, int addr, unsigned data,
73017307
static void serdes_7322_los_enable(struct qib_pportdata *ppd, int enable)
73027308
{
73037309
u64 data = qib_read_kreg_port(ppd, krp_serdesctrl);
7304-
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS %s\n",
7305-
ppd->dd->unit, ppd->port, (enable ? "on" : "off"));
7306-
if (enable)
7310+
u8 state = SYM_FIELD(data, IBSerdesCtrl_0, RXLOSEN);
7311+
7312+
if (enable && !state) {
7313+
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS on\n",
7314+
ppd->dd->unit, ppd->port);
73077315
data |= SYM_MASK(IBSerdesCtrl_0, RXLOSEN);
7308-
else
7316+
} else if (!enable && state) {
7317+
printk(KERN_INFO QIB_DRV_NAME " IB%u:%u Turning LOS off\n",
7318+
ppd->dd->unit, ppd->port);
73097319
data &= ~SYM_MASK(IBSerdesCtrl_0, RXLOSEN);
7320+
}
73107321
qib_write_kreg_port(ppd, krp_serdesctrl, data);
73117322
}
73127323

drivers/infiniband/hw/qib/qib_intr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ void qib_handle_e_ibstatuschanged(struct qib_pportdata *ppd, u64 ibcs)
9696
* states, or if it transitions from any of the up (INIT or better)
9797
* states into any of the down states (except link recovery), then
9898
* call the chip-specific code to take appropriate actions.
99+
*
100+
* ppd->lflags could be 0 if this is the first time the interrupt
101+
* handlers has been called but the link is already up.
99102
*/
100-
if (lstate >= IB_PORT_INIT && (ppd->lflags & QIBL_LINKDOWN) &&
103+
if (lstate >= IB_PORT_INIT &&
104+
(!ppd->lflags || (ppd->lflags & QIBL_LINKDOWN)) &&
101105
ltstate == IB_PHYSPORTSTATE_LINKUP) {
102106
/* transitioned to UP */
103107
if (dd->f_ib_updown(ppd, 1, ibcs))

0 commit comments

Comments
 (0)