Skip to content

Commit d846992

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Implement the new toggle bit doorbell mechanism on P7 chips
The new chip family passes the Toggle bits to the driver in the NQE notification. The driver now stores this value and sends it back to hardware when it re-arms the RX and TX CQs. Together with the earlier patch that guarantees the driver will only re-arm the CQ at the end of NAPI polling if it has seen a new NQE, this method allows the hardware to detect any dropped doorbells. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://lore.kernel.org/r/20231201223924.26955-6-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d3c1647 commit d846992

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,13 +2880,18 @@ static void __bnxt_poll_cqs_done(struct bnxt *bp, struct bnxt_napi *bnapi,
28802880
struct bnxt_db_info *db;
28812881

28822882
if (cpr2->had_work_done) {
2883+
u32 tgl = 0;
2884+
2885+
if (dbr_type == DBR_TYPE_CQ_ARMALL) {
2886+
cpr2->had_nqe_notify = 0;
2887+
tgl = cpr2->toggle;
2888+
}
28832889
db = &cpr2->cp_db;
2884-
bnxt_writeq(bp, db->db_key64 | dbr_type |
2890+
bnxt_writeq(bp,
2891+
db->db_key64 | dbr_type | DB_TOGGLE(tgl) |
28852892
DB_RING_IDX(db, cpr2->cp_raw_cons),
28862893
db->doorbell);
28872894
cpr2->had_work_done = 0;
2888-
if (dbr_type == DBR_TYPE_CQ_ARMALL)
2889-
cpr2->had_nqe_notify = 0;
28902895
}
28912896
}
28922897
__bnxt_poll_work_done(bp, bnapi, budget);
@@ -2912,6 +2917,8 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
29122917
work_done = __bnxt_poll_cqs(bp, bnapi, budget);
29132918
}
29142919
while (1) {
2920+
u16 type;
2921+
29152922
cons = RING_CMP(raw_cons);
29162923
nqcmp = &cpr->nq_desc_ring[CP_RING(cons)][CP_IDX(cons)];
29172924

@@ -2933,7 +2940,8 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
29332940
*/
29342941
dma_rmb();
29352942

2936-
if (nqcmp->type == cpu_to_le16(NQ_CN_TYPE_CQ_NOTIFICATION)) {
2943+
type = le16_to_cpu(nqcmp->type);
2944+
if (NQE_CN_TYPE(type) == NQ_CN_TYPE_CQ_NOTIFICATION) {
29372945
u32 idx = le32_to_cpu(nqcmp->cq_handle_low);
29382946
u32 cq_type = BNXT_NQ_HDL_TYPE(idx);
29392947
struct bnxt_cp_ring_info *cpr2;
@@ -2946,6 +2954,7 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
29462954
idx = BNXT_NQ_HDL_IDX(idx);
29472955
cpr2 = &cpr->cp_ring_arr[idx];
29482956
cpr2->had_nqe_notify = 1;
2957+
cpr2->toggle = NQE_CN_TOGGLE(type);
29492958
work_done += __bnxt_poll_work(bp, cpr2,
29502959
budget - work_done);
29512960
cpr->has_more_work |= cpr2->has_more_work;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ struct bnxt_cp_ring_info {
10381038
u8 had_work_done:1;
10391039
u8 has_more_work:1;
10401040
u8 had_nqe_notify:1;
1041+
u8 toggle;
10411042

10421043
u8 cp_ring_type;
10431044
u8 cp_idx;

0 commit comments

Comments
 (0)