From patchwork Tue Nov 14 21:41:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13456032 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B97533094; Tue, 14 Nov 2023 21:42:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22162D5; Tue, 14 Nov 2023 13:42:15 -0800 (PST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1cc29f39e7aso40145125ad.0; Tue, 14 Nov 2023 13:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699998134; x=1700602934; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T4k+JDqEcQkKs3J5VRs0ivCwgTJsm0PTpYm6Nj592ys=; b=NoVpOP+fAXtbVTmMoYFI03iRVxh8N/F5sTj6Ej/ug8VSqwrX6IkzJB2yeOvo89RDtY o1AvsBoKRgpl3KhkX7sSyvZj27vn9sFP6dt7Uh05IBWMvTKhNBQnAYp7KYdgH7mVJCm4 fLBVfehuLlqtBI1Pfx9jcnN1wamSvUbm/UKCDlZoBKUhKA0BSr+jFalMPwUZnRShQDmT XpOs7kvVsSkyGWB68UuhmK8KFOdWkcSWzXR+Ubd02BknhV81+laywjD/24O0SDrOqif5 86TXr72LqGqyvFAVhD4agP2HZXTLZXGUuChrygoMW7s2TJaWqLpMMYJFW/OcWJ+tmfX0 lq+w== X-Gm-Message-State: AOJu0YwYp2dkCy6uQh5FQ2sjVD9SJkMHrPRC9opNXMPIZklmdC7f2afT xkaNt2cUZr0fY5IdsI3IuHg= X-Google-Smtp-Source: AGHT+IF+XFn1rcJpzzNVg3Rh3Zw5xj8B/z1t3iTu+CGQnWtv6NXURIwQhykjCPN4Up1cbQ8QJs4HbA== X-Received: by 2002:a17:903:2a84:b0:1cc:6fa6:ab62 with SMTP id lv4-20020a1709032a8400b001cc6fa6ab62mr3741215plb.29.1699998134479; Tue, 14 Nov 2023 13:42:14 -0800 (PST) Received: from bvanassche-linux.mtv.corp.google.com ([2620:0:1000:8411:2278:ad72:cefb:4d49]) by smtp.gmail.com with ESMTPSA id o16-20020a170902d4d000b001c3267ae317sm6133926plg.165.2023.11.14.13.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 13:42:14 -0800 (PST) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig , Daejun Park , Kanchan Joshi , Bart Van Assche , "James E.J. Bottomley" Subject: [PATCH v4 07/15] scsi_proto: Add structures and constants related to I/O groups and streams Date: Tue, 14 Nov 2023 13:41:02 -0800 Message-ID: <20231114214132.1486867-8-bvanassche@acm.org> X-Mailer: git-send-email 2.43.0.rc0.421.g78406f8d94-goog In-Reply-To: <20231114214132.1486867-1-bvanassche@acm.org> References: <20231114214132.1486867-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Prepare for adding code that will query the I/O advice hints group descriptors and for adding code that will retrieve the stream status. Cc: Martin K. Petersen Signed-off-by: Bart Van Assche --- include/scsi/scsi_proto.h | 75 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h index 07d65c1f59db..9ee4983c23b4 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 #include /* @@ -126,6 +127,7 @@ #define SAI_READ_CAPACITY_16 0x10 #define SAI_GET_LBA_STATUS 0x12 #define SAI_REPORT_REFERRALS 0x13 +#define SAI_GET_STREAM_STATUS 0x16 /* values for maintenance in */ #define MI_REPORT_IDENTIFYING_INFORMATION 0x05 #define MI_REPORT_TARGET_PGS 0x0a @@ -275,6 +277,79 @@ 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); + +struct scsi_stream_status { +#if defined(__BIG_ENDIAN) + u16 perm: 1; + u16 reserved1: 15; +#elif defined(__LITTLE_ENDIAN) + u16 reserved1: 15; + u16 perm: 1; +#else +#error +#endif + __be16 stream_identifier; +#if defined(__BIG_ENDIAN) + u8 reserved2: 2; + u8 rel_lifetime: 6; +#elif defined(__LITTLE_ENDIAN) + u8 rel_lifetime: 6; + u8 reserved2: 2; +#else +#error +#endif + u8 reserved3[3]; +}; + +static_assert(sizeof(struct scsi_stream_status) == 8); + +struct scsi_stream_status_header { + __be32 len; /* length in bytes of stream_status[] array. */ + u16 reserved; + u16 number_of_open_streams; + DECLARE_FLEX_ARRAY(struct scsi_stream_status, stream_status); +}; + +static_assert(sizeof(struct scsi_stream_status_header) == 8); + /* SPC asymmetric access states */ #define SCSI_ACCESS_STATE_OPTIMAL 0x00 #define SCSI_ACCESS_STATE_ACTIVE 0x01