Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144955638
D21807.1777008226.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21807.1777008226.diff
View Options
Index: sys/dev/virtio/scsi/virtio_scsi.h
===================================================================
--- sys/dev/virtio/scsi/virtio_scsi.h
+++ sys/dev/virtio/scsi/virtio_scsi.h
@@ -37,6 +37,10 @@
#define VIRTIO_SCSI_F_HOTPLUG 0x0002 /* Host should enable hot plug/unplug
* of new LUNs and targets.
*/
+#define VIRTIO_SCSI_F_CHANGE 0x0004 /* Host will report changes to LUN
+ * parameters via a
+ * VIRTIO_SCSI_T_PARAM_CHANGE.
+ */
#define VIRTIO_SCSI_CDB_SIZE 32
#define VIRTIO_SCSI_SENSE_SIZE 96
@@ -140,6 +144,7 @@
#define VIRTIO_SCSI_T_NO_EVENT 0
#define VIRTIO_SCSI_T_TRANSPORT_RESET 1
#define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
+#define VIRTIO_SCSI_T_PARAM_CHANGE 3
/* Reasons of transport reset event */
#define VIRTIO_SCSI_EVT_RESET_HARD 0
Index: sys/dev/virtio/scsi/virtio_scsi.c
===================================================================
--- sys/dev/virtio/scsi/virtio_scsi.c
+++ sys/dev/virtio/scsi/virtio_scsi.c
@@ -206,6 +206,7 @@
static struct virtio_feature_desc vtscsi_feature_desc[] = {
{ VIRTIO_SCSI_F_INOUT, "InOut" },
{ VIRTIO_SCSI_F_HOTPLUG, "Hotplug" },
+ { VIRTIO_SCSI_F_CHANGE, "Change" },
{ 0, NULL }
};
@@ -1758,6 +1759,30 @@
}
static void
+vtscsi_param_change_event(struct vtscsi_softc *sc,
+ struct virtio_scsi_event *event)
+{
+ target_id_t target_id;
+ lun_id_t lun_id;
+ uint8_t asc, ascq;
+
+ vtscsi_get_request_lun(event->lun, &target_id, &lun_id);
+
+ asc = event->reason & 0xff;
+ ascq = event->reason >> 8;
+ /*
+ * ASC ASCQ Description
+ * 0x2A 0x00 PARAMETERS CHANGED
+ * 0x2A 0x01 MODE PARAMETERS CHANGED
+ * 0x2A 0x09 CAPACITY DATA HAS CHANGED
+ */
+ if (asc == 0x2a && (ascq == 0x00 || ascq == 0x01 || ascq == 0x09)) {
+ /* Disk capacity has changed. */
+ vtscsi_announce(sc, AC_INQ_CHANGED, target_id, lun_id);
+ }
+}
+
+static void
vtscsi_handle_event(struct vtscsi_softc *sc, struct virtio_scsi_event *event)
{
int error;
@@ -1767,6 +1792,9 @@
case VIRTIO_SCSI_T_TRANSPORT_RESET:
vtscsi_transport_reset_event(sc, event);
break;
+ case VIRTIO_SCSI_T_PARAM_CHANGE:
+ vtscsi_param_change_event(sc, event);
+ break;
default:
device_printf(sc->vtscsi_dev,
"unhandled event: %d\n", event->event);
Index: sys/dev/virtio/scsi/virtio_scsivar.h
===================================================================
--- sys/dev/virtio/scsi/virtio_scsivar.h
+++ sys/dev/virtio/scsi/virtio_scsivar.h
@@ -141,6 +141,7 @@
/* Features desired/implemented by this driver. */
#define VTSCSI_FEATURES \
(VIRTIO_SCSI_F_HOTPLUG | \
+ VIRTIO_SCSI_F_CHANGE | \
VIRTIO_RING_F_INDIRECT_DESC)
#define VTSCSI_MTX(_sc) &(_sc)->vtscsi_mtx
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 24, 5:23 AM (17 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28420655
Default Alt Text
D21807.1777008226.diff (2 KB)
Attached To
Mode
D21807: VirtIO SCSI online disk resize
Attached
Detach File
Event Timeline
Log In to Comment