Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d335983 authored by Nicholas Bellinger's avatar Nicholas Bellinger
Browse files

target/sbc: Only expose PI read_cap16 bits when supported by fabric



Only expose the PI protection type bits in READ_CAPACITY_16
if the session + fabric support DIX PASS operations.

Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent d45aca42
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -89,6 +89,7 @@ static sense_reason_t
sbc_emulate_readcapacity_16(struct se_cmd *cmd)
sbc_emulate_readcapacity_16(struct se_cmd *cmd)
{
{
	struct se_device *dev = cmd->se_dev;
	struct se_device *dev = cmd->se_dev;
	struct se_session *sess = cmd->se_sess;
	unsigned char *rbuf;
	unsigned char *rbuf;
	unsigned char buf[32];
	unsigned char buf[32];
	unsigned long long blocks = dev->transport->get_blocks(dev);
	unsigned long long blocks = dev->transport->get_blocks(dev);
@@ -109,8 +110,10 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd)
	/*
	/*
	 * Set P_TYPE and PROT_EN bits for DIF support
	 * Set P_TYPE and PROT_EN bits for DIF support
	 */
	 */
	if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) {
		if (dev->dev_attrib.pi_prot_type)
		if (dev->dev_attrib.pi_prot_type)
			buf[12] = (dev->dev_attrib.pi_prot_type - 1) << 1 | 0x1;
			buf[12] = (dev->dev_attrib.pi_prot_type - 1) << 1 | 0x1;
	}


	if (dev->transport->get_lbppbe)
	if (dev->transport->get_lbppbe)
		buf[13] = dev->transport->get_lbppbe(dev) & 0x0f;
		buf[13] = dev->transport->get_lbppbe(dev) & 0x0f;