diff options
| author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-06-07 20:38:58 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-09-09 17:29:16 -0400 |
| commit | c0add7fd05ff99c3a516c78eb6b1e6460a3efdae (patch) | |
| tree | 2aa45b7fe481134865e179caf631501bad811959 /include/target | |
| parent | 798ab48eecdf659df9ae0064ca5c62626c651827 (diff) | |
target: Add transport_init_session_tags using per-cpu ida
This patch adds lib/idr.c based transport_init_session_tags() logic
that allows fabric drivers to setup a per-cpu se_sess->sess_tag_pool
and associated se_sess->sess_cmd_map for basic tagged pre-allocation
of fabric descriptor sized memory.
v5 changes:
- Convert to percpu_ida.h include
v4 changes:
- Add transport_alloc_session_tags() for fabrics that need early
transport_init_session()
v3 changes:
- Update to percpu-ida usage
Cc: Kent Overstreet <kmo@daterainc.com>
Cc: Asias He <asias@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Asias He <asias@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
| -rw-r--r-- | include/target/target_core_base.h | 5 | ||||
| -rw-r--r-- | include/target/target_core_fabric.h | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index e34fc904f2e1..bd55acd43005 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/configfs.h> | 5 | #include <linux/configfs.h> |
| 6 | #include <linux/dma-mapping.h> | 6 | #include <linux/dma-mapping.h> |
| 7 | #include <linux/blkdev.h> | 7 | #include <linux/blkdev.h> |
| 8 | #include <linux/percpu_ida.h> | ||
| 8 | #include <scsi/scsi_cmnd.h> | 9 | #include <scsi/scsi_cmnd.h> |
| 9 | #include <net/sock.h> | 10 | #include <net/sock.h> |
| 10 | #include <net/tcp.h> | 11 | #include <net/tcp.h> |
| @@ -415,6 +416,8 @@ struct se_cmd { | |||
| 415 | enum dma_data_direction data_direction; | 416 | enum dma_data_direction data_direction; |
| 416 | /* For SAM Task Attribute */ | 417 | /* For SAM Task Attribute */ |
| 417 | int sam_task_attr; | 418 | int sam_task_attr; |
| 419 | /* Used for se_sess->sess_tag_pool */ | ||
| 420 | unsigned int map_tag; | ||
| 418 | /* Transport protocol dependent state, see transport_state_table */ | 421 | /* Transport protocol dependent state, see transport_state_table */ |
| 419 | enum transport_state_table t_state; | 422 | enum transport_state_table t_state; |
| 420 | unsigned cmd_wait_set:1; | 423 | unsigned cmd_wait_set:1; |
| @@ -536,6 +539,8 @@ struct se_session { | |||
| 536 | struct list_head sess_wait_list; | 539 | struct list_head sess_wait_list; |
| 537 | spinlock_t sess_cmd_lock; | 540 | spinlock_t sess_cmd_lock; |
| 538 | struct kref sess_kref; | 541 | struct kref sess_kref; |
| 542 | void *sess_cmd_map; | ||
| 543 | struct percpu_ida sess_tag_pool; | ||
| 539 | }; | 544 | }; |
| 540 | 545 | ||
| 541 | struct se_device; | 546 | struct se_device; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 7a16178424f9..d559c36692af 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
| @@ -84,6 +84,9 @@ struct target_core_fabric_ops { | |||
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | struct se_session *transport_init_session(void); | 86 | struct se_session *transport_init_session(void); |
| 87 | int transport_alloc_session_tags(struct se_session *, unsigned int, | ||
| 88 | unsigned int); | ||
| 89 | struct se_session *transport_init_session_tags(unsigned int, unsigned int); | ||
| 87 | void __transport_register_session(struct se_portal_group *, | 90 | void __transport_register_session(struct se_portal_group *, |
| 88 | struct se_node_acl *, struct se_session *, void *); | 91 | struct se_node_acl *, struct se_session *, void *); |
| 89 | void transport_register_session(struct se_portal_group *, | 92 | void transport_register_session(struct se_portal_group *, |
