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

Function mlx5_common_dev_probe

dpdk/drivers/common/mlx5/mlx5_common.c:960–1053  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

958}
959
960int
961mlx5_common_dev_probe(struct rte_device *eal_dev)
962{
963 struct mlx5_common_device *cdev;
964 struct mlx5_kvargs_ctrl mkvlist;
965 struct mlx5_kvargs_ctrl *mkvlist_p = NULL;
966 uint32_t classes = 0;
967 bool new_device = false;
968 int ret;
969
970 DRV_LOG(INFO, "probe device \"%s\".", eal_dev->name);
971 if (eal_dev->devargs != NULL && eal_dev->devargs->args != NULL)
972 mkvlist_p = &mkvlist;
973 ret = mlx5_kvargs_prepare(mkvlist_p, eal_dev->devargs);
974 if (ret < 0) {
975 DRV_LOG(ERR, "Unsupported device arguments: %s",
976 eal_dev->devargs->args);
977 return ret;
978 }
979 ret = parse_class_options(eal_dev->devargs, mkvlist_p);
980 if (ret < 0) {
981 DRV_LOG(ERR, "Unsupported mlx5 class type: %s",
982 eal_dev->devargs->args);
983 goto class_err;
984 }
985 classes = ret;
986 if (classes == 0)
987 /* Default to net class. */
988 classes = MLX5_CLASS_ETH;
989 /*
990 * MLX5 common driver supports probing again in two scenarios:
991 * - Add new driver under existing common device (regardless of the
992 * driver's own support in probing again).
993 * - Transfer the probing again support of the drivers themselves.
994 *
995 * In both scenarios it uses in the existing device. here it looks for
996 * device that match to rte device, if it exists, the request classes
997 * were probed with this device.
998 */
999 cdev = to_mlx5_device(eal_dev);
1000 if (!cdev) {
1001 /* It isn't probing again, creates a new device. */
1002 cdev = mlx5_common_dev_create(eal_dev, classes, mkvlist_p);
1003 if (!cdev) {
1004 ret = -ENOMEM;
1005 goto class_err;
1006 }
1007 new_device = true;
1008 } else {
1009 /* It is probing again, validate common devargs match. */
1010 ret = mlx5_common_probe_again_args_validate(cdev, mkvlist_p);
1011 if (ret) {
1012 DRV_LOG(ERR,
1013 "Probe again parameters aren't compatible : %s",
1014 strerror(rte_errno));
1015 goto class_err;
1016 }
1017 }

Callers 2

mlx5_common_pci_probeFunction · 0.85

Calls 11

mlx5_kvargs_prepareFunction · 0.85
parse_class_optionsFunction · 0.85
to_mlx5_deviceFunction · 0.85
mlx5_common_dev_createFunction · 0.85
drivers_probeFunction · 0.85
mlx5_kvargs_validateFunction · 0.85
mlx5_kvargs_releaseFunction · 0.85
drivers_removeFunction · 0.85
mlx5_common_dev_releaseFunction · 0.85

Tested by

no test coverage detected