mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 02:31:27 +00:00
qla2x00t-32gbit: Backport to older kernel versions
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9307 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -21,8 +21,12 @@ qla_dfs_rport_get(struct fc_port *fp, int attr_id, u64 *val)
|
||||
/* Only supported for FC-NVMe devices that are registered. */
|
||||
if (!(fp->nvme_flag & NVME_FLAG_REGISTERED))
|
||||
return -EIO;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
|
||||
*val = fp->nvme_remote_port->dev_loss_tmo;
|
||||
break;
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -37,7 +41,7 @@ qla_dfs_rport_set(struct fc_port *fp, int attr_id, u64 val)
|
||||
/* Only supported for FC-NVMe devices that are registered. */
|
||||
if (!(fp->nvme_flag & NVME_FLAG_REGISTERED))
|
||||
return -EIO;
|
||||
#if (IS_ENABLED(CONFIG_NVME_FC))
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) && IS_ENABLED(CONFIG_NVME_FC)
|
||||
return nvme_fc_set_remoteport_devloss(fp->nvme_remote_port,
|
||||
val);
|
||||
#else /* CONFIG_NVME_FC */
|
||||
|
||||
@@ -2136,7 +2136,9 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
|
||||
|
||||
if (abort_cmd->qpair) {
|
||||
mcmd->qpair = abort_cmd->qpair;
|
||||
#if HAVE_SE_CMD_CPUID
|
||||
mcmd->se_cmd.cpuid = abort_cmd->se_cmd.cpuid;
|
||||
#endif
|
||||
mcmd->abort_io_attr = abort_cmd->atio.u.isp24.attr;
|
||||
mcmd->flags = QLA24XX_MGMT_ABORT_IO_ATTR_VALID;
|
||||
}
|
||||
|
||||
@@ -381,6 +381,40 @@ static inline bool cpumask_equal(const cpumask_t *src1p,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/debugfs.h> */
|
||||
|
||||
/*
|
||||
* See also commit c64688081490 ("debugfs: add support for self-protecting
|
||||
* attribute file fops") # v4.7.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
|
||||
#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
|
||||
static int __fops ## _open(struct inode *inode, struct file *file) \
|
||||
{ \
|
||||
__simple_attr_check_format(__fmt, 0ull); \
|
||||
return simple_attr_open(inode, file, __get, __set, __fmt); \
|
||||
} \
|
||||
static const struct file_operations __fops = { \
|
||||
.owner = THIS_MODULE, \
|
||||
.open = __fops ## _open, \
|
||||
.release = simple_attr_release, \
|
||||
.read = debugfs_attr_read, \
|
||||
.write = debugfs_attr_write, \
|
||||
.llseek = no_llseek, \
|
||||
}
|
||||
|
||||
static inline ssize_t debugfs_attr_read(struct file *file, char __user *buf,
|
||||
size_t len, loff_t *ppos)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
static inline ssize_t debugfs_attr_write(struct file *file,
|
||||
const char __user *buf, size_t len, loff_t *ppos)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/device.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)
|
||||
@@ -1683,6 +1717,28 @@ static inline void sg_unmark_end(struct scatterlist *sg)
|
||||
#define MIN_NICE -20
|
||||
#endif
|
||||
|
||||
/* <linux/seq_file.h> */
|
||||
|
||||
/*
|
||||
* See also commit a08f06bb7a07 ("seq_file: Introduce DEFINE_SHOW_ATTRIBUTE()
|
||||
* helper macro") # v4.16.
|
||||
*/
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
|
||||
#define DEFINE_SHOW_ATTRIBUTE(__name) \
|
||||
static int __name ## _open(struct inode *inode, struct file *file) \
|
||||
{ \
|
||||
return single_open(file, __name ## _show, inode->i_private); \
|
||||
} \
|
||||
\
|
||||
static const struct file_operations __name ## _fops = { \
|
||||
.owner = THIS_MODULE, \
|
||||
.open = __name ## _open, \
|
||||
.read = seq_read, \
|
||||
.llseek = seq_lseek, \
|
||||
.release = single_release, \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <linux/slab.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22)
|
||||
|
||||
Reference in New Issue
Block a user