Displaying 12 results from an estimated 12 matches for "wwn_to_u64".
2017 Jan 17
2
[PATCH 2/2] virtio_scsi: Implement fc_host
...t; this patch does the same, so using virtio_* helpers for these fields should
> handle the endianness correctly.
I was suspicious about it because they are defined as "u8 x[8]" in the
virtio_scsi_config struct. So you would need to read with
virtio_cread_bytes and pass the result to wwn_to_u64.
For example, if you have 0x500123456789abcd this would be
0x50 0x01 0x23 0x45 0x67 0x89 0xab 0cd
in virtio_scsi_config, and then virtio_cread64 would read it as a
little-endian u64, 0xcdab896745230150. Maybe your QEMU patch is also
writing things as little-endian 64-bit integers, rather than...
2017 Jan 17
2
[PATCH 2/2] virtio_scsi: Implement fc_host
...t; this patch does the same, so using virtio_* helpers for these fields should
> handle the endianness correctly.
I was suspicious about it because they are defined as "u8 x[8]" in the
virtio_scsi_config struct. So you would need to read with
virtio_cread_bytes and pass the result to wwn_to_u64.
For example, if you have 0x500123456789abcd this would be
0x50 0x01 0x23 0x45 0x67 0x89 0xab 0cd
in virtio_scsi_config, and then virtio_cread64 would read it as a
little-endian u64, 0xcdab896745230150. Maybe your QEMU patch is also
writing things as little-endian 64-bit integers, rather than...
2017 Jan 26
1
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...y_wwpn),
> + &port_name, 8);
> + }
This is racy, isn't it? You need to wrap this in a generation check
otherwise read can race with primary_active changing.
And you might want a wrapper to virtio_cread_bytes that does not
include generation check.
> + fc_host_node_name(shost) = wwn_to_u64(node_name);
> + fc_host_port_name(shost) = wwn_to_u64(port_name);
> + fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
> + fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
> +}
> +
> static int virtscsi_probe(struct virtio_device *vdev)
> {
> - struct Scsi_Host *shost;
> +...
2017 Jan 26
1
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...y_wwpn),
> + &port_name, 8);
> + }
This is racy, isn't it? You need to wrap this in a generation check
otherwise read can race with primary_active changing.
And you might want a wrapper to virtio_cread_bytes that does not
include generation check.
> + fc_host_node_name(shost) = wwn_to_u64(node_name);
> + fc_host_port_name(shost) = wwn_to_u64(port_name);
> + fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
> + fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
> +}
> +
> static int virtscsi_probe(struct virtio_device *vdev)
> {
> - struct Scsi_Host *shost;
> +...
2017 Jan 26
6
[PATCH v2 0/2] virtio-scsi: Implement FC_HOST feature
v2: Fix endianness of WWNN/WWPN. [Paolo]
This series implements the proposed fc_host feature of virtio-scsi.
The first patch updates the data structure changes according to the spec
proposal; the second patch actually implements the operations.
Fam Zheng (2):
virtio_scsi: Add fc_host definitions
virtio_scsi: Implement fc_host
drivers/scsi/virtio_scsi.c | 60
2017 Jan 26
6
[PATCH v2 0/2] virtio-scsi: Implement FC_HOST feature
v2: Fix endianness of WWNN/WWPN. [Paolo]
This series implements the proposed fc_host feature of virtio-scsi.
The first patch updates the data structure changes according to the spec
proposal; the second patch actually implements the operations.
Fam Zheng (2):
virtio_scsi: Add fc_host definitions
virtio_scsi: Implement fc_host
drivers/scsi/virtio_scsi.c | 60
2017 Jan 26
0
[PATCH v2 2/2] virtio_scsi: Implement fc_host
...rimary_wwpn),
+ &port_name, 8);
+ } else {
+ virtio_cread_bytes(vdev,
+ offsetof(struct virtio_scsi_config, secondary_wwnn),
+ &node_name, 8);
+ virtio_cread_bytes(vdev,
+ offsetof(struct virtio_scsi_config, secondary_wwpn),
+ &port_name, 8);
+ }
+ fc_host_node_name(shost) = wwn_to_u64(node_name);
+ fc_host_port_name(shost) = wwn_to_u64(port_name);
+ fc_host_port_type(shost) = FC_PORTTYPE_NPORT;
+ fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
+}
+
static int virtscsi_probe(struct virtio_device *vdev)
{
- struct Scsi_Host *shost;
+ struct Scsi_Host *shost = NULL;
struct vir...
2017 Jan 16
2
[PATCH 2/2] virtio_scsi: Implement fc_host
On 16/01/2017 17:04, Fam Zheng wrote:
> + node_name = virtio_cread64(vdev,
> + offsetof(struct virtio_scsi_config, primary_wwnn));
> + port_name = virtio_cread64(vdev,
> + offsetof(struct virtio_scsi_config, primary_wwpn));
> + } else {
> + node_name = virtio_cread64(vdev,
> + offsetof(struct virtio_scsi_config, secondary_wwnn));
> + port_name =
2017 Jan 17
0
[PATCH 2/2] virtio_scsi: Implement fc_host
...me, so using virtio_* helpers for these fields should
> > handle the endianness correctly.
>
> I was suspicious about it because they are defined as "u8 x[8]" in the
> virtio_scsi_config struct. So you would need to read with
> virtio_cread_bytes and pass the result to wwn_to_u64.
>
> For example, if you have 0x500123456789abcd this would be
>
> 0x50 0x01 0x23 0x45 0x67 0x89 0xab 0cd
>
> in virtio_scsi_config, and then virtio_cread64 would read it as a
> little-endian u64, 0xcdab896745230150. Maybe your QEMU patch is also
> writing things as lit...
2017 Jan 16
2
[PATCH 2/2] virtio_scsi: Implement fc_host
On 16/01/2017 17:04, Fam Zheng wrote:
> + node_name = virtio_cread64(vdev,
> + offsetof(struct virtio_scsi_config, primary_wwnn));
> + port_name = virtio_cread64(vdev,
> + offsetof(struct virtio_scsi_config, primary_wwpn));
> + } else {
> + node_name = virtio_cread64(vdev,
> + offsetof(struct virtio_scsi_config, secondary_wwnn));
> + port_name =
2012 Apr 20
1
[PATCH] multiqueue: a hodge podge of things
...n[8];
memset(wwn, 0, sizeof(wwn));
/* Validate and store the new name */
for (i=0, j=0; i < 16; i++) {
int value;
value = hex_to_bin(*ns++);
if (value >= 0)
j = (j << 4) | value;
else
return -EINVAL;
if (i % 2) {
wwn[i/2] = j & 0xff;
j = 0;
}
}
*nm = wwn_to_u64(wwn);
return 0;
}
/*
* "Short-cut" sysfs variable to create a new vport on a FC Host.
* Input is a string of the form "<WWPN>:<WWNN>". Other attributes
* will default to a NPIV-based FCP_Initiator; The WWNs are specified
* as hex characters, and may *not* con...
2012 Apr 20
1
[PATCH] multiqueue: a hodge podge of things
...n[8];
memset(wwn, 0, sizeof(wwn));
/* Validate and store the new name */
for (i=0, j=0; i < 16; i++) {
int value;
value = hex_to_bin(*ns++);
if (value >= 0)
j = (j << 4) | value;
else
return -EINVAL;
if (i % 2) {
wwn[i/2] = j & 0xff;
j = 0;
}
}
*nm = wwn_to_u64(wwn);
return 0;
}
/*
* "Short-cut" sysfs variable to create a new vport on a FC Host.
* Input is a string of the form "<WWPN>:<WWNN>". Other attributes
* will default to a NPIV-based FCP_Initiator; The WWNs are specified
* as hex characters, and may *not* con...