Skip to content

Commit 7cf6604

Browse files
committed
Merge branch 'cxgb4-next'
Hariprasad Shenai says: ==================== Misc. fixes for iw_cxgb4 This patch series adds support to determine ingress padding boundary at runtime. Advertise a larger max read queue depth for qps, and gather the resource limits from fw and use them to avoid exhausting all the resources and display TPTE on errors and add support for work request logging feature. The patches series is created against 'net-next' tree. And includes patches on cxgb4 and iw_cxgb4 driver. Since this patch-series contains changes which are dependent on commit id fc5ab02 ("cxgb4: Replaced the backdoor mechanism to access the HW memory with PCIe Window method") we would like to request this patch series to get merged via David Miller's 'net-next' tree. We have included all the maintainers of respective drivers. Kindly review the change and let us know in case of any review comments. V2: Optimized alloc_ird function, and several other changes related to debug prints based on review comments given by Yann Droneaud. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 5ee2c94 + 7730b4c commit 7cf6604

13 files changed

Lines changed: 528 additions & 61 deletions

File tree

‎drivers/infiniband/hw/cxgb4/cm.c‎

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ static int dack_mode = 1;
7979
module_param(dack_mode, int, 0644);
8080
MODULE_PARM_DESC(dack_mode, "Delayed ack mode (default=1)");
8181

82-
int c4iw_max_read_depth = 8;
82+
uint c4iw_max_read_depth = 32;
8383
module_param(c4iw_max_read_depth, int, 0644);
84-
MODULE_PARM_DESC(c4iw_max_read_depth, "Per-connection max ORD/IRD (default=8)");
84+
MODULE_PARM_DESC(c4iw_max_read_depth,
85+
"Per-connection max ORD/IRD (default=32)");
8586

8687
static int enable_tcp_timestamps;
8788
module_param(enable_tcp_timestamps, int, 0644);
@@ -813,6 +814,8 @@ static void send_mpa_req(struct c4iw_ep *ep, struct sk_buff *skb,
813814
if (mpa_rev_to_use == 2) {
814815
mpa->private_data_size = htons(ntohs(mpa->private_data_size) +
815816
sizeof (struct mpa_v2_conn_params));
817+
PDBG("%s initiator ird %u ord %u\n", __func__, ep->ird,
818+
ep->ord);
816819
mpa_v2_params.ird = htons((u16)ep->ird);
817820
mpa_v2_params.ord = htons((u16)ep->ord);
818821

@@ -1182,8 +1185,8 @@ static int connect_request_upcall(struct c4iw_ep *ep)
11821185
sizeof(struct mpa_v2_conn_params);
11831186
} else {
11841187
/* this means MPA_v1 is used. Send max supported */
1185-
event.ord = c4iw_max_read_depth;
1186-
event.ird = c4iw_max_read_depth;
1188+
event.ord = cur_max_read_depth(ep->com.dev);
1189+
event.ird = cur_max_read_depth(ep->com.dev);
11871190
event.private_data_len = ep->plen;
11881191
event.private_data = ep->mpa_pkt + sizeof(struct mpa_message);
11891192
}
@@ -1247,6 +1250,8 @@ static int update_rx_credits(struct c4iw_ep *ep, u32 credits)
12471250
return credits;
12481251
}
12491252

1253+
#define RELAXED_IRD_NEGOTIATION 1
1254+
12501255
static int process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb)
12511256
{
12521257
struct mpa_message *mpa;
@@ -1358,17 +1363,33 @@ static int process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb)
13581363
MPA_V2_IRD_ORD_MASK;
13591364
resp_ord = ntohs(mpa_v2_params->ord) &
13601365
MPA_V2_IRD_ORD_MASK;
1366+
PDBG("%s responder ird %u ord %u ep ird %u ord %u\n",
1367+
__func__, resp_ird, resp_ord, ep->ird, ep->ord);
13611368

13621369
/*
13631370
* This is a double-check. Ideally, below checks are
13641371
* not required since ird/ord stuff has been taken
13651372
* care of in c4iw_accept_cr
13661373
*/
1367-
if ((ep->ird < resp_ord) || (ep->ord > resp_ird)) {
1374+
if (ep->ird < resp_ord) {
1375+
if (RELAXED_IRD_NEGOTIATION && resp_ord <=
1376+
ep->com.dev->rdev.lldi.max_ordird_qp)
1377+
ep->ird = resp_ord;
1378+
else
1379+
insuff_ird = 1;
1380+
} else if (ep->ird > resp_ord) {
1381+
ep->ird = resp_ord;
1382+
}
1383+
if (ep->ord > resp_ird) {
1384+
if (RELAXED_IRD_NEGOTIATION)
1385+
ep->ord = resp_ird;
1386+
else
1387+
insuff_ird = 1;
1388+
}
1389+
if (insuff_ird) {
13681390
err = -ENOMEM;
13691391
ep->ird = resp_ord;
13701392
ep->ord = resp_ird;
1371-
insuff_ird = 1;
13721393
}
13731394

13741395
if (ntohs(mpa_v2_params->ird) &
@@ -1571,6 +1592,8 @@ static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb)
15711592
MPA_V2_IRD_ORD_MASK;
15721593
ep->ord = ntohs(mpa_v2_params->ord) &
15731594
MPA_V2_IRD_ORD_MASK;
1595+
PDBG("%s initiator ird %u ord %u\n", __func__, ep->ird,
1596+
ep->ord);
15741597
if (ntohs(mpa_v2_params->ird) & MPA_V2_PEER2PEER_MODEL)
15751598
if (peer2peer) {
15761599
if (ntohs(mpa_v2_params->ord) &
@@ -2724,40 +2747,50 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
27242747
BUG_ON(!qp);
27252748

27262749
set_bit(ULP_ACCEPT, &ep->com.history);
2727-
if ((conn_param->ord > c4iw_max_read_depth) ||
2728-
(conn_param->ird > c4iw_max_read_depth)) {
2750+
if ((conn_param->ord > cur_max_read_depth(ep->com.dev)) ||
2751+
(conn_param->ird > cur_max_read_depth(ep->com.dev))) {
27292752
abort_connection(ep, NULL, GFP_KERNEL);
27302753
err = -EINVAL;
27312754
goto err;
27322755
}
27332756

27342757
if (ep->mpa_attr.version == 2 && ep->mpa_attr.enhanced_rdma_conn) {
27352758
if (conn_param->ord > ep->ird) {
2736-
ep->ird = conn_param->ird;
2737-
ep->ord = conn_param->ord;
2738-
send_mpa_reject(ep, conn_param->private_data,
2739-
conn_param->private_data_len);
2740-
abort_connection(ep, NULL, GFP_KERNEL);
2741-
err = -ENOMEM;
2742-
goto err;
2759+
if (RELAXED_IRD_NEGOTIATION) {
2760+
ep->ord = ep->ird;
2761+
} else {
2762+
ep->ird = conn_param->ird;
2763+
ep->ord = conn_param->ord;
2764+
send_mpa_reject(ep, conn_param->private_data,
2765+
conn_param->private_data_len);
2766+
abort_connection(ep, NULL, GFP_KERNEL);
2767+
err = -ENOMEM;
2768+
goto err;
2769+
}
27432770
}
2744-
if (conn_param->ird > ep->ord) {
2745-
if (!ep->ord)
2746-
conn_param->ird = 1;
2747-
else {
2771+
if (conn_param->ird < ep->ord) {
2772+
if (RELAXED_IRD_NEGOTIATION &&
2773+
ep->ord <= h->rdev.lldi.max_ordird_qp) {
2774+
conn_param->ird = ep->ord;
2775+
} else {
27482776
abort_connection(ep, NULL, GFP_KERNEL);
27492777
err = -ENOMEM;
27502778
goto err;
27512779
}
27522780
}
2753-
27542781
}
27552782
ep->ird = conn_param->ird;
27562783
ep->ord = conn_param->ord;
27572784

2758-
if (ep->mpa_attr.version != 2)
2785+
if (ep->mpa_attr.version == 1) {
27592786
if (peer2peer && ep->ird == 0)
27602787
ep->ird = 1;
2788+
} else {
2789+
if (peer2peer &&
2790+
(ep->mpa_attr.p2p_type != FW_RI_INIT_P2PTYPE_DISABLED) &&
2791+
(p2p_type == FW_RI_INIT_P2PTYPE_READ_REQ) && ep->ord == 0)
2792+
ep->ird = 1;
2793+
}
27612794

27622795
PDBG("%s %d ird %d ord %d\n", __func__, __LINE__, ep->ird, ep->ord);
27632796

@@ -2796,6 +2829,7 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
27962829
return 0;
27972830
err1:
27982831
ep->com.cm_id = NULL;
2832+
abort_connection(ep, NULL, GFP_KERNEL);
27992833
cm_id->rem_ref(cm_id);
28002834
err:
28012835
mutex_unlock(&ep->com.mutex);
@@ -2879,8 +2913,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
28792913
int iptype;
28802914
int iwpm_err = 0;
28812915

2882-
if ((conn_param->ord > c4iw_max_read_depth) ||
2883-
(conn_param->ird > c4iw_max_read_depth)) {
2916+
if ((conn_param->ord > cur_max_read_depth(dev)) ||
2917+
(conn_param->ird > cur_max_read_depth(dev))) {
28842918
err = -EINVAL;
28852919
goto out;
28862920
}

‎drivers/infiniband/hw/cxgb4/cq.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,15 @@ static int poll_cq(struct t4_wq *wq, struct t4_cq *cq, struct t4_cqe *cqe,
633633
wq->sq.cidx = (uint16_t)idx;
634634
PDBG("%s completing sq idx %u\n", __func__, wq->sq.cidx);
635635
*cookie = wq->sq.sw_sq[wq->sq.cidx].wr_id;
636+
if (c4iw_wr_log)
637+
c4iw_log_wr_stats(wq, hw_cqe);
636638
t4_sq_consume(wq);
637639
} else {
638640
PDBG("%s completing rq idx %u\n", __func__, wq->rq.cidx);
639641
*cookie = wq->rq.sw_rq[wq->rq.cidx].wr_id;
640642
BUG_ON(t4_rq_empty(wq));
643+
if (c4iw_wr_log)
644+
c4iw_log_wr_stats(wq, hw_cqe);
641645
t4_rq_consume(wq);
642646
goto skip_cqe;
643647
}
@@ -895,7 +899,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
895899
/*
896900
* Make actual HW queue 2x to avoid cdix_inc overflows.
897901
*/
898-
hwentries = min(entries * 2, T4_MAX_IQ_SIZE);
902+
hwentries = min(entries * 2, rhp->rdev.hw_queue.t4_max_iq_size);
899903

900904
/*
901905
* Make HW queue at least 64 entries so GTS updates aren't too
@@ -912,7 +916,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
912916
if (ucontext) {
913917
memsize = roundup(memsize, PAGE_SIZE);
914918
hwentries = memsize / sizeof *chp->cq.queue;
915-
while (hwentries > T4_MAX_IQ_SIZE) {
919+
while (hwentries > rhp->rdev.hw_queue.t4_max_iq_size) {
916920
memsize -= PAGE_SIZE;
917921
hwentries = memsize / sizeof *chp->cq.queue;
918922
}

0 commit comments

Comments
 (0)