summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2016-04-19 20:30:14 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2016-05-10 08:12:09 +0200
commitc0b7373be811307c5ff1de8c8547aae3597d24aa (patch)
tree59c6e68dee76c79717c2d7d1ccc9a94a9e70c335 /include
parentiscsi-target: add void (*iscsit_get_r2t_ttt)() (diff)
downloadlinux-c0b7373be811307c5ff1de8c8547aae3597d24aa.tar.xz
linux-c0b7373be811307c5ff1de8c8547aae3597d24aa.zip
iscsi-target: move iscsit_thread_check_cpumask()
Move iscsit_thread_check_cpumask() to header file so that ISCSI_HW_OFFLOAD and other transport drivers can call this function to ensure both tx and rx thread runs on same cpu. Signed-off-by: Varun Prakash <varun@chelsio.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r--include/target/iscsi/iscsi_target_core.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
index c3371fa548cb..01c41f2b66d1 100644
--- a/include/target/iscsi/iscsi_target_core.h
+++ b/include/target/iscsi/iscsi_target_core.h
@@ -890,4 +890,30 @@ static inline u32 session_get_next_ttt(struct iscsi_session *session)
}
extern struct iscsi_cmd *iscsit_find_cmd_from_itt(struct iscsi_conn *, itt_t);
+
+static inline void iscsit_thread_check_cpumask(
+ struct iscsi_conn *conn,
+ struct task_struct *p,
+ int mode)
+{
+ /*
+ * mode == 1 signals iscsi_target_tx_thread() usage.
+ * mode == 0 signals iscsi_target_rx_thread() usage.
+ */
+ if (mode == 1) {
+ if (!conn->conn_tx_reset_cpumask)
+ return;
+ conn->conn_tx_reset_cpumask = 0;
+ } else {
+ if (!conn->conn_rx_reset_cpumask)
+ return;
+ conn->conn_rx_reset_cpumask = 0;
+ }
+ /*
+ * Update the CPU mask for this single kthread so that
+ * both TX and RX kthreads are scheduled to run on the
+ * same CPU.
+ */
+ set_cpus_allowed_ptr(p, conn->conn_cpumask);
+}
#endif /* ISCSI_TARGET_CORE_H */