Commit 1bb4238b authored by David S. Miller's avatar David S. Miller

Merge branch 'cxgb4-next'

Hariprasad Shenai says:

====================
Misc. fix for cxgb4 and iw_cxgb4

This patch series adds support to enchance error reporting, log detailed
warning for negative advice, support query_qp verb and advertise correct
device max attributes for iwarp.

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
4c2c5763 ("cxgb4/iw_cxgb4: use firmware ord/ird resource limits") of net-next
tree we would like to request this patch series to get merged via David Miller's
'net-next' tree.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents bc3bd3f4 91244bbd
...@@ -1813,6 +1813,20 @@ static int is_neg_adv(unsigned int status) ...@@ -1813,6 +1813,20 @@ static int is_neg_adv(unsigned int status)
status == CPL_ERR_KEEPALV_NEG_ADVICE; status == CPL_ERR_KEEPALV_NEG_ADVICE;
} }
static char *neg_adv_str(unsigned int status)
{
switch (status) {
case CPL_ERR_RTX_NEG_ADVICE:
return "Retransmit timeout";
case CPL_ERR_PERSIST_NEG_ADVICE:
return "Persist timeout";
case CPL_ERR_KEEPALV_NEG_ADVICE:
return "Keepalive timeout";
default:
return "Unknown";
}
}
static void set_tcp_window(struct c4iw_ep *ep, struct port_info *pi) static void set_tcp_window(struct c4iw_ep *ep, struct port_info *pi)
{ {
ep->snd_win = snd_win; ep->snd_win = snd_win;
...@@ -2011,8 +2025,9 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2011,8 +2025,9 @@ static int act_open_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
status, status2errno(status)); status, status2errno(status));
if (is_neg_adv(status)) { if (is_neg_adv(status)) {
printk(KERN_WARNING MOD "Connection problems for atid %u\n", dev_warn(&dev->rdev.lldi.pdev->dev,
atid); "Connection problems for atid %u status %u (%s)\n",
atid, status, neg_adv_str(status));
return 0; return 0;
} }
...@@ -2488,8 +2503,9 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -2488,8 +2503,9 @@ static int peer_abort(struct c4iw_dev *dev, struct sk_buff *skb)
ep = lookup_tid(t, tid); ep = lookup_tid(t, tid);
if (is_neg_adv(req->status)) { if (is_neg_adv(req->status)) {
PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep, dev_warn(&dev->rdev.lldi.pdev->dev,
ep->hwtid); "Negative advice on abort - tid %u status %d (%s)\n",
ep->hwtid, req->status, neg_adv_str(req->status));
return 0; return 0;
} }
PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid, PDBG("%s ep %p tid %u state %u\n", __func__, ep, ep->hwtid,
...@@ -3894,8 +3910,9 @@ static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb) ...@@ -3894,8 +3910,9 @@ static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb)
return 0; return 0;
} }
if (is_neg_adv(req->status)) { if (is_neg_adv(req->status)) {
PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep, dev_warn(&dev->rdev.lldi.pdev->dev,
ep->hwtid); "Negative advice on abort - tid %u status %d (%s)\n",
ep->hwtid, req->status, neg_adv_str(req->status));
kfree_skb(skb); kfree_skb(skb);
return 0; return 0;
} }
......
...@@ -913,14 +913,8 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries, ...@@ -913,14 +913,8 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
/* /*
* memsize must be a multiple of the page size if its a user cq. * memsize must be a multiple of the page size if its a user cq.
*/ */
if (ucontext) { if (ucontext)
memsize = roundup(memsize, PAGE_SIZE); memsize = roundup(memsize, PAGE_SIZE);
hwentries = memsize / sizeof *chp->cq.queue;
while (hwentries > rhp->rdev.hw_queue.t4_max_iq_size) {
memsize -= PAGE_SIZE;
hwentries = memsize / sizeof *chp->cq.queue;
}
}
chp->cq.size = hwentries; chp->cq.size = hwentries;
chp->cq.memsize = memsize; chp->cq.memsize = memsize;
chp->cq.vector = vector; chp->cq.vector = vector;
......
...@@ -934,17 +934,17 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) ...@@ -934,17 +934,17 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
devp->rdev.hw_queue.t4_eq_status_entries = devp->rdev.hw_queue.t4_eq_status_entries =
devp->rdev.lldi.sge_ingpadboundary > 64 ? 2 : 1; devp->rdev.lldi.sge_ingpadboundary > 64 ? 2 : 1;
devp->rdev.hw_queue.t4_max_eq_size = devp->rdev.hw_queue.t4_max_eq_size = 65520;
65520 - devp->rdev.hw_queue.t4_eq_status_entries; devp->rdev.hw_queue.t4_max_iq_size = 65520;
devp->rdev.hw_queue.t4_max_iq_size = 65520 - 1; devp->rdev.hw_queue.t4_max_rq_size = 8192 -
devp->rdev.hw_queue.t4_max_rq_size = devp->rdev.hw_queue.t4_eq_status_entries - 1;
8192 - devp->rdev.hw_queue.t4_eq_status_entries;
devp->rdev.hw_queue.t4_max_sq_size = devp->rdev.hw_queue.t4_max_sq_size =
devp->rdev.hw_queue.t4_max_eq_size - 1; devp->rdev.hw_queue.t4_max_eq_size -
devp->rdev.hw_queue.t4_eq_status_entries - 1;
devp->rdev.hw_queue.t4_max_qp_depth = devp->rdev.hw_queue.t4_max_qp_depth =
devp->rdev.hw_queue.t4_max_rq_size - 1; devp->rdev.hw_queue.t4_max_rq_size;
devp->rdev.hw_queue.t4_max_cq_depth = devp->rdev.hw_queue.t4_max_cq_depth =
devp->rdev.hw_queue.t4_max_iq_size - 1; devp->rdev.hw_queue.t4_max_iq_size - 2;
devp->rdev.hw_queue.t4_stat_len = devp->rdev.hw_queue.t4_stat_len =
devp->rdev.lldi.sge_egrstatuspagesize; devp->rdev.lldi.sge_egrstatuspagesize;
......
...@@ -193,7 +193,7 @@ static inline int c4iw_fatal_error(struct c4iw_rdev *rdev) ...@@ -193,7 +193,7 @@ static inline int c4iw_fatal_error(struct c4iw_rdev *rdev)
static inline int c4iw_num_stags(struct c4iw_rdev *rdev) static inline int c4iw_num_stags(struct c4iw_rdev *rdev)
{ {
return min((int)T4_MAX_NUM_STAG, (int)(rdev->lldi.vr->stag.size >> 5)); return (int)(rdev->lldi.vr->stag.size >> 5);
} }
#define C4IW_WR_TO (30*HZ) #define C4IW_WR_TO (30*HZ)
......
...@@ -318,7 +318,7 @@ static int c4iw_query_device(struct ib_device *ibdev, ...@@ -318,7 +318,7 @@ static int c4iw_query_device(struct ib_device *ibdev,
props->vendor_id = (u32)dev->rdev.lldi.pdev->vendor; props->vendor_id = (u32)dev->rdev.lldi.pdev->vendor;
props->vendor_part_id = (u32)dev->rdev.lldi.pdev->device; props->vendor_part_id = (u32)dev->rdev.lldi.pdev->device;
props->max_mr_size = T4_MAX_MR_SIZE; props->max_mr_size = T4_MAX_MR_SIZE;
props->max_qp = T4_MAX_NUM_QP; props->max_qp = dev->rdev.lldi.vr->qp.size / 2;
props->max_qp_wr = dev->rdev.hw_queue.t4_max_qp_depth; props->max_qp_wr = dev->rdev.hw_queue.t4_max_qp_depth;
props->max_sge = T4_MAX_RECV_SGE; props->max_sge = T4_MAX_RECV_SGE;
props->max_sge_rd = 1; props->max_sge_rd = 1;
...@@ -326,7 +326,7 @@ static int c4iw_query_device(struct ib_device *ibdev, ...@@ -326,7 +326,7 @@ static int c4iw_query_device(struct ib_device *ibdev,
props->max_qp_rd_atom = min(dev->rdev.lldi.max_ordird_qp, props->max_qp_rd_atom = min(dev->rdev.lldi.max_ordird_qp,
c4iw_max_read_depth); c4iw_max_read_depth);
props->max_qp_init_rd_atom = props->max_qp_rd_atom; props->max_qp_init_rd_atom = props->max_qp_rd_atom;
props->max_cq = T4_MAX_NUM_CQ; props->max_cq = dev->rdev.lldi.vr->qp.size;
props->max_cqe = dev->rdev.hw_queue.t4_max_cq_depth; props->max_cqe = dev->rdev.hw_queue.t4_max_cq_depth;
props->max_mr = c4iw_num_stags(&dev->rdev); props->max_mr = c4iw_num_stags(&dev->rdev);
props->max_pd = T4_MAX_NUM_PD; props->max_pd = T4_MAX_NUM_PD;
......
...@@ -205,9 +205,9 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, ...@@ -205,9 +205,9 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
} }
/* /*
* RQT must be a power of 2. * RQT must be a power of 2 and at least 16 deep.
*/ */
wq->rq.rqt_size = roundup_pow_of_two(wq->rq.size); wq->rq.rqt_size = roundup_pow_of_two(max_t(u16, wq->rq.size, 16));
wq->rq.rqt_hwaddr = c4iw_rqtpool_alloc(rdev, wq->rq.rqt_size); wq->rq.rqt_hwaddr = c4iw_rqtpool_alloc(rdev, wq->rq.rqt_size);
if (!wq->rq.rqt_hwaddr) { if (!wq->rq.rqt_hwaddr) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1621,13 +1621,17 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, ...@@ -1621,13 +1621,17 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
if (attrs->cap.max_inline_data > T4_MAX_SEND_INLINE) if (attrs->cap.max_inline_data > T4_MAX_SEND_INLINE)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
rqsize = roundup(attrs->cap.max_recv_wr + 1, 16); if (attrs->cap.max_recv_wr > rhp->rdev.hw_queue.t4_max_rq_size)
if (rqsize > rhp->rdev.hw_queue.t4_max_rq_size)
return ERR_PTR(-E2BIG); return ERR_PTR(-E2BIG);
rqsize = attrs->cap.max_recv_wr + 1;
if (rqsize < 8)
rqsize = 8;
sqsize = roundup(attrs->cap.max_send_wr + 1, 16); if (attrs->cap.max_send_wr > rhp->rdev.hw_queue.t4_max_sq_size)
if (sqsize > rhp->rdev.hw_queue.t4_max_sq_size)
return ERR_PTR(-E2BIG); return ERR_PTR(-E2BIG);
sqsize = attrs->cap.max_send_wr + 1;
if (sqsize < 8)
sqsize = 8;
ucontext = pd->uobject ? to_c4iw_ucontext(pd->uobject->context) : NULL; ucontext = pd->uobject ? to_c4iw_ucontext(pd->uobject->context) : NULL;
...@@ -1635,19 +1639,20 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, ...@@ -1635,19 +1639,20 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
if (!qhp) if (!qhp)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
qhp->wq.sq.size = sqsize; qhp->wq.sq.size = sqsize;
qhp->wq.sq.memsize = (sqsize + 1) * sizeof *qhp->wq.sq.queue; qhp->wq.sq.memsize =
(sqsize + rhp->rdev.hw_queue.t4_eq_status_entries) *
sizeof(*qhp->wq.sq.queue) + 16 * sizeof(__be64);
qhp->wq.sq.flush_cidx = -1; qhp->wq.sq.flush_cidx = -1;
qhp->wq.rq.size = rqsize; qhp->wq.rq.size = rqsize;
qhp->wq.rq.memsize = (rqsize + 1) * sizeof *qhp->wq.rq.queue; qhp->wq.rq.memsize =
(rqsize + rhp->rdev.hw_queue.t4_eq_status_entries) *
sizeof(*qhp->wq.rq.queue);
if (ucontext) { if (ucontext) {
qhp->wq.sq.memsize = roundup(qhp->wq.sq.memsize, PAGE_SIZE); qhp->wq.sq.memsize = roundup(qhp->wq.sq.memsize, PAGE_SIZE);
qhp->wq.rq.memsize = roundup(qhp->wq.rq.memsize, PAGE_SIZE); qhp->wq.rq.memsize = roundup(qhp->wq.rq.memsize, PAGE_SIZE);
} }
PDBG("%s sqsize %u sqmemsize %zu rqsize %u rqmemsize %zu\n",
__func__, sqsize, qhp->wq.sq.memsize, rqsize, qhp->wq.rq.memsize);
ret = create_qp(&rhp->rdev, &qhp->wq, &schp->cq, &rchp->cq, ret = create_qp(&rhp->rdev, &qhp->wq, &schp->cq, &rchp->cq,
ucontext ? &ucontext->uctx : &rhp->rdev.uctx); ucontext ? &ucontext->uctx : &rhp->rdev.uctx);
if (ret) if (ret)
...@@ -1766,9 +1771,11 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, ...@@ -1766,9 +1771,11 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
qhp->ibqp.qp_num = qhp->wq.sq.qid; qhp->ibqp.qp_num = qhp->wq.sq.qid;
init_timer(&(qhp->timer)); init_timer(&(qhp->timer));
INIT_LIST_HEAD(&qhp->db_fc_entry); INIT_LIST_HEAD(&qhp->db_fc_entry);
PDBG("%s qhp %p sq_num_entries %d, rq_num_entries %d qpid 0x%0x\n", PDBG("%s sq id %u size %u memsize %zu num_entries %u "
__func__, qhp, qhp->attr.sq_num_entries, qhp->attr.rq_num_entries, "rq id %u size %u memsize %zu num_entries %u\n", __func__,
qhp->wq.sq.qid); qhp->wq.sq.qid, qhp->wq.sq.size, qhp->wq.sq.memsize,
attrs->cap.max_send_wr, qhp->wq.rq.qid, qhp->wq.rq.size,
qhp->wq.rq.memsize, attrs->cap.max_recv_wr);
return &qhp->ibqp; return &qhp->ibqp;
err8: err8:
kfree(mm5); kfree(mm5);
...@@ -1856,5 +1863,11 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, ...@@ -1856,5 +1863,11 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
memset(attr, 0, sizeof *attr); memset(attr, 0, sizeof *attr);
memset(init_attr, 0, sizeof *init_attr); memset(init_attr, 0, sizeof *init_attr);
attr->qp_state = to_ib_qp_state(qhp->attr.state); attr->qp_state = to_ib_qp_state(qhp->attr.state);
init_attr->cap.max_send_wr = qhp->attr.sq_num_entries;
init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries;
init_attr->cap.max_send_sge = qhp->attr.sq_max_sges;
init_attr->cap.max_recv_sge = qhp->attr.sq_max_sges;
init_attr->cap.max_inline_data = T4_MAX_SEND_INLINE;
init_attr->sq_sig_type = qhp->sq_sig_all ? IB_SIGNAL_ALL_WR : 0;
return 0; return 0;
} }
...@@ -36,10 +36,7 @@ ...@@ -36,10 +36,7 @@
#include "t4_msg.h" #include "t4_msg.h"
#include "t4fw_ri_api.h" #include "t4fw_ri_api.h"
#define T4_MAX_NUM_QP 65536
#define T4_MAX_NUM_CQ 65536
#define T4_MAX_NUM_PD 65536 #define T4_MAX_NUM_PD 65536
#define T4_MAX_NUM_STAG (1<<15)
#define T4_MAX_MR_SIZE (~0ULL) #define T4_MAX_MR_SIZE (~0ULL)
#define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */ #define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */
#define T4_STAG_UNSET 0xffffffff #define T4_STAG_UNSET 0xffffffff
......
...@@ -1719,16 +1719,24 @@ static void mps_intr_handler(struct adapter *adapter) ...@@ -1719,16 +1719,24 @@ static void mps_intr_handler(struct adapter *adapter)
*/ */
static void mem_intr_handler(struct adapter *adapter, int idx) static void mem_intr_handler(struct adapter *adapter, int idx)
{ {
static const char name[3][5] = { "EDC0", "EDC1", "MC" }; static const char name[4][7] = { "EDC0", "EDC1", "MC/MC0", "MC1" };
unsigned int addr, cnt_addr, v; unsigned int addr, cnt_addr, v;
if (idx <= MEM_EDC1) { if (idx <= MEM_EDC1) {
addr = EDC_REG(EDC_INT_CAUSE, idx); addr = EDC_REG(EDC_INT_CAUSE, idx);
cnt_addr = EDC_REG(EDC_ECC_STATUS, idx); cnt_addr = EDC_REG(EDC_ECC_STATUS, idx);
} else { } else if (idx == MEM_MC) {
if (is_t4(adapter->params.chip)) {
addr = MC_INT_CAUSE; addr = MC_INT_CAUSE;
cnt_addr = MC_ECC_STATUS; cnt_addr = MC_ECC_STATUS;
} else {
addr = MC_P_INT_CAUSE;
cnt_addr = MC_P_ECC_STATUS;
}
} else {
addr = MC_REG(MC_P_INT_CAUSE, 1);
cnt_addr = MC_REG(MC_P_ECC_STATUS, 1);
} }
v = t4_read_reg(adapter, addr) & MEM_INT_MASK; v = t4_read_reg(adapter, addr) & MEM_INT_MASK;
...@@ -1892,6 +1900,8 @@ int t4_slow_intr_handler(struct adapter *adapter) ...@@ -1892,6 +1900,8 @@ int t4_slow_intr_handler(struct adapter *adapter)
pcie_intr_handler(adapter); pcie_intr_handler(adapter);
if (cause & MC) if (cause & MC)
mem_intr_handler(adapter, MEM_MC); mem_intr_handler(adapter, MEM_MC);
if (!is_t4(adapter->params.chip) && (cause & MC1))
mem_intr_handler(adapter, MEM_MC1);
if (cause & EDC0) if (cause & EDC0)
mem_intr_handler(adapter, MEM_EDC0); mem_intr_handler(adapter, MEM_EDC0);
if (cause & EDC1) if (cause & EDC1)
......
...@@ -448,11 +448,13 @@ ...@@ -448,11 +448,13 @@
#define TDUE 0x00010000U #define TDUE 0x00010000U
#define MC_INT_CAUSE 0x7518 #define MC_INT_CAUSE 0x7518
#define MC_P_INT_CAUSE 0x41318
#define ECC_UE_INT_CAUSE 0x00000004U #define ECC_UE_INT_CAUSE 0x00000004U
#define ECC_CE_INT_CAUSE 0x00000002U #define ECC_CE_INT_CAUSE 0x00000002U
#define PERR_INT_CAUSE 0x00000001U #define PERR_INT_CAUSE 0x00000001U
#define MC_ECC_STATUS 0x751c #define MC_ECC_STATUS 0x751c
#define MC_P_ECC_STATUS 0x4131c
#define ECC_CECNT_MASK 0xffff0000U #define ECC_CECNT_MASK 0xffff0000U
#define ECC_CECNT_SHIFT 16 #define ECC_CECNT_SHIFT 16
#define ECC_CECNT(x) ((x) << ECC_CECNT_SHIFT) #define ECC_CECNT(x) ((x) << ECC_CECNT_SHIFT)
...@@ -1101,6 +1103,7 @@ ...@@ -1101,6 +1103,7 @@
#define I2CM 0x00000002U #define I2CM 0x00000002U
#define CIM 0x00000001U #define CIM 0x00000001U
#define MC1 0x31
#define PL_INT_ENABLE 0x19410 #define PL_INT_ENABLE 0x19410
#define PL_INT_MAP0 0x19414 #define PL_INT_MAP0 0x19414
#define PL_RST 0x19428 #define PL_RST 0x19428
......
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