mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-20 15:04:19 +00:00
qla2x00t: Port to Linux kernel v5.16
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9600 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2461,7 +2461,7 @@ static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_show, NULL);
|
||||
static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL);
|
||||
static DEVICE_ATTR_RO(edif_doorbell);
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
struct device_attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version,
|
||||
&dev_attr_fw_version,
|
||||
@@ -2527,6 +2527,79 @@ void qla_insert_tgt_attrs(void)
|
||||
attr++;
|
||||
*attr = &dev_attr_ql2xexchoffld;
|
||||
}
|
||||
#else
|
||||
static struct attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version.attr,
|
||||
&dev_attr_fw_version.attr,
|
||||
&dev_attr_serial_num.attr,
|
||||
&dev_attr_isp_name.attr,
|
||||
&dev_attr_isp_id.attr,
|
||||
&dev_attr_model_name.attr,
|
||||
&dev_attr_model_desc.attr,
|
||||
&dev_attr_pci_info.attr,
|
||||
&dev_attr_link_state.attr,
|
||||
&dev_attr_zio.attr,
|
||||
&dev_attr_zio_timer.attr,
|
||||
&dev_attr_beacon.attr,
|
||||
&dev_attr_beacon_config.attr,
|
||||
&dev_attr_optrom_bios_version.attr,
|
||||
&dev_attr_optrom_efi_version.attr,
|
||||
&dev_attr_optrom_fcode_version.attr,
|
||||
&dev_attr_optrom_fw_version.attr,
|
||||
&dev_attr_84xx_fw_version.attr,
|
||||
&dev_attr_total_isp_aborts.attr,
|
||||
&dev_attr_serdes_version.attr,
|
||||
&dev_attr_mpi_version.attr,
|
||||
&dev_attr_phy_version.attr,
|
||||
&dev_attr_flash_block_size.attr,
|
||||
&dev_attr_vlan_id.attr,
|
||||
&dev_attr_vn_port_mac_address.attr,
|
||||
&dev_attr_fabric_param.attr,
|
||||
&dev_attr_fw_state.attr,
|
||||
&dev_attr_optrom_gold_fw_version.attr,
|
||||
&dev_attr_thermal_temp.attr,
|
||||
&dev_attr_diag_requests.attr,
|
||||
&dev_attr_diag_megabytes.attr,
|
||||
&dev_attr_fw_dump_size.attr,
|
||||
&dev_attr_allow_cna_fw_dump.attr,
|
||||
&dev_attr_pep_version.attr,
|
||||
&dev_attr_min_supported_speed.attr,
|
||||
&dev_attr_max_supported_speed.attr,
|
||||
&dev_attr_zio_threshold.attr,
|
||||
&dev_attr_dif_bundle_statistics.attr,
|
||||
&dev_attr_port_speed.attr,
|
||||
&dev_attr_port_no.attr,
|
||||
&dev_attr_fw_attr.attr,
|
||||
&dev_attr_dport_diagnostics.attr,
|
||||
&dev_attr_edif_doorbell.attr,
|
||||
&dev_attr_mpi_pause.attr,
|
||||
&dev_attr_qlini_mode.attr,
|
||||
&dev_attr_ql2xiniexchg.attr,
|
||||
&dev_attr_ql2xexchoffld.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static umode_t qla_host_attr_is_visible(struct kobject *kobj,
|
||||
struct attribute *attr, int i)
|
||||
{
|
||||
if (ql2x_ini_mode != QLA2XXX_INI_MODE_DUAL &&
|
||||
(attr == &dev_attr_qlini_mode.attr ||
|
||||
attr == &dev_attr_ql2xiniexchg.attr ||
|
||||
attr == &dev_attr_ql2xexchoffld.attr))
|
||||
return 0;
|
||||
return attr->mode;
|
||||
}
|
||||
|
||||
static const struct attribute_group qla2x00_host_attr_group = {
|
||||
.is_visible = qla_host_attr_is_visible,
|
||||
.attrs = qla2x00_host_attrs
|
||||
};
|
||||
|
||||
const struct attribute_group *qla2x00_host_groups[] = {
|
||||
&qla2x00_host_attr_group,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Host attributes. */
|
||||
|
||||
|
||||
@@ -742,7 +742,11 @@ uint qla25xx_fdmi_port_speed_currently(struct qla_hw_data *);
|
||||
* Global Function Prototypes in qla_attr.c source file.
|
||||
*/
|
||||
struct device_attribute;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
extern struct device_attribute *qla2x00_host_attrs[];
|
||||
#else
|
||||
extern const struct attribute_group *qla2x00_host_groups[];
|
||||
#endif
|
||||
extern struct device_attribute *qla2x00_host_attrs_dm[];
|
||||
struct fc_function_template;
|
||||
extern struct fc_function_template qla2xxx_transport_functions;
|
||||
@@ -757,7 +761,9 @@ extern int qla2x00_echo_test(scsi_qla_host_t *,
|
||||
extern int qla24xx_update_all_fcp_prio(scsi_qla_host_t *);
|
||||
extern int qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *,
|
||||
struct qla_fcp_prio_cfg *, uint8_t);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
void qla_insert_tgt_attrs(void);
|
||||
#endif
|
||||
/*
|
||||
* Global Function Prototypes in qla_dfs.c source file.
|
||||
*/
|
||||
|
||||
@@ -757,7 +757,7 @@ void qla2x00_sp_compl(srb_t *sp, int res)
|
||||
sp->free(sp);
|
||||
cmd->result = res;
|
||||
CMD_SP(cmd) = NULL;
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
if (comp)
|
||||
complete(comp);
|
||||
}
|
||||
@@ -848,7 +848,7 @@ void qla2xxx_qpair_sp_compl(srb_t *sp, int res)
|
||||
sp->free(sp);
|
||||
cmd->result = res;
|
||||
CMD_SP(cmd) = NULL;
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
if (comp)
|
||||
complete(comp);
|
||||
}
|
||||
@@ -987,7 +987,7 @@ qc24_target_busy:
|
||||
return SCSI_MLQUEUE_TARGET_BUSY;
|
||||
|
||||
qc24_fail_command:
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ qc24_target_busy:
|
||||
return SCSI_MLQUEUE_TARGET_BUSY;
|
||||
|
||||
qc24_fail_command:
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -8039,7 +8039,11 @@ struct scsi_host_template qla2xxx_driver_template = {
|
||||
.sg_tablesize = SG_ALL,
|
||||
|
||||
.max_sectors = 0xFFFF,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
.shost_attrs = qla2x00_host_attrs,
|
||||
#else
|
||||
.shost_groups = qla2x00_host_groups,
|
||||
#endif
|
||||
|
||||
.supported_mode = MODE_INITIATOR,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
|
||||
@@ -8252,8 +8256,10 @@ qla2x00_module_init(void)
|
||||
if (ql2xextended_error_logging == 1)
|
||||
ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
if (ql2x_ini_mode == QLA2XXX_INI_MODE_DUAL)
|
||||
qla_insert_tgt_attrs();
|
||||
#endif
|
||||
|
||||
qla2xxx_transport_template =
|
||||
fc_attach_transport(&qla2xxx_transport_functions);
|
||||
|
||||
@@ -1803,6 +1803,7 @@ static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL);
|
||||
static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL);
|
||||
static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
struct device_attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version,
|
||||
&dev_attr_fw_version,
|
||||
@@ -1839,6 +1840,53 @@ struct device_attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_thermal_temp,
|
||||
NULL,
|
||||
};
|
||||
#else
|
||||
static struct attribute *qla2x00_host_attrs[] = {
|
||||
&dev_attr_driver_version.attr,
|
||||
&dev_attr_fw_version.attr,
|
||||
&dev_attr_serial_num.attr,
|
||||
&dev_attr_isp_name.attr,
|
||||
&dev_attr_isp_id.attr,
|
||||
&dev_attr_model_name.attr,
|
||||
&dev_attr_model_desc.attr,
|
||||
&dev_attr_pci_info.attr,
|
||||
&dev_attr_link_state.attr,
|
||||
&dev_attr_zio.attr,
|
||||
&dev_attr_zio_timer.attr,
|
||||
&dev_attr_beacon.attr,
|
||||
&dev_attr_optrom_bios_version.attr,
|
||||
&dev_attr_optrom_efi_version.attr,
|
||||
&dev_attr_optrom_fcode_version.attr,
|
||||
&dev_attr_optrom_fw_version.attr,
|
||||
&dev_attr_84xx_fw_version.attr,
|
||||
&dev_attr_class2_enabled.attr,
|
||||
#ifdef CONFIG_SCSI_QLA2XXX_TARGET
|
||||
&dev_attr_ini_mode_force_reverse.attr,
|
||||
&dev_attr_resource_counts.attr,
|
||||
&dev_attr_port_database.attr,
|
||||
#endif
|
||||
&dev_attr_total_isp_aborts.attr,
|
||||
&dev_attr_mpi_version.attr,
|
||||
&dev_attr_phy_version.attr,
|
||||
&dev_attr_flash_block_size.attr,
|
||||
&dev_attr_vlan_id.attr,
|
||||
&dev_attr_vn_port_mac_address.attr,
|
||||
&dev_attr_fabric_param.attr,
|
||||
&dev_attr_fw_state.attr,
|
||||
&dev_attr_optrom_gold_fw_version.attr,
|
||||
&dev_attr_thermal_temp.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group qla2x00_host_attr_group = {
|
||||
.attrs = qla2x00_host_attrs
|
||||
};
|
||||
|
||||
const struct attribute_group *qla2x00_host_groups[] = {
|
||||
&qla2x00_host_attr_group,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Host attributes. */
|
||||
|
||||
|
||||
@@ -496,7 +496,11 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *);
|
||||
* Global Function Prototypes in qla_attr.c source file.
|
||||
*/
|
||||
struct device_attribute;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
extern struct device_attribute *qla2x00_host_attrs[];
|
||||
#else
|
||||
extern const struct attribute_group *qla2x00_host_groups[];
|
||||
#endif
|
||||
struct fc_function_template;
|
||||
extern struct fc_function_template qla2xxx_transport_functions;
|
||||
extern struct fc_function_template qla2xxx_transport_vport_functions;
|
||||
|
||||
+16
-2
@@ -249,8 +249,12 @@ static int qla2xxx_slave_alloc(struct scsi_device *);
|
||||
static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time);
|
||||
static void qla2xxx_scan_start(struct Scsi_Host *);
|
||||
static void qla2xxx_slave_destroy(struct scsi_device *);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd,
|
||||
void (*fn)(struct scsi_cmnd *));
|
||||
#else
|
||||
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd);
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
||||
static DEF_SCSI_QCMD(qla2xxx_queuecommand);
|
||||
#endif
|
||||
@@ -306,7 +310,11 @@ struct scsi_host_template qla2xxx_driver_template = {
|
||||
.sg_tablesize = SG_ALL,
|
||||
|
||||
.max_sectors = 0xFFFF,
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
.shost_attrs = qla2x00_host_attrs,
|
||||
#else
|
||||
.shost_groups = qla2x00_host_groups,
|
||||
#endif
|
||||
#ifdef CONFIG_SCSI_QLA2XXX_TARGET
|
||||
.supported_mode = MODE_INITIATOR | MODE_TARGET,
|
||||
#endif /* CONFIG_SCSI_QLA2XXX_TARGET */
|
||||
@@ -674,11 +682,15 @@ qla2x00_sp_compl(void *data, void *ptr, int res)
|
||||
return;
|
||||
|
||||
qla2x00_sp_free_dma(ha, sp);
|
||||
cmd->scsi_done(cmd);
|
||||
scsi_done(cmd);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
static int
|
||||
qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
|
||||
#else
|
||||
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd)
|
||||
#endif
|
||||
{
|
||||
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
|
||||
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
|
||||
@@ -757,7 +769,9 @@ qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)
|
||||
sp->type = SRB_SCSI_CMD;
|
||||
atomic_set(&sp->ref_count, 1);
|
||||
CMD_SP(cmd) = (void *)sp;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
|
||||
cmd->scsi_done = done;
|
||||
#endif
|
||||
sp->free = qla2x00_sp_free_dma;
|
||||
sp->done = qla2x00_sp_compl;
|
||||
|
||||
@@ -785,7 +799,7 @@ qc24_target_busy:
|
||||
|
||||
qc24_fail_command:
|
||||
spin_lock_irq(vha->host->host_lock);
|
||||
done(cmd);
|
||||
scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user