Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2019-03-31 09:35:21 -07:00
10 changed files with 75 additions and 41 deletions

View File

@@ -15,7 +15,7 @@ fi
mkdir -p qla2xxx-orig
cd qla2xxx-orig || exit $?
extract_kernel_tree "${kernel_version}"
download_and_extract_kernel_tree "${kernel_version}"
touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/*
rm -rf "${kernel_version}"
mkdir -p "${kernel_version}"

View File

@@ -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;
@@ -933,13 +942,6 @@ static struct se_session *sqa_alloc_sesess(scsi_qla_host_t *vha)
static void sqa_free_sesess(struct se_session *se_sess)
{
#if QLT_USE_PERCPU_IDA
percpu_ida_destroy(&se_sess->sess_tag_pool);
#elif QLT_USE_SBITMAP
sbitmap_queue_free(&se_sess->sess_tag_pool);
#else
#error Neither percpu_ida nor sbitmap are available.
#endif
kfree(se_sess);
}
@@ -1471,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);

View File

@@ -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
};

View File

@@ -7,8 +7,8 @@
#ifndef __QLA_NVME_H
#define __QLA_NVME_H
#include <uapi/scsi/fc/fc_fs.h>
#include <uapi/scsi/fc/fc_els.h>
#include <scsi/fc/fc_fs.h>
#include <scsi/fc/fc_els.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
#include <linux/nvme-fc-driver.h>
#endif

View File

@@ -28,6 +28,13 @@
#include "qla_target.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) || \
defined(RHEL_MAJOR) && RHEL_MAJOR -0 >= 7
#define HAVE_SCSI_MQ 1
#else
#define HAVE_SCSI_MQ 0
#endif
/*
* Driver version
*/
@@ -936,7 +943,7 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
goto qc24_fail_command;
}
#ifdef BLK_MQ_H
#if HAVE_SCSI_MQ
if (ha->mqenable) {
uint32_t tag;
uint16_t hwq;
@@ -3252,7 +3259,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
goto probe_failed;
}
#ifdef BLK_MQ_H
#if HAVE_SCSI_MQ
if (ha->mqenable) {
/* number of hardware queues supported by blk/scsi-mq*/
host->nr_hw_queues = ha->max_qpairs;

View File

@@ -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

View File

@@ -15,7 +15,7 @@ fi
mkdir -p qla2xxx-orig
cd qla2xxx-orig || exit $?
extract_kernel_tree "${kernel_version}"
download_and_extract_kernel_tree "${kernel_version}"
touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/*
rm -rf "${kernel_version}"
mkdir -p "${kernel_version}"

View File

@@ -42,9 +42,7 @@ target="linux-$1"
kernel_version="$(kernel_version "$1")"
patchlevel="$(patchlevel "$1")"
download_kernel "$1" || exit $?
extract_kernel_tree "$1" || exit $?
download_and_extract_kernel_tree "$1" || exit $?
cd "${target}" || exit $?

View File

@@ -3,7 +3,8 @@
# from kernel.org.
kernel_mirror="http://cdn.kernel.org/pub/linux/kernel"
kernel_sources="$HOME/software/downloads"
kernel_downloads="$HOME/software/downloads"
kernel_tree="$HOME/software/linux-kernel"
# Whether or not kernel version $1 is lower than or equal kernel version $2.
function kernel_version_le {
@@ -42,7 +43,7 @@ function download_file {
}
# Make sure the kernel tarball and patch file are present in directory
# ${kernel_sources}. Download any missing files from ${kernel_mirror}.
# ${kernel_downloads}. Download any missing files from ${kernel_mirror}.
function download_kernel {
local kver="$(kernel_version $1)"
local plevel="$(patchlevel $1)"
@@ -52,10 +53,10 @@ function download_kernel {
[12].*) series="${series:0:3}";;
*) series="${series/.*/}.x";;
esac
mkdir -p "${kernel_sources}" || return $?
test -w "${kernel_sources}" || return $?
mkdir -p "${kernel_downloads}" || return $?
test -w "${kernel_downloads}" || return $?
(
cd "${kernel_sources}" || return $?
cd "${kernel_downloads}" || return $?
if [ "$plevel" = "" -o "$plevel" = "0" ] ||
download_file "${kernel_mirror}/v$series/patch-$1.xz"
then
@@ -73,15 +74,15 @@ function extract_kernel_archive {
local plevel="$(patchlevel $1)"
local series="$1"
if [ -e "${kernel_sources}/linux-$1.tar.xz" ]; then
xz -cd "${kernel_sources}/linux-$1.tar.xz" | tar xf -
elif [ -e "${kernel_sources}/linux-$kver.tar.xz" ]; then
xz -cd "${kernel_sources}/linux-$kver.tar.xz" | tar xf - &&
if [ -e "${kernel_downloads}/linux-$1.tar.xz" ]; then
xz -cd "${kernel_downloads}/linux-$1.tar.xz" | tar xf -
elif [ -e "${kernel_downloads}/linux-$kver.tar.xz" ]; then
xz -cd "${kernel_downloads}/linux-$kver.tar.xz" | tar xf - &&
mv linux-$kver linux-$1
elif [ -e "${kernel_sources}/linux-$1.tar.bz2" ]; then
tar xjf "${kernel_sources}/linux-$1.tar.bz2"
elif [ -e "${kernel_sources}/linux-$kver.tar.bz2" ]; then
tar xjf "${kernel_sources}/linux-$kver.tar.bz2" &&
elif [ -e "${kernel_downloads}/linux-$1.tar.bz2" ]; then
tar xjf "${kernel_downloads}/linux-$1.tar.bz2"
elif [ -e "${kernel_downloads}/linux-$kver.tar.bz2" ]; then
tar xjf "${kernel_downloads}/linux-$kver.tar.bz2" &&
mv linux-$kver linux-$1
else
return 1
@@ -100,10 +101,10 @@ function extract_kernel_tree {
(
cd "${tmpdir}" || return $?
if [ "$plevel" != "" -a "$plevel" != "0" -a \
-e "${kernel_sources}/patch-$1.xz" ]; then
-e "${kernel_downloads}/patch-$1.xz" ]; then
extract_kernel_archive $kver || return $?
mv linux-$kver linux-$1
( cd linux-$1 && xz -cd "${kernel_sources}/patch-$1.xz" \
( cd linux-$1 && xz -cd "${kernel_downloads}/patch-$1.xz" \
| patch -p1 -f -s; ) \
|| return $?
else
@@ -421,3 +422,15 @@ EOF
rmdir "${tmpdir}"
}
function download_and_extract_kernel_tree {
if [ -e "${kernel_tree}" ]; then
rm -rf "linux-$1"
mkdir "linux-$1"
(
cd "${kernel_tree}" &&
{ git tag -l "v$1" >/dev/null || git fetch stable; } &&
git archive "v$1"
) | tar -C "linux-$1" -xf-
fi
download_kernel "$1" && extract_kernel_tree "$1"
}

View File

@@ -652,14 +652,10 @@ do
patchdir="patchdir-${kv}"
k="${kv}"
if ! download_kernel "$k"; then
echo "Downloading kernel version $k failed"
continue
fi
generate_kernel_patch "$k" "${generate_kernel_patch_options}" || continue
(
cd "${outputdir}" &&
extract_kernel_tree "$k" &&
download_and_extract_kernel_tree "$k" &&
cd "linux-$k/include/linux" &&
if [ ! -e compiler-gcc6.h ]; then
for f in compiler-gcc5.h compiler-gcc4.h; do
@@ -675,6 +671,12 @@ do
run_checkpatch "$k"
fi
patch_and_configure_kernel "$k"
case "$k" in
2.*|3.*)
# Tell the kernel that we are using gcc 4.6.
KCFLAGS="-U__GNUC__ -U__GNUC_MINOR__ -D__GNUC__=4 -D__GNUC_MINOR__=6"
export KCFLAGS;;
esac
subdirs=(drivers/scst)
if [ "${run_sparse}" = "true" ]; then
run_sparse "$k" "${subdirs[@]}"