aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2016-04-19 14:30:14 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2016-05-10 02:12:09 -0400
commitc0b7373be811307c5ff1de8c8547aae3597d24aa (patch)
tree59c6e68dee76c79717c2d7d1ccc9a94a9e70c335
parent8567270d8de6192eb2632b45421b1fde9bcda2f2 (diff)
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>
-rw-r--r--drivers/target/iscsi/iscsi_target.c26
-rw-r--r--include/target/iscsi/iscsi_target_core.h26
2 files changed, 26 insertions, 26 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index a28eb87d6efc..28fc7fb5035f 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3580,32 +3580,6 @@ void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
3580 cpumask_setall(conn->conn_cpumask); 3580 cpumask_setall(conn->conn_cpumask);
3581} 3581}
3582 3582
3583static inline void iscsit_thread_check_cpumask(
3584 struct iscsi_conn *conn,
3585 struct task_struct *p,
3586 int mode)
3587{
3588 /*
3589 * mode == 1 signals iscsi_target_tx_thread() usage.
3590 * mode == 0 signals iscsi_target_rx_thread() usage.
3591 */
3592 if (mode == 1) {
3593 if (!conn->conn_tx_reset_cpumask)
3594 return;
3595 conn->conn_tx_reset_cpumask = 0;
3596 } else {
3597 if (!conn->conn_rx_reset_cpumask)
3598 return;
3599 conn->conn_rx_reset_cpumask = 0;
3600 }
3601 /*
3602 * Update the CPU mask for this single kthread so that
3603 * both TX and RX kthreads are scheduled to run on the
3604 * same CPU.
3605 */
3606 set_cpus_allowed_ptr(p, conn->conn_cpumask);
3607}
3608
3609static int 3583static int
3610iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state) 3584iscsit_immediate_queue(struct iscsi_conn *conn, struct iscsi_cmd *cmd, int state)
3611{ 3585{
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)
890} 890}
891 891
892extern struct iscsi_cmd *iscsit_find_cmd_from_itt(struct iscsi_conn *, itt_t); 892extern struct iscsi_cmd *iscsit_find_cmd_from_itt(struct iscsi_conn *, itt_t);
893
894static inline void iscsit_thread_check_cpumask(
895 struct iscsi_conn *conn,
896 struct task_struct *p,
897 int mode)
898{
899 /*
900 * mode == 1 signals iscsi_target_tx_thread() usage.
901 * mode == 0 signals iscsi_target_rx_thread() usage.
902 */
903 if (mode == 1) {
904 if (!conn->conn_tx_reset_cpumask)
905 return;
906 conn->conn_tx_reset_cpumask = 0;
907 } else {
908 if (!conn->conn_rx_reset_cpumask)
909 return;
910 conn->conn_rx_reset_cpumask = 0;
911 }
912 /*
913 * Update the CPU mask for this single kthread so that
914 * both TX and RX kthreads are scheduled to run on the
915 * same CPU.
916 */
917 set_cpus_allowed_ptr(p, conn->conn_cpumask);
918}
893#endif /* ISCSI_TARGET_CORE_H */ 919#endif /* ISCSI_TARGET_CORE_H */