aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-02-01 02:56:53 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2015-02-04 13:55:39 -0500
commit1a1ff8256af679c8a69c438d27644383ddcfcb3b (patch)
treec27771852c9d9364bd03897d5d5c46ceed660d61
parentf575c6123387e72d460add7391c4f8eaafb61ac2 (diff)
vhost/scsi: Global tcm_vhost -> vhost_scsi rename
There is a large amount of code that still references the original 'tcm_vhost' naming conventions, instead of modern 'vhost_scsi'. Go ahead and do a global rename to make the usage consistent. Cc: Michael S. Tsirkin <mst@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/vhost/scsi.c662
1 files changed, 331 insertions, 331 deletions
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 1a66fcfeb61c..daf10b7fa311 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -51,13 +51,13 @@
51 51
52#include "vhost.h" 52#include "vhost.h"
53 53
54#define TCM_VHOST_VERSION "v0.1" 54#define VHOST_SCSI_VERSION "v0.1"
55#define TCM_VHOST_NAMELEN 256 55#define VHOST_SCSI_NAMELEN 256
56#define TCM_VHOST_MAX_CDB_SIZE 32 56#define VHOST_SCSI_MAX_CDB_SIZE 32
57#define TCM_VHOST_DEFAULT_TAGS 256 57#define VHOST_SCSI_DEFAULT_TAGS 256
58#define TCM_VHOST_PREALLOC_SGLS 2048 58#define VHOST_SCSI_PREALLOC_SGLS 2048
59#define TCM_VHOST_PREALLOC_UPAGES 2048 59#define VHOST_SCSI_PREALLOC_UPAGES 2048
60#define TCM_VHOST_PREALLOC_PROT_SGLS 512 60#define VHOST_SCSI_PREALLOC_PROT_SGLS 512
61 61
62struct vhost_scsi_inflight { 62struct vhost_scsi_inflight {
63 /* Wait for the flush operation to finish */ 63 /* Wait for the flush operation to finish */
@@ -66,7 +66,7 @@ struct vhost_scsi_inflight {
66 struct kref kref; 66 struct kref kref;
67}; 67};
68 68
69struct tcm_vhost_cmd { 69struct vhost_scsi_cmd {
70 /* Descriptor from vhost_get_vq_desc() for virt_queue segment */ 70 /* Descriptor from vhost_get_vq_desc() for virt_queue segment */
71 int tvc_vq_desc; 71 int tvc_vq_desc;
72 /* virtio-scsi initiator task attribute */ 72 /* virtio-scsi initiator task attribute */
@@ -82,7 +82,7 @@ struct tcm_vhost_cmd {
82 /* The number of scatterlists associated with this cmd */ 82 /* The number of scatterlists associated with this cmd */
83 u32 tvc_sgl_count; 83 u32 tvc_sgl_count;
84 u32 tvc_prot_sgl_count; 84 u32 tvc_prot_sgl_count;
85 /* Saved unpacked SCSI LUN for tcm_vhost_submission_work() */ 85 /* Saved unpacked SCSI LUN for vhost_scsi_submission_work() */
86 u32 tvc_lun; 86 u32 tvc_lun;
87 /* Pointer to the SGL formatted memory from virtio-scsi */ 87 /* Pointer to the SGL formatted memory from virtio-scsi */
88 struct scatterlist *tvc_sgl; 88 struct scatterlist *tvc_sgl;
@@ -95,13 +95,13 @@ struct tcm_vhost_cmd {
95 /* Pointer to vhost_virtqueue for the cmd */ 95 /* Pointer to vhost_virtqueue for the cmd */
96 struct vhost_virtqueue *tvc_vq; 96 struct vhost_virtqueue *tvc_vq;
97 /* Pointer to vhost nexus memory */ 97 /* Pointer to vhost nexus memory */
98 struct tcm_vhost_nexus *tvc_nexus; 98 struct vhost_scsi_nexus *tvc_nexus;
99 /* The TCM I/O descriptor that is accessed via container_of() */ 99 /* The TCM I/O descriptor that is accessed via container_of() */
100 struct se_cmd tvc_se_cmd; 100 struct se_cmd tvc_se_cmd;
101 /* work item used for cmwq dispatch to tcm_vhost_submission_work() */ 101 /* work item used for cmwq dispatch to vhost_scsi_submission_work() */
102 struct work_struct work; 102 struct work_struct work;
103 /* Copy of the incoming SCSI command descriptor block (CDB) */ 103 /* Copy of the incoming SCSI command descriptor block (CDB) */
104 unsigned char tvc_cdb[TCM_VHOST_MAX_CDB_SIZE]; 104 unsigned char tvc_cdb[VHOST_SCSI_MAX_CDB_SIZE];
105 /* Sense buffer that will be mapped into outgoing status */ 105 /* Sense buffer that will be mapped into outgoing status */
106 unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER]; 106 unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER];
107 /* Completed commands list, serviced from vhost worker thread */ 107 /* Completed commands list, serviced from vhost worker thread */
@@ -110,53 +110,53 @@ struct tcm_vhost_cmd {
110 struct vhost_scsi_inflight *inflight; 110 struct vhost_scsi_inflight *inflight;
111}; 111};
112 112
113struct tcm_vhost_nexus { 113struct vhost_scsi_nexus {
114 /* Pointer to TCM session for I_T Nexus */ 114 /* Pointer to TCM session for I_T Nexus */
115 struct se_session *tvn_se_sess; 115 struct se_session *tvn_se_sess;
116}; 116};
117 117
118struct tcm_vhost_nacl { 118struct vhost_scsi_nacl {
119 /* Binary World Wide unique Port Name for Vhost Initiator port */ 119 /* Binary World Wide unique Port Name for Vhost Initiator port */
120 u64 iport_wwpn; 120 u64 iport_wwpn;
121 /* ASCII formatted WWPN for Sas Initiator port */ 121 /* ASCII formatted WWPN for Sas Initiator port */
122 char iport_name[TCM_VHOST_NAMELEN]; 122 char iport_name[VHOST_SCSI_NAMELEN];
123 /* Returned by tcm_vhost_make_nodeacl() */ 123 /* Returned by vhost_scsi_make_nodeacl() */
124 struct se_node_acl se_node_acl; 124 struct se_node_acl se_node_acl;
125}; 125};
126 126
127struct tcm_vhost_tpg { 127struct vhost_scsi_tpg {
128 /* Vhost port target portal group tag for TCM */ 128 /* Vhost port target portal group tag for TCM */
129 u16 tport_tpgt; 129 u16 tport_tpgt;
130 /* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus shutdown */ 130 /* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus shutdown */
131 int tv_tpg_port_count; 131 int tv_tpg_port_count;
132 /* Used for vhost_scsi device reference to tpg_nexus, protected by tv_tpg_mutex */ 132 /* Used for vhost_scsi device reference to tpg_nexus, protected by tv_tpg_mutex */
133 int tv_tpg_vhost_count; 133 int tv_tpg_vhost_count;
134 /* list for tcm_vhost_list */ 134 /* list for vhost_scsi_list */
135 struct list_head tv_tpg_list; 135 struct list_head tv_tpg_list;
136 /* Used to protect access for tpg_nexus */ 136 /* Used to protect access for tpg_nexus */
137 struct mutex tv_tpg_mutex; 137 struct mutex tv_tpg_mutex;
138 /* Pointer to the TCM VHost I_T Nexus for this TPG endpoint */ 138 /* Pointer to the TCM VHost I_T Nexus for this TPG endpoint */
139 struct tcm_vhost_nexus *tpg_nexus; 139 struct vhost_scsi_nexus *tpg_nexus;
140 /* Pointer back to tcm_vhost_tport */ 140 /* Pointer back to vhost_scsi_tport */
141 struct tcm_vhost_tport *tport; 141 struct vhost_scsi_tport *tport;
142 /* Returned by tcm_vhost_make_tpg() */ 142 /* Returned by vhost_scsi_make_tpg() */
143 struct se_portal_group se_tpg; 143 struct se_portal_group se_tpg;
144 /* Pointer back to vhost_scsi, protected by tv_tpg_mutex */ 144 /* Pointer back to vhost_scsi, protected by tv_tpg_mutex */
145 struct vhost_scsi *vhost_scsi; 145 struct vhost_scsi *vhost_scsi;
146}; 146};
147 147
148struct tcm_vhost_tport { 148struct vhost_scsi_tport {
149 /* SCSI protocol the tport is providing */ 149 /* SCSI protocol the tport is providing */
150 u8 tport_proto_id; 150 u8 tport_proto_id;
151 /* Binary World Wide unique Port Name for Vhost Target port */ 151 /* Binary World Wide unique Port Name for Vhost Target port */
152 u64 tport_wwpn; 152 u64 tport_wwpn;
153 /* ASCII formatted WWPN for Vhost Target port */ 153 /* ASCII formatted WWPN for Vhost Target port */
154 char tport_name[TCM_VHOST_NAMELEN]; 154 char tport_name[VHOST_SCSI_NAMELEN];
155 /* Returned by tcm_vhost_make_tport() */ 155 /* Returned by vhost_scsi_make_tport() */
156 struct se_wwn tport_wwn; 156 struct se_wwn tport_wwn;
157}; 157};
158 158
159struct tcm_vhost_evt { 159struct vhost_scsi_evt {
160 /* event to be sent to guest */ 160 /* event to be sent to guest */
161 struct virtio_scsi_event event; 161 struct virtio_scsi_event event;
162 /* event list, serviced from vhost worker thread */ 162 /* event list, serviced from vhost worker thread */
@@ -198,7 +198,7 @@ struct vhost_scsi_virtqueue {
198 198
199struct vhost_scsi { 199struct vhost_scsi {
200 /* Protected by vhost_scsi->dev.mutex */ 200 /* Protected by vhost_scsi->dev.mutex */
201 struct tcm_vhost_tpg **vs_tpg; 201 struct vhost_scsi_tpg **vs_tpg;
202 char vs_vhost_wwpn[TRANSPORT_IQN_LEN]; 202 char vs_vhost_wwpn[TRANSPORT_IQN_LEN];
203 203
204 struct vhost_dev dev; 204 struct vhost_dev dev;
@@ -215,13 +215,13 @@ struct vhost_scsi {
215}; 215};
216 216
217/* Local pointer to allocated TCM configfs fabric module */ 217/* Local pointer to allocated TCM configfs fabric module */
218static struct target_fabric_configfs *tcm_vhost_fabric_configfs; 218static struct target_fabric_configfs *vhost_scsi_fabric_configfs;
219 219
220static struct workqueue_struct *tcm_vhost_workqueue; 220static struct workqueue_struct *vhost_scsi_workqueue;
221 221
222/* Global spinlock to protect tcm_vhost TPG list for vhost IOCTL access */ 222/* Global spinlock to protect vhost_scsi TPG list for vhost IOCTL access */
223static DEFINE_MUTEX(tcm_vhost_mutex); 223static DEFINE_MUTEX(vhost_scsi_mutex);
224static LIST_HEAD(tcm_vhost_list); 224static LIST_HEAD(vhost_scsi_list);
225 225
226static int iov_num_pages(void __user *iov_base, size_t iov_len) 226static int iov_num_pages(void __user *iov_base, size_t iov_len)
227{ 227{
@@ -229,7 +229,7 @@ static int iov_num_pages(void __user *iov_base, size_t iov_len)
229 ((unsigned long)iov_base & PAGE_MASK)) >> PAGE_SHIFT; 229 ((unsigned long)iov_base & PAGE_MASK)) >> PAGE_SHIFT;
230} 230}
231 231
232static void tcm_vhost_done_inflight(struct kref *kref) 232static void vhost_scsi_done_inflight(struct kref *kref)
233{ 233{
234 struct vhost_scsi_inflight *inflight; 234 struct vhost_scsi_inflight *inflight;
235 235
@@ -237,7 +237,7 @@ static void tcm_vhost_done_inflight(struct kref *kref)
237 complete(&inflight->comp); 237 complete(&inflight->comp);
238} 238}
239 239
240static void tcm_vhost_init_inflight(struct vhost_scsi *vs, 240static void vhost_scsi_init_inflight(struct vhost_scsi *vs,
241 struct vhost_scsi_inflight *old_inflight[]) 241 struct vhost_scsi_inflight *old_inflight[])
242{ 242{
243 struct vhost_scsi_inflight *new_inflight; 243 struct vhost_scsi_inflight *new_inflight;
@@ -265,7 +265,7 @@ static void tcm_vhost_init_inflight(struct vhost_scsi *vs,
265} 265}
266 266
267static struct vhost_scsi_inflight * 267static struct vhost_scsi_inflight *
268tcm_vhost_get_inflight(struct vhost_virtqueue *vq) 268vhost_scsi_get_inflight(struct vhost_virtqueue *vq)
269{ 269{
270 struct vhost_scsi_inflight *inflight; 270 struct vhost_scsi_inflight *inflight;
271 struct vhost_scsi_virtqueue *svq; 271 struct vhost_scsi_virtqueue *svq;
@@ -277,31 +277,31 @@ tcm_vhost_get_inflight(struct vhost_virtqueue *vq)
277 return inflight; 277 return inflight;
278} 278}
279 279
280static void tcm_vhost_put_inflight(struct vhost_scsi_inflight *inflight) 280static void vhost_scsi_put_inflight(struct vhost_scsi_inflight *inflight)
281{ 281{
282 kref_put(&inflight->kref, tcm_vhost_done_inflight); 282 kref_put(&inflight->kref, vhost_scsi_done_inflight);
283} 283}
284 284
285static int tcm_vhost_check_true(struct se_portal_group *se_tpg) 285static int vhost_scsi_check_true(struct se_portal_group *se_tpg)
286{ 286{
287 return 1; 287 return 1;
288} 288}
289 289
290static int tcm_vhost_check_false(struct se_portal_group *se_tpg) 290static int vhost_scsi_check_false(struct se_portal_group *se_tpg)
291{ 291{
292 return 0; 292 return 0;
293} 293}
294 294
295static char *tcm_vhost_get_fabric_name(void) 295static char *vhost_scsi_get_fabric_name(void)
296{ 296{
297 return "vhost"; 297 return "vhost";
298} 298}
299 299
300static u8 tcm_vhost_get_fabric_proto_ident(struct se_portal_group *se_tpg) 300static u8 vhost_scsi_get_fabric_proto_ident(struct se_portal_group *se_tpg)
301{ 301{
302 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 302 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
303 struct tcm_vhost_tpg, se_tpg); 303 struct vhost_scsi_tpg, se_tpg);
304 struct tcm_vhost_tport *tport = tpg->tport; 304 struct vhost_scsi_tport *tport = tpg->tport;
305 305
306 switch (tport->tport_proto_id) { 306 switch (tport->tport_proto_id) {
307 case SCSI_PROTOCOL_SAS: 307 case SCSI_PROTOCOL_SAS:
@@ -319,37 +319,37 @@ static u8 tcm_vhost_get_fabric_proto_ident(struct se_portal_group *se_tpg)
319 return sas_get_fabric_proto_ident(se_tpg); 319 return sas_get_fabric_proto_ident(se_tpg);
320} 320}
321 321
322static char *tcm_vhost_get_fabric_wwn(struct se_portal_group *se_tpg) 322static char *vhost_scsi_get_fabric_wwn(struct se_portal_group *se_tpg)
323{ 323{
324 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 324 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
325 struct tcm_vhost_tpg, se_tpg); 325 struct vhost_scsi_tpg, se_tpg);
326 struct tcm_vhost_tport *tport = tpg->tport; 326 struct vhost_scsi_tport *tport = tpg->tport;
327 327
328 return &tport->tport_name[0]; 328 return &tport->tport_name[0];
329} 329}
330 330
331static u16 tcm_vhost_get_tag(struct se_portal_group *se_tpg) 331static u16 vhost_scsi_get_tpgt(struct se_portal_group *se_tpg)
332{ 332{
333 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 333 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
334 struct tcm_vhost_tpg, se_tpg); 334 struct vhost_scsi_tpg, se_tpg);
335 return tpg->tport_tpgt; 335 return tpg->tport_tpgt;
336} 336}
337 337
338static u32 tcm_vhost_get_default_depth(struct se_portal_group *se_tpg) 338static u32 vhost_scsi_get_default_depth(struct se_portal_group *se_tpg)
339{ 339{
340 return 1; 340 return 1;
341} 341}
342 342
343static u32 343static u32
344tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg, 344vhost_scsi_get_pr_transport_id(struct se_portal_group *se_tpg,
345 struct se_node_acl *se_nacl, 345 struct se_node_acl *se_nacl,
346 struct t10_pr_registration *pr_reg, 346 struct t10_pr_registration *pr_reg,
347 int *format_code, 347 int *format_code,
348 unsigned char *buf) 348 unsigned char *buf)
349{ 349{
350 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 350 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
351 struct tcm_vhost_tpg, se_tpg); 351 struct vhost_scsi_tpg, se_tpg);
352 struct tcm_vhost_tport *tport = tpg->tport; 352 struct vhost_scsi_tport *tport = tpg->tport;
353 353
354 switch (tport->tport_proto_id) { 354 switch (tport->tport_proto_id) {
355 case SCSI_PROTOCOL_SAS: 355 case SCSI_PROTOCOL_SAS:
@@ -372,14 +372,14 @@ tcm_vhost_get_pr_transport_id(struct se_portal_group *se_tpg,
372} 372}
373 373
374static u32 374static u32
375tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg, 375vhost_scsi_get_pr_transport_id_len(struct se_portal_group *se_tpg,
376 struct se_node_acl *se_nacl, 376 struct se_node_acl *se_nacl,
377 struct t10_pr_registration *pr_reg, 377 struct t10_pr_registration *pr_reg,
378 int *format_code) 378 int *format_code)
379{ 379{
380 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 380 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
381 struct tcm_vhost_tpg, se_tpg); 381 struct vhost_scsi_tpg, se_tpg);
382 struct tcm_vhost_tport *tport = tpg->tport; 382 struct vhost_scsi_tport *tport = tpg->tport;
383 383
384 switch (tport->tport_proto_id) { 384 switch (tport->tport_proto_id) {
385 case SCSI_PROTOCOL_SAS: 385 case SCSI_PROTOCOL_SAS:
@@ -402,14 +402,14 @@ tcm_vhost_get_pr_transport_id_len(struct se_portal_group *se_tpg,
402} 402}
403 403
404static char * 404static char *
405tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg, 405vhost_scsi_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
406 const char *buf, 406 const char *buf,
407 u32 *out_tid_len, 407 u32 *out_tid_len,
408 char **port_nexus_ptr) 408 char **port_nexus_ptr)
409{ 409{
410 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 410 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
411 struct tcm_vhost_tpg, se_tpg); 411 struct vhost_scsi_tpg, se_tpg);
412 struct tcm_vhost_tport *tport = tpg->tport; 412 struct vhost_scsi_tport *tport = tpg->tport;
413 413
414 switch (tport->tport_proto_id) { 414 switch (tport->tport_proto_id) {
415 case SCSI_PROTOCOL_SAS: 415 case SCSI_PROTOCOL_SAS:
@@ -432,13 +432,13 @@ tcm_vhost_parse_pr_out_transport_id(struct se_portal_group *se_tpg,
432} 432}
433 433
434static struct se_node_acl * 434static struct se_node_acl *
435tcm_vhost_alloc_fabric_acl(struct se_portal_group *se_tpg) 435vhost_scsi_alloc_fabric_acl(struct se_portal_group *se_tpg)
436{ 436{
437 struct tcm_vhost_nacl *nacl; 437 struct vhost_scsi_nacl *nacl;
438 438
439 nacl = kzalloc(sizeof(struct tcm_vhost_nacl), GFP_KERNEL); 439 nacl = kzalloc(sizeof(struct vhost_scsi_nacl), GFP_KERNEL);
440 if (!nacl) { 440 if (!nacl) {
441 pr_err("Unable to allocate struct tcm_vhost_nacl\n"); 441 pr_err("Unable to allocate struct vhost_scsi_nacl\n");
442 return NULL; 442 return NULL;
443 } 443 }
444 444
@@ -446,23 +446,23 @@ tcm_vhost_alloc_fabric_acl(struct se_portal_group *se_tpg)
446} 446}
447 447
448static void 448static void
449tcm_vhost_release_fabric_acl(struct se_portal_group *se_tpg, 449vhost_scsi_release_fabric_acl(struct se_portal_group *se_tpg,
450 struct se_node_acl *se_nacl) 450 struct se_node_acl *se_nacl)
451{ 451{
452 struct tcm_vhost_nacl *nacl = container_of(se_nacl, 452 struct vhost_scsi_nacl *nacl = container_of(se_nacl,
453 struct tcm_vhost_nacl, se_node_acl); 453 struct vhost_scsi_nacl, se_node_acl);
454 kfree(nacl); 454 kfree(nacl);
455} 455}
456 456
457static u32 tcm_vhost_tpg_get_inst_index(struct se_portal_group *se_tpg) 457static u32 vhost_scsi_tpg_get_inst_index(struct se_portal_group *se_tpg)
458{ 458{
459 return 1; 459 return 1;
460} 460}
461 461
462static void tcm_vhost_release_cmd(struct se_cmd *se_cmd) 462static void vhost_scsi_release_cmd(struct se_cmd *se_cmd)
463{ 463{
464 struct tcm_vhost_cmd *tv_cmd = container_of(se_cmd, 464 struct vhost_scsi_cmd *tv_cmd = container_of(se_cmd,
465 struct tcm_vhost_cmd, tvc_se_cmd); 465 struct vhost_scsi_cmd, tvc_se_cmd);
466 struct se_session *se_sess = tv_cmd->tvc_nexus->tvn_se_sess; 466 struct se_session *se_sess = tv_cmd->tvc_nexus->tvn_se_sess;
467 int i; 467 int i;
468 468
@@ -475,53 +475,53 @@ static void tcm_vhost_release_cmd(struct se_cmd *se_cmd)
475 put_page(sg_page(&tv_cmd->tvc_prot_sgl[i])); 475 put_page(sg_page(&tv_cmd->tvc_prot_sgl[i]));
476 } 476 }
477 477
478 tcm_vhost_put_inflight(tv_cmd->inflight); 478 vhost_scsi_put_inflight(tv_cmd->inflight);
479 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag); 479 percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
480} 480}
481 481
482static int tcm_vhost_shutdown_session(struct se_session *se_sess) 482static int vhost_scsi_shutdown_session(struct se_session *se_sess)
483{ 483{
484 return 0; 484 return 0;
485} 485}
486 486
487static void tcm_vhost_close_session(struct se_session *se_sess) 487static void vhost_scsi_close_session(struct se_session *se_sess)
488{ 488{
489 return; 489 return;
490} 490}
491 491
492static u32 tcm_vhost_sess_get_index(struct se_session *se_sess) 492static u32 vhost_scsi_sess_get_index(struct se_session *se_sess)
493{ 493{
494 return 0; 494 return 0;
495} 495}
496 496
497static int tcm_vhost_write_pending(struct se_cmd *se_cmd) 497static int vhost_scsi_write_pending(struct se_cmd *se_cmd)
498{ 498{
499 /* Go ahead and process the write immediately */ 499 /* Go ahead and process the write immediately */
500 target_execute_cmd(se_cmd); 500 target_execute_cmd(se_cmd);
501 return 0; 501 return 0;
502} 502}
503 503
504static int tcm_vhost_write_pending_status(struct se_cmd *se_cmd) 504static int vhost_scsi_write_pending_status(struct se_cmd *se_cmd)
505{ 505{
506 return 0; 506 return 0;
507} 507}
508 508
509static void tcm_vhost_set_default_node_attrs(struct se_node_acl *nacl) 509static void vhost_scsi_set_default_node_attrs(struct se_node_acl *nacl)
510{ 510{
511 return; 511 return;
512} 512}
513 513
514static u32 tcm_vhost_get_task_tag(struct se_cmd *se_cmd) 514static u32 vhost_scsi_get_task_tag(struct se_cmd *se_cmd)
515{ 515{
516 return 0; 516 return 0;
517} 517}
518 518
519static int tcm_vhost_get_cmd_state(struct se_cmd *se_cmd) 519static int vhost_scsi_get_cmd_state(struct se_cmd *se_cmd)
520{ 520{
521 return 0; 521 return 0;
522} 522}
523 523
524static void vhost_scsi_complete_cmd(struct tcm_vhost_cmd *cmd) 524static void vhost_scsi_complete_cmd(struct vhost_scsi_cmd *cmd)
525{ 525{
526 struct vhost_scsi *vs = cmd->tvc_vhost; 526 struct vhost_scsi *vs = cmd->tvc_vhost;
527 527
@@ -530,44 +530,44 @@ static void vhost_scsi_complete_cmd(struct tcm_vhost_cmd *cmd)
530 vhost_work_queue(&vs->dev, &vs->vs_completion_work); 530 vhost_work_queue(&vs->dev, &vs->vs_completion_work);
531} 531}
532 532
533static int tcm_vhost_queue_data_in(struct se_cmd *se_cmd) 533static int vhost_scsi_queue_data_in(struct se_cmd *se_cmd)
534{ 534{
535 struct tcm_vhost_cmd *cmd = container_of(se_cmd, 535 struct vhost_scsi_cmd *cmd = container_of(se_cmd,
536 struct tcm_vhost_cmd, tvc_se_cmd); 536 struct vhost_scsi_cmd, tvc_se_cmd);
537 vhost_scsi_complete_cmd(cmd); 537 vhost_scsi_complete_cmd(cmd);
538 return 0; 538 return 0;
539} 539}
540 540
541static int tcm_vhost_queue_status(struct se_cmd *se_cmd) 541static int vhost_scsi_queue_status(struct se_cmd *se_cmd)
542{ 542{
543 struct tcm_vhost_cmd *cmd = container_of(se_cmd, 543 struct vhost_scsi_cmd *cmd = container_of(se_cmd,
544 struct tcm_vhost_cmd, tvc_se_cmd); 544 struct vhost_scsi_cmd, tvc_se_cmd);
545 vhost_scsi_complete_cmd(cmd); 545 vhost_scsi_complete_cmd(cmd);
546 return 0; 546 return 0;
547} 547}
548 548
549static void tcm_vhost_queue_tm_rsp(struct se_cmd *se_cmd) 549static void vhost_scsi_queue_tm_rsp(struct se_cmd *se_cmd)
550{ 550{
551 return; 551 return;
552} 552}
553 553
554static void tcm_vhost_aborted_task(struct se_cmd *se_cmd) 554static void vhost_scsi_aborted_task(struct se_cmd *se_cmd)
555{ 555{
556 return; 556 return;
557} 557}
558 558
559static void tcm_vhost_free_evt(struct vhost_scsi *vs, struct tcm_vhost_evt *evt) 559static void vhost_scsi_free_evt(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
560{ 560{
561 vs->vs_events_nr--; 561 vs->vs_events_nr--;
562 kfree(evt); 562 kfree(evt);
563} 563}
564 564
565static struct tcm_vhost_evt * 565static struct vhost_scsi_evt *
566tcm_vhost_allocate_evt(struct vhost_scsi *vs, 566vhost_scsi_allocate_evt(struct vhost_scsi *vs,
567 u32 event, u32 reason) 567 u32 event, u32 reason)
568{ 568{
569 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 569 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
570 struct tcm_vhost_evt *evt; 570 struct vhost_scsi_evt *evt;
571 571
572 if (vs->vs_events_nr > VHOST_SCSI_MAX_EVENT) { 572 if (vs->vs_events_nr > VHOST_SCSI_MAX_EVENT) {
573 vs->vs_events_missed = true; 573 vs->vs_events_missed = true;
@@ -576,7 +576,7 @@ tcm_vhost_allocate_evt(struct vhost_scsi *vs,
576 576
577 evt = kzalloc(sizeof(*evt), GFP_KERNEL); 577 evt = kzalloc(sizeof(*evt), GFP_KERNEL);
578 if (!evt) { 578 if (!evt) {
579 vq_err(vq, "Failed to allocate tcm_vhost_evt\n"); 579 vq_err(vq, "Failed to allocate vhost_scsi_evt\n");
580 vs->vs_events_missed = true; 580 vs->vs_events_missed = true;
581 return NULL; 581 return NULL;
582 } 582 }
@@ -588,7 +588,7 @@ tcm_vhost_allocate_evt(struct vhost_scsi *vs,
588 return evt; 588 return evt;
589} 589}
590 590
591static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *cmd) 591static void vhost_scsi_free_cmd(struct vhost_scsi_cmd *cmd)
592{ 592{
593 struct se_cmd *se_cmd = &cmd->tvc_se_cmd; 593 struct se_cmd *se_cmd = &cmd->tvc_se_cmd;
594 594
@@ -603,7 +603,7 @@ static int vhost_scsi_check_stop_free(struct se_cmd *se_cmd)
603} 603}
604 604
605static void 605static void
606tcm_vhost_do_evt_work(struct vhost_scsi *vs, struct tcm_vhost_evt *evt) 606vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
607{ 607{
608 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 608 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
609 struct virtio_scsi_event *event = &evt->event; 609 struct virtio_scsi_event *event = &evt->event;
@@ -649,24 +649,24 @@ again:
649 if (!ret) 649 if (!ret)
650 vhost_add_used_and_signal(&vs->dev, vq, head, 0); 650 vhost_add_used_and_signal(&vs->dev, vq, head, 0);
651 else 651 else
652 vq_err(vq, "Faulted on tcm_vhost_send_event\n"); 652 vq_err(vq, "Faulted on vhost_scsi_send_event\n");
653} 653}
654 654
655static void tcm_vhost_evt_work(struct vhost_work *work) 655static void vhost_scsi_evt_work(struct vhost_work *work)
656{ 656{
657 struct vhost_scsi *vs = container_of(work, struct vhost_scsi, 657 struct vhost_scsi *vs = container_of(work, struct vhost_scsi,
658 vs_event_work); 658 vs_event_work);
659 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 659 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
660 struct tcm_vhost_evt *evt; 660 struct vhost_scsi_evt *evt;
661 struct llist_node *llnode; 661 struct llist_node *llnode;
662 662
663 mutex_lock(&vq->mutex); 663 mutex_lock(&vq->mutex);
664 llnode = llist_del_all(&vs->vs_event_list); 664 llnode = llist_del_all(&vs->vs_event_list);
665 while (llnode) { 665 while (llnode) {
666 evt = llist_entry(llnode, struct tcm_vhost_evt, list); 666 evt = llist_entry(llnode, struct vhost_scsi_evt, list);
667 llnode = llist_next(llnode); 667 llnode = llist_next(llnode);
668 tcm_vhost_do_evt_work(vs, evt); 668 vhost_scsi_do_evt_work(vs, evt);
669 tcm_vhost_free_evt(vs, evt); 669 vhost_scsi_free_evt(vs, evt);
670 } 670 }
671 mutex_unlock(&vq->mutex); 671 mutex_unlock(&vq->mutex);
672} 672}
@@ -682,7 +682,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
682 vs_completion_work); 682 vs_completion_work);
683 DECLARE_BITMAP(signal, VHOST_SCSI_MAX_VQ); 683 DECLARE_BITMAP(signal, VHOST_SCSI_MAX_VQ);
684 struct virtio_scsi_cmd_resp v_rsp; 684 struct virtio_scsi_cmd_resp v_rsp;
685 struct tcm_vhost_cmd *cmd; 685 struct vhost_scsi_cmd *cmd;
686 struct llist_node *llnode; 686 struct llist_node *llnode;
687 struct se_cmd *se_cmd; 687 struct se_cmd *se_cmd;
688 struct iov_iter iov_iter; 688 struct iov_iter iov_iter;
@@ -691,7 +691,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
691 bitmap_zero(signal, VHOST_SCSI_MAX_VQ); 691 bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
692 llnode = llist_del_all(&vs->vs_completion_list); 692 llnode = llist_del_all(&vs->vs_completion_list);
693 while (llnode) { 693 while (llnode) {
694 cmd = llist_entry(llnode, struct tcm_vhost_cmd, 694 cmd = llist_entry(llnode, struct vhost_scsi_cmd,
695 tvc_completion_list); 695 tvc_completion_list);
696 llnode = llist_next(llnode); 696 llnode = llist_next(llnode);
697 se_cmd = &cmd->tvc_se_cmd; 697 se_cmd = &cmd->tvc_se_cmd;
@@ -729,13 +729,13 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
729 vhost_signal(&vs->dev, &vs->vqs[vq].vq); 729 vhost_signal(&vs->dev, &vs->vqs[vq].vq);
730} 730}
731 731
732static struct tcm_vhost_cmd * 732static struct vhost_scsi_cmd *
733vhost_scsi_get_tag(struct vhost_virtqueue *vq, struct tcm_vhost_tpg *tpg, 733vhost_scsi_get_tag(struct vhost_virtqueue *vq, struct vhost_scsi_tpg *tpg,
734 unsigned char *cdb, u64 scsi_tag, u16 lun, u8 task_attr, 734 unsigned char *cdb, u64 scsi_tag, u16 lun, u8 task_attr,
735 u32 exp_data_len, int data_direction) 735 u32 exp_data_len, int data_direction)
736{ 736{
737 struct tcm_vhost_cmd *cmd; 737 struct vhost_scsi_cmd *cmd;
738 struct tcm_vhost_nexus *tv_nexus; 738 struct vhost_scsi_nexus *tv_nexus;
739 struct se_session *se_sess; 739 struct se_session *se_sess;
740 struct scatterlist *sg, *prot_sg; 740 struct scatterlist *sg, *prot_sg;
741 struct page **pages; 741 struct page **pages;
@@ -743,22 +743,22 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, struct tcm_vhost_tpg *tpg,
743 743
744 tv_nexus = tpg->tpg_nexus; 744 tv_nexus = tpg->tpg_nexus;
745 if (!tv_nexus) { 745 if (!tv_nexus) {
746 pr_err("Unable to locate active struct tcm_vhost_nexus\n"); 746 pr_err("Unable to locate active struct vhost_scsi_nexus\n");
747 return ERR_PTR(-EIO); 747 return ERR_PTR(-EIO);
748 } 748 }
749 se_sess = tv_nexus->tvn_se_sess; 749 se_sess = tv_nexus->tvn_se_sess;
750 750
751 tag = percpu_ida_alloc(&se_sess->sess_tag_pool, TASK_RUNNING); 751 tag = percpu_ida_alloc(&se_sess->sess_tag_pool, TASK_RUNNING);
752 if (tag < 0) { 752 if (tag < 0) {
753 pr_err("Unable to obtain tag for tcm_vhost_cmd\n"); 753 pr_err("Unable to obtain tag for vhost_scsi_cmd\n");
754 return ERR_PTR(-ENOMEM); 754 return ERR_PTR(-ENOMEM);
755 } 755 }
756 756
757 cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag]; 757 cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[tag];
758 sg = cmd->tvc_sgl; 758 sg = cmd->tvc_sgl;
759 prot_sg = cmd->tvc_prot_sgl; 759 prot_sg = cmd->tvc_prot_sgl;
760 pages = cmd->tvc_upages; 760 pages = cmd->tvc_upages;
761 memset(cmd, 0, sizeof(struct tcm_vhost_cmd)); 761 memset(cmd, 0, sizeof(struct vhost_scsi_cmd));
762 762
763 cmd->tvc_sgl = sg; 763 cmd->tvc_sgl = sg;
764 cmd->tvc_prot_sgl = prot_sg; 764 cmd->tvc_prot_sgl = prot_sg;
@@ -770,9 +770,9 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, struct tcm_vhost_tpg *tpg,
770 cmd->tvc_exp_data_len = exp_data_len; 770 cmd->tvc_exp_data_len = exp_data_len;
771 cmd->tvc_data_direction = data_direction; 771 cmd->tvc_data_direction = data_direction;
772 cmd->tvc_nexus = tv_nexus; 772 cmd->tvc_nexus = tv_nexus;
773 cmd->inflight = tcm_vhost_get_inflight(vq); 773 cmd->inflight = vhost_scsi_get_inflight(vq);
774 774
775 memcpy(cmd->tvc_cdb, cdb, TCM_VHOST_MAX_CDB_SIZE); 775 memcpy(cmd->tvc_cdb, cdb, VHOST_SCSI_MAX_CDB_SIZE);
776 776
777 return cmd; 777 return cmd;
778} 778}
@@ -783,7 +783,7 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, struct tcm_vhost_tpg *tpg,
783 * Returns the number of scatterlist entries used or -errno on error. 783 * Returns the number of scatterlist entries used or -errno on error.
784 */ 784 */
785static int 785static int
786vhost_scsi_map_to_sgl(struct tcm_vhost_cmd *cmd, 786vhost_scsi_map_to_sgl(struct vhost_scsi_cmd *cmd,
787 void __user *ptr, 787 void __user *ptr,
788 size_t len, 788 size_t len,
789 struct scatterlist *sgl, 789 struct scatterlist *sgl,
@@ -795,10 +795,10 @@ vhost_scsi_map_to_sgl(struct tcm_vhost_cmd *cmd,
795 struct page **pages = cmd->tvc_upages; 795 struct page **pages = cmd->tvc_upages;
796 int ret, i; 796 int ret, i;
797 797
798 if (pages_nr > TCM_VHOST_PREALLOC_UPAGES) { 798 if (pages_nr > VHOST_SCSI_PREALLOC_UPAGES) {
799 pr_err("vhost_scsi_map_to_sgl() pages_nr: %u greater than" 799 pr_err("vhost_scsi_map_to_sgl() pages_nr: %u greater than"
800 " preallocated TCM_VHOST_PREALLOC_UPAGES: %u\n", 800 " preallocated VHOST_SCSI_PREALLOC_UPAGES: %u\n",
801 pages_nr, TCM_VHOST_PREALLOC_UPAGES); 801 pages_nr, VHOST_SCSI_PREALLOC_UPAGES);
802 return -ENOBUFS; 802 return -ENOBUFS;
803 } 803 }
804 804
@@ -849,9 +849,9 @@ vhost_scsi_calc_sgls(struct iov_iter *iter, size_t bytes, int max_sgls)
849} 849}
850 850
851static int 851static int
852vhost_scsi_iov_to_sgl(struct tcm_vhost_cmd *cmd, bool write, 852vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, bool write,
853 struct iov_iter *iter, struct scatterlist *sg, 853 struct iov_iter *iter,
854 int sg_count) 854 struct scatterlist *sg, int sg_count)
855{ 855{
856 size_t off = iter->iov_offset; 856 size_t off = iter->iov_offset;
857 int i, ret; 857 int i, ret;
@@ -876,7 +876,7 @@ vhost_scsi_iov_to_sgl(struct tcm_vhost_cmd *cmd, bool write,
876} 876}
877 877
878static int 878static int
879vhost_scsi_mapal(struct tcm_vhost_cmd *cmd, 879vhost_scsi_mapal(struct vhost_scsi_cmd *cmd,
880 size_t prot_bytes, struct iov_iter *prot_iter, 880 size_t prot_bytes, struct iov_iter *prot_iter,
881 size_t data_bytes, struct iov_iter *data_iter) 881 size_t data_bytes, struct iov_iter *data_iter)
882{ 882{
@@ -885,7 +885,7 @@ vhost_scsi_mapal(struct tcm_vhost_cmd *cmd,
885 885
886 if (prot_bytes) { 886 if (prot_bytes) {
887 sgl_count = vhost_scsi_calc_sgls(prot_iter, prot_bytes, 887 sgl_count = vhost_scsi_calc_sgls(prot_iter, prot_bytes,
888 TCM_VHOST_PREALLOC_PROT_SGLS); 888 VHOST_SCSI_PREALLOC_PROT_SGLS);
889 if (sgl_count < 0) 889 if (sgl_count < 0)
890 return sgl_count; 890 return sgl_count;
891 891
@@ -903,7 +903,7 @@ vhost_scsi_mapal(struct tcm_vhost_cmd *cmd,
903 } 903 }
904 } 904 }
905 sgl_count = vhost_scsi_calc_sgls(data_iter, data_bytes, 905 sgl_count = vhost_scsi_calc_sgls(data_iter, data_bytes,
906 TCM_VHOST_PREALLOC_SGLS); 906 VHOST_SCSI_PREALLOC_SGLS);
907 if (sgl_count < 0) 907 if (sgl_count < 0)
908 return sgl_count; 908 return sgl_count;
909 909
@@ -921,11 +921,11 @@ vhost_scsi_mapal(struct tcm_vhost_cmd *cmd,
921 return 0; 921 return 0;
922} 922}
923 923
924static void tcm_vhost_submission_work(struct work_struct *work) 924static void vhost_scsi_submission_work(struct work_struct *work)
925{ 925{
926 struct tcm_vhost_cmd *cmd = 926 struct vhost_scsi_cmd *cmd =
927 container_of(work, struct tcm_vhost_cmd, work); 927 container_of(work, struct vhost_scsi_cmd, work);
928 struct tcm_vhost_nexus *tv_nexus; 928 struct vhost_scsi_nexus *tv_nexus;
929 struct se_cmd *se_cmd = &cmd->tvc_se_cmd; 929 struct se_cmd *se_cmd = &cmd->tvc_se_cmd;
930 struct scatterlist *sg_ptr, *sg_prot_ptr = NULL; 930 struct scatterlist *sg_ptr, *sg_prot_ptr = NULL;
931 int rc; 931 int rc;
@@ -978,10 +978,10 @@ vhost_scsi_send_bad_target(struct vhost_scsi *vs,
978static void 978static void
979vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) 979vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
980{ 980{
981 struct tcm_vhost_tpg **vs_tpg, *tpg; 981 struct vhost_scsi_tpg **vs_tpg, *tpg;
982 struct virtio_scsi_cmd_req v_req; 982 struct virtio_scsi_cmd_req v_req;
983 struct virtio_scsi_cmd_req_pi v_req_pi; 983 struct virtio_scsi_cmd_req_pi v_req_pi;
984 struct tcm_vhost_cmd *cmd; 984 struct vhost_scsi_cmd *cmd;
985 struct iov_iter out_iter, in_iter, prot_iter, data_iter; 985 struct iov_iter out_iter, in_iter, prot_iter, data_iter;
986 u64 tag; 986 u64 tag;
987 u32 exp_data_len, data_direction; 987 u32 exp_data_len, data_direction;
@@ -1168,10 +1168,10 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
1168 * 1168 *
1169 * TODO what if cdb was too small for varlen cdb header? 1169 * TODO what if cdb was too small for varlen cdb header?
1170 */ 1170 */
1171 if (unlikely(scsi_command_size(cdb) > TCM_VHOST_MAX_CDB_SIZE)) { 1171 if (unlikely(scsi_command_size(cdb) > VHOST_SCSI_MAX_CDB_SIZE)) {
1172 vq_err(vq, "Received SCSI CDB with command_size: %d that" 1172 vq_err(vq, "Received SCSI CDB with command_size: %d that"
1173 " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", 1173 " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n",
1174 scsi_command_size(cdb), TCM_VHOST_MAX_CDB_SIZE); 1174 scsi_command_size(cdb), VHOST_SCSI_MAX_CDB_SIZE);
1175 vhost_scsi_send_bad_target(vs, vq, head, out); 1175 vhost_scsi_send_bad_target(vs, vq, head, out);
1176 continue; 1176 continue;
1177 } 1177 }
@@ -1200,7 +1200,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
1200 exp_data_len, &data_iter); 1200 exp_data_len, &data_iter);
1201 if (unlikely(ret)) { 1201 if (unlikely(ret)) {
1202 vq_err(vq, "Failed to map iov to sgl\n"); 1202 vq_err(vq, "Failed to map iov to sgl\n");
1203 tcm_vhost_release_cmd(&cmd->tvc_se_cmd); 1203 vhost_scsi_release_cmd(&cmd->tvc_se_cmd);
1204 vhost_scsi_send_bad_target(vs, vq, head, out); 1204 vhost_scsi_send_bad_target(vs, vq, head, out);
1205 continue; 1205 continue;
1206 } 1206 }
@@ -1217,8 +1217,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
1217 * cmd is executed on the same kworker CPU as this vhost 1217 * cmd is executed on the same kworker CPU as this vhost
1218 * thread to gain positive L2 cache locality effects. 1218 * thread to gain positive L2 cache locality effects.
1219 */ 1219 */
1220 INIT_WORK(&cmd->work, tcm_vhost_submission_work); 1220 INIT_WORK(&cmd->work, vhost_scsi_submission_work);
1221 queue_work(tcm_vhost_workqueue, &cmd->work); 1221 queue_work(vhost_scsi_workqueue, &cmd->work);
1222 } 1222 }
1223out: 1223out:
1224 mutex_unlock(&vq->mutex); 1224 mutex_unlock(&vq->mutex);
@@ -1230,15 +1230,15 @@ static void vhost_scsi_ctl_handle_kick(struct vhost_work *work)
1230} 1230}
1231 1231
1232static void 1232static void
1233tcm_vhost_send_evt(struct vhost_scsi *vs, 1233vhost_scsi_send_evt(struct vhost_scsi *vs,
1234 struct tcm_vhost_tpg *tpg, 1234 struct vhost_scsi_tpg *tpg,
1235 struct se_lun *lun, 1235 struct se_lun *lun,
1236 u32 event, 1236 u32 event,
1237 u32 reason) 1237 u32 reason)
1238{ 1238{
1239 struct tcm_vhost_evt *evt; 1239 struct vhost_scsi_evt *evt;
1240 1240
1241 evt = tcm_vhost_allocate_evt(vs, event, reason); 1241 evt = vhost_scsi_allocate_evt(vs, event, reason);
1242 if (!evt) 1242 if (!evt)
1243 return; 1243 return;
1244 1244
@@ -1270,7 +1270,7 @@ static void vhost_scsi_evt_handle_kick(struct vhost_work *work)
1270 goto out; 1270 goto out;
1271 1271
1272 if (vs->vs_events_missed) 1272 if (vs->vs_events_missed)
1273 tcm_vhost_send_evt(vs, NULL, NULL, VIRTIO_SCSI_T_NO_EVENT, 0); 1273 vhost_scsi_send_evt(vs, NULL, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
1274out: 1274out:
1275 mutex_unlock(&vq->mutex); 1275 mutex_unlock(&vq->mutex);
1276} 1276}
@@ -1296,7 +1296,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)
1296 int i; 1296 int i;
1297 1297
1298 /* Init new inflight and remember the old inflight */ 1298 /* Init new inflight and remember the old inflight */
1299 tcm_vhost_init_inflight(vs, old_inflight); 1299 vhost_scsi_init_inflight(vs, old_inflight);
1300 1300
1301 /* 1301 /*
1302 * The inflight->kref was initialized to 1. We decrement it here to 1302 * The inflight->kref was initialized to 1. We decrement it here to
@@ -1304,7 +1304,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)
1304 * when all the reqs are finished. 1304 * when all the reqs are finished.
1305 */ 1305 */
1306 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) 1306 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
1307 kref_put(&old_inflight[i]->kref, tcm_vhost_done_inflight); 1307 kref_put(&old_inflight[i]->kref, vhost_scsi_done_inflight);
1308 1308
1309 /* Flush both the vhost poll and vhost work */ 1309 /* Flush both the vhost poll and vhost work */
1310 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) 1310 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
@@ -1319,24 +1319,24 @@ static void vhost_scsi_flush(struct vhost_scsi *vs)
1319 1319
1320/* 1320/*
1321 * Called from vhost_scsi_ioctl() context to walk the list of available 1321 * Called from vhost_scsi_ioctl() context to walk the list of available
1322 * tcm_vhost_tpg with an active struct tcm_vhost_nexus 1322 * vhost_scsi_tpg with an active struct vhost_scsi_nexus
1323 * 1323 *
1324 * The lock nesting rule is: 1324 * The lock nesting rule is:
1325 * tcm_vhost_mutex -> vs->dev.mutex -> tpg->tv_tpg_mutex -> vq->mutex 1325 * vhost_scsi_mutex -> vs->dev.mutex -> tpg->tv_tpg_mutex -> vq->mutex
1326 */ 1326 */
1327static int 1327static int
1328vhost_scsi_set_endpoint(struct vhost_scsi *vs, 1328vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1329 struct vhost_scsi_target *t) 1329 struct vhost_scsi_target *t)
1330{ 1330{
1331 struct se_portal_group *se_tpg; 1331 struct se_portal_group *se_tpg;
1332 struct tcm_vhost_tport *tv_tport; 1332 struct vhost_scsi_tport *tv_tport;
1333 struct tcm_vhost_tpg *tpg; 1333 struct vhost_scsi_tpg *tpg;
1334 struct tcm_vhost_tpg **vs_tpg; 1334 struct vhost_scsi_tpg **vs_tpg;
1335 struct vhost_virtqueue *vq; 1335 struct vhost_virtqueue *vq;
1336 int index, ret, i, len; 1336 int index, ret, i, len;
1337 bool match = false; 1337 bool match = false;
1338 1338
1339 mutex_lock(&tcm_vhost_mutex); 1339 mutex_lock(&vhost_scsi_mutex);
1340 mutex_lock(&vs->dev.mutex); 1340 mutex_lock(&vs->dev.mutex);
1341 1341
1342 /* Verify that ring has been setup correctly. */ 1342 /* Verify that ring has been setup correctly. */
@@ -1357,7 +1357,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1357 if (vs->vs_tpg) 1357 if (vs->vs_tpg)
1358 memcpy(vs_tpg, vs->vs_tpg, len); 1358 memcpy(vs_tpg, vs->vs_tpg, len);
1359 1359
1360 list_for_each_entry(tpg, &tcm_vhost_list, tv_tpg_list) { 1360 list_for_each_entry(tpg, &vhost_scsi_list, tv_tpg_list) {
1361 mutex_lock(&tpg->tv_tpg_mutex); 1361 mutex_lock(&tpg->tv_tpg_mutex);
1362 if (!tpg->tpg_nexus) { 1362 if (!tpg->tpg_nexus) {
1363 mutex_unlock(&tpg->tv_tpg_mutex); 1363 mutex_unlock(&tpg->tv_tpg_mutex);
@@ -1425,7 +1425,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1425 1425
1426out: 1426out:
1427 mutex_unlock(&vs->dev.mutex); 1427 mutex_unlock(&vs->dev.mutex);
1428 mutex_unlock(&tcm_vhost_mutex); 1428 mutex_unlock(&vhost_scsi_mutex);
1429 return ret; 1429 return ret;
1430} 1430}
1431 1431
@@ -1434,14 +1434,14 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
1434 struct vhost_scsi_target *t) 1434 struct vhost_scsi_target *t)
1435{ 1435{
1436 struct se_portal_group *se_tpg; 1436 struct se_portal_group *se_tpg;
1437 struct tcm_vhost_tport *tv_tport; 1437 struct vhost_scsi_tport *tv_tport;
1438 struct tcm_vhost_tpg *tpg; 1438 struct vhost_scsi_tpg *tpg;
1439 struct vhost_virtqueue *vq; 1439 struct vhost_virtqueue *vq;
1440 bool match = false; 1440 bool match = false;
1441 int index, ret, i; 1441 int index, ret, i;
1442 u8 target; 1442 u8 target;
1443 1443
1444 mutex_lock(&tcm_vhost_mutex); 1444 mutex_lock(&vhost_scsi_mutex);
1445 mutex_lock(&vs->dev.mutex); 1445 mutex_lock(&vs->dev.mutex);
1446 /* Verify that ring has been setup correctly. */ 1446 /* Verify that ring has been setup correctly. */
1447 for (index = 0; index < vs->dev.nvqs; ++index) { 1447 for (index = 0; index < vs->dev.nvqs; ++index) {
@@ -1507,14 +1507,14 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
1507 vs->vs_tpg = NULL; 1507 vs->vs_tpg = NULL;
1508 WARN_ON(vs->vs_events_nr); 1508 WARN_ON(vs->vs_events_nr);
1509 mutex_unlock(&vs->dev.mutex); 1509 mutex_unlock(&vs->dev.mutex);
1510 mutex_unlock(&tcm_vhost_mutex); 1510 mutex_unlock(&vhost_scsi_mutex);
1511 return 0; 1511 return 0;
1512 1512
1513err_tpg: 1513err_tpg:
1514 mutex_unlock(&tpg->tv_tpg_mutex); 1514 mutex_unlock(&tpg->tv_tpg_mutex);
1515err_dev: 1515err_dev:
1516 mutex_unlock(&vs->dev.mutex); 1516 mutex_unlock(&vs->dev.mutex);
1517 mutex_unlock(&tcm_vhost_mutex); 1517 mutex_unlock(&vhost_scsi_mutex);
1518 return ret; 1518 return ret;
1519} 1519}
1520 1520
@@ -1561,7 +1561,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
1561 goto err_vqs; 1561 goto err_vqs;
1562 1562
1563 vhost_work_init(&vs->vs_completion_work, vhost_scsi_complete_cmd_work); 1563 vhost_work_init(&vs->vs_completion_work, vhost_scsi_complete_cmd_work);
1564 vhost_work_init(&vs->vs_event_work, tcm_vhost_evt_work); 1564 vhost_work_init(&vs->vs_event_work, vhost_scsi_evt_work);
1565 1565
1566 vs->vs_events_nr = 0; 1566 vs->vs_events_nr = 0;
1567 vs->vs_events_missed = false; 1567 vs->vs_events_missed = false;
@@ -1576,7 +1576,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
1576 } 1576 }
1577 vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ); 1577 vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ);
1578 1578
1579 tcm_vhost_init_inflight(vs, NULL); 1579 vhost_scsi_init_inflight(vs, NULL);
1580 1580
1581 f->private_data = vs; 1581 f->private_data = vs;
1582 return 0; 1582 return 0;
@@ -1708,7 +1708,7 @@ static int vhost_scsi_deregister(void)
1708 return misc_deregister(&vhost_scsi_misc); 1708 return misc_deregister(&vhost_scsi_misc);
1709} 1709}
1710 1710
1711static char *tcm_vhost_dump_proto_id(struct tcm_vhost_tport *tport) 1711static char *vhost_scsi_dump_proto_id(struct vhost_scsi_tport *tport)
1712{ 1712{
1713 switch (tport->tport_proto_id) { 1713 switch (tport->tport_proto_id) {
1714 case SCSI_PROTOCOL_SAS: 1714 case SCSI_PROTOCOL_SAS:
@@ -1725,7 +1725,7 @@ static char *tcm_vhost_dump_proto_id(struct tcm_vhost_tport *tport)
1725} 1725}
1726 1726
1727static void 1727static void
1728tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg, 1728vhost_scsi_do_plug(struct vhost_scsi_tpg *tpg,
1729 struct se_lun *lun, bool plug) 1729 struct se_lun *lun, bool plug)
1730{ 1730{
1731 1731
@@ -1746,71 +1746,71 @@ tcm_vhost_do_plug(struct tcm_vhost_tpg *tpg,
1746 vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq; 1746 vq = &vs->vqs[VHOST_SCSI_VQ_EVT].vq;
1747 mutex_lock(&vq->mutex); 1747 mutex_lock(&vq->mutex);
1748 if (vhost_has_feature(vq, VIRTIO_SCSI_F_HOTPLUG)) 1748 if (vhost_has_feature(vq, VIRTIO_SCSI_F_HOTPLUG))
1749 tcm_vhost_send_evt(vs, tpg, lun, 1749 vhost_scsi_send_evt(vs, tpg, lun,
1750 VIRTIO_SCSI_T_TRANSPORT_RESET, reason); 1750 VIRTIO_SCSI_T_TRANSPORT_RESET, reason);
1751 mutex_unlock(&vq->mutex); 1751 mutex_unlock(&vq->mutex);
1752 mutex_unlock(&vs->dev.mutex); 1752 mutex_unlock(&vs->dev.mutex);
1753} 1753}
1754 1754
1755static void tcm_vhost_hotplug(struct tcm_vhost_tpg *tpg, struct se_lun *lun) 1755static void vhost_scsi_hotplug(struct vhost_scsi_tpg *tpg, struct se_lun *lun)
1756{ 1756{
1757 tcm_vhost_do_plug(tpg, lun, true); 1757 vhost_scsi_do_plug(tpg, lun, true);
1758} 1758}
1759 1759
1760static void tcm_vhost_hotunplug(struct tcm_vhost_tpg *tpg, struct se_lun *lun) 1760static void vhost_scsi_hotunplug(struct vhost_scsi_tpg *tpg, struct se_lun *lun)
1761{ 1761{
1762 tcm_vhost_do_plug(tpg, lun, false); 1762 vhost_scsi_do_plug(tpg, lun, false);
1763} 1763}
1764 1764
1765static int tcm_vhost_port_link(struct se_portal_group *se_tpg, 1765static int vhost_scsi_port_link(struct se_portal_group *se_tpg,
1766 struct se_lun *lun) 1766 struct se_lun *lun)
1767{ 1767{
1768 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 1768 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
1769 struct tcm_vhost_tpg, se_tpg); 1769 struct vhost_scsi_tpg, se_tpg);
1770 1770
1771 mutex_lock(&tcm_vhost_mutex); 1771 mutex_lock(&vhost_scsi_mutex);
1772 1772
1773 mutex_lock(&tpg->tv_tpg_mutex); 1773 mutex_lock(&tpg->tv_tpg_mutex);
1774 tpg->tv_tpg_port_count++; 1774 tpg->tv_tpg_port_count++;
1775 mutex_unlock(&tpg->tv_tpg_mutex); 1775 mutex_unlock(&tpg->tv_tpg_mutex);
1776 1776
1777 tcm_vhost_hotplug(tpg, lun); 1777 vhost_scsi_hotplug(tpg, lun);
1778 1778
1779 mutex_unlock(&tcm_vhost_mutex); 1779 mutex_unlock(&vhost_scsi_mutex);
1780 1780
1781 return 0; 1781 return 0;
1782} 1782}
1783 1783
1784static void tcm_vhost_port_unlink(struct se_portal_group *se_tpg, 1784static void vhost_scsi_port_unlink(struct se_portal_group *se_tpg,
1785 struct se_lun *lun) 1785 struct se_lun *lun)
1786{ 1786{
1787 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 1787 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
1788 struct tcm_vhost_tpg, se_tpg); 1788 struct vhost_scsi_tpg, se_tpg);
1789 1789
1790 mutex_lock(&tcm_vhost_mutex); 1790 mutex_lock(&vhost_scsi_mutex);
1791 1791
1792 mutex_lock(&tpg->tv_tpg_mutex); 1792 mutex_lock(&tpg->tv_tpg_mutex);
1793 tpg->tv_tpg_port_count--; 1793 tpg->tv_tpg_port_count--;
1794 mutex_unlock(&tpg->tv_tpg_mutex); 1794 mutex_unlock(&tpg->tv_tpg_mutex);
1795 1795
1796 tcm_vhost_hotunplug(tpg, lun); 1796 vhost_scsi_hotunplug(tpg, lun);
1797 1797
1798 mutex_unlock(&tcm_vhost_mutex); 1798 mutex_unlock(&vhost_scsi_mutex);
1799} 1799}
1800 1800
1801static struct se_node_acl * 1801static struct se_node_acl *
1802tcm_vhost_make_nodeacl(struct se_portal_group *se_tpg, 1802vhost_scsi_make_nodeacl(struct se_portal_group *se_tpg,
1803 struct config_group *group, 1803 struct config_group *group,
1804 const char *name) 1804 const char *name)
1805{ 1805{
1806 struct se_node_acl *se_nacl, *se_nacl_new; 1806 struct se_node_acl *se_nacl, *se_nacl_new;
1807 struct tcm_vhost_nacl *nacl; 1807 struct vhost_scsi_nacl *nacl;
1808 u64 wwpn = 0; 1808 u64 wwpn = 0;
1809 u32 nexus_depth; 1809 u32 nexus_depth;
1810 1810
1811 /* tcm_vhost_parse_wwn(name, &wwpn, 1) < 0) 1811 /* vhost_scsi_parse_wwn(name, &wwpn, 1) < 0)
1812 return ERR_PTR(-EINVAL); */ 1812 return ERR_PTR(-EINVAL); */
1813 se_nacl_new = tcm_vhost_alloc_fabric_acl(se_tpg); 1813 se_nacl_new = vhost_scsi_alloc_fabric_acl(se_tpg);
1814 if (!se_nacl_new) 1814 if (!se_nacl_new)
1815 return ERR_PTR(-ENOMEM); 1815 return ERR_PTR(-ENOMEM);
1816 1816
@@ -1822,37 +1822,37 @@ tcm_vhost_make_nodeacl(struct se_portal_group *se_tpg,
1822 se_nacl = core_tpg_add_initiator_node_acl(se_tpg, se_nacl_new, 1822 se_nacl = core_tpg_add_initiator_node_acl(se_tpg, se_nacl_new,
1823 name, nexus_depth); 1823 name, nexus_depth);
1824 if (IS_ERR(se_nacl)) { 1824 if (IS_ERR(se_nacl)) {
1825 tcm_vhost_release_fabric_acl(se_tpg, se_nacl_new); 1825 vhost_scsi_release_fabric_acl(se_tpg, se_nacl_new);
1826 return se_nacl; 1826 return se_nacl;
1827 } 1827 }
1828 /* 1828 /*
1829 * Locate our struct tcm_vhost_nacl and set the FC Nport WWPN 1829 * Locate our struct vhost_scsi_nacl and set the FC Nport WWPN
1830 */ 1830 */
1831 nacl = container_of(se_nacl, struct tcm_vhost_nacl, se_node_acl); 1831 nacl = container_of(se_nacl, struct vhost_scsi_nacl, se_node_acl);
1832 nacl->iport_wwpn = wwpn; 1832 nacl->iport_wwpn = wwpn;
1833 1833
1834 return se_nacl; 1834 return se_nacl;
1835} 1835}
1836 1836
1837static void tcm_vhost_drop_nodeacl(struct se_node_acl *se_acl) 1837static void vhost_scsi_drop_nodeacl(struct se_node_acl *se_acl)
1838{ 1838{
1839 struct tcm_vhost_nacl *nacl = container_of(se_acl, 1839 struct vhost_scsi_nacl *nacl = container_of(se_acl,
1840 struct tcm_vhost_nacl, se_node_acl); 1840 struct vhost_scsi_nacl, se_node_acl);
1841 core_tpg_del_initiator_node_acl(se_acl->se_tpg, se_acl, 1); 1841 core_tpg_del_initiator_node_acl(se_acl->se_tpg, se_acl, 1);
1842 kfree(nacl); 1842 kfree(nacl);
1843} 1843}
1844 1844
1845static void tcm_vhost_free_cmd_map_res(struct tcm_vhost_nexus *nexus, 1845static void vhost_scsi_free_cmd_map_res(struct vhost_scsi_nexus *nexus,
1846 struct se_session *se_sess) 1846 struct se_session *se_sess)
1847{ 1847{
1848 struct tcm_vhost_cmd *tv_cmd; 1848 struct vhost_scsi_cmd *tv_cmd;
1849 unsigned int i; 1849 unsigned int i;
1850 1850
1851 if (!se_sess->sess_cmd_map) 1851 if (!se_sess->sess_cmd_map)
1852 return; 1852 return;
1853 1853
1854 for (i = 0; i < TCM_VHOST_DEFAULT_TAGS; i++) { 1854 for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) {
1855 tv_cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[i]; 1855 tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i];
1856 1856
1857 kfree(tv_cmd->tvc_sgl); 1857 kfree(tv_cmd->tvc_sgl);
1858 kfree(tv_cmd->tvc_prot_sgl); 1858 kfree(tv_cmd->tvc_prot_sgl);
@@ -1860,13 +1860,13 @@ static void tcm_vhost_free_cmd_map_res(struct tcm_vhost_nexus *nexus,
1860 } 1860 }
1861} 1861}
1862 1862
1863static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg, 1863static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg,
1864 const char *name) 1864 const char *name)
1865{ 1865{
1866 struct se_portal_group *se_tpg; 1866 struct se_portal_group *se_tpg;
1867 struct se_session *se_sess; 1867 struct se_session *se_sess;
1868 struct tcm_vhost_nexus *tv_nexus; 1868 struct vhost_scsi_nexus *tv_nexus;
1869 struct tcm_vhost_cmd *tv_cmd; 1869 struct vhost_scsi_cmd *tv_cmd;
1870 unsigned int i; 1870 unsigned int i;
1871 1871
1872 mutex_lock(&tpg->tv_tpg_mutex); 1872 mutex_lock(&tpg->tv_tpg_mutex);
@@ -1877,19 +1877,19 @@ static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg,
1877 } 1877 }
1878 se_tpg = &tpg->se_tpg; 1878 se_tpg = &tpg->se_tpg;
1879 1879
1880 tv_nexus = kzalloc(sizeof(struct tcm_vhost_nexus), GFP_KERNEL); 1880 tv_nexus = kzalloc(sizeof(struct vhost_scsi_nexus), GFP_KERNEL);
1881 if (!tv_nexus) { 1881 if (!tv_nexus) {
1882 mutex_unlock(&tpg->tv_tpg_mutex); 1882 mutex_unlock(&tpg->tv_tpg_mutex);
1883 pr_err("Unable to allocate struct tcm_vhost_nexus\n"); 1883 pr_err("Unable to allocate struct vhost_scsi_nexus\n");
1884 return -ENOMEM; 1884 return -ENOMEM;
1885 } 1885 }
1886 /* 1886 /*
1887 * Initialize the struct se_session pointer and setup tagpool 1887 * Initialize the struct se_session pointer and setup tagpool
1888 * for struct tcm_vhost_cmd descriptors 1888 * for struct vhost_scsi_cmd descriptors
1889 */ 1889 */
1890 tv_nexus->tvn_se_sess = transport_init_session_tags( 1890 tv_nexus->tvn_se_sess = transport_init_session_tags(
1891 TCM_VHOST_DEFAULT_TAGS, 1891 VHOST_SCSI_DEFAULT_TAGS,
1892 sizeof(struct tcm_vhost_cmd), 1892 sizeof(struct vhost_scsi_cmd),
1893 TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS); 1893 TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS);
1894 if (IS_ERR(tv_nexus->tvn_se_sess)) { 1894 if (IS_ERR(tv_nexus->tvn_se_sess)) {
1895 mutex_unlock(&tpg->tv_tpg_mutex); 1895 mutex_unlock(&tpg->tv_tpg_mutex);
@@ -1897,11 +1897,11 @@ static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg,
1897 return -ENOMEM; 1897 return -ENOMEM;
1898 } 1898 }
1899 se_sess = tv_nexus->tvn_se_sess; 1899 se_sess = tv_nexus->tvn_se_sess;
1900 for (i = 0; i < TCM_VHOST_DEFAULT_TAGS; i++) { 1900 for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) {
1901 tv_cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[i]; 1901 tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i];
1902 1902
1903 tv_cmd->tvc_sgl = kzalloc(sizeof(struct scatterlist) * 1903 tv_cmd->tvc_sgl = kzalloc(sizeof(struct scatterlist) *
1904 TCM_VHOST_PREALLOC_SGLS, GFP_KERNEL); 1904 VHOST_SCSI_PREALLOC_SGLS, GFP_KERNEL);
1905 if (!tv_cmd->tvc_sgl) { 1905 if (!tv_cmd->tvc_sgl) {
1906 mutex_unlock(&tpg->tv_tpg_mutex); 1906 mutex_unlock(&tpg->tv_tpg_mutex);
1907 pr_err("Unable to allocate tv_cmd->tvc_sgl\n"); 1907 pr_err("Unable to allocate tv_cmd->tvc_sgl\n");
@@ -1909,7 +1909,7 @@ static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg,
1909 } 1909 }
1910 1910
1911 tv_cmd->tvc_upages = kzalloc(sizeof(struct page *) * 1911 tv_cmd->tvc_upages = kzalloc(sizeof(struct page *) *
1912 TCM_VHOST_PREALLOC_UPAGES, GFP_KERNEL); 1912 VHOST_SCSI_PREALLOC_UPAGES, GFP_KERNEL);
1913 if (!tv_cmd->tvc_upages) { 1913 if (!tv_cmd->tvc_upages) {
1914 mutex_unlock(&tpg->tv_tpg_mutex); 1914 mutex_unlock(&tpg->tv_tpg_mutex);
1915 pr_err("Unable to allocate tv_cmd->tvc_upages\n"); 1915 pr_err("Unable to allocate tv_cmd->tvc_upages\n");
@@ -1917,7 +1917,7 @@ static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg,
1917 } 1917 }
1918 1918
1919 tv_cmd->tvc_prot_sgl = kzalloc(sizeof(struct scatterlist) * 1919 tv_cmd->tvc_prot_sgl = kzalloc(sizeof(struct scatterlist) *
1920 TCM_VHOST_PREALLOC_PROT_SGLS, GFP_KERNEL); 1920 VHOST_SCSI_PREALLOC_PROT_SGLS, GFP_KERNEL);
1921 if (!tv_cmd->tvc_prot_sgl) { 1921 if (!tv_cmd->tvc_prot_sgl) {
1922 mutex_unlock(&tpg->tv_tpg_mutex); 1922 mutex_unlock(&tpg->tv_tpg_mutex);
1923 pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n"); 1923 pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n");
@@ -1926,7 +1926,7 @@ static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg,
1926 } 1926 }
1927 /* 1927 /*
1928 * Since we are running in 'demo mode' this call with generate a 1928 * Since we are running in 'demo mode' this call with generate a
1929 * struct se_node_acl for the tcm_vhost struct se_portal_group with 1929 * struct se_node_acl for the vhost_scsi struct se_portal_group with
1930 * the SCSI Initiator port name of the passed configfs group 'name'. 1930 * the SCSI Initiator port name of the passed configfs group 'name'.
1931 */ 1931 */
1932 tv_nexus->tvn_se_sess->se_node_acl = core_tpg_check_initiator_node_acl( 1932 tv_nexus->tvn_se_sess->se_node_acl = core_tpg_check_initiator_node_acl(
@@ -1949,16 +1949,16 @@ static int tcm_vhost_make_nexus(struct tcm_vhost_tpg *tpg,
1949 return 0; 1949 return 0;
1950 1950
1951out: 1951out:
1952 tcm_vhost_free_cmd_map_res(tv_nexus, se_sess); 1952 vhost_scsi_free_cmd_map_res(tv_nexus, se_sess);
1953 transport_free_session(se_sess); 1953 transport_free_session(se_sess);
1954 kfree(tv_nexus); 1954 kfree(tv_nexus);
1955 return -ENOMEM; 1955 return -ENOMEM;
1956} 1956}
1957 1957
1958static int tcm_vhost_drop_nexus(struct tcm_vhost_tpg *tpg) 1958static int vhost_scsi_drop_nexus(struct vhost_scsi_tpg *tpg)
1959{ 1959{
1960 struct se_session *se_sess; 1960 struct se_session *se_sess;
1961 struct tcm_vhost_nexus *tv_nexus; 1961 struct vhost_scsi_nexus *tv_nexus;
1962 1962
1963 mutex_lock(&tpg->tv_tpg_mutex); 1963 mutex_lock(&tpg->tv_tpg_mutex);
1964 tv_nexus = tpg->tpg_nexus; 1964 tv_nexus = tpg->tpg_nexus;
@@ -1990,10 +1990,10 @@ static int tcm_vhost_drop_nexus(struct tcm_vhost_tpg *tpg)
1990 } 1990 }
1991 1991
1992 pr_debug("TCM_vhost_ConfigFS: Removing I_T Nexus to emulated" 1992 pr_debug("TCM_vhost_ConfigFS: Removing I_T Nexus to emulated"
1993 " %s Initiator Port: %s\n", tcm_vhost_dump_proto_id(tpg->tport), 1993 " %s Initiator Port: %s\n", vhost_scsi_dump_proto_id(tpg->tport),
1994 tv_nexus->tvn_se_sess->se_node_acl->initiatorname); 1994 tv_nexus->tvn_se_sess->se_node_acl->initiatorname);
1995 1995
1996 tcm_vhost_free_cmd_map_res(tv_nexus, se_sess); 1996 vhost_scsi_free_cmd_map_res(tv_nexus, se_sess);
1997 /* 1997 /*
1998 * Release the SCSI I_T Nexus to the emulated vhost Target Port 1998 * Release the SCSI I_T Nexus to the emulated vhost Target Port
1999 */ 1999 */
@@ -2005,12 +2005,12 @@ static int tcm_vhost_drop_nexus(struct tcm_vhost_tpg *tpg)
2005 return 0; 2005 return 0;
2006} 2006}
2007 2007
2008static ssize_t tcm_vhost_tpg_show_nexus(struct se_portal_group *se_tpg, 2008static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg,
2009 char *page) 2009 char *page)
2010{ 2010{
2011 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 2011 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
2012 struct tcm_vhost_tpg, se_tpg); 2012 struct vhost_scsi_tpg, se_tpg);
2013 struct tcm_vhost_nexus *tv_nexus; 2013 struct vhost_scsi_nexus *tv_nexus;
2014 ssize_t ret; 2014 ssize_t ret;
2015 2015
2016 mutex_lock(&tpg->tv_tpg_mutex); 2016 mutex_lock(&tpg->tv_tpg_mutex);
@@ -2026,40 +2026,40 @@ static ssize_t tcm_vhost_tpg_show_nexus(struct se_portal_group *se_tpg,
2026 return ret; 2026 return ret;
2027} 2027}
2028 2028
2029static ssize_t tcm_vhost_tpg_store_nexus(struct se_portal_group *se_tpg, 2029static ssize_t vhost_scsi_tpg_store_nexus(struct se_portal_group *se_tpg,
2030 const char *page, 2030 const char *page,
2031 size_t count) 2031 size_t count)
2032{ 2032{
2033 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 2033 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
2034 struct tcm_vhost_tpg, se_tpg); 2034 struct vhost_scsi_tpg, se_tpg);
2035 struct tcm_vhost_tport *tport_wwn = tpg->tport; 2035 struct vhost_scsi_tport *tport_wwn = tpg->tport;
2036 unsigned char i_port[TCM_VHOST_NAMELEN], *ptr, *port_ptr; 2036 unsigned char i_port[VHOST_SCSI_NAMELEN], *ptr, *port_ptr;
2037 int ret; 2037 int ret;
2038 /* 2038 /*
2039 * Shutdown the active I_T nexus if 'NULL' is passed.. 2039 * Shutdown the active I_T nexus if 'NULL' is passed..
2040 */ 2040 */
2041 if (!strncmp(page, "NULL", 4)) { 2041 if (!strncmp(page, "NULL", 4)) {
2042 ret = tcm_vhost_drop_nexus(tpg); 2042 ret = vhost_scsi_drop_nexus(tpg);
2043 return (!ret) ? count : ret; 2043 return (!ret) ? count : ret;
2044 } 2044 }
2045 /* 2045 /*
2046 * Otherwise make sure the passed virtual Initiator port WWN matches 2046 * Otherwise make sure the passed virtual Initiator port WWN matches
2047 * the fabric protocol_id set in tcm_vhost_make_tport(), and call 2047 * the fabric protocol_id set in vhost_scsi_make_tport(), and call
2048 * tcm_vhost_make_nexus(). 2048 * vhost_scsi_make_nexus().
2049 */ 2049 */
2050 if (strlen(page) >= TCM_VHOST_NAMELEN) { 2050 if (strlen(page) >= VHOST_SCSI_NAMELEN) {
2051 pr_err("Emulated NAA Sas Address: %s, exceeds" 2051 pr_err("Emulated NAA Sas Address: %s, exceeds"
2052 " max: %d\n", page, TCM_VHOST_NAMELEN); 2052 " max: %d\n", page, VHOST_SCSI_NAMELEN);
2053 return -EINVAL; 2053 return -EINVAL;
2054 } 2054 }
2055 snprintf(&i_port[0], TCM_VHOST_NAMELEN, "%s", page); 2055 snprintf(&i_port[0], VHOST_SCSI_NAMELEN, "%s", page);
2056 2056
2057 ptr = strstr(i_port, "naa."); 2057 ptr = strstr(i_port, "naa.");
2058 if (ptr) { 2058 if (ptr) {
2059 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_SAS) { 2059 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_SAS) {
2060 pr_err("Passed SAS Initiator Port %s does not" 2060 pr_err("Passed SAS Initiator Port %s does not"
2061 " match target port protoid: %s\n", i_port, 2061 " match target port protoid: %s\n", i_port,
2062 tcm_vhost_dump_proto_id(tport_wwn)); 2062 vhost_scsi_dump_proto_id(tport_wwn));
2063 return -EINVAL; 2063 return -EINVAL;
2064 } 2064 }
2065 port_ptr = &i_port[0]; 2065 port_ptr = &i_port[0];
@@ -2070,7 +2070,7 @@ static ssize_t tcm_vhost_tpg_store_nexus(struct se_portal_group *se_tpg,
2070 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_FCP) { 2070 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_FCP) {
2071 pr_err("Passed FCP Initiator Port %s does not" 2071 pr_err("Passed FCP Initiator Port %s does not"
2072 " match target port protoid: %s\n", i_port, 2072 " match target port protoid: %s\n", i_port,
2073 tcm_vhost_dump_proto_id(tport_wwn)); 2073 vhost_scsi_dump_proto_id(tport_wwn));
2074 return -EINVAL; 2074 return -EINVAL;
2075 } 2075 }
2076 port_ptr = &i_port[3]; /* Skip over "fc." */ 2076 port_ptr = &i_port[3]; /* Skip over "fc." */
@@ -2081,7 +2081,7 @@ static ssize_t tcm_vhost_tpg_store_nexus(struct se_portal_group *se_tpg,
2081 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_ISCSI) { 2081 if (tport_wwn->tport_proto_id != SCSI_PROTOCOL_ISCSI) {
2082 pr_err("Passed iSCSI Initiator Port %s does not" 2082 pr_err("Passed iSCSI Initiator Port %s does not"
2083 " match target port protoid: %s\n", i_port, 2083 " match target port protoid: %s\n", i_port,
2084 tcm_vhost_dump_proto_id(tport_wwn)); 2084 vhost_scsi_dump_proto_id(tport_wwn));
2085 return -EINVAL; 2085 return -EINVAL;
2086 } 2086 }
2087 port_ptr = &i_port[0]; 2087 port_ptr = &i_port[0];
@@ -2097,29 +2097,29 @@ check_newline:
2097 if (i_port[strlen(i_port)-1] == '\n') 2097 if (i_port[strlen(i_port)-1] == '\n')
2098 i_port[strlen(i_port)-1] = '\0'; 2098 i_port[strlen(i_port)-1] = '\0';
2099 2099
2100 ret = tcm_vhost_make_nexus(tpg, port_ptr); 2100 ret = vhost_scsi_make_nexus(tpg, port_ptr);
2101 if (ret < 0) 2101 if (ret < 0)
2102 return ret; 2102 return ret;
2103 2103
2104 return count; 2104 return count;
2105} 2105}
2106 2106
2107TF_TPG_BASE_ATTR(tcm_vhost, nexus, S_IRUGO | S_IWUSR); 2107TF_TPG_BASE_ATTR(vhost_scsi, nexus, S_IRUGO | S_IWUSR);
2108 2108
2109static struct configfs_attribute *tcm_vhost_tpg_attrs[] = { 2109static struct configfs_attribute *vhost_scsi_tpg_attrs[] = {
2110 &tcm_vhost_tpg_nexus.attr, 2110 &vhost_scsi_tpg_nexus.attr,
2111 NULL, 2111 NULL,
2112}; 2112};
2113 2113
2114static struct se_portal_group * 2114static struct se_portal_group *
2115tcm_vhost_make_tpg(struct se_wwn *wwn, 2115vhost_scsi_make_tpg(struct se_wwn *wwn,
2116 struct config_group *group, 2116 struct config_group *group,
2117 const char *name) 2117 const char *name)
2118{ 2118{
2119 struct tcm_vhost_tport *tport = container_of(wwn, 2119 struct vhost_scsi_tport *tport = container_of(wwn,
2120 struct tcm_vhost_tport, tport_wwn); 2120 struct vhost_scsi_tport, tport_wwn);
2121 2121
2122 struct tcm_vhost_tpg *tpg; 2122 struct vhost_scsi_tpg *tpg;
2123 unsigned long tpgt; 2123 unsigned long tpgt;
2124 int ret; 2124 int ret;
2125 2125
@@ -2128,9 +2128,9 @@ tcm_vhost_make_tpg(struct se_wwn *wwn,
2128 if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX) 2128 if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX)
2129 return ERR_PTR(-EINVAL); 2129 return ERR_PTR(-EINVAL);
2130 2130
2131 tpg = kzalloc(sizeof(struct tcm_vhost_tpg), GFP_KERNEL); 2131 tpg = kzalloc(sizeof(struct vhost_scsi_tpg), GFP_KERNEL);
2132 if (!tpg) { 2132 if (!tpg) {
2133 pr_err("Unable to allocate struct tcm_vhost_tpg"); 2133 pr_err("Unable to allocate struct vhost_scsi_tpg");
2134 return ERR_PTR(-ENOMEM); 2134 return ERR_PTR(-ENOMEM);
2135 } 2135 }
2136 mutex_init(&tpg->tv_tpg_mutex); 2136 mutex_init(&tpg->tv_tpg_mutex);
@@ -2138,31 +2138,31 @@ tcm_vhost_make_tpg(struct se_wwn *wwn,
2138 tpg->tport = tport; 2138 tpg->tport = tport;
2139 tpg->tport_tpgt = tpgt; 2139 tpg->tport_tpgt = tpgt;
2140 2140
2141 ret = core_tpg_register(&tcm_vhost_fabric_configfs->tf_ops, wwn, 2141 ret = core_tpg_register(&vhost_scsi_fabric_configfs->tf_ops, wwn,
2142 &tpg->se_tpg, tpg, TRANSPORT_TPG_TYPE_NORMAL); 2142 &tpg->se_tpg, tpg, TRANSPORT_TPG_TYPE_NORMAL);
2143 if (ret < 0) { 2143 if (ret < 0) {
2144 kfree(tpg); 2144 kfree(tpg);
2145 return NULL; 2145 return NULL;
2146 } 2146 }
2147 mutex_lock(&tcm_vhost_mutex); 2147 mutex_lock(&vhost_scsi_mutex);
2148 list_add_tail(&tpg->tv_tpg_list, &tcm_vhost_list); 2148 list_add_tail(&tpg->tv_tpg_list, &vhost_scsi_list);
2149 mutex_unlock(&tcm_vhost_mutex); 2149 mutex_unlock(&vhost_scsi_mutex);
2150 2150
2151 return &tpg->se_tpg; 2151 return &tpg->se_tpg;
2152} 2152}
2153 2153
2154static void tcm_vhost_drop_tpg(struct se_portal_group *se_tpg) 2154static void vhost_scsi_drop_tpg(struct se_portal_group *se_tpg)
2155{ 2155{
2156 struct tcm_vhost_tpg *tpg = container_of(se_tpg, 2156 struct vhost_scsi_tpg *tpg = container_of(se_tpg,
2157 struct tcm_vhost_tpg, se_tpg); 2157 struct vhost_scsi_tpg, se_tpg);
2158 2158
2159 mutex_lock(&tcm_vhost_mutex); 2159 mutex_lock(&vhost_scsi_mutex);
2160 list_del(&tpg->tv_tpg_list); 2160 list_del(&tpg->tv_tpg_list);
2161 mutex_unlock(&tcm_vhost_mutex); 2161 mutex_unlock(&vhost_scsi_mutex);
2162 /* 2162 /*
2163 * Release the virtual I_T Nexus for this vhost TPG 2163 * Release the virtual I_T Nexus for this vhost TPG
2164 */ 2164 */
2165 tcm_vhost_drop_nexus(tpg); 2165 vhost_scsi_drop_nexus(tpg);
2166 /* 2166 /*
2167 * Deregister the se_tpg from TCM.. 2167 * Deregister the se_tpg from TCM..
2168 */ 2168 */
@@ -2171,21 +2171,21 @@ static void tcm_vhost_drop_tpg(struct se_portal_group *se_tpg)
2171} 2171}
2172 2172
2173static struct se_wwn * 2173static struct se_wwn *
2174tcm_vhost_make_tport(struct target_fabric_configfs *tf, 2174vhost_scsi_make_tport(struct target_fabric_configfs *tf,
2175 struct config_group *group, 2175 struct config_group *group,
2176 const char *name) 2176 const char *name)
2177{ 2177{
2178 struct tcm_vhost_tport *tport; 2178 struct vhost_scsi_tport *tport;
2179 char *ptr; 2179 char *ptr;
2180 u64 wwpn = 0; 2180 u64 wwpn = 0;
2181 int off = 0; 2181 int off = 0;
2182 2182
2183 /* if (tcm_vhost_parse_wwn(name, &wwpn, 1) < 0) 2183 /* if (vhost_scsi_parse_wwn(name, &wwpn, 1) < 0)
2184 return ERR_PTR(-EINVAL); */ 2184 return ERR_PTR(-EINVAL); */
2185 2185
2186 tport = kzalloc(sizeof(struct tcm_vhost_tport), GFP_KERNEL); 2186 tport = kzalloc(sizeof(struct vhost_scsi_tport), GFP_KERNEL);
2187 if (!tport) { 2187 if (!tport) {
2188 pr_err("Unable to allocate struct tcm_vhost_tport"); 2188 pr_err("Unable to allocate struct vhost_scsi_tport");
2189 return ERR_PTR(-ENOMEM); 2189 return ERR_PTR(-ENOMEM);
2190 } 2190 }
2191 tport->tport_wwpn = wwpn; 2191 tport->tport_wwpn = wwpn;
@@ -2216,102 +2216,102 @@ tcm_vhost_make_tport(struct target_fabric_configfs *tf,
2216 return ERR_PTR(-EINVAL); 2216 return ERR_PTR(-EINVAL);
2217 2217
2218check_len: 2218check_len:
2219 if (strlen(name) >= TCM_VHOST_NAMELEN) { 2219 if (strlen(name) >= VHOST_SCSI_NAMELEN) {
2220 pr_err("Emulated %s Address: %s, exceeds" 2220 pr_err("Emulated %s Address: %s, exceeds"
2221 " max: %d\n", name, tcm_vhost_dump_proto_id(tport), 2221 " max: %d\n", name, vhost_scsi_dump_proto_id(tport),
2222 TCM_VHOST_NAMELEN); 2222 VHOST_SCSI_NAMELEN);
2223 kfree(tport); 2223 kfree(tport);
2224 return ERR_PTR(-EINVAL); 2224 return ERR_PTR(-EINVAL);
2225 } 2225 }
2226 snprintf(&tport->tport_name[0], TCM_VHOST_NAMELEN, "%s", &name[off]); 2226 snprintf(&tport->tport_name[0], VHOST_SCSI_NAMELEN, "%s", &name[off]);
2227 2227
2228 pr_debug("TCM_VHost_ConfigFS: Allocated emulated Target" 2228 pr_debug("TCM_VHost_ConfigFS: Allocated emulated Target"
2229 " %s Address: %s\n", tcm_vhost_dump_proto_id(tport), name); 2229 " %s Address: %s\n", vhost_scsi_dump_proto_id(tport), name);
2230 2230
2231 return &tport->tport_wwn; 2231 return &tport->tport_wwn;
2232} 2232}
2233 2233
2234static void tcm_vhost_drop_tport(struct se_wwn *wwn) 2234static void vhost_scsi_drop_tport(struct se_wwn *wwn)
2235{ 2235{
2236 struct tcm_vhost_tport *tport = container_of(wwn, 2236 struct vhost_scsi_tport *tport = container_of(wwn,
2237 struct tcm_vhost_tport, tport_wwn); 2237 struct vhost_scsi_tport, tport_wwn);
2238 2238
2239 pr_debug("TCM_VHost_ConfigFS: Deallocating emulated Target" 2239 pr_debug("TCM_VHost_ConfigFS: Deallocating emulated Target"
2240 " %s Address: %s\n", tcm_vhost_dump_proto_id(tport), 2240 " %s Address: %s\n", vhost_scsi_dump_proto_id(tport),
2241 tport->tport_name); 2241 tport->tport_name);
2242 2242
2243 kfree(tport); 2243 kfree(tport);
2244} 2244}
2245 2245
2246static ssize_t 2246static ssize_t
2247tcm_vhost_wwn_show_attr_version(struct target_fabric_configfs *tf, 2247vhost_scsi_wwn_show_attr_version(struct target_fabric_configfs *tf,
2248 char *page) 2248 char *page)
2249{ 2249{
2250 return sprintf(page, "TCM_VHOST fabric module %s on %s/%s" 2250 return sprintf(page, "TCM_VHOST fabric module %s on %s/%s"
2251 "on "UTS_RELEASE"\n", TCM_VHOST_VERSION, utsname()->sysname, 2251 "on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
2252 utsname()->machine); 2252 utsname()->machine);
2253} 2253}
2254 2254
2255TF_WWN_ATTR_RO(tcm_vhost, version); 2255TF_WWN_ATTR_RO(vhost_scsi, version);
2256 2256
2257static struct configfs_attribute *tcm_vhost_wwn_attrs[] = { 2257static struct configfs_attribute *vhost_scsi_wwn_attrs[] = {
2258 &tcm_vhost_wwn_version.attr, 2258 &vhost_scsi_wwn_version.attr,
2259 NULL, 2259 NULL,
2260}; 2260};
2261 2261
2262static struct target_core_fabric_ops tcm_vhost_ops = { 2262static struct target_core_fabric_ops vhost_scsi_ops = {
2263 .get_fabric_name = tcm_vhost_get_fabric_name, 2263 .get_fabric_name = vhost_scsi_get_fabric_name,
2264 .get_fabric_proto_ident = tcm_vhost_get_fabric_proto_ident, 2264 .get_fabric_proto_ident = vhost_scsi_get_fabric_proto_ident,
2265 .tpg_get_wwn = tcm_vhost_get_fabric_wwn, 2265 .tpg_get_wwn = vhost_scsi_get_fabric_wwn,
2266 .tpg_get_tag = tcm_vhost_get_tag, 2266 .tpg_get_tag = vhost_scsi_get_tpgt,
2267 .tpg_get_default_depth = tcm_vhost_get_default_depth, 2267 .tpg_get_default_depth = vhost_scsi_get_default_depth,
2268 .tpg_get_pr_transport_id = tcm_vhost_get_pr_transport_id, 2268 .tpg_get_pr_transport_id = vhost_scsi_get_pr_transport_id,
2269 .tpg_get_pr_transport_id_len = tcm_vhost_get_pr_transport_id_len, 2269 .tpg_get_pr_transport_id_len = vhost_scsi_get_pr_transport_id_len,
2270 .tpg_parse_pr_out_transport_id = tcm_vhost_parse_pr_out_transport_id, 2270 .tpg_parse_pr_out_transport_id = vhost_scsi_parse_pr_out_transport_id,
2271 .tpg_check_demo_mode = tcm_vhost_check_true, 2271 .tpg_check_demo_mode = vhost_scsi_check_true,
2272 .tpg_check_demo_mode_cache = tcm_vhost_check_true, 2272 .tpg_check_demo_mode_cache = vhost_scsi_check_true,
2273 .tpg_check_demo_mode_write_protect = tcm_vhost_check_false, 2273 .tpg_check_demo_mode_write_protect = vhost_scsi_check_false,
2274 .tpg_check_prod_mode_write_protect = tcm_vhost_check_false, 2274 .tpg_check_prod_mode_write_protect = vhost_scsi_check_false,
2275 .tpg_alloc_fabric_acl = tcm_vhost_alloc_fabric_acl, 2275 .tpg_alloc_fabric_acl = vhost_scsi_alloc_fabric_acl,
2276 .tpg_release_fabric_acl = tcm_vhost_release_fabric_acl, 2276 .tpg_release_fabric_acl = vhost_scsi_release_fabric_acl,
2277 .tpg_get_inst_index = tcm_vhost_tpg_get_inst_index, 2277 .tpg_get_inst_index = vhost_scsi_tpg_get_inst_index,
2278 .release_cmd = tcm_vhost_release_cmd, 2278 .release_cmd = vhost_scsi_release_cmd,
2279 .check_stop_free = vhost_scsi_check_stop_free, 2279 .check_stop_free = vhost_scsi_check_stop_free,
2280 .shutdown_session = tcm_vhost_shutdown_session, 2280 .shutdown_session = vhost_scsi_shutdown_session,
2281 .close_session = tcm_vhost_close_session, 2281 .close_session = vhost_scsi_close_session,
2282 .sess_get_index = tcm_vhost_sess_get_index, 2282 .sess_get_index = vhost_scsi_sess_get_index,
2283 .sess_get_initiator_sid = NULL, 2283 .sess_get_initiator_sid = NULL,
2284 .write_pending = tcm_vhost_write_pending, 2284 .write_pending = vhost_scsi_write_pending,
2285 .write_pending_status = tcm_vhost_write_pending_status, 2285 .write_pending_status = vhost_scsi_write_pending_status,
2286 .set_default_node_attributes = tcm_vhost_set_default_node_attrs, 2286 .set_default_node_attributes = vhost_scsi_set_default_node_attrs,
2287 .get_task_tag = tcm_vhost_get_task_tag, 2287 .get_task_tag = vhost_scsi_get_task_tag,
2288 .get_cmd_state = tcm_vhost_get_cmd_state, 2288 .get_cmd_state = vhost_scsi_get_cmd_state,
2289 .queue_data_in = tcm_vhost_queue_data_in, 2289 .queue_data_in = vhost_scsi_queue_data_in,
2290 .queue_status = tcm_vhost_queue_status, 2290 .queue_status = vhost_scsi_queue_status,
2291 .queue_tm_rsp = tcm_vhost_queue_tm_rsp, 2291 .queue_tm_rsp = vhost_scsi_queue_tm_rsp,
2292 .aborted_task = tcm_vhost_aborted_task, 2292 .aborted_task = vhost_scsi_aborted_task,
2293 /* 2293 /*
2294 * Setup callers for generic logic in target_core_fabric_configfs.c 2294 * Setup callers for generic logic in target_core_fabric_configfs.c
2295 */ 2295 */
2296 .fabric_make_wwn = tcm_vhost_make_tport, 2296 .fabric_make_wwn = vhost_scsi_make_tport,
2297 .fabric_drop_wwn = tcm_vhost_drop_tport, 2297 .fabric_drop_wwn = vhost_scsi_drop_tport,
2298 .fabric_make_tpg = tcm_vhost_make_tpg, 2298 .fabric_make_tpg = vhost_scsi_make_tpg,
2299 .fabric_drop_tpg = tcm_vhost_drop_tpg, 2299 .fabric_drop_tpg = vhost_scsi_drop_tpg,
2300 .fabric_post_link = tcm_vhost_port_link, 2300 .fabric_post_link = vhost_scsi_port_link,
2301 .fabric_pre_unlink = tcm_vhost_port_unlink, 2301 .fabric_pre_unlink = vhost_scsi_port_unlink,
2302 .fabric_make_np = NULL, 2302 .fabric_make_np = NULL,
2303 .fabric_drop_np = NULL, 2303 .fabric_drop_np = NULL,
2304 .fabric_make_nodeacl = tcm_vhost_make_nodeacl, 2304 .fabric_make_nodeacl = vhost_scsi_make_nodeacl,
2305 .fabric_drop_nodeacl = tcm_vhost_drop_nodeacl, 2305 .fabric_drop_nodeacl = vhost_scsi_drop_nodeacl,
2306}; 2306};
2307 2307
2308static int tcm_vhost_register_configfs(void) 2308static int vhost_scsi_register_configfs(void)
2309{ 2309{
2310 struct target_fabric_configfs *fabric; 2310 struct target_fabric_configfs *fabric;
2311 int ret; 2311 int ret;
2312 2312
2313 pr_debug("TCM_VHOST fabric module %s on %s/%s" 2313 pr_debug("vhost-scsi fabric module %s on %s/%s"
2314 " on "UTS_RELEASE"\n", TCM_VHOST_VERSION, utsname()->sysname, 2314 " on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname,
2315 utsname()->machine); 2315 utsname()->machine);
2316 /* 2316 /*
2317 * Register the top level struct config_item_type with TCM core 2317 * Register the top level struct config_item_type with TCM core
@@ -2322,14 +2322,14 @@ static int tcm_vhost_register_configfs(void)
2322 return PTR_ERR(fabric); 2322 return PTR_ERR(fabric);
2323 } 2323 }
2324 /* 2324 /*
2325 * Setup fabric->tf_ops from our local tcm_vhost_ops 2325 * Setup fabric->tf_ops from our local vhost_scsi_ops
2326 */ 2326 */
2327 fabric->tf_ops = tcm_vhost_ops; 2327 fabric->tf_ops = vhost_scsi_ops;
2328 /* 2328 /*
2329 * Setup default attribute lists for various fabric->tf_cit_tmpl 2329 * Setup default attribute lists for various fabric->tf_cit_tmpl
2330 */ 2330 */
2331 fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_vhost_wwn_attrs; 2331 fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = vhost_scsi_wwn_attrs;
2332 fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = tcm_vhost_tpg_attrs; 2332 fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = vhost_scsi_tpg_attrs;
2333 fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; 2333 fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL;
2334 fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; 2334 fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL;
2335 fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; 2335 fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL;
@@ -2349,37 +2349,37 @@ static int tcm_vhost_register_configfs(void)
2349 /* 2349 /*
2350 * Setup our local pointer to *fabric 2350 * Setup our local pointer to *fabric
2351 */ 2351 */
2352 tcm_vhost_fabric_configfs = fabric; 2352 vhost_scsi_fabric_configfs = fabric;
2353 pr_debug("TCM_VHOST[0] - Set fabric -> tcm_vhost_fabric_configfs\n"); 2353 pr_debug("TCM_VHOST[0] - Set fabric -> vhost_scsi_fabric_configfs\n");
2354 return 0; 2354 return 0;
2355}; 2355};
2356 2356
2357static void tcm_vhost_deregister_configfs(void) 2357static void vhost_scsi_deregister_configfs(void)
2358{ 2358{
2359 if (!tcm_vhost_fabric_configfs) 2359 if (!vhost_scsi_fabric_configfs)
2360 return; 2360 return;
2361 2361
2362 target_fabric_configfs_deregister(tcm_vhost_fabric_configfs); 2362 target_fabric_configfs_deregister(vhost_scsi_fabric_configfs);
2363 tcm_vhost_fabric_configfs = NULL; 2363 vhost_scsi_fabric_configfs = NULL;
2364 pr_debug("TCM_VHOST[0] - Cleared tcm_vhost_fabric_configfs\n"); 2364 pr_debug("TCM_VHOST[0] - Cleared vhost_scsi_fabric_configfs\n");
2365}; 2365};
2366 2366
2367static int __init tcm_vhost_init(void) 2367static int __init vhost_scsi_init(void)
2368{ 2368{
2369 int ret = -ENOMEM; 2369 int ret = -ENOMEM;
2370 /* 2370 /*
2371 * Use our own dedicated workqueue for submitting I/O into 2371 * Use our own dedicated workqueue for submitting I/O into
2372 * target core to avoid contention within system_wq. 2372 * target core to avoid contention within system_wq.
2373 */ 2373 */
2374 tcm_vhost_workqueue = alloc_workqueue("tcm_vhost", 0, 0); 2374 vhost_scsi_workqueue = alloc_workqueue("vhost_scsi", 0, 0);
2375 if (!tcm_vhost_workqueue) 2375 if (!vhost_scsi_workqueue)
2376 goto out; 2376 goto out;
2377 2377
2378 ret = vhost_scsi_register(); 2378 ret = vhost_scsi_register();
2379 if (ret < 0) 2379 if (ret < 0)
2380 goto out_destroy_workqueue; 2380 goto out_destroy_workqueue;
2381 2381
2382 ret = tcm_vhost_register_configfs(); 2382 ret = vhost_scsi_register_configfs();
2383 if (ret < 0) 2383 if (ret < 0)
2384 goto out_vhost_scsi_deregister; 2384 goto out_vhost_scsi_deregister;
2385 2385
@@ -2388,20 +2388,20 @@ static int __init tcm_vhost_init(void)
2388out_vhost_scsi_deregister: 2388out_vhost_scsi_deregister:
2389 vhost_scsi_deregister(); 2389 vhost_scsi_deregister();
2390out_destroy_workqueue: 2390out_destroy_workqueue:
2391 destroy_workqueue(tcm_vhost_workqueue); 2391 destroy_workqueue(vhost_scsi_workqueue);
2392out: 2392out:
2393 return ret; 2393 return ret;
2394}; 2394};
2395 2395
2396static void tcm_vhost_exit(void) 2396static void vhost_scsi_exit(void)
2397{ 2397{
2398 tcm_vhost_deregister_configfs(); 2398 vhost_scsi_deregister_configfs();
2399 vhost_scsi_deregister(); 2399 vhost_scsi_deregister();
2400 destroy_workqueue(tcm_vhost_workqueue); 2400 destroy_workqueue(vhost_scsi_workqueue);
2401}; 2401};
2402 2402
2403MODULE_DESCRIPTION("VHOST_SCSI series fabric driver"); 2403MODULE_DESCRIPTION("VHOST_SCSI series fabric driver");
2404MODULE_ALIAS("tcm_vhost"); 2404MODULE_ALIAS("tcm_vhost");
2405MODULE_LICENSE("GPL"); 2405MODULE_LICENSE("GPL");
2406module_init(tcm_vhost_init); 2406module_init(vhost_scsi_init);
2407module_exit(tcm_vhost_exit); 2407module_exit(vhost_scsi_exit);