Skip to content

Commit 524941a

Browse files
authored
Merge pull request #199 from Arunpandian15/Supported_Cap_Config_List_Log_Page
nvme: Add Supported Capacity Configuration List log page(LID: 0x11)
2 parents 28d0bda + 071a8a1 commit 524941a

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
@@ -1803,6 +1803,38 @@ static inline int nvme_get_log_media_unit_stat(int fd, __u16 domid,
18031803
return nvme_get_log(&args);
18041804
}
18051805

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

src/nvme/types.h

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,6 +3549,101 @@ struct nvme_media_unit_stat_log {
35493549
struct nvme_media_unit_stat_desc mus_desc[];
35503550
};
35513551

3552+
/**
3553+
* struct nvme_media_unit_config_desc -
3554+
* @muid: Media Unit Identifier
3555+
* @mudl: Media Unit Descriptor Length
3556+
*
3557+
* Media Unit Configuration Descriptor
3558+
* Structure Definitions
3559+
*/
3560+
struct nvme_media_unit_config_desc {
3561+
__le16 muid;
3562+
__u8 rsvd2[4];
3563+
__le16 mudl;
3564+
};
3565+
3566+
/**
3567+
* struct nvme_channel_config_desc -
3568+
* @chanid: Channel Identifier
3569+
* @chmus: Number Channel Media Units
3570+
*
3571+
* Channel Configuration Descriptor
3572+
* Structure Definitions
3573+
*/
3574+
struct nvme_channel_config_desc {
3575+
__le16 chanid;
3576+
__le16 chmus;
3577+
struct nvme_media_unit_config_desc mu_config_desc[];
3578+
};
3579+
3580+
/**
3581+
* struct nvme_channel_config_desc -
3582+
* @egchans: Number of Channels
3583+
*
3584+
* Endurance group Channel Configuration Descriptor
3585+
* Structure Definitions
3586+
*/
3587+
struct nvme_end_grp_chan_desc {
3588+
__le16 egchans;
3589+
struct nvme_channel_config_desc chan_config_desc[];
3590+
};
3591+
3592+
/**
3593+
* struct nvme_end_grp_config_desc -
3594+
* @endgid: Endurance Group Identifier
3595+
* @cap_adj_factor: Capacity Adjustment Factor
3596+
* @tegcap: Total Endurance Group Capacity
3597+
* @segcap: Spare Endurance Group Capacity
3598+
* @end_est: Endurance Estimate
3599+
* @egsets: Number of NVM Sets
3600+
* @nvmsetid: NVM Set Identifier
3601+
*
3602+
* Endurance Group Configuration Descriptor
3603+
* Structure Definitions
3604+
*/
3605+
struct nvme_end_grp_config_desc {
3606+
__le16 endgid;
3607+
__le16 cap_adj_factor;
3608+
__u8 rsvd4[12];
3609+
__u8 tegcap[16];
3610+
__u8 segcap[16];
3611+
__u8 end_est[16];
3612+
__u8 rsvd64[16];
3613+
__le16 egsets;
3614+
__le16 nvmsetid[];
3615+
};
3616+
3617+
/**
3618+
* struct nvme_cap_config_desc -
3619+
* @cap_config_id: Capacity Configuration Identifier
3620+
* @domainid: Domain Identifier
3621+
* @egcn: Number Endurance Group Configuration
3622+
* Descriptors
3623+
*
3624+
* Capacity Configuration structure definitions
3625+
*/
3626+
struct nvme_capacity_config_desc {
3627+
__le16 cap_config_id;
3628+
__le16 domainid;
3629+
__le16 egcn;
3630+
__u8 rsvd6[26];
3631+
struct nvme_end_grp_config_desc egcd[];
3632+
};
3633+
3634+
/**
3635+
* struct nvme_supported_cap_config_list_log -
3636+
* @sccn: number of capacity configuration
3637+
*
3638+
* Supported Capacity Configuration list log page
3639+
* structure definitions
3640+
*/
3641+
struct nvme_supported_cap_config_list_log {
3642+
__u8 sccn;
3643+
__u8 rsvd1[15];
3644+
struct nvme_capacity_config_desc cap_config_desc[];
3645+
};
3646+
35523647
/**
35533648
* struct nvme_resv_notification_log -
35543649
* @lpc:
@@ -5724,6 +5819,7 @@ enum nvme_identify_cns {
57245819
* @NVME_LOG_LID_LBA_STATUS:
57255820
* @NVME_LOG_LID_ENDURANCE_GRP_EVT:
57265821
* @NVME_LOG_LID_MEDIA_UNIT_STATUS:
5822+
* @NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST:
57275823
* @NVME_LOG_LID_FID_SUPPORTED_EFFECTS:
57285824
* @NVME_LOG_LID_BOOT_PARTITION:
57295825
* @NVME_LOG_LID_DISCOVER:
@@ -5749,6 +5845,7 @@ enum nvme_cmd_get_log_lid {
57495845
NVME_LOG_LID_LBA_STATUS = 0x0e,
57505846
NVME_LOG_LID_ENDURANCE_GRP_EVT = 0x0f,
57515847
NVME_LOG_LID_MEDIA_UNIT_STATUS = 0x10,
5848+
NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST = 0x11,
57525849
NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12,
57535850
NVME_LOG_LID_BOOT_PARTITION = 0x15,
57545851
NVME_LOG_LID_DISCOVER = 0x70,

0 commit comments

Comments
 (0)