Skip to content

Commit 006e896

Browse files
committed
Merge tag 'mlx5-updates-2024-02-01' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2024-02-01 1) IPSec global stats for xfrm and mlx5 2) XSK memory improvements for non-linear SKBs 3) Software steering debug dump to use seq_file ops 4) Various code clean-ups * tag 'mlx5-updates-2024-02-01' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5e: XDP, Exclude headroom and tailroom from memory calculations net/mlx5e: XSK, Exclude tailroom from non-linear SKBs memory calculations net/mlx5: DR, Change SWS usage to debug fs seq_file interface net/mlx5: Change missing SyncE capability print to debug net/mlx5: Remove initial segmentation duplicate definitions net/mlx5: Return specific error code for timeout on wait_fw_init net/mlx5: SF, Stop waiting for FW as teardown was called net/mlx5: remove fw reporter dump option for non PF net/mlx5: remove fw_fatal reporter dump option for non PF net/mlx5: Rename mlx5_sf_dev_remove Documentation: Fix counter name of mlx5 vnic reporter net/mlx5e: Delete obsolete IPsec code net/mlx5e: Connect mlx5 IPsec statistics with XFRM core xfrm: get global statistics from the offloaded device xfrm: generalize xdo_dev_state_update_curlft to allow statistics update ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 313fb18 + a90f559 commit 006e896

File tree

23 files changed

+766
-240
lines changed

23 files changed

+766
-240
lines changed

Documentation/networking/devlink/mlx5.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ them in realtime.
250250

251251
Description of the vnic counters:
252252

253-
- total_q_under_processor_handle
253+
- total_error_queues
254254
number of queues in an error state due to
255255
an async error or errored command.
256256
- send_queue_priority_update_flow
@@ -259,7 +259,8 @@ Description of the vnic counters:
259259
number of times CQ entered an error state due to an overflow.
260260
- async_eq_overrun
261261
number of times an EQ mapped to async events was overrun.
262-
comp_eq_overrun number of times an EQ mapped to completion events was
262+
- comp_eq_overrun
263+
number of times an EQ mapped to completion events was
263264
overrun.
264265
- quota_exceeded_command
265266
number of commands issued and failed due to quota exceeded.

Documentation/networking/xfrm_device.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ Callbacks to implement
7171
bool (*xdo_dev_offload_ok) (struct sk_buff *skb,
7272
struct xfrm_state *x);
7373
void (*xdo_dev_state_advance_esn) (struct xfrm_state *x);
74+
void (*xdo_dev_state_update_stats) (struct xfrm_state *x);
7475

7576
/* Solely packet offload callbacks */
76-
void (*xdo_dev_state_update_curlft) (struct xfrm_state *x);
7777
int (*xdo_dev_policy_add) (struct xfrm_policy *x, struct netlink_ext_ack *extack);
7878
void (*xdo_dev_policy_delete) (struct xfrm_policy *x);
7979
void (*xdo_dev_policy_free) (struct xfrm_policy *x);
@@ -191,6 +191,6 @@ xdo_dev_policy_free() on any remaining offloaded states.
191191

192192
Outcome of HW handling packets, the XFRM core can't count hard, soft limits.
193193
The HW/driver are responsible to perform it and provide accurate data when
194-
xdo_dev_state_update_curlft() is called. In case of one of these limits
194+
xdo_dev_state_update_stats() is called. In case of one of these limits
195195
occuried, the driver needs to call to xfrm_state_check_expire() to make sure
196196
that XFRM performs rekeying sequence.

drivers/net/ethernet/mellanox/mlx5/core/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static bool is_dpll_supported(struct mlx5_core_dev *dev)
210210
return false;
211211

212212
if (!MLX5_CAP_MCAM_REG2(dev, synce_registers)) {
213-
mlx5_core_warn(dev, "Missing SyncE capability\n");
213+
mlx5_core_dbg(dev, "Missing SyncE capability\n");
214214
return false;
215215
}
216216

drivers/net/ethernet/mellanox/mlx5/core/en/params.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,14 @@ static u32 mlx5e_rx_get_linear_sz_xsk(struct mlx5e_params *params,
240240
return xsk->headroom + hw_mtu;
241241
}
242242

243-
static u32 mlx5e_rx_get_linear_sz_skb(struct mlx5e_params *params, bool xsk)
243+
static u32 mlx5e_rx_get_linear_sz_skb(struct mlx5e_params *params, bool no_head_tail_room)
244244
{
245-
/* SKBs built on XDP_PASS on XSK RQs don't have headroom. */
246-
u16 headroom = xsk ? 0 : mlx5e_get_linear_rq_headroom(params, NULL);
247245
u32 hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu);
246+
u16 headroom;
247+
248+
if (no_head_tail_room)
249+
return SKB_DATA_ALIGN(hw_mtu);
250+
headroom = mlx5e_get_linear_rq_headroom(params, NULL);
248251

249252
return MLX5_SKB_FRAG_SZ(headroom + hw_mtu);
250253
}
@@ -254,6 +257,7 @@ static u32 mlx5e_rx_get_linear_stride_sz(struct mlx5_core_dev *mdev,
254257
struct mlx5e_xsk_param *xsk,
255258
bool mpwqe)
256259
{
260+
bool no_head_tail_room;
257261
u32 sz;
258262

259263
/* XSK frames are mapped as individual pages, because frames may come in
@@ -262,7 +266,13 @@ static u32 mlx5e_rx_get_linear_stride_sz(struct mlx5_core_dev *mdev,
262266
if (xsk)
263267
return mpwqe ? 1 << mlx5e_mpwrq_page_shift(mdev, xsk) : PAGE_SIZE;
264268

265-
sz = roundup_pow_of_two(mlx5e_rx_get_linear_sz_skb(params, false));
269+
no_head_tail_room = params->xdp_prog && mpwqe && !mlx5e_rx_is_linear_skb(mdev, params, xsk);
270+
271+
/* When no_head_tail_room is set, headroom and tailroom are excluded from skb calculations.
272+
* no_head_tail_room should be set in the case of XDP with Striding RQ
273+
* when SKB is not linear. This is because another page is allocated for the linear part.
274+
*/
275+
sz = roundup_pow_of_two(mlx5e_rx_get_linear_sz_skb(params, no_head_tail_room));
266276

267277
/* XDP in mlx5e doesn't support multiple packets per page.
268278
* Do not assume sz <= PAGE_SIZE if params->xdp_prog is set.
@@ -289,7 +299,11 @@ bool mlx5e_rx_is_linear_skb(struct mlx5_core_dev *mdev,
289299
if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE)
290300
return false;
291301

292-
/* Both XSK and non-XSK cases allocate an SKB on XDP_PASS. Packet data
302+
/* Call mlx5e_rx_get_linear_sz_skb with the no_head_tail_room parameter set
303+
* to exclude headroom and tailroom from calculations.
304+
* no_head_tail_room is true when SKB is built on XDP_PASS on XSK RQs
305+
* since packet data buffers don't have headroom and tailroom resreved for the SKB.
306+
* Both XSK and non-XSK cases allocate an SKB on XDP_PASS. Packet data
293307
* must fit into a CPU page.
294308
*/
295309
if (mlx5e_rx_get_linear_sz_skb(params, xsk) > PAGE_SIZE)

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -984,21 +984,41 @@ static void mlx5e_xfrm_advance_esn_state(struct xfrm_state *x)
984984
queue_work(sa_entry->ipsec->wq, &work->work);
985985
}
986986

987-
static void mlx5e_xfrm_update_curlft(struct xfrm_state *x)
987+
static void mlx5e_xfrm_update_stats(struct xfrm_state *x)
988988
{
989989
struct mlx5e_ipsec_sa_entry *sa_entry = to_ipsec_sa_entry(x);
990990
struct mlx5e_ipsec_rule *ipsec_rule = &sa_entry->ipsec_rule;
991+
struct net *net = dev_net(x->xso.dev);
991992
u64 packets, bytes, lastuse;
992993

993994
lockdep_assert(lockdep_is_held(&x->lock) ||
994-
lockdep_is_held(&dev_net(x->xso.real_dev)->xfrm.xfrm_cfg_mutex));
995+
lockdep_is_held(&dev_net(x->xso.real_dev)->xfrm.xfrm_cfg_mutex) ||
996+
lockdep_is_held(&dev_net(x->xso.real_dev)->xfrm.xfrm_state_lock));
995997

996998
if (x->xso.flags & XFRM_DEV_OFFLOAD_FLAG_ACQ)
997999
return;
9981000

1001+
if (sa_entry->attrs.dir == XFRM_DEV_OFFLOAD_IN) {
1002+
mlx5_fc_query_cached(ipsec_rule->auth.fc, &bytes, &packets, &lastuse);
1003+
x->stats.integrity_failed += packets;
1004+
XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATEPROTOERROR, packets);
1005+
1006+
mlx5_fc_query_cached(ipsec_rule->trailer.fc, &bytes, &packets, &lastuse);
1007+
XFRM_ADD_STATS(net, LINUX_MIB_XFRMINHDRERROR, packets);
1008+
}
1009+
1010+
if (x->xso.type != XFRM_DEV_OFFLOAD_PACKET)
1011+
return;
1012+
9991013
mlx5_fc_query_cached(ipsec_rule->fc, &bytes, &packets, &lastuse);
10001014
x->curlft.packets += packets;
10011015
x->curlft.bytes += bytes;
1016+
1017+
if (sa_entry->attrs.dir == XFRM_DEV_OFFLOAD_IN) {
1018+
mlx5_fc_query_cached(ipsec_rule->replay.fc, &bytes, &packets, &lastuse);
1019+
x->stats.replay += packets;
1020+
XFRM_ADD_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR, packets);
1021+
}
10021022
}
10031023

10041024
static int mlx5e_xfrm_validate_policy(struct mlx5_core_dev *mdev,
@@ -1156,7 +1176,7 @@ static const struct xfrmdev_ops mlx5e_ipsec_xfrmdev_ops = {
11561176
.xdo_dev_offload_ok = mlx5e_ipsec_offload_ok,
11571177
.xdo_dev_state_advance_esn = mlx5e_xfrm_advance_esn_state,
11581178

1159-
.xdo_dev_state_update_curlft = mlx5e_xfrm_update_curlft,
1179+
.xdo_dev_state_update_stats = mlx5e_xfrm_update_stats,
11601180
.xdo_dev_policy_add = mlx5e_xfrm_add_policy,
11611181
.xdo_dev_policy_delete = mlx5e_xfrm_del_policy,
11621182
.xdo_dev_policy_free = mlx5e_xfrm_free_policy,

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ struct mlx5e_ipsec_hw_stats {
137137
struct mlx5e_ipsec_sw_stats {
138138
atomic64_t ipsec_rx_drop_sp_alloc;
139139
atomic64_t ipsec_rx_drop_sadb_miss;
140-
atomic64_t ipsec_rx_drop_syndrome;
141140
atomic64_t ipsec_tx_drop_bundle;
142141
atomic64_t ipsec_tx_drop_no_state;
143142
atomic64_t ipsec_tx_drop_not_ip;

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,6 @@ bool mlx5e_ipsec_handle_tx_skb(struct net_device *netdev,
304304
return false;
305305
}
306306

307-
enum {
308-
MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_DECRYPTED,
309-
MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_AUTH_FAILED,
310-
MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_BAD_TRAILER,
311-
};
312-
313307
void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,
314308
struct sk_buff *skb,
315309
u32 ipsec_meta_data)
@@ -343,20 +337,7 @@ void mlx5e_ipsec_offload_handle_rx_skb(struct net_device *netdev,
343337

344338
xo = xfrm_offload(skb);
345339
xo->flags = CRYPTO_DONE;
346-
347-
switch (MLX5_IPSEC_METADATA_SYNDROM(ipsec_meta_data)) {
348-
case MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_DECRYPTED:
349-
xo->status = CRYPTO_SUCCESS;
350-
break;
351-
case MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_AUTH_FAILED:
352-
xo->status = CRYPTO_TUNNEL_ESP_AUTH_FAILED;
353-
break;
354-
case MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_BAD_TRAILER:
355-
xo->status = CRYPTO_INVALID_PACKET_SYNTAX;
356-
break;
357-
default:
358-
atomic64_inc(&ipsec->sw_stats.ipsec_rx_drop_syndrome);
359-
}
340+
xo->status = CRYPTO_SUCCESS;
360341
}
361342

362343
int mlx5_esw_ipsec_rx_make_metadata(struct mlx5e_priv *priv, u32 id, u32 *metadata)
@@ -374,8 +355,6 @@ int mlx5_esw_ipsec_rx_make_metadata(struct mlx5e_priv *priv, u32 id, u32 *metada
374355
return err;
375356
}
376357

377-
*metadata = MLX5_IPSEC_METADATA_CREATE(ipsec_obj_id,
378-
MLX5E_IPSEC_OFFLOAD_RX_SYNDROME_DECRYPTED);
379-
358+
*metadata = ipsec_obj_id;
380359
return 0;
381360
}

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#define MLX5_IPSEC_METADATA_MARKER(metadata) (((metadata) >> 31) & 0x1)
4444
#define MLX5_IPSEC_METADATA_SYNDROM(metadata) (((metadata) >> 24) & GENMASK(5, 0))
4545
#define MLX5_IPSEC_METADATA_HANDLE(metadata) ((metadata) & GENMASK(23, 0))
46-
#define MLX5_IPSEC_METADATA_CREATE(id, syndrome) ((id) | ((syndrome) << 24))
4746

4847
struct mlx5e_accel_tx_ipsec_state {
4948
struct xfrm_offload *xo;

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_stats.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ static const struct counter_desc mlx5e_ipsec_hw_stats_desc[] = {
5151
static const struct counter_desc mlx5e_ipsec_sw_stats_desc[] = {
5252
{ MLX5E_DECLARE_STAT(struct mlx5e_ipsec_sw_stats, ipsec_rx_drop_sp_alloc) },
5353
{ MLX5E_DECLARE_STAT(struct mlx5e_ipsec_sw_stats, ipsec_rx_drop_sadb_miss) },
54-
{ MLX5E_DECLARE_STAT(struct mlx5e_ipsec_sw_stats, ipsec_rx_drop_syndrome) },
5554
{ MLX5E_DECLARE_STAT(struct mlx5e_ipsec_sw_stats, ipsec_tx_drop_bundle) },
5655
{ MLX5E_DECLARE_STAT(struct mlx5e_ipsec_sw_stats, ipsec_tx_drop_no_state) },
5756
{ MLX5E_DECLARE_STAT(struct mlx5e_ipsec_sw_stats, ipsec_tx_drop_not_ip) },

drivers/net/ethernet/mellanox/mlx5/core/fw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,18 +366,18 @@ int mlx5_cmd_fast_teardown_hca(struct mlx5_core_dev *dev)
366366
return -EIO;
367367
}
368368

369-
mlx5_set_nic_state(dev, MLX5_NIC_IFC_DISABLED);
369+
mlx5_set_nic_state(dev, MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED);
370370

371371
/* Loop until device state turns to disable */
372372
end = jiffies + msecs_to_jiffies(delay_ms);
373373
do {
374-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
374+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
375375
break;
376376

377377
cond_resched();
378378
} while (!time_after(jiffies, end));
379379

380-
if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) {
380+
if (mlx5_get_nic_state(dev) != MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) {
381381
dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n",
382382
mlx5_get_nic_state(dev), delay_ms);
383383
return -EIO;

drivers/net/ethernet/mellanox/mlx5/core/health.c

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ u32 mlx5_health_check_fatal_sensors(struct mlx5_core_dev *dev)
116116
return MLX5_SENSOR_PCI_COMM_ERR;
117117
if (pci_channel_offline(dev->pdev))
118118
return MLX5_SENSOR_PCI_ERR;
119-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
119+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
120120
return MLX5_SENSOR_NIC_DISABLED;
121-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_SW_RESET)
121+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET)
122122
return MLX5_SENSOR_NIC_SW_RESET;
123123
if (sensor_fw_synd_rfr(dev))
124124
return MLX5_SENSOR_FW_SYND_RFR;
@@ -185,7 +185,7 @@ static bool reset_fw_if_needed(struct mlx5_core_dev *dev)
185185
/* Write the NIC interface field to initiate the reset, the command
186186
* interface address also resides here, don't overwrite it.
187187
*/
188-
mlx5_set_nic_state(dev, MLX5_NIC_IFC_SW_RESET);
188+
mlx5_set_nic_state(dev, MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET);
189189

190190
return true;
191191
}
@@ -246,13 +246,13 @@ void mlx5_error_sw_reset(struct mlx5_core_dev *dev)
246246
/* Recover from SW reset */
247247
end = jiffies + msecs_to_jiffies(delay_ms);
248248
do {
249-
if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED)
249+
if (mlx5_get_nic_state(dev) == MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED)
250250
break;
251251

252252
msleep(20);
253253
} while (!time_after(jiffies, end));
254254

255-
if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) {
255+
if (mlx5_get_nic_state(dev) != MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED) {
256256
dev_err(&dev->pdev->dev, "NIC IFC still %d after %lums.\n",
257257
mlx5_get_nic_state(dev), delay_ms);
258258
}
@@ -272,26 +272,26 @@ static void mlx5_handle_bad_state(struct mlx5_core_dev *dev)
272272
u8 nic_interface = mlx5_get_nic_state(dev);
273273

274274
switch (nic_interface) {
275-
case MLX5_NIC_IFC_FULL:
275+
case MLX5_INITIAL_SEG_NIC_INTERFACE_FULL_DRIVER:
276276
mlx5_core_warn(dev, "Expected to see disabled NIC but it is full driver\n");
277277
break;
278278

279-
case MLX5_NIC_IFC_DISABLED:
279+
case MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED:
280280
mlx5_core_warn(dev, "starting teardown\n");
281281
break;
282282

283-
case MLX5_NIC_IFC_NO_DRAM_NIC:
283+
case MLX5_INITIAL_SEG_NIC_INTERFACE_NO_DRAM_NIC:
284284
mlx5_core_warn(dev, "Expected to see disabled NIC but it is no dram nic\n");
285285
break;
286286

287-
case MLX5_NIC_IFC_SW_RESET:
287+
case MLX5_INITIAL_SEG_NIC_INTERFACE_SW_RESET:
288288
/* The IFC mode field is 3 bits, so it will read 0x7 in 2 cases:
289289
* 1. PCI has been disabled (ie. PCI-AER, PF driver unloaded
290290
* and this is a VF), this is not recoverable by SW reset.
291291
* Logging of this is handled elsewhere.
292292
* 2. FW reset has been issued by another function, driver can
293293
* be reloaded to recover after the mode switches to
294-
* MLX5_NIC_IFC_DISABLED.
294+
* MLX5_INITIAL_SEG_NIC_INTERFACE_DISABLED.
295295
*/
296296
if (dev->priv.health.fatal_error != MLX5_SENSOR_PCI_COMM_ERR)
297297
mlx5_core_warn(dev, "NIC SW reset in progress\n");
@@ -555,12 +555,17 @@ static void mlx5_fw_reporter_err_work(struct work_struct *work)
555555
&fw_reporter_ctx);
556556
}
557557

558-
static const struct devlink_health_reporter_ops mlx5_fw_reporter_ops = {
558+
static const struct devlink_health_reporter_ops mlx5_fw_reporter_pf_ops = {
559559
.name = "fw",
560560
.diagnose = mlx5_fw_reporter_diagnose,
561561
.dump = mlx5_fw_reporter_dump,
562562
};
563563

564+
static const struct devlink_health_reporter_ops mlx5_fw_reporter_ops = {
565+
.name = "fw",
566+
.diagnose = mlx5_fw_reporter_diagnose,
567+
};
568+
564569
static int
565570
mlx5_fw_fatal_reporter_recover(struct devlink_health_reporter *reporter,
566571
void *priv_ctx,
@@ -646,42 +651,52 @@ static void mlx5_fw_fatal_reporter_err_work(struct work_struct *work)
646651
}
647652
}
648653

649-
static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = {
654+
static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_pf_ops = {
650655
.name = "fw_fatal",
651656
.recover = mlx5_fw_fatal_reporter_recover,
652657
.dump = mlx5_fw_fatal_reporter_dump,
653658
};
654659

660+
static const struct devlink_health_reporter_ops mlx5_fw_fatal_reporter_ops = {
661+
.name = "fw_fatal",
662+
.recover = mlx5_fw_fatal_reporter_recover,
663+
};
664+
655665
#define MLX5_FW_REPORTER_ECPF_GRACEFUL_PERIOD 180000
656666
#define MLX5_FW_REPORTER_PF_GRACEFUL_PERIOD 60000
657667
#define MLX5_FW_REPORTER_VF_GRACEFUL_PERIOD 30000
658668
#define MLX5_FW_REPORTER_DEFAULT_GRACEFUL_PERIOD MLX5_FW_REPORTER_VF_GRACEFUL_PERIOD
659669

660670
void mlx5_fw_reporters_create(struct mlx5_core_dev *dev)
661671
{
672+
const struct devlink_health_reporter_ops *fw_fatal_ops;
662673
struct mlx5_core_health *health = &dev->priv.health;
674+
const struct devlink_health_reporter_ops *fw_ops;
663675
struct devlink *devlink = priv_to_devlink(dev);
664676
u64 grace_period;
665677

678+
fw_fatal_ops = &mlx5_fw_fatal_reporter_pf_ops;
679+
fw_ops = &mlx5_fw_reporter_pf_ops;
666680
if (mlx5_core_is_ecpf(dev)) {
667681
grace_period = MLX5_FW_REPORTER_ECPF_GRACEFUL_PERIOD;
668682
} else if (mlx5_core_is_pf(dev)) {
669683
grace_period = MLX5_FW_REPORTER_PF_GRACEFUL_PERIOD;
670684
} else {
671685
/* VF or SF */
672686
grace_period = MLX5_FW_REPORTER_DEFAULT_GRACEFUL_PERIOD;
687+
fw_fatal_ops = &mlx5_fw_fatal_reporter_ops;
688+
fw_ops = &mlx5_fw_reporter_ops;
673689
}
674690

675691
health->fw_reporter =
676-
devl_health_reporter_create(devlink, &mlx5_fw_reporter_ops,
677-
0, dev);
692+
devl_health_reporter_create(devlink, fw_ops, 0, dev);
678693
if (IS_ERR(health->fw_reporter))
679694
mlx5_core_warn(dev, "Failed to create fw reporter, err = %ld\n",
680695
PTR_ERR(health->fw_reporter));
681696

682697
health->fw_fatal_reporter =
683698
devl_health_reporter_create(devlink,
684-
&mlx5_fw_fatal_reporter_ops,
699+
fw_fatal_ops,
685700
grace_period,
686701
dev);
687702
if (IS_ERR(health->fw_fatal_reporter))

0 commit comments

Comments
 (0)