Skip to content

Commit aadb0b1

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: remove fw_reset devlink health reporter
Firmware resets initiated by the user are not errors and should not be reported via devlink. Once only unsolicited resets remain, it is no longer sensible to maintain a separate fw_reset reporter. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1596847 commit aadb0b1

File tree

4 files changed

+53
-116
lines changed

4 files changed

+53
-116
lines changed

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ static int bnxt_async_event_process(struct bnxt *bp,
21222122
set_bit(BNXT_RESET_TASK_SILENT_SP_EVENT, &bp->sp_event);
21232123
break;
21242124
case ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY: {
2125-
char *fatal_str = "non-fatal";
2125+
char *type_str = "Solicited";
21262126

21272127
if (!bp->fw_health)
21282128
goto async_event_process_exit;
@@ -2137,12 +2137,16 @@ static int bnxt_async_event_process(struct bnxt *bp,
21372137
if (EVENT_DATA1_RESET_NOTIFY_FW_ACTIVATION(data1)) {
21382138
set_bit(BNXT_STATE_FW_ACTIVATE_RESET, &bp->state);
21392139
} else if (EVENT_DATA1_RESET_NOTIFY_FATAL(data1)) {
2140-
fatal_str = "fatal";
2140+
type_str = "Fatal";
21412141
set_bit(BNXT_STATE_FW_FATAL_COND, &bp->state);
2142+
} else if (data2 && BNXT_FW_STATUS_HEALTHY !=
2143+
EVENT_DATA2_RESET_NOTIFY_FW_STATUS_CODE(data2)) {
2144+
type_str = "Non-fatal";
2145+
set_bit(BNXT_STATE_FW_NON_FATAL_COND, &bp->state);
21422146
}
21432147
netif_warn(bp, hw, bp->dev,
2144-
"Firmware %s reset event, data1: 0x%x, data2: 0x%x, min wait %u ms, max wait %u ms\n",
2145-
fatal_str, data1, data2,
2148+
"%s firmware reset event, data1: 0x%x, data2: 0x%x, min wait %u ms, max wait %u ms\n",
2149+
type_str, data1, data2,
21462150
bp->fw_reset_min_dsecs * 100,
21472151
bp->fw_reset_max_dsecs * 100);
21482152
set_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event);
@@ -11737,13 +11741,17 @@ static void bnxt_sp_task(struct work_struct *work)
1173711741
if (test_and_clear_bit(BNXT_RST_RING_SP_EVENT, &bp->sp_event))
1173811742
bnxt_rx_ring_reset(bp);
1173911743

11740-
if (test_and_clear_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event))
11741-
bnxt_devlink_health_report(bp, BNXT_FW_RESET_NOTIFY_SP_EVENT);
11744+
if (test_and_clear_bit(BNXT_FW_RESET_NOTIFY_SP_EVENT, &bp->sp_event)) {
11745+
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) ||
11746+
test_bit(BNXT_STATE_FW_NON_FATAL_COND, &bp->state))
11747+
bnxt_devlink_health_fw_report(bp);
11748+
else
11749+
bnxt_fw_reset(bp);
11750+
}
1174211751

1174311752
if (test_and_clear_bit(BNXT_FW_EXCEPTION_SP_EVENT, &bp->sp_event)) {
1174411753
if (!is_bnxt_fw_ok(bp))
11745-
bnxt_devlink_health_report(bp,
11746-
BNXT_FW_EXCEPTION_SP_EVENT);
11754+
bnxt_devlink_health_fw_report(bp);
1174711755
}
1174811756

1174911757
smp_mb__before_atomic();
@@ -12079,7 +12087,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
1207912087
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1208012088
if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF) {
1208112089
bnxt_ulp_start(bp, rc);
12082-
bnxt_dl_health_status_update(bp, false);
12090+
bnxt_dl_health_fw_status_update(bp, false);
1208312091
}
1208412092
bp->fw_reset_state = 0;
1208512093
dev_close(bp->dev);
@@ -12178,6 +12186,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1217812186
}
1217912187
}
1218012188
clear_bit(BNXT_STATE_FW_FATAL_COND, &bp->state);
12189+
clear_bit(BNXT_STATE_FW_NON_FATAL_COND, &bp->state);
1218112190
if (test_and_clear_bit(BNXT_STATE_FW_ACTIVATE_RESET, &bp->state) &&
1218212191
!test_bit(BNXT_STATE_FW_ACTIVATE, &bp->state))
1218312192
bnxt_dl_remote_reload(bp);
@@ -12230,9 +12239,11 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1223012239
bnxt_vf_reps_alloc(bp);
1223112240
bnxt_vf_reps_open(bp);
1223212241
bnxt_ptp_reapply_pps(bp);
12233-
bnxt_dl_health_recovery_done(bp);
12234-
bnxt_dl_health_status_update(bp, true);
1223512242
clear_bit(BNXT_STATE_FW_ACTIVATE, &bp->state);
12243+
if (test_and_clear_bit(BNXT_STATE_RECOVER, &bp->state)) {
12244+
bnxt_dl_health_fw_recovery_done(bp);
12245+
bnxt_dl_health_fw_status_update(bp, true);
12246+
}
1223612247
rtnl_unlock();
1223712248
break;
1223812249
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ struct rx_tpa_end_cmp_ext {
494494
ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_MASK) ==\
495495
ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA1_REASON_CODE_FW_ACTIVATION)
496496

497+
#define EVENT_DATA2_RESET_NOTIFY_FW_STATUS_CODE(data2) \
498+
((data2) & \
499+
ASYNC_EVENT_CMPL_RESET_NOTIFY_EVENT_DATA2_FW_STATUS_CODE_MASK)
500+
497501
#define EVENT_DATA1_RECOVERY_MASTER_FUNC(data1) \
498502
!!((data1) & \
499503
ASYNC_EVENT_CMPL_ERROR_RECOVERY_EVENT_DATA1_FLAGS_MASTER_FUNC)
@@ -1537,7 +1541,6 @@ struct bnxt_fw_health {
15371541
u32 last_fw_reset_cnt;
15381542
u8 enabled:1;
15391543
u8 primary:1;
1540-
u8 fatal:1;
15411544
u8 status_reliable:1;
15421545
u8 tmr_multiplier;
15431546
u8 tmr_counter;
@@ -1548,14 +1551,9 @@ struct bnxt_fw_health {
15481551
u32 echo_req_data1;
15491552
u32 echo_req_data2;
15501553
struct devlink_health_reporter *fw_reporter;
1551-
struct devlink_health_reporter *fw_reset_reporter;
15521554
struct devlink_health_reporter *fw_fatal_reporter;
15531555
};
15541556

1555-
struct bnxt_fw_reporter_ctx {
1556-
unsigned long sp_event;
1557-
};
1558-
15591557
#define BNXT_FW_HEALTH_REG_TYPE_MASK 3
15601558
#define BNXT_FW_HEALTH_REG_TYPE_CFG 0
15611559
#define BNXT_FW_HEALTH_REG_TYPE_GRC 1
@@ -1894,6 +1892,8 @@ struct bnxt {
18941892
#define BNXT_STATE_PCI_CHANNEL_IO_FROZEN 8
18951893
#define BNXT_STATE_NAPI_DISABLED 9
18961894
#define BNXT_STATE_FW_ACTIVATE 11
1895+
#define BNXT_STATE_RECOVER 12
1896+
#define BNXT_STATE_FW_NON_FATAL_COND 13
18971897
#define BNXT_STATE_FW_ACTIVATE_RESET 14
18981898

18991899
#define BNXT_NO_FW_ACCESS(bp) \

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

Lines changed: 22 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
#include "bnxt_ulp.h"
2020
#include "bnxt_ptp.h"
2121

22+
static void __bnxt_fw_recover(struct bnxt *bp)
23+
{
24+
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state) ||
25+
test_bit(BNXT_STATE_FW_NON_FATAL_COND, &bp->state))
26+
bnxt_fw_reset(bp);
27+
else
28+
bnxt_fw_exception(bp);
29+
}
30+
2231
static int
2332
bnxt_dl_flash_update(struct devlink *dl,
2433
struct devlink_flash_update_params *params,
@@ -106,42 +115,14 @@ static const struct devlink_health_reporter_ops bnxt_dl_fw_reporter_ops = {
106115
.diagnose = bnxt_fw_reporter_diagnose,
107116
};
108117

109-
static int bnxt_fw_reset_recover(struct devlink_health_reporter *reporter,
110-
void *priv_ctx,
111-
struct netlink_ext_ack *extack)
112-
{
113-
struct bnxt *bp = devlink_health_reporter_priv(reporter);
114-
115-
if (!priv_ctx)
116-
return -EOPNOTSUPP;
117-
118-
bnxt_fw_reset(bp);
119-
return -EINPROGRESS;
120-
}
121-
122-
static const
123-
struct devlink_health_reporter_ops bnxt_dl_fw_reset_reporter_ops = {
124-
.name = "fw_reset",
125-
.recover = bnxt_fw_reset_recover,
126-
};
127-
128118
static int bnxt_fw_fatal_recover(struct devlink_health_reporter *reporter,
129119
void *priv_ctx,
130120
struct netlink_ext_ack *extack)
131121
{
132122
struct bnxt *bp = devlink_health_reporter_priv(reporter);
133-
struct bnxt_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;
134-
unsigned long event;
135-
136-
if (!priv_ctx)
137-
return -EOPNOTSUPP;
138123

139-
bp->fw_health->fatal = true;
140-
event = fw_reporter_ctx->sp_event;
141-
if (event == BNXT_FW_RESET_NOTIFY_SP_EVENT)
142-
bnxt_fw_reset(bp);
143-
else if (event == BNXT_FW_EXCEPTION_SP_EVENT)
144-
bnxt_fw_exception(bp);
124+
set_bit(BNXT_STATE_RECOVER, &bp->state);
125+
__bnxt_fw_recover(bp);
145126

146127
return -EINPROGRESS;
147128
}
@@ -159,24 +140,6 @@ void bnxt_dl_fw_reporters_create(struct bnxt *bp)
159140
if (!health)
160141
return;
161142

162-
if (!(bp->fw_cap & BNXT_FW_CAP_HOT_RESET) || health->fw_reset_reporter)
163-
goto err_recovery;
164-
165-
health->fw_reset_reporter =
166-
devlink_health_reporter_create(bp->dl,
167-
&bnxt_dl_fw_reset_reporter_ops,
168-
0, bp);
169-
if (IS_ERR(health->fw_reset_reporter)) {
170-
netdev_warn(bp->dev, "Failed to create FW fatal health reporter, rc = %ld\n",
171-
PTR_ERR(health->fw_reset_reporter));
172-
health->fw_reset_reporter = NULL;
173-
bp->fw_cap &= ~BNXT_FW_CAP_HOT_RESET;
174-
}
175-
176-
err_recovery:
177-
if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
178-
return;
179-
180143
if (!health->fw_reporter) {
181144
health->fw_reporter =
182145
devlink_health_reporter_create(bp->dl,
@@ -186,7 +149,6 @@ void bnxt_dl_fw_reporters_create(struct bnxt *bp)
186149
netdev_warn(bp->dev, "Failed to create FW health reporter, rc = %ld\n",
187150
PTR_ERR(health->fw_reporter));
188151
health->fw_reporter = NULL;
189-
bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
190152
return;
191153
}
192154
}
@@ -213,12 +175,6 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all)
213175
if (!health)
214176
return;
215177

216-
if ((all || !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) &&
217-
health->fw_reset_reporter) {
218-
devlink_health_reporter_destroy(health->fw_reset_reporter);
219-
health->fw_reset_reporter = NULL;
220-
}
221-
222178
if ((bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) && !all)
223179
return;
224180

@@ -233,43 +189,23 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all)
233189
}
234190
}
235191

236-
void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event)
192+
void bnxt_devlink_health_fw_report(struct bnxt *bp)
237193
{
238194
struct bnxt_fw_health *fw_health = bp->fw_health;
239-
struct bnxt_fw_reporter_ctx fw_reporter_ctx;
240-
241-
fw_reporter_ctx.sp_event = event;
242-
switch (event) {
243-
case BNXT_FW_RESET_NOTIFY_SP_EVENT:
244-
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) {
245-
if (!fw_health->fw_fatal_reporter)
246-
return;
247-
248-
devlink_health_report(fw_health->fw_fatal_reporter,
249-
"FW fatal async event received",
250-
&fw_reporter_ctx);
251-
return;
252-
}
253-
if (!fw_health->fw_reset_reporter)
254-
return;
255195

256-
devlink_health_report(fw_health->fw_reset_reporter,
257-
"FW non-fatal reset event received",
258-
&fw_reporter_ctx);
196+
if (!fw_health)
259197
return;
260198

261-
case BNXT_FW_EXCEPTION_SP_EVENT:
262-
if (!fw_health->fw_fatal_reporter)
263-
return;
264-
265-
devlink_health_report(fw_health->fw_fatal_reporter,
266-
"FW fatal error reported",
267-
&fw_reporter_ctx);
199+
if (!fw_health->fw_fatal_reporter) {
200+
__bnxt_fw_recover(bp);
268201
return;
269202
}
203+
204+
devlink_health_report(fw_health->fw_fatal_reporter,
205+
"FW fatal error reported", NULL);
270206
}
271207

272-
void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy)
208+
void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy)
273209
{
274210
struct bnxt_fw_health *health = bp->fw_health;
275211
u8 state;
@@ -279,25 +215,15 @@ void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy)
279215
else
280216
state = DEVLINK_HEALTH_REPORTER_STATE_ERROR;
281217

282-
if (health->fatal)
283-
devlink_health_reporter_state_update(health->fw_fatal_reporter,
284-
state);
285-
else
286-
devlink_health_reporter_state_update(health->fw_reset_reporter,
287-
state);
288-
289-
health->fatal = false;
218+
devlink_health_reporter_state_update(health->fw_fatal_reporter, state);
290219
}
291220

292-
void bnxt_dl_health_recovery_done(struct bnxt *bp)
221+
void bnxt_dl_health_fw_recovery_done(struct bnxt *bp)
293222
{
294223
struct bnxt_fw_health *hlth = bp->fw_health;
295224
struct bnxt_dl *dl = devlink_priv(bp->dl);
296225

297-
if (hlth->fatal)
298-
devlink_health_reporter_recovery_done(hlth->fw_fatal_reporter);
299-
else
300-
devlink_health_reporter_recovery_done(hlth->fw_reset_reporter);
226+
devlink_health_reporter_recovery_done(hlth->fw_fatal_reporter);
301227
bnxt_hwrm_remote_dev_reset_set(bp, dl->remote_reset);
302228
}
303229

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ enum bnxt_dl_version_type {
7171
BNXT_VERSION_STORED,
7272
};
7373

74-
void bnxt_devlink_health_report(struct bnxt *bp, unsigned long event);
75-
void bnxt_dl_health_status_update(struct bnxt *bp, bool healthy);
76-
void bnxt_dl_health_recovery_done(struct bnxt *bp);
74+
void bnxt_devlink_health_fw_report(struct bnxt *bp);
75+
void bnxt_dl_health_fw_status_update(struct bnxt *bp, bool healthy);
76+
void bnxt_dl_health_fw_recovery_done(struct bnxt *bp);
7777
void bnxt_dl_fw_reporters_create(struct bnxt *bp);
7878
void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all);
7979
int bnxt_dl_register(struct bnxt *bp);

0 commit comments

Comments
 (0)