Skip to content

Commit 48efe45

Browse files
committed
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Lots of activity again this round for I/O performance optimizations (per-cpu IDA pre-allocation for vhost + iscsi/target), and the addition of new fabric independent features to target-core (COMPARE_AND_WRITE + EXTENDED_COPY). The main highlights include: - Support for iscsi-target login multiplexing across individual network portals - Generic Per-cpu IDA logic (kent + akpm + clameter) - Conversion of vhost to use per-cpu IDA pre-allocation for descriptors, SGLs and userspace page pointer list - Conversion of iscsi-target + iser-target to use per-cpu IDA pre-allocation for descriptors - Add support for generic COMPARE_AND_WRITE (AtomicTestandSet) emulation for virtual backend drivers - Add support for generic EXTENDED_COPY (CopyOffload) emulation for virtual backend drivers. - Add support for fast memory registration mode to iser-target (Vu) The patches to add COMPARE_AND_WRITE and EXTENDED_COPY support are of particular significance, which make us the first and only open source target to support the full set of VAAI primitives. Currently Linux clients are lacking upstream support to actually utilize these primitives. However, with server side support now in place for folks like MKP + ZAB working on the client, this logic once reserved for the highest end of storage arrays, can now be run in VMs on their laptops" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits) target/iscsi: Bump versions to v4.1.0 target: Update copyright ownership/year information to 2013 iscsi-target: Bump default TCP listen backlog to 256 target: Fix >= v3.9+ regression in PR APTPL + ALUA metadata write-out iscsi-target; Bump default CmdSN Depth to 64 iscsi-target: Remove unnecessary wait_for_completion in iscsi_get_thread_set iscsi-target: Add thread_set->ts_activate_sem + use common deallocate iscsi-target: Fix race with thread_pre_handler flush_signals + ISCSI_THREAD_SET_DIE target: remove unused including <linux/version.h> iser-target: introduce fast memory registration mode (FRWR) iser-target: generalize rdma memory registration and cleanup iser-target: move rdma wr processing to a shared function target: Enable global EXTENDED_COPY setup/release target: Add Third Party Copy (3PC) bit in INQUIRY response target: Enable EXTENDED_COPY setup in spc_parse_cdb target: Add support for EXTENDED_COPY copy offload emulation target: Avoid non-existent tg_pt_gp_mem in target_alua_state_check target: Add global device list for EXTENDED_COPY target: Make helpers non static for EXTENDED_COPY command setup target: Make spc_parse_naa_6h_vendor_specific non static ...
2 parents ac4de95 + 2999ee7 commit 48efe45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3487
-776
lines changed

drivers/infiniband/ulp/isert/ib_isert.c

Lines changed: 521 additions & 226 deletions
Large diffs are not rendered by default.

drivers/infiniband/ulp/isert/ib_isert.h

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <rdma/rdma_cm.h>
66

77
#define ISERT_RDMA_LISTEN_BACKLOG 10
8+
#define ISCSI_ISER_SG_TABLESIZE 256
89

910
enum isert_desc_type {
1011
ISCSI_TX_CONTROL,
@@ -45,15 +46,26 @@ struct iser_tx_desc {
4546
struct ib_send_wr send_wr;
4647
} __packed;
4748

49+
struct fast_reg_descriptor {
50+
struct list_head list;
51+
struct ib_mr *data_mr;
52+
struct ib_fast_reg_page_list *data_frpl;
53+
bool valid;
54+
};
55+
4856
struct isert_rdma_wr {
4957
struct list_head wr_list;
5058
struct isert_cmd *isert_cmd;
5159
enum iser_ib_op_code iser_ib_op;
5260
struct ib_sge *ib_sge;
61+
struct ib_sge s_ib_sge;
5362
int num_sge;
5463
struct scatterlist *sge;
5564
int send_wr_num;
5665
struct ib_send_wr *send_wr;
66+
struct ib_send_wr s_send_wr;
67+
u32 cur_rdma_length;
68+
struct fast_reg_descriptor *fr_desc;
5769
};
5870

5971
struct isert_cmd {
@@ -67,8 +79,7 @@ struct isert_cmd {
6779
u32 write_va_off;
6880
u32 rdma_wr_num;
6981
struct isert_conn *conn;
70-
struct iscsi_cmd iscsi_cmd;
71-
struct ib_sge *ib_sge;
82+
struct iscsi_cmd *iscsi_cmd;
7283
struct iser_tx_desc tx_desc;
7384
struct isert_rdma_wr rdma_wr;
7485
struct work_struct comp_work;
@@ -106,6 +117,10 @@ struct isert_conn {
106117
wait_queue_head_t conn_wait;
107118
wait_queue_head_t conn_wait_comp_err;
108119
struct kref conn_kref;
120+
struct list_head conn_frwr_pool;
121+
int conn_frwr_pool_size;
122+
/* lock to protect frwr_pool */
123+
spinlock_t conn_lock;
109124
};
110125

111126
#define ISERT_MAX_CQ 64
@@ -118,6 +133,7 @@ struct isert_cq_desc {
118133
};
119134

120135
struct isert_device {
136+
int use_frwr;
121137
int cqs_used;
122138
int refcount;
123139
int cq_active_qps[ISERT_MAX_CQ];
@@ -128,6 +144,12 @@ struct isert_device {
128144
struct ib_cq *dev_tx_cq[ISERT_MAX_CQ];
129145
struct isert_cq_desc *cq_desc;
130146
struct list_head dev_node;
147+
struct ib_device_attr dev_attr;
148+
int (*reg_rdma_mem)(struct iscsi_conn *conn,
149+
struct iscsi_cmd *cmd,
150+
struct isert_rdma_wr *wr);
151+
void (*unreg_rdma_mem)(struct isert_cmd *isert_cmd,
152+
struct isert_conn *isert_conn);
131153
};
132154

133155
struct isert_np {

drivers/scsi/qla2xxx/qla_target.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Forward port and refactoring to modern qla2xxx and target/configfs
1212
*
13-
* Copyright (C) 2010-2011 Nicholas A. Bellinger <[email protected]>
13+
* Copyright (C) 2010-2013 Nicholas A. Bellinger <[email protected]>
1414
*
1515
* This program is free software; you can redistribute it and/or
1616
* modify it under the terms of the GNU General Public License

drivers/scsi/qla2xxx/tcm_qla2xxx.c

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
* This file contains tcm implementation using v4 configfs fabric infrastructure
33
* for QLogic target mode HBAs
44
*
5-
* ?? Copyright 2010-2011 RisingTide Systems LLC.
5+
* (c) Copyright 2010-2013 Datera, Inc.
66
*
7-
* Licensed to the Linux Foundation under the General Public License (GPL)
8-
* version 2.
9-
*
10-
* Author: Nicholas A. Bellinger <[email protected]>
7+
* Author: Nicholas A. Bellinger <[email protected]>
118
*
129
* tcm_qla2xxx_parse_wwn() and tcm_qla2xxx_format_wwn() contains code from
1310
* the TCM_FC / Open-FCoE.org fabric module.
@@ -360,6 +357,14 @@ static int tcm_qla2xxx_check_prod_write_protect(struct se_portal_group *se_tpg)
360357
return QLA_TPG_ATTRIB(tpg)->prod_mode_write_protect;
361358
}
362359

360+
static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpg)
361+
{
362+
struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
363+
struct tcm_qla2xxx_tpg, se_tpg);
364+
365+
return QLA_TPG_ATTRIB(tpg)->demo_mode_login_only;
366+
}
367+
363368
static struct se_node_acl *tcm_qla2xxx_alloc_fabric_acl(
364369
struct se_portal_group *se_tpg)
365370
{
@@ -489,38 +494,13 @@ static u32 tcm_qla2xxx_sess_get_index(struct se_session *se_sess)
489494
return 0;
490495
}
491496

492-
/*
493-
* The LIO target core uses DMA_TO_DEVICE to mean that data is going
494-
* to the target (eg handling a WRITE) and DMA_FROM_DEVICE to mean
495-
* that data is coming from the target (eg handling a READ). However,
496-
* this is just the opposite of what we have to tell the DMA mapping
497-
* layer -- eg when handling a READ, the HBA will have to DMA the data
498-
* out of memory so it can send it to the initiator, which means we
499-
* need to use DMA_TO_DEVICE when we map the data.
500-
*/
501-
static enum dma_data_direction tcm_qla2xxx_mapping_dir(struct se_cmd *se_cmd)
502-
{
503-
if (se_cmd->se_cmd_flags & SCF_BIDI)
504-
return DMA_BIDIRECTIONAL;
505-
506-
switch (se_cmd->data_direction) {
507-
case DMA_TO_DEVICE:
508-
return DMA_FROM_DEVICE;
509-
case DMA_FROM_DEVICE:
510-
return DMA_TO_DEVICE;
511-
case DMA_NONE:
512-
default:
513-
return DMA_NONE;
514-
}
515-
}
516-
517497
static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
518498
{
519499
struct qla_tgt_cmd *cmd = container_of(se_cmd,
520500
struct qla_tgt_cmd, se_cmd);
521501

522502
cmd->bufflen = se_cmd->data_length;
523-
cmd->dma_data_direction = tcm_qla2xxx_mapping_dir(se_cmd);
503+
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
524504

525505
cmd->sg_cnt = se_cmd->t_data_nents;
526506
cmd->sg = se_cmd->t_data_sg;
@@ -656,7 +636,7 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
656636
struct qla_tgt_cmd, se_cmd);
657637

658638
cmd->bufflen = se_cmd->data_length;
659-
cmd->dma_data_direction = tcm_qla2xxx_mapping_dir(se_cmd);
639+
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
660640
cmd->aborted = (se_cmd->transport_state & CMD_T_ABORTED);
661641

662642
cmd->sg_cnt = se_cmd->t_data_nents;
@@ -680,7 +660,7 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)
680660
cmd->sg = NULL;
681661
cmd->sg_cnt = 0;
682662
cmd->offset = 0;
683-
cmd->dma_data_direction = tcm_qla2xxx_mapping_dir(se_cmd);
663+
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
684664
cmd->aborted = (se_cmd->transport_state & CMD_T_ABORTED);
685665

686666
if (se_cmd->data_direction == DMA_FROM_DEVICE) {
@@ -939,11 +919,19 @@ DEF_QLA_TPG_ATTR_BOOL(prod_mode_write_protect);
939919
DEF_QLA_TPG_ATTRIB(prod_mode_write_protect);
940920
QLA_TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR);
941921

922+
/*
923+
* Define tcm_qla2xxx_tpg_attrib_s_demo_mode_login_only
924+
*/
925+
DEF_QLA_TPG_ATTR_BOOL(demo_mode_login_only);
926+
DEF_QLA_TPG_ATTRIB(demo_mode_login_only);
927+
QLA_TPG_ATTR(demo_mode_login_only, S_IRUGO | S_IWUSR);
928+
942929
static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = {
943930
&tcm_qla2xxx_tpg_attrib_generate_node_acls.attr,
944931
&tcm_qla2xxx_tpg_attrib_cache_dynamic_acls.attr,
945932
&tcm_qla2xxx_tpg_attrib_demo_mode_write_protect.attr,
946933
&tcm_qla2xxx_tpg_attrib_prod_mode_write_protect.attr,
934+
&tcm_qla2xxx_tpg_attrib_demo_mode_login_only.attr,
947935
NULL,
948936
};
949937

@@ -1042,6 +1030,7 @@ static struct se_portal_group *tcm_qla2xxx_make_tpg(
10421030
QLA_TPG_ATTRIB(tpg)->generate_node_acls = 1;
10431031
QLA_TPG_ATTRIB(tpg)->demo_mode_write_protect = 1;
10441032
QLA_TPG_ATTRIB(tpg)->cache_dynamic_acls = 1;
1033+
QLA_TPG_ATTRIB(tpg)->demo_mode_login_only = 1;
10451034

10461035
ret = core_tpg_register(&tcm_qla2xxx_fabric_configfs->tf_ops, wwn,
10471036
&tpg->se_tpg, tpg, TRANSPORT_TPG_TYPE_NORMAL);
@@ -1736,7 +1725,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = {
17361725
tcm_qla2xxx_check_demo_write_protect,
17371726
.tpg_check_prod_mode_write_protect =
17381727
tcm_qla2xxx_check_prod_write_protect,
1739-
.tpg_check_demo_mode_login_only = tcm_qla2xxx_check_true,
1728+
.tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only,
17401729
.tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl,
17411730
.tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl,
17421731
.tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,
@@ -1784,7 +1773,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = {
17841773
.tpg_check_demo_mode_cache = tcm_qla2xxx_check_true,
17851774
.tpg_check_demo_mode_write_protect = tcm_qla2xxx_check_true,
17861775
.tpg_check_prod_mode_write_protect = tcm_qla2xxx_check_false,
1787-
.tpg_check_demo_mode_login_only = tcm_qla2xxx_check_true,
1776+
.tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only,
17881777
.tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl,
17891778
.tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl,
17901779
.tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index,

drivers/scsi/qla2xxx/tcm_qla2xxx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct tcm_qla2xxx_tpg_attrib {
2929
int cache_dynamic_acls;
3030
int demo_mode_write_protect;
3131
int prod_mode_write_protect;
32+
int demo_mode_login_only;
3233
};
3334

3435
struct tcm_qla2xxx_tpg {

drivers/target/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ target_core_mod-y := target_core_configfs.o \
1313
target_core_spc.o \
1414
target_core_ua.o \
1515
target_core_rd.o \
16-
target_core_stat.o
16+
target_core_stat.o \
17+
target_core_xcopy.o
1718

1819
obj-$(CONFIG_TARGET_CORE) += target_core_mod.o
1920

0 commit comments

Comments
 (0)