mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
scst, ib_srpt: Add support for kernel version v5.1
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8064 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -902,6 +902,11 @@ static inline struct ib_pd *ib_alloc_pd_backport(struct ib_device *device)
|
||||
})
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
|
||||
#define ib_sg_dma_len(dev, sg) sg_dma_len(sg)
|
||||
#define ib_sg_dma_address(dev, sg) sg_dma_address(sg)
|
||||
#endif
|
||||
|
||||
/* <linux/sched.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && \
|
||||
@@ -1245,10 +1250,12 @@ static inline void *vzalloc(unsigned long size)
|
||||
|
||||
/* <scsi/scsi_cmnd.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) || \
|
||||
LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0)
|
||||
/*
|
||||
* See also patch "[SCSI] bidirectional command support"
|
||||
* (commit ID 6f9a35e2dafa).
|
||||
* See also patch "[SCSI] bidirectional command support" (commit ID
|
||||
* 6f9a35e2dafa). See also commit ae3d56d81507 ("scsi: remove bidirectional
|
||||
* command support") # v5.1.
|
||||
*/
|
||||
static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
|
||||
{
|
||||
|
||||
@@ -8606,6 +8606,7 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
|
||||
}
|
||||
|
||||
if (cmd->data_direction == SCST_DATA_BIDI) {
|
||||
#ifdef QUEUE_FLAG_BIDI
|
||||
struct request *next_rq;
|
||||
|
||||
if (!test_bit(QUEUE_FLAG_BIDI, &q->queue_flags)) {
|
||||
@@ -8628,6 +8629,9 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
|
||||
goto out_free_unmap;
|
||||
}
|
||||
rq->next_rq = next_rq;
|
||||
#else
|
||||
return -EOPNOTSUPP;
|
||||
#endif
|
||||
} else {
|
||||
rq = blk_map_kern_sg(q, cmd->sg, cmd->sg_cnt, gfp, reading);
|
||||
if (IS_ERR(rq)) {
|
||||
@@ -8668,6 +8672,7 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
|
||||
out:
|
||||
return res;
|
||||
|
||||
#ifdef QUEUE_FLAG_BIDI
|
||||
out_free_unmap:
|
||||
{
|
||||
struct bio *bio = rq->bio, *b;
|
||||
@@ -8690,6 +8695,7 @@ out_free_unmap:
|
||||
rq->bio = NULL;
|
||||
|
||||
blk_put_request(rq);
|
||||
#endif
|
||||
|
||||
out_free_sioc:
|
||||
kmem_cache_free(scsi_io_context_cache, sioc);
|
||||
|
||||
@@ -1010,7 +1010,8 @@ static int scst_local_queuecommand_lck(struct scsi_cmnd *scmd,
|
||||
#endif
|
||||
|
||||
if (scsi_bidi_cmnd(scmd)) {
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24) && \
|
||||
LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
|
||||
/* Some of these symbols are only defined after 2.6.24 */
|
||||
dir = SCST_DATA_BIDI;
|
||||
scst_cmd_set_expected(scst_cmd, dir, scsi_bufflen(scmd));
|
||||
@@ -1177,7 +1178,7 @@ static int scst_local_slave_alloc(struct scsi_device *sdev)
|
||||
#if !defined(RHEL_MAJOR) || RHEL_MAJOR -0 >= 6
|
||||
queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdev->request_queue);
|
||||
#endif
|
||||
#else
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
|
||||
blk_queue_flag_set(QUEUE_FLAG_BIDI, sdev->request_queue);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3231,7 +3231,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
|
||||
struct srpt_send_ioctx *ioctx,
|
||||
struct scst_cmd *cmd)
|
||||
{
|
||||
struct ib_device *dev;
|
||||
struct ib_device *dev __maybe_unused;
|
||||
struct scatterlist *sg, *cur_sg;
|
||||
int sg_cnt;
|
||||
scst_data_direction dir;
|
||||
|
||||
Reference in New Issue
Block a user