Skip to content

Commit 2bb21b8

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: consolidate fw devlink health reporters
Merge 'fw' and 'fw_fatal' health reporters. There is no longer a need to distinguish between firmware reporters. Only bonafide errors are reported now and no reports were being generated for the 'fw' reporter. Signed-off-by: Edwin Peer <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aadb0b1 commit 2bb21b8

File tree

2 files changed

+21
-51
lines changed

2 files changed

+21
-51
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,6 @@ struct bnxt_fw_health {
15511551
u32 echo_req_data1;
15521552
u32 echo_req_data2;
15531553
struct devlink_health_reporter *fw_reporter;
1554-
struct devlink_health_reporter *fw_fatal_reporter;
15551554
};
15561555

15571556
#define BNXT_FW_HEALTH_REG_TYPE_MASK 3

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

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ static int bnxt_hwrm_remote_dev_reset_set(struct bnxt *bp, bool remote_reset)
7171
return hwrm_req_send(bp, req);
7272
}
7373

74-
static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
75-
struct devlink_fmsg *fmsg,
76-
struct netlink_ext_ack *extack)
74+
static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter,
75+
struct devlink_fmsg *fmsg,
76+
struct netlink_ext_ack *extack)
7777
{
7878
struct bnxt *bp = devlink_health_reporter_priv(reporter);
7979
u32 val;
@@ -110,14 +110,9 @@ static int bnxt_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
110110
return 0;
111111
}
112112

113-
static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
114-
.name = "fw",
115-
.diagnose = bnxt_fw_reporter_diagnose,
116-
};
117-
118-
static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
119-
void *priv_ctx,
120-
struct netlink_ext_ack *extack)
113+
static int bnxt_fw_recover(struct devlink_health_reporter *reporter,
114+
void *priv_ctx,
115+
struct netlink_ext_ack *extack)
121116
{
122117
struct bnxt *bp = devlink_health_reporter_priv(reporter);
123118

@@ -127,43 +122,26 @@ static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
127122
return -EINPROGRESS;
128123
}
129124

130-
static const
131-
struct devlink_health_reporter_ops bnxt_dl_fw_fatal_reporter_ops = {
132-
.name = "fw_fatal",
133-
.recover = bnxt_fw_fatal_recover,
125+
static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
126+
.name = "fw",
127+
.diagnose = bnxt_fw_diagnose,
128+
.recover = bnxt_fw_recover,
134129
};
135130

136131
void bnxt_dl_fw_reporters_create(struct bnxt *bp)
137132
{
138133
struct bnxt_fw_health *health = bp->fw_health;
139134

140-
if (!health)
135+
if (!health || health->fw_reporter)
141136
return;
142137

143-
if (!health->fw_reporter) {
144-
health->fw_reporter =
145-
devlink_health_reporter_create(bp->dl,
146-
&bnxt_dl_fw_reporter_ops,
147-
0, bp);
148-
if (IS_ERR(health->fw_reporter)) {
149-
netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n",
150-
PTR_ERR(health->fw_reporter));
151-
health->fw_reporter = NULL;
152-
return;
153-
}
154-
}
155-
156-
if (health->fw_fatal_reporter)
157-
return;
158-
159-
health->fw_fatal_reporter =
160-
devlink_health_reporter_create(bp->dl,
161-
&bnxt_dl_fw_fatal_reporter_ops,
138+
health->fw_reporter =
139+
devlink_health_reporter_create(bp->dl, &bnxt_dl_fw_reporter_ops,
162140
0, bp);
163-
if (IS_ERR(health->fw_fatal_reporter)) {
164-
netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n",
165-
PTR_ERR(health->fw_fatal_reporter));
166-
health->fw_fatal_reporter = NULL;
141+
if (IS_ERR(health->fw_reporter)) {
142+
netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n",
143+
PTR_ERR(health->fw_reporter));
144+
health->fw_reporter = NULL;
167145
bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
168146
}
169147
}
@@ -182,11 +160,6 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all)
182160
devlink_health_reporter_destroy(health->fw_reporter);
183161
health->fw_reporter = NULL;
184162
}
185-
186-
if (health->fw_fatal_reporter) {
187-
devlink_health_reporter_destroy(health->fw_fatal_reporter);
188-
health->fw_fatal_reporter = NULL;
189-
}
190163
}
191164

192165
void bnxt_devlink_health_fw_report(struct bnxt *bp)
@@ -196,13 +169,12 @@ void bnxt_devlink_health_fw_report(struct bnxt *bp)
196169
if (!fw_health)
197170
return;
198171

199-
if (!fw_health->fw_fatal_reporter) {
172+
if (!fw_health->fw_reporter) {
200173
__bnxt_fw_recover(bp);
201174
return;
202175
}
203176

204-
devlink_health_report(fw_health->fw_fatal_reporter,
205-
"FW fatal error reported", NULL);
177+
devlink_health_report(fw_health->fw_reporter, "FW error reported", NULL);
206178
}
207179

208180
void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy)
@@ -215,15 +187,14 @@ void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy)
215187
else
216188
state = DEVLINK_HEALTH_REPORTER_STATE_ERROR;
217189

218-
devlink_health_reporter_state_update(health->fw_fatal_reporter, state);
190+
devlink_health_reporter_state_update(health->fw_reporter, state);
219191
}
220192

221193
void bnxt_dl_health_fw_recovery_done(struct bnxt *bp)
222194
{
223-
struct bnxt_fw_health *hlth = bp->fw_health;
224195
struct bnxt_dl *dl = devlink_priv(bp->dl);
225196

226-
devlink_health_reporter_recovery_done(hlth->fw_fatal_reporter);
197+
devlink_health_reporter_recovery_done(bp->fw_health->fw_reporter);
227198
bnxt_hwrm_remote_dev_reset_set(bp, dl->remote_reset);
228199
}
229200

0 commit comments

Comments
 (0)