Skip to content

Commit 840f300

Browse files
Vipul Pandyadavem330
authored andcommitted
cxgb4: Remove duplicate register definitions
Removed duplicate definition for SGE_PF_KDOORBELL, SGE_INT_ENABLE3, PCIE_MEM_ACCESS_OFFSET registers. Moved the register field definitions around the register definition. Signed-off-by: Santosh Rastapur <[email protected]> Signed-off-by: Vipul Pandya <[email protected]> Reviewed-by: Sivakumar Subramani <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e5619c1 commit 840f300

File tree

4 files changed

+30
-58
lines changed

4 files changed

+30
-58
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,8 +2470,8 @@ int cxgb4_sync_txq_pidx(struct net_device *dev, u16 qid, u16 pidx,
24702470
else
24712471
delta = size - hw_pidx + pidx;
24722472
wmb();
2473-
t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),
2474-
V_QID(qid) | V_PIDX(delta));
2473+
t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
2474+
QID(qid) | PIDX(delta));
24752475
}
24762476
out:
24772477
return ret;
@@ -2579,8 +2579,8 @@ static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q)
25792579
else
25802580
delta = q->size - hw_pidx + q->db_pidx;
25812581
wmb();
2582-
t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),
2583-
V_QID(q->cntxt_id) | V_PIDX(delta));
2582+
t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
2583+
QID(q->cntxt_id) | PIDX(delta));
25842584
}
25852585
out:
25862586
q->db_disabled = 0;
@@ -2617,9 +2617,9 @@ static void process_db_full(struct work_struct *work)
26172617

26182618
notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL);
26192619
drain_db_fifo(adap, dbfifo_drain_delay);
2620-
t4_set_reg_field(adap, A_SGE_INT_ENABLE3,
2621-
F_DBFIFO_HP_INT | F_DBFIFO_LP_INT,
2622-
F_DBFIFO_HP_INT | F_DBFIFO_LP_INT);
2620+
t4_set_reg_field(adap, SGE_INT_ENABLE3,
2621+
DBFIFO_HP_INT | DBFIFO_LP_INT,
2622+
DBFIFO_HP_INT | DBFIFO_LP_INT);
26232623
notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY);
26242624
}
26252625

@@ -2639,8 +2639,8 @@ static void process_db_drop(struct work_struct *work)
26392639

26402640
void t4_db_full(struct adapter *adap)
26412641
{
2642-
t4_set_reg_field(adap, A_SGE_INT_ENABLE3,
2643-
F_DBFIFO_HP_INT | F_DBFIFO_LP_INT, 0);
2642+
t4_set_reg_field(adap, SGE_INT_ENABLE3,
2643+
DBFIFO_HP_INT | DBFIFO_LP_INT, 0);
26442644
queue_work(workq, &adap->db_full_task);
26452645
}
26462646

drivers/net/ethernet/chelsio/cxgb4/sge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n)
769769
wmb(); /* write descriptors before telling HW */
770770
spin_lock(&q->db_lock);
771771
if (!q->db_disabled) {
772-
t4_write_reg(adap, MYPF_REG(A_SGE_PF_KDOORBELL),
773-
V_QID(q->cntxt_id) | V_PIDX(n));
772+
t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL),
773+
QID(q->cntxt_id) | PIDX(n));
774774
}
775775
q->db_pidx = q->pidx;
776776
spin_unlock(&q->db_lock);

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,9 +1018,9 @@ static void sge_intr_handler(struct adapter *adapter)
10181018
{ ERR_INVALID_CIDX_INC,
10191019
"SGE GTS CIDX increment too large", -1, 0 },
10201020
{ ERR_CPL_OPCODE_0, "SGE received 0-length CPL", -1, 0 },
1021-
{ F_DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },
1022-
{ F_DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },
1023-
{ F_ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },
1021+
{ DBFIFO_LP_INT, NULL, -1, 0, t4_db_full },
1022+
{ DBFIFO_HP_INT, NULL, -1, 0, t4_db_full },
1023+
{ ERR_DROPPED_DB, NULL, -1, 0, t4_db_dropped },
10241024
{ ERR_DATA_CPL_ON_HIGH_QID1 | ERR_DATA_CPL_ON_HIGH_QID0,
10251025
"SGE IQID > 1023 received CPL for FL", -1, 0 },
10261026
{ ERR_BAD_DB_PIDX3, "SGE DBP 3 pidx increment too large", -1,
@@ -1520,7 +1520,7 @@ void t4_intr_enable(struct adapter *adapter)
15201520
ERR_BAD_DB_PIDX2 | ERR_BAD_DB_PIDX1 |
15211521
ERR_BAD_DB_PIDX0 | ERR_ING_CTXT_PRIO |
15221522
ERR_EGR_CTXT_PRIO | INGRESS_SIZE_ERR |
1523-
F_DBFIFO_HP_INT | F_DBFIFO_LP_INT |
1523+
DBFIFO_HP_INT | DBFIFO_LP_INT |
15241524
EGRESS_SIZE_ERR);
15251525
t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE), PF_INTR_MASK);
15261526
t4_set_reg_field(adapter, PL_INT_MAP0, 0, 1 << pf);
@@ -2033,8 +2033,8 @@ int t4_mem_win_read_len(struct adapter *adap, u32 addr, __be32 *data, int len)
20332033
if ((addr & 3) || (len + off) > MEMWIN0_APERTURE)
20342034
return -EINVAL;
20352035

2036-
t4_write_reg(adap, A_PCIE_MEM_ACCESS_OFFSET, addr & ~15);
2037-
t4_read_reg(adap, A_PCIE_MEM_ACCESS_OFFSET);
2036+
t4_write_reg(adap, PCIE_MEM_ACCESS_OFFSET, addr & ~15);
2037+
t4_read_reg(adap, PCIE_MEM_ACCESS_OFFSET);
20382038

20392039
for (i = 0; i < len; i += 4)
20402040
*data++ = t4_read_reg(adap, (MEMWIN0_BASE + off + i));

drivers/net/ethernet/chelsio/cxgb4/t4_regs.h

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -190,58 +190,30 @@
190190
#define SGE_DEBUG_DATA_LOW 0x10d4
191191
#define SGE_INGRESS_QUEUES_PER_PAGE_PF 0x10f4
192192

193-
#define S_LP_INT_THRESH 12
194-
#define V_LP_INT_THRESH(x) ((x) << S_LP_INT_THRESH)
195193
#define S_HP_INT_THRESH 28
194+
#define M_HP_INT_THRESH 0xfU
196195
#define V_HP_INT_THRESH(x) ((x) << S_HP_INT_THRESH)
196+
#define M_HP_COUNT 0x7ffU
197+
#define S_HP_COUNT 16
198+
#define G_HP_COUNT(x) (((x) >> S_HP_COUNT) & M_HP_COUNT)
199+
#define S_LP_INT_THRESH 12
200+
#define M_LP_INT_THRESH 0xfU
201+
#define V_LP_INT_THRESH(x) ((x) << S_LP_INT_THRESH)
202+
#define M_LP_COUNT 0x7ffU
203+
#define S_LP_COUNT 0
204+
#define G_LP_COUNT(x) (((x) >> S_LP_COUNT) & M_LP_COUNT)
197205
#define A_SGE_DBFIFO_STATUS 0x10a4
198206

199207
#define S_ENABLE_DROP 13
200208
#define V_ENABLE_DROP(x) ((x) << S_ENABLE_DROP)
201209
#define F_ENABLE_DROP V_ENABLE_DROP(1U)
202-
#define A_SGE_DOORBELL_CONTROL 0x10a8
203-
204-
#define A_SGE_CTXT_CMD 0x11fc
205-
#define A_SGE_DBQ_CTXT_BADDR 0x1084
206-
207-
#define A_SGE_PF_KDOORBELL 0x0
208-
209-
#define S_QID 15
210-
#define V_QID(x) ((x) << S_QID)
211-
212-
#define S_PIDX 0
213-
#define V_PIDX(x) ((x) << S_PIDX)
214-
215-
#define M_LP_COUNT 0x7ffU
216-
#define S_LP_COUNT 0
217-
#define G_LP_COUNT(x) (((x) >> S_LP_COUNT) & M_LP_COUNT)
218-
219-
#define M_HP_COUNT 0x7ffU
220-
#define S_HP_COUNT 16
221-
#define G_HP_COUNT(x) (((x) >> S_HP_COUNT) & M_HP_COUNT)
222-
223-
#define A_SGE_INT_ENABLE3 0x1040
224-
225-
#define S_DBFIFO_HP_INT 8
226-
#define V_DBFIFO_HP_INT(x) ((x) << S_DBFIFO_HP_INT)
227-
#define F_DBFIFO_HP_INT V_DBFIFO_HP_INT(1U)
228-
229-
#define S_DBFIFO_LP_INT 7
230-
#define V_DBFIFO_LP_INT(x) ((x) << S_DBFIFO_LP_INT)
231-
#define F_DBFIFO_LP_INT V_DBFIFO_LP_INT(1U)
232-
233210
#define S_DROPPED_DB 0
234211
#define V_DROPPED_DB(x) ((x) << S_DROPPED_DB)
235212
#define F_DROPPED_DB V_DROPPED_DB(1U)
213+
#define A_SGE_DOORBELL_CONTROL 0x10a8
236214

237-
#define S_ERR_DROPPED_DB 18
238-
#define V_ERR_DROPPED_DB(x) ((x) << S_ERR_DROPPED_DB)
239-
#define F_ERR_DROPPED_DB V_ERR_DROPPED_DB(1U)
240-
241-
#define A_PCIE_MEM_ACCESS_OFFSET 0x306c
242-
243-
#define M_HP_INT_THRESH 0xfU
244-
#define M_LP_INT_THRESH 0xfU
215+
#define A_SGE_CTXT_CMD 0x11fc
216+
#define A_SGE_DBQ_CTXT_BADDR 0x1084
245217

246218
#define PCIE_PF_CLI 0x44
247219
#define PCIE_INT_CAUSE 0x3004

0 commit comments

Comments
 (0)