diff options
author | Matan Barak <matanb@mellanox.com> | 2015-10-15 11:38:45 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-10-21 23:48:17 -0400 |
commit | 55ee3ab2e49a9ead850722ef47698243dd226d16 (patch) | |
tree | 5e1d6c782a7ca0f41878e49deb94e9dd321d7418 | |
parent | fbfb6625ea2d1bd535db03838df381768a2d6865 (diff) |
IB/core: Add netdev and gid attributes paramteres to cache
Adding an ability to query the IB cache by a netdev and get the
attributes of a GID. These parameters are necessary in order to
successfully resolve the required GID (when the netdevice is known)
and get the Ethernet L2 attributes from a GID.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-By: Devesh Sharma <devesh.sharma@avagotech.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/core/cache.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/core/cm.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/core/cma.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/core/device.c | 17 | ||||
-rw-r--r-- | drivers/infiniband/core/mad.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/core/multicast.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/core/sa_query.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/core/verbs.c | 7 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_av.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srpt/ib_srpt.c | 3 | ||||
-rw-r--r-- | include/rdma/ib_cache.h | 13 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 5 |
19 files changed, 60 insertions, 38 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 87471ef37198..5c054072ef20 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c | |||
@@ -649,21 +649,23 @@ static int gid_table_setup_one(struct ib_device *ib_dev) | |||
649 | int ib_get_cached_gid(struct ib_device *device, | 649 | int ib_get_cached_gid(struct ib_device *device, |
650 | u8 port_num, | 650 | u8 port_num, |
651 | int index, | 651 | int index, |
652 | union ib_gid *gid) | 652 | union ib_gid *gid, |
653 | struct ib_gid_attr *gid_attr) | ||
653 | { | 654 | { |
654 | if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) | 655 | if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device)) |
655 | return -EINVAL; | 656 | return -EINVAL; |
656 | 657 | ||
657 | return __ib_cache_gid_get(device, port_num, index, gid, NULL); | 658 | return __ib_cache_gid_get(device, port_num, index, gid, gid_attr); |
658 | } | 659 | } |
659 | EXPORT_SYMBOL(ib_get_cached_gid); | 660 | EXPORT_SYMBOL(ib_get_cached_gid); |
660 | 661 | ||
661 | int ib_find_cached_gid(struct ib_device *device, | 662 | int ib_find_cached_gid(struct ib_device *device, |
662 | const union ib_gid *gid, | 663 | const union ib_gid *gid, |
664 | struct net_device *ndev, | ||
663 | u8 *port_num, | 665 | u8 *port_num, |
664 | u16 *index) | 666 | u16 *index) |
665 | { | 667 | { |
666 | return ib_cache_gid_find(device, gid, NULL, port_num, index); | 668 | return ib_cache_gid_find(device, gid, ndev, port_num, index); |
667 | } | 669 | } |
668 | EXPORT_SYMBOL(ib_find_cached_gid); | 670 | EXPORT_SYMBOL(ib_find_cached_gid); |
669 | 671 | ||
@@ -845,7 +847,7 @@ static void ib_cache_update(struct ib_device *device, | |||
845 | if (!use_roce_gid_table) { | 847 | if (!use_roce_gid_table) { |
846 | for (i = 0; i < gid_cache->table_len; ++i) { | 848 | for (i = 0; i < gid_cache->table_len; ++i) { |
847 | ret = ib_query_gid(device, port, i, | 849 | ret = ib_query_gid(device, port, i, |
848 | gid_cache->table + i); | 850 | gid_cache->table + i, NULL); |
849 | if (ret) { | 851 | if (ret) { |
850 | printk(KERN_WARNING "ib_query_gid failed (%d) for %s (index %d)\n", | 852 | printk(KERN_WARNING "ib_query_gid failed (%d) for %s (index %d)\n", |
851 | ret, device->name, i); | 853 | ret, device->name, i); |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 4f918b929eca..2d8a0e4c42d6 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -365,7 +365,7 @@ static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av) | |||
365 | read_lock_irqsave(&cm.device_lock, flags); | 365 | read_lock_irqsave(&cm.device_lock, flags); |
366 | list_for_each_entry(cm_dev, &cm.device_list, list) { | 366 | list_for_each_entry(cm_dev, &cm.device_list, list) { |
367 | if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid, | 367 | if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid, |
368 | &p, NULL)) { | 368 | NULL, &p, NULL)) { |
369 | port = cm_dev->port[p-1]; | 369 | port = cm_dev->port[p-1]; |
370 | break; | 370 | break; |
371 | } | 371 | } |
@@ -1643,7 +1643,8 @@ static int cm_req_handler(struct cm_work *work) | |||
1643 | ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); | 1643 | ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av); |
1644 | if (ret) { | 1644 | if (ret) { |
1645 | ib_get_cached_gid(work->port->cm_dev->ib_device, | 1645 | ib_get_cached_gid(work->port->cm_dev->ib_device, |
1646 | work->port->port_num, 0, &work->path[0].sgid); | 1646 | work->port->port_num, 0, &work->path[0].sgid, |
1647 | NULL); | ||
1647 | ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID, | 1648 | ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID, |
1648 | &work->path[0].sgid, sizeof work->path[0].sgid, | 1649 | &work->path[0].sgid, sizeof work->path[0].sgid, |
1649 | NULL, 0); | 1650 | NULL, 0); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 36b12d560e17..e4d9d75ffc08 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -438,7 +438,7 @@ static inline int cma_validate_port(struct ib_device *device, u8 port, | |||
438 | if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port)) | 438 | if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port)) |
439 | return ret; | 439 | return ret; |
440 | 440 | ||
441 | ret = ib_find_cached_gid(device, gid, &found_port, NULL); | 441 | ret = ib_find_cached_gid(device, gid, NULL, &found_port, NULL); |
442 | if (port != found_port) | 442 | if (port != found_port) |
443 | return -ENODEV; | 443 | return -ENODEV; |
444 | 444 | ||
@@ -531,7 +531,9 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
531 | if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index)) | 531 | if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index)) |
532 | continue; | 532 | continue; |
533 | 533 | ||
534 | for (i = 0; !ib_get_cached_gid(cur_dev->device, p, i, &gid); i++) { | 534 | for (i = 0; !ib_get_cached_gid(cur_dev->device, p, i, |
535 | &gid, NULL); | ||
536 | i++) { | ||
535 | if (!memcmp(&gid, dgid, sizeof(gid))) { | 537 | if (!memcmp(&gid, dgid, sizeof(gid))) { |
536 | cma_dev = cur_dev; | 538 | cma_dev = cur_dev; |
537 | sgid = gid; | 539 | sgid = gid; |
@@ -718,7 +720,7 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv, | |||
718 | goto out; | 720 | goto out; |
719 | 721 | ||
720 | ret = ib_query_gid(id_priv->id.device, id_priv->id.port_num, | 722 | ret = ib_query_gid(id_priv->id.device, id_priv->id.port_num, |
721 | qp_attr.ah_attr.grh.sgid_index, &sgid); | 723 | qp_attr.ah_attr.grh.sgid_index, &sgid, NULL); |
722 | if (ret) | 724 | if (ret) |
723 | goto out; | 725 | goto out; |
724 | 726 | ||
@@ -2426,7 +2428,7 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv) | |||
2426 | p = 1; | 2428 | p = 1; |
2427 | 2429 | ||
2428 | port_found: | 2430 | port_found: |
2429 | ret = ib_get_cached_gid(cma_dev->device, p, 0, &gid); | 2431 | ret = ib_get_cached_gid(cma_dev->device, p, 0, &gid, NULL); |
2430 | if (ret) | 2432 | if (ret) |
2431 | goto out; | 2433 | goto out; |
2432 | 2434 | ||
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 17639117afc6..f22ce487fd3a 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,12 +825,13 @@ 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; |
@@ -832,14 +839,14 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, | |||
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_cache_gid_find_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)) { |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 4b5c72311deb..fa63b89e15aa 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -1877,7 +1877,7 @@ static inline int rcv_has_same_gid(const struct ib_mad_agent_private *mad_agent_ | |||
1877 | ((1 << lmc) - 1))); | 1877 | ((1 << lmc) - 1))); |
1878 | } else { | 1878 | } else { |
1879 | if (ib_get_cached_gid(device, port_num, | 1879 | if (ib_get_cached_gid(device, port_num, |
1880 | attr.grh.sgid_index, &sgid)) | 1880 | attr.grh.sgid_index, &sgid, NULL)) |
1881 | return 0; | 1881 | return 0; |
1882 | return !memcmp(sgid.raw, rwc->recv_buf.grh->dgid.raw, | 1882 | return !memcmp(sgid.raw, rwc->recv_buf.grh->dgid.raw, |
1883 | 16); | 1883 | 16); |
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c index d38d8b2b2979..bb6685fb08c6 100644 --- a/drivers/infiniband/core/multicast.c +++ b/drivers/infiniband/core/multicast.c | |||
@@ -729,7 +729,8 @@ int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num, | |||
729 | u16 gid_index; | 729 | u16 gid_index; |
730 | u8 p; | 730 | u8 p; |
731 | 731 | ||
732 | ret = ib_find_cached_gid(device, &rec->port_gid, &p, &gid_index); | 732 | ret = ib_find_cached_gid(device, &rec->port_gid, |
733 | NULL, &p, &gid_index); | ||
733 | if (ret) | 734 | if (ret) |
734 | return ret; | 735 | return ret; |
735 | 736 | ||
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 8c014b33d8e0..9a4e7891ada2 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -1010,7 +1010,7 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, | |||
1010 | ah_attr->ah_flags = IB_AH_GRH; | 1010 | ah_attr->ah_flags = IB_AH_GRH; |
1011 | ah_attr->grh.dgid = rec->dgid; | 1011 | ah_attr->grh.dgid = rec->dgid; |
1012 | 1012 | ||
1013 | ret = ib_find_cached_gid(device, &rec->sgid, &port_num, | 1013 | ret = ib_find_cached_gid(device, &rec->sgid, NULL, &port_num, |
1014 | &gid_index); | 1014 | &gid_index); |
1015 | if (ret) | 1015 | if (ret) |
1016 | return ret; | 1016 | return ret; |
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 34cdd74b0a17..b1f37d4095fa 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -289,7 +289,7 @@ static ssize_t show_port_gid(struct ib_port *p, struct port_attribute *attr, | |||
289 | union ib_gid gid; | 289 | union ib_gid gid; |
290 | ssize_t ret; | 290 | ssize_t ret; |
291 | 291 | ||
292 | ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid); | 292 | ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid, NULL); |
293 | if (ret) | 293 | if (ret) |
294 | return ret; | 294 | return ret; |
295 | 295 | ||
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index e1f2c9887f3f..6012f5e5b97c 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -344,8 +344,8 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, | |||
344 | ah_attr->ah_flags = IB_AH_GRH; | 344 | ah_attr->ah_flags = IB_AH_GRH; |
345 | ah_attr->grh.dgid = grh->sgid; | 345 | ah_attr->grh.dgid = grh->sgid; |
346 | 346 | ||
347 | ret = ib_find_cached_gid(device, &grh->dgid, &port_num, | 347 | ret = ib_find_cached_gid(device, &grh->dgid, |
348 | &gid_index); | 348 | NULL, &port_num, &gid_index); |
349 | if (ret) | 349 | if (ret) |
350 | return ret; | 350 | return ret; |
351 | 351 | ||
@@ -988,7 +988,8 @@ int ib_resolve_eth_l2_attrs(struct ib_qp *qp, | |||
988 | if ((*qp_attr_mask & IB_QP_AV) && | 988 | if ((*qp_attr_mask & IB_QP_AV) && |
989 | (rdma_cap_eth_ah(qp->device, qp_attr->ah_attr.port_num))) { | 989 | (rdma_cap_eth_ah(qp->device, qp_attr->ah_attr.port_num))) { |
990 | ret = ib_query_gid(qp->device, qp_attr->ah_attr.port_num, | 990 | ret = ib_query_gid(qp->device, qp_attr->ah_attr.port_num, |
991 | qp_attr->ah_attr.grh.sgid_index, &sgid); | 991 | qp_attr->ah_attr.grh.sgid_index, &sgid, |
992 | NULL); | ||
992 | if (ret) | 993 | if (ret) |
993 | goto out; | 994 | goto out; |
994 | if (rdma_link_local_addr((struct in6_addr *)qp_attr->ah_attr.grh.dgid.raw)) { | 995 | if (rdma_link_local_addr((struct in6_addr *)qp_attr->ah_attr.grh.dgid.raw)) { |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 8779d26d1e61..f63d5427bfc0 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -335,7 +335,7 @@ int mlx4_ib_gid_index_to_real_index(struct mlx4_ib_dev *ibdev, | |||
335 | if (!rdma_cap_roce_gid_table(&ibdev->ib_dev, port_num)) | 335 | if (!rdma_cap_roce_gid_table(&ibdev->ib_dev, port_num)) |
336 | return index; | 336 | return index; |
337 | 337 | ||
338 | ret = ib_get_cached_gid(&ibdev->ib_dev, port_num, index, &gid); | 338 | ret = ib_get_cached_gid(&ibdev->ib_dev, port_num, index, &gid, NULL); |
339 | if (ret) | 339 | if (ret) |
340 | return ret; | 340 | return ret; |
341 | 341 | ||
@@ -756,7 +756,7 @@ static int mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index, | |||
756 | if (!rdma_cap_roce_gid_table(ibdev, port)) | 756 | if (!rdma_cap_roce_gid_table(ibdev, port)) |
757 | return -ENODEV; | 757 | return -ENODEV; |
758 | 758 | ||
759 | ret = ib_get_cached_gid(ibdev, port, index, gid); | 759 | ret = ib_get_cached_gid(ibdev, port, index, gid, NULL); |
760 | if (ret == -EAGAIN) { | 760 | if (ret == -EAGAIN) { |
761 | memcpy(gid, &zgid, sizeof(*gid)); | 761 | memcpy(gid, &zgid, sizeof(*gid)); |
762 | return 0; | 762 | return 0; |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index ba25a1bfa52f..b52c9e1cdf1a 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -2269,7 +2269,8 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
2269 | } else { | 2269 | } else { |
2270 | err = ib_get_cached_gid(ib_dev, | 2270 | err = ib_get_cached_gid(ib_dev, |
2271 | be32_to_cpu(ah->av.ib.port_pd) >> 24, | 2271 | be32_to_cpu(ah->av.ib.port_pd) >> 24, |
2272 | ah->av.ib.gid_index, &sgid); | 2272 | ah->av.ib.gid_index, &sgid, |
2273 | NULL); | ||
2273 | if (err) | 2274 | if (err) |
2274 | return err; | 2275 | return err; |
2275 | } | 2276 | } |
@@ -2311,7 +2312,7 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
2311 | ib_get_cached_gid(ib_dev, | 2312 | ib_get_cached_gid(ib_dev, |
2312 | be32_to_cpu(ah->av.ib.port_pd) >> 24, | 2313 | be32_to_cpu(ah->av.ib.port_pd) >> 24, |
2313 | ah->av.ib.gid_index, | 2314 | ah->av.ib.gid_index, |
2314 | &sqp->ud_header.grh.source_gid); | 2315 | &sqp->ud_header.grh.source_gid, NULL); |
2315 | } | 2316 | } |
2316 | memcpy(sqp->ud_header.grh.destination_gid.raw, | 2317 | memcpy(sqp->ud_header.grh.destination_gid.raw, |
2317 | ah->av.ib.dgid, 16); | 2318 | ah->av.ib.dgid, 16); |
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index 32f6c6315454..bcac294042f5 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -281,7 +281,7 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | |||
281 | ib_get_cached_gid(&dev->ib_dev, | 281 | ib_get_cached_gid(&dev->ib_dev, |
282 | be32_to_cpu(ah->av->port_pd) >> 24, | 282 | be32_to_cpu(ah->av->port_pd) >> 24, |
283 | ah->av->gid_index % dev->limits.gid_table_len, | 283 | ah->av->gid_index % dev->limits.gid_table_len, |
284 | &header->grh.source_gid); | 284 | &header->grh.source_gid, NULL); |
285 | memcpy(header->grh.destination_gid.raw, | 285 | memcpy(header->grh.destination_gid.raw, |
286 | ah->av->dgid, 16); | 286 | ah->av->dgid, 16); |
287 | } | 287 | } |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 1c4e83d5d153..9bb710a402cd 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -73,7 +73,7 @@ int ocrdma_query_gid(struct ib_device *ibdev, u8 port, | |||
73 | if (index >= OCRDMA_MAX_SGID) | 73 | if (index >= OCRDMA_MAX_SGID) |
74 | return -EINVAL; | 74 | return -EINVAL; |
75 | 75 | ||
76 | ret = ib_get_cached_gid(ibdev, port, index, sgid); | 76 | ret = ib_get_cached_gid(ibdev, port, index, sgid, NULL); |
77 | if (ret == -EAGAIN) { | 77 | if (ret == -EAGAIN) { |
78 | memcpy(sgid, &zgid, sizeof(*sgid)); | 78 | memcpy(sgid, &zgid, sizeof(*sgid)); |
79 | return 0; | 79 | return 0; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index babba05d7a0e..cbb6721d0a65 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -1860,7 +1860,7 @@ static struct net_device *ipoib_add_port(const char *format, | |||
1860 | priv->dev->broadcast[8] = priv->pkey >> 8; | 1860 | priv->dev->broadcast[8] = priv->pkey >> 8; |
1861 | priv->dev->broadcast[9] = priv->pkey & 0xff; | 1861 | priv->dev->broadcast[9] = priv->pkey & 0xff; |
1862 | 1862 | ||
1863 | result = ib_query_gid(hca, port, 0, &priv->local_gid); | 1863 | result = ib_query_gid(hca, port, 0, &priv->local_gid, NULL); |
1864 | if (result) { | 1864 | if (result) { |
1865 | printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n", | 1865 | printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n", |
1866 | hca->name, port, result); | 1866 | hca->name, port, result); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index d750a86042f3..d4b97614196c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -561,7 +561,7 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
561 | } | 561 | } |
562 | priv->local_lid = port_attr.lid; | 562 | priv->local_lid = port_attr.lid; |
563 | 563 | ||
564 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) | 564 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid, NULL)) |
565 | ipoib_warn(priv, "ib_query_gid() failed\n"); | 565 | ipoib_warn(priv, "ib_query_gid() failed\n"); |
566 | else | 566 | else |
567 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); | 567 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index b481490ad257..8ba887824d05 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -3213,7 +3213,7 @@ static ssize_t srp_create_target(struct device *dev, | |||
3213 | INIT_WORK(&target->tl_err_work, srp_tl_err_work); | 3213 | INIT_WORK(&target->tl_err_work, srp_tl_err_work); |
3214 | INIT_WORK(&target->remove_work, srp_remove_work); | 3214 | INIT_WORK(&target->remove_work, srp_remove_work); |
3215 | spin_lock_init(&target->lock); | 3215 | spin_lock_init(&target->lock); |
3216 | ret = ib_query_gid(ibdev, host->port, 0, &target->sgid); | 3216 | ret = ib_query_gid(ibdev, host->port, 0, &target->sgid, NULL); |
3217 | if (ret) | 3217 | if (ret) |
3218 | goto out; | 3218 | goto out; |
3219 | 3219 | ||
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index f6fe0414139b..a7ac77a02593 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -546,7 +546,8 @@ static int srpt_refresh_port(struct srpt_port *sport) | |||
546 | sport->sm_lid = port_attr.sm_lid; | 546 | sport->sm_lid = port_attr.sm_lid; |
547 | sport->lid = port_attr.lid; | 547 | sport->lid = port_attr.lid; |
548 | 548 | ||
549 | ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid); | 549 | ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid, |
550 | NULL); | ||
550 | if (ret) | 551 | if (ret) |
551 | goto err_query_port; | 552 | goto err_query_port; |
552 | 553 | ||
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h index bd92130f4ac5..dcc9bed9b69a 100644 --- a/include/rdma/ib_cache.h +++ b/include/rdma/ib_cache.h | |||
@@ -43,6 +43,8 @@ | |||
43 | * @port_num: The port number of the device to query. | 43 | * @port_num: The port number of the device to query. |
44 | * @index: The index into the cached GID table to query. | 44 | * @index: The index into the cached GID table to query. |
45 | * @gid: The GID value found at the specified index. | 45 | * @gid: The GID value found at the specified index. |
46 | * @attr: The GID attribute found at the specified index (only in RoCE). | ||
47 | * NULL means ignore (output parameter). | ||
46 | * | 48 | * |
47 | * ib_get_cached_gid() fetches the specified GID table entry stored in | 49 | * ib_get_cached_gid() fetches the specified GID table entry stored in |
48 | * the local software cache. | 50 | * the local software cache. |
@@ -50,13 +52,15 @@ | |||
50 | int ib_get_cached_gid(struct ib_device *device, | 52 | int ib_get_cached_gid(struct ib_device *device, |
51 | u8 port_num, | 53 | u8 port_num, |
52 | int index, | 54 | int index, |
53 | union ib_gid *gid); | 55 | union ib_gid *gid, |
56 | struct ib_gid_attr *attr); | ||
54 | 57 | ||
55 | /** | 58 | /** |
56 | * ib_find_cached_gid - Returns the port number and GID table index where | 59 | * ib_find_cached_gid - Returns the port number and GID table index where |
57 | * a specified GID value occurs. | 60 | * a specified GID value occurs. |
58 | * @device: The device to query. | 61 | * @device: The device to query. |
59 | * @gid: The GID value to search for. | 62 | * @gid: The GID value to search for. |
63 | * @ndev: In RoCE, the net device of the device. NULL means ignore. | ||
60 | * @port_num: The port number of the device where the GID value was found. | 64 | * @port_num: The port number of the device where the GID value was found. |
61 | * @index: The index into the cached GID table where the GID was found. This | 65 | * @index: The index into the cached GID table where the GID was found. This |
62 | * parameter may be NULL. | 66 | * parameter may be NULL. |
@@ -64,10 +68,11 @@ int ib_get_cached_gid(struct ib_device *device, | |||
64 | * ib_find_cached_gid() searches for the specified GID value in | 68 | * ib_find_cached_gid() searches for the specified GID value in |
65 | * the local software cache. | 69 | * the local software cache. |
66 | */ | 70 | */ |
67 | int ib_find_cached_gid(struct ib_device *device, | 71 | int ib_find_cached_gid(struct ib_device *device, |
68 | const union ib_gid *gid, | 72 | const union ib_gid *gid, |
69 | u8 *port_num, | 73 | struct net_device *ndev, |
70 | u16 *index); | 74 | u8 *port_num, |
75 | u16 *index); | ||
71 | 76 | ||
72 | /** | 77 | /** |
73 | * ib_get_cached_pkey - Returns a cached PKey table entry | 78 | * ib_get_cached_pkey - Returns a cached PKey table entry |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index e1f65e204d37..98ded0b749cd 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -2177,7 +2177,8 @@ static inline bool rdma_cap_roce_gid_table(const struct ib_device *device, | |||
2177 | } | 2177 | } |
2178 | 2178 | ||
2179 | int ib_query_gid(struct ib_device *device, | 2179 | int ib_query_gid(struct ib_device *device, |
2180 | u8 port_num, int index, union ib_gid *gid); | 2180 | u8 port_num, int index, union ib_gid *gid, |
2181 | struct ib_gid_attr *attr); | ||
2181 | 2182 | ||
2182 | int ib_query_pkey(struct ib_device *device, | 2183 | int ib_query_pkey(struct ib_device *device, |
2183 | u8 port_num, u16 index, u16 *pkey); | 2184 | u8 port_num, u16 index, u16 *pkey); |
@@ -2191,7 +2192,7 @@ int ib_modify_port(struct ib_device *device, | |||
2191 | struct ib_port_modify *port_modify); | 2192 | struct ib_port_modify *port_modify); |
2192 | 2193 | ||
2193 | int ib_find_gid(struct ib_device *device, union ib_gid *gid, | 2194 | int ib_find_gid(struct ib_device *device, union ib_gid *gid, |
2194 | u8 *port_num, u16 *index); | 2195 | struct net_device *ndev, u8 *port_num, u16 *index); |
2195 | 2196 | ||
2196 | int ib_find_pkey(struct ib_device *device, | 2197 | int ib_find_pkey(struct ib_device *device, |
2197 | u8 port_num, u16 pkey, u16 *index); | 2198 | u8 port_num, u16 pkey, u16 *index); |