mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 21:26:31 +00:00
qla2x00t-32gbit, target: Backport to kernel v3.11 and before
Note: this code has not yet been tested. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8115 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -445,7 +445,7 @@ static void sqa_qla2xxx_rel_cmd(struct qla_tgt_cmd *cmd)
|
||||
sbitmap_queue_clear(&sqa_tgt->tgt_tag_pool, cmd->se_cmd.map_tag,
|
||||
cmd->se_cmd.map_cpu);
|
||||
#else
|
||||
#error Neither percpu_ida nor sbitmap are available.
|
||||
clear_bit(cmd->map_tag, sqa_tgt->tgt_tag_pool);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -463,7 +463,16 @@ static struct qla_tgt_cmd *sqa_qla2xxx_get_cmd(struct fc_port *sess)
|
||||
|
||||
tag = sbitmap_queue_get(&sqa_tgt->tgt_tag_pool, &cpu);
|
||||
#else
|
||||
#error Neither percpu_ida nor sbitmap are available.
|
||||
for (;;) {
|
||||
tag = find_first_zero_bit(sqa_tgt->tgt_tag_pool,
|
||||
sqa_tgt->tag_num);
|
||||
if (test_and_set_bit(tag, sqa_tgt->tgt_tag_pool) == 0)
|
||||
break;
|
||||
if (tag >= sqa_tgt->tag_num) {
|
||||
tag = -ENOENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (tag < 0)
|
||||
return NULL;
|
||||
@@ -1464,10 +1473,13 @@ static int sqa_init_scst_tgt(struct scsi_qla_host *vha)
|
||||
res = sbitmap_queue_init_node(&sqa_tgt->tgt_tag_pool, tag_num, -1,
|
||||
false, GFP_KERNEL, NUMA_NO_NODE);
|
||||
#else
|
||||
#error Neither percpu_ida nor sbitmap are available.
|
||||
sqa_tgt->tag_num = tag_num;
|
||||
sqa_tgt->tgt_tag_pool = kzalloc(BITS_TO_LONGS(tag_num), GFP_KERNEL);
|
||||
res = IS_ERR(sqa_tgt->tgt_tag_pool) ? PTR_ERR(sqa_tgt->tgt_tag_pool) :
|
||||
0;
|
||||
#endif
|
||||
if (res < 0) {
|
||||
pr_err("Unable to init se_sess->sess_tag_pool,"
|
||||
pr_err("Unable to init se_sess->tgt_tag_pool,"
|
||||
" tag_num: %u\n", tag_num);
|
||||
kvfree(sqa_tgt->tgt_cmd_map);
|
||||
kfree(pwwn);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
!(defined(RHEL_MAJOR) && RHEL_MAJOR -0 >= 7)
|
||||
#define QLT_USE_PERCPU_IDA 0
|
||||
#define QLT_USE_SBITMAP 0
|
||||
#include <linux/bitmap.h>
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
|
||||
#define QLT_USE_PERCPU_IDA 1
|
||||
#define QLT_USE_SBITMAP 0
|
||||
@@ -30,6 +31,7 @@ struct sqa_scst_tgt{
|
||||
#elif QLT_USE_SBITMAP
|
||||
struct sbitmap_queue tgt_tag_pool;
|
||||
#else
|
||||
#error Neither percpu_ida nor sbitmap are available.
|
||||
unsigned long *tgt_tag_pool;
|
||||
unsigned int tag_num;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -899,6 +899,13 @@ struct qla_tgt_cmd {
|
||||
uint8_t cmd_type;
|
||||
uint8_t pad[7];
|
||||
struct se_cmd se_cmd;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
|
||||
/*
|
||||
* Used if neither <linux/bitmap.h> nor <linux/percpu_ida.h> are
|
||||
* available.
|
||||
*/
|
||||
unsigned int map_tag;
|
||||
#endif
|
||||
#if !HAVE_SE_CMD_TAG
|
||||
u64 tag;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user