From: Michael Baum Date: Sun, 12 Sep 2021 10:36:26 +0000 (+0300) Subject: common/mlx5: fix class combination validation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=288d7c3fa6e8bfca9e1e79a9712ec85d7179b3ce;p=dpdk.git common/mlx5: fix class combination validation The common probe function gets as a user argument the classes it should create, and checks whether the combination is valid. In case the device already exists, it checks the integration of the above with the classes that the device has. However, the function does not check the combination when the device does not exist and it has to create it. Check if the combination is valid for all cases. Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Matan Azrad --- diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 459cf4bcc4..f6e440dca1 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -317,14 +317,16 @@ mlx5_common_dev_probe(struct rte_device *eal_dev) dev->dev = eal_dev; TAILQ_INSERT_HEAD(&devices_list, dev, next); new_device = true; - } else { - /* Validate combination here. */ - ret = is_valid_class_combination(classes | - dev->classes_loaded); - if (ret != 0) { - DRV_LOG(ERR, "Unsupported mlx5 classes combination."); - return ret; - } + } + /* + * Validate combination here. + * For new device, the classes_loaded field is 0 and it check only + * the classes given as user device arguments. + */ + ret = is_valid_class_combination(classes | dev->classes_loaded); + if (ret != 0) { + DRV_LOG(ERR, "Unsupported mlx5 classes combination."); + goto class_err; } ret = drivers_probe(dev, classes); if (ret)