IB/mad: Add user space RMPP support
Using the new registration mechanism, define a flag that indicates the user wishes to process RMPP messages in user space rather than have the kernel process them. Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
0f29b46d49
commit
1471cb6ca6
4 changed files with 89 additions and 37 deletions
|
@ -506,13 +506,15 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
|
|||
|
||||
rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data;
|
||||
hdr_len = ib_get_mad_data_offset(rmpp_mad->mad_hdr.mgmt_class);
|
||||
if (!ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)) {
|
||||
copy_offset = IB_MGMT_MAD_HDR;
|
||||
rmpp_active = 0;
|
||||
} else {
|
||||
|
||||
if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
|
||||
&& ib_mad_kernel_rmpp_agent(agent)) {
|
||||
copy_offset = IB_MGMT_RMPP_HDR;
|
||||
rmpp_active = ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
|
||||
IB_MGMT_RMPP_FLAG_ACTIVE;
|
||||
IB_MGMT_RMPP_FLAG_ACTIVE;
|
||||
} else {
|
||||
copy_offset = IB_MGMT_MAD_HDR;
|
||||
rmpp_active = 0;
|
||||
}
|
||||
|
||||
data_len = count - hdr_size(file) - hdr_len;
|
||||
|
@ -558,14 +560,22 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
|
|||
rmpp_mad->mad_hdr.tid = *tid;
|
||||
}
|
||||
|
||||
spin_lock_irq(&file->send_lock);
|
||||
ret = is_duplicate(file, packet);
|
||||
if (!ret)
|
||||
if (!ib_mad_kernel_rmpp_agent(agent)
|
||||
&& ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
|
||||
&& (ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) {
|
||||
spin_lock_irq(&file->send_lock);
|
||||
list_add_tail(&packet->list, &file->send_list);
|
||||
spin_unlock_irq(&file->send_lock);
|
||||
if (ret) {
|
||||
ret = -EINVAL;
|
||||
goto err_msg;
|
||||
spin_unlock_irq(&file->send_lock);
|
||||
} else {
|
||||
spin_lock_irq(&file->send_lock);
|
||||
ret = is_duplicate(file, packet);
|
||||
if (!ret)
|
||||
list_add_tail(&packet->list, &file->send_list);
|
||||
spin_unlock_irq(&file->send_lock);
|
||||
if (ret) {
|
||||
ret = -EINVAL;
|
||||
goto err_msg;
|
||||
}
|
||||
}
|
||||
|
||||
ret = ib_post_send_mad(packet->msg, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue