diff options
Diffstat (limited to 'drivers/infiniband/core/sa_query.c')
-rw-r--r-- | drivers/infiniband/core/sa_query.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 8c014b33d8e0..dcdaa79e3f0f 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -1007,26 +1007,29 @@ int ib_init_ah_from_path(struct ib_device *device, u8 port_num, | |||
1007 | force_grh = rdma_cap_eth_ah(device, port_num); | 1007 | force_grh = rdma_cap_eth_ah(device, port_num); |
1008 | 1008 | ||
1009 | if (rec->hop_limit > 1 || force_grh) { | 1009 | if (rec->hop_limit > 1 || force_grh) { |
1010 | struct net_device *ndev = ib_get_ndev_from_path(rec); | ||
1011 | |||
1010 | ah_attr->ah_flags = IB_AH_GRH; | 1012 | ah_attr->ah_flags = IB_AH_GRH; |
1011 | ah_attr->grh.dgid = rec->dgid; | 1013 | ah_attr->grh.dgid = rec->dgid; |
1012 | 1014 | ||
1013 | ret = ib_find_cached_gid(device, &rec->sgid, &port_num, | 1015 | ret = ib_find_cached_gid(device, &rec->sgid, ndev, &port_num, |
1014 | &gid_index); | 1016 | &gid_index); |
1015 | if (ret) | 1017 | if (ret) { |
1018 | if (ndev) | ||
1019 | dev_put(ndev); | ||
1016 | return ret; | 1020 | return ret; |
1021 | } | ||
1017 | 1022 | ||
1018 | ah_attr->grh.sgid_index = gid_index; | 1023 | ah_attr->grh.sgid_index = gid_index; |
1019 | ah_attr->grh.flow_label = be32_to_cpu(rec->flow_label); | 1024 | ah_attr->grh.flow_label = be32_to_cpu(rec->flow_label); |
1020 | ah_attr->grh.hop_limit = rec->hop_limit; | 1025 | ah_attr->grh.hop_limit = rec->hop_limit; |
1021 | ah_attr->grh.traffic_class = rec->traffic_class; | 1026 | ah_attr->grh.traffic_class = rec->traffic_class; |
1027 | if (ndev) | ||
1028 | dev_put(ndev); | ||
1022 | } | 1029 | } |
1023 | if (force_grh) { | 1030 | if (force_grh) { |
1024 | memcpy(ah_attr->dmac, rec->dmac, ETH_ALEN); | 1031 | memcpy(ah_attr->dmac, rec->dmac, ETH_ALEN); |
1025 | ah_attr->vlan_id = rec->vlan_id; | ||
1026 | } else { | ||
1027 | ah_attr->vlan_id = 0xffff; | ||
1028 | } | 1032 | } |
1029 | |||
1030 | return 0; | 1033 | return 0; |
1031 | } | 1034 | } |
1032 | EXPORT_SYMBOL(ib_init_ah_from_path); | 1035 | EXPORT_SYMBOL(ib_init_ah_from_path); |
@@ -1150,9 +1153,9 @@ static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query, | |||
1150 | 1153 | ||
1151 | ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table), | 1154 | ib_unpack(path_rec_table, ARRAY_SIZE(path_rec_table), |
1152 | mad->data, &rec); | 1155 | mad->data, &rec); |
1153 | rec.vlan_id = 0xffff; | 1156 | rec.net = NULL; |
1157 | rec.ifindex = 0; | ||
1154 | memset(rec.dmac, 0, ETH_ALEN); | 1158 | memset(rec.dmac, 0, ETH_ALEN); |
1155 | memset(rec.smac, 0, ETH_ALEN); | ||
1156 | query->callback(status, &rec, query->context); | 1159 | query->callback(status, &rec, query->context); |
1157 | } else | 1160 | } else |
1158 | query->callback(status, NULL, query->context); | 1161 | query->callback(status, NULL, query->context); |