IB/iser: Publish T10-PI support to SCSI midlayer
After allocating a scsi_host we set protection types and guard type supported. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Alex Tabachnik <alext@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
Родитель
0a7a08ad6f
Коммит
6192d4e6bb
|
@ -435,6 +435,17 @@ static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session)
|
||||||
iscsi_host_free(shost);
|
iscsi_host_free(shost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned int
|
||||||
|
iser_dif_prot_caps(int prot_caps)
|
||||||
|
{
|
||||||
|
return ((prot_caps & IB_PROT_T10DIF_TYPE_1) ? SHOST_DIF_TYPE1_PROTECTION |
|
||||||
|
SHOST_DIX_TYPE1_PROTECTION : 0) |
|
||||||
|
((prot_caps & IB_PROT_T10DIF_TYPE_2) ? SHOST_DIF_TYPE2_PROTECTION |
|
||||||
|
SHOST_DIX_TYPE2_PROTECTION : 0) |
|
||||||
|
((prot_caps & IB_PROT_T10DIF_TYPE_3) ? SHOST_DIF_TYPE3_PROTECTION |
|
||||||
|
SHOST_DIX_TYPE3_PROTECTION : 0);
|
||||||
|
}
|
||||||
|
|
||||||
static struct iscsi_cls_session *
|
static struct iscsi_cls_session *
|
||||||
iscsi_iser_session_create(struct iscsi_endpoint *ep,
|
iscsi_iser_session_create(struct iscsi_endpoint *ep,
|
||||||
uint16_t cmds_max, uint16_t qdepth,
|
uint16_t cmds_max, uint16_t qdepth,
|
||||||
|
@ -459,8 +470,18 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,
|
||||||
* older userspace tools (before 2.0-870) did not pass us
|
* older userspace tools (before 2.0-870) did not pass us
|
||||||
* the leading conn's ep so this will be NULL;
|
* the leading conn's ep so this will be NULL;
|
||||||
*/
|
*/
|
||||||
if (ep)
|
if (ep) {
|
||||||
ib_conn = ep->dd_data;
|
ib_conn = ep->dd_data;
|
||||||
|
if (ib_conn->pi_support) {
|
||||||
|
u32 sig_caps = ib_conn->device->dev_attr.sig_prot_cap;
|
||||||
|
|
||||||
|
scsi_host_set_prot(shost, iser_dif_prot_caps(sig_caps));
|
||||||
|
if (iser_pi_guard)
|
||||||
|
scsi_host_set_guard(shost, SHOST_DIX_GUARD_IP);
|
||||||
|
else
|
||||||
|
scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (iscsi_host_add(shost,
|
if (iscsi_host_add(shost,
|
||||||
ep ? ib_conn->device->ib_device->dma_device : NULL))
|
ep ? ib_conn->device->ib_device->dma_device : NULL))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче