diff options
| author | Sagi Grimberg <sagig@mellanox.com> | 2014-12-02 09:57:35 -0500 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-12-13 02:32:26 -0500 |
| commit | 23a548ee656c8ba6da8cb2412070edcd62e2ac5d (patch) | |
| tree | 9aaedc8d899f08a2363293c420919b5bfae04076 | |
| parent | 302cc7c3ca14d21ccdffdebdb61c4fe028f2d5ad (diff) | |
iscsi,iser-target: Expose supported protection ops according to t10_pi
iSER will report supported protection operations based on
the tpg attribute t10_pi settings and HCA PI offload capabilities.
If the HCA does not support PI offload or tpg attribute t10_pi is
not set, we fall to SW PI mode.
In order to do that, we move iscsit_get_sup_prot_ops after connection
tpg assignment.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| -rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 14 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.h | 1 | ||||
| -rw-r--r-- | drivers/target/iscsi/iscsi_target_login.c | 7 |
3 files changed, 16 insertions, 6 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 618c81576b05..a6daabc70425 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
| @@ -64,7 +64,7 @@ struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); | |||
| 64 | static inline bool | 64 | static inline bool |
| 65 | isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd) | 65 | isert_prot_cmd(struct isert_conn *conn, struct se_cmd *cmd) |
| 66 | { | 66 | { |
| 67 | return (conn->conn_device->pi_capable && | 67 | return (conn->pi_support && |
| 68 | cmd->prot_op != TARGET_PROT_NORMAL); | 68 | cmd->prot_op != TARGET_PROT_NORMAL); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -2324,8 +2324,16 @@ isert_get_sup_prot_ops(struct iscsi_conn *conn) | |||
| 2324 | struct isert_conn *isert_conn = (struct isert_conn *)conn->context; | 2324 | struct isert_conn *isert_conn = (struct isert_conn *)conn->context; |
| 2325 | struct isert_device *device = isert_conn->conn_device; | 2325 | struct isert_device *device = isert_conn->conn_device; |
| 2326 | 2326 | ||
| 2327 | if (device->pi_capable) | 2327 | if (conn->tpg->tpg_attrib.t10_pi) { |
| 2328 | return TARGET_PROT_ALL; | 2328 | if (device->pi_capable) { |
| 2329 | pr_info("conn %p PI offload enabled\n", isert_conn); | ||
| 2330 | isert_conn->pi_support = true; | ||
| 2331 | return TARGET_PROT_ALL; | ||
| 2332 | } | ||
| 2333 | } | ||
| 2334 | |||
| 2335 | pr_info("conn %p PI offload disabled\n", isert_conn); | ||
| 2336 | isert_conn->pi_support = false; | ||
| 2329 | 2337 | ||
| 2330 | return TARGET_PROT_NORMAL; | 2338 | return TARGET_PROT_NORMAL; |
| 2331 | } | 2339 | } |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 2e7868c5ad14..141905f446dd 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
| @@ -128,6 +128,7 @@ struct isert_conn { | |||
| 128 | atomic_t post_send_buf_count; | 128 | atomic_t post_send_buf_count; |
| 129 | u32 responder_resources; | 129 | u32 responder_resources; |
| 130 | u32 initiator_depth; | 130 | u32 initiator_depth; |
| 131 | bool pi_support; | ||
| 131 | u32 max_sge; | 132 | u32 max_sge; |
| 132 | char *login_buf; | 133 | char *login_buf; |
| 133 | char *login_req_buf; | 134 | char *login_req_buf; |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 05ad5c7128f2..18e2601527df 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
| @@ -281,7 +281,6 @@ static int iscsi_login_zero_tsih_s1( | |||
| 281 | { | 281 | { |
| 282 | struct iscsi_session *sess = NULL; | 282 | struct iscsi_session *sess = NULL; |
| 283 | struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf; | 283 | struct iscsi_login_req *pdu = (struct iscsi_login_req *)buf; |
| 284 | enum target_prot_op sup_pro_ops; | ||
| 285 | int ret; | 284 | int ret; |
| 286 | 285 | ||
| 287 | sess = kzalloc(sizeof(struct iscsi_session), GFP_KERNEL); | 286 | sess = kzalloc(sizeof(struct iscsi_session), GFP_KERNEL); |
| @@ -343,9 +342,8 @@ static int iscsi_login_zero_tsih_s1( | |||
| 343 | kfree(sess); | 342 | kfree(sess); |
| 344 | return -ENOMEM; | 343 | return -ENOMEM; |
| 345 | } | 344 | } |
| 346 | sup_pro_ops = conn->conn_transport->iscsit_get_sup_prot_ops(conn); | ||
| 347 | 345 | ||
| 348 | sess->se_sess = transport_init_session(sup_pro_ops); | 346 | sess->se_sess = transport_init_session(TARGET_PROT_NORMAL); |
| 349 | if (IS_ERR(sess->se_sess)) { | 347 | if (IS_ERR(sess->se_sess)) { |
| 350 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 348 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
| 351 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 349 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
| @@ -1367,6 +1365,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
| 1367 | } | 1365 | } |
| 1368 | login->zero_tsih = zero_tsih; | 1366 | login->zero_tsih = zero_tsih; |
| 1369 | 1367 | ||
| 1368 | conn->sess->se_sess->sup_prot_ops = | ||
| 1369 | conn->conn_transport->iscsit_get_sup_prot_ops(conn); | ||
| 1370 | |||
| 1370 | tpg = conn->tpg; | 1371 | tpg = conn->tpg; |
| 1371 | if (!tpg) { | 1372 | if (!tpg) { |
| 1372 | pr_err("Unable to locate struct iscsi_conn->tpg\n"); | 1373 | pr_err("Unable to locate struct iscsi_conn->tpg\n"); |
