aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHariprasad Shenai <hariprasad@chelsio.com>2014-07-14 12:04:51 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-15 19:25:16 -0400
commit04e10e2164fcfa05e14eff3c2757a5097f11d258 (patch)
tree2212ddad781d45e0ca93165b4cefc48ac321b897
parent5ee2c941b5969eb1b5592f9731b3ee76a784641f (diff)
iw_cxgb4: Detect Ing. Padding Boundary at run-time
Updates iw_cxgb4 to determine the Ingress Padding Boundary from cxgb4_lld_info, and take subsequent actions. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c4
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c21
-rw-r--r--drivers/infiniband/hw/cxgb4/iw_cxgb4.h12
-rw-r--r--drivers/infiniband/hw/cxgb4/provider.c4
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c10
-rw-r--r--drivers/infiniband/hw/cxgb4/t4.h8
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h2
8 files changed, 47 insertions, 16 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index c04292c950f1..f04a838b65c7 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -895,7 +895,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
895 /* 895 /*
896 * Make actual HW queue 2x to avoid cdix_inc overflows. 896 * Make actual HW queue 2x to avoid cdix_inc overflows.
897 */ 897 */
898 hwentries = min(entries * 2, T4_MAX_IQ_SIZE); 898 hwentries = min(entries * 2, rhp->rdev.hw_queue.t4_max_iq_size);
899 899
900 /* 900 /*
901 * Make HW queue at least 64 entries so GTS updates aren't too 901 * Make HW queue at least 64 entries so GTS updates aren't too
@@ -912,7 +912,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
912 if (ucontext) { 912 if (ucontext) {
913 memsize = roundup(memsize, PAGE_SIZE); 913 memsize = roundup(memsize, PAGE_SIZE);
914 hwentries = memsize / sizeof *chp->cq.queue; 914 hwentries = memsize / sizeof *chp->cq.queue;
915 while (hwentries > T4_MAX_IQ_SIZE) { 915 while (hwentries > rhp->rdev.hw_queue.t4_max_iq_size) {
916 memsize -= PAGE_SIZE; 916 memsize -= PAGE_SIZE;
917 hwentries = memsize / sizeof *chp->cq.queue; 917 hwentries = memsize / sizeof *chp->cq.queue;
918 } 918 }
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index dd93aadc996e..88291ef82941 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -768,6 +768,27 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop)
768 } 768 }
769 devp->rdev.lldi = *infop; 769 devp->rdev.lldi = *infop;
770 770
771 /* init various hw-queue params based on lld info */
772 PDBG("%s: Ing. padding boundary is %d, egrsstatuspagesize = %d\n",
773 __func__, devp->rdev.lldi.sge_ingpadboundary,
774 devp->rdev.lldi.sge_egrstatuspagesize);
775
776 devp->rdev.hw_queue.t4_eq_status_entries =
777 devp->rdev.lldi.sge_ingpadboundary > 64 ? 2 : 1;
778 devp->rdev.hw_queue.t4_max_eq_size =
779 65520 - devp->rdev.hw_queue.t4_eq_status_entries;
780 devp->rdev.hw_queue.t4_max_iq_size = 65520 - 1;
781 devp->rdev.hw_queue.t4_max_rq_size =
782 8192 - devp->rdev.hw_queue.t4_eq_status_entries;
783 devp->rdev.hw_queue.t4_max_sq_size =
784 devp->rdev.hw_queue.t4_max_eq_size - 1;
785 devp->rdev.hw_queue.t4_max_qp_depth =
786 devp->rdev.hw_queue.t4_max_rq_size - 1;
787 devp->rdev.hw_queue.t4_max_cq_depth =
788 devp->rdev.hw_queue.t4_max_iq_size - 1;
789 devp->rdev.hw_queue.t4_stat_len =
790 devp->rdev.lldi.sge_egrstatuspagesize;
791
771 /* 792 /*
772 * For T5 devices, we map all of BAR2 with WC. 793 * For T5 devices, we map all of BAR2 with WC.
773 * For T4 devices with onchip qp mem, we map only that part 794 * For T4 devices with onchip qp mem, we map only that part
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index 125bc5d1e175..9b9754c69ea0 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -139,6 +139,17 @@ struct c4iw_stats {
139 u64 pas_ofld_conn_fails; 139 u64 pas_ofld_conn_fails;
140}; 140};
141 141
142struct c4iw_hw_queue {
143 int t4_eq_status_entries;
144 int t4_max_eq_size;
145 int t4_max_iq_size;
146 int t4_max_rq_size;
147 int t4_max_sq_size;
148 int t4_max_qp_depth;
149 int t4_max_cq_depth;
150 int t4_stat_len;
151};
152
142struct c4iw_rdev { 153struct c4iw_rdev {
143 struct c4iw_resource resource; 154 struct c4iw_resource resource;
144 unsigned long qpshift; 155 unsigned long qpshift;
@@ -156,6 +167,7 @@ struct c4iw_rdev {
156 unsigned long oc_mw_pa; 167 unsigned long oc_mw_pa;
157 void __iomem *oc_mw_kva; 168 void __iomem *oc_mw_kva;
158 struct c4iw_stats stats; 169 struct c4iw_stats stats;
170 struct c4iw_hw_queue hw_queue;
159 struct t4_dev_status_page *status_page; 171 struct t4_dev_status_page *status_page;
160}; 172};
161 173
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index b1d305338de6..1d41b92caaf5 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -319,13 +319,13 @@ static int c4iw_query_device(struct ib_device *ibdev,
319 props->vendor_part_id = (u32)dev->rdev.lldi.pdev->device; 319 props->vendor_part_id = (u32)dev->rdev.lldi.pdev->device;
320 props->max_mr_size = T4_MAX_MR_SIZE; 320 props->max_mr_size = T4_MAX_MR_SIZE;
321 props->max_qp = T4_MAX_NUM_QP; 321 props->max_qp = T4_MAX_NUM_QP;
322 props->max_qp_wr = T4_MAX_QP_DEPTH; 322 props->max_qp_wr = dev->rdev.hw_queue.t4_max_qp_depth;
323 props->max_sge = T4_MAX_RECV_SGE; 323 props->max_sge = T4_MAX_RECV_SGE;
324 props->max_sge_rd = 1; 324 props->max_sge_rd = 1;
325 props->max_qp_rd_atom = c4iw_max_read_depth; 325 props->max_qp_rd_atom = c4iw_max_read_depth;
326 props->max_qp_init_rd_atom = c4iw_max_read_depth; 326 props->max_qp_init_rd_atom = c4iw_max_read_depth;
327 props->max_cq = T4_MAX_NUM_CQ; 327 props->max_cq = T4_MAX_NUM_CQ;
328 props->max_cqe = T4_MAX_CQ_DEPTH; 328 props->max_cqe = dev->rdev.hw_queue.t4_max_cq_depth;
329 props->max_mr = c4iw_num_stags(&dev->rdev); 329 props->max_mr = c4iw_num_stags(&dev->rdev);
330 props->max_pd = T4_MAX_NUM_PD; 330 props->max_pd = T4_MAX_NUM_PD;
331 props->local_ca_ack_delay = 0; 331 props->local_ca_ack_delay = 0;
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 086f62f5dc9e..6f74e0e9a022 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -258,7 +258,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
258 /* 258 /*
259 * eqsize is the number of 64B entries plus the status page size. 259 * eqsize is the number of 64B entries plus the status page size.
260 */ 260 */
261 eqsize = wq->sq.size * T4_SQ_NUM_SLOTS + T4_EQ_STATUS_ENTRIES; 261 eqsize = wq->sq.size * T4_SQ_NUM_SLOTS +
262 rdev->hw_queue.t4_eq_status_entries;
262 263
263 res->u.sqrq.fetchszm_to_iqid = cpu_to_be32( 264 res->u.sqrq.fetchszm_to_iqid = cpu_to_be32(
264 V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */ 265 V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */
@@ -283,7 +284,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
283 /* 284 /*
284 * eqsize is the number of 64B entries plus the status page size. 285 * eqsize is the number of 64B entries plus the status page size.
285 */ 286 */
286 eqsize = wq->rq.size * T4_RQ_NUM_SLOTS + T4_EQ_STATUS_ENTRIES; 287 eqsize = wq->rq.size * T4_RQ_NUM_SLOTS +
288 rdev->hw_queue.t4_eq_status_entries;
287 res->u.sqrq.fetchszm_to_iqid = cpu_to_be32( 289 res->u.sqrq.fetchszm_to_iqid = cpu_to_be32(
288 V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */ 290 V_FW_RI_RES_WR_HOSTFCMODE(0) | /* no host cidx updates */
289 V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */ 291 V_FW_RI_RES_WR_CPRIO(0) | /* don't keep in chip cache */
@@ -1570,11 +1572,11 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs,
1570 return ERR_PTR(-EINVAL); 1572 return ERR_PTR(-EINVAL);
1571 1573
1572 rqsize = roundup(attrs->cap.max_recv_wr + 1, 16); 1574 rqsize = roundup(attrs->cap.max_recv_wr + 1, 16);
1573 if (rqsize > T4_MAX_RQ_SIZE) 1575 if (rqsize > rhp->rdev.hw_queue.t4_max_rq_size)
1574 return ERR_PTR(-E2BIG); 1576 return ERR_PTR(-E2BIG);
1575 1577
1576 sqsize = roundup(attrs->cap.max_send_wr + 1, 16); 1578 sqsize = roundup(attrs->cap.max_send_wr + 1, 16);
1577 if (sqsize > T4_MAX_SQ_SIZE) 1579 if (sqsize > rhp->rdev.hw_queue.t4_max_sq_size)
1578 return ERR_PTR(-E2BIG); 1580 return ERR_PTR(-E2BIG);
1579 1581
1580 ucontext = pd->uobject ? to_c4iw_ucontext(pd->uobject->context) : NULL; 1582 ucontext = pd->uobject ? to_c4iw_ucontext(pd->uobject->context) : NULL;
diff --git a/drivers/infiniband/hw/cxgb4/t4.h b/drivers/infiniband/hw/cxgb4/t4.h
index 68b0a6bf4eb0..e64fa8b2be06 100644
--- a/drivers/infiniband/hw/cxgb4/t4.h
+++ b/drivers/infiniband/hw/cxgb4/t4.h
@@ -39,19 +39,11 @@
39#define T4_MAX_NUM_QP 65536 39#define T4_MAX_NUM_QP 65536
40#define T4_MAX_NUM_CQ 65536 40#define T4_MAX_NUM_CQ 65536
41#define T4_MAX_NUM_PD 65536 41#define T4_MAX_NUM_PD 65536
42#define T4_EQ_STATUS_ENTRIES (L1_CACHE_BYTES > 64 ? 2 : 1)
43#define T4_MAX_EQ_SIZE (65520 - T4_EQ_STATUS_ENTRIES)
44#define T4_MAX_IQ_SIZE (65520 - 1)
45#define T4_MAX_RQ_SIZE (8192 - T4_EQ_STATUS_ENTRIES)
46#define T4_MAX_SQ_SIZE (T4_MAX_EQ_SIZE - 1)
47#define T4_MAX_QP_DEPTH (T4_MAX_RQ_SIZE - 1)
48#define T4_MAX_CQ_DEPTH (T4_MAX_IQ_SIZE - 1)
49#define T4_MAX_NUM_STAG (1<<15) 42#define T4_MAX_NUM_STAG (1<<15)
50#define T4_MAX_MR_SIZE (~0ULL) 43#define T4_MAX_MR_SIZE (~0ULL)
51#define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */ 44#define T4_PAGESIZE_MASK 0xffff000 /* 4KB-128MB */
52#define T4_STAG_UNSET 0xffffffff 45#define T4_STAG_UNSET 0xffffffff
53#define T4_FW_MAJ 0 46#define T4_FW_MAJ 0
54#define T4_EQ_STATUS_ENTRIES (L1_CACHE_BYTES > 64 ? 2 : 1)
55#define A_PCIE_MA_SYNC 0x30b4 47#define A_PCIE_MA_SYNC 0x30b4
56 48
57struct t4_status_page { 49struct t4_status_page {
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 2b438bd68c73..a7ce996630ed 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4109,6 +4109,8 @@ static void uld_attach(struct adapter *adap, unsigned int uld)
4109 lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL); 4109 lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL);
4110 lli.fw_vers = adap->params.fw_vers; 4110 lli.fw_vers = adap->params.fw_vers;
4111 lli.dbfifo_int_thresh = dbfifo_int_thresh; 4111 lli.dbfifo_int_thresh = dbfifo_int_thresh;
4112 lli.sge_ingpadboundary = adap->sge.fl_align;
4113 lli.sge_egrstatuspagesize = adap->sge.stat_len;
4112 lli.sge_pktshift = adap->sge.pktshift; 4114 lli.sge_pktshift = adap->sge.pktshift;
4113 lli.enable_fw_ofld_conn = adap->flags & FW_OFLD_CONN; 4115 lli.enable_fw_ofld_conn = adap->flags & FW_OFLD_CONN;
4114 lli.ulptx_memwrite_dsgl = adap->params.ulptx_memwrite_dsgl; 4116 lli.ulptx_memwrite_dsgl = adap->params.ulptx_memwrite_dsgl;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
index 8f60851b75ad..962458f5d5b3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h
@@ -251,6 +251,8 @@ struct cxgb4_lld_info {
251 void __iomem *gts_reg; /* address of GTS register */ 251 void __iomem *gts_reg; /* address of GTS register */
252 void __iomem *db_reg; /* address of kernel doorbell */ 252 void __iomem *db_reg; /* address of kernel doorbell */
253 int dbfifo_int_thresh; /* doorbell fifo int threshold */ 253 int dbfifo_int_thresh; /* doorbell fifo int threshold */
254 unsigned int sge_ingpadboundary; /* SGE ingress padding boundary */
255 unsigned int sge_egrstatuspagesize; /* SGE egress status page size */
254 unsigned int sge_pktshift; /* Padding between CPL and */ 256 unsigned int sge_pktshift; /* Padding between CPL and */
255 /* packet data */ 257 /* packet data */
256 unsigned int pf; /* Physical Function we're using */ 258 unsigned int pf; /* Physical Function we're using */