From 21116dee58d17f9da4f74608c257280ea7424dbc Mon Sep 17 00:00:00 2001 From: Shijith Thotton Date: Fri, 22 Nov 2024 11:38:42 +0530 Subject: [PATCH] lib/pem: add API to get max supported VFs Added a new API to get the maximum number of supported VFs. This will help allocate resources, such as crypto queues, across devices. Signed-off-by: Shijith Thotton Change-Id: I4ca5ee45734b0ebff00af4a2aa58f80952957dcf Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/139785 Reviewed-by: Nithin Kumar Dabilpuram Tested-by: sa_ip-toolkits-Jenkins --- lib/pem/dao_pem.h | 10 ++++++++++ lib/pem/pem.c | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/pem/dao_pem.h b/lib/pem/dao_pem.h index 981d9fc..7ea6365 100644 --- a/lib/pem/dao_pem.h +++ b/lib/pem/dao_pem.h @@ -168,4 +168,14 @@ size_t dao_pem_host_page_sz(uint16_t pem_devid); * Number of interrupts configured. */ uint8_t dao_pem_host_interrupt_setup(uint16_t pem_devid, int vfid, uint64_t **intr_addr); + +/** + * PEM max VFs get. + * + * @param pem_devid + * PEM device ID + * @return + * Max VFs supported. + */ +uint16_t dao_pem_max_vfs_get(uint16_t pem_devid); #endif /* __INCLUDE_DAO_PEM_H__ */ diff --git a/lib/pem/pem.c b/lib/pem/pem.c index 5371c36..53b4364 100644 --- a/lib/pem/pem.c +++ b/lib/pem/pem.c @@ -421,3 +421,15 @@ dao_pem_host_interrupt_setup(uint16_t pem_devid, int vfid, uint64_t **intr_addr) return rpvf; } + +uint16_t +dao_pem_max_vfs_get(uint16_t pem_devid) +{ + struct pem *pem; + + if (pem_devid >= DAO_PEM_DEV_ID_MAX) + return 0; + + pem = &pem_devices[pem_devid]; + return pem->max_vfs; +}