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 12/12] scsi_debug: use locally assigned naa
Date: Fri, 29 Apr 2016 21:39:19 -0400 [thread overview]
Message-ID: <1461980359-4320-13-git-send-email-dgilbert@interlog.com> (raw)
In-Reply-To: <1461980359-4320-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 ff3f769..19fe0b3 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
prev parent reply other threads:[~2016-04-30 1:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-30 1:39 [PATCH v2 00/12] scsi_debug: multiple queue support and cleanup Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 01/12] scsi_debug: cleanup naming and bit crunching Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 02/12] scsi_debug: ignore host lock option Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 03/12] scsi_debug: replace jiffy timers with hr timers Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 04/12] scsi_debug: make jiffy delay name clearer Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 05/12] scsi_debug: replace tasklet with work queue Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 06/12] scsi_debug: re-order file scope declarations Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 07/12] scsi_debug: use likely hints on fast path Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 08/12] scsi_debug: rework resp_report_luns Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 09/12] scsi_debug: add multiple queue support Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 10/12] scsi_debug: vpd and mode page work Douglas Gilbert
2016-04-30 1:39 ` [PATCH v2 11/12] scsi_debug: uuid for lu name Douglas Gilbert
2016-04-30 1:39 ` Douglas Gilbert [this message]
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=1461980359-4320-13-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.