mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 03:31:26 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
ABT_DETAILS="x86_64"
|
||||
ABT_JOBS=5
|
||||
ABT_KERNELS=" \
|
||||
4.0.7 \
|
||||
4.1 \
|
||||
4.0.7-nc \
|
||||
3.19.7-nc \
|
||||
3.18.8-nc \
|
||||
3.17.8-nc \
|
||||
|
||||
@@ -150,7 +150,12 @@ static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28) && defined(__LINUX_CPUMASK_H)
|
||||
/*
|
||||
* See also patch "cpumask: introduce new API, without changing anything"
|
||||
* (commit ID 2d3854a37e8b).
|
||||
*/
|
||||
typedef cpumask_t cpumask_var_t[1];
|
||||
#define cpumask_bits(maskp) ((maskp)->bits)
|
||||
#ifdef CONFIG_CPUMASK_OFFSTACK
|
||||
/* Assuming NR_CPUS is huge, a runtime limit is more efficient. Also,
|
||||
|
||||
@@ -2433,13 +2433,11 @@ static u8 srpt_next_comp_vector(struct srpt_port *sport)
|
||||
u8 comp_vector;
|
||||
|
||||
mutex_lock(&sport->mutex);
|
||||
comp_vector = find_next_bit(sport->comp_v_mask, COMP_V_MASK_SIZE,
|
||||
sport->comp_vector);
|
||||
if (comp_vector >= COMP_V_MASK_SIZE)
|
||||
comp_vector = find_next_bit(sport->comp_v_mask,
|
||||
COMP_V_MASK_SIZE, 0);
|
||||
sBUG_ON(comp_vector >= COMP_V_MASK_SIZE);
|
||||
sport->comp_vector = comp_vector + 1;
|
||||
comp_vector = cpumask_next(sport->comp_vector, &sport->comp_v_mask);
|
||||
if (comp_vector >= nr_cpu_ids)
|
||||
comp_vector = cpumask_next(-1, &sport->comp_v_mask);
|
||||
sBUG_ON(comp_vector >= nr_cpu_ids);
|
||||
sport->comp_vector = comp_vector;
|
||||
mutex_unlock(&sport->mutex);
|
||||
|
||||
return comp_vector;
|
||||
@@ -3840,8 +3838,16 @@ static ssize_t show_comp_v_mask(struct kobject *kobj,
|
||||
|
||||
if (!sport)
|
||||
goto out;
|
||||
res = sprintf(buf, "%#lx\n%s", sport->comp_v_mask[0],
|
||||
SCST_SYSFS_KEY_MARK "\n");
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
|
||||
res = cpumask_scnprintf(buf, PAGE_SIZE, sport->comp_v_mask);
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
|
||||
res = cpumask_scnprintf(buf, PAGE_SIZE, &sport->comp_v_mask);
|
||||
#else
|
||||
res = scnprintf(buf, PAGE_SIZE, "%*pb",
|
||||
cpumask_pr_args(&sport->comp_v_mask));
|
||||
#endif
|
||||
res += scnprintf(&buf[res], PAGE_SIZE - res, "\n%s\n",
|
||||
SCST_SYSFS_KEY_MARK);
|
||||
|
||||
out:
|
||||
return res;
|
||||
@@ -3856,24 +3862,33 @@ static ssize_t store_comp_v_mask(struct kobject *kobj,
|
||||
struct srpt_port *sport = scst_tgt_get_tgt_priv(scst_tgt);
|
||||
struct srpt_device *sdev;
|
||||
int res = -E_TGT_PRIV_NOT_YET_SET;
|
||||
unsigned long mask;
|
||||
cpumask_var_t mask;
|
||||
unsigned int i1, i2;
|
||||
|
||||
if (!sport)
|
||||
goto out;
|
||||
sdev = sport->sdev;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
|
||||
res = kstrtoul(buf, 16, &mask);
|
||||
res = -ENOMEM;
|
||||
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
|
||||
goto out;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
|
||||
res = bitmap_parse(buf, count, cpumask_bits(mask), nr_cpumask_bits);
|
||||
#else
|
||||
res = strict_strtoul(buf, 16, &mask);
|
||||
res = cpumask_parse(buf, mask);
|
||||
#endif
|
||||
if (res)
|
||||
goto out;
|
||||
goto free_mask;
|
||||
res = -EINVAL;
|
||||
if (mask == 0 || mask >= (1ULL << sdev->device->num_comp_vectors))
|
||||
goto out;
|
||||
sport->comp_v_mask[0] = mask;
|
||||
i1 = cpumask_next(-1, mask);
|
||||
i2 = cpumask_next(sdev->device->num_comp_vectors - 1, mask);
|
||||
if (i1 >= nr_cpu_ids ||
|
||||
(i2 >= sdev->device->num_comp_vectors && i2 < nr_cpu_ids))
|
||||
goto free_mask;
|
||||
cpumask_copy(&sport->comp_v_mask, mask);
|
||||
res = count;
|
||||
|
||||
free_mask:
|
||||
free_cpumask_var(mask);
|
||||
out:
|
||||
return res;
|
||||
}
|
||||
@@ -4190,11 +4205,9 @@ static void srpt_add_one(struct ib_device *device)
|
||||
INIT_LIST_HEAD(&sport->nexus_list);
|
||||
init_waitqueue_head(&sport->ch_releaseQ);
|
||||
mutex_init(&sport->mutex);
|
||||
for (j = 0; j < sdev->device->num_comp_vectors; j++) {
|
||||
if (WARN_ON_ONCE(j >= COMP_V_MASK_SIZE))
|
||||
break;
|
||||
__set_bit(j, sport->comp_v_mask);
|
||||
}
|
||||
sport->comp_vector = -1;
|
||||
for (j = 0; j < sdev->device->num_comp_vectors; j++)
|
||||
cpumask_set_cpu(j, &sport->comp_v_mask);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) && !defined(BACKPORT_LINUX_WORKQUEUE_TO_2_6_19)
|
||||
/*
|
||||
* A vanilla 2.6.19 or older kernel without backported OFED
|
||||
|
||||
@@ -138,8 +138,6 @@ enum {
|
||||
DEFAULT_MAX_RDMA_SIZE = 65536,
|
||||
|
||||
RDMA_COMPL_TIMEOUT_S = 80,
|
||||
|
||||
COMP_V_MASK_SIZE = 64,
|
||||
};
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) && \
|
||||
@@ -434,7 +432,7 @@ struct srpt_port {
|
||||
struct mutex mutex;
|
||||
struct list_head nexus_list;
|
||||
struct scst_tgt *scst_tgt;
|
||||
DECLARE_BITMAP(comp_v_mask, COMP_V_MASK_SIZE);
|
||||
cpumask_t comp_v_mask;
|
||||
u8 comp_vector;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user