diff options
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_util.c')
| -rw-r--r-- | drivers/target/iscsi/iscsi_target_util.c | 53 |
1 files changed, 2 insertions, 51 deletions
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index b18edda3e8af..a2bff0702eb2 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <scsi/iscsi_proto.h> | 22 | #include <scsi/iscsi_proto.h> |
| 23 | #include <target/target_core_base.h> | 23 | #include <target/target_core_base.h> |
| 24 | #include <target/target_core_fabric.h> | 24 | #include <target/target_core_fabric.h> |
| 25 | #include <target/target_core_configfs.h> | ||
| 26 | #include <target/iscsi/iscsi_transport.h> | 25 | #include <target/iscsi/iscsi_transport.h> |
| 27 | 26 | ||
| 28 | #include <target/iscsi/iscsi_target_core.h> | 27 | #include <target/iscsi/iscsi_target_core.h> |
| @@ -746,7 +745,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) | |||
| 746 | rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); | 745 | rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); |
| 747 | if (!rc && shutdown && se_cmd && se_cmd->se_sess) { | 746 | if (!rc && shutdown && se_cmd && se_cmd->se_sess) { |
| 748 | __iscsit_free_cmd(cmd, true, shutdown); | 747 | __iscsit_free_cmd(cmd, true, shutdown); |
| 749 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); | 748 | target_put_sess_cmd(se_cmd); |
| 750 | } | 749 | } |
| 751 | break; | 750 | break; |
| 752 | case ISCSI_OP_REJECT: | 751 | case ISCSI_OP_REJECT: |
| @@ -762,7 +761,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) | |||
| 762 | rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); | 761 | rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); |
| 763 | if (!rc && shutdown && se_cmd->se_sess) { | 762 | if (!rc && shutdown && se_cmd->se_sess) { |
| 764 | __iscsit_free_cmd(cmd, true, shutdown); | 763 | __iscsit_free_cmd(cmd, true, shutdown); |
| 765 | target_put_sess_cmd(se_cmd->se_sess, se_cmd); | 764 | target_put_sess_cmd(se_cmd); |
| 766 | } | 765 | } |
| 767 | break; | 766 | break; |
| 768 | } | 767 | } |
| @@ -809,54 +808,6 @@ void iscsit_inc_session_usage_count(struct iscsi_session *sess) | |||
| 809 | spin_unlock_bh(&sess->session_usage_lock); | 808 | spin_unlock_bh(&sess->session_usage_lock); |
| 810 | } | 809 | } |
| 811 | 810 | ||
| 812 | /* | ||
| 813 | * Setup conn->if_marker and conn->of_marker values based upon | ||
| 814 | * the initial marker-less interval. (see iSCSI v19 A.2) | ||
| 815 | */ | ||
| 816 | int iscsit_set_sync_and_steering_values(struct iscsi_conn *conn) | ||
| 817 | { | ||
| 818 | int login_ifmarker_count = 0, login_ofmarker_count = 0, next_marker = 0; | ||
| 819 | /* | ||
| 820 | * IFMarkInt and OFMarkInt are negotiated as 32-bit words. | ||
| 821 | */ | ||
| 822 | u32 IFMarkInt = (conn->conn_ops->IFMarkInt * 4); | ||
| 823 | u32 OFMarkInt = (conn->conn_ops->OFMarkInt * 4); | ||
| 824 | |||
| 825 | if (conn->conn_ops->OFMarker) { | ||
| 826 | /* | ||
| 827 | * Account for the first Login Command received not | ||
| 828 | * via iscsi_recv_msg(). | ||
| 829 | */ | ||
| 830 | conn->of_marker += ISCSI_HDR_LEN; | ||
| 831 | if (conn->of_marker <= OFMarkInt) { | ||
| 832 | conn->of_marker = (OFMarkInt - conn->of_marker); | ||
| 833 | } else { | ||
| 834 | login_ofmarker_count = (conn->of_marker / OFMarkInt); | ||
| 835 | next_marker = (OFMarkInt * (login_ofmarker_count + 1)) + | ||
| 836 | (login_ofmarker_count * MARKER_SIZE); | ||
| 837 | conn->of_marker = (next_marker - conn->of_marker); | ||
| 838 | } | ||
| 839 | conn->of_marker_offset = 0; | ||
| 840 | pr_debug("Setting OFMarker value to %u based on Initial" | ||
| 841 | " Markerless Interval.\n", conn->of_marker); | ||
| 842 | } | ||
| 843 | |||
| 844 | if (conn->conn_ops->IFMarker) { | ||
| 845 | if (conn->if_marker <= IFMarkInt) { | ||
| 846 | conn->if_marker = (IFMarkInt - conn->if_marker); | ||
| 847 | } else { | ||
| 848 | login_ifmarker_count = (conn->if_marker / IFMarkInt); | ||
| 849 | next_marker = (IFMarkInt * (login_ifmarker_count + 1)) + | ||
| 850 | (login_ifmarker_count * MARKER_SIZE); | ||
| 851 | conn->if_marker = (next_marker - conn->if_marker); | ||
| 852 | } | ||
| 853 | pr_debug("Setting IFMarker value to %u based on Initial" | ||
| 854 | " Markerless Interval.\n", conn->if_marker); | ||
| 855 | } | ||
| 856 | |||
| 857 | return 0; | ||
| 858 | } | ||
| 859 | |||
| 860 | struct iscsi_conn *iscsit_get_conn_from_cid(struct iscsi_session *sess, u16 cid) | 811 | struct iscsi_conn *iscsit_get_conn_from_cid(struct iscsi_session *sess, u16 cid) |
| 861 | { | 812 | { |
| 862 | struct iscsi_conn *conn; | 813 | struct iscsi_conn *conn; |
