diff options
author | Vipul Pandya <vipul@chelsio.com> | 2013-03-14 01:08:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-14 11:35:58 -0400 |
commit | 3cbdb928e2ddd16649769c8597a3ebc06c7594fd (patch) | |
tree | fd5297358dfcf186bec063508822dba78bf95be2 | |
parent | f079af7a117504b5b307b727858c972261047907 (diff) |
RDMA/cxgb4: Turn off db coalescing when RDMA QPs are in use.
Signed-off-by: Vipul Pandya <vipul@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/cxgb4/qp.c | 20 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 4 |
4 files changed, 42 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index c46024409c4e..da4869f41e35 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -42,10 +42,17 @@ static int ocqp_support = 1; | |||
42 | module_param(ocqp_support, int, 0644); | 42 | module_param(ocqp_support, int, 0644); |
43 | MODULE_PARM_DESC(ocqp_support, "Support on-chip SQs (default=1)"); | 43 | MODULE_PARM_DESC(ocqp_support, "Support on-chip SQs (default=1)"); |
44 | 44 | ||
45 | int db_fc_threshold = 2000; | 45 | int db_fc_threshold = 1000; |
46 | module_param(db_fc_threshold, int, 0644); | 46 | module_param(db_fc_threshold, int, 0644); |
47 | MODULE_PARM_DESC(db_fc_threshold, "QP count/threshold that triggers automatic " | 47 | MODULE_PARM_DESC(db_fc_threshold, |
48 | "db flow control mode (default = 2000)"); | 48 | "QP count/threshold that triggers" |
49 | " automatic db flow control mode (default = 1000)"); | ||
50 | |||
51 | int db_coalescing_threshold; | ||
52 | module_param(db_coalescing_threshold, int, 0644); | ||
53 | MODULE_PARM_DESC(db_coalescing_threshold, | ||
54 | "QP count/threshold that triggers" | ||
55 | " disabling db coalescing (default = 0)"); | ||
49 | 56 | ||
50 | static void set_state(struct c4iw_qp *qhp, enum c4iw_qp_state state) | 57 | static void set_state(struct c4iw_qp *qhp, enum c4iw_qp_state state) |
51 | { | 58 | { |
@@ -1448,6 +1455,8 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp) | |||
1448 | rhp->db_state = NORMAL; | 1455 | rhp->db_state = NORMAL; |
1449 | idr_for_each(&rhp->qpidr, enable_qp_db, NULL); | 1456 | idr_for_each(&rhp->qpidr, enable_qp_db, NULL); |
1450 | } | 1457 | } |
1458 | if (rhp->qpcnt <= db_coalescing_threshold) | ||
1459 | cxgb4_enable_db_coalescing(rhp->rdev.lldi.ports[0]); | ||
1451 | spin_unlock_irq(&rhp->lock); | 1460 | spin_unlock_irq(&rhp->lock); |
1452 | atomic_dec(&qhp->refcnt); | 1461 | atomic_dec(&qhp->refcnt); |
1453 | wait_event(qhp->wait, !atomic_read(&qhp->refcnt)); | 1462 | wait_event(qhp->wait, !atomic_read(&qhp->refcnt)); |
@@ -1559,11 +1568,14 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, | |||
1559 | spin_lock_irq(&rhp->lock); | 1568 | spin_lock_irq(&rhp->lock); |
1560 | if (rhp->db_state != NORMAL) | 1569 | if (rhp->db_state != NORMAL) |
1561 | t4_disable_wq_db(&qhp->wq); | 1570 | t4_disable_wq_db(&qhp->wq); |
1562 | if (++rhp->qpcnt > db_fc_threshold && rhp->db_state == NORMAL) { | 1571 | rhp->qpcnt++; |
1572 | if (rhp->qpcnt > db_fc_threshold && rhp->db_state == NORMAL) { | ||
1563 | rhp->rdev.stats.db_state_transitions++; | 1573 | rhp->rdev.stats.db_state_transitions++; |
1564 | rhp->db_state = FLOW_CONTROL; | 1574 | rhp->db_state = FLOW_CONTROL; |
1565 | idr_for_each(&rhp->qpidr, disable_qp_db, NULL); | 1575 | idr_for_each(&rhp->qpidr, disable_qp_db, NULL); |
1566 | } | 1576 | } |
1577 | if (rhp->qpcnt > db_coalescing_threshold) | ||
1578 | cxgb4_disable_db_coalescing(rhp->rdev.lldi.ports[0]); | ||
1567 | ret = insert_handle_nolock(rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid); | 1579 | ret = insert_handle_nolock(rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid); |
1568 | spin_unlock_irq(&rhp->lock); | 1580 | spin_unlock_irq(&rhp->lock); |
1569 | if (ret) | 1581 | if (ret) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index a59bb231bea2..e76cf035100b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3397,6 +3397,25 @@ out: | |||
3397 | } | 3397 | } |
3398 | EXPORT_SYMBOL(cxgb4_sync_txq_pidx); | 3398 | EXPORT_SYMBOL(cxgb4_sync_txq_pidx); |
3399 | 3399 | ||
3400 | void cxgb4_disable_db_coalescing(struct net_device *dev) | ||
3401 | { | ||
3402 | struct adapter *adap; | ||
3403 | |||
3404 | adap = netdev2adap(dev); | ||
3405 | t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE, | ||
3406 | F_NOCOALESCE); | ||
3407 | } | ||
3408 | EXPORT_SYMBOL(cxgb4_disable_db_coalescing); | ||
3409 | |||
3410 | void cxgb4_enable_db_coalescing(struct net_device *dev) | ||
3411 | { | ||
3412 | struct adapter *adap; | ||
3413 | |||
3414 | adap = netdev2adap(dev); | ||
3415 | t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE, 0); | ||
3416 | } | ||
3417 | EXPORT_SYMBOL(cxgb4_enable_db_coalescing); | ||
3418 | |||
3400 | static struct pci_driver cxgb4_driver; | 3419 | static struct pci_driver cxgb4_driver; |
3401 | 3420 | ||
3402 | static void check_neigh_update(struct neighbour *neigh) | 3421 | static void check_neigh_update(struct neighbour *neigh) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h index e2bbc7f3e2de..4faf4d067ee7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | |||
@@ -269,4 +269,7 @@ struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl, | |||
269 | unsigned int skb_len, unsigned int pull_len); | 269 | unsigned int skb_len, unsigned int pull_len); |
270 | int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, u16 size); | 270 | int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, u16 size); |
271 | int cxgb4_flush_eq_cache(struct net_device *dev); | 271 | int cxgb4_flush_eq_cache(struct net_device *dev); |
272 | void cxgb4_disable_db_coalescing(struct net_device *dev); | ||
273 | void cxgb4_enable_db_coalescing(struct net_device *dev); | ||
274 | |||
272 | #endif /* !__CXGB4_OFLD_H */ | 275 | #endif /* !__CXGB4_OFLD_H */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index 22cbcb36d81d..ef146c0ba481 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -241,6 +241,10 @@ | |||
241 | #define SGE_DOORBELL_CONTROL 0x10a8 | 241 | #define SGE_DOORBELL_CONTROL 0x10a8 |
242 | #define ENABLE_DROP (1 << 13) | 242 | #define ENABLE_DROP (1 << 13) |
243 | 243 | ||
244 | #define S_NOCOALESCE 26 | ||
245 | #define V_NOCOALESCE(x) ((x) << S_NOCOALESCE) | ||
246 | #define F_NOCOALESCE V_NOCOALESCE(1U) | ||
247 | |||
244 | #define SGE_TIMER_VALUE_0_AND_1 0x10b8 | 248 | #define SGE_TIMER_VALUE_0_AND_1 0x10b8 |
245 | #define TIMERVALUE0_MASK 0xffff0000U | 249 | #define TIMERVALUE0_MASK 0xffff0000U |
246 | #define TIMERVALUE0_SHIFT 16 | 250 | #define TIMERVALUE0_SHIFT 16 |