Skip to content

Commit 071a8a1

Browse files
Arunpandian Jdwsuse
authored andcommitted
nvme: Add Supported Capacity Configuration List log page(LID: 0x11)
Reviewed-by: Steven Seungcheol Lee <[email protected]> Signed-off-by: Arunpandian J <[email protected]>
1 parent 377a868 commit 071a8a1

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

src/nvme/ioctl.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,38 @@ static inline int nvme_get_log_media_unit_stat(int fd, __u16 domid,
17971797
return nvme_get_log(&args);
17981798
}
17991799

1800+
/**
1801+
* nvme_get_log_support_cap_config_list() -
1802+
* @fd: File descriptor of nvme device
1803+
* @domid: Domain Identifier selection, if supported
1804+
*
1805+
* Return: The nvme command status if a response was received (see
1806+
* &enum nvme_status_field) or -1 with errno set otherwise
1807+
*/
1808+
static inline int nvme_get_log_support_cap_config_list(int fd, __u16 domid,
1809+
struct nvme_supported_cap_config_list_log *cap)
1810+
{
1811+
struct nvme_get_log_args args = {
1812+
.lpo = 0,
1813+
.result = NULL,
1814+
.log = cap,
1815+
.args_size = sizeof(args),
1816+
.fd = fd,
1817+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
1818+
.lid = NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST,
1819+
.len = sizeof(*cap),
1820+
.nsid = NVME_NSID_NONE,
1821+
.csi = NVME_CSI_NVM,
1822+
.lsi = NVME_LOG_LSI_NONE,
1823+
.domid = domid,
1824+
.lsp = NVME_LOG_LSP_NONE,
1825+
.uuidx = NVME_UUID_NONE,
1826+
.rae = false,
1827+
.ot = false,
1828+
};
1829+
return nvme_get_log(&args);
1830+
}
1831+
18001832
/**
18011833
* nvme_get_log_reservation() -
18021834
* @fd: File descriptor of nvme device

src/nvme/types.h

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3543,6 +3543,101 @@ struct nvme_media_unit_stat_log {
35433543
struct nvme_media_unit_stat_desc mus_desc[];
35443544
};
35453545

3546+
/**
3547+
* struct nvme_media_unit_config_desc -
3548+
* @muid: Media Unit Identifier
3549+
* @mudl: Media Unit Descriptor Length
3550+
*
3551+
* Media Unit Configuration Descriptor
3552+
* Structure Definitions
3553+
*/
3554+
struct nvme_media_unit_config_desc {
3555+
__le16 muid;
3556+
__u8 rsvd2[4];
3557+
__le16 mudl;
3558+
};
3559+
3560+
/**
3561+
* struct nvme_channel_config_desc -
3562+
* @chanid: Channel Identifier
3563+
* @chmus: Number Channel Media Units
3564+
*
3565+
* Channel Configuration Descriptor
3566+
* Structure Definitions
3567+
*/
3568+
struct nvme_channel_config_desc {
3569+
__le16 chanid;
3570+
__le16 chmus;
3571+
struct nvme_media_unit_config_desc mu_config_desc[];
3572+
};
3573+
3574+
/**
3575+
* struct nvme_channel_config_desc -
3576+
* @egchans: Number of Channels
3577+
*
3578+
* Endurance group Channel Configuration Descriptor
3579+
* Structure Definitions
3580+
*/
3581+
struct nvme_end_grp_chan_desc {
3582+
__le16 egchans;
3583+
struct nvme_channel_config_desc chan_config_desc[];
3584+
};
3585+
3586+
/**
3587+
* struct nvme_end_grp_config_desc -
3588+
* @endgid: Endurance Group Identifier
3589+
* @cap_adj_factor: Capacity Adjustment Factor
3590+
* @tegcap: Total Endurance Group Capacity
3591+
* @segcap: Spare Endurance Group Capacity
3592+
* @end_est: Endurance Estimate
3593+
* @egsets: Number of NVM Sets
3594+
* @nvmsetid: NVM Set Identifier
3595+
*
3596+
* Endurance Group Configuration Descriptor
3597+
* Structure Definitions
3598+
*/
3599+
struct nvme_end_grp_config_desc {
3600+
__le16 endgid;
3601+
__le16 cap_adj_factor;
3602+
__u8 rsvd4[12];
3603+
__u8 tegcap[16];
3604+
__u8 segcap[16];
3605+
__u8 end_est[16];
3606+
__u8 rsvd64[16];
3607+
__le16 egsets;
3608+
__le16 nvmsetid[];
3609+
};
3610+
3611+
/**
3612+
* struct nvme_cap_config_desc -
3613+
* @cap_config_id: Capacity Configuration Identifier
3614+
* @domainid: Domain Identifier
3615+
* @egcn: Number Endurance Group Configuration
3616+
* Descriptors
3617+
*
3618+
* Capacity Configuration structure definitions
3619+
*/
3620+
struct nvme_capacity_config_desc {
3621+
__le16 cap_config_id;
3622+
__le16 domainid;
3623+
__le16 egcn;
3624+
__u8 rsvd6[26];
3625+
struct nvme_end_grp_config_desc egcd[];
3626+
};
3627+
3628+
/**
3629+
* struct nvme_supported_cap_config_list_log -
3630+
* @sccn: number of capacity configuration
3631+
*
3632+
* Supported Capacity Configuration list log page
3633+
* structure definitions
3634+
*/
3635+
struct nvme_supported_cap_config_list_log {
3636+
__u8 sccn;
3637+
__u8 rsvd1[15];
3638+
struct nvme_capacity_config_desc cap_config_desc[];
3639+
};
3640+
35463641
/**
35473642
* struct nvme_resv_notification_log -
35483643
* @lpc:
@@ -5718,6 +5813,7 @@ enum nvme_identify_cns {
57185813
* @NVME_LOG_LID_LBA_STATUS:
57195814
* @NVME_LOG_LID_ENDURANCE_GRP_EVT:
57205815
* @NVME_LOG_LID_MEDIA_UNIT_STATUS:
5816+
* @NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST:
57215817
* @NVME_LOG_LID_FID_SUPPORTED_EFFECTS:
57225818
* @NVME_LOG_LID_BOOT_PARTITION:
57235819
* @NVME_LOG_LID_DISCOVER:
@@ -5743,6 +5839,7 @@ enum nvme_cmd_get_log_lid {
57435839
NVME_LOG_LID_LBA_STATUS = 0x0e,
57445840
NVME_LOG_LID_ENDURANCE_GRP_EVT = 0x0f,
57455841
NVME_LOG_LID_MEDIA_UNIT_STATUS = 0x10,
5842+
NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST = 0x11,
57465843
NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12,
57475844
NVME_LOG_LID_BOOT_PARTITION = 0x15,
57485845
NVME_LOG_LID_DISCOVER = 0x70,

0 commit comments

Comments
 (0)