Skip to content

Commit d6c8e8b

Browse files
cp890582martinkpetersen
authored andcommitted
scsi: mpi3mr: Fix device loss during enclosure reboot due to zero link speed
During enclosure reboot or expander reset, firmware may report a link speed of 0 in "Device Add" events while the link is still coming up. The driver drops such devices, leaving them missing even after the link recovers. Fix this by treating link speed 0 as 1.5 Gbps during device addition so the device is exposed to the OS. The actual link speed will be updated later when link-up events arrive. Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com> Link: https://lore.kernel.org/r/20250820084138.228471-2-chandrakanth.patil@broadcom.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 8f5ae30 commit d6c8e8b

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,8 +2049,8 @@ static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc,
20492049
if (!fwevt->process_evt)
20502050
goto evt_ack;
20512051

2052-
dprint_event_bh(mrioc, "processing event(0x%02x) in the bottom half handler\n",
2053-
fwevt->event_id);
2052+
dprint_event_bh(mrioc, "processing event(0x%02x) -(0x%08x) in the bottom half handler\n",
2053+
fwevt->event_id, fwevt->evt_ctx);
20542054

20552055
switch (fwevt->event_id) {
20562056
case MPI3_EVENT_DEVICE_ADDED:
@@ -3076,8 +3076,8 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
30763076
}
30773077
if (process_evt_bh || ack_req) {
30783078
dprint_event_th(mrioc,
3079-
"scheduling bottom half handler for event(0x%02x),ack_required=%d\n",
3080-
evt_type, ack_req);
3079+
"scheduling bottom half handler for event(0x%02x) - (0x%08x), ack_required=%d\n",
3080+
evt_type, le32_to_cpu(event_reply->event_context), ack_req);
30813081
sz = event_reply->event_data_length * 4;
30823082
fwevt = mpi3mr_alloc_fwevt(sz);
30833083
if (!fwevt) {

drivers/scsi/mpi3mr/mpi3mr_transport.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,11 @@ static void mpi3mr_remove_device_by_sas_address(struct mpi3mr_ioc *mrioc,
413413
sas_address, hba_port);
414414
if (tgtdev) {
415415
if (!list_empty(&tgtdev->list)) {
416-
list_del_init(&tgtdev->list);
417416
was_on_tgtdev_list = 1;
418-
mpi3mr_tgtdev_put(tgtdev);
417+
if (tgtdev->state == MPI3MR_DEV_REMOVE_HS_STARTED) {
418+
list_del_init(&tgtdev->list);
419+
mpi3mr_tgtdev_put(tgtdev);
420+
}
419421
}
420422
}
421423
spin_unlock_irqrestore(&mrioc->tgtdev_lock, flags);
@@ -2079,6 +2081,8 @@ int mpi3mr_expander_add(struct mpi3mr_ioc *mrioc, u16 handle)
20792081
link_rate = (expander_pg1.negotiated_link_rate &
20802082
MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK) >>
20812083
MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT;
2084+
if (link_rate < MPI3_SAS_NEG_LINK_RATE_1_5)
2085+
link_rate = MPI3_SAS_NEG_LINK_RATE_1_5;
20822086
mpi3mr_update_links(mrioc, sas_address_parent,
20832087
handle, i, link_rate, hba_port);
20842088
}
@@ -2388,6 +2392,9 @@ int mpi3mr_report_tgtdev_to_sas_transport(struct mpi3mr_ioc *mrioc,
23882392

23892393
link_rate = mpi3mr_get_sas_negotiated_logical_linkrate(mrioc, tgtdev);
23902394

2395+
if (link_rate < MPI3_SAS_NEG_LINK_RATE_1_5)
2396+
link_rate = MPI3_SAS_NEG_LINK_RATE_1_5;
2397+
23912398
mpi3mr_update_links(mrioc, sas_address_parent, tgtdev->dev_handle,
23922399
parent_phy_number, link_rate, hba_port);
23932400

0 commit comments

Comments
 (0)