main.c (8cdd312cfed706b067d7ea952603e28cc33c40cc) main.c (6aec21f6a8322fa8d43df3ea7f051dfd8967f1b9)
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 850 unchanged lines hidden (view full) ---

859}
860
861static ssize_t show_reg_pages(struct device *device,
862 struct device_attribute *attr, char *buf)
863{
864 struct mlx5_ib_dev *dev =
865 container_of(device, struct mlx5_ib_dev, ib_dev.dev);
866
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 850 unchanged lines hidden (view full) ---

859}
860
861static ssize_t show_reg_pages(struct device *device,
862 struct device_attribute *attr, char *buf)
863{
864 struct mlx5_ib_dev *dev =
865 container_of(device, struct mlx5_ib_dev, ib_dev.dev);
866
867 return sprintf(buf, "%d\n", dev->mdev->priv.reg_pages);
867 return sprintf(buf, "%d\n", atomic_read(&dev->mdev->priv.reg_pages));
868}
869
870static ssize_t show_hca(struct device *device, struct device_attribute *attr,
871 char *buf)
872{
873 struct mlx5_ib_dev *dev =
874 container_of(device, struct mlx5_ib_dev, ib_dev.dev);
875 return sprintf(buf, "MT%d\n", dev->mdev->pdev->device);

--- 508 unchanged lines hidden (view full) ---

1384 (1ull << IB_USER_VERBS_CMD_CLOSE_XRCD);
1385 }
1386
1387 err = init_node_data(dev);
1388 if (err)
1389 goto err_eqs;
1390
1391 mutex_init(&dev->cap_mask_mutex);
868}
869
870static ssize_t show_hca(struct device *device, struct device_attribute *attr,
871 char *buf)
872{
873 struct mlx5_ib_dev *dev =
874 container_of(device, struct mlx5_ib_dev, ib_dev.dev);
875 return sprintf(buf, "MT%d\n", dev->mdev->pdev->device);

--- 508 unchanged lines hidden (view full) ---

1384 (1ull << IB_USER_VERBS_CMD_CLOSE_XRCD);
1385 }
1386
1387 err = init_node_data(dev);
1388 if (err)
1389 goto err_eqs;
1390
1391 mutex_init(&dev->cap_mask_mutex);
1392 spin_lock_init(&dev->mr_lock);
1393
1394 err = create_dev_resources(&dev->devr);
1395 if (err)
1396 goto err_eqs;
1397
1392
1393 err = create_dev_resources(&dev->devr);
1394 if (err)
1395 goto err_eqs;
1396
1398 err = ib_register_device(&dev->ib_dev, NULL);
1397 err = mlx5_ib_odp_init_one(dev);
1399 if (err)
1400 goto err_rsrc;
1401
1398 if (err)
1399 goto err_rsrc;
1400
1401 err = ib_register_device(&dev->ib_dev, NULL);
1402 if (err)
1403 goto err_odp;
1404
1402 err = create_umr_res(dev);
1403 if (err)
1404 goto err_dev;
1405
1406 for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) {
1407 err = device_create_file(&dev->ib_dev.dev,
1408 mlx5_class_attributes[i]);
1409 if (err)

--- 5 unchanged lines hidden (view full) ---

1415 return dev;
1416
1417err_umrc:
1418 destroy_umrc_res(dev);
1419
1420err_dev:
1421 ib_unregister_device(&dev->ib_dev);
1422
1405 err = create_umr_res(dev);
1406 if (err)
1407 goto err_dev;
1408
1409 for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) {
1410 err = device_create_file(&dev->ib_dev.dev,
1411 mlx5_class_attributes[i]);
1412 if (err)

--- 5 unchanged lines hidden (view full) ---

1418 return dev;
1419
1420err_umrc:
1421 destroy_umrc_res(dev);
1422
1423err_dev:
1424 ib_unregister_device(&dev->ib_dev);
1425
1426err_odp:
1427 mlx5_ib_odp_remove_one(dev);
1428
1423err_rsrc:
1424 destroy_dev_resources(&dev->devr);
1425
1426err_eqs:
1427 free_comp_eqs(dev);
1428
1429err_dealloc:
1430 ib_dealloc_device((struct ib_device *)dev);
1431
1432 return NULL;
1433}
1434
1435static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
1436{
1437 struct mlx5_ib_dev *dev = context;
1429err_rsrc:
1430 destroy_dev_resources(&dev->devr);
1431
1432err_eqs:
1433 free_comp_eqs(dev);
1434
1435err_dealloc:
1436 ib_dealloc_device((struct ib_device *)dev);
1437
1438 return NULL;
1439}
1440
1441static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
1442{
1443 struct mlx5_ib_dev *dev = context;
1444
1438 ib_unregister_device(&dev->ib_dev);
1439 destroy_umrc_res(dev);
1445 ib_unregister_device(&dev->ib_dev);
1446 destroy_umrc_res(dev);
1447 mlx5_ib_odp_remove_one(dev);
1440 destroy_dev_resources(&dev->devr);
1441 free_comp_eqs(dev);
1442 ib_dealloc_device(&dev->ib_dev);
1443}
1444
1445static struct mlx5_interface mlx5_ib_interface = {
1446 .add = mlx5_ib_add,
1447 .remove = mlx5_ib_remove,
1448 .event = mlx5_ib_event,
1449};
1450
1451static int __init mlx5_ib_init(void)
1452{
1448 destroy_dev_resources(&dev->devr);
1449 free_comp_eqs(dev);
1450 ib_dealloc_device(&dev->ib_dev);
1451}
1452
1453static struct mlx5_interface mlx5_ib_interface = {
1454 .add = mlx5_ib_add,
1455 .remove = mlx5_ib_remove,
1456 .event = mlx5_ib_event,
1457};
1458
1459static int __init mlx5_ib_init(void)
1460{
1461 int err;
1462
1453 if (deprecated_prof_sel != 2)
1454 pr_warn("prof_sel is deprecated for mlx5_ib, set it for mlx5_core\n");
1455
1463 if (deprecated_prof_sel != 2)
1464 pr_warn("prof_sel is deprecated for mlx5_ib, set it for mlx5_core\n");
1465
1456 return mlx5_register_interface(&mlx5_ib_interface);
1466 err = mlx5_ib_odp_init();
1467 if (err)
1468 return err;
1469
1470 err = mlx5_register_interface(&mlx5_ib_interface);
1471 if (err)
1472 goto clean_odp;
1473
1474 return err;
1475
1476clean_odp:
1477 mlx5_ib_odp_cleanup();
1478 return err;
1457}
1458
1459static void __exit mlx5_ib_cleanup(void)
1460{
1461 mlx5_unregister_interface(&mlx5_ib_interface);
1479}
1480
1481static void __exit mlx5_ib_cleanup(void)
1482{
1483 mlx5_unregister_interface(&mlx5_ib_interface);
1484 mlx5_ib_odp_cleanup();
1462}
1463
1464module_init(mlx5_ib_init);
1465module_exit(mlx5_ib_cleanup);
1485}
1486
1487module_init(mlx5_ib_init);
1488module_exit(mlx5_ib_cleanup);