aboutsummaryrefslogtreecommitdiff
path: root/hw/nvme/nvme.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/nvme/nvme.h')
-rw-r--r--hw/nvme/nvme.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 2e7d31c..9da5343 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -26,6 +26,7 @@
#define NVME_MAX_CONTROLLERS 256
#define NVME_MAX_NAMESPACES 256
+#define NVME_MAX_VFS 127
#define NVME_EUI64_DEFAULT ((uint64_t)0x5254000000000000)
#define NVME_FDP_MAX_EVENTS 63
#define NVME_FDP_MAXPIDS 128
@@ -613,7 +614,8 @@ typedef struct NvmeCtrl {
} features;
NvmePriCtrlCap pri_ctrl_cap;
- NvmeSecCtrlList sec_ctrl_list;
+ uint32_t nr_sec_ctrls;
+ NvmeSecCtrlEntry sec_ctrl_list[NVME_MAX_VFS];
struct {
uint16_t vqrfap;
uint16_t virfap;
@@ -663,7 +665,7 @@ static inline NvmeSecCtrlEntry *nvme_sctrl(NvmeCtrl *n)
NvmeCtrl *pf = NVME(pcie_sriov_get_pf(pci_dev));
if (pci_is_vf(pci_dev)) {
- return &pf->sec_ctrl_list.sec[pcie_sriov_vf_number(pci_dev)];
+ return &pf->sec_ctrl_list[pcie_sriov_vf_number(pci_dev)];
}
return NULL;
@@ -672,12 +674,12 @@ static inline NvmeSecCtrlEntry *nvme_sctrl(NvmeCtrl *n)
static inline NvmeSecCtrlEntry *nvme_sctrl_for_cntlid(NvmeCtrl *n,
uint16_t cntlid)
{
- NvmeSecCtrlList *list = &n->sec_ctrl_list;
+ NvmeSecCtrlEntry *list = n->sec_ctrl_list;
uint8_t i;
- for (i = 0; i < list->numcntl; i++) {
- if (le16_to_cpu(list->sec[i].scid) == cntlid) {
- return &list->sec[i];
+ for (i = 0; i < n->nr_sec_ctrls; i++) {
+ if (le16_to_cpu(list[i].scid) == cntlid) {
+ return &list[i];
}
}