Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 292825
b: refs/heads/master
c: ea98d7f
h: refs/heads/master
i:
  292823: cf1162b
v: v3
  • Loading branch information
Andy Grover authored and Nicholas Bellinger committed Feb 25, 2012
1 parent cf70fc2 commit f92dcac
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a1321f71e87930579afc4a4029cce128c23f3fd3
refs/heads/master: ea98d7f9c7cc38de55f81a1c249112442b93c7c9
48 changes: 48 additions & 0 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,54 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
}
EXPORT_SYMBOL(target_submit_cmd);

/**
* target_submit_tmr - lookup unpacked lun and submit uninitialized se_cmd
* for TMR CDBs
*
* @se_cmd: command descriptor to submit
* @se_sess: associated se_sess for endpoint
* @sense: pointer to SCSI sense buffer
* @unpacked_lun: unpacked LUN to reference for struct se_lun
* @fabric_context: fabric context for TMR req
* @tm_type: Type of TM request
*
* Callable from all contexts.
**/

void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
unsigned char *sense, u32 unpacked_lun,
void *fabric_tmr_ptr, unsigned char tm_type, int flags)
{
struct se_portal_group *se_tpg;
int ret;

se_tpg = se_sess->se_tpg;
BUG_ON(!se_tpg);

transport_init_se_cmd(se_cmd, se_tpg->se_tpg_tfo, se_sess,
0, DMA_NONE, MSG_SIMPLE_TAG, sense);

/* See target_submit_cmd for commentary */
target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF));

ret = core_tmr_alloc_req(se_cmd, fabric_tmr_ptr, tm_type, GFP_KERNEL);
if (ret < 0) {
dump_stack();
/* FIXME XXX */
return;
}

ret = transport_lookup_tmr_lun(se_cmd, unpacked_lun);
if (ret) {
transport_send_check_condition_and_sense(se_cmd,
se_cmd->scsi_sense_reason, 0);
transport_generic_free_cmd(se_cmd, 0);
return;
}
transport_generic_handle_tmr(se_cmd);
}
EXPORT_SYMBOL(target_submit_tmr);

/*
* Used by fabric module frontends defining a TFO->new_cmd_map() caller
* to queue up a newly setup se_cmd w/ TRANSPORT_NEW_CMD_MAP in order to
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/target/target_core_fabric.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ int transport_lookup_cmd_lun(struct se_cmd *, u32);
int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
unsigned char *, u32, u32, int, int, int);
void target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
unsigned char *sense, u32 unpacked_lun,
void *fabric_tmr_ptr, unsigned char tm_type, int flags);
int transport_handle_cdb_direct(struct se_cmd *);
int transport_generic_handle_cdb_map(struct se_cmd *);
int transport_generic_handle_data(struct se_cmd *);
Expand Down

0 comments on commit f92dcac

Please sign in to comment.