diff options
Diffstat (limited to 'drivers/infiniband/core/device.c')
-rw-r--r-- | drivers/infiniband/core/device.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 17639117afc6..179e8134d57f 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c | |||
@@ -672,14 +672,20 @@ EXPORT_SYMBOL(ib_query_port); | |||
672 | * @port_num:Port number to query | 672 | * @port_num:Port number to query |
673 | * @index:GID table index to query | 673 | * @index:GID table index to query |
674 | * @gid:Returned GID | 674 | * @gid:Returned GID |
675 | * @attr: Returned GID attributes related to this GID index (only in RoCE). | ||
676 | * NULL means ignore. | ||
675 | * | 677 | * |
676 | * ib_query_gid() fetches the specified GID table entry. | 678 | * ib_query_gid() fetches the specified GID table entry. |
677 | */ | 679 | */ |
678 | int ib_query_gid(struct ib_device *device, | 680 | int ib_query_gid(struct ib_device *device, |
679 | u8 port_num, int index, union ib_gid *gid) | 681 | u8 port_num, int index, union ib_gid *gid, |
682 | struct ib_gid_attr *attr) | ||
680 | { | 683 | { |
681 | if (rdma_cap_roce_gid_table(device, port_num)) | 684 | if (rdma_cap_roce_gid_table(device, port_num)) |
682 | return ib_get_cached_gid(device, port_num, index, gid); | 685 | return ib_get_cached_gid(device, port_num, index, gid, attr); |
686 | |||
687 | if (attr) | ||
688 | return -EINVAL; | ||
683 | 689 | ||
684 | return device->query_gid(device, port_num, index, gid); | 690 | return device->query_gid(device, port_num, index, gid); |
685 | } | 691 | } |
@@ -819,27 +825,28 @@ EXPORT_SYMBOL(ib_modify_port); | |||
819 | * a specified GID value occurs. | 825 | * a specified GID value occurs. |
820 | * @device: The device to query. | 826 | * @device: The device to query. |
821 | * @gid: The GID value to search for. | 827 | * @gid: The GID value to search for. |
828 | * @ndev: The ndev related to the GID to search for. | ||
822 | * @port_num: The port number of the device where the GID value was found. | 829 | * @port_num: The port number of the device where the GID value was found. |
823 | * @index: The index into the GID table where the GID was found. This | 830 | * @index: The index into the GID table where the GID was found. This |
824 | * parameter may be NULL. | 831 | * parameter may be NULL. |
825 | */ | 832 | */ |
826 | int ib_find_gid(struct ib_device *device, union ib_gid *gid, | 833 | int ib_find_gid(struct ib_device *device, union ib_gid *gid, |
827 | u8 *port_num, u16 *index) | 834 | struct net_device *ndev, u8 *port_num, u16 *index) |
828 | { | 835 | { |
829 | union ib_gid tmp_gid; | 836 | union ib_gid tmp_gid; |
830 | int ret, port, i; | 837 | int ret, port, i; |
831 | 838 | ||
832 | for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { | 839 | for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) { |
833 | if (rdma_cap_roce_gid_table(device, port)) { | 840 | if (rdma_cap_roce_gid_table(device, port)) { |
834 | if (!ib_cache_gid_find_by_port(device, gid, port, | 841 | if (!ib_find_cached_gid_by_port(device, gid, port, |
835 | NULL, index)) { | 842 | ndev, index)) { |
836 | *port_num = port; | 843 | *port_num = port; |
837 | return 0; | 844 | return 0; |
838 | } | 845 | } |
839 | } | 846 | } |
840 | 847 | ||
841 | for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { | 848 | for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) { |
842 | ret = ib_query_gid(device, port, i, &tmp_gid); | 849 | ret = ib_query_gid(device, port, i, &tmp_gid, NULL); |
843 | if (ret) | 850 | if (ret) |
844 | return ret; | 851 | return ret; |
845 | if (!memcmp(&tmp_gid, gid, sizeof *gid)) { | 852 | if (!memcmp(&tmp_gid, gid, sizeof *gid)) { |