diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-22 13:52:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-22 13:52:03 -0500 |
commit | b0e3636f656c98bdeded5aaa78601e3256b18d6d (patch) | |
tree | 8b2096769179967bd3c186cf79c232f21fa1d1a1 /drivers/infiniband/ulp/isert/ib_isert.c | |
parent | 0032cdefff0f4ff5bd9464036d510a5441ec8b83 (diff) | |
parent | 86784c6bdeeef78eed94d298be7a8879f6a97ee2 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger:
"Things have been quiet this round with mostly bugfixes, percpu
conversions, and other minor iscsi-target conformance testing changes.
The highlights include:
- Add demo_mode_discovery attribute for iscsi-target (Thomas)
- Convert tcm_fc(FCoE) to use percpu-ida pre-allocation
- Add send completion interrupt coalescing for ib_isert
- Convert target-core to use percpu-refcounting for se_lun
- Fix mutex_trylock usage bug in iscsit_increment_maxcmdsn
- tcm_loop updates (Hannes)
- target-core ALUA cleanups + prep for v3.14 SCSI Referrals support (Hannes)
v3.14 is currently shaping to be a busy development cycle in target
land, with initial support for T10 Referrals and T10 DIF currently on
the roadmap"
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (40 commits)
iscsi-target: chap auth shouldn't match username with trailing garbage
iscsi-target: fix extract_param to handle buffer length corner case
iscsi-target: Expose default_erl as TPG attribute
target_core_configfs: split up ALUA supported states
target_core_alua: Make supported states configurable
target_core_alua: Store supported ALUA states
target_core_alua: Rename ALUA_ACCESS_STATE_OPTIMIZED
target_core_alua: spellcheck
target core: rename (ex,im)plict -> (ex,im)plicit
percpu-refcount: Add percpu-refcount.o to obj-y
iscsi-target: Do not reject non-immediate CmdSNs exceeding MaxCmdSN
iscsi-target: Convert iscsi_session statistics to atomic_long_t
target: Convert se_device statistics to atomic_long_t
target: Fix delayed Task Aborted Status (TAS) handling bug
iscsi-target: Reject unsupported multi PDU text command sequence
ib_isert: Avoid duplicate iscsit_increment_maxcmdsn call
iscsi-target: Fix mutex_trylock usage in iscsit_increment_maxcmdsn
target: Core does not need blkdev.h
target: Pass through I/O topology for block backstores
iser-target: Avoid using FRMR for single dma entry requests
...
Diffstat (limited to 'drivers/infiniband/ulp/isert/ib_isert.c')
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 99 |
1 files changed, 71 insertions, 28 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 6df23502059a..6be57c38638d 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/socket.h> | 22 | #include <linux/socket.h> |
23 | #include <linux/in.h> | 23 | #include <linux/in.h> |
24 | #include <linux/in6.h> | 24 | #include <linux/in6.h> |
25 | #include <linux/llist.h> | ||
25 | #include <rdma/ib_verbs.h> | 26 | #include <rdma/ib_verbs.h> |
26 | #include <rdma/rdma_cm.h> | 27 | #include <rdma/rdma_cm.h> |
27 | #include <target/target_core_base.h> | 28 | #include <target/target_core_base.h> |
@@ -489,6 +490,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
489 | kref_init(&isert_conn->conn_kref); | 490 | kref_init(&isert_conn->conn_kref); |
490 | kref_get(&isert_conn->conn_kref); | 491 | kref_get(&isert_conn->conn_kref); |
491 | mutex_init(&isert_conn->conn_mutex); | 492 | mutex_init(&isert_conn->conn_mutex); |
493 | mutex_init(&isert_conn->conn_comp_mutex); | ||
492 | spin_lock_init(&isert_conn->conn_lock); | 494 | spin_lock_init(&isert_conn->conn_lock); |
493 | 495 | ||
494 | cma_id->context = isert_conn; | 496 | cma_id->context = isert_conn; |
@@ -843,14 +845,32 @@ isert_init_tx_hdrs(struct isert_conn *isert_conn, | |||
843 | } | 845 | } |
844 | 846 | ||
845 | static void | 847 | static void |
846 | isert_init_send_wr(struct isert_cmd *isert_cmd, struct ib_send_wr *send_wr) | 848 | isert_init_send_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, |
849 | struct ib_send_wr *send_wr, bool coalesce) | ||
847 | { | 850 | { |
851 | struct iser_tx_desc *tx_desc = &isert_cmd->tx_desc; | ||
852 | |||
848 | isert_cmd->rdma_wr.iser_ib_op = ISER_IB_SEND; | 853 | isert_cmd->rdma_wr.iser_ib_op = ISER_IB_SEND; |
849 | send_wr->wr_id = (unsigned long)&isert_cmd->tx_desc; | 854 | send_wr->wr_id = (unsigned long)&isert_cmd->tx_desc; |
850 | send_wr->opcode = IB_WR_SEND; | 855 | send_wr->opcode = IB_WR_SEND; |
851 | send_wr->send_flags = IB_SEND_SIGNALED; | 856 | send_wr->sg_list = &tx_desc->tx_sg[0]; |
852 | send_wr->sg_list = &isert_cmd->tx_desc.tx_sg[0]; | ||
853 | send_wr->num_sge = isert_cmd->tx_desc.num_sge; | 857 | send_wr->num_sge = isert_cmd->tx_desc.num_sge; |
858 | /* | ||
859 | * Coalesce send completion interrupts by only setting IB_SEND_SIGNALED | ||
860 | * bit for every ISERT_COMP_BATCH_COUNT number of ib_post_send() calls. | ||
861 | */ | ||
862 | mutex_lock(&isert_conn->conn_comp_mutex); | ||
863 | if (coalesce && | ||
864 | ++isert_conn->conn_comp_batch < ISERT_COMP_BATCH_COUNT) { | ||
865 | llist_add(&tx_desc->comp_llnode, &isert_conn->conn_comp_llist); | ||
866 | mutex_unlock(&isert_conn->conn_comp_mutex); | ||
867 | return; | ||
868 | } | ||
869 | isert_conn->conn_comp_batch = 0; | ||
870 | tx_desc->comp_llnode_batch = llist_del_all(&isert_conn->conn_comp_llist); | ||
871 | mutex_unlock(&isert_conn->conn_comp_mutex); | ||
872 | |||
873 | send_wr->send_flags = IB_SEND_SIGNALED; | ||
854 | } | 874 | } |
855 | 875 | ||
856 | static int | 876 | static int |
@@ -1582,8 +1602,8 @@ isert_response_completion(struct iser_tx_desc *tx_desc, | |||
1582 | } | 1602 | } |
1583 | 1603 | ||
1584 | static void | 1604 | static void |
1585 | isert_send_completion(struct iser_tx_desc *tx_desc, | 1605 | __isert_send_completion(struct iser_tx_desc *tx_desc, |
1586 | struct isert_conn *isert_conn) | 1606 | struct isert_conn *isert_conn) |
1587 | { | 1607 | { |
1588 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 1608 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; |
1589 | struct isert_cmd *isert_cmd = tx_desc->isert_cmd; | 1609 | struct isert_cmd *isert_cmd = tx_desc->isert_cmd; |
@@ -1624,6 +1644,24 @@ isert_send_completion(struct iser_tx_desc *tx_desc, | |||
1624 | } | 1644 | } |
1625 | 1645 | ||
1626 | static void | 1646 | static void |
1647 | isert_send_completion(struct iser_tx_desc *tx_desc, | ||
1648 | struct isert_conn *isert_conn) | ||
1649 | { | ||
1650 | struct llist_node *llnode = tx_desc->comp_llnode_batch; | ||
1651 | struct iser_tx_desc *t; | ||
1652 | /* | ||
1653 | * Drain coalesced completion llist starting from comp_llnode_batch | ||
1654 | * setup in isert_init_send_wr(), and then complete trailing tx_desc. | ||
1655 | */ | ||
1656 | while (llnode) { | ||
1657 | t = llist_entry(llnode, struct iser_tx_desc, comp_llnode); | ||
1658 | llnode = llist_next(llnode); | ||
1659 | __isert_send_completion(t, isert_conn); | ||
1660 | } | ||
1661 | __isert_send_completion(tx_desc, isert_conn); | ||
1662 | } | ||
1663 | |||
1664 | static void | ||
1627 | isert_cq_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) | 1665 | isert_cq_comp_err(struct iser_tx_desc *tx_desc, struct isert_conn *isert_conn) |
1628 | { | 1666 | { |
1629 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 1667 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; |
@@ -1793,7 +1831,7 @@ isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd) | |||
1793 | isert_cmd->tx_desc.num_sge = 2; | 1831 | isert_cmd->tx_desc.num_sge = 2; |
1794 | } | 1832 | } |
1795 | 1833 | ||
1796 | isert_init_send_wr(isert_cmd, send_wr); | 1834 | isert_init_send_wr(isert_conn, isert_cmd, send_wr, true); |
1797 | 1835 | ||
1798 | pr_debug("Posting SCSI Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); | 1836 | pr_debug("Posting SCSI Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); |
1799 | 1837 | ||
@@ -1813,7 +1851,7 @@ isert_put_nopin(struct iscsi_cmd *cmd, struct iscsi_conn *conn, | |||
1813 | &isert_cmd->tx_desc.iscsi_header, | 1851 | &isert_cmd->tx_desc.iscsi_header, |
1814 | nopout_response); | 1852 | nopout_response); |
1815 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); | 1853 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); |
1816 | isert_init_send_wr(isert_cmd, send_wr); | 1854 | isert_init_send_wr(isert_conn, isert_cmd, send_wr, false); |
1817 | 1855 | ||
1818 | pr_debug("Posting NOPIN Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); | 1856 | pr_debug("Posting NOPIN Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); |
1819 | 1857 | ||
@@ -1831,7 +1869,7 @@ isert_put_logout_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
1831 | iscsit_build_logout_rsp(cmd, conn, (struct iscsi_logout_rsp *) | 1869 | iscsit_build_logout_rsp(cmd, conn, (struct iscsi_logout_rsp *) |
1832 | &isert_cmd->tx_desc.iscsi_header); | 1870 | &isert_cmd->tx_desc.iscsi_header); |
1833 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); | 1871 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); |
1834 | isert_init_send_wr(isert_cmd, send_wr); | 1872 | isert_init_send_wr(isert_conn, isert_cmd, send_wr, false); |
1835 | 1873 | ||
1836 | pr_debug("Posting Logout Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); | 1874 | pr_debug("Posting Logout Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); |
1837 | 1875 | ||
@@ -1849,7 +1887,7 @@ isert_put_tm_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
1849 | iscsit_build_task_mgt_rsp(cmd, conn, (struct iscsi_tm_rsp *) | 1887 | iscsit_build_task_mgt_rsp(cmd, conn, (struct iscsi_tm_rsp *) |
1850 | &isert_cmd->tx_desc.iscsi_header); | 1888 | &isert_cmd->tx_desc.iscsi_header); |
1851 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); | 1889 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); |
1852 | isert_init_send_wr(isert_cmd, send_wr); | 1890 | isert_init_send_wr(isert_conn, isert_cmd, send_wr, false); |
1853 | 1891 | ||
1854 | pr_debug("Posting Task Management Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); | 1892 | pr_debug("Posting Task Management Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); |
1855 | 1893 | ||
@@ -1881,7 +1919,7 @@ isert_put_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
1881 | tx_dsg->lkey = isert_conn->conn_mr->lkey; | 1919 | tx_dsg->lkey = isert_conn->conn_mr->lkey; |
1882 | isert_cmd->tx_desc.num_sge = 2; | 1920 | isert_cmd->tx_desc.num_sge = 2; |
1883 | 1921 | ||
1884 | isert_init_send_wr(isert_cmd, send_wr); | 1922 | isert_init_send_wr(isert_conn, isert_cmd, send_wr, false); |
1885 | 1923 | ||
1886 | pr_debug("Posting Reject IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); | 1924 | pr_debug("Posting Reject IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); |
1887 | 1925 | ||
@@ -1921,7 +1959,7 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
1921 | tx_dsg->lkey = isert_conn->conn_mr->lkey; | 1959 | tx_dsg->lkey = isert_conn->conn_mr->lkey; |
1922 | isert_cmd->tx_desc.num_sge = 2; | 1960 | isert_cmd->tx_desc.num_sge = 2; |
1923 | } | 1961 | } |
1924 | isert_init_send_wr(isert_cmd, send_wr); | 1962 | isert_init_send_wr(isert_conn, isert_cmd, send_wr, false); |
1925 | 1963 | ||
1926 | pr_debug("Posting Text Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); | 1964 | pr_debug("Posting Text Response IB_WR_SEND >>>>>>>>>>>>>>>>>>>>>>\n"); |
1927 | 1965 | ||
@@ -1991,8 +2029,6 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
1991 | 2029 | ||
1992 | if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { | 2030 | if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { |
1993 | data_left = se_cmd->data_length; | 2031 | data_left = se_cmd->data_length; |
1994 | iscsit_increment_maxcmdsn(cmd, conn->sess); | ||
1995 | cmd->stat_sn = conn->stat_sn++; | ||
1996 | } else { | 2032 | } else { |
1997 | sg_off = cmd->write_data_done / PAGE_SIZE; | 2033 | sg_off = cmd->write_data_done / PAGE_SIZE; |
1998 | data_left = se_cmd->data_length - cmd->write_data_done; | 2034 | data_left = se_cmd->data_length - cmd->write_data_done; |
@@ -2204,8 +2240,6 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
2204 | 2240 | ||
2205 | if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { | 2241 | if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) { |
2206 | data_left = se_cmd->data_length; | 2242 | data_left = se_cmd->data_length; |
2207 | iscsit_increment_maxcmdsn(cmd, conn->sess); | ||
2208 | cmd->stat_sn = conn->stat_sn++; | ||
2209 | } else { | 2243 | } else { |
2210 | sg_off = cmd->write_data_done / PAGE_SIZE; | 2244 | sg_off = cmd->write_data_done / PAGE_SIZE; |
2211 | data_left = se_cmd->data_length - cmd->write_data_done; | 2245 | data_left = se_cmd->data_length - cmd->write_data_done; |
@@ -2259,18 +2293,26 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
2259 | data_len = min(data_left, rdma_write_max); | 2293 | data_len = min(data_left, rdma_write_max); |
2260 | wr->cur_rdma_length = data_len; | 2294 | wr->cur_rdma_length = data_len; |
2261 | 2295 | ||
2262 | spin_lock_irqsave(&isert_conn->conn_lock, flags); | 2296 | /* if there is a single dma entry, dma mr is sufficient */ |
2263 | fr_desc = list_first_entry(&isert_conn->conn_frwr_pool, | 2297 | if (count == 1) { |
2264 | struct fast_reg_descriptor, list); | 2298 | ib_sge->addr = ib_sg_dma_address(ib_dev, &sg_start[0]); |
2265 | list_del(&fr_desc->list); | 2299 | ib_sge->length = ib_sg_dma_len(ib_dev, &sg_start[0]); |
2266 | spin_unlock_irqrestore(&isert_conn->conn_lock, flags); | 2300 | ib_sge->lkey = isert_conn->conn_mr->lkey; |
2267 | wr->fr_desc = fr_desc; | 2301 | wr->fr_desc = NULL; |
2302 | } else { | ||
2303 | spin_lock_irqsave(&isert_conn->conn_lock, flags); | ||
2304 | fr_desc = list_first_entry(&isert_conn->conn_frwr_pool, | ||
2305 | struct fast_reg_descriptor, list); | ||
2306 | list_del(&fr_desc->list); | ||
2307 | spin_unlock_irqrestore(&isert_conn->conn_lock, flags); | ||
2308 | wr->fr_desc = fr_desc; | ||
2268 | 2309 | ||
2269 | ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn, | 2310 | ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn, |
2270 | ib_sge, offset, data_len); | 2311 | ib_sge, offset, data_len); |
2271 | if (ret) { | 2312 | if (ret) { |
2272 | list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool); | 2313 | list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool); |
2273 | goto unmap_sg; | 2314 | goto unmap_sg; |
2315 | } | ||
2274 | } | 2316 | } |
2275 | 2317 | ||
2276 | return 0; | 2318 | return 0; |
@@ -2306,10 +2348,11 @@ isert_put_datain(struct iscsi_conn *conn, struct iscsi_cmd *cmd) | |||
2306 | * Build isert_conn->tx_desc for iSCSI response PDU and attach | 2348 | * Build isert_conn->tx_desc for iSCSI response PDU and attach |
2307 | */ | 2349 | */ |
2308 | isert_create_send_desc(isert_conn, isert_cmd, &isert_cmd->tx_desc); | 2350 | isert_create_send_desc(isert_conn, isert_cmd, &isert_cmd->tx_desc); |
2309 | iscsit_build_rsp_pdu(cmd, conn, false, (struct iscsi_scsi_rsp *) | 2351 | iscsit_build_rsp_pdu(cmd, conn, true, (struct iscsi_scsi_rsp *) |
2310 | &isert_cmd->tx_desc.iscsi_header); | 2352 | &isert_cmd->tx_desc.iscsi_header); |
2311 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); | 2353 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); |
2312 | isert_init_send_wr(isert_cmd, &isert_cmd->tx_desc.send_wr); | 2354 | isert_init_send_wr(isert_conn, isert_cmd, |
2355 | &isert_cmd->tx_desc.send_wr, true); | ||
2313 | 2356 | ||
2314 | atomic_inc(&isert_conn->post_send_buf_count); | 2357 | atomic_inc(&isert_conn->post_send_buf_count); |
2315 | 2358 | ||