* [Qemu-devel] [PATCH v2] spapr-vscsi: Report error on unsupported MAD requests
@ 2013-08-29 8:13 Alexey Kardashevskiy
2013-08-30 14:42 ` Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kardashevskiy @ 2013-08-29 8:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, Paolo Bonzini, qemu-ppc, Alexander Graf
The existing driver just dropped unsupported requests. This adds error
responses to those unhandled requests.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* reorganized code to have one return from the function
* fixed response length according to the spec, it is byte-swapped in
vscsi_send_iu()
---
hw/scsi/spapr_vscsi.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index cc35b1b..52294ef 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -950,29 +950,43 @@ static int vscsi_send_capabilities(VSCSIState *s, vscsi_req *req)
static int vscsi_handle_mad_req(VSCSIState *s, vscsi_req *req)
{
union mad_iu *mad = &req->iu.mad;
+ bool request_handled = false;
+ uint64_t retlen = 0;
switch (be32_to_cpu(mad->empty_iu.common.type)) {
case VIOSRP_EMPTY_IU_TYPE:
fprintf(stderr, "Unsupported EMPTY MAD IU\n");
+ retlen = sizeof(mad->empty_iu);
break;
case VIOSRP_ERROR_LOG_TYPE:
fprintf(stderr, "Unsupported ERROR LOG MAD IU\n");
- mad->error_log.common.status = cpu_to_be16(1);
- vscsi_send_iu(s, req, sizeof(mad->error_log), VIOSRP_MAD_FORMAT);
+ retlen = sizeof(mad->error_log);
break;
case VIOSRP_ADAPTER_INFO_TYPE:
vscsi_send_adapter_info(s, req);
+ request_handled = true;
break;
case VIOSRP_HOST_CONFIG_TYPE:
- mad->host_config.common.status = cpu_to_be16(1);
- vscsi_send_iu(s, req, sizeof(mad->host_config), VIOSRP_MAD_FORMAT);
+ retlen = sizeof(mad->host_config);
break;
case VIOSRP_CAPABILITIES_TYPE:
vscsi_send_capabilities(s, req);
+ request_handled = true;
break;
default:
fprintf(stderr, "VSCSI: Unknown MAD type %02x\n",
be32_to_cpu(mad->empty_iu.common.type));
+ /*
+ * PAPR+ says that "The length field is set to the length
+ * of the data structure(s) used in the command".
+ * As we did not recognize the request type, put zero there.
+ */
+ retlen = 0;
+ }
+
+ if (!request_handled) {
+ mad->empty_iu.common.status = cpu_to_be16(VIOSRP_MAD_NOT_SUPPORTED);
+ vscsi_send_iu(s, req, retlen, VIOSRP_MAD_FORMAT);
}
return 1;
--
1.8.4.rc4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] spapr-vscsi: Report error on unsupported MAD requests
2013-08-29 8:13 [Qemu-devel] [PATCH v2] spapr-vscsi: Report error on unsupported MAD requests Alexey Kardashevskiy
@ 2013-08-30 14:42 ` Alexander Graf
2013-08-30 15:08 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2013-08-30 14:42 UTC (permalink / raw)
To: Alexey Kardashevskiy; +Cc: Paolo Bonzini, qemu-ppc, qemu-devel
On 29.08.2013, at 10:13, Alexey Kardashevskiy wrote:
> The existing driver just dropped unsupported requests. This adds error
> responses to those unhandled requests.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Alexander Graf <agraf@suse.de>
Paolo, you want to take this one?
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v2] spapr-vscsi: Report error on unsupported MAD requests
2013-08-30 14:42 ` Alexander Graf
@ 2013-08-30 15:08 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2013-08-30 15:08 UTC (permalink / raw)
To: Alexander Graf; +Cc: Alexey Kardashevskiy, qemu-ppc, qemu-devel
Il 30/08/2013 16:42, Alexander Graf ha scritto:
>
> On 29.08.2013, at 10:13, Alexey Kardashevskiy wrote:
>
>> The existing driver just dropped unsupported requests. This adds error
>> responses to those unhandled requests.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>
> Acked-by: Alexander Graf <agraf@suse.de>
>
> Paolo, you want to take this one?
I can take it, but I first need a good version of "Adding VSCSI
capabilities" on which this patch depends.
Thanks for the Acked-by!
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-30 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29 8:13 [Qemu-devel] [PATCH v2] spapr-vscsi: Report error on unsupported MAD requests Alexey Kardashevskiy
2013-08-30 14:42 ` Alexander Graf
2013-08-30 15:08 ` Paolo Bonzini
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.