Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cbdb928 authored by Vipul Pandya's avatar Vipul Pandya Committed by David S. Miller
Browse files

RDMA/cxgb4: Turn off db coalescing when RDMA QPs are in use.

parent f079af7a
Loading
Loading
Loading
Loading
+16 −4
Original line number Original line Diff line number Diff line
@@ -42,10 +42,17 @@ static int ocqp_support = 1;
module_param(ocqp_support, int, 0644);
module_param(ocqp_support, int, 0644);
MODULE_PARM_DESC(ocqp_support, "Support on-chip SQs (default=1)");
MODULE_PARM_DESC(ocqp_support, "Support on-chip SQs (default=1)");


int db_fc_threshold = 2000;
int db_fc_threshold = 1000;
module_param(db_fc_threshold, int, 0644);
module_param(db_fc_threshold, int, 0644);
MODULE_PARM_DESC(db_fc_threshold, "QP count/threshold that triggers automatic "
MODULE_PARM_DESC(db_fc_threshold,
		 "db flow control mode (default = 2000)");
		 "QP count/threshold that triggers"
		 " automatic db flow control mode (default = 1000)");

int db_coalescing_threshold;
module_param(db_coalescing_threshold, int, 0644);
MODULE_PARM_DESC(db_coalescing_threshold,
		 "QP count/threshold that triggers"
		 " disabling db coalescing (default = 0)");


static void set_state(struct c4iw_qp *qhp, enum c4iw_qp_state state)
static void set_state(struct c4iw_qp *qhp, enum c4iw_qp_state state)
{
{
@@ -1448,6 +1455,8 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp)
		rhp->db_state = NORMAL;
		rhp->db_state = NORMAL;
		idr_for_each(&rhp->qpidr, enable_qp_db, NULL);
		idr_for_each(&rhp->qpidr, enable_qp_db, NULL);
	}
	}
	if (rhp->qpcnt <= db_coalescing_threshold)
		cxgb4_enable_db_coalescing(rhp->rdev.lldi.ports[0]);
	spin_unlock_irq(&rhp->lock);
	spin_unlock_irq(&rhp->lock);
	atomic_dec(&qhp->refcnt);
	atomic_dec(&qhp->refcnt);
	wait_event(qhp->wait, !atomic_read(&qhp->refcnt));
	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,
	spin_lock_irq(&rhp->lock);
	spin_lock_irq(&rhp->lock);
	if (rhp->db_state != NORMAL)
	if (rhp->db_state != NORMAL)
		t4_disable_wq_db(&qhp->wq);
		t4_disable_wq_db(&qhp->wq);
	if (++rhp->qpcnt > db_fc_threshold && rhp->db_state == NORMAL) {
	rhp->qpcnt++;
	if (rhp->qpcnt > db_fc_threshold && rhp->db_state == NORMAL) {
		rhp->rdev.stats.db_state_transitions++;
		rhp->rdev.stats.db_state_transitions++;
		rhp->db_state = FLOW_CONTROL;
		rhp->db_state = FLOW_CONTROL;
		idr_for_each(&rhp->qpidr, disable_qp_db, NULL);
		idr_for_each(&rhp->qpidr, disable_qp_db, NULL);
	}
	}
	if (rhp->qpcnt > db_coalescing_threshold)
		cxgb4_disable_db_coalescing(rhp->rdev.lldi.ports[0]);
	ret = insert_handle_nolock(rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid);
	ret = insert_handle_nolock(rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid);
	spin_unlock_irq(&rhp->lock);
	spin_unlock_irq(&rhp->lock);
	if (ret)
	if (ret)
+19 −0
Original line number Original line Diff line number Diff line
@@ -3397,6 +3397,25 @@ int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx,
}
}
EXPORT_SYMBOL(cxgb4_sync_txq_pidx);
EXPORT_SYMBOL(cxgb4_sync_txq_pidx);


void cxgb4_disable_db_coalescing(struct net_device *dev)
{
	struct adapter *adap;

	adap = netdev2adap(dev);
	t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE,
			 F_NOCOALESCE);
}
EXPORT_SYMBOL(cxgb4_disable_db_coalescing);

void cxgb4_enable_db_coalescing(struct net_device *dev)
{
	struct adapter *adap;

	adap = netdev2adap(dev);
	t4_set_reg_field(adap, A_SGE_DOORBELL_CONTROL, F_NOCOALESCE, 0);
}
EXPORT_SYMBOL(cxgb4_enable_db_coalescing);

static struct pci_driver cxgb4_driver;
static struct pci_driver cxgb4_driver;


static void check_neigh_update(struct neighbour *neigh)
static void check_neigh_update(struct neighbour *neigh)
+3 −0
Original line number Original line Diff line number Diff line
@@ -269,4 +269,7 @@ struct sk_buff *cxgb4_pktgl_to_skb(const struct pkt_gl *gl,
				   unsigned int skb_len, unsigned int pull_len);
				   unsigned int skb_len, unsigned int pull_len);
int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, u16 size);
int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx, u16 size);
int cxgb4_flush_eq_cache(struct net_device *dev);
int cxgb4_flush_eq_cache(struct net_device *dev);
void cxgb4_disable_db_coalescing(struct net_device *dev);
void cxgb4_enable_db_coalescing(struct net_device *dev);

#endif  /* !__CXGB4_OFLD_H */
#endif  /* !__CXGB4_OFLD_H */
+4 −0
Original line number Original line Diff line number Diff line
@@ -241,6 +241,10 @@
#define SGE_DOORBELL_CONTROL 0x10a8
#define SGE_DOORBELL_CONTROL 0x10a8
#define  ENABLE_DROP        (1 << 13)
#define  ENABLE_DROP        (1 << 13)


#define S_NOCOALESCE    26
#define V_NOCOALESCE(x) ((x) << S_NOCOALESCE)
#define F_NOCOALESCE    V_NOCOALESCE(1U)

#define SGE_TIMER_VALUE_0_AND_1 0x10b8
#define SGE_TIMER_VALUE_0_AND_1 0x10b8
#define  TIMERVALUE0_MASK   0xffff0000U
#define  TIMERVALUE0_MASK   0xffff0000U
#define  TIMERVALUE0_SHIFT  16
#define  TIMERVALUE0_SHIFT  16