diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-04-02 16:34:04 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-04-07 04:48:56 -0400 |
commit | 2d3359832513ac62a8bd6d2bffbb2c5bdd29aad3 (patch) | |
tree | cae9200f111c4cf2d16bc88c1e0c20f29edd5bdc | |
parent | d45aca42a25c4ba7a73115fcf2283ee1a822665e (diff) |
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: Sagi 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: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_sbc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index ec204f7ef126..f2d73dd4f9a3 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -89,6 +89,7 @@ static sense_reason_t | |||
89 | sbc_emulate_readcapacity_16(struct se_cmd *cmd) | 89 | sbc_emulate_readcapacity_16(struct se_cmd *cmd) |
90 | { | 90 | { |
91 | struct se_device *dev = cmd->se_dev; | 91 | struct se_device *dev = cmd->se_dev; |
92 | struct se_session *sess = cmd->se_sess; | ||
92 | unsigned char *rbuf; | 93 | unsigned char *rbuf; |
93 | unsigned char buf[32]; | 94 | unsigned char buf[32]; |
94 | unsigned long long blocks = dev->transport->get_blocks(dev); | 95 | unsigned long long blocks = dev->transport->get_blocks(dev); |
@@ -109,8 +110,10 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd) | |||
109 | /* | 110 | /* |
110 | * Set P_TYPE and PROT_EN bits for DIF support | 111 | * Set P_TYPE and PROT_EN bits for DIF support |
111 | */ | 112 | */ |
112 | if (dev->dev_attrib.pi_prot_type) | 113 | if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) { |
113 | buf[12] = (dev->dev_attrib.pi_prot_type - 1) << 1 | 0x1; | 114 | if (dev->dev_attrib.pi_prot_type) |
115 | buf[12] = (dev->dev_attrib.pi_prot_type - 1) << 1 | 0x1; | ||
116 | } | ||
114 | 117 | ||
115 | if (dev->transport->get_lbppbe) | 118 | if (dev->transport->get_lbppbe) |
116 | buf[13] = dev->transport->get_lbppbe(dev) & 0x0f; | 119 | buf[13] = dev->transport->get_lbppbe(dev) & 0x0f; |