scsi: add persistent reserve in command with report capabilities support

Change-Id: I676c385ffd51c0ad2c606f948f21beb031ef4c95
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/436095
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2019-05-14 01:43:08 -04:00 committed by Jim Harris
parent fecac0d871
commit c25e9b2437

View File

@ -618,6 +618,29 @@ spdk_scsi_pr_in_read_reservations(struct spdk_scsi_task *task,
return sizeof(param->header);
}
static int
spdk_scsi_pr_in_report_capabilities(struct spdk_scsi_task *task,
uint8_t *data, uint16_t data_len)
{
struct spdk_scsi_pr_in_report_capabilities_data *param;
SPDK_DEBUGLOG(SPDK_LOG_SCSI, "PR IN REPORT CAPABILITIES\n");
param = (struct spdk_scsi_pr_in_report_capabilities_data *)data;
memset(param, 0, sizeof(*param));
/* TODO: can support more capabilities bits */
to_be16(&param->length, sizeof(*param));
param->tmv = 1;
param->wr_ex = 1;
param->ex_ac = 1;
param->wr_ex_ro = 1;
param->ex_ac_ro = 1;
param->wr_ex_ar = 1;
param->ex_ac_ar = 1;
return sizeof(*param);
}
int
spdk_scsi_pr_in(struct spdk_scsi_task *task,
uint8_t *cdb, uint8_t *data,
@ -641,6 +664,9 @@ spdk_scsi_pr_in(struct spdk_scsi_task *task,
}
rc = spdk_scsi_pr_in_read_reservations(task, data, data_len);
break;
case SPDK_SCSI_PR_IN_REPORT_CAPABILITIES:
rc = spdk_scsi_pr_in_report_capabilities(task, data, data_len);
break;
default:
goto invalid;
}