Target initiated NOP:
Initial support to try to respond to target initiated NOPs.
This commit is contained in:
45
lib/nop.c
45
lib/nop.c
@@ -47,12 +47,15 @@ iscsi_nop_out_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
||||
iscsi_pdu_set_ttt(pdu, 0xffffffff);
|
||||
|
||||
/* lun */
|
||||
iscsi_pdu_set_lun(pdu, 2);
|
||||
iscsi_pdu_set_lun(pdu, 0);
|
||||
|
||||
/* cmdsn is not increased if Immediate delivery*/
|
||||
iscsi_pdu_set_cmdsn(pdu, iscsi->cmdsn);
|
||||
pdu->cmdsn = iscsi->cmdsn;
|
||||
|
||||
/* exp statsn */
|
||||
iscsi_pdu_set_expstatsn(pdu, iscsi->statsn+1);
|
||||
|
||||
pdu->callback = cb;
|
||||
pdu->private_data = private_data;
|
||||
|
||||
@@ -71,6 +74,46 @@ iscsi_nop_out_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt)
|
||||
{
|
||||
struct iscsi_pdu *pdu;
|
||||
|
||||
pdu = iscsi_allocate_pdu_with_itt_flags(iscsi, ISCSI_PDU_NOP_OUT, ISCSI_PDU_NO_PDU,
|
||||
0xffffffff,ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK);
|
||||
if (pdu == NULL) {
|
||||
iscsi_set_error(iscsi, "Failed to allocate nop-out pdu");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* immediate flag */
|
||||
iscsi_pdu_set_immediate(pdu);
|
||||
|
||||
/* flags */
|
||||
iscsi_pdu_set_pduflags(pdu, 0x80);
|
||||
|
||||
/* ttt */
|
||||
iscsi_pdu_set_ttt(pdu, ttt);
|
||||
|
||||
/* lun */
|
||||
iscsi_pdu_set_lun(pdu, 0);
|
||||
|
||||
/* cmdsn is not increased if Immediate delivery*/
|
||||
iscsi_pdu_set_cmdsn(pdu, iscsi->cmdsn);
|
||||
pdu->cmdsn = iscsi->cmdsn;
|
||||
|
||||
/* exp statsn */
|
||||
iscsi_pdu_set_expstatsn(pdu, iscsi->statsn+1);
|
||||
|
||||
if (iscsi_queue_pdu(iscsi, pdu) != 0) {
|
||||
iscsi_set_error(iscsi, "failed to queue iscsi nop-out pdu");
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_process_nop_out_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
|
||||
struct iscsi_in_pdu *in)
|
||||
|
||||
Reference in New Issue
Block a user