This adds support for cryptodevs to the common ionic library. Signed-off-by: Andrew Boyer <andrew.bo...@amd.com> --- drivers/common/ionic/ionic_common.h | 2 ++ drivers/common/ionic/ionic_common_uio.c | 48 ++++++++++++++++++++++++- drivers/common/ionic/version.map | 1 + 3 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/drivers/common/ionic/ionic_common.h b/drivers/common/ionic/ionic_common.h index eb4850e24c..c4a15fdf2b 100644 --- a/drivers/common/ionic/ionic_common.h +++ b/drivers/common/ionic/ionic_common.h @@ -32,6 +32,8 @@ struct ionic_dev_bar { __rte_internal void ionic_uio_scan_mnet_devices(void); +__rte_internal +void ionic_uio_scan_mcrypt_devices(void); __rte_internal void ionic_uio_get_rsrc(const char *name, int idx, struct ionic_dev_bar *bar); diff --git a/drivers/common/ionic/ionic_common_uio.c b/drivers/common/ionic/ionic_common_uio.c index e5c73faf96..c647b22eaf 100644 --- a/drivers/common/ionic/ionic_common_uio.c +++ b/drivers/common/ionic/ionic_common_uio.c @@ -23,10 +23,12 @@ #define IONIC_MDEV_UNK "mdev_unknown" #define IONIC_MNIC "cpu_mnic" +#define IONIC_MCRYPT "cpu_mcrypt" #define IONIC_MAX_NAME_LEN 20 #define IONIC_MAX_MNETS 5 -#define IONIC_MAX_DEVICES (IONIC_MAX_MNETS) +#define IONIC_MAX_MCPTS 1 +#define IONIC_MAX_DEVICES (IONIC_MAX_MNETS + IONIC_MAX_MCPTS) #define IONIC_MAX_U16_IDX 0xFFFF #define IONIC_UIO_MAX_TRIES 32 @@ -49,6 +51,7 @@ struct ionic_map_tbl ionic_mdev_map[IONIC_MAX_DEVICES] = { { "net_ionic2", 2, IONIC_MAX_U16_IDX, IONIC_MDEV_UNK }, { "net_ionic3", 3, IONIC_MAX_U16_IDX, IONIC_MDEV_UNK }, { "net_ionic4", 4, IONIC_MAX_U16_IDX, IONIC_MDEV_UNK }, + { "crypto_ionic0", 5, IONIC_MAX_U16_IDX, IONIC_MDEV_UNK }, }; struct uio_name { @@ -143,6 +146,49 @@ ionic_uio_scan_mnet_devices(void) } } +void +ionic_uio_scan_mcrypt_devices(void) +{ + struct ionic_map_tbl *map; + char devname[IONIC_MAX_NAME_LEN]; + struct uio_name name_cache[IONIC_MAX_DEVICES]; + bool done; + int mdev_idx = 0; + int uio_idx; + int i; + static bool scan_done; + + if (scan_done) + return; + + scan_done = true; + + uio_fill_name_cache(name_cache, IONIC_MCRYPT); + + for (i = IONIC_MAX_MNETS; i < IONIC_MAX_DEVICES; i++) { + done = false; + + while (!done) { + if (mdev_idx > IONIC_MAX_MDEV_SCAN) + break; + + /* Look for a matching mcrypt */ + snprintf(devname, IONIC_MAX_NAME_LEN, + IONIC_MCRYPT "%d", mdev_idx); + uio_idx = uio_get_idx_for_devname(name_cache, devname); + if (uio_idx >= 0) { + map = &ionic_mdev_map[i]; + map->uio_idx = (uint16_t)uio_idx; + strlcpy(map->mdev_name, devname, + IONIC_MAX_NAME_LEN); + done = true; + } + + mdev_idx++; + } + } +} + static int uio_get_multi_dev_uionum(const char *name) { diff --git a/drivers/common/ionic/version.map b/drivers/common/ionic/version.map index 484330c437..db532d4ffc 100644 --- a/drivers/common/ionic/version.map +++ b/drivers/common/ionic/version.map @@ -2,6 +2,7 @@ INTERNAL { global: ionic_uio_scan_mnet_devices; + ionic_uio_scan_mcrypt_devices; ionic_uio_get_rsrc; ionic_uio_rel_rsrc; -- 2.17.1