qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Johannes Thumshirn <jthumshirn@suse.com>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.com>,
	Hannes Reinecke <hare@suse.de>
Subject: [Qemu-devel] [PATCH 1/3] scsi-disk: Add 'port_group' property
Date: Mon, 16 Nov 2015 15:36:56 +0100	[thread overview]
Message-ID: <1447684618-17794-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1447684618-17794-1-git-send-email-hare@suse.de>

Each SCSI target port can have a 'target port group' identifier.
This identifier is used for management software to group individual
I_T_L nexus together eg when assembling a multipath topology.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 hw/scsi/scsi-disk.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 4797d83..f544f43 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -79,6 +79,7 @@ struct SCSIDiskState
     uint64_t wwn;
     uint64_t port_wwn;
     uint16_t port_index;
+    uint16_t port_group;
     uint64_t max_unmap_size;
     uint64_t max_io_size;
     QEMUBH *bh;
@@ -658,6 +659,14 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
                 stw_be_p(&outbuf[buflen + 2], s->port_index);
                 buflen += 4;
             }
+            if (s->port_group) {
+                outbuf[buflen++] = 0x61; // SAS / Binary
+                outbuf[buflen++] = 0x95; // PIV / Target port / target port group
+                outbuf[buflen++] = 0;    // reserved
+                outbuf[buflen++] = 4;
+                stw_be_p(&outbuf[buflen + 2], s->port_group);
+                buflen += 4;
+            }
             break;
         }
         case 0xb0: /* block limits */
@@ -2670,6 +2679,7 @@ static Property scsi_hd_properties[] = {
     DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0),
     DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, port_wwn, 0),
     DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0),
+    DEFINE_PROP_UINT16("port_group", SCSIDiskState, port_group, 0),
     DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size,
                        DEFAULT_MAX_UNMAP_SIZE),
     DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size,
@@ -2720,6 +2730,7 @@ static Property scsi_cd_properties[] = {
     DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0),
     DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, port_wwn, 0),
     DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0),
+    DEFINE_PROP_UINT16("port_group", SCSIDiskState, port_group, 0),
     DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size,
                        DEFAULT_MAX_IO_SIZE),
     DEFINE_PROP_END_OF_LIST(),
@@ -2785,6 +2796,7 @@ static Property scsi_disk_properties[] = {
     DEFINE_PROP_UINT64("wwn", SCSIDiskState, wwn, 0),
     DEFINE_PROP_UINT64("port_wwn", SCSIDiskState, port_wwn, 0),
     DEFINE_PROP_UINT16("port_index", SCSIDiskState, port_index, 0),
+    DEFINE_PROP_UINT16("port_group", SCSIDiskState, port_group, 0),
     DEFINE_PROP_UINT64("max_unmap_size", SCSIDiskState, max_unmap_size,
                        DEFAULT_MAX_UNMAP_SIZE),
     DEFINE_PROP_UINT64("max_io_size", SCSIDiskState, max_io_size,
-- 
1.8.4.5

  reply	other threads:[~2015-11-16 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 14:36 [Qemu-devel] [PATCH 0/3] SCSI ALUA support Hannes Reinecke
2015-11-16 14:36 ` Hannes Reinecke [this message]
2015-11-16 14:36 ` [Qemu-devel] [PATCH 2/3] scsi-disk: Add 'alua_state' property Hannes Reinecke
2015-11-16 14:36 ` [Qemu-devel] [PATCH 3/3] scsi-disk: Implement 'REPORT TARGET PORT GROUPS' Hannes Reinecke
2015-11-25  7:55   ` Stefan Hajnoczi
2015-11-25  8:55     ` Hannes Reinecke

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=1447684618-17794-2-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=agraf@suse.com \
    --cc=jthumshirn@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).