From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: martin.petersen@oracle.com, tomas.winkler@intel.com,
emilne@redhat.com, bart.vanassche@sandisk.com
Subject: [PATCH v2.5 6/6] scsi_debug: use locally assigned naa
Date: Sat, 30 Apr 2016 22:44:47 -0400 [thread overview]
Message-ID: <1462070687-12689-7-git-send-email-dgilbert@interlog.com> (raw)
In-Reply-To: <1462070687-12689-1-git-send-email-dgilbert@interlog.com>
For reported SAS addresses replace fake IEEE registered NAAs (5)
with locally assigned NAAs (3).
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
---
drivers/scsi/scsi_debug.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c14811e..459a4d7 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -921,9 +921,10 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *scp, unsigned char *arr,
static const char * inq_vendor_id = "Linux ";
static const char * inq_product_id = "scsi_debug ";
static const char *inq_product_rev = "0186"; /* version less '.' */
-static const u64 naa5_comp_a = 0x5222222000000000ULL;
-static const u64 naa5_comp_b = 0x5333333000000000ULL;
-static const u64 naa5_comp_c = 0x5111111000000000ULL;
+/* Use some locally assigned NAAs for SAS addresses. */
+static const u64 naa3_comp_a = 0x3222222000000000ULL;
+static const u64 naa3_comp_b = 0x3333333000000000ULL;
+static const u64 naa3_comp_c = 0x3111111000000000ULL;
/* Device identification VPD page. Returns number of bytes placed in arr */
static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
@@ -957,12 +958,12 @@ static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
memcpy(arr + num, lu_name, 16);
num += 16;
} else {
- /* NAA-5, Logical unit identifier (binary) */
+ /* NAA-3, Logical unit identifier (binary) */
arr[num++] = 0x1; /* binary (not necessarily sas) */
arr[num++] = 0x3; /* PIV=0, lu, naa */
arr[num++] = 0x0;
arr[num++] = 0x8;
- put_unaligned_be64(naa5_comp_b + dev_id_num, arr + num);
+ put_unaligned_be64(naa3_comp_b + dev_id_num, arr + num);
num += 8;
}
/* Target relative port number */
@@ -975,14 +976,14 @@ static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
arr[num++] = 0x0;
arr[num++] = 0x1; /* relative port A */
}
- /* NAA-5, Target port identifier */
+ /* NAA-3, Target port identifier */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x93; /* piv=1, target port, naa */
arr[num++] = 0x0;
arr[num++] = 0x8;
- put_unaligned_be64(naa5_comp_a + port_a, arr + num);
+ put_unaligned_be64(naa3_comp_a + port_a, arr + num);
num += 8;
- /* NAA-5, Target port group identifier */
+ /* NAA-3, Target port group identifier */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0x95; /* piv=1, target port group id */
arr[num++] = 0x0;
@@ -991,19 +992,19 @@ static int inquiry_vpd_83(unsigned char *arr, int port_group_id,
arr[num++] = 0;
put_unaligned_be16(port_group_id, arr + num);
num += 2;
- /* NAA-5, Target device identifier */
+ /* NAA-3, Target device identifier */
arr[num++] = 0x61; /* proto=sas, binary */
arr[num++] = 0xa3; /* piv=1, target device, naa */
arr[num++] = 0x0;
arr[num++] = 0x8;
- put_unaligned_be64(naa5_comp_a + target_dev_id, arr + num);
+ put_unaligned_be64(naa3_comp_a + target_dev_id, arr + num);
num += 8;
/* SCSI name string: Target device identifier */
arr[num++] = 0x63; /* proto=sas, UTF-8 */
arr[num++] = 0xa8; /* piv=1, target device, SCSI name string */
arr[num++] = 0x0;
arr[num++] = 24;
- memcpy(arr + num, "naa.52222220", 12);
+ memcpy(arr + num, "naa.32222220", 12);
num += 12;
snprintf(b, sizeof(b), "%08X", target_dev_id);
memcpy(arr + num, b, 8);
@@ -1082,7 +1083,7 @@ static int inquiry_vpd_88(unsigned char *arr, int target_dev_id)
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
- put_unaligned_be64(naa5_comp_a + port_a, arr + num);
+ put_unaligned_be64(naa3_comp_a + port_a, arr + num);
num += 8;
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x0; /* reserved */
@@ -1097,7 +1098,7 @@ static int inquiry_vpd_88(unsigned char *arr, int target_dev_id)
arr[num++] = 0x93; /* PIV=1, target port, NAA */
arr[num++] = 0x0; /* reserved */
arr[num++] = 0x8; /* length */
- put_unaligned_be64(naa5_comp_a + port_b, arr + num);
+ put_unaligned_be64(naa3_comp_a + port_b, arr + num);
num += 8;
return num;
@@ -1927,10 +1928,10 @@ static int resp_sas_pcd_m_spg(unsigned char * p, int pcontrol, int target,
};
int port_a, port_b;
- put_unaligned_be64(naa5_comp_a, sas_pcd_m_pg + 16);
- put_unaligned_be64(naa5_comp_c + 1, sas_pcd_m_pg + 24);
- put_unaligned_be64(naa5_comp_a, sas_pcd_m_pg + 64);
- put_unaligned_be64(naa5_comp_c + 1, sas_pcd_m_pg + 72);
+ put_unaligned_be64(naa3_comp_a, sas_pcd_m_pg + 16);
+ put_unaligned_be64(naa3_comp_c + 1, sas_pcd_m_pg + 24);
+ put_unaligned_be64(naa3_comp_a, sas_pcd_m_pg + 64);
+ put_unaligned_be64(naa3_comp_c + 1, sas_pcd_m_pg + 72);
port_a = target_dev_id + 1;
port_b = port_a + 1;
memcpy(p, sas_pcd_m_pg, sizeof(sas_pcd_m_pg));
--
2.7.4
next prev parent reply other threads:[~2016-05-01 2:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-01 2:44 [PATCH v2.5 0/6] scsi_debug: rebase second half of series Douglas Gilbert
2016-05-01 2:44 ` [PATCH v2.5 1/6] scsi_debug: use pdt constants Douglas Gilbert
2016-05-02 8:25 ` Hannes Reinecke
2016-05-03 23:56 ` Bart Van Assche
2016-05-01 2:44 ` [PATCH v2.5 2/6] scsi_debug: rework resp_report_luns Douglas Gilbert
2016-05-02 8:25 ` Hannes Reinecke
2016-05-02 8:29 ` Winkler, Tomas
2016-05-03 23:58 ` Bart Van Assche
2016-05-01 2:44 ` [PATCH v2.5 3/6] scsi_debug: add multiple queue support Douglas Gilbert
2016-05-02 8:35 ` Hannes Reinecke
2016-05-02 15:35 ` Douglas Gilbert
2016-05-04 22:09 ` Bart Van Assche
2016-05-04 22:32 ` Bart Van Assche
2016-05-06 3:47 ` Douglas Gilbert
2016-05-06 4:20 ` Bart Van Assche
2016-05-01 2:44 ` [PATCH v2.5 4/6] scsi_debug: vpd and mode page work Douglas Gilbert
2016-05-02 8:38 ` Hannes Reinecke
2016-05-02 15:48 ` Douglas Gilbert
2016-05-01 2:44 ` [PATCH v2.5 5/6] scsi_debug: uuid for lu name Douglas Gilbert
2016-05-02 8:38 ` Hannes Reinecke
2016-05-04 22:37 ` Bart Van Assche
2016-05-01 2:44 ` Douglas Gilbert [this message]
2016-05-02 8:39 ` [PATCH v2.5 6/6] scsi_debug: use locally assigned naa Hannes Reinecke
2016-05-04 22:37 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462070687-12689-7-git-send-email-dgilbert@interlog.com \
--to=dgilbert@interlog.com \
--cc=bart.vanassche@sandisk.com \
--cc=emilne@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).