.. | .. |
---|
131 | 131 | struct ib_user_mad mad; |
---|
132 | 132 | }; |
---|
133 | 133 | |
---|
| 134 | +struct ib_rmpp_mad_hdr { |
---|
| 135 | + struct ib_mad_hdr mad_hdr; |
---|
| 136 | + struct ib_rmpp_hdr rmpp_hdr; |
---|
| 137 | +} __packed; |
---|
| 138 | + |
---|
134 | 139 | #define CREATE_TRACE_POINTS |
---|
135 | 140 | #include <trace/events/ib_umad.h> |
---|
136 | 141 | |
---|
.. | .. |
---|
494 | 499 | size_t count, loff_t *pos) |
---|
495 | 500 | { |
---|
496 | 501 | struct ib_umad_file *file = filp->private_data; |
---|
| 502 | + struct ib_rmpp_mad_hdr *rmpp_mad_hdr; |
---|
497 | 503 | struct ib_umad_packet *packet; |
---|
498 | 504 | struct ib_mad_agent *agent; |
---|
499 | 505 | struct rdma_ah_attr ah_attr; |
---|
500 | 506 | struct ib_ah *ah; |
---|
501 | | - struct ib_rmpp_mad *rmpp_mad; |
---|
502 | 507 | __be64 *tid; |
---|
503 | 508 | int ret, data_len, hdr_len, copy_offset, rmpp_active; |
---|
504 | 509 | u8 base_version; |
---|
.. | .. |
---|
506 | 511 | if (count < hdr_size(file) + IB_MGMT_RMPP_HDR) |
---|
507 | 512 | return -EINVAL; |
---|
508 | 513 | |
---|
509 | | - packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL); |
---|
| 514 | + packet = kzalloc(sizeof(*packet) + IB_MGMT_RMPP_HDR, GFP_KERNEL); |
---|
510 | 515 | if (!packet) |
---|
511 | 516 | return -ENOMEM; |
---|
512 | 517 | |
---|
.. | .. |
---|
560 | 565 | goto err_up; |
---|
561 | 566 | } |
---|
562 | 567 | |
---|
563 | | - rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data; |
---|
564 | | - hdr_len = ib_get_mad_data_offset(rmpp_mad->mad_hdr.mgmt_class); |
---|
| 568 | + rmpp_mad_hdr = (struct ib_rmpp_mad_hdr *)packet->mad.data; |
---|
| 569 | + hdr_len = ib_get_mad_data_offset(rmpp_mad_hdr->mad_hdr.mgmt_class); |
---|
565 | 570 | |
---|
566 | | - if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class) |
---|
| 571 | + if (ib_is_mad_class_rmpp(rmpp_mad_hdr->mad_hdr.mgmt_class) |
---|
567 | 572 | && ib_mad_kernel_rmpp_agent(agent)) { |
---|
568 | 573 | copy_offset = IB_MGMT_RMPP_HDR; |
---|
569 | | - rmpp_active = ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & |
---|
| 574 | + rmpp_active = ib_get_rmpp_flags(&rmpp_mad_hdr->rmpp_hdr) & |
---|
570 | 575 | IB_MGMT_RMPP_FLAG_ACTIVE; |
---|
571 | 576 | } else { |
---|
572 | 577 | copy_offset = IB_MGMT_MAD_HDR; |
---|
.. | .. |
---|
615 | 620 | tid = &((struct ib_mad_hdr *) packet->msg->mad)->tid; |
---|
616 | 621 | *tid = cpu_to_be64(((u64) agent->hi_tid) << 32 | |
---|
617 | 622 | (be64_to_cpup(tid) & 0xffffffff)); |
---|
618 | | - rmpp_mad->mad_hdr.tid = *tid; |
---|
| 623 | + rmpp_mad_hdr->mad_hdr.tid = *tid; |
---|
619 | 624 | } |
---|
620 | 625 | |
---|
621 | 626 | if (!ib_mad_kernel_rmpp_agent(agent) |
---|
622 | | - && ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class) |
---|
623 | | - && (ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) { |
---|
| 627 | + && ib_is_mad_class_rmpp(rmpp_mad_hdr->mad_hdr.mgmt_class) |
---|
| 628 | + && (ib_get_rmpp_flags(&rmpp_mad_hdr->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) { |
---|
624 | 629 | spin_lock_irq(&file->send_lock); |
---|
625 | 630 | list_add_tail(&packet->list, &file->send_list); |
---|
626 | 631 | spin_unlock_irq(&file->send_lock); |
---|