MCPcopy Create free account
hub / github.com/F-Stack/f-stack / roc_sso_dev_init

Function roc_sso_dev_init

dpdk/drivers/common/cnxk/roc_sso.c:956–1034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956int
957roc_sso_dev_init(struct roc_sso *roc_sso)
958{
959 struct plt_pci_device *pci_dev;
960 uint32_t link_map_sz;
961 struct sso *sso;
962 void *link_mem;
963 int i, rc;
964
965 if (roc_sso == NULL || roc_sso->pci_dev == NULL)
966 return SSO_ERR_PARAM;
967
968 PLT_STATIC_ASSERT(sizeof(struct sso) <= ROC_SSO_MEM_SZ);
969 sso = roc_sso_to_sso_priv(roc_sso);
970 memset(sso, 0, sizeof(*sso));
971 pci_dev = roc_sso->pci_dev;
972
973 rc = sso_update_msix_vec_count(roc_sso, 0);
974 if (rc < 0) {
975 plt_err("Failed to set SSO MSIX vector count");
976 return rc;
977 }
978
979 rc = dev_init(&sso->dev, pci_dev);
980 if (rc < 0) {
981 plt_err("Failed to init roc device");
982 goto fail;
983 }
984
985 rc = sso_rsrc_get(roc_sso);
986 if (rc < 0) {
987 plt_err("Failed to get SSO resources");
988 goto rsrc_fail;
989 }
990 rc = -ENOMEM;
991
992 if (roc_sso->max_hws) {
993 sso->link_map = plt_zmalloc(
994 sizeof(struct plt_bitmap *) * roc_sso->max_hws, 0);
995 if (sso->link_map == NULL) {
996 plt_err("Failed to allocate memory for link_map array");
997 goto rsrc_fail;
998 }
999
1000 link_map_sz =
1001 plt_bitmap_get_memory_footprint(roc_sso->max_hwgrp);
1002 sso->link_map_mem =
1003 plt_zmalloc(link_map_sz * roc_sso->max_hws, 0);
1004 if (sso->link_map_mem == NULL) {
1005 plt_err("Failed to get link_map memory");
1006 goto rsrc_fail;
1007 }
1008
1009 link_mem = sso->link_map_mem;
1010
1011 for (i = 0; i < roc_sso->max_hws; i++) {
1012 sso->link_map[i] = plt_bitmap_init(
1013 roc_sso->max_hwgrp, link_mem, link_map_sz);

Callers 1

cnxk_sso_initFunction · 0.85

Calls 8

roc_sso_to_sso_privFunction · 0.85
memsetFunction · 0.85
dev_initFunction · 0.85
sso_rsrc_getFunction · 0.85
idev_sso_pffunc_setFunction · 0.85
idev_sso_setFunction · 0.85
dev_finiFunction · 0.85

Tested by

no test coverage detected