main.c (4a95857a875e887cc958c92fe9d2cde6184d2ec0) | main.c (45808361d4491217de11cdf0661d657081f8f422) |
---|---|
1/* 2 * Copyright (c) 2006, 2007 Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved. 4 * 5 * This software is available to you under a choice of one of two 6 * licenses. You may choose to be licensed under the terms of the GNU 7 * General Public License (GPL) Version 2, available from the file 8 * COPYING in the main directory of this source tree, or the --- 2010 unchanged lines hidden (view full) --- 2019 return err; 2020} 2021 2022static ssize_t hca_type_show(struct device *device, 2023 struct device_attribute *attr, char *buf) 2024{ 2025 struct mlx4_ib_dev *dev = 2026 rdma_device_to_drv_device(device, struct mlx4_ib_dev, ib_dev); | 1/* 2 * Copyright (c) 2006, 2007 Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved. 4 * 5 * This software is available to you under a choice of one of two 6 * licenses. You may choose to be licensed under the terms of the GNU 7 * General Public License (GPL) Version 2, available from the file 8 * COPYING in the main directory of this source tree, or the --- 2010 unchanged lines hidden (view full) --- 2019 return err; 2020} 2021 2022static ssize_t hca_type_show(struct device *device, 2023 struct device_attribute *attr, char *buf) 2024{ 2025 struct mlx4_ib_dev *dev = 2026 rdma_device_to_drv_device(device, struct mlx4_ib_dev, ib_dev); |
2027 return sprintf(buf, "MT%d\n", dev->dev->persist->pdev->device); | 2027 2028 return sysfs_emit(buf, "MT%d\n", dev->dev->persist->pdev->device); |
2028} 2029static DEVICE_ATTR_RO(hca_type); 2030 2031static ssize_t hw_rev_show(struct device *device, 2032 struct device_attribute *attr, char *buf) 2033{ 2034 struct mlx4_ib_dev *dev = 2035 rdma_device_to_drv_device(device, struct mlx4_ib_dev, ib_dev); | 2029} 2030static DEVICE_ATTR_RO(hca_type); 2031 2032static ssize_t hw_rev_show(struct device *device, 2033 struct device_attribute *attr, char *buf) 2034{ 2035 struct mlx4_ib_dev *dev = 2036 rdma_device_to_drv_device(device, struct mlx4_ib_dev, ib_dev); |
2036 return sprintf(buf, "%x\n", dev->dev->rev_id); | 2037 2038 return sysfs_emit(buf, "%x\n", dev->dev->rev_id); |
2037} 2038static DEVICE_ATTR_RO(hw_rev); 2039 2040static ssize_t board_id_show(struct device *device, 2041 struct device_attribute *attr, char *buf) 2042{ 2043 struct mlx4_ib_dev *dev = 2044 rdma_device_to_drv_device(device, struct mlx4_ib_dev, ib_dev); 2045 | 2039} 2040static DEVICE_ATTR_RO(hw_rev); 2041 2042static ssize_t board_id_show(struct device *device, 2043 struct device_attribute *attr, char *buf) 2044{ 2045 struct mlx4_ib_dev *dev = 2046 rdma_device_to_drv_device(device, struct mlx4_ib_dev, ib_dev); 2047 |
2046 return sprintf(buf, "%.*s\n", MLX4_BOARD_ID_LEN, 2047 dev->dev->board_id); | 2048 return sysfs_emit(buf, "%.*s\n", MLX4_BOARD_ID_LEN, dev->dev->board_id); |
2048} 2049static DEVICE_ATTR_RO(board_id); 2050 2051static struct attribute *mlx4_class_attributes[] = { 2052 &dev_attr_hw_rev.attr, 2053 &dev_attr_hca_type.attr, 2054 &dev_attr_board_id.attr, 2055 NULL --- 596 unchanged lines hidden (view full) --- 2652 ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; 2653 ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; 2654 ibdev->num_ports = num_ports; 2655 ibdev->ib_dev.phys_port_cnt = mlx4_is_bonded(dev) ? 2656 1 : ibdev->num_ports; 2657 ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; 2658 ibdev->ib_dev.dev.parent = &dev->persist->pdev->dev; 2659 | 2049} 2050static DEVICE_ATTR_RO(board_id); 2051 2052static struct attribute *mlx4_class_attributes[] = { 2053 &dev_attr_hw_rev.attr, 2054 &dev_attr_hca_type.attr, 2055 &dev_attr_board_id.attr, 2056 NULL --- 596 unchanged lines hidden (view full) --- 2653 ibdev->ib_dev.node_type = RDMA_NODE_IB_CA; 2654 ibdev->ib_dev.local_dma_lkey = dev->caps.reserved_lkey; 2655 ibdev->num_ports = num_ports; 2656 ibdev->ib_dev.phys_port_cnt = mlx4_is_bonded(dev) ? 2657 1 : ibdev->num_ports; 2658 ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; 2659 ibdev->ib_dev.dev.parent = &dev->persist->pdev->dev; 2660 |
2660 ibdev->ib_dev.uverbs_cmd_mask = 2661 (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) | 2662 (1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) | 2663 (1ull << IB_USER_VERBS_CMD_QUERY_PORT) | 2664 (1ull << IB_USER_VERBS_CMD_ALLOC_PD) | 2665 (1ull << IB_USER_VERBS_CMD_DEALLOC_PD) | 2666 (1ull << IB_USER_VERBS_CMD_REG_MR) | 2667 (1ull << IB_USER_VERBS_CMD_REREG_MR) | 2668 (1ull << IB_USER_VERBS_CMD_DEREG_MR) | 2669 (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) | 2670 (1ull << IB_USER_VERBS_CMD_CREATE_CQ) | 2671 (1ull << IB_USER_VERBS_CMD_RESIZE_CQ) | 2672 (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) | 2673 (1ull << IB_USER_VERBS_CMD_CREATE_QP) | 2674 (1ull << IB_USER_VERBS_CMD_MODIFY_QP) | 2675 (1ull << IB_USER_VERBS_CMD_QUERY_QP) | 2676 (1ull << IB_USER_VERBS_CMD_DESTROY_QP) | 2677 (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | 2678 (1ull << IB_USER_VERBS_CMD_DETACH_MCAST) | 2679 (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) | 2680 (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) | 2681 (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | 2682 (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | 2683 (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) | 2684 (1ull << IB_USER_VERBS_CMD_OPEN_QP); 2685 | |
2686 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops); | 2661 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_ops); |
2687 ibdev->ib_dev.uverbs_ex_cmd_mask |= 2688 (1ull << IB_USER_VERBS_EX_CMD_MODIFY_CQ) | 2689 (1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE) | 2690 (1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) | 2691 (1ull << IB_USER_VERBS_EX_CMD_CREATE_QP); | |
2692 2693 if ((dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) && 2694 ((mlx4_ib_port_link_layer(&ibdev->ib_dev, 1) == 2695 IB_LINK_LAYER_ETHERNET) || 2696 (mlx4_ib_port_link_layer(&ibdev->ib_dev, 2) == | 2662 2663 if ((dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) && 2664 ((mlx4_ib_port_link_layer(&ibdev->ib_dev, 1) == 2665 IB_LINK_LAYER_ETHERNET) || 2666 (mlx4_ib_port_link_layer(&ibdev->ib_dev, 2) == |
2697 IB_LINK_LAYER_ETHERNET))) { 2698 ibdev->ib_dev.uverbs_ex_cmd_mask |= 2699 (1ull << IB_USER_VERBS_EX_CMD_CREATE_WQ) | 2700 (1ull << IB_USER_VERBS_EX_CMD_MODIFY_WQ) | 2701 (1ull << IB_USER_VERBS_EX_CMD_DESTROY_WQ) | 2702 (1ull << IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL) | 2703 (1ull << IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL); | 2667 IB_LINK_LAYER_ETHERNET))) |
2704 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_wq_ops); | 2668 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_wq_ops); |
2705 } | |
2706 2707 if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW || | 2669 2670 if (dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW || |
2708 dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) { 2709 ibdev->ib_dev.uverbs_cmd_mask |= 2710 (1ull << IB_USER_VERBS_CMD_ALLOC_MW) | 2711 (1ull << IB_USER_VERBS_CMD_DEALLOC_MW); | 2671 dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) |
2712 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_mw_ops); | 2672 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_mw_ops); |
2713 } | |
2714 2715 if (dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC) { | 2673 2674 if (dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC) { |
2716 ibdev->ib_dev.uverbs_cmd_mask |= 2717 (1ull << IB_USER_VERBS_CMD_OPEN_XRCD) | 2718 (1ull << IB_USER_VERBS_CMD_CLOSE_XRCD); | |
2719 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_xrc_ops); 2720 } 2721 2722 if (check_flow_steering_support(dev)) { 2723 ibdev->steering_support = MLX4_STEERING_MODE_DEVICE_MANAGED; | 2675 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_xrc_ops); 2676 } 2677 2678 if (check_flow_steering_support(dev)) { 2679 ibdev->steering_support = MLX4_STEERING_MODE_DEVICE_MANAGED; |
2724 ibdev->ib_dev.uverbs_ex_cmd_mask |= 2725 (1ull << IB_USER_VERBS_EX_CMD_CREATE_FLOW) | 2726 (1ull << IB_USER_VERBS_EX_CMD_DESTROY_FLOW); | |
2727 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_fs_ops); 2728 } 2729 2730 if (!dev->caps.userspace_caps) 2731 ibdev->ib_dev.ops.uverbs_abi_ver = 2732 MLX4_IB_UVERBS_NO_DEV_CAPS_ABI_VERSION; 2733 2734 mlx4_ib_alloc_eqs(dev, ibdev); --- 641 unchanged lines hidden --- | 2680 ib_set_device_ops(&ibdev->ib_dev, &mlx4_ib_dev_fs_ops); 2681 } 2682 2683 if (!dev->caps.userspace_caps) 2684 ibdev->ib_dev.ops.uverbs_abi_ver = 2685 MLX4_IB_UVERBS_NO_DEV_CAPS_ABI_VERSION; 2686 2687 mlx4_ib_alloc_eqs(dev, ibdev); --- 641 unchanged lines hidden --- |