diff options
Diffstat (limited to 'drivers/infiniband/core/user_mad.c')
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index c069ebeba8e..8199b83052a 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -135,7 +135,7 @@ static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE); | |||
135 | 135 | ||
136 | static DEFINE_SPINLOCK(port_lock); | 136 | static DEFINE_SPINLOCK(port_lock); |
137 | static struct ib_umad_port *umad_port[IB_UMAD_MAX_PORTS]; | 137 | static struct ib_umad_port *umad_port[IB_UMAD_MAX_PORTS]; |
138 | static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS * 2); | 138 | static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS); |
139 | 139 | ||
140 | static void ib_umad_add_one(struct ib_device *device); | 140 | static void ib_umad_add_one(struct ib_device *device); |
141 | static void ib_umad_remove_one(struct ib_device *device); | 141 | static void ib_umad_remove_one(struct ib_device *device); |
@@ -231,12 +231,17 @@ static void recv_handler(struct ib_mad_agent *agent, | |||
231 | packet->mad.hdr.path_bits = mad_recv_wc->wc->dlid_path_bits; | 231 | packet->mad.hdr.path_bits = mad_recv_wc->wc->dlid_path_bits; |
232 | packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH); | 232 | packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH); |
233 | if (packet->mad.hdr.grh_present) { | 233 | if (packet->mad.hdr.grh_present) { |
234 | /* XXX parse GRH */ | 234 | struct ib_ah_attr ah_attr; |
235 | packet->mad.hdr.gid_index = 0; | 235 | |
236 | packet->mad.hdr.hop_limit = 0; | 236 | ib_init_ah_from_wc(agent->device, agent->port_num, |
237 | packet->mad.hdr.traffic_class = 0; | 237 | mad_recv_wc->wc, mad_recv_wc->recv_buf.grh, |
238 | memset(packet->mad.hdr.gid, 0, 16); | 238 | &ah_attr); |
239 | packet->mad.hdr.flow_label = 0; | 239 | |
240 | packet->mad.hdr.gid_index = ah_attr.grh.sgid_index; | ||
241 | packet->mad.hdr.hop_limit = ah_attr.grh.hop_limit; | ||
242 | packet->mad.hdr.traffic_class = ah_attr.grh.traffic_class; | ||
243 | memcpy(packet->mad.hdr.gid, &ah_attr.grh.dgid, 16); | ||
244 | packet->mad.hdr.flow_label = cpu_to_be32(ah_attr.grh.flow_label); | ||
240 | } | 245 | } |
241 | 246 | ||
242 | if (queue_packet(file, agent, packet)) | 247 | if (queue_packet(file, agent, packet)) |
@@ -473,6 +478,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, | |||
473 | if (packet->mad.hdr.grh_present) { | 478 | if (packet->mad.hdr.grh_present) { |
474 | ah_attr.ah_flags = IB_AH_GRH; | 479 | ah_attr.ah_flags = IB_AH_GRH; |
475 | memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16); | 480 | memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16); |
481 | ah_attr.grh.sgid_index = packet->mad.hdr.gid_index; | ||
476 | ah_attr.grh.flow_label = be32_to_cpu(packet->mad.hdr.flow_label); | 482 | ah_attr.grh.flow_label = be32_to_cpu(packet->mad.hdr.flow_label); |
477 | ah_attr.grh.hop_limit = packet->mad.hdr.hop_limit; | 483 | ah_attr.grh.hop_limit = packet->mad.hdr.hop_limit; |
478 | ah_attr.grh.traffic_class = packet->mad.hdr.traffic_class; | 484 | ah_attr.grh.traffic_class = packet->mad.hdr.traffic_class; |