aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2016-03-21 00:29:45 +0000
committerNavdeep Parhar <np@FreeBSD.org>2016-03-21 00:29:45 +0000
commit8d814a458c573abb2c8ee0fe07aa43981c3c87b7 (patch)
treeb5c1dd92a2729fbbd2c3b64d00eb8afaa2662ba0 /contrib
parentb50d46df0917b3f1eb2108a827bf1922946705d7 (diff)
downloadsrc-8d814a458c573abb2c8ee0fe07aa43981c3c87b7.tar.gz
src-8d814a458c573abb2c8ee0fe07aa43981c3c87b7.zip
iw_cxgbe/libcxgb4: Pull in many applicable fixes from the upstream Linux
iWARP driver and userspace library to the FreeBSD iw_cxgbe and libcxgb4. This commit includes internal changesets 6785 8111 8149 8478 8617 8648 8650 9110 9143 9440 9511 9894 10164 10261 10450 10980 10981 10982 11730 11792 12218 12220 12222 12223 12225 12226 12227 12228 12229 12654. Submitted by: Krishnamraju Eraparaju @ Chelsio Sponsored by: Chelsio Communications
Notes
Notes: svn path=/head/; revision=297124
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ofed/libcxgb4/src/cq.c2
-rw-r--r--contrib/ofed/libcxgb4/src/dev.c7
-rw-r--r--contrib/ofed/libcxgb4/src/libcxgb4.h5
-rw-r--r--contrib/ofed/libcxgb4/src/qp.c2
-rw-r--r--contrib/ofed/libcxgb4/src/t4.h12
-rw-r--r--contrib/ofed/libcxgb4/src/verbs.c22
6 files changed, 35 insertions, 15 deletions
diff --git a/contrib/ofed/libcxgb4/src/cq.c b/contrib/ofed/libcxgb4/src/cq.c
index f028a22d9a60..ed5b66b4507e 100644
--- a/contrib/ofed/libcxgb4/src/cq.c
+++ b/contrib/ofed/libcxgb4/src/cq.c
@@ -697,7 +697,7 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ibv_wc *wc)
default:
PDBG("Unexpected cqe_status 0x%x for QPID=0x%0x\n",
CQE_STATUS(&cqe), CQE_QPID(&cqe));
- ret = -EINVAL;
+ wc->status = IBV_WC_FATAL_ERR;
}
}
if (wc->status && wc->status != IBV_WC_WR_FLUSH_ERR)
diff --git a/contrib/ofed/libcxgb4/src/dev.c b/contrib/ofed/libcxgb4/src/dev.c
index 322fa0c86817..33c10de237e5 100644
--- a/contrib/ofed/libcxgb4/src/dev.c
+++ b/contrib/ofed/libcxgb4/src/dev.c
@@ -54,7 +54,6 @@
struct { \
unsigned vendor; \
unsigned device; \
- unsigned chip_version; \
} hca_table[] = {
#define CH_PCI_DEVICE_ID_FUNCTION \
@@ -64,7 +63,6 @@
{ \
.vendor = PCI_VENDOR_ID_CHELSIO, \
.device = (__DeviceID), \
- .chip_version = CHELSIO_PCI_ID_CHIP_VERSION(__DeviceID), \
}
#define CH_PCI_DEVICE_ID_TABLE_DEFINE_END \
@@ -493,7 +491,8 @@ found:
}
PDBG("%s found vendor %d device %d type %d\n",
- __FUNCTION__, vendor, device, hca_table[i].chip_version);
+ __FUNCTION__, vendor, device,
+ CHELSIO_PCI_ID_CHIP_VERSION(hca_table[i].device));
dev = calloc(1, sizeof *dev);
if (!dev) {
@@ -502,7 +501,7 @@ found:
pthread_spin_init(&dev->lock, PTHREAD_PROCESS_PRIVATE);
dev->ibv_dev.ops = c4iw_dev_ops;
- dev->chip_version = hca_table[i].chip_version;
+ dev->chip_version = CHELSIO_PCI_ID_CHIP_VERSION(hca_table[i].device);
dev->abi_version = abi_version;
PDBG("%s device claimed\n", __FUNCTION__);
diff --git a/contrib/ofed/libcxgb4/src/libcxgb4.h b/contrib/ofed/libcxgb4/src/libcxgb4.h
index 7110aa30864f..30afcf301af2 100644
--- a/contrib/ofed/libcxgb4/src/libcxgb4.h
+++ b/contrib/ofed/libcxgb4/src/libcxgb4.h
@@ -69,6 +69,11 @@ static inline int dev_is_t5(struct c4iw_dev *dev)
return dev->chip_version == CHELSIO_T5;
}
+static inline int dev_is_t4(struct c4iw_dev *dev)
+{
+ return dev->chip_version == CHELSIO_T4;
+}
+
struct c4iw_context {
struct ibv_context ibv_ctx;
struct t4_dev_status_page *status_page;
diff --git a/contrib/ofed/libcxgb4/src/qp.c b/contrib/ofed/libcxgb4/src/qp.c
index 9a8629138f21..71cc49b6e8ff 100644
--- a/contrib/ofed/libcxgb4/src/qp.c
+++ b/contrib/ofed/libcxgb4/src/qp.c
@@ -362,7 +362,7 @@ int c4iw_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
err = build_rdma_read(wqe, wr, &len16);
if (err)
break;
- swsqe->read_len = wr->sg_list[0].length;
+ swsqe->read_len = wr->sg_list ? wr->sg_list[0].length : 0;
if (!qhp->wq.sq.oldest_read)
qhp->wq.sq.oldest_read = swsqe;
break;
diff --git a/contrib/ofed/libcxgb4/src/t4.h b/contrib/ofed/libcxgb4/src/t4.h
index ce48244ce340..c5120a6a61b3 100644
--- a/contrib/ofed/libcxgb4/src/t4.h
+++ b/contrib/ofed/libcxgb4/src/t4.h
@@ -328,6 +328,7 @@ struct t4_sq {
volatile u32 *udb;
size_t memsize;
u32 qid;
+ u32 bar2_qid;
void *ma_sync;
u16 in_use;
u16 size;
@@ -336,6 +337,7 @@ struct t4_sq {
u16 wq_pidx;
u16 flags;
short flush_cidx;
+ int wc_reg_available;
};
struct t4_swrqe {
@@ -348,6 +350,7 @@ struct t4_rq {
volatile u32 *udb;
size_t memsize;
u32 qid;
+ u32 bar2_qid;
u32 msn;
u32 rqt_hwaddr;
u16 rqt_size;
@@ -356,6 +359,7 @@ struct t4_rq {
u16 cidx;
u16 pidx;
u16 wq_pidx;
+ int wc_reg_available;
};
struct t4_wq {
@@ -485,14 +489,14 @@ static inline void t4_ring_sq_db(struct t4_wq *wq, u16 inc, u8 t5, u8 len16,
{
wc_wmb();
if (t5) {
- if (t5_en_wc && inc == 1) {
+ if (t5_en_wc && inc == 1 && wq->sq.wc_reg_available) {
PDBG("%s: WC wq->sq.pidx = %d; len16=%d\n",
__func__, wq->sq.pidx, len16);
copy_wqe_to_udb(wq->sq.udb + 14, wqe);
} else {
PDBG("%s: DB wq->sq.pidx = %d; len16=%d\n",
__func__, wq->sq.pidx, len16);
- writel(V_PIDX_T5(inc), wq->sq.udb);
+ writel(V_QID(wq->sq.bar2_qid) | V_PIDX_T5(inc), wq->sq.udb);
}
wc_wmb();
return;
@@ -518,14 +522,14 @@ static inline void t4_ring_rq_db(struct t4_wq *wq, u16 inc, u8 t5, u8 len16,
{
wc_wmb();
if (t5) {
- if (t5_en_wc && inc == 1) {
+ if (t5_en_wc && inc == 1 && wq->sq.wc_reg_available) {
PDBG("%s: WC wq->rq.pidx = %d; len16=%d\n",
__func__, wq->rq.pidx, len16);
copy_wqe_to_udb(wq->rq.udb + 14, wqe);
} else {
PDBG("%s: DB wq->rq.pidx = %d; len16=%d\n",
__func__, wq->rq.pidx, len16);
- writel(V_PIDX_T5(inc), wq->rq.udb);
+ writel(V_QID(wq->rq.bar2_qid) | V_PIDX_T5(inc), wq->rq.udb);
}
wc_wmb();
return;
diff --git a/contrib/ofed/libcxgb4/src/verbs.c b/contrib/ofed/libcxgb4/src/verbs.c
index 93d1e499aaaa..4d2a69d27427 100644
--- a/contrib/ofed/libcxgb4/src/verbs.c
+++ b/contrib/ofed/libcxgb4/src/verbs.c
@@ -213,7 +213,7 @@ struct ibv_cq *c4iw_create_cq(struct ibv_context *context, int cqe,
goto err3;
if (dev_is_t5(chp->rhp))
- chp->cq.ugts += 3;
+ chp->cq.ugts += 5;
else
chp->cq.ugts += 1;
chp->cq.sw_queue = calloc(chp->cq.size, sizeof *chp->cq.queue);
@@ -460,8 +460,14 @@ static struct ibv_qp *create_qp(struct ibv_pd *pd,
goto err3;
}
qhp->wq.sq.udb = dbva;
- if (dev_is_t5(qhp->rhp)) {
- qhp->wq.sq.udb += (128*(qhp->wq.sq.qid & qhp->wq.qid_mask))/4;
+ if (!dev_is_t4(qhp->rhp)) {
+ unsigned long segment_offset = 128 * (qhp->wq.sq.qid & qhp->wq.qid_mask);
+
+ if (segment_offset < c4iw_page_size) {
+ qhp->wq.sq.udb += segment_offset / 4;
+ qhp->wq.sq.wc_reg_available = 1;
+ } else
+ qhp->wq.sq.bar2_qid = qhp->wq.sq.qid & qhp->wq.qid_mask;
qhp->wq.sq.udb += 2;
}
@@ -479,8 +485,14 @@ static struct ibv_qp *create_qp(struct ibv_pd *pd,
if (dbva == MAP_FAILED)
goto err5;
qhp->wq.rq.udb = dbva;
- if (dev_is_t5(qhp->rhp)) {
- qhp->wq.rq.udb += (128*(qhp->wq.rq.qid & qhp->wq.qid_mask))/4;
+ if (!dev_is_t4(qhp->rhp)) {
+ unsigned long segment_offset = 128 * (qhp->wq.rq.qid & qhp->wq.qid_mask);
+
+ if (segment_offset < c4iw_page_size) {
+ qhp->wq.rq.udb += segment_offset / 4;
+ qhp->wq.rq.wc_reg_available = 1;
+ } else
+ qhp->wq.rq.bar2_qid = qhp->wq.rq.qid & qhp->wq.qid_mask;
qhp->wq.rq.udb += 2;
}
qhp->wq.rq.queue = mmap(NULL, qhp->wq.rq.memsize,