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

Function rte_ml_dev_configure

dpdk/lib/mldev/rte_mldev.c:252–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252int
253rte_ml_dev_configure(int16_t dev_id, const struct rte_ml_dev_config *config)
254{
255 struct rte_ml_dev_info dev_info;
256 struct rte_ml_dev *dev;
257 int ret;
258
259 if (!rte_ml_dev_is_valid_dev(dev_id)) {
260 RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d", dev_id);
261 return -EINVAL;
262 }
263
264 dev = rte_ml_dev_pmd_get_dev(dev_id);
265 if (*dev->dev_ops->dev_configure == NULL)
266 return -ENOTSUP;
267
268 if (dev->data->dev_started) {
269 RTE_MLDEV_LOG(ERR, "Device %d must be stopped to allow configuration", dev_id);
270 return -EBUSY;
271 }
272
273 if (config == NULL) {
274 RTE_MLDEV_LOG(ERR, "Dev %d, config cannot be NULL", dev_id);
275 return -EINVAL;
276 }
277
278 ret = rte_ml_dev_info_get(dev_id, &dev_info);
279 if (ret < 0)
280 return ret;
281
282 if (config->nb_queue_pairs > dev_info.max_queue_pairs) {
283 RTE_MLDEV_LOG(ERR, "Device %d num of queues %u > %u", dev_id,
284 config->nb_queue_pairs, dev_info.max_queue_pairs);
285 return -EINVAL;
286 }
287
288 return (*dev->dev_ops->dev_configure)(dev, config);
289}
290
291int
292rte_ml_dev_close(int16_t dev_id)

Callers 2

ml_test_device_configureFunction · 0.85
test_device_reconfigureFunction · 0.85

Calls 3

rte_ml_dev_is_valid_devFunction · 0.85
rte_ml_dev_pmd_get_devFunction · 0.85
rte_ml_dev_info_getFunction · 0.85

Tested by 2

ml_test_device_configureFunction · 0.68
test_device_reconfigureFunction · 0.68