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

Function fsdev_allocate_one_dev

dpdk/drivers/crypto/bcmfs/bcmfs_device.c:93–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91static struct fsdev_list fsdev_list = TAILQ_HEAD_INITIALIZER(fsdev_list);
92
93static struct bcmfs_device *
94fsdev_allocate_one_dev(struct rte_vdev_device *vdev,
95 char *dirpath,
96 char *devname,
97 enum bcmfs_device_type dev_type __rte_unused)
98{
99 struct bcmfs_device *fsdev;
100 uint32_t i;
101
102 fsdev = rte_calloc(__func__, 1, sizeof(*fsdev), 0);
103 if (!fsdev)
104 return NULL;
105
106 if (strlen(dirpath) > sizeof(fsdev->dirname)) {
107 BCMFS_LOG(ERR, "dir path name is too long");
108 goto cleanup;
109 }
110
111 if (strlen(devname) > sizeof(fsdev->name)) {
112 BCMFS_LOG(ERR, "devname is too long");
113 goto cleanup;
114 }
115
116 /* check if registered ops name is present in directory path */
117 for (i = 0; i < bcmfs_hw_queue_pair_ops_table.num_ops; i++)
118 if (strstr(dirpath,
119 bcmfs_hw_queue_pair_ops_table.qp_ops[i].name))
120 fsdev->sym_hw_qp_ops =
121 &bcmfs_hw_queue_pair_ops_table.qp_ops[i];
122 if (!fsdev->sym_hw_qp_ops)
123 goto cleanup;
124
125 strcpy(fsdev->dirname, dirpath);
126 strcpy(fsdev->name, devname);
127
128 fsdev->vdev = vdev;
129
130 /* attach to VFIO */
131 if (bcmfs_attach_vfio(fsdev))
132 goto cleanup;
133
134 /* Maximum number of QPs supported */
135 fsdev->max_hw_qps = fsdev->mmap_size / BCMFS_HW_QUEUE_IO_ADDR_LEN;
136
137 TAILQ_INSERT_TAIL(&fsdev_list, fsdev, next);
138
139 return fsdev;
140
141cleanup:
142 rte_free(fsdev);
143
144 return NULL;
145}
146
147static struct bcmfs_device *
148find_fsdev(struct rte_vdev_device *vdev)

Callers 1

bcmfs_vdev_probeFunction · 0.85

Calls 4

rte_callocFunction · 0.85
strstrFunction · 0.85
bcmfs_attach_vfioFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected