diff mbox series

[06/13] scsi_proto: Add struct io_group_descriptor

Message ID 20230920191442.3701673-7-bvanassche@acm.org
State New
Headers show
Series Pass data temperature information to zoned UFS devices | expand

Commit Message

Bart Van Assche Sept. 20, 2023, 7:14 p.m. UTC
Prepare for adding code that will fill in and parse this data structure.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/scsi/scsi_proto.h | 40 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

Comments

Avri Altman Oct. 2, 2023, 11:41 a.m. UTC | #1
> Prepare for adding code that will fill in and parse this data structure.
> 
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  include/scsi/scsi_proto.h | 40
> +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h
> index 07d65c1f59db..4e3691cb67da 100644
> --- a/include/scsi/scsi_proto.h
> +++ b/include/scsi/scsi_proto.h
> @@ -10,6 +10,7 @@
>  #ifndef _SCSI_PROTO_H_
>  #define _SCSI_PROTO_H_
> 
> +#include <linux/build_bug.h>
>  #include <linux/types.h>
> 
>  /*
> @@ -275,6 +276,45 @@ struct scsi_lun {
>         __u8 scsi_lun[8];
>  };
> 
> +/* SBC-5 IO advice hints group descriptor */
> +struct scsi_io_group_descriptor {
> +#if defined(__BIG_ENDIAN)
> +       u8 io_advice_hints_mode: 2;
> +       u8 reserved1: 3;
> +       u8 st_enble: 1;
> +       u8 cs_enble: 1;
> +       u8 ic_enable: 1;
> +#elif defined(__LITTLE_ENDIAN)
> +       u8 ic_enable: 1;
> +       u8 cs_enble: 1;
> +       u8 st_enble: 1;
> +       u8 reserved1: 3;
> +       u8 io_advice_hints_mode: 2;
> +#else
> +#error
> +#endif
Anything pass byte offset 0 is irrelevant for constrained streams.
Why do we need that further drill down of the descriptor structure?

Thanks,
Avri

> +       u8 reserved2[3];
> +       /* Logical block markup descriptor */
> +#if defined(__BIG_ENDIAN)
> +       u8 acdlu: 1;
> +       u8 reserved3: 1;
> +       u8 rlbsr: 2;
> +       u8 lbm_descriptor_type: 4;
> +#elif defined(__LITTLE_ENDIAN)
> +       u8 lbm_descriptor_type: 4;
> +       u8 rlbsr: 2;
> +       u8 reserved3: 1;
> +       u8 acdlu: 1;
> +#else
> +#error
> +#endif
> +       u8 params[2];
> +       u8 reserved4;
> +       u8 reserved5[8];
> +};
> +
> +static_assert(sizeof(struct scsi_io_group_descriptor) == 16);
> +
>  /* SPC asymmetric access states */
>  #define SCSI_ACCESS_STATE_OPTIMAL     0x00
>  #define SCSI_ACCESS_STATE_ACTIVE      0x01
Bart Van Assche Oct. 2, 2023, 5:16 p.m. UTC | #2
On 10/2/23 04:41, Avri Altman wrote:
>> +/* SBC-5 IO advice hints group descriptor */
>> +struct scsi_io_group_descriptor {
>> +#if defined(__BIG_ENDIAN)
>> +       u8 io_advice_hints_mode: 2;
>> +       u8 reserved1: 3;
>> +       u8 st_enble: 1;
>> +       u8 cs_enble: 1;
>> +       u8 ic_enable: 1;
>> +#elif defined(__LITTLE_ENDIAN)
>> +       u8 ic_enable: 1;
>> +       u8 cs_enble: 1;
>> +       u8 st_enble: 1;
>> +       u8 reserved1: 3;
>> +       u8 io_advice_hints_mode: 2;
>> +#else
>> +#error
>> +#endif
 >
> Anything pass byte offset 0 is irrelevant for constrained streams.
> Why do we need that further drill down of the descriptor structure?

The data structures in header file include/scsi/scsi_proto.h follow the
SCSI standards closely. These data structures should not be tailored to
the current use case of these data structures.

Thanks,

Bart.
Avri Altman Oct. 2, 2023, 6:16 p.m. UTC | #3
> Prepare for adding code that will fill in and parse this data structure.
> 
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Daejun Park Oct. 5, 2023, 11:59 a.m. UTC | #4
> Prepare for adding code that will fill in and parse this data structure.

> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Daejun Park <daejun7.park@samsung.com>
diff mbox series

Patch

diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h
index 07d65c1f59db..4e3691cb67da 100644
--- a/include/scsi/scsi_proto.h
+++ b/include/scsi/scsi_proto.h
@@ -10,6 +10,7 @@ 
 #ifndef _SCSI_PROTO_H_
 #define _SCSI_PROTO_H_
 
+#include <linux/build_bug.h>
 #include <linux/types.h>
 
 /*
@@ -275,6 +276,45 @@  struct scsi_lun {
 	__u8 scsi_lun[8];
 };
 
+/* SBC-5 IO advice hints group descriptor */
+struct scsi_io_group_descriptor {
+#if defined(__BIG_ENDIAN)
+	u8 io_advice_hints_mode: 2;
+	u8 reserved1: 3;
+	u8 st_enble: 1;
+	u8 cs_enble: 1;
+	u8 ic_enable: 1;
+#elif defined(__LITTLE_ENDIAN)
+	u8 ic_enable: 1;
+	u8 cs_enble: 1;
+	u8 st_enble: 1;
+	u8 reserved1: 3;
+	u8 io_advice_hints_mode: 2;
+#else
+#error
+#endif
+	u8 reserved2[3];
+	/* Logical block markup descriptor */
+#if defined(__BIG_ENDIAN)
+	u8 acdlu: 1;
+	u8 reserved3: 1;
+	u8 rlbsr: 2;
+	u8 lbm_descriptor_type: 4;
+#elif defined(__LITTLE_ENDIAN)
+	u8 lbm_descriptor_type: 4;
+	u8 rlbsr: 2;
+	u8 reserved3: 1;
+	u8 acdlu: 1;
+#else
+#error
+#endif
+	u8 params[2];
+	u8 reserved4;
+	u8 reserved5[8];
+};
+
+static_assert(sizeof(struct scsi_io_group_descriptor) == 16);
+
 /* SPC asymmetric access states */
 #define SCSI_ACCESS_STATE_OPTIMAL     0x00
 #define SCSI_ACCESS_STATE_ACTIVE      0x01