Skip to contentSkip to conversation

include/public: add command result definitions to vscsiif.h

PATCH In review Juergen Gross 3 participants 7 messages Mar 23, 2022 – Apr 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 include/public: add command result definitions to vscsiif.h

The result field of struct vscsiif_response is lacking a detailed definition. Today the Linux kernel internal scsi definitions are being used, which is not a sane interface for a PV device driver.

Add macros to change that by using today's values in the XEN namespace.

---
V2:
- put macro parameters in parentheses (Jan Beulich)
- correct XEN_VSCSIIF_RSLT_HOST() (Jan Beulich)
- more verbose result defines (Jan Beulich)
- add reset result defines (Jan Beulich)

---
 xen/include/public/io/vscsiif.h | 51 +++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
xen/include/public/io/vscsiif.h +51 -0
index c9ceb1884d..8553b17cc6 100644
@@ -315,6 +315,57 @@ struct vscsiif_response {
 };
 typedef struct vscsiif_response vscsiif_response_t;
 
+/* SCSI I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_STATUS(x)  ((x) & 0x00ff)
+
+/* Host I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_HOST(x)    (((x) & 0x00ff0000) >> 16)
+#define XEN_VSCSIIF_RSLT_HOST_OK                   0
+/* Couldn't connect before timeout */
+#define XEN_VSCSIIF_RSLT_HOST_NO_CONNECT           1
+/* Bus busy through timeout */
+#define XEN_VSCSIIF_RSLT_HOST_BUS_BUSY             2
+/* Timed out for other reason */
+#define XEN_VSCSIIF_RSLT_HOST_TIME_OUT             3
+/* Bad target */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_TARGET           4
+/* Abort for some other reason */
+#define XEN_VSCSIIF_RSLT_HOST_ABORT                5
+/* Parity error */
+#define XEN_VSCSIIF_RSLT_HOST_PARITY               6
+/* Internal error */
+#define XEN_VSCSIIF_RSLT_HOST_ERROR                7
+/* Reset by somebody */
+#define XEN_VSCSIIF_RSLT_HOST_RESET                8
+/* Unexpected interrupt */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_INTR             9
+/* Force command past mid-layer */
+#define XEN_VSCSIIF_RSLT_HOST_PASSTHROUGH         10
+/* Retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_SOFT_ERROR          11
+/* Hidden retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_IMM_RETRY           12
+/* Requeue command requested */
+#define XEN_VSCSIIF_RSLT_HOST_REQUEUE             13
+/* Transport error disrupted I/O */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
+/* Transport class fastfailed */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15
+/* Permanent target failure */
+#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
+/* Permanent nexus failure on path */
+#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
+/* Space allocation on device failed */
+#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
+/* Medium error */
+#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
+/* Transport marginal errors */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20
+
+/* Result values of reset operations */
+#define XEN_VSCSIIF_RSLT_RESET_SUCCESS  0x2002
+#define XEN_VSCSIIF_RSLT_RESET_FAILED   0x2003
+
 DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
 
 
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 65 lines · Juergen Gross

The result field of struct vscsiif_response is lacking a detailed definition. Today the Linux kernel internal scsi definitions are being used, which is not a sane interface for a PV device driver.

Add macros to change that by using today's values in the XEN namespace.

---
V2:
- put macro parameters in parentheses (Jan Beulich)
- correct XEN_VSCSIIF_RSLT_HOST() (Jan Beulich)
- more verbose result defines (Jan Beulich)
- add reset result defines (Jan Beulich)
---
xen/include/public/io/vscsiif.h | 51 +++++++++++++++++++++++++++++++++

1 file changed, 51 insertions(+)
xen/include/public/io/vscsiif.h +36 -0
index c9ceb1884d..8553b17cc6 100644
@@ -315,6 +315,57 @@ struct vscsiif_response {
 };
 typedef struct vscsiif_response vscsiif_response_t;
 
+/* SCSI I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_STATUS(x)  ((x) & 0x00ff)
+
+/* Host I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_HOST(x)    (((x) & 0x00ff0000) >> 16)
+#define XEN_VSCSIIF_RSLT_HOST_OK                   0
+/* Couldn't connect before timeout */
+#define XEN_VSCSIIF_RSLT_HOST_NO_CONNECT           1
+/* Bus busy through timeout */
+#define XEN_VSCSIIF_RSLT_HOST_BUS_BUSY             2
+/* Timed out for other reason */
+#define XEN_VSCSIIF_RSLT_HOST_TIME_OUT             3
+/* Bad target */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_TARGET           4
+/* Abort for some other reason */
+#define XEN_VSCSIIF_RSLT_HOST_ABORT                5
+/* Parity error */
+#define XEN_VSCSIIF_RSLT_HOST_PARITY               6
+/* Internal error */
+#define XEN_VSCSIIF_RSLT_HOST_ERROR                7
+/* Reset by somebody */
+#define XEN_VSCSIIF_RSLT_HOST_RESET                8
+/* Unexpected interrupt */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_INTR             9
+/* Force command past mid-layer */
+#define XEN_VSCSIIF_RSLT_HOST_PASSTHROUGH         10
+/* Retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_SOFT_ERROR          11
+/* Hidden retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_IMM_RETRY           12
+/* Requeue command requested */
+#define XEN_VSCSIIF_RSLT_HOST_REQUEUE             13
+/* Transport error disrupted I/O */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
+/* Transport class fastfailed */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15

xen/include/public/io/vscsiif.h struct vscsiif_response { · line 363

Quoted 10 lines
xen/include/public/io/vscsiif.h +10 -0
+/* Permanent target failure */
+#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
+/* Permanent nexus failure on path */
+#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
+/* Space allocation on device failed */
+#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
+/* Medium error */
+#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
+/* Transport marginal errors */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20

Hi Juergen,

Would it makes sense to define the values in hex like in include/scsi/scsi_status.h so that they are more easy to compare?

However this looks good to me,

Quoted 12 lines
xen/include/public/io/vscsiif.h +5 -0
+
+/* Result values of reset operations */
+#define XEN_VSCSIIF_RSLT_RESET_SUCCESS  0x2002
+#define XEN_VSCSIIF_RSLT_RESET_FAILED   0x2003
+
 DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
 
 
Signature · 1 line
2.34.1
#2 lore raw
Quoted 33 lines · Luca Fancellu
Quoted 30 lines · Juergen Gross

The result field of struct vscsiif_response is lacking a detailed definition. Today the Linux kernel internal scsi definitions are being used, which is not a sane interface for a PV device driver.

Add macros to change that by using today's values in the XEN namespace.

---
V2:
- put macro parameters in parentheses (Jan Beulich)
- correct XEN_VSCSIIF_RSLT_HOST() (Jan Beulich)
- more verbose result defines (Jan Beulich)
- add reset result defines (Jan Beulich)
---
xen/include/public/io/vscsiif.h | 51 +++++++++++++++++++++++++++++++++

1 file changed, 51 insertions(+)
xen/include/public/io/vscsiif.h +0 -0
index c9ceb1884d..8553b17cc6 100644
@@ -315,6 +315,57 @@ struct vscsiif_response {
 };
 typedef struct vscsiif_response vscsiif_response_t;
 
Quoted 2 lines

xen/include/public/io/vscsiif.h struct vscsiif_response { · line 319

Quoted 2 lines
xen/include/public/io/vscsiif.h +2 -0
+/* SCSI I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_STATUS(x)  ((x) & 0x00ff)

Sorry Juergen,

A thing came to me after sending my first message, is XEN_VSCSIIF_RSLT_STATUS meant to be used to compare the result with XEN_VSCSIIF_RSLT_RESET_SUCCESS or XEN_VSCSIIF_RSLT_RESET_FAILED?

Because I think the mask should be 0xFFFF instead of 0xFF since we have the bit 13 set

Cheers,
Luca

Quoted 65 lines
Quoted 34 lines
xen/include/public/io/vscsiif.h +34 -0
+
+/* Host I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_HOST(x)    (((x) & 0x00ff0000) >> 16)
+#define XEN_VSCSIIF_RSLT_HOST_OK                   0
+/* Couldn't connect before timeout */
+#define XEN_VSCSIIF_RSLT_HOST_NO_CONNECT           1
+/* Bus busy through timeout */
+#define XEN_VSCSIIF_RSLT_HOST_BUS_BUSY             2
+/* Timed out for other reason */
+#define XEN_VSCSIIF_RSLT_HOST_TIME_OUT             3
+/* Bad target */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_TARGET           4
+/* Abort for some other reason */
+#define XEN_VSCSIIF_RSLT_HOST_ABORT                5
+/* Parity error */
+#define XEN_VSCSIIF_RSLT_HOST_PARITY               6
+/* Internal error */
+#define XEN_VSCSIIF_RSLT_HOST_ERROR                7
+/* Reset by somebody */
+#define XEN_VSCSIIF_RSLT_HOST_RESET                8
+/* Unexpected interrupt */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_INTR             9
+/* Force command past mid-layer */
+#define XEN_VSCSIIF_RSLT_HOST_PASSTHROUGH         10
+/* Retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_SOFT_ERROR          11
+/* Hidden retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_IMM_RETRY           12
+/* Requeue command requested */
+#define XEN_VSCSIIF_RSLT_HOST_REQUEUE             13
+/* Transport error disrupted I/O */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
+/* Transport class fastfailed */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15

xen/include/public/io/vscsiif.h struct vscsiif_response { · line 363

Quoted 10 lines
xen/include/public/io/vscsiif.h +10 -0
+/* Permanent target failure */
+#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
+/* Permanent nexus failure on path */
+#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
+/* Space allocation on device failed */
+#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
+/* Medium error */
+#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
+/* Transport marginal errors */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20

Hi Juergen,

Would it makes sense to define the values in hex like in include/scsi/scsi_status.h so that they are more easy to compare?

However this looks good to me,

Quoted 10 lines
xen/include/public/io/vscsiif.h +5 -0
+
+/* Result values of reset operations */
+#define XEN_VSCSIIF_RSLT_RESET_SUCCESS  0x2002
+#define XEN_VSCSIIF_RSLT_RESET_FAILED   0x2003
+
 DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
 
 
Signature · 1 line
2.34.1
#3 lore raw
Quoted 33 lines · Luca Fancellu
Quoted 33 lines · Luca Fancellu
Quoted 30 lines · Juergen Gross

The result field of struct vscsiif_response is lacking a detailed definition. Today the Linux kernel internal scsi definitions are being used, which is not a sane interface for a PV device driver.

Add macros to change that by using today's values in the XEN namespace.

---
V2:
- put macro parameters in parentheses (Jan Beulich)
- correct XEN_VSCSIIF_RSLT_HOST() (Jan Beulich)
- more verbose result defines (Jan Beulich)
- add reset result defines (Jan Beulich)
---
xen/include/public/io/vscsiif.h | 51 +++++++++++++++++++++++++++++++++

1 file changed, 51 insertions(+)
xen/include/public/io/vscsiif.h +0 -0
index c9ceb1884d..8553b17cc6 100644
@@ -315,6 +315,57 @@ struct vscsiif_response {
 };
 typedef struct vscsiif_response vscsiif_response_t;
 
Quoted 8 lines
Quoted 2 lines

xen/include/public/io/vscsiif.h struct vscsiif_response { · line 319

Quoted 2 lines
xen/include/public/io/vscsiif.h +2 -0
+/* SCSI I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_STATUS(x)  ((x) & 0x00ff)

Sorry Juergen,

A thing came to me after sending my first message, is XEN_VSCSIIF_RSLT_STATUS meant to be used to compare the result with XEN_VSCSIIF_RSLT_RESET_SUCCESS or XEN_VSCSIIF_RSLT_RESET_FAILED?

No.

XEN_VSCSIIF_RSLT_RESET_* are meant to be compared with vscsiif_response->rslt.

Juergen

#4 lore raw
In reply to Luca Fancellu
Quoted 78 lines · Luca Fancellu
Quoted 65 lines · Juergen Gross

The result field of struct vscsiif_response is lacking a detailed definition. Today the Linux kernel internal scsi definitions are being used, which is not a sane interface for a PV device driver.

Add macros to change that by using today's values in the XEN namespace.

---
V2:
- put macro parameters in parentheses (Jan Beulich)
- correct XEN_VSCSIIF_RSLT_HOST() (Jan Beulich)
- more verbose result defines (Jan Beulich)
- add reset result defines (Jan Beulich)
---
xen/include/public/io/vscsiif.h | 51 +++++++++++++++++++++++++++++++++

1 file changed, 51 insertions(+)
xen/include/public/io/vscsiif.h +36 -0
index c9ceb1884d..8553b17cc6 100644
@@ -315,6 +315,57 @@ struct vscsiif_response {
 };
 typedef struct vscsiif_response vscsiif_response_t;
 
+/* SCSI I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_STATUS(x)  ((x) & 0x00ff)
+
+/* Host I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_HOST(x)    (((x) & 0x00ff0000) >> 16)
+#define XEN_VSCSIIF_RSLT_HOST_OK                   0
+/* Couldn't connect before timeout */
+#define XEN_VSCSIIF_RSLT_HOST_NO_CONNECT           1
+/* Bus busy through timeout */
+#define XEN_VSCSIIF_RSLT_HOST_BUS_BUSY             2
+/* Timed out for other reason */
+#define XEN_VSCSIIF_RSLT_HOST_TIME_OUT             3
+/* Bad target */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_TARGET           4
+/* Abort for some other reason */
+#define XEN_VSCSIIF_RSLT_HOST_ABORT                5
+/* Parity error */
+#define XEN_VSCSIIF_RSLT_HOST_PARITY               6
+/* Internal error */
+#define XEN_VSCSIIF_RSLT_HOST_ERROR                7
+/* Reset by somebody */
+#define XEN_VSCSIIF_RSLT_HOST_RESET                8
+/* Unexpected interrupt */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_INTR             9
+/* Force command past mid-layer */
+#define XEN_VSCSIIF_RSLT_HOST_PASSTHROUGH         10
+/* Retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_SOFT_ERROR          11
+/* Hidden retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_IMM_RETRY           12
+/* Requeue command requested */
+#define XEN_VSCSIIF_RSLT_HOST_REQUEUE             13
+/* Transport error disrupted I/O */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
+/* Transport class fastfailed */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15

xen/include/public/io/vscsiif.h struct vscsiif_response { · line 363

Quoted 10 lines
xen/include/public/io/vscsiif.h +10 -0
+/* Permanent target failure */
+#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
+/* Permanent nexus failure on path */
+#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
+/* Space allocation on device failed */
+#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
+/* Medium error */
+#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
+/* Transport marginal errors */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20

Hi Juergen,

Quoted 2 lines

Would it makes sense to define the values in hex like in include/scsi/scsi_status.h so that they are more easy to compare?

They are not meant to be compared, even if they have (today) the same value.

Quoted 4 lines

However this looks good to me,

Thanks,

Juergen

#5 lore raw
In reply to Juergen Gross

Ping?

Quoted 79 lines · Juergen Gross

The result field of struct vscsiif_response is lacking a detailed definition. Today the Linux kernel internal scsi definitions are being used, which is not a sane interface for a PV device driver.

Add macros to change that by using today's values in the XEN namespace.

---
V2:
- put macro parameters in parentheses (Jan Beulich)
- correct XEN_VSCSIIF_RSLT_HOST() (Jan Beulich)
- more verbose result defines (Jan Beulich)
- add reset result defines (Jan Beulich)

---
  xen/include/public/io/vscsiif.h | 51 +++++++++++++++++++++++++++++++++
  1 file changed, 51 insertions(+)
xen/include/public/io/vscsiif.h +51 -0
index c9ceb1884d..8553b17cc6 100644
@@ -315,6 +315,57 @@ struct vscsiif_response {
  };
  typedef struct vscsiif_response vscsiif_response_t;
 
+/* SCSI I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_STATUS(x)  ((x) & 0x00ff)
+
+/* Host I/O status from vscsiif_response->rslt */
+#define XEN_VSCSIIF_RSLT_HOST(x)    (((x) & 0x00ff0000) >> 16)
+#define XEN_VSCSIIF_RSLT_HOST_OK                   0
+/* Couldn't connect before timeout */
+#define XEN_VSCSIIF_RSLT_HOST_NO_CONNECT           1
+/* Bus busy through timeout */
+#define XEN_VSCSIIF_RSLT_HOST_BUS_BUSY             2
+/* Timed out for other reason */
+#define XEN_VSCSIIF_RSLT_HOST_TIME_OUT             3
+/* Bad target */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_TARGET           4
+/* Abort for some other reason */
+#define XEN_VSCSIIF_RSLT_HOST_ABORT                5
+/* Parity error */
+#define XEN_VSCSIIF_RSLT_HOST_PARITY               6
+/* Internal error */
+#define XEN_VSCSIIF_RSLT_HOST_ERROR                7
+/* Reset by somebody */
+#define XEN_VSCSIIF_RSLT_HOST_RESET                8
+/* Unexpected interrupt */
+#define XEN_VSCSIIF_RSLT_HOST_BAD_INTR             9
+/* Force command past mid-layer */
+#define XEN_VSCSIIF_RSLT_HOST_PASSTHROUGH         10
+/* Retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_SOFT_ERROR          11
+/* Hidden retry requested */
+#define XEN_VSCSIIF_RSLT_HOST_IMM_RETRY           12
+/* Requeue command requested */
+#define XEN_VSCSIIF_RSLT_HOST_REQUEUE             13
+/* Transport error disrupted I/O */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_DISRUPTED 14
+/* Transport class fastfailed */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_FAILFAST  15
+/* Permanent target failure */
+#define XEN_VSCSIIF_RSLT_HOST_TARGET_FAILURE      16
+/* Permanent nexus failure on path */
+#define XEN_VSCSIIF_RSLT_HOST_NEXUS_FAILURE       17
+/* Space allocation on device failed */
+#define XEN_VSCSIIF_RSLT_HOST_ALLOC_FAILURE       18
+/* Medium error */
+#define XEN_VSCSIIF_RSLT_HOST_MEDIUM_ERROR        19
+/* Transport marginal errors */
+#define XEN_VSCSIIF_RSLT_HOST_TRANSPORT_MARGINAL  20
+
+/* Result values of reset operations */
+#define XEN_VSCSIIF_RSLT_RESET_SUCCESS  0x2002
+#define XEN_VSCSIIF_RSLT_RESET_FAILED   0x2003
+
  DEFINE_RING_TYPES(vscsiif, struct vscsiif_request, struct vscsiif_response);
 
 
#6 lore raw
Quoted 1 line · Juergen Gross

Ping?

Actually this patch is ready for committing - you have got an R-b already. I merely failed to tag it as such in my respective folder, and hence I've overlooked it during earlier commit swipes. Will include it next time round.

Jan