Skip to content

Commit b2a0148

Browse files
author
Frantisek Hrbata
committed
Merge: megaraid_sas: driver update
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1498 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2120068 Tested: I've verified the set on a x86 server. Signed-off-by: Tomas Henzl <thenzl@redhat.com> Approved-by: Ewan D. Milne <emilne@redhat.com> Approved-by: John Meneghini <jmeneghi@redhat.com> Approved-by: Chris Leech <cleech@redhat.com> Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
2 parents 27a89b8 + b3a94ca commit b2a0148

File tree

5 files changed

+44
-58
lines changed

5 files changed

+44
-58
lines changed

drivers/scsi/megaraid/megaraid_mbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ MODULE_PARM_DESC(cmd_per_lun,
181181
* This would result in non-disk devices being skipped during driver load
182182
* time. These can be later added though, using /proc/scsi/scsi
183183
*/
184-
static unsigned int megaraid_fast_load = 0;
184+
static unsigned int megaraid_fast_load;
185185
module_param_named(fast_load, megaraid_fast_load, int, 0);
186186
MODULE_PARM_DESC(fast_load,
187187
"Faster loading of the driver, skips physical devices! (default=0)");

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
18351835

18361836
if (instance->unload == 1) {
18371837
scmd->result = DID_NO_CONNECT << 16;
1838-
scmd->scsi_done(scmd);
1838+
scsi_done(scmd);
18391839
return 0;
18401840
}
18411841

@@ -1850,7 +1850,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
18501850
return SCSI_MLQUEUE_HOST_BUSY;
18511851
} else {
18521852
scmd->result = DID_NO_CONNECT << 16;
1853-
scmd->scsi_done(scmd);
1853+
scsi_done(scmd);
18541854
return 0;
18551855
}
18561856
}
@@ -1859,15 +1859,15 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
18591859
if (!mr_device_priv_data ||
18601860
(atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR)) {
18611861
scmd->result = DID_NO_CONNECT << 16;
1862-
scmd->scsi_done(scmd);
1862+
scsi_done(scmd);
18631863
return 0;
18641864
}
18651865

18661866
if (MEGASAS_IS_LOGICAL(scmd->device)) {
18671867
ld_tgt_id = MEGASAS_TARGET_ID(scmd->device);
18681868
if (instance->ld_tgtid_status[ld_tgt_id] == LD_TARGET_ID_DELETED) {
18691869
scmd->result = DID_NO_CONNECT << 16;
1870-
scmd->scsi_done(scmd);
1870+
scsi_done(scmd);
18711871
return 0;
18721872
}
18731873
}
@@ -1898,7 +1898,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
18981898
return instance->instancet->build_and_issue_cmd(instance, scmd);
18991899

19001900
out_done:
1901-
scmd->scsi_done(scmd);
1901+
scsi_done(scmd);
19021902
return 0;
19031903
}
19041904

@@ -2831,7 +2831,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
28312831
reset_index, reset_cmd,
28322832
reset_cmd->scmd->cmnd[0]);
28332833

2834-
reset_cmd->scmd->scsi_done(reset_cmd->scmd);
2834+
scsi_done(reset_cmd->scmd);
28352835
megasas_return_cmd(instance, reset_cmd);
28362836
} else if (reset_cmd->sync_cmd) {
28372837
dev_notice(&instance->pdev->dev, "%p synch cmds"
@@ -3689,7 +3689,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
36893689
atomic_dec(&instance->fw_outstanding);
36903690

36913691
scsi_dma_unmap(cmd->scmd);
3692-
cmd->scmd->scsi_done(cmd->scmd);
3692+
scsi_done(cmd->scmd);
36933693
megasas_return_cmd(instance, cmd);
36943694

36953695
break;
@@ -3735,7 +3735,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
37353735
atomic_dec(&instance->fw_outstanding);
37363736

37373737
scsi_dma_unmap(cmd->scmd);
3738-
cmd->scmd->scsi_done(cmd->scmd);
3738+
scsi_done(cmd->scmd);
37393739
megasas_return_cmd(instance, cmd);
37403740

37413741
break;
@@ -3987,9 +3987,9 @@ process_fw_state_change_wq(struct work_struct *work)
39873987
u32 wait;
39883988
unsigned long flags;
39893989

3990-
if (atomic_read(&instance->adprecovery) != MEGASAS_ADPRESET_SM_INFAULT) {
3990+
if (atomic_read(&instance->adprecovery) != MEGASAS_ADPRESET_SM_INFAULT) {
39913991
dev_notice(&instance->pdev->dev, "error, recovery st %x\n",
3992-
atomic_read(&instance->adprecovery));
3992+
atomic_read(&instance->adprecovery));
39933993
return ;
39943994
}
39953995

@@ -4060,10 +4060,8 @@ megasas_deplete_reply_queue(struct megasas_instance *instance,
40604060
u32 mfiStatus;
40614061
u32 fw_state;
40624062

4063-
if ((mfiStatus = instance->instancet->check_reset(instance,
4064-
instance->reg_set)) == 1) {
4063+
if (instance->instancet->check_reset(instance, instance->reg_set) == 1)
40654064
return IRQ_HANDLED;
4066-
}
40674065

40684066
mfiStatus = instance->instancet->clear_intr(instance);
40694067
if (mfiStatus == 0) {
@@ -5194,9 +5192,9 @@ static void megasas_update_ext_vd_details(struct megasas_instance *instance)
51945192
fusion->current_map_sz = ventura_map_sz;
51955193
fusion->max_map_sz = ventura_map_sz;
51965194
} else {
5197-
fusion->old_map_sz = sizeof(struct MR_FW_RAID_MAP) +
5198-
(sizeof(struct MR_LD_SPAN_MAP) *
5199-
(instance->fw_supported_vd_count - 1));
5195+
fusion->old_map_sz =
5196+
struct_size((struct MR_FW_RAID_MAP *)0, ldSpanMap,
5197+
instance->fw_supported_vd_count);
52005198
fusion->new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT);
52015199

52025200
fusion->max_map_sz =
@@ -5829,10 +5827,10 @@ megasas_setup_jbod_map(struct megasas_instance *instance)
58295827
{
58305828
int i;
58315829
struct fusion_context *fusion = instance->ctrl_context;
5832-
u32 pd_seq_map_sz;
5830+
size_t pd_seq_map_sz;
58335831

5834-
pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
5835-
(sizeof(struct MR_PD_CFG_SEQ) * (MAX_PHYSICAL_DEVICES - 1));
5832+
pd_seq_map_sz = struct_size((struct MR_PD_CFG_SEQ_NUM_SYNC *)0, seq,
5833+
MAX_PHYSICAL_DEVICES);
58365834

58375835
instance->use_seqnum_jbod_fp =
58385836
instance->support_seqnum_jbod_fp;
@@ -5915,10 +5913,6 @@ static void megasas_setup_reply_map(struct megasas_instance *instance)
59155913
static
59165914
int megasas_get_device_list(struct megasas_instance *instance)
59175915
{
5918-
memset(instance->pd_list, 0,
5919-
(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
5920-
memset(instance->ld_ids, 0xff, MEGASAS_MAX_LD_IDS);
5921-
59225916
if (instance->enable_fw_dev_list) {
59235917
if (megasas_host_device_list_query(instance, true))
59245918
return FAILED;
@@ -7265,7 +7259,7 @@ int megasas_alloc_ctrl_dma_buffers(struct megasas_instance *instance)
72657259

72667260
if (!fusion->ioc_init_request) {
72677261
dev_err(&pdev->dev,
7268-
"Failed to allocate PD list buffer\n");
7262+
"Failed to allocate ioc init request\n");
72697263
return -ENOMEM;
72707264
}
72717265

@@ -7484,7 +7478,6 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance)
74847478
(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY))
74857479
instance->flag_ieee = 1;
74867480

7487-
megasas_dbg_lvl = 0;
74887481
instance->flag = 0;
74897482
instance->unload = 1;
74907483
instance->last_time = 0;
@@ -8019,7 +8012,7 @@ static void megasas_detach_one(struct pci_dev *pdev)
80198012
struct Scsi_Host *host;
80208013
struct megasas_instance *instance;
80218014
struct fusion_context *fusion;
8022-
u32 pd_seq_map_sz;
8015+
size_t pd_seq_map_sz;
80238016

80248017
instance = pci_get_drvdata(pdev);
80258018

@@ -8091,9 +8084,9 @@ static void megasas_detach_one(struct pci_dev *pdev)
80918084

80928085
if (instance->adapter_type != MFI_SERIES) {
80938086
megasas_release_fusion(instance);
8094-
pd_seq_map_sz = sizeof(struct MR_PD_CFG_SEQ_NUM_SYNC) +
8095-
(sizeof(struct MR_PD_CFG_SEQ) *
8096-
(MAX_PHYSICAL_DEVICES - 1));
8087+
pd_seq_map_sz =
8088+
struct_size((struct MR_PD_CFG_SEQ_NUM_SYNC *)0,
8089+
seq, MAX_PHYSICAL_DEVICES);
80978090
for (i = 0; i < 2 ; i++) {
80988091
if (fusion->ld_map[i])
80998092
dma_free_coherent(&instance->pdev->dev,
@@ -8815,33 +8808,26 @@ static
88158808
int megasas_update_device_list(struct megasas_instance *instance,
88168809
int event_type)
88178810
{
8818-
int dcmd_ret = DCMD_SUCCESS;
8811+
int dcmd_ret;
88198812

88208813
if (instance->enable_fw_dev_list) {
8821-
dcmd_ret = megasas_host_device_list_query(instance, false);
8822-
if (dcmd_ret != DCMD_SUCCESS)
8823-
goto out;
8814+
return megasas_host_device_list_query(instance, false);
88248815
} else {
88258816
if (event_type & SCAN_PD_CHANNEL) {
88268817
dcmd_ret = megasas_get_pd_list(instance);
8827-
88288818
if (dcmd_ret != DCMD_SUCCESS)
8829-
goto out;
8819+
return dcmd_ret;
88308820
}
88318821

88328822
if (event_type & SCAN_VD_CHANNEL) {
88338823
if (!instance->requestorId ||
88348824
megasas_get_ld_vf_affiliation(instance, 0)) {
8835-
dcmd_ret = megasas_ld_list_query(instance,
8825+
return megasas_ld_list_query(instance,
88368826
MR_LD_QUERY_TYPE_EXPOSED_TO_HOST);
8837-
if (dcmd_ret != DCMD_SUCCESS)
8838-
goto out;
88398827
}
88408828
}
88418829
}
8842-
8843-
out:
8844-
return dcmd_ret;
8830+
return DCMD_SUCCESS;
88458831
}
88468832

88478833
/**
@@ -8971,7 +8957,7 @@ megasas_aen_polling(struct work_struct *work)
89718957
sdev1 = scsi_device_lookup(instance->host,
89728958
MEGASAS_MAX_PD_CHANNELS +
89738959
(ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL),
8974-
(ld_target_id - MEGASAS_MAX_DEV_PER_CHANNEL),
8960+
(ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL),
89758961
0);
89768962
if (sdev1)
89778963
megasas_remove_scsi_device(sdev1);
@@ -9069,6 +9055,7 @@ static int __init megasas_init(void)
90699055
*/
90709056
pr_info("megasas: %s\n", MEGASAS_VERSION);
90719057

9058+
megasas_dbg_lvl = 0;
90729059
support_poll_for_event = 2;
90739060
support_device_change = 1;
90749061
support_nvme_encapsulation = true;

drivers/scsi/megaraid/megaraid_sas_fp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
326326
else if (instance->supportmax256vd)
327327
expected_size = sizeof(struct MR_FW_RAID_MAP_EXT);
328328
else
329-
expected_size =
330-
(sizeof(struct MR_FW_RAID_MAP) - sizeof(struct MR_LD_SPAN_MAP) +
331-
(sizeof(struct MR_LD_SPAN_MAP) * le16_to_cpu(pDrvRaidMap->ldCount)));
329+
expected_size = struct_size((struct MR_FW_RAID_MAP *)0,
330+
ldSpanMap,
331+
le16_to_cpu(pDrvRaidMap->ldCount));
332332

333333
if (le32_to_cpu(pDrvRaidMap->totalSize) != expected_size) {
334334
dev_dbg(&instance->pdev->dev, "megasas: map info structure size 0x%x",

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ megasas_sync_pd_seq_num(struct megasas_instance *instance, bool pend) {
13101310

13111311
pd_sync = (void *)fusion->pd_seq_sync[(instance->pd_seq_map_id & 1)];
13121312
pd_seq_h = fusion->pd_seq_phys[(instance->pd_seq_map_id & 1)];
1313-
pd_seq_map_sz = struct_size(pd_sync, seq, MAX_PHYSICAL_DEVICES - 1);
1313+
pd_seq_map_sz = struct_size(pd_sync, seq, MAX_PHYSICAL_DEVICES);
13141314

13151315
cmd = megasas_get_cmd(instance);
13161316
if (!cmd) {
@@ -3201,7 +3201,6 @@ megasas_build_io_fusion(struct megasas_instance *instance,
32013201
struct megasas_cmd_fusion *cmd)
32023202
{
32033203
int sge_count;
3204-
u8 cmd_type;
32053204
u16 pd_index = 0;
32063205
u8 drive_type = 0;
32073206
struct MPI2_RAID_SCSI_IO_REQUEST *io_request = cmd->io_request;
@@ -3227,7 +3226,7 @@ megasas_build_io_fusion(struct megasas_instance *instance,
32273226
*/
32283227
io_request->IoFlags = cpu_to_le16(scp->cmd_len);
32293228

3230-
switch (cmd_type = megasas_cmd_type(scp)) {
3229+
switch (megasas_cmd_type(scp)) {
32313230
case READ_WRITE_LDIO:
32323231
megasas_build_ldio_fusion(instance, scp, cmd);
32333232
break;
@@ -3493,7 +3492,7 @@ megasas_complete_r1_command(struct megasas_instance *instance,
34933492
megasas_return_cmd_fusion(instance, cmd);
34943493
scsi_dma_unmap(scmd_local);
34953494
megasas_sdev_busy_dec(instance, scmd_local);
3496-
scmd_local->scsi_done(scmd_local);
3495+
scsi_done(scmd_local);
34973496
}
34983497
}
34993498

@@ -3635,7 +3634,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex,
36353634
megasas_return_cmd_fusion(instance, cmd_fusion);
36363635
scsi_dma_unmap(scmd_local);
36373636
megasas_sdev_busy_dec(instance, scmd_local);
3638-
scmd_local->scsi_done(scmd_local);
3637+
scsi_done(scmd_local);
36393638
} else /* Optimal VD - R1 FP command completion. */
36403639
megasas_complete_r1_command(instance, cmd_fusion);
36413640
break;
@@ -5014,7 +5013,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
50145013
atomic_dec(&instance->ldio_outstanding);
50155014
megasas_return_cmd_fusion(instance, cmd_fusion);
50165015
scsi_dma_unmap(scmd_local);
5017-
scmd_local->scsi_done(scmd_local);
5016+
scsi_done(scmd_local);
50185017
}
50195018
}
50205019

drivers/scsi/megaraid/megaraid_sas_fusion.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ struct MR_FW_RAID_MAP {
942942
u8 reserved2[7];
943943
struct MR_ARRAY_INFO arMapInfo[MAX_RAIDMAP_ARRAYS];
944944
struct MR_DEV_HANDLE_INFO devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES];
945-
struct MR_LD_SPAN_MAP ldSpanMap[1];
945+
struct MR_LD_SPAN_MAP ldSpanMap[];
946946
};
947947

948948
struct IO_REQUEST_INFO {
@@ -1053,7 +1053,7 @@ struct MR_FW_RAID_MAP_DYNAMIC {
10531053
struct MR_RAID_MAP_DESC_TABLE
10541054
raid_map_desc_table[RAID_MAP_DESC_TYPE_COUNT];
10551055
/* Variable Size buffer containing all data */
1056-
u32 raid_map_desc_data[1];
1056+
u32 raid_map_desc_data[];
10571057
}; /* Dynamicaly sized RAID MAp structure */
10581058

10591059
#define IEEE_SGE_FLAGS_ADDR_MASK (0x03)
@@ -1148,7 +1148,7 @@ typedef struct LOG_BLOCK_SPAN_INFO {
11481148

11491149
struct MR_FW_RAID_MAP_ALL {
11501150
struct MR_FW_RAID_MAP raidMap;
1151-
struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES - 1];
1151+
struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES];
11521152
} __attribute__ ((packed));
11531153

11541154
struct MR_DRV_RAID_MAP {
@@ -1182,7 +1182,7 @@ struct MR_DRV_RAID_MAP {
11821182
devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES_DYN];
11831183
u16 ldTgtIdToLd[MAX_LOGICAL_DRIVES_DYN];
11841184
struct MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_DYN];
1185-
struct MR_LD_SPAN_MAP ldSpanMap[1];
1185+
struct MR_LD_SPAN_MAP ldSpanMap[];
11861186

11871187
};
11881188

@@ -1193,7 +1193,7 @@ struct MR_DRV_RAID_MAP {
11931193
struct MR_DRV_RAID_MAP_ALL {
11941194

11951195
struct MR_DRV_RAID_MAP raidMap;
1196-
struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_DYN - 1];
1196+
struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_DYN];
11971197
} __packed;
11981198

11991199

@@ -1249,7 +1249,7 @@ struct MR_PD_CFG_SEQ {
12491249
struct MR_PD_CFG_SEQ_NUM_SYNC {
12501250
__le32 size;
12511251
__le32 count;
1252-
struct MR_PD_CFG_SEQ seq[1];
1252+
struct MR_PD_CFG_SEQ seq[];
12531253
} __packed;
12541254

12551255
/* stream detection */

0 commit comments

Comments
 (0)