Skip to content

Commit 0ab8ac6

Browse files
Mike ChristieNicholas Bellinger
authored andcommitted
target: export protocol identifier
I think the transport statistics device file was supposed to show scsiTransportProtocolType. It instead shows the fabric name which is normally closer to the driver name. I was thinking I cannot change from fabric name to protocol type name incase people are expecting the driver name, so this patch adds another file proto_id that exports the SCSI protocol identifier ID. Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 6cb3216 commit 0ab8ac6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/target/target_core_stat.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,16 +795,34 @@ static ssize_t target_stat_transport_dev_name_show(struct config_item *item,
795795
return ret;
796796
}
797797

798+
static ssize_t target_stat_transport_proto_id_show(struct config_item *item,
799+
char *page)
800+
{
801+
struct se_lun *lun = to_transport_stat(item);
802+
struct se_device *dev;
803+
struct se_portal_group *tpg = lun->lun_tpg;
804+
ssize_t ret = -ENODEV;
805+
806+
rcu_read_lock();
807+
dev = rcu_dereference(lun->lun_se_dev);
808+
if (dev)
809+
ret = snprintf(page, PAGE_SIZE, "%u\n", tpg->proto_id);
810+
rcu_read_unlock();
811+
return ret;
812+
}
813+
798814
CONFIGFS_ATTR_RO(target_stat_transport_, inst);
799815
CONFIGFS_ATTR_RO(target_stat_transport_, device);
800816
CONFIGFS_ATTR_RO(target_stat_transport_, indx);
801817
CONFIGFS_ATTR_RO(target_stat_transport_, dev_name);
818+
CONFIGFS_ATTR_RO(target_stat_transport_, proto_id);
802819

803820
static struct configfs_attribute *target_stat_scsi_transport_attrs[] = {
804821
&target_stat_transport_attr_inst,
805822
&target_stat_transport_attr_device,
806823
&target_stat_transport_attr_indx,
807824
&target_stat_transport_attr_dev_name,
825+
&target_stat_transport_attr_proto_id,
808826
NULL,
809827
};
810828

0 commit comments

Comments
 (0)