: Add INQUIRY EVPD response parsing support
PATCH 1/1 : Add INQUIRY EVPD response parsing support
Greetings all,
This patch is made against lio-core-2.6.git/master
and tested on v2.6.28. The lio-core-2.6.git tree can be found at:
http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=summary
Thanks,
--nab
Quoted 1 line
From
332300358bc0528925105acd5974a304641abd79Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Thu, 15 Jan 2009 13:24:38 -0800
Subject: [PATCH] [Target_Core_Mod]: Add INQUIRY EVPD response parsing support
This patch adds the following INQUIRY EVPD=1 protocol information:
*) Protocol Identifier
*) Association
*) Identifier Type
*) Identifier Binary, ASCII, and UTF-8 encoding
and saves each of the EVPD page information in a t10_evpd_t structure attached to the se_dev_t->t10_wwn structure, in v3.0 data structure terms. This naming was defined with spc3r23.pdf, and from a quick look at spc4r17.pdf the naming is pretty much the same, with one exception: IDENTIFIER TYPE becomes DESIGNATOR TYPE.
This patch also adds se_release_evpd_for_dev() function/usage.
Here are some examples from "real" SCSI hardware registration:
Parallel SCSI:
Vendor: MAXTOR Model: ATLAS15K_36SCA Revision: DT60
Type: Direct-Access ANSI SCSI revision: 03
T10 EVPD Unit Serial Number: C40464HK
T10 EVPD Page Length: 36
T10 EVPD Identifer Length: 8
T10 EVPD Identifier Association: addressed logical unit T10 EVPD Identifier Type: EUI-64 based
T10 EVPD Binary Device Identifier: 20010b9fe9f4b0200 T10 EVPD Identifer Length: 20
T10 EVPD Identifier Association: addressed logical unit T10 EVPD Identifier Type: T10 Vendor ID based T10 EVPD ASCII Device Identifier: MAXTOR C40464HK
Serial SCSI (SAS):
Vendor: MAXTOR Model: ATLAS15K2_36SAS Revision: BG3H
Type: Direct-Access ANSI SCSI revision: 02
T10 EVPD Unit Serial Number: E20HY72K
T10 EVPD Page Length: 60
T10 EVPD Identifer Length: 8
T10 EVPD Identifier Association: addressed logical unit T10 EVPD Identifier Type: NAA
T10 EVPD Binary Device Identifier: 350010b90000292df T10 EVPD Identifer Length: 8
T10 EVPD Protocol Identifier: SAS Serial SCSI Protocol T10 EVPD Identifier Association: target port
T10 EVPD Identifier Type: NAA
T10 EVPD Binary Device Identifier: 350010b90000292de T10 EVPD Identifer Length: 4
T10 EVPD Protocol Identifier: SAS Serial SCSI Protocol T10 EVPD Identifier Association: target port
T10 EVPD Identifier Type: Relative target port identifier T10 EVPD Binary Device Identifier: 400000002
T10 EVPD Identifer Length: 24
T10 EVPD Identifier Association: SCSI target device T10 EVPD Identifier Type: SCSI name string
T10 EVPD UTF-8 Device Identifier: naa.50010B90000292DC
--- drivers/lio-core/target_core_base.h | 15 ++- drivers/lio-core/target_core_device.c | 17 ++ drivers/lio-core/target_core_device.h | 1 + drivers/lio-core/target_core_transport.c | 307 ++++++++++++++++++++++++++++-- 4 files changed, 317 insertions(+), 23 deletions(-)
drivers/lio-core/target_core_base.h +13 -2
@@ -51,6 +51,8 @@#define TRANSPORT_IQN_LEN 224/* Currently same as ISCSI_IQN_LEN */ +#define EVPD_TMP_BUF_SIZE 128/* Used to parse EVPD into t10_evpd_t */ +/* used by PSCSI and iBlock Transport drivers */ #define READ_BLOCK_LEN 6#define READ_CAP_LEN 8
@@ -232,13 +234,22 @@ typedef struct se_obj_s {atomic_t obj_access_count; }____cacheline_aligned se_obj_t; +typedef struct t10_evpd_s { +unsigned char device_identifier[INQUIRY_EVPD_DEVICE_IDENTIFIER_LEN ]; +u32 protocol_identifier; +u32 device_identifier_code_set; +u32 association; +u32 device_identifier_type; +struct list_head evpd_list; +}t10_evpd_t ; +typedef struct t10_wwn_s {unsigned char vendor[8 ];unsigned char model[16 ];unsigned char revision[4 ];unsigned char unit_serial[INQUIRY_EVPD_SERIAL_LEN ]; -u32 device_identifier_code_set; -unsigned char device_identifier[INQUIRY_EVPD_DEVICE_IDENTIFIER_LEN ]; +spinlock_t t10_evpd_lock; +struct list_head t10_evpd_list; }____cacheline_aligned t10_wwn_t ; typedef struct se_queue_req_s {
drivers/lio-core/target_core_device.c +17 -0
@@ -592,6 +592,8 @@ extern void se_release_device_for_hba (se_device_t *dev)REMOVE_ENTRY_FROM_LIST (dev, hba->device_head, hba->device_tail); hba->dev_count--;spin_unlock (&hba->device_lock); + +se_release_evpd_for_dev (dev);kfree (dev->dev_status_queue_obj);kfree (dev->dev_queue_obj);
@@ -600,6 +602,21 @@ extern void se_release_device_for_hba (se_device_t *dev)return ; } +extern void se_release_evpd_for_dev (se_device_t *dev) +{ +t10_evpd_t *evpd, *evpd_tmp; + +spin_lock (&dev->t10_wwn.t10_evpd_lock); +list_for_each_entry_safe (evpd, evpd_tmp, &dev->t10_wwn.t10_evpd_list, + evpd_list) { +list_del (&evpd->evpd_list); +kfree (evpd); + } +spin_unlock (&dev->t10_wwn.t10_evpd_lock); + +return ; +} + extern int transport_get_lun_for_cmd ( se_cmd_t *se_cmd, unsigned char *cdb,
drivers/lio-core/target_core_device.h +1 -0
@@ -42,6 +42,7 @@ extern void core_update_device_list_for_node (se_lun_t *lun, u32, u32, se_node_aextern void core_clear_lun_from_tpg (se_lun_t *,se_portal_group_t *);extern int transport_core_report_lun_response (se_cmd_t *);extern void se_release_device_for_hba (se_device_t *); +extern void se_release_evpd_for_dev (se_device_t *);extern void se_clear_dev_ports (se_device_t *);extern int se_free_virtual_device (se_device_t *,se_hba_t *);extern void se_dev_start (se_device_t *);
drivers/lio-core/target_core_transport.c +286 -21
349 lines not on this page · raw message
Signature · 1 line
1.5.4.1