cxgb4: DB Drop Recovery for RDMA and LLD queues.
Subsystems (4)
PATCH v2 3/10 cxgb4: DB Drop Recovery for RDMA and LLD queues.
- recover LLD EQs for DB drop interrupts. This includes adding a new db_lock, a spin lock disabling BH too, used by the recovery thread and the ring_tx_db() paths to allow db drop recovery.
- cleaned up initial db avoidance code.
- add read_eq_indices() - allows the LLD to use the pcie mw to efficiently read hw eq contexts.
- add cxgb4_sync_txq_pidx() - called by iw_cxgb4 to sync up the sw/hw pidx value.
- add flush_eq_cache() and cxgb4_flush_eq_cache(). This allows iw_cxgb4 to flush the sge eq context cache before beginning db drop recovery.
- add module parameter, dbfoifo_int_thresh, to allow tuning the db interrupt threshold value.
- add dbfifo_int_thresh to cxgb4_lld_info so iw_cxgb4 knows the threshold.
- add module parameter, dbfoifo_drain_delay, to allow tuning the amount of time delay between DB FULL and EMPTY upcalls to iw_cxgb4.
---
V2: Moved enum declaration from t4fw_api.h to cxgb4.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 16 ++ drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 214 +++++++++++++++++++---- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h | 4 + drivers/net/ethernet/chelsio/cxgb4/sge.c | 20 ++- drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 53 ++++++ drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | 15 ++ 6 files changed, 280 insertions(+), 42 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +16 -0
@@ -51,6 +51,8 @@#define FW_VERSION_MINOR 1#define FW_VERSION_MICRO 0 +#define CH_WARN (adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__) +enum {MAX_NPORTS =4 ,/* max # of ports */ SERNUM_LEN =24 ,/* Serial # length */
@@ -64,6 +66,15 @@ enum {MEM_MC }; +enum { +MEMWIN0_APERTURE =65536 , +MEMWIN0_BASE =0x30000 , +MEMWIN1_APERTURE =32768 , +MEMWIN1_BASE =0x28000 , +MEMWIN2_APERTURE =2048 , +MEMWIN2_BASE =0x1b800 , +}; +enum dev_master {MASTER_CANT ,MASTER_MAY ,
@@ -403,6 +414,9 @@ struct sge_txq {struct tx_sw_desc *sdesc;/* address of SW Tx descriptor ring */ struct sge_qstat *stat;/* queue status entry */ dma_addr_t phys_addr;/* physical address of the ring */ +spinlock_t db_lock; +int db_disabled; +unsigned short db_pidx; };struct sge_eth_txq {/* state for an SGE Ethernet Tx queue */
@@ -475,6 +489,7 @@ struct adapter {void __iomem *regs;struct pci_dev *pdev;struct device *pdev_dev; +unsigned int mbox;unsigned int fn;unsigned int flags;
@@ -607,6 +622,7 @@ irqreturn_t t4_sge_intr_msix(int irq, void *cookie);void t4_sge_init (struct adapter *adap);void t4_sge_start (struct adapter *adap);void t4_sge_stop (struct adapter *adap); +extern int dbfifo_int_thresh;#define for_each_port (adapter, iter) \ for (iter = 0; iter < (adapter)->params.nports; ++iter)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +176 -38
301 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.h +4 -0
@@ -218,6 +218,7 @@ struct cxgb4_lld_info {unsigned short ucq_density;/* # of user CQs/page */ void __iomem *gts_reg;/* address of GTS register */ void __iomem *db_reg;/* address of kernel doorbell */ +int dbfifo_int_thresh;/* doorbell fifo int threshold */ };struct cxgb4_uld_info {
@@ -226,6 +227,7 @@ struct cxgb4_uld_info {int (*rx_handler)(void *handle,const __be64 *rsp,const struct pkt_gl *gl);int (*state_change)(void *handle,enum cxgb4_state new_state); +int (*control)(void *handle,enum cxgb4_control control, ...); };int cxgb4_register_uld (enum cxgb4_uld type,const struct cxgb4_uld_info *p);
@@ -243,4 +245,6 @@ void cxgb4_iscsi_init(struct net_device *dev, unsigned int tag_mask, const unsigned int *pgsz_order);struct sk_buff *cxgb4_pktgl_to_skb (const struct pkt_gl *gl,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_flush_eq_cache (struct net_device *dev);#endif /* !__CXGB4_OFLD_H */
drivers/net/ethernet/chelsio/cxgb4/sge.c +16 -4
@@ -767,8 +767,13 @@ static void write_sgl(const struct sk_buff *skb, struct sge_txq *q,static inline void ring_tx_db (struct adapter *adap,struct sge_txq *q,int n) {wmb ();/* write descriptors before telling HW */ -t4_write_reg (adap,MYPF_REG (SGE_PF_KDOORBELL ), -QID (q->cntxt_id) |PIDX (n)); +spin_lock (&q->db_lock); +if (!q->db_disabled) { +t4_write_reg (adap,MYPF_REG (A_SGE_PF_KDOORBELL ), +V_QID (q->cntxt_id) |V_PIDX (n)); + } + q->db_pidx = q->pidx; +spin_unlock (&q->db_lock); }/**
@@ -2080,6 +2085,7 @@ static void init_txq(struct adapter *adap, struct sge_txq *q, unsigned int id) q->stops = q->restarts =0 ; q->stat = (void *)&q->desc[q->size]; q->cntxt_id = id; +spin_lock_init (&q->db_lock); adap->sge.egr_map[id - adap->sge.egr_start] = q; }
@@ -2414,9 +2420,15 @@ void t4_sge_init(struct adapter *adap)RXPKTCPLMODE | (STAT_LEN == 128 ? EGRSTATUSPAGESIZE : 0)); +/* +* Set up to drop DOORBELL writes when the DOORBELL FIFO overflows +* and generate an interrupt when this occurs so we can recover. +*/ t4_set_reg_field (adap,A_SGE_DBFIFO_STATUS , -V_HP_INT_THRESH (5 ) |V_LP_INT_THRESH (5 ), -V_HP_INT_THRESH (5 ) |V_LP_INT_THRESH (5 )); +V_HP_INT_THRESH (M_HP_INT_THRESH ) | +V_LP_INT_THRESH (M_LP_INT_THRESH ), +V_HP_INT_THRESH (dbfifo_int_thresh) | +V_LP_INT_THRESH (dbfifo_int_thresh));t4_set_reg_field (adap,A_SGE_DOORBELL_CONTROL ,F_ENABLE_DROP ,F_ENABLE_DROP );
drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +53 -0
59 lines not on this page · raw message
drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +15 -0
@@ -1620,4 +1620,19 @@ struct fw_hdr {#define FW_HDR_FW_VER_MINOR_GET (x) (((x) >> 16) & 0xff)#define FW_HDR_FW_VER_MICRO_GET (x) (((x) >> 8) & 0xff)#define FW_HDR_FW_VER_BUILD_GET (x) (((x) >> 0) & 0xff) + +#define S_FW_CMD_OP 24 +#define V_FW_CMD_OP (x) ((x) << S_FW_CMD_OP) + +#define S_FW_CMD_REQUEST 23 +#define V_FW_CMD_REQUEST (x) ((x) << S_FW_CMD_REQUEST) +#define F_FW_CMD_REQUEST V_FW_CMD_REQUEST(1U) + +#define S_FW_CMD_WRITE 21 +#define V_FW_CMD_WRITE (x) ((x) << S_FW_CMD_WRITE) +#define F_FW_CMD_WRITE V_FW_CMD_WRITE(1U) + +#define S_FW_LDST_CMD_ADDRSPACE 0 +#define V_FW_LDST_CMD_ADDRSPACE (x) ((x) << S_FW_LDST_CMD_ADDRSPACE) +#endif /* _T4FW_INTERFACE_H_ */
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html